Changeset 152 for trunk/wp-content/plugins/xpressme
- Timestamp:
- Apr 3, 2009, 11:04:47 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/plugins/xpressme/xpressme_class.php
r149 r152 139 139 $table = get_wp_prefix() . 'group_role'; 140 140 $xoops_group = get_xoops_prefix() . 'groups'; 141 $xoops_group_permission = get_xoops_prefix() . 'group_permission'; 142 143 $module_id = get_xpress_modid(); 144 141 145 $sql= "SELECT * FROM $table"; 142 146 $before_groupes = $xoops_db->get_results($sql); … … 145 149 $xoops_db->query($sql); 146 150 147 148 $sql= "SELECT * FROM $xoops_group WHERE group_type <> 'Anonymous'"; 151 $sql = "SELECT * FROM $xoops_group_permission WHERE gperm_itemid = $module_id"; 152 $gperms = $xoops_db->get_results($sql); 153 154 $sql = "SELECT * FROM $xoops_group WHERE group_type <> 'Anonymous'"; 149 155 $groupes = $xoops_db->get_results($sql); 150 156 $insert_sql = ''; 151 157 foreach ($groupes as $groupe) { 152 $role = ''; 153 foreach ($before_groupes as $before_groupe) { 154 if ($groupe->groupid == $before_groupe->groupid) { 155 $role = $before_groupe->role; 156 $login_all = $before_groupe->login_all; 158 $parmsql = "SELECT * FROM $xoops_group_permission WHERE gperm_itemid = $module_id AND gperm_groupid = $groupe->groupid"; 159 $gperms = $xoops_db->get_results($parmsql); 160 $parmission = ''; 161 foreach ($gperms as $gperm) { 162 $parmission = $gperm->gperm_name; 163 if ($parmission == 'module_admin') break; 164 } 165 166 if (!empty($parmission)){ 167 $role = ''; 168 foreach ($before_groupes as $before_groupe) { 169 if ($groupe->groupid == $before_groupe->groupid) { 170 $role = $before_groupe->role; 171 $login_all = $before_groupe->login_all; 172 } 157 173 } 158 } 159 160 $insert_sql = "INSERT INTO $table "; 161 $insert_sql .= "(groupid , name , description , group_type , role , login_all) "; 162 $insert_sql .= "VALUES ("; 163 $insert_sql .= $groupe->groupid . ', '; 164 $insert_sql .= "'" . $groupe->name . "' , "; 165 $insert_sql .= "'" . $groupe->description . "' , "; 166 $insert_sql .= "'" . $groupe->group_type . "' , "; 167 $insert_sql .= "'" . $role . "' , '"; 168 $insert_sql .= $login_all . "')"; 169 $xoops_db->query($insert_sql); 174 if ($parmission == 'module_admin') $role = 'administrator'; 175 176 $insert_sql = "INSERT INTO $table "; 177 $insert_sql .= "(groupid , name , description , group_type , role , login_all) "; 178 $insert_sql .= "VALUES ("; 179 $insert_sql .= $groupe->groupid . ', '; 180 $insert_sql .= "'" . $groupe->name . "' , "; 181 $insert_sql .= "'" . $groupe->description . "' , "; 182 $insert_sql .= "'" . $parmission . "' , "; 183 $insert_sql .= "'" . $role . "' , '"; 184 $insert_sql .= $login_all . "')"; 185 $xoops_db->query($insert_sql); 186 } 170 187 } 171 188 … … 406 423 $selected = ''; 407 424 } 408 if ($groupe->group_type != ' Admin' || $groupe->groupid > 3|| !empty($selected)) {425 if ($groupe->group_type != 'module_admin'|| !empty($selected)) { 409 426 $role_list .= "<option value=\"{$role}\"{$selected}>{$name}</option>\n"; 410 427 } 411 428 } 412 if ($groupe->group_type != ' Admin' || $groupe->groupid > 3) {429 if ($groupe->group_type != 'module_admin') { 413 430 if ( $group_has_role ) { 414 431 $role_list .= '<option value="default">' . __('Default Role of WordPress', 'xpressme') . "</option>\n";
Note: See TracChangeset
for help on using the changeset viewer.