Exemple #1
0
function go()
{
    ob_start();
    require_once LOCAL_PATH . "conf.php";
    require_once LOCAL_PATH . "framework/common/includes.php";
    require_once LOCAL_PATH . "routes.php";
    // parse the requested page, and make it available globally
    if ($_GET["id"] != '') {
        $GLOBALS["REQUEST_PARAMS"] = explode("/", $_GET["id"]);
    } else {
        $GLOBALS["REQUEST_PARAMS"] = array('', '');
    }
    // "/admin/login" gets exploded as { "", "admin", "login" } but it looks better when not rewriting
    // -- so shift off the empty element of the array
    if ($GLOBALS["REQUEST_PARAMS"][0] == "") {
        array_shift($GLOBALS["REQUEST_PARAMS"]);
    }
    if (end($GLOBALS["REQUEST_PARAMS"]) == "") {
        array_pop($GLOBALS["REQUEST_PARAMS"]);
    }
    // take out a prefix, if we're not running from /
    // TODO: remove in order
    function remove_prefix($val)
    {
        return in_array($val, explode("/", ltrim(rtrim(BASEHREF, '/'), '/')));
    }
    if (REWRITE_URLS) {
        array_filter($GLOBALS["REQUEST_PARAMS"], "remove_prefix");
    }
    // display the requested page
    if (!display_page($GLOBALS["REQUEST_PARAMS"])) {
        display_404();
    }
    ob_end_flush();
}
Exemple #2
0
function display_submod($submod, $mod)
{
    if (!$submod->hasVisible()) {
        return;
    }
    echo '<div class="submod">';
    ?>
 <img src="<?php 
    echo $submod->_img;
    ?>
_select.png" alt="" style="float:right;" /><?php 
    /*if (!$submod->_visibility) { //if submod not visible
          return;
      }*/
    echo '<h3>';
    $url = urlStr($submod->_defaultpage);
    echo "<a style=\"text-decoration: none;\" href=\"{$url}\">" . $submod->getDescription() . "</a><br/>";
    echo "</h3>";
    print "<ul>";
    foreach ($submod->getPages() as $page) {
        display_page($page, $submod, $mod);
    }
    print "</ul>";
    echo '</div>';
}
function shortcode_get_our_app()
{
    ob_start();
    display_page('get-our-app');
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Exemple #4
0
/**
 * SolidWorks (entry point)
 *
 * This function serves as the entry point for the entire application.  It opens
 * the session, loads the Page object, processes any forms, and invokes any actions
 * for the page.
 *
 * @package SolidWorks
 * @author John Diamond <*****@*****.**>
 */
function solidworks(&$conf, $smarty)
{
    global $page;
    // Make the Page object available to smarty_extensions
    global $translations;
    // Make sure the client is logged in as a valid user before proceeding
    validate_client();
    // Load the user's language preference
    $language = isset($_SESSION['client']['userdbo']) ? $_SESSION['client']['userdbo']->getLanguage() : null;
    if ($language != null) {
        TranslationParser::load("language/" . $language);
        Translator::getTranslator()->setActiveLanguage($language);
    }
    if ($_SESSION['currentpage'] != $_GET['page']) {
        $_SESSION['lastpage'] = $_SESSION['currentpage'];
    }
    // Get a Page object for the page being requested
    $page = null;
    $page = get_page_object($conf, $smarty);
    if ($page == null) {
        // Delete current session
        session_destroy();
        // Instantiate a generic page object
        $page = new Page();
    }
    // Make sure the client has access to this page
    if (!$page->control_access()) {
        // Access denied
        $page->setError(array("type" => "ACCESS_DENIED"));
        $page->goback(1);
    }
    // Process any forms
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
        handle_post_request();
    }
    // Execute any action if present in the URL
    if (isset($_GET['action'])) {
        $page->action($_GET['action']);
    }
    // Display
    display_page($page);
    // Push page onto the navigation stack
    $_SESSION['navstack'][] = array("page" => $page->getName(), "url" => $page->getURL());
}
function display_static_page($page, $pages, $vars = array(), $options = array())
{
    if (!isset($pages[$page])) {
        // Unlisted page requested.
        error_log('  Invalid page (' . $page . ') requested on page.php.');
        display_page('404.tpl', '404');
    } else {
        if (!is_array($pages[$page])) {
            $template = "page." . $page . ".tpl";
            $title = $page;
            // Display_page will prepend with 'Ninja Wars: '
        } else {
            $page_info = $pages[$page];
            $template = first_value(@$page_info['template'], "page." . $page . ".tpl");
            $title = $page_info['title'];
            $callback = @$page_info['callback'];
            // TODO: Merge the vars array instead of overwriting.
            if ($callback && function_exists($callback)) {
                $vars = array_merge($callback(), $vars);
                // Call the callback to return the vars.
            }
        }
        cache_headers(24);
        // 24 hour caching.
        display_page($template, $title, $vars, $options);
    }
}
Exemple #6
0
    $work_multiplier = 30;
    $worked = $new_gold = $not_enough_energy = $use_second_description = null;
    $is_logged_in = is_logged_in();
    $worked = intval(in('worked'));
    $recommended_to_work = 10;
    // Store or retrieve the last value of turns worked.
    if ($worked && is_numeric($worked)) {
        set_setting('turns_worked', $worked);
        $recommended_to_work = $worked;
    } else {
        $last_worked = get_setting('turns_worked');
        $recommended_to_work = $last_worked ? $last_worked : 10;
    }
    // Work only if the work was requested, not just if the setting was set.
    if ($worked > 0) {
        $turns = get_turns($char_id);
        if ($worked > $turns) {
            $not_enough_energy = true;
        } else {
            $new_gold = $worked * $work_multiplier;
            // *** calc amount worked ***
            add_gold($char_id, $new_gold);
            $turns = subtractTurns($char_id, $worked);
            $use_second_description = true;
        }
    }
    $gold = get_gold($char_id);
    // Get the current/final gold.
    $gold_display = number_format($gold);
    display_page('work.tpl', 'Working in the Village', get_certain_vars(get_defined_vars(), array()), array('quickstat' => 'player'));
}
            OX_Admin_Redirect::redirect("{$page}?clientid={$clientid}");
        }
    }
}
OA_Permission::enforceAccessToObject('clients', $clientid);
OA_Permission::enforceAccessToObject('campaigns', $campaignid);
if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
    OA_Permission::enforceAllowed(OA_PERM_BANNER_EDIT);
    OA_Permission::enforceAccessToObject('banners', $bannerid);
} else {
    OA_Permission::enforceAccessToObject('banners', $bannerid, true);
}
$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'] = $clientid;
$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['campaignid'][$clientid] = $campaignid;
phpAds_SessionDataStore();
display_page($bannerid, $campaignid, $clientid);
function display_page($banner_id, $campaign_id, $client_id)
{
    $page_name = basename($_SERVER['PHP_SELF']);
    $entities = array('clientid' => $client_id, 'campaignid' => $campaign_id, 'bannerid' => $banner_id);
    $entity_id = OA_Permission::getEntityId();
    if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
        $entity_type = 'advertiser_id';
    } else {
        $entity_type = 'agency_id';
    }
    // Display navigation
    $other_campaigns = Admin_DA::getPlacements(array($entity_type => $entity_id));
    $other_banners = Admin_DA::getAds(array('placement_id' => $campaign_id), false);
    displayNavigationBanner($page_name, $other_campaigns, $other_banners, $entities);
    if (!empty($banner_id)) {
Exemple #8
0
    $data = query_row('
	SELECT player_id, uname, accounts.verification_number as verification_number, CASE WHEN active = 1 THEN 1 ELSE 0 END AS active, accounts.active_email, 
	CASE WHEN accounts.confirmed = 1 THEN 1 ELSE 0 END as confirmed, status, member, days, ip, players.created_date 
	FROM accounts JOIN account_players ON _account_id = account_id JOIN players ON _player_id = player_id 
	WHERE account_id = :acctId', array(':acctId' => $aid));
    if (rco($data)) {
        $check = $data['verification_number'];
        $confirmed = $data['confirmed'];
        $active = $data['active'];
        $username = $data['uname'];
    } else {
        $active = $check = $confirmed = $username = null;
    }
    //debug($data, $confirm, $check, $confirmed);
    //debug($check, $confirm);
    $confirmation_confirmed = false;
    if ($confirmed == 1) {
        // Confirmation state from the database is already confirmed.
    } else {
        if ($check && $confirm && $confirm == $check || $acceptable_admin_override) {
            // Confirmation number matches whats in the database and neither is null, or the admin override was met.
            query('UPDATE accounts SET operational = true, confirmed=1 WHERE account_id = :accountID', array(':accountID' => $aid));
            $statement = DatabaseConnection::$pdo->prepare('UPDATE players SET active = 1 WHERE player_id in (SELECT _player_id FROM account_players WHERE _account_id = :accountID)');
            $statement->bindValue(':accountID', $aid);
            $statement->execute();
            // todo - test for success
            $confirmation_confirmed = true;
        }
    }
    display_page('confirm.tpl', 'Game Confirmation', get_certain_vars(get_defined_vars()), array('quickstat' => false));
}
Exemple #9
0
                                            subtract_gold($char_id, $thief_gold);
                                        } else {
                                            if ($thief_attack < 30) {
                                                add_gold($char_id, $thief_gold);
                                                add_item($char_id, 'shuriken', $quantity = 1);
                                            }
                                        }
                                    } else {
                                        $thief_gold = 0;
                                    }
                                    $npc_template = 'npc.thief.tpl';
                                    $combat_data = array('attack' => $thief_attack, 'gold' => $thief_gold, 'victory' => $victory);
                                }
                            }
                        }
                    }
                }
            }
        }
        // ************ End of specific npc logic *******************
        // ************ FINAL CHECK FOR DEATH ***********************
        if ($player->health() <= 0) {
            $health = false;
            sendMessage("SysMsg", $username, "DEATH: You have been killed by a " . $victim . " on {$today}");
        }
        // Subtract the turn cost for attacking an npc, almost always going to be 1 apart from perhaps oni or group-of-thieves
        subtractTurns($char_id, $turn_cost);
    }
    // Add the combat_data into the standard stuff.
    display_page('npc.tpl', 'Battle', array('npc_template' => $npc_template, 'attacked' => 1, 'turns' => $turns, 'random_encounter' => $random_encounter, 'health' => $health) + $combat_data, array('quickstat' => 'player'));
}
<?php

