Changeset 198

Show
Ignore:
Timestamp:
01/24/09 18:34:54 (3 years ago)
Author:
Nafania
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cheaters.php

    r184 r198  
    1717 
    1818if ( isset($_POST['id']) ) { 
    19         $ids = request_var('id', array(''=>'')); 
    20         foreach ( $ids AS $_null => $id ) { 
    21                 $ids[] = (int) $id; 
    22      } 
     19        $ids = request_var('id', array(0=>0)); 
    2320 
    2421        meta_refresh(3, append_sid($root_path . 'cheaters.php' . ( $mode == 'stealth_downers' ? '?mode=stealth_downers' : '' ) . ( $show_banned ? '&show_banned=1' : '' ))); 
     
    5148                        if ( isset($_POST['ban']) ) { 
    5249                                $sql = 'SELECT u.name, u.uid AS user_id FROM ' . USERS_TABLE . ' u, ' . CHEATERS_TABLE . ' c 
    53                                                 WHERE u.uid = c.userid AND c.id IN (' . implode(', ', $ids) . ') AND enabled = 1 GROUP BY u.uid'; 
     50                                                WHERE u.uid = c.userid AND u.uid IN (' . implode(', ', $ids) . ') AND enabled = 1 GROUP BY u.uid'; 
    5451                                $result = $db->sql_query($sql); 
    5552 
    5653                                $modcomment = "\n" . sprintf($lang['modcomment_account_disabled'], 't' . time(), $userdata['name'], $lang['cheater']); 
     54 
    5755                          while ( $row = $db->sql_fetchrow($result) ) { 
    5856                                     $sql = 'UPDATE ' . USERS_TABLE . ' SET enabled = 0, warneduntil = 0, modcomment=CONCAT(modcomment,' . "'" . $db->sql_escape($modcomment) . "'" . ') WHERE uid  = ' . $row['user_id']; 
    5957                               $db->sql_query($sql); 
     58 
    6059                                        $sql = 'DELETE FROM ' . SESSIONS_TABLE . ' WHERE session_user_id = ' . $row['user_id']; 
    6160                                        $db->sql_query($sql); 
     61 
    6262                                        write_log(sprintf($lang['log_account_disable'], 'userdetails_' . $row['user_id'], $row['name'], $userdata['name'], $lang['cheater']), LOG_VIEW_ADMIN); 
    6363                        } 
     
    6666 
    6767                        if ( isset($_POST['delete']) ) { 
    68                                 $sql = 'DELETE FROM ' . CHEATERS_TABLE . ' WHERE id IN (' . implode(', ', $ids) . ')'; 
     68                                $sql = 'DELETE FROM ' . CHEATERS_TABLE . ' WHERE userid IN (' . implode(', ', $ids) . ')'; 
    6969                                $db->sql_query($sql); 
     70 
    7071                             trigger_error ($lang['success_delete']); 
    7172                        } 
     
    158159 
    159160                default: 
    160                         $sql = 'SELECT COUNT(*) AS count FROM ' . CHEATERS_TABLE; 
    161                         $result = $db->sql_query($sql); 
    162                         $count = ( $row = $db->sql_fetchrow($result) ) ? intval($row['count']) : 0; 
    163  
    164                         $per_page = 100; 
    165  
    166                         list($pagertop, $pagerbottom, $limit) = pager($per_page, $count, 'cheaters.php?'); 
    167161 
    168162                        $template->assign_vars(array( 
    169163                        'S_FORM_ACTION' => append_sid('cheaters.php'), 
    170                                 'PAGER_TOP' => $pagertop, 
    171                                 'PAGER_BOTTOM' => $pagerbottom) 
    172                         ); 
     164                        )); 
    173165 
    174166                        $sql = 'SELECT c.*, u.uid AS user_id, u.name, u.class, u.downloaded, u.uploaded, u.enabled, u.parked, u.warneduntil, u.donor, u.added AS reg_date, t.name AS torrent_name, t.fid AS torrent_id, t.size 
    175167                                        FROM ' . CHEATERS_TABLE . ' c, ' . USERS_TABLE . ' u, ' . TORRENTS_TABLE . ' t 
    176168                                        WHERE c.userid = u.uid AND c.torrentid = t.fid 
    177                                      ORDER BY added DESC        ' . $limit
     169                                     ORDER BY added DESC        '
    178170                        $result = $db->sql_query($sql); 
    179171 
     
    182174                        $i = 0; 
    183175 
    184                         while ( $row = $db->sql_fetchrow($result) ) { 
     176                        /*while ( $row = $db->sql_fetchrow($result) ) { 
    185177                                $i++; 
    186178                                $ratio = get_ratio($row['uploaded'], $row['downloaded']); 
     
    206198                                        'REG_DATE' => create_date($config['default_dateformat'], $row['reg_date'], $userdata['tzoffset']) 
    207199                                )); 
     200                        }*/ 
     201 
     202                        $users_ary = array(); 
     203                        $i = 0; 
     204 
     205                        while ( $row = $db->sql_fetchrow($result) ) { 
     206 
     207                                $ratio = get_ratio($row['uploaded'], $row['downloaded']); 
     208                                $ratio_color = get_ratio_color($ratio); 
     209                                $uppd = mksize($row['upthis']); 
     210 
     211                                $username = get_user_class_color($row['class'], $row['name']); 
     212                                $reg_date = create_date($config['default_dateformat'], $row['reg_date'], $userdata['tzoffset']); 
     213                                $user_icons = get_user_icons($row); 
     214 
     215                                $ary_key = $username . '|' . $row['user_id'] . '|' . $row['userip'] . '|' . $reg_date . '|' . $user_icons; 
     216 
     217                                $users_ary[$ary_key][$row['torrent_id'] . '|' . $row['torrent_name']][] = array( 
     218                                        'USERNAME' => get_user_class_color($row['class'], $row['name']), 
     219                                        'UPLOADED' => $uppd, 
     220                                        'SPEED' => mksize($row['rate']) . '/' . $lang['secs_short'], 
     221                                        'WITHIN' => $row['timediff'] . $lang['secs_short'], 
     222                                        'CLIENT' => getagent($row['che_useragent'], $row['che_peer_id']), 
     223                                        'IP' => $row['userip'], 
     224                                        'ID' => $row['id'], 
     225                                        'ADDED' => create_date($config['default_dateformat'], $row['added'], $userdata['tzoffset']), 
     226                                        'TORRENT_ID' => $row['torrent_id'], 
     227                                        'TORRENT_SIZE' => mksize($row['size']) 
     228                                ); 
     229                        } 
     230 
     231                        @ksort($users_ary); 
     232 
     233                        foreach ( $users_ary AS $user_id => $ary ) { 
     234 
     235                                ++$i; 
     236 
     237                                list($username, $user_id, $user_ip, $reg_date, $user_icons) = explode('|', $user_id); 
     238 
     239                                $template->assign_block_vars('cheat_users_row', array( 
     240                                        'USER_ID' => $user_id, 
     241                                        'USERNAME' => $username, 
     242                                        'USER_IP' => $user_ip, 
     243                                        'U_USERDETAILS' => append_sid('userdetails.php?id=' . $user_id), 
     244                                        'REG_DATE' => $reg_date, 
     245                                        'USER_ICONS' => $user_icons, 
     246                                        'NUMBER' => $i 
     247                                )); 
     248 
     249                                foreach ( $ary AS $torrent_id => $sub_ary ) { 
     250 
     251                                        list($torrent_id, $torrent_name) = explode('|', $torrent_id); 
     252 
     253                                        $template->assign_block_vars('cheat_users_row.torrents_row', array( 
     254                                                'U_TORRENT' => append_sid('details.php?id=' . $torrent_id), 
     255                                                'TORRENT_NAME' => $torrent_name, 
     256                                        )); 
     257 
     258                                        foreach ( $sub_ary AS $_null => $sub_sub_ary ) { //lol 
     259 
     260                                                $template->assign_block_vars('cheat_users_row.torrents_row.torrents_data', array( 
     261                                                        'UPLOADED' => $sub_sub_ary['UPLOADED'], 
     262                                                        'SPEED' => $sub_sub_ary['SPEED'], 
     263                                                        'WITHIN' => $sub_sub_ary['WITHIN'], 
     264                                                        'CLIENT' => $sub_sub_ary['CLIENT'], 
     265                                                        'IP' => $sub_sub_ary['IP'], 
     266                                                        'ADDED' => $sub_sub_ary['ADDED'], 
     267                                                        'TORRENT_SIZE' => $sub_sub_ary['TORRENT_SIZE'], 
     268                                                )); 
     269                                        } 
     270                                } 
    208271                        } 
    209272 
  • message.php

    r197 r198  
    377377                } 
    378378 
     379                if ( !sizeof($pm_messages) ) { 
     380                        redirect( append_sid('message.php?action=viewmailbox&box=' . $pm_box)); 
     381                } 
     382 
    379383                $sql = 'SELECT * FROM ' . PRIVATE_MESSAGES_TABLE . ' WHERE id IN (' . implode(', ', $pm_messages) . ')'; 
    380384                $result = $db->sql_query($sql);