Revision 546
Added by doc almost 17 years ago
settings.php | ||
---|---|---|
42 | 42 |
$results_array = $results->fetchRow(); |
43 | 43 |
$old_admin_groups = explode(',', $results_array['admin_groups']); |
44 | 44 |
$old_admin_users = explode(',', $results_array['admin_users']); |
45 |
if(!is_numeric(array_search($admin->get_group_id(), $old_admin_groups)) AND !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) { |
|
45 |
|
|
46 |
$in_old_group = FALSE; |
|
47 |
foreach($admin->get_groups_id() as $cur_gid){ |
|
48 |
if (in_array($cur_gid, $old_admin_groups)) { |
|
49 |
$in_old_group = TRUE; |
|
50 |
} |
|
51 |
} |
|
52 |
if((!$in_old_group) AND !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) { |
|
46 | 53 |
$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']); |
47 | 54 |
} |
48 | 55 |
|
... | ... | |
111 | 118 |
} |
112 | 119 |
// Group list 1 (admin_groups) |
113 | 120 |
$admin_groups = explode(',', str_replace('_', '', $results_array['admin_groups'])); |
114 |
if($admin->get_group_id() == 1) { |
|
115 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups"; |
|
116 |
} else { |
|
117 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id != '".$admin->get_group_id()."'"; |
|
118 |
} |
|
121 |
|
|
122 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups"; |
|
123 |
|
|
119 | 124 |
$get_groups = $database->query($query); |
120 | 125 |
$template->set_block('main_block', 'group_list_block', 'group_list'); |
121 | 126 |
// Insert admin group and current group first |
... | ... | |
131 | 136 |
) |
132 | 137 |
); |
133 | 138 |
$template->parse('group_list', 'group_list_block', true); |
134 |
if($admin->get_group_id() != 1) { |
|
135 |
$template->set_var(array( |
|
136 |
'ID' => $admin->get_group_id(), |
|
139 |
/* |
|
140 |
if(!in_array(1, $admin->get_groups_id())) { |
|
141 |
$users_groups = $admin->get_groups_name(); |
|
142 |
foreach ($admin->get_groups_id() as $users_group_id) { |
|
143 |
$template->set_var(array( |
|
144 |
'ID' => $users_group_id, |
|
137 | 145 |
'TOGGLE' => '', |
138 | 146 |
'DISABLED' => ' disabled', |
139 | 147 |
'LINK_COLOR' => '000000', |
140 | 148 |
'CURSOR' => 'default', |
141 |
'NAME' => $admin->get_group_name(),
|
|
149 |
'NAME' => $users_groups[$users_group_id],
|
|
142 | 150 |
'CHECKED' => ' checked' |
143 | 151 |
) |
144 | 152 |
); |
145 |
$template->parse('group_list', 'group_list_block', true); |
|
153 |
$template->parse('group_list', 'group_list_block', true); |
|
154 |
} |
|
146 | 155 |
} |
156 |
*/ |
|
147 | 157 |
while($group = $get_groups->fetchRow()) { |
158 |
// check if the user is a member of this group |
|
159 |
$flag_disabled = ''; |
|
160 |
$flag_checked = ''; |
|
161 |
$flag_cursor = 'pointer'; |
|
162 |
$flag_color = ''; |
|
163 |
if (in_array($group["group_id"], $admin->get_groups_id())) { |
|
164 |
$flag_disabled = ' disabled'; |
|
165 |
$flag_checked = ' checked'; |
|
166 |
$flag_cursor = 'default'; |
|
167 |
$flag_color = '000000'; |
|
168 |
} |
|
169 |
|
|
148 | 170 |
// Check if the group is allowed to edit pages |
149 | 171 |
$system_permissions = explode(',', $group['system_permissions']); |
150 | 172 |
if(is_numeric(array_search('pages_modify', $system_permissions))) { |
151 | 173 |
$template->set_var(array( |
152 | 174 |
'ID' => $group['group_id'], |
153 | 175 |
'TOGGLE' => $group['group_id'], |
154 |
'DISABLED' => '',
|
|
155 |
'LINK_COLOR' => '',
|
|
156 |
'CURSOR' => 'pointer',
|
|
176 |
'DISABLED' => $flag_disabled,
|
|
177 |
'LINK_COLOR' => $flag_color,
|
|
178 |
'CURSOR' => $flag_cursor,
|
|
157 | 179 |
'NAME' => $group['name'], |
158 |
'CHECKED' => ''
|
|
180 |
'CHECKED' => $flag_checked
|
|
159 | 181 |
) |
160 | 182 |
); |
161 | 183 |
if(is_numeric(array_search($group['group_id'], $admin_groups))) { |
162 | 184 |
$template->set_var('CHECKED', 'checked'); |
163 | 185 |
} else { |
164 |
$template->set_var('CHECKED', ''); |
|
186 |
if (!$flag_checked) $template->set_var('CHECKED', '');
|
|
165 | 187 |
} |
166 | 188 |
$template->parse('group_list', 'group_list_block', true); |
167 | 189 |
} |
168 | 190 |
} |
169 | 191 |
// Group list 2 (viewing_groups) |
170 | 192 |
$viewing_groups = explode(',', str_replace('_', '', $results_array['viewing_groups'])); |
171 |
if($admin->get_group_id() == 1) { |
|
172 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups"; |
|
173 |
} else { |
|
174 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id != '".$admin->get_group_id()."'"; |
|
175 |
} |
|
193 |
|
|
194 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups"; |
|
195 |
|
|
176 | 196 |
$get_groups = $database->query($query); |
177 | 197 |
$template->set_block('main_block', 'group_list_block2', 'group_list2'); |
178 | 198 |
// Insert admin group and current group first |
... | ... | |
188 | 208 |
) |
189 | 209 |
); |
190 | 210 |
$template->parse('group_list2', 'group_list_block2', true); |
191 |
if($admin->get_group_id() != 1) { |
|
192 |
$template->set_var(array( |
|
193 |
'ID' => $admin->get_group_id(), |
|
194 |
'TOGGLE' => '', |
|
195 |
'DISABLED' => ' disabled', |
|
196 |
'LINK_COLOR' => '000000', |
|
197 |
'CURSOR' => 'default', |
|
198 |
'NAME' => $admin->get_group_name(), |
|
199 |
'CHECKED' => ' checked' |
|
200 |
) |
|
201 |
); |
|
202 |
$template->parse('group_list2', 'group_list_block2', true); |
|
203 |
} |
|
211 |
|
|
212 |
|
|
204 | 213 |
while($group = $get_groups->fetchRow()) { |
214 |
// check if the user is a member of this group |
|
215 |
$flag_disabled = ''; |
|
216 |
$flag_checked = ''; |
|
217 |
$flag_cursor = 'pointer'; |
|
218 |
$flag_color = ''; |
|
219 |
if (in_array($group["group_id"], $admin->get_groups_id())) { |
|
220 |
$flag_disabled = ' disabled'; |
|
221 |
$flag_checked = ' checked'; |
|
222 |
$flag_cursor = 'default'; |
|
223 |
$flag_color = '000000'; |
|
224 |
} |
|
225 |
|
|
205 | 226 |
$template->set_var(array( |
206 | 227 |
'ID' => $group['group_id'], |
207 | 228 |
'TOGGLE' => $group['group_id'], |
208 |
'DISABLED' => '',
|
|
209 |
'LINK_COLOR' => '',
|
|
210 |
'CURSOR' => 'pointer',
|
|
229 |
'DISABLED' => $flag_disabled,
|
|
230 |
'LINK_COLOR' => $flag_color,
|
|
231 |
'CURSOR' => $flag_cursor,
|
|
211 | 232 |
'NAME' => $group['name'], |
233 |
'CHECKED' => $flag_checked |
|
212 | 234 |
) |
213 | 235 |
); |
214 | 236 |
if(is_numeric(array_search($group['group_id'], $viewing_groups))) { |
215 | 237 |
$template->set_var('CHECKED', 'checked'); |
216 | 238 |
} else { |
217 |
$template->set_var('CHECKED', ''); |
|
239 |
if (!$flag_checked) $template->set_var('CHECKED', '');
|
|
218 | 240 |
} |
219 | 241 |
$template->parse('group_list2', 'group_list_block2', true); |
220 | 242 |
} |
... | ... | |
239 | 261 |
// Get user perms |
240 | 262 |
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups'])); |
241 | 263 |
$admin_users = explode(',', str_replace('_', '', $page['admin_users'])); |
242 |
if(is_numeric(array_search($admin->get_group_id(), $admin_groups)) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) { |
|
264 |
|
|
265 |
$in_group = FALSE; |
|
266 |
foreach($admin->get_groups_id() as $cur_gid){ |
|
267 |
if (in_array($cur_gid, $admin_groups)) { |
|
268 |
$in_group = TRUE; |
|
269 |
} |
|
270 |
} |
|
271 |
|
|
272 |
if(($in_group) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) { |
|
243 | 273 |
$can_modify = true; |
244 | 274 |
} else { |
245 | 275 |
$can_modify = false; |
Also available in: Unified diff
added the "users in multiple groups" feature (closes parts of ticket #546)