271 if ( $existing_level != $user_level ) |
271 if ( $existing_level != $user_level ) |
272 { |
272 { |
273 // We need to update group memberships |
273 // We need to update group memberships |
274 if ( $existing_level == USER_LEVEL_ADMIN ) |
274 if ( $existing_level == USER_LEVEL_ADMIN ) |
275 { |
275 { |
276 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES(\'security\',\'u_from_admin\',' . time() . ',"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '","' . $db->escape($username) . '");'); |
276 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid,page_text) VALUES(\'security\',\'u_from_admin\',' . time() . ', \'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\', ' . $session->user_id . ', \'' . $db->escape($session->username) . '\', \'' . $db->escape($username) . '\');'); |
277 if ( !$q ) |
277 if ( !$q ) |
278 $db->_die(); |
278 $db->_die(); |
279 $session->remove_user_from_group($user_id, GROUP_ID_ADMIN); |
279 $session->remove_user_from_group($user_id, GROUP_ID_ADMIN); |
280 } |
280 } |
281 else if ( $existing_level == USER_LEVEL_MOD ) |
281 else if ( $existing_level == USER_LEVEL_MOD ) |
282 { |
282 { |
283 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES(\'security\',\'u_from_mod\',' . time() . ',"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '","' . $db->escape($username) . '");'); |
283 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid,page_text) VALUES(\'security\',\'u_from_mod\',' . time() . ', \'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\', ' . $session->user_id . ', \'' . $db->escape($session->username) . '\', \'' . $db->escape($username) . '\');'); |
284 if ( !$q ) |
284 if ( !$q ) |
285 $db->_die(); |
285 $db->_die(); |
286 $session->remove_user_from_group($user_id, GROUP_ID_MOD); |
286 $session->remove_user_from_group($user_id, GROUP_ID_MOD); |
287 } |
287 } |
288 |
288 |
289 if ( $user_level == USER_LEVEL_ADMIN ) |
289 if ( $user_level == USER_LEVEL_ADMIN ) |
290 { |
290 { |
291 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES(\'security\',\'u_to_admin\',' . time() . ',"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '","' . $db->escape($username) . '");'); |
291 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid,page_text) VALUES(\'security\',\'u_to_admin\',' . time() . ', \'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\', ' . $session->user_id . ', \'' . $db->escape($session->username) . '\', \'' . $db->escape($username) . '\');'); |
292 if ( !$q ) |
292 if ( !$q ) |
293 $db->_die(); |
293 $db->_die(); |
294 $session->add_user_to_group($user_id, GROUP_ID_ADMIN, false); |
294 $session->add_user_to_group($user_id, GROUP_ID_ADMIN, false); |
295 } |
295 } |
296 else if ( $user_level == USER_LEVEL_MOD ) |
296 else if ( $user_level == USER_LEVEL_MOD ) |
297 { |
297 { |
298 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES(\'security\',\'u_to_mod\',' . time() . ',"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '","' . $db->escape($username) . '");'); |
298 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid,page_text) VALUES(\'security\',\'u_to_mod\',' . time() . ', \'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\', ' . $session->user_id . ', \'' . $db->escape($session->username) . '\', \'' . $db->escape($username) . '\');'); |
299 if ( !$q ) |
299 if ( !$q ) |
300 $db->_die(); |
300 $db->_die(); |
301 $session->add_user_to_group($user_id, GROUP_ID_MOD, false); |
301 $session->add_user_to_group($user_id, GROUP_ID_MOD, false); |
302 } |
302 } |
303 } |
303 } |