Project

General

Profile

« Previous | Next » 

Revision 546

Added by doc almost 17 years ago

added the "users in multiple groups" feature (closes parts of ticket #546)

View differences:

settings2.php
73 73
$old_position = $results_array['position'];
74 74
$old_admin_groups = explode(',', str_replace('_', '', $results_array['admin_groups']));
75 75
$old_admin_users = explode(',', str_replace('_', '', $results_array['admin_users']));
76
if(!is_numeric(array_search($admin->get_group_id(), $old_admin_groups)) AND !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) {
76

  
77
$in_old_group = FALSE;
78
foreach($admin->get_groups_id() as $cur_gid){
79
    if (in_array($cur_gid, $old_admin_groups)) {
80
	$in_old_group = TRUE;
81
    }
82
}
83
if((!$in_old_group) AND !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) {
77 84
	$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']);
78 85
}
79 86

  
80 87
// Setup admin groups
81 88
$admin_groups[] = 1;
82
if($admin->get_group_id() != 1) {
83
	$admin_groups[] = $admin->get_group_id();
89
if(!in_array(1, $admin->get_groups_id())) {
90
	$admin_groups[] = implode(",",$admin->get_groups_id());
84 91
}
85 92
$admin_groups = implode(',', $admin_groups);
86 93
// Setup viewing groups
87 94
$viewing_groups[] = 1;
88
if($admin->get_group_id() != 1) {
89
	$viewing_groups[] = $admin->get_group_id();
95
if(!in_array(1, $admin->get_groups_id())) {
96
	$viewing_groups[] = implode(",",$admin->get_groups_id());
90 97
}
91 98
$viewing_groups = implode(',', $viewing_groups);
92 99

  
......
143 150
// Get page trail
144 151
$page_trail = get_page_trail($page_id);
145 152

  
153
// Make sure link is not overwritten if page uses the menu link module
154
$query_sections = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'menu_link'");
155
if($query_sections->numRows() > 0) {
156
	$link = $old_link;
157
} 
158

  
146 159
// Update page settings in the pages table
147 160
$query = "UPDATE ".TABLE_PREFIX."pages SET parent = '$parent', page_title = '$page_title', menu_title = '$menu_title', menu = '$menu', level = '$level', page_trail = '$page_trail', root_parent = '$root_parent', link = '$link', template = '$template', target = '$target', description = '$description', keywords = '$keywords', position = '$position', visibility = '$visibility', searching = '$searching', language = '$language', admin_groups = '$admin_groups', viewing_groups = '$viewing_groups' WHERE page_id = '$page_id'";
148 161
$database->query($query);

Also available in: Unified diff