예제 #1
0
 public function getBody()
 {
     $timeframe = Neuron_Core_Tools::getInput('_GET', 'timeframe', 'int', 60 * 60 * 48);
     $db = Neuron_DB_Database::__getInstance();
     $page = new Neuron_Core_Template();
     $page->set('timeframe', $timeframe);
     // Fetch all doubles
     $data = $db->query("\n\t\t\tSELECT\n\t\t\t\tn_login_log.l_ip,\n\t\t\t\t\n\t\t\t\tGROUP_CONCAT(DISTINCT n_login_log.l_plid) AS plids,\n\t\t\t\tGROUP_CONCAT(DISTINCT n_players.nickname) AS nicknames,\n\t\t\t\t\n\t\t\t\tGROUP_CONCAT(c.pac_plid1) AS cleared_1,\n\t\t\t\tGROUP_CONCAT(c.pac_plid2) AS cleared_2,\n\t\t\t\tGROUP_CONCAT(c.pac_reason) AS cleared_reason,\n\t\t\t\t\n\t\t\t\tCOUNT(DISTINCT l_plid) AS aantal\n\t\t\tFROM\n\t\t\t\tn_login_log\n\t\t\tLEFT JOIN\n\t\t\t\tn_players ON n_login_log.l_plid = n_players.plid\n\t\t\tLEFT JOIN\n\t\t\t\tn_players_admin_cleared c ON (c.pac_plid1 = n_login_log.l_plid OR c.pac_plid2 = n_login_log.l_plid)\n\t\t\tWHERE\n\t\t\t\tn_login_log.l_datetime > FROM_UNIXTIME(" . (NOW - $timeframe) . ") AND\n\t\t\t\tn_players.isPlaying = 1\n\t\t\tGROUP BY\n\t\t\t\tl_ip\n\t\t\tHAVING\n\t\t\t\taantal > 1\n\t\t");
     foreach ($data as $row) {
         $plids = explode(',', $row['plids']);
         $nicknames = explode(',', $row['nicknames']);
         // Check clearances.
         $clearances = $this->getClearancesFromRow($row);
         $players = array();
         $combinedlogs = "";
         foreach ($plids as $k => $v) {
             $players[] = array('id' => $plids[$k], 'name' => isset($nicknames[$k]) ? $nicknames[$k] : 'no-nickname-set', 'url' => $this->getUrl('user', array('id' => $plids[$k])), 'logs_url' => $this->getUrl('gamelogs', array('players' => $plids[$k])));
             $combinedlogs .= $plids[$k] . "|";
         }
         // Check for cleared accounts
         $allcleared = true;
         foreach ($players as $k => $v) {
             $players[$k]['cleared'] = $this->isCleared($clearances, $v, $players);
             if ($allcleared && !$players[$k]['cleared']) {
                 $allcleared = false;
             }
         }
         $combinedlogs = substr($combinedlogs, 0, -1);
         $page->addListValue('players', array('ip' => $row['l_ip'], 'players' => $players, 'combined_logs_url' => $this->getUrl('gamelogs', array('players' => $combinedlogs)), 'clearmultis' => $this->getUrl('clearmultis', array('players' => $combinedlogs)), 'cleared' => $allcleared, 'amount' => $row['aantal']));
     }
     $page->usortList('players', array($this, 'sortcompare'));
     return $page->parse('pages/admin/multis.phpt');
 }