/**
 * @package WordPress
 * @subpackage Study Edge
 * @since Study Edge 1.0
 */
/*
global $nav;

get_header();
$pages = dirname(__FILE__) . '/pages/';
require(file_exists($f = $pages . $nav->getActive() . '.php') ? $f : $pages . 'home.php');
get_footer();
*/
get_header();
display_page('home');
get_footer();
Exemple #11
0
<?php

$private = false;
$alive = false;
if ($error = init($private, $alive)) {
    display_error($error);
} else {
    require_once LIB_ROOT . "control/lib_player_list.php";
    require_once LIB_ROOT . "control/lib_player.php";
    $player_size = player_size();
    display_page('player-tags.tpl', 'Ninja List', array('player_size' => $player_size), array('quickstat' => false));
}
Exemple #12
0
    $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));
}
Exemple #13
0
<?php

display_page('public.tpl', 'Public Discussion');
function display_publication($query, $pageNum = 1)
{
    global $config;
    global $db;
    $count_sql = 'SELECT COUNT(id) AS c FROM nz WHERE publication LIKE ' . $db->qstr($query . '%');
    $sql = "SELECT * FROM nz WHERE publication LIKE " . $db->qstr($query . '%') . " ORDER BY year";
    $q = do_query($query, $count_sql, $sql, $pageNum);
    display_top($query);
    display_search_box('publication');
    echo '<h2>Showing results for publication "' . $query . '"</h2>';
    display_pagination('publication', $q);
    display_page($q);
    display_pagination('publication', $q);
    display_bottom();
}
Exemple #15
0
                            //non-covert acts
                            $player->subtractStatus(STEALTH);
                            $stealthLost = true;
                        } else {
                            $stealthLost = false;
                        }
                    }
                }
                $targetName = $targetObj->vo->uname;
                $targetHealth = $targetObj->vo->health;
                $targetHealthPercent = $targetObj->health_percent();
                $turns_to_take = 1;
                if ($item_used) {
                    // *** remove Item ***
                    removeItem($user_id, $item->getName(), 1);
                    // *** Decreases the item amount by 1.
                }
                if ($victim_alive && $using_item) {
                    $repeat = true;
                }
            }
        }
    }
    // *** Take away at least one turn even on attacks that fail to prevent page reload spamming ***
    if ($turns_to_take < 1) {
        $turns_to_take = 1;
    }
    $ending_turns = subtractTurns($user_id, $turns_to_take);
    assert($item->hasEffect('speed') || $ending_turns < $starting_turns || $starting_turns == 0);
    display_page('inventory_mod.tpl', 'Item Usage', get_defined_vars(), array('quickstat' => 'player'));
}
Exemple #16
0
            $type = 0;
    }
    // Sending mail section.
    if ($message && $messenger) {
        if ($to_clan && $has_clan) {
            $type = 1;
            $target_id_list = $clan->getMemberIds();
            $passfail = Message::sendToGroup($ninja, $target_id_list, $message, $type);
            $message_sent_to = 'your clan';
            $message_to = 'clan';
        } elseif ((bool) $target_id) {
            Message::create(['send_from' => $ninja->id(), 'send_to' => $target_id, 'message' => $message, 'type' => $type]);
            $message_sent_to = $to;
            $message_to = 'individual';
            $type = 0;
        }
    }
    // An illuminate collection object.
    $messages = Message::findByReceiver($ninja, $type, $limit, $offset);
    $message_count = Message::countByReceiver($ninja, $type);
    // To count all the messages
    $pages = ceil($message_count / $limit);
    // Total pages.
    $current_page = $page;
    Message::markAsRead($ninja, $type);
    // mark messages as read for next viewing.
    // TODO: Handle "send" ing to specific, known users.
    $individual_or_clan = $message_to == 'individual' || $message_to == 'clan';
    $parts = compact('command', 'message_sent_to', 'messages', 'current_tab', 'to', 'has_clan', 'type', 'messages_type', 'individual_or_clan', 'pages', 'current_page', 'message_to', 'informational');
    display_page('messages.tpl', 'Messages', $parts, ['quickstat' => false]);
}
Exemple #17
0
function main()
{
    $query = '';
    $bookmark = '';
    // If no query parameters
    if (count($_GET) == 0) {
        default_display();
        exit(0);
    }
    // If show a single record
    if (isset($_GET['id'])) {
        $id = $_GET['id'];
        display_record($id);
    }
    if (isset($_GET['q'])) {
        $query = $_GET['q'];
        if (isset($_GET['bookmark'])) {
            $bookmark = $_GET['bookmark'];
        }
        display_search($query, $bookmark);
        exit(0);
    }
    if (isset($_GET['page'])) {
        $page = $_GET['page'];
        display_page($page);
        exit(0);
    }
    /*
    if (isset($_GET['author']))
    {	
    	$query = $_GET['author'];
    	display_author($query);
    	exit(0);
    }
    */
}
Exemple #18
0
    // Player info display pieces.
    require_once LIB_ROOT . "control/Skill.php";
    $skillsListObj = new Skill();
    $player = new Player(self_char_id());
    $level = $player->level();
    $class = $player->class_display_name();
    // Just to be displayed in the template.
    $starting_turns = $player->turns();
    $starting_ki = $player->ki();
    $status_list = get_status_list();
    $no_skills = true;
    $stealth = $skillsListObj->hasSkill('Stealth');
    if ($stealth) {
        $no_skills = false;
    }
    $stealth_turn_cost = $skillsListObj->getTurnCost('Stealth');
    $unstealth_turn_cost = $skillsListObj->getTurnCost('Unstealth');
    $chi = $skillsListObj->hasSkill('Chi');
    $speed = $skillsListObj->hasSkill('speed');
    $hidden_resurrect = $skillsListObj->hasSkill('hidden resurrect');
    $midnight_heal = $skillsListObj->hasSkill('midnight heal');
    $kampo_turn_cost = $skillsListObj->getTurnCost('Kampo');
    $kampo = $skillsListObj->hasSkill('kampo');
    $heal = $skillsListObj->hasSkill('heal');
    $heal_turn_cost = $skillsListObj->getTurnCost('heal');
    $clone_kill = $skillsListObj->hasSkill('clone kill');
    $clone_kill_turn_cost = $skillsListObj->getTurnCost('clone kill');
    $wrath = $skillsListObj->hasSkill('wrath');
    $can_harmonize = $starting_ki;
    display_page('skills.tpl', 'Your Skills', get_certain_vars(get_defined_vars(), array('status_list')), array('quickstat' => 'player'));
}
Exemple #19
0
    $changed = PlayerDAO::saveDetails($char);
    redirect('/stats.php?changed=' . (int) $changed . ($profile_changed ? '&profile_changed=1' : ''));
}
/*
if(false && DEBUG){
	$description = 'This is a description here and all';
	$goals = 'Kill ninja of the ramen clan';
	$beliefs = 'I believe in a one true ninja god';
	$instincts = 'When I hear whistling, I duck';
	$traits = 'Hardy, nervous, meaty, silent';
}
*/
$player = self_info();
//$player['created_date']=$player['created_date']? date("c", strtotime($player['created_date'])) : null;
$class_theme = class_theme($char->class_identity());
$level_category = level_category($player['level']);
$status_list = get_status_list();
$gravatar_url = generate_gravatar_url($player['player_id']);
$gurl = $gravatar_url;
$rank_display = get_rank($char_id);
// rank display.
$profile_editable = $player['messages'];
$parts = get_certain_vars(get_defined_vars(), ['player', 'level_category', 'status_list', 'description', 'goals', 'beliefs', 'instincts', 'traits', 'dev', 'changed']);
// Set the parts array's player clan if any is found.
if ($parts['player_clan'] = get_clan_by_player_id($char_id)) {
    // Set the char clan name and id for later usage.
    $parts['clan_name'] = $parts['player_clan']->getName();
    $parts['clan_id'] = $parts['player_clan']->getID();
}
display_page('stats.tpl', 'Ninja Stats', $parts, array('quickstat' => 'player'));
Exemple #20
0
           'post_reset' => 'postReset',
       ],
   ],
