Exemplo n.º 1
0
 public function prepare()
 {
     global $SITE, $db;
     $this->template = "maps";
     $this->tab = 'map';
     $this->title = 'Popular maps';
     $f = $db->query_first("SELECT id, name, rank, score, plays, players FROM tf2_vars v INNER JOIN tf2_maps m on v.value = m.id");
     $fa = array('image' => map_functions::image('x600.y360', $f), 'label' => map_functions::label('', $f), 'link' => map_functions::link('', $f), 'type' => map_functions::type('', $f));
     $mlen = 18;
     $f['display_name'] = strlen($f['name']) > $mlen ? substr($f['name'], 0, $mlen - 3) . '...' : $f['name'];
     $this->params['feat'] = array_merge($f, $fa);
     ///////////////////////////////////////// New maps ////////////////////////////////////
     $this->params['new_maps'] = map::get_map_list(array('funcs' => array('count' => array('func' => 'count', 'param' => '%02d'), 'link' => array('func' => 'link'), 'label' => array('func' => 'label', 'param' => 25)), 'query' => 'SELECT * FROM tf2_maps ORDER BY first_seen DESC LIMIT 10;'));
     //////////////////////////////////////// popular maps ///////////////////////////////////
     $this->params['popular_maps'] = map::get_map_list(array('funcs' => array('link' => array('func' => 'link'), 'label' => array('func' => 'label'), 'image' => array('func' => 'image', 'param' => 'xy165')), 'query' => sprintf('SELECT id,name, official FROM tf2_maps ORDER BY score DESC LIMIT 10', $time)));
 }
 public function prepare()
 {
     global $SITE, $db;
     $this->template = "map_list";
     $this->tab = 'map';
     $this->title = 'Map list';
     $page_size = 50;
     $page = mysql_real_escape_string((int) $this->request[1]);
     $method = $this->request[0];
     $query = '';
     switch ($method) {
         case 'rank':
         case 'score':
         default:
             $method = 'score';
             $query = sprintf('SELECT id, name, official, score, rank, players, servers, plays FROM tf2_maps ORDER BY score DESC LIMIT ' . $page * $page_size . ', ' . $page_size);
     }
     $this->params['maps'] = map::get_map_list(array('funcs' => array('link' => array('func' => 'link'), 'label' => array('func' => 'label'), 'type' => array('func' => 'type'), 'icon' => array('func' => 'icon'), 'image' => array('func' => 'image', 'param' => 'x128.y96')), 'query' => $query));
     $this->params['method'] = $method;
     $this->params['page'] = $page;
 }
 public function prepare()
 {
     global $db;
     $this->template = "map_search";
     require_once 'classes/map.php';
     $q = $this->request['search'];
     //$db->debug=true;
     $db->query("SELECT name FROM tf2_maps WHERE name LIKE %s", array(sprintf("%%%%%s%%%%", $q)));
     //echo mysql_error();
     if ($db->num_rows() == 1) {
         $row = $db->fetch_array();
         //die();
         header('Location: /map/' . $row['name']);
         exit;
     }
     if (!$db->num_rows()) {
         page::error("We searched and searched", "But we just couldn't find the map you were looking for.\r\n\t\t\t\tRest assured Heavy is on the job. He won't rest until he knows who's been tampering with his gun.\r\n\t\t\t\t<br/><br/>That's what you were searching for, right?", array('image' => "heavy_yell"));
     }
     //$db->debug=true;
     $this->params['list'] = map::get_map_list(array('funcs' => array('link' => array('func' => 'link'), 'label' => array('func' => 'label')), 'query' => sprintf('SELECT m.id, m.name, m.official, m.score, plays, servers, first_seen FROM tf2_maps m WHERE name LIKE \'%%%s%%\' ORDER BY score DESC LIMIT 50', $q)));
     $this->title = sprintf("Search: %s", htmlspecialchars($this->request[0]));
 }