コード例 #1
0
ファイル: lib_header.php プロジェクト: reillo/ninjawars
/**
  *  Creates all the environmental variables, with no outputting.
**/
function init($private, $alive)
{
    global $today;
    // ******************** Declared variables *****************************
    $today = date("F j, Y, g:i a");
    // Today var is only used for creating mails.
    // Page viewing settings usually set before the header.
    $error = null;
    // Logged in or alive error.
    update_activity_info();
    // *** Updates the activity of the page viewer in the database.
    return globalize_user_info($private, $alive);
    // Sticks lots of user info into the global namespace for backwards compat.
}
コード例 #2
0
ファイル: lib_header.php プロジェクト: NinjaWars/ninjawars
/**
 * Creates all the environmental variables, with no outputting.
 *
 * Places much of the user info into the global namespace.
 */
function init($private, $alive)
{
    global $today;
    global $username;
    global $char_id;
    // ******************** Declared variables *****************************
    $today = date("F j, Y, g:i a");
    // Today var is only used for creating mails.
    // Page viewing settings usually set before the header.
    update_activity_info();
    // *** Updates the activity of the page viewer in the database.
    $error = null;
    $char_id = self_char_id();
    // Will default to null.
    if ((!is_logged_in() || !$char_id) && $private) {
        $error = 'log_in';
        // A non-null set of content being in the error triggers a die at the end of the header.
    } elseif ($char_id) {
        // **************** Player information settings. *******************
        global $player, $player_id;
        // Polluting the global namespace here.  Booo.
        $player = new Player($char_id);
        // Defaults to current session user.
        $username = $player->name();
        // Set the global username.
        $player_id = $player->player_id;
        if ($alive) {
            // That page requires the player to be alive to view it
            if (!$player->health()) {
                $error = 'dead';
            } else {
                if ($player->hasStatus(FROZEN)) {
                    $error = 'frozen';
                }
            }
        }
    }
    return $error;
}
コード例 #3
0
ファイル: header.php プロジェクト: ninjajerry/ninjawars
$filter = new Filter();
// *** Creates the filters for later use.
$sql = new DBAccess();
$section_only = in('section_only');
// Check whether it's an ajax section.
// ******************** Declared variables *****************************
$today = date("F j, Y, g:i a");
// Today var is only used for creating mails.
// Page viewing settings usually set before the header.
$private = isset($private) ? $private : NULL;
$quickstat = isset($quickstat) ? $quickstat : NULL;
$alive = isset($alive) ? $alive : NULL;
$page_title = isset($page_title) ? $page_title : "NinjaWars";
$error = null;
// Logged in or alive error.
update_activity_info();
// *** Updates the activity of the page viewer in the database.
if (!is_logged_in()) {
    if ($private) {
        $error = render_viewable_error('log_in');
        // Content being in the error triggers a die at the end of the header.
    }
} else {
    // **************** Player information settings. *******************
    $username = SESSION::get('username');
    $player = new Player($username);
    // Defaults to current session user.
    $players_id = $player->player_id;
    $player_id = $players_id;
    // Just two aliases for the player id.
    $players_email = $player->vo->email;