diff -r a2b20a832447 -r 01955bf53f96 plugins/SpecialAdmin.php --- a/plugins/SpecialAdmin.php Sat Sep 08 15:06:28 2007 -0400 +++ b/plugins/SpecialAdmin.php Sat Sep 08 22:58:38 2007 -0400 @@ -860,19 +860,31 @@ // We need to update group memberships if ( $old_level == USER_LEVEL_ADMIN ) { + $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES("security","u_from_admin",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '","' . $db->escape($_POST['new_username']) . '");'); + if ( !$q ) + $db->_die(); $session->remove_user_from_group($user_id, GROUP_ID_ADMIN); } else if ( $old_level == USER_LEVEL_MOD ) { + $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES("security","u_from_mod",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '","' . $db->escape($_POST['new_username']) . '");'); + if ( !$q ) + $db->_die(); $session->remove_user_from_group($user_id, GROUP_ID_MOD); } if ( $new_level == USER_LEVEL_ADMIN ) { + $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES("security","u_to_admin",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '","' . $db->escape($_POST['new_username']) . '");'); + if ( !$q ) + $db->_die(); $session->add_user_to_group($user_id, GROUP_ID_ADMIN, false); } else if ( $new_level == USER_LEVEL_MOD ) { + $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,page_text) VALUES("security","u_to_mod",UNIX_TIMESTAMP(),"' . $db->escape($_SERVER['REMOTE_ADDR']) . '","' . $db->escape($session->username) . '","' . $db->escape($_POST['new_username']) . '");'); + if ( !$q ) + $db->_die(); $session->add_user_to_group($user_id, GROUP_ID_MOD, false); } } @@ -2064,12 +2076,66 @@ } if(isset($_POST['create']) && !defined('ENANO_DEMO_MODE')) { - $q = 'INSERT INTO '.table_prefix.'banlist(ban_type,ban_value,reason,is_regex) VALUES( ' . $db->escape($_POST['type']) . ', \'' . $db->escape($_POST['value']) . '\', \''.$db->escape($_POST['reason']).'\''; - if(isset($_POST['regex'])) $q .= ', 1'; - else $q .= ', 0'; - $q .= ');'; - $e = $db->sql_query($q); - if(!$e) $db->_die('The banlist could not be updated.'); + $type = intval($_POST['type']); + $value = trim($_POST['value']); + if ( !in_array($type, array(BAN_IP, BAN_USER, BAN_EMAIL)) ) + { + echo '
Type | Value | Regular Expression | No ban rules yet. | '; + if($db->numrows() < 1) echo 'No ban rules yet. | '; + $cls = 'row2'; while($r = $db->fetchrow()) { + $cls = ( $cls == 'row1' ) ? 'row2' : 'row1'; if($r['ban_type']==BAN_IP) $t = 'IP address'; elseif($r['ban_type']==BAN_USER) $t = 'Username'; elseif($r['ban_type']==BAN_EMAIL) $t = 'E-mail address'; if($r['is_regex']) $g = 'Yes'; else $g = 'No'; - echo '
---|---|---|---|
'.$t.' | '.$r['ban_value'].' | '.$g.' | Delete |
'.$t.' | '.$r['ban_value'].' | '.$g.' | Delete |