예제 #1
0
파일: list.php 프로젝트: reillo/ninjawars
 $numofpages = ceil($totalrows / $record_limit);
 $limitvalue = (int) max(0, $page * $record_limit - $record_limit);
 // Get the ninja information to create the lists.
 $sel = "SELECT rank_id, rankings.uname, class.class_name as class, class.identity as class_identity, class.theme as class_theme, rankings.level, rankings.alive, rankings.days, clan_player._clan_id AS clan_id, clan.clan_name, players.player_id\n\tFROM rankings LEFT JOIN clan_player ON player_id = _player_id LEFT JOIN clan ON clan_id = _clan_id JOIN players on rankings.player_id = players.player_id JOIN class on class.class_id = players._class_id " . (count($where_clauses) ? " WHERE active = 1 AND " . implode($where_clauses, ' AND ') : "") . " ORDER BY rank_id ASC, player_id ASC\n\tLIMIT :limit OFFSET :offset";
 $ninja_info = DatabaseConnection::$pdo->prepare($sel);
 for ($i = 0; $i < count($queryParams); $i++) {
     // *** Reformulate if queryParams gets to be more than 3 or for items
     $ninja_info->bindValue(':param' . $i, $queryParams[$i]);
 }
 $ninja_info->bindValue(':limit', $record_limit);
 $ninja_info->bindValue(':offset', $limitvalue);
 $ninja_info->execute();
 $last_page = $totalrows - $record_limit * $page > 0;
 if (!$searched) {
     // Will not display active ninja on a search page.
     $active_ninjas = get_active_players(5, $alive_only);
     // get  the currently active ninjas
 } else {
     $active_ninjas = null;
 }
 // Format each of the player rows, then just pass 'em to the template.
 $ninja_count = 0;
 $player_rows = '';
 $ninja_rows = array();
 while ($a_player = $ninja_info->fetch()) {
     $ninja_rows[] = format_ninja_row($a_player);
     $ninja_rows[$ninja_count]['odd_or_even'] = ($ninja_count + 1) % 2 ? "odd" : "even";
     $ninja_count++;
 }
 $parts = get_certain_vars(get_defined_vars(), $whitelist = array('ninja_rows', 'active_ninjas'));
 display_page('list.tpl', 'Ninja List', $parts, array('quickstat' => false));
예제 #2
0
<?php

require_once LIB_ROOT . "control/lib_player_list.php";
require_once LIB_ROOT . "control/lib_grouping.php";
require_once LIB_ROOT . "data/lib_npc.php";
$private = true;
$alive = false;
if ($error = init($private, $alive)) {
    header('Location: list.php');
} else {
    $char_name = self_name();
    $peers = nearby_peers(self_char_id());
    $active_ninjas = get_active_players(5, true);
    // Get the currently active ninjas
    $char_info = self_info();
    $char = new Player(self_char_id());
    $match_string = in('enemy_match', null, 'no filter');
    $add_enemy = in('add_enemy', null, 'toInt');
    $remove_enemy = in('remove_enemy', null, 'toInt');
    $enemy_limit = 20;
    $max_enemies = false;
    $enemy_list = null;
    if ($match_string) {
        $found_enemies = get_enemy_matches($match_string);
    } else {
        $found_enemies = null;
    }
    if (is_numeric($remove_enemy) && $remove_enemy != 0) {
        remove_enemy($remove_enemy);
    }
    if (is_numeric($add_enemy) && $add_enemy != 0) {