Esempio n. 1
0
 private function getUserOverview(Neuron_GameServer_Player $objUser)
 {
     $admin = Neuron_GameServer::getPlayer();
     $page = new Neuron_Core_Template();
     $page->set('username', Neuron_Core_Tools::output_varchar($objUser->getName()));
     $page->set('email', $objUser->getEmail());
     $page->set('registration', date('d/m/Y H:i:s', $objUser->getCreationDate()));
     $page->set('lastrefresh', date('d/m/Y H:i:s', $objUser->getLastRefresh()));
     $page->set('premiumend', date('d/m/Y H:i:s', $objUser->getPremiumEndDate()));
     foreach ($objUser->getVillages() as $v) {
         $page->addListValue('villages', array('village' => Neuron_Core_Tools::output_varchar($v->getName()), 'url' => ABSOLUTE_URL . '#' . implode($v->buildings->getTownCenterLocation(), ',')));
     }
     $page->set('reset_url', $this->getUrl('user', array('id' => $objUser->getId(), 'action' => 'reset')));
     if ($admin->isModerator()) {
         $page->set('logs_url', $this->getUrl('gamelogs', array('players' => $objUser->getId())));
         $page->set('contact_url', $this->getUrl('messages', array('view' => 'write', 'target' => $objUser->getNickname())));
     }
     if ($admin->isAdmin()) {
         if (isset($_POST['admin_status'])) {
             $status = Neuron_Core_Tools::getInput('_POST', 'admin_status', 'int');
             $objUser->setAdminStatus($status);
         }
         $page->set('admin_action', $this->getUrl('user', array('id' => $objUser->getId())));
         $modes = array();
         foreach ($objUser->getAdminModes() as $k => $v) {
             if ($k < $admin->getAdminStatus()) {
                 $modes[$k] = $v;
             }
         }
         $page->set('admin_modes', $modes);
     }
     $page->set('adminmode', $objUser->getAdminStatus());
     $page->set('adminmodestring', $objUser->getAdminStatusString());
     $page->set('banoptions', array(300 => '5 minutes', 1800 => '30 minutes', 3600 => '1 hour', 21600 => '6 hours', 86400 => '1 day', 604800 => '1 week', 1209600 => '2 weeks', 2678400 => '1 month', 31536000 => '1 year'));
     $this->addBans($page, $objUser);
     $data = $this->getModeratorHistory($objUser);
     foreach ($data as $v) {
         if (!$v['isProcessed']) {
             $status = 'pending';
         } elseif ($v['isExecuted']) {
             $status = 'approved';
         } else {
             $status = 'declined';
         }
         $reason = Neuron_Core_Tools::output_text($v['reason']);
         $rcheck = strip_tags($reason);
         $rcheck = trim($rcheck);
         $page->addListValue('history', array('date' => date(DATETIME, $v['date']), 'action' => $v['action'], 'reason' => !empty($rcheck) ? $reason : null, 'admin' => $v['admin']->getDisplayName(), 'isExecuted' => $v['isExecuted'], 'isProcessed' => $v['isProcessed'], 'status' => $status));
     }
     $openids = $objUser->getOpenIDs();
     foreach ($openids as $v) {
         $page->addListValue('openids', array('url' => $v));
     }
     if (Neuron_GameServer::getPlayer()->getAdminStatus() >= 9) {
         $page->set('refundcredits', $this->getUrl('user', array('id' => $objUser->getId())));
         $credits = Neuron_Core_Tools::getInput('_POST', 'refundcredits', 'int');
         $reason = Neuron_Core_Tools::getInput('_POST', 'refundreason', 'varchar');
         if ($credits && $reason) {
             if ($this->refundCredits($objUser, $credits, $reason)) {
                 $page->set('refunddone', true);
             }
         }
     }
     return $page->parse('pages/admin/user/overview.phpt');
 }