*/
use NinjaWars\core\control\PasswordController;
use NinjaWars\core\data\PasswordResetRequest;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;
$command = (string) in('command');
$controller = new PasswordController();
$request = Request::createFromGlobals();
switch (true) {
    case $command == 'post_reset':
        $response = $controller->postReset($request);
        break;
    case $command == 'reset':
        $response = $controller->getReset($request);
        break;
    case $command == 'email':
        $response = $controller->postEmail($request);
        break;
    default:
        $command == 'index';
        $response = $controller->index($request);
        break;
}
if ($response instanceof RedirectResponse) {
    $response->send();
} else {
    display_page($response['template'], $response['title'], $response['parts'], $response['options']);
}
Exemple #21
0
<?php

require_once LIB_ROOT . "control/lib_player.php";
$private = false;
$alive = false;
if ($error = init($private, $alive)) {
    redirect('list.php');
} else {
    $stats = membership_and_combat_stats();
    $vicious_killer = $stats['vicious_killer'];
    $duels = query_array("SELECT dueling_log.*, attackers.player_id AS attacker_id, defenders.player_id AS defender_id FROM dueling_log JOIN players AS attackers ON attackers.uname = attacker JOIN players AS defenders ON defender = defenders.uname ORDER BY id DESC LIMIT 500");
    display_page('duel.tpl', 'Bath House', get_certain_vars(get_defined_vars(), array('duels')), array('quickstat' => false));
}
Exemple #22
0
            // Class change requested, not a page refresh, and requested class is existant.
            if (!$class_change_requirement_error) {
                // Class change conditions are ok, so:
                // subtract the cost in turns
                // ...and change the class.
                $class_change_error = set_class($char_id, $destination_class_identity);
                if (!$class_change_error) {
                    $char->changeTurns(-1 * $class_change_cost);
                }
            }
        }
        $possibly_changed_class = char_class_identity($char_id);
        $possibly_changed_class_name = char_class_name($char_id);
        $possibly_changed_class_theme = class_theme($possibly_changed_class);
        $upgrade_requested = $in_upgrade && $in_upgrade == 1;
        $levelled = false;
        if ($upgrade_requested) {
            // Try to level up.
            $levelled = level_up_if_possible($char_id);
            $char = $player = new Player($char_id);
            $userLevel = $char->level();
            $char_data = $char->data();
            // Get the info for the next level, especially if that has changed.
            $nextLevel = min($userLevel + 1, $max_level);
            $userKills = char_kills($char_id);
            $required_kills = required_kills_to_level($userLevel);
        }
    }
    // End of the logged in processing.
    display_page('dojo.tpl', 'Dojo', get_defined_vars(), array('quickstat' => 'player'));
}
Exemple #23
0
        if ($password) {
            $success = $USER->send_password_reminder();
            if ($success) {
                print "<p>A new password has been sent to " . _htmlentities($email) . "</p>\n";
            } else {
                $errors["sending"] = "Sorry, there was a technical problem sending the email.";
                display_page($errors);
            }
        } else {
            // This email address isn't in the DB.
            $errors["passwordchange"] = "Sorry, there was a problem and we couldn't set a new password for " . _htmlentities($email);
            display_page($errors);
        }
    }
} else {
    display_page();
}
function display_page($errors = array())
{
    global $this_page, $PAGE;
    if (isset($errors["sending"])) {
        $PAGE->error_message($errors["sending"]);
    } else {
        print "<p>If you can't remember your password we can send you a new one.</p>\n<p>If you would like a new password, enter your address below.</p>\n";
    }
    ?>

<form method="get" action="<?php 
    $URL = new URL($this_page);
    echo $URL->generate();
    ?>
Exemple #24
0
            if ($added_bounty > 0) {
                $player->set_bounty($player->bounty + $added_bounty * 25);
            } else {
                if ($target->bounty > 0) {
                    $player->set_gold($player->gold + $target->bounty);
                    $target->set_bounty(0);
                    $bounty_msg = "You have valiantly slain the wanted criminal, {$target}! For your efforts, you have been awarded {$bounty} gold!";
                    sendMessage('Village Doshin', $player->name(), $bounty_msg);
                }
            }
            $target_message = "{$attacker_id} has killed you with {$command} and taken {$loot} gold.";
            send_event($attacker_char_id, $target->id(), $target_message);
            $attacker_message = "You have killed {$target} with {$command} and taken {$loot} gold.";
            sendMessage($target->vo->uname, $player->name(), $attacker_message);
            $target->save();
            $player->save();
        }
    }
    $turns_to_take = $turns_to_take - $turn_cost;
    if (!$covert && $player->hasStatus(STEALTH)) {
        $player->subtractStatus(STEALTH);
        $destealthed = true;
    }
}
// End of the skill use SUCCESS block.
$ending_turns = $player->changeTurns($turns_to_take);
// Take the skill use cost.
$target_ending_health = $target->health();
$target_name = $target->name();
display_page('skills_mod.tpl', 'Skill Effect', get_defined_vars(), array('quickstat' => 'player'));
Exemple #25
0
 /**
  * Renders the view and sends it to the client
  *
  * @param Array $p_viewSpec The data needed to render a view
  * @return void
  * @note
  * This method generates output
  */
 public static function render($p_viewSpec)
 {
     display_page($p_viewSpec['template'], $p_viewSpec['title'], $p_viewSpec['parts'], $p_viewSpec['options']);
 }
