当前位置: 首页>>代码示例>>PHP>>正文


PHP Player::getSessionPlayer方法代码示例

本文整理汇总了PHP中Player::getSessionPlayer方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::getSessionPlayer方法的具体用法?PHP Player::getSessionPlayer怎么用?PHP Player::getSessionPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player::getSessionPlayer方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: content

function content()
{
    $event = NULL;
    if (isset($_GET['name'])) {
        $event = new Event($_GET['name']);
        eventForm($event);
    } elseif (strcmp($_POST['mode'], "Create New Event") == 0) {
        if (Player::getSessionPlayer()->isHost()) {
            if (isset($_POST['insert'])) {
                insertEvent();
                eventList();
            } else {
                eventForm();
            }
        } else {
            authFailed();
        }
    } elseif (strcmp($_GET['mode'], "create") == 0) {
        eventForm();
    } elseif (isset($_POST['name'])) {
        $event = new Event($_POST['name']);
        if (!$event->authCheck($_SESSION['username'])) {
            authFailed();
        } else {
            if (strcmp($_POST['mode'], "Parse DCI Files") == 0) {
                dciInput();
            } elseif (strcmp($_POST['mode'], "Auto-Input Event Data") == 0) {
                autoInput();
            } elseif (strcmp($_POST['mode'], "Update Registration") == 0) {
                updateReg();
            } elseif (strcmp($_POST['mode'], "Update Match Listing") == 0) {
                updateMatches();
            } elseif (strcmp($_POST['mode'], "Update Medals") == 0) {
                updateMedals();
            } elseif (strcmp($_POST['mode'], "Upload Trophy") == 0) {
                if (insertTrophy()) {
                    $event->hastrophy = 1;
                }
            } elseif (strcmp($_POST['mode'], "Update Event Info") == 0) {
                $event = updateEvent();
            }
            eventForm($event);
        }
    } else {
        echo "<table style=\"border-width: 0px;\" align=\"center\">";
        echo "<tr><td>";
        echo "<form action=\"event.php\" method=\"post\">";
        echo "<input type=\"submit\" name=\"mode\" value=\"Create New Event\">";
        echo "</form></td><td>";
        echo "<form action=\"format.php\" method=\"post\">";
        echo "<input type=\"submit\" name=\"mode\" value=\"View/Add Formats\">";
        echo "</form></td></tr>";
        echo "</table><br><br>";
        eventList($_POST['series'], $_POST['season']);
    }
}
开发者ID:OldVig,项目名称:gatherling,代码行数:56,代码来源:event.php

示例2: session_start

<?php

