File: _blogs_permissions.form.php

package info (click to toggle)
b2evolution 0.9.2-3%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 12,972 kB
  • ctags: 5,460
  • sloc: php: 58,989; sh: 298; makefile: 36
file content (218 lines) | stat: -rw-r--r-- 10,520 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<?php
/**
 * Displays blog properties form
 *
 * b2evolution - {@link http://b2evolution.net/}
 * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
 * @copyright (c)2003-2005 by Francois PLANQUE - {@link http://fplanque.net/}
 *
 * @package admin
 */
if( !defined('DB_USER') ) die( 'Please, do not access this page directly.' );
?>
<form action="b2blogs.php" class="fform" method="post" name="FormPerm">
	<input type="hidden" name="action" value="update" />
	<input type="hidden" name="tab" value="perm" />
	<input type="hidden" name="blog" value="<?php echo $blog; ?>" />

	<fieldset>
		<legend><?php echo T_('User permissions') ?></legend>
		<table class="grouped" cellspacing="0">
			<tr>
				<th rowspan="2"><?php /* TRANS: table header for user list */ echo T_('Login ') ?></th>
				<th rowspan="2" class="checkright"><?php /* TRANS: SHORT table header on TWO lines */ echo T_('Is<br />member') ?></th>
				<th colspan="5" class="checkright"><?php /* TRANS: SHORT table header on TWO lines */ echo T_('Can post/edit with following statuses:') ?></th>
				<th rowspan="2" class="checkright"><?php /* TRANS: SHORT table header on TWO lines */ echo T_('Delete<br />posts') ?></th>
				<th rowspan="2" class="checkright"><?php /* TRANS: SHORT table header on TWO lines */ echo T_('Edit<br />comts') ?></th>
				<th rowspan="2" class="checkright"><?php /* TRANS: SHORT table header on TWO lines */ echo T_('Edit<br />cats') ?></th>
				<th rowspan="2" class="checkright"><?php /* TRANS: SHORT table header on TWO lines */ echo T_('Edit<br />blog') ?></th>
				<th rowspan="2" class="checkright">&nbsp;</th>
			</tr>
			<tr>
				<th class="checkright"><?php echo T_('Published') ?></th>
				<th class="checkright"><?php echo T_('Protected') ?></th>
				<th class="checkright"><?php echo T_('Private') ?></th>
				<th class="checkright"><?php echo T_('Draft') ?></th>
				<th class="checkright"><?php echo T_('Deprecated') ?></th>
			</tr>
			<tr class="group">
				<td colspan="12">
					<strong><?php echo T_('Members') ?></strong>
				</td>
			</tr>
			<?php
				$query = "SELECT ID, user_login, bloguser_perm_poststatuses, bloguser_ismember,
													bloguser_perm_comments, bloguser_perm_delpost, bloguser_perm_cats,
													bloguser_perm_properties
									FROM $tableusers INNER JOIN $tableblogusers
													ON ID = bloguser_user_ID
									WHERE bloguser_blog_ID = $blog
									ORDER BY user_login";
				$rows = $DB->get_results( $query, ARRAY_A );
				$members = array();
				$i = 0;  // incemental counter (for "check all" span IDs)
				if( count($rows) ) foreach( $rows as $loop_row )
				{	// Go through users:
					$members[] = $loop_row['ID'];
					$perm_post = explode( ',', $loop_row['bloguser_perm_poststatuses'] );
					?>
					<tr <?php if( $i%2 == 1) echo 'class="odd"'; ?>>
						<td><?php echo format_to_output( $loop_row['user_login'], 'htmlbody' ); ?></td>
						<td class="center">
							<input id="checkallspan_state_<?php echo $i ?>" type="checkbox" name="blog_ismember_<?php echo $loop_row['ID'] ?>"
								checked="checked" onclick="setcheckallspan(<?php echo $i ?>, this.checked)"
								value="1" title="<?php echo T_('Permission to read protected posts') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_published_<?php echo $loop_row['ID'] ?>"
								<?php if( in_array( 'published', $perm_post ) ) { ?>
								checked="checked"
								<?php } ?>
								value="1" title="<?php echo T_('Permission to post into this blog with private status') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_protected_<?php echo $loop_row['ID'] ?>"
								<?php if( in_array( 'protected', $perm_post ) ) { ?>
								checked="checked"
								<?php } ?>
								value="1" title="<?php echo T_('Permission to post into this blog with protected status') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_private_<?php echo $loop_row['ID'] ?>"
								<?php if( in_array( 'private', $perm_post ) ) { ?>
								checked="checked"
								<?php } ?>
								value="1" title="<?php echo T_('Permission to post into this blog with private status') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_draft_<?php echo $loop_row['ID'] ?>"
								<?php if( in_array( 'draft', $perm_post ) ) { ?>
								checked="checked"
								<?php } ?>
								value="1" title="<?php echo T_('Permission to post into this blog with draft status') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_deprecated_<?php echo $loop_row['ID'] ?>"
								<?php if( in_array( 'deprecated', $perm_post ) ) { ?>
								checked="checked"
								<?php } ?>
								value="1" title="<?php echo T_('Permission to post into this blog with deprecated status') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_delpost_<?php echo $loop_row['ID'] ?>"
								<?php if( $loop_row['bloguser_perm_delpost'] != 0  ) { ?>
								checked="checked"
								<?php } ?>
								value="1" title="<?php echo T_('Permission to delete posts in this blog') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_comments_<?php echo $loop_row['ID'] ?>"
								<?php if( $loop_row['bloguser_perm_comments'] != 0  ) { ?>
								checked="checked"
								<?php } ?>
								value="1" title="<?php echo T_('Permission to edit comments in this blog') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_cats_<?php echo $loop_row['ID'] ?>"
								<?php if( $loop_row['bloguser_perm_cats'] != 0  ) { ?>
								checked="checked"
								<?php } ?>
								value="1" title="<?php echo T_('Permission to edit categories for this blog') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_properties_<?php echo $loop_row['ID'] ?>"
								<?php if( $loop_row['bloguser_perm_properties'] != 0  ) { ?>
								checked="checked"
								<?php } ?>
								value="1" title="<?php echo T_('Permission to edit blog properties') ?>" />
						</td>
						<td class="center">
							<a href="javascript:toggleall(document.FormPerm, <?php echo $loop_row['ID'].', '.$i ?>);" title="<?php echo T_('(un)selects all checkboxes using Javascript') ?>">
								<span id="checkallspan_<?php echo $i ?>" class="checkall"><?php echo T_('(un)check all')?></span>
							</a>
						</td>
					</tr>
					<?php
					$i++;
				}
				?>
			<tr class="group">
				<td colspan="12">
					<strong><?php echo T_('Non members') ?></strong>
				</td>
			</tr>
				<?php
				$query = "SELECT ID, user_login
									FROM $tableusers ";
				if( count( $members ) )
				{
					$query .= "WHERE ID NOT IN (".implode( ',', $members ) .") ";
				}
				$query .= "ORDER BY user_login";
				$rows = $DB->get_results( $query, ARRAY_A );
				if( count($rows) ) foreach( $rows as $loop_row )
				{	// Go through users:
					?>
					<tr <?php if( $i%2 == 1) echo 'class="odd"'; ?>>
						<td><?php echo format_to_output( $loop_row['user_login'], 'htmlbody' ); ?></td>
						<td class="center">
							<input id="checkallspan_state_<?php echo $i ?>" type="checkbox" name="blog_ismember_<?php echo $loop_row['ID'] ?>"
								onclick="setcheckallspan(<?php echo $i ?>, this.checked)"
								value="1" title="<?php echo T_('Permission to read protected posts') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_published_<?php echo $loop_row['ID'] ?>"
								value="1" title="<?php echo T_('Permission to post into this blog with private status') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_protected_<?php echo $loop_row['ID'] ?>"
								value="1" title="<?php echo T_('Permission to post into this blog with protected status') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_private_<?php echo $loop_row['ID'] ?>"
								value="1" title="<?php echo T_('Permission to post into this blog with private status') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_draft_<?php echo $loop_row['ID'] ?>"
								value="1" title="<?php echo T_('Permission to post into this blog with draft status') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_deprecated_<?php echo $loop_row['ID'] ?>"
								value="1" title="<?php echo T_('Permission to post into this blog with deprecated status') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_delpost_<?php echo $loop_row['ID'] ?>"
								value="1" title="<?php echo T_('Permission to delete posts in this blog') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_comments_<?php echo $loop_row['ID'] ?>"
								value="1" title="<?php echo T_('Permission to edit comments in this blog') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_cats_<?php echo $loop_row['ID'] ?>"
								value="1" title="<?php echo T_('Permission to edit categories for this blog') ?>" />
						</td>
						<td class="center">
							<input type="checkbox" name="blog_perm_properties_<?php echo $loop_row['ID'] ?>"
								value="1" title="<?php echo T_('Permission to edit blog properties') ?>" />
						</td>
						<td class="center">
							<a href="javascript:toggleall(document.FormPerm, <?php echo $loop_row['ID'].', '.$i ?>);">
								<span id="checkallspan_<?php echo $i ?>" class="checkall"><?php echo T_('(un)check all')?></span>
							</a>
						</td>
					</tr>
					<?php
					$i++;
				}
			?>
		</table>
		<br />
	</fieldset>

	<?php 
		// warning if a user withdraws own permission to edit the blog's properties
		form_submit( ( $current_User->ID != 1 ) ? 'onclick="if( document.FormPerm.blog_perm_properties_'.$current_User->ID.'.checked == false) return( confirm(\''. /* TRANS: Warning this is a javascript string */ T_('Warning! You are about to remove your own permission to edit this blog!\nYou won\\\'t have access to its properties any longer if you do that!').'\') );"' : '' )
	?>

</form>