Exemple #26
0
{
}
// Get the questors
function get_questors($quest_id)
{
    $sel = "SELECT p.player_id, p.uname \n        from players p join questers q on p.player_id = q._player_id \n        where quest_id = :quest_id";
    //$questers = query($sel, array(":quest_id"=>array($quest_id, PDO::PARAM_INT)));
    if (DEBUG) {
        $questers = array(array('player_id' => 10, 'uname' => 'glassbox'));
    }
    return $questers;
}
$quest_id = in('quest_id');
$quest_accepted = in('quest_accepted');
$quests = null;
// When accepting a quest, simply display that quest.
if ($quest_accepted) {
    $quest_id = $quest_accepted;
}
// Process the single quest view is quest_id isn't null, otherwise get all quests.
$quests = format_quests(get_quests($quest_id));
if (count($quests) == 1) {
    $quest = reset($quests);
    $tpl = 'quests.single_quest.tpl';
} else {
    $tpl = 'quests.tpl';
}
$parts = array('quest' => $quest, 'quests' => $quests, 'quest_accepted' => $quest_accepted);
$options = array('quickstat' => 'player');
display_page($tpl, 'Quests', $parts, $options);
Exemple #27
0
    $error = null;
    $sent = null;
    $attemptedToSendEmail = false;
    if (!$email && ($password_request || $confirmation_request)) {
        $error = 'invalidemail';
    } else {
        if ($email) {
            $data = user_having_email($email);
            $username = $data['uname'];
            if (!$data['uname']) {
                $error = 'nouser';
            } elseif ($password_request && $data['active']) {
                $sent = send_account_email($email, $data);
                $attemptedToSendEmail = true;
            } else {
                // Confirmation request.
                if ($data['confirmed']) {
                    $error = 'alreadyconfirmed';
                } else {
                    $attemptedToSendEmail = true;
                    $sent = send_confirmation_email($email, $data);
                }
            }
        }
    }
    if ($attemptedToSendEmail && !$sent) {
        $error = 'emailfail';
    }
    $body_classes = 'account-issues';
    display_page('account_issues.tpl', 'Account Problems', get_certain_vars(get_defined_vars(), array('data')), array('quickstat' => false));
}
Exemple #28
0
<?php