# Upgrades the database.  There are a couple of pretty crude checks for
# versions 0 (no database) and 1 (no version table).  Hopefully it will
# work for you, but you can always just run the schema yourself.
#
# Use at your own risk!
require '../lib.php';
# Need to be logged in as admin before you can even try this.
session_start();
$some_admin = Player::getSessionPlayer();
if (!$some_admin->isSuper()) {
    header("Location: index.php");
    exit(0);
}
$db = Database::getConnection();
function do_query($query)
{
    global $db;
    echo "Executing Query: {$query} <br />";
    $result = $db->query($query);
    if (!$result) {
        echo "!!!! - Error: ";
        echo $db->error;
        exit(0);
    }
    return $result;
}
function redirect_deck_update($latest_id = 0)
{
    $url = explode('?', $_SERVER['REQUEST_URI']);
开发者ID:jamuraa,项目名称:gatherling,代码行数:31,代码来源:db-upgrade.php

示例3: session_start

<?php

session_start();
require_once 'lib.php';
$player = Player::getSessionPlayer();
print_header("Player Control Panel");
?>
<div class="grid_10 suffix_1 prefix_1">
<div id="gatherling_main" class="box">
<div class="uppertitle"> Player Control Panel </div>
<?php 
if ($player == NULL) {
    echo "<center> You must <a href=\"login.php\">log in</a> to use your player control panel.</center>\n";
} else {
    // Handle actions
    if (isset($_POST['action'])) {
        if ($_POST['action'] == 'setIgnores') {
            setPlayerIgnores();
        } else {
            if ($_POST['action'] == 'changePassword') {
                $success = false;
                if ($_POST['newPassword2'] == $_POST['newPassword']) {
                    if (strlen($_POST['newPassword']) >= 6) {
                        $authenticated = Player::checkPassword($_POST['username'], $_POST['oldPassword']);
                        if ($authenticated) {
                            $player = new Player($_POST['username']);
                            $player->setPassword($_POST['newPassword']);
                            $result = "Password changed.";
                            $success = true;
                        } else {
                            $result = "Password *not* changed, your old password was incorrect!";
开发者ID:jamuraa,项目名称:gatherling,代码行数:31,代码来源:player.php

示例4: handleActions

function handleActions()
{
    global $hasError;
    global $errormsg;
    if (!isset($_POST['series'])) {
        return;
    }
    $seriesname = $_POST['series'];
    $series = new Series($seriesname);
    if (!$series) {
        return;
    }
    if (!$series->authCheck(Player::loginName())) {
        return;
    }
    if ($_POST['action'] == "Update Series") {
        $newactive = $_POST['isactive'];
        $newtime = $_POST['hour'];
        $newday = $_POST['start_day'];
        $prereg = 0;
        if (isset($_POST['preregdefault'])) {
            $prereg = $_POST['preregdefault'];
        }
        $series = new Series($seriesname);
        if ($series->authCheck(Player::loginName())) {
            $series->active = $newactive;
            $series->start_time = $newtime . ":00:00";
            $series->start_day = $newday;
            $series->prereg_default = $prereg;
            $series->save();
        }
    } else {
        if ($_POST['action'] == "Change Logo") {
            if ($_FILES['logo']['size'] > 0) {
                $file = $_FILES['logo'];
                $name = $file['name'];
                $tmp = $file['tmp_name'];
                $size = $file['size'];
                $type = $file['type'];
                $series->setLogo($tmp, $type, $size);
            }
        } else {
            if ($_POST['action'] == "Update Organizers") {
                if (isset($_POST['delstewards'])) {
                    $removals = $_POST['delstewards'];
                    foreach ($removals as $deadsteward) {
                        $series->removeSteward($deadsteward);
                    }
                }
                if (!isset($_POST['addsteward'])) {
                    return;
                }
                $addition = $_POST['addsteward'];
                $addplayer = Player::findByName($addition);
                if ($addplayer == NULL) {
                    $hasError = true;
                    $errormsg .= "Can't add {$addition} to stewards, they don't exist!";
                    return;
                }
                if ($addplayer->verified == 0 && Player::getSessionPlayer()->super == 0) {
                    $hasError = true;
                    $errormsg .= "Can't add {$addplayer->name} to stewards, they aren't a verified user!";
                    return;
                }
                $series->addSteward($addplayer->name);
            } else {
                if ($_POST['action'] == "Update Points Rules") {
                    $new_rules = $_POST['new_rules'];
                    $series->setSeasonRules($_POST['season'], $new_rules);
                }
            }
        }
    }
}
开发者ID:jamuraa,项目名称:gatherling,代码行数:74,代码来源:seriescp.php

示例5: print_header

function print_header($title, $js = null, $extra_head_content = "")
{
    global $CONFIG;
    echo "<html><head><meta http-equiv=\"X-UA-Compatible\" content=\"IE=8\" />";
    echo "<title>{$CONFIG['site_name']} | Gatherling | {$title}</title>";
    echo "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"" . theme_file("css/stylesheet.css") . "\" />";
    echo "<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js\"></script>\n";
    if ($js) {
        echo "<script type=\"text/javascript\">";
        echo $js;
        echo "</script>";
    }
    echo $extra_head_content;
    echo <<<EOT
  </head>
  <body>
    <div id="maincontainer" class="container_12">
      <div id="headerimage" class="grid_12">
EOT;
    echo image_tag("header.png");
    echo <<<EOT
      </div>
      <div id="mainmenu_submenu" class="grid_12">
        <ul>
          <li><a href="http://pdcmagic.com/">Home</a></li>
          <li><a href="http://forums.pdcmagic.com/">Forums</a></li>
          <li><a href="http://pdcmagic.com/articles/">Articles</a></li>
          <li><a href="series.php">Events</a></li>
          <li class="current">
            <a href="index.php">
            Gatherling
            </a>
          </li>
          <li><a href="ratings.php">Ratings</a></li>
          <li class="last"><a href="http://community.wizards.com/pauperonline/wiki/">Wiki</a></li>
        </ul>
      </div>
EOT;
    $player = Player::getSessionPlayer();
    $super = false;
    $host = false;
    $steward = false;
    if ($player != NULL) {
        $host = $player->isHost();
        $super = $player->isSuper();
        $steward = count($player->stewardsSeries()) > 0;
    }
    $tabs = 5;
    if ($super || $steward) {
        $tabs += 1;
    }
    if ($host) {
        $tabs += 1;
    }
    if ($super) {
        $tabs += 1;
    }
    echo <<<EOT
<div id="submenu" class="grid_12 tabs_{$tabs}">
  <ul>
    <li><a href="profile.php">Profile</a></li>
    <li><a href="player.php">Player CP</a></li>
    <li><a href="eventreport.php">Metagame</a></li>
    <li><a href="decksearch.php">Decks</a></li>
EOT;
    if ($host || $super) {
        echo "<li><a href=\"event.php\">Host CP</a></li>\n";
    }
    if ($steward || $super) {
        echo "<li><a href=\"seriescp.php\">Series CP</a></li>\n";
    }
    if ($super) {
        echo "<li><a href=\"admincp.php\">Admin CP</a></li>\n";
    }
    if ($player == NULL) {
        echo "<li class=\"last\"><a href=\"login.php\">Login</a></li>\n";
    } else {
        echo "<li class=\"last\"><a href=\"logout.php\">Logout [{$player->name}]</a></li>\n";
    }
    echo "</ul> </div>\n";
}
开发者ID:jamuraa,项目名称:gatherling,代码行数:81,代码来源:lib.php

示例6: eventForm

function eventForm($event = NULL, $forcenew = false)
{
    if ($forcenew) {
        $edit = 0;
    } else {
        $edit = $event != NULL;
    }
    if (is_null($event)) {
        $event = new Event("");
    }
    echo "<form action=\"event.php\" method=\"post\" ";
    echo "enctype=\"multipart/form-data\">";
    echo "<table class=\"form\" style=\"border-width: 0px\" align=\"center\">";
    $current_year = strftime('%Y', time());
    if ($event->start != NULL) {
        $date = $event->start;
        preg_match('/([0-9]+)-([0-9]+)-([0-9]+) ([0-9]+):([0-9]+):.*/', $date, $datearr);
        $year = $datearr[1];
        $month = $datearr[2];
        $day = $datearr[3];
        $hour = $datearr[4];
        $minutes = $datearr[5];
        echo "<tr><th>Currently Editing</th>";
        echo "<td><i>" . htmlentities($event->name) . "</i>";
        echo "<input type=\"hidden\" name=\"name\" value=\"" . htmlentities($event->name) . "\">";
        echo "</td>";
        echo "</tr><tr><td>&nbsp;</td><td>";
        $prevevent = $event->findPrev();
        if ($prevevent) {
            echo $prevevent->makeLink("&laquo; Previous");
        }
        $nextevent = $event->findNext();
        if ($nextevent) {
            if ($prevevent) {
                echo " | ";
            }
            echo $nextevent->makeLink("Next &raquo;");
        }
        echo "</td></tr>";
    } else {
        echo "<tr><th>Event Name</th>";
        echo "<td><input type=\"radio\" name=\"naming\" value=\"auto\" checked>";
        echo "Automatically name this event based on Series, Season, and Number.";
        echo "<br /><input type=\"radio\" name=\"naming\" value=\"custom\">";
        echo "Use a custom name: ";
        echo "<input type=\"text\" name=\"name\" value=\"" . htmlentities($event->name) . "\" ";
        echo "size=\"40\">";
        echo "</td></tr>";
        $year = strftime('%Y', time());
        $month = strftime('%B', time());
        $day = strftime('%e', time());
        $hour = strftime('%H', time());
        $minutes = strftime('%M', time());
    }
    echo "<tr><th>Date & Time</th><td>";
    numDropMenu("year", "- Year -", $current_year + 1, $year, 2005);
    monthDropMenu($month);
    numDropMenu("day", "- Day- ", 31, $day, 1);
    timeDropMenu($hour, $minutes);
    echo "</td></tr>";
    echo "<tr><th>Series</th><td>";
    $seriesList = Player::getSessionPlayer()->stewardsSeries();
    $seriesList[] = "Other";
    Series::dropMenu($event->series, 0, $seriesList);
    echo "</td></tr>";
    echo "<tr><th>Season</th><td>";
    seasonDropMenu($event->season);
    echo "</td></tr>";
    echo "<tr><th>Number</th><td>";
    numDropMenu("number", "- Event Number -", Event::largestEventNum() + 5, $event->number, 0, "Custom");
    echo "</td><tr>";
    echo "<tr><th>Format</th><td>";
    formatDropMenu($event->format);
    echo "</td></tr>";
    echo "<tr><th>K-Value</th><td>";
    kValueDropMenu($event->kvalue);
    echo "</td></tr>";
    echo "<tr><th>Host/Cohost</th><td>";
    stringField("host", $event->host, 20);
    echo "&nbsp;/&nbsp;";
    stringField("cohost", $event->cohost, 20);
    echo "</td></tr>";
    echo "<tr><th>Event Thread URL</th><td>";
    stringField("threadurl", $event->threadurl, 60);
    echo "</td></tr>";
    echo "<tr><th>Metagame URL</th><td>";
    stringField("metaurl", $event->metaurl, 60);
    echo "</td></tr>";
    echo "<tr><th>Report URL</th><td>";
    stringField("reporturl", $event->reporturl, 60);
    echo "</td></tr>";
    echo "<tr><th>Main Event Structure</th><td>";
    numDropMenu("mainrounds", "- No. of Rounds -", 10, $event->mainrounds, 1);
    echo " rounds of ";
    structDropMenu("mainstruct", $event->mainstruct);
    echo "</td></tr>";
    echo "<tr><th>Finals Structure</th><td>";
    numDropMenu("finalrounds", "- No. of Rounds -", 10, $event->finalrounds, 0);
    echo " rounds of ";
    structDropMenu("finalstruct", $event->finalstruct);
//.........这里部分代码省略.........
开发者ID:jamuraa,项目名称:gatherling,代码行数:101,代码来源:event.php

示例7: session_start

<?php

session_start();
include 'lib.php';
include 'lib_form_helper.php';
$hasError = false;
$errormsg = "";
if (!Player::isLoggedIn() || !Player::getSessionPlayer()->isSuper()) {
    redirect("Location: index.php");
}
print_header("Admin Control Panel");
?>

<div class="grid_10 suffix_1 prefix_1">
<div id="gatherling_main" class="box">
<div class="uppertitle"> Admin Control Panel </div>
<center>
<?php 
do_page();
?>
</center>
<div class="clear"></div>
</div></div>

<?php 
print_footer();
?>

<?php 
function do_page()
{
开发者ID:jamuraa,项目名称:gatherling,代码行数:31,代码来源:admincp.php


注:本文中的Player::getSessionPlayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。