require_once LIB_ROOT . "data/lib_npc.php";
$private = false;
$alive = false;
if ($error = init($private, $alive)) {
    display_error($error);
} else {
    // Here is where the node locations are defined, and their order is allocated.
    //
    $nodes = array(array(array('name' => 'Shrine', 'type' => 'shrine building', 'url' => 'shrine.php', 'image' => 'shrine.png', 'tile_image' => 'concentric_shrine.png', 'xcoord' => 0, 'ycoord' => 0, 'id' => 1), array('name' => '', 'type' => 'rice-field', 'url' => '', 'tile_image' => null, 'xcoord' => 0, 'ycoord' => 2, 'id' => 12), array('name' => 'Road', 'type' => 'north-south-road', 'url' => '', 'tile_image' => 'north-south-road.png', 'xcoord' => 2, 'ycoord' => 0, 'id' => 3), array('name' => '', 'type' => 'rice-field', 'url' => '', 'tile_image' => null, 'xcoord' => 0, 'ycoord' => 2, 'id' => 12), array('name' => 'Doshin', 'type' => 'doshin building', 'url' => 'doshin_office.php', 'image' => 'doshin.png', 'tile_image' => 'doshin_building.png', 'xcoord' => 1, 'ycoord' => 0, 'id' => 2)), array(array('name' => '', 'type' => 'wheat-field', 'url' => '', 'tile_image' => null, 'xcoord' => 0, 'ycoord' => 2, 'id' => 15), array('name' => 'Dojo', 'type' => 'dojo building', 'url' => 'dojo.php', 'tile_image' => 'concentric_leaf.png', 'xcoord' => 1, 'ycoord' => 1, 'id' => 7), array('name' => 'Road', 'type' => 'north-south-road', 'url' => '', 'tile_image' => 'north-south-road.png', 'xcoord' => 2, 'ycoord' => 0, 'id' => 3), array('name' => 'Shop', 'type' => 'weapons-shop building', 'url' => 'shop.php', 'tile_image' => 'concentric_star.png', 'xcoord' => 0, 'ycoord' => 1, 'id' => 6), array('name' => '', 'type' => 'rice-field', 'url' => '', 'tile_image' => null, 'xcoord' => 0, 'ycoord' => 2, 'id' => 12)), array(array('name' => 'Rice Paddy', 'type' => 'wheat-field', 'url' => '', 'tile_image' => null, 'xcoord' => 0, 'ycoord' => 2, 'id' => 10), array('name' => 'Road', 'type' => 'east-west-road', 'url' => '', 'xcoord' => 2, 'ycoord' => 1, 'id' => 8), array('name' => 'Village Square', 'type' => 'village-square', 'url' => 'village.php', 'tile_image' => null, 'xcoord' => 0, 'ycoord' => 2, 'id' => 12), array('name' => 'Road', 'type' => 'east-west-road', 'url' => '', 'xcoord' => 2, 'ycoord' => 1, 'id' => 8), array('name' => 'Fields', 'type' => 'rice-field', 'url' => 'work.php', 'tile_image' => 'concentric_field.png', 'xcoord' => 2, 'ycoord' => 14, 'id' => 14)), array(array('name' => '', 'type' => 'wheat-field', 'url' => '', 'tile_image' => null, 'xcoord' => 0, 'ycoord' => 2, 'id' => 15), array('name' => 'Casino', 'type' => 'casino building', 'url' => 'casino.php', 'tile_image' => 'elemental_coin.png', 'xcoord' => 0, 'ycoord' => 2, 'id' => 11), array('name' => 'Road', 'type' => 'north-south-road', 'url' => '', 'tile_image' => 'north-south-road.png', 'xcoord' => 2, 'ycoord' => 1, 'id' => 17), array('name' => 'Bath House', 'type' => 'bath-house building', 'url' => 'duel.php', 'tile_image' => 'concentric_star.png', 'xcoord' => 2, 'ycoord' => 13, 'id' => 19), array('name' => 'Fields', 'type' => 'rice-field', 'url' => 'work.php', 'tile_image' => 'concentric_field.png', 'xcoord' => 2, 'ycoord' => 14, 'id' => 14)), array(array('name' => 'Rice Paddy', 'type' => 'wheat-field', 'url' => '', 'tile_image' => null, 'xcoord' => 0, 'ycoord' => 2, 'id' => 10), array('name' => 'Grassy Knoll', 'type' => 'grass', 'url' => '', 'tile_image' => null, 'xcoord' => 0, 'ycoord' => 2, 'id' => 11), array('name' => 'Road', 'type' => 'north-south-road', 'url' => '', 'tile_image' => 'north-south-road.png', 'xcoord' => 2, 'ycoord' => 1, 'id' => 17), array('name' => 'Fields', 'type' => 'rice-field', 'url' => 'work.php', 'tile_image' => 'concentric_field.png', 'xcoord' => 2, 'ycoord' => 13, 'id' => 13), array('name' => 'Fields', 'type' => 'rice-field', 'url' => 'work.php', 'tile_image' => 'concentric_field.png', 'xcoord' => 2, 'ycoord' => 14, 'id' => 14)));
    /*
    	
    // Old locations array.
    $locations = array(
    	array('name'=>'Shrine', 'url'=>'shrine.php', 'image'=>'shrine.png', 'tile_image'=>'concentric_shrine.png')
    	, array('name'=>'Doshin', 'url'=>'doshin_office.php', 'image'=>'doshin.png', 'tile_image'=>'doshin_building.png')
    	, array('name'=>'Fields', 'url'=>'work.php', 'tile_image'=>'concentric_field.png')
    	, array('name'=>'Shop',   'url'=>'shop.php', 'tile_image'=>'concentric_star.png')
    	, array('name'=>'Dojo',   'url'=>'dojo.php', 'tile_image'=>'concentric_leaf.png')
    	, array('name'=>'Casino', 'url'=>'casino.php', 'tile_image'=>'elemental_coin.png')
    );
    */
    display_page('map.tpl', 'Map', array('nodes' => $nodes, 'show_ad' => rand(1, 20)), array('quickstat' => 'player'));
}
Exemple #29
0
    $display["search"] = dis_log_search_form($params);
  }

}


///////////////////////////////////////////////////////////////////////////////
// Display
///////////////////////////////////////////////////////////////////////////////
$display["head"] = display_head($l_log);
if (! $params["popup"]) {
  $display["header"] = display_menu($module);
}
$display["end"] = display_end();

display_page($display);


///////////////////////////////////////////////////////////////////////////////
// Stores Log parameters transmited in $params hash
// returns : $params hash with parameters set
///////////////////////////////////////////////////////////////////////////////
function get_param_log() {
  global $tf_filename, $tf_version, $tf_date, $param_backup, $popup; 

  // Get global params
  $params = get_global_params("log");

  // sel_user_id can be filled by sel_user_id or sel_ent (see below)
  if (is_array($params["user_id"])) {
    while (list($key, $value) = each($params["user_id"]) ) {
Exemple #30
0
$char_id = self_char_id();
$self = null;
if (positive_int($char_id)) {
    $self = new Player($char_id);
}
if ($self instanceof Player && $self->isAdmin()) {
    // Admin possibilities start here.
    $view_char = null;
    $dupes = AdminViews::duped_ips();
    $stats = AdminViews::high_rollers();
    $npcs = NpcFactory::allNonTrivialNpcs();
    $trivial_npcs = NpcFactory::allTrivialNpcs();
    $char_name = in('char_name');
    if (is_string($char_name) && trim($char_name)) {
        $view_char = get_char_id($char_name);
    }
    // If a request is made to view a character's info, show it.
    $view_char = $view_char ? $view_char : in('view');
    $char_infos = $char_inventory = $message = null;
    if ($view_char) {
        $char_infos = AdminViews::split_char_infos($view_char);
        $char_inventory = AdminViews::char_inventory($view_char);
        $message = $char_infos[0]['messages'];
        // Split the message out as a separate var for space reasons
        unset($char_infos[0]['messages']);
    }
    display_page('ninjamaster.tpl', 'Admin Actions', ['stats' => $stats, 'char_infos' => $char_infos, 'dupes' => $dupes, 'char_inventory' => $char_inventory, 'char_name' => $char_name, 'npcs' => $npcs, 'trivial_npcs' => $trivial_npcs, 'message' => $message]);
} else {
    // Redirect to the root site.
    redirect('/');
}