本文整理汇总了PHP中Core::getRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::getRequest方法的具体用法?PHP Core::getRequest怎么用?PHP Core::getRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core::getRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function __construct()
{
$this->__core = Core::getInstance();
$this->__lib = $this->__core->getLib();
$this->__uri = $this->__core->getUri();
$this->__req = $this->__core->getRequest();
}
示例2: indexAction
/**
* Index action.
*
* @return Bengine_Comm_Controller_Index
*/
public function indexAction()
{
Hook::event("CommIndexStart", array($this));
$this->assign("errorMsg", Core::getRequest()->getGET("error"));
if ($this->isPost()) {
$encryption = Core::getOptions("USE_PASSWORD_SALT") ? "md5_salt" : "md5";
$login = new Bengine_Game_Login($this->getParam("username"), $this->getParam("password"), "game", $encryption);
$login->setRedirectOnFailure(false)->checkData();
if ($login->getCanLogin()) {
Hook::event("PreLogin", array($login));
$login->startSession();
Hook::event("PostLogin", array($login));
} else {
$this->assign("errorMsg", $login->getErrors()->getFirst());
}
}
if ($this->errorMsg != "") {
Core::getLang()->load("error");
$this->assign("errorMsg", Core::getLang()->get($this->errorMsg));
}
$this->assign("page", Core::getLang()->getItem("LOGIN"));
if ($cmsPage = Comm::getCMS()->getPage("index")) {
$this->assign("page", $cmsPage["title"]);
$this->assign("content", $cmsPage["content"]);
$this->setTemplate("cms_page");
} else {
$this->assign("showDefaultContent", true);
}
Hook::event("CommIndexEnd", array($this));
return $this;
}
示例3: init
/**
* Handles the moderator class.
*
* @return void
*/
protected function init()
{
Core::getUser()->checkPermissions("CAN_MODERATE_USER");
Core::getLanguage()->load(array("Prefs", "Statistics", "Registration"));
$this->userid = Core::getRequest()->getPOST("userid") ? Core::getRequest()->getPOST("userid") : Core::getRequest()->getGET("1");
parent::init();
}
示例4: run
/**
* Starts Bengine.
*
* @return Game
*/
public function run()
{
parent::run();
// Update last activity
Core::getQuery()->update("user", array("last" => TIME, "db_lock" => TIME), "userid = ?", array(Core::getUser()->userid));
if ($planetid = Core::getRequest()->getPOST("planetid")) {
Core::getUser()->set("curplanet", $planetid);
}
Hook::event("GameStart");
self::loadResearch();
self::setPlanet();
self::setEventHandler();
self::getEH()->init();
self::getPlanet()->getProduction()->addProd();
self::globalTPLAssigns();
// Asteroid event (Once per week).
$first = mt_rand(0, 100);
$second = mt_rand(0, 100);
if ($first == 42 && $second == 49 && Core::getUser()->get("asteroid") < TIME - 604800) {
$data["metal"] = mt_rand(1, Core::getOptions()->get("MAX_ASTEROID_SIZE")) * 1000;
$data["silicon"] = mt_rand(1, $data["metal"] / 1000) * 1000;
$data["galaxy"] = self::getPlanet()->getData("galaxy");
$data["system"] = self::getPlanet()->getData("system");
$data["position"] = self::getPlanet()->getData("position");
$data["planet"] = self::getPlanet()->getData("planetname");
Hook::event("GameAsteroidEvent", array(&$data));
Core::getQuery()->update("user", array("asteroid" => TIME), "userid = ?", array(Core::getUser()->get("userid")));
$what = self::getPlanet()->getData("ismoon") ? "moonid" : "planetid";
Core::getDB()->query("UPDATE " . PREFIX . "galaxy SET metal = metal + ?, silicon = silicon + ? WHERE " . $what . " = ?", array($data["metal"], $data["silicon"], self::getPlanet()->getPlanetId()));
new Bengine_Game_AutoMsg(22, Core::getUser()->get("userid"), TIME, $data);
Core::getUser()->rebuild();
}
$this->dispatch();
return $this;
}
示例5: init
/**
* Constructor. Handles requests for this page.
*
* @return Bengine_Game_Controller_Mission
*/
protected function init()
{
Core::getTPL()->addHTMLHeaderFile("fleet.js", "js");
Core::getLanguage()->load(array("info", "mission"));
if (!Core::getUser()->get("umode") && $this->isPost()) {
if ($this->getParam("stargatejump")) {
$this->starGateJump(Core::getRequest()->getPOST());
}
if ($this->getParam("execjump")) {
$this->executeJump($this->getParam("moonid"));
}
if ($this->getParam("retreat")) {
$this->retreatFleet($this->getParam("id"));
}
if ($this->getParam("formation")) {
$this->formation($this->getParam("id"));
}
if ($this->getParam("invite")) {
$this->invite($this->getParam("id"), $this->getParam("name"), $this->getParam("username"));
}
if ($this->getParam("step2")) {
$this->selectCoordinates($this->getParam("galaxy"), $this->getParam("system"), $this->getParam("position"), $this->getParam("targetType"), $this->getParam("code"), Core::getRequest()->getPOST());
}
if ($this->getParam("step3")) {
$this->selectMission($this->getParam("galaxy"), $this->getParam("system"), $this->getParam("position"), $this->getParam("targetType"), $this->getParam("speed"), $this->getParam("code"), $this->getParam("formation"));
}
if ($this->getParam("step4")) {
$this->sendFleet($this->getParam("mode"), $this->getParam("metal"), $this->getParam("silicon"), $this->getParam("hydrogen"), $this->getParam("holdingtime"));
}
}
return parent::init();
}
示例6: logoutAction
/**
* @return Bengine_Admin_Controller_Auth
*/
protected function logoutAction()
{
if (Core::getUser()->getSid()) {
Core::getCache()->cleanUserCache(Core::getUser()->get("userid"));
Core::getRequest()->setCookie("sid", "", TIME - 1);
}
$this->redirect("admin/auth");
return $this;
}
示例7: __construct
/**
* Constructor.
*
* @param string Path to upload
* @param string File to upload
*
* @return void
*/
public function __construct($path, $file)
{
$this->path = $this->validatePath($path);
$this->file = is_array($file) ? $file : Core::getRequest()->getFILES($file);
$this->filename = $this->file["name"];
$this->setExtension($this->filename);
Hook::event("StartFileUpload", array($this));
return;
}
示例8: update
/**
* @param array $delete
* @param array $perms
* @return Bengine_Admin_Controller_Permissions
*/
protected function update(array $delete, array $perms)
{
foreach ($delete as $pid) {
Core::getQuery()->delete("permissions", "permissionid = ?", null, null, array($pid));
}
foreach ($perms as $pid) {
Core::getQuery()->update("permissions", array("permission" => Core::getRequest()->getPOST("perm_" . $pid)), "permissionid = ?", array($pid));
}
return $this;
}
示例9: init
/**
* Main method to display a sun system.
*
* @return Bengine_Game_Controller_Galaxy
*/
protected function init()
{
Core::getLanguage()->load(array("Galaxy", "Statistics"));
$this->missileRange = Game::getRocketRange();
$this->viewConsumption = (int) Core::getOptions()->get("GALAXY_VIEW_CONSUMPTION");
if (Core::getRequest()->getGET("1") && Core::getRequest()->getGET("2")) {
$this->setCoordinatesByGet(Core::getRequest()->getGET("1"), Core::getRequest()->getGET("2"));
}
return parent::init();
}
示例10: onFrontHtmlEnd
/**
* Show share button code.
*
* @return string
*/
public function onFrontHtmlEnd()
{
switch (Core::getRequest()->getGET("controller")) {
case "combat":
case "alliance":
return '<div style="margin: 1em 3em 1em 0; text-align: right;">
<a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><br/>
<a name="fb_share" type="button_count" href="http://www.facebook.com/sharer.php">Teilen</a>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script><br/>
<g:plusone size="tall"></g:plusone>
<script type="text/javascript">window.___gcfg={lang:"' . Core::getLang()->getOpt("code") . '"};(function(){var po=document.createElement("script");po.type="text/javascript";po.async=true;po.src="https://apis.google.com/js/plusone.js";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(po,s);})();</script>
</div>';
break;
}
return null;
}
示例11: editAction
/**
* Edit user profile.
*
* @param integer $user_id
*
* @return Bengine_Game_Controller_Profile
*/
protected function editAction($user_id = 0)
{
if (!$user_id) {
$user_id = Core::getUser()->get("userid");
}
if ($user_id != Core::getUser()->get("userid")) {
Core::getUser()->checkPermissions(array("CAN_EDIT_PROFILES"));
}
$this->assign("user_id", $user_id);
$profile = Game::getCollection("game/profile");
$profile->addUserFilter($user_id)->addSortIndex();
if ($this->isPost() && $this->getParam("save")) {
$this->save(Core::getRequest()->getPOST(), $profile);
}
$this->backLink = Link::get("game/" . SID . "/Profile/Page/" . $user_id, Core::getLang()->get("BACK_TO_PROFILE"));
Core::getTPL()->addLoop("profile", $profile);
return $this;
}
示例12: updatePagesAction
/**
* Update pages in DB (from main page)
*
* @param array $delete
* @param array $pages
*
* @return Bengine_Admin_Controller_Cms
*/
protected function updatePagesAction($delete, $pages)
{
foreach ($delete as $id) {
Core::getQuery()->delete("page", "pageid = ?", null, null, array($id));
}
foreach ($pages as $id) {
$spec = array("displayorder" => Core::getRequest()->getPOST("displayorder_" . $id), "title" => Core::getRequest()->getPOST("title_" . $id), "position" => Core::getRequest()->getPOST("position_" . $id));
Core::getQuery()->update("page", $spec, "pageid = ?", array($id));
}
return $this;
}
示例13: url
/**
* Generates a full readable url.
*
* @param string $url The url parameters
* @param boolean $appendSession Append session id to url
*
* @return string
*/
public static function url($url, $appendSession = false)
{
$session = Core::getRequest()->getGET("sid");
if (!COOKIE_SESSION && $appendSession && $session) {
if (Str::inString("?", $url)) {
$url .= "?sid=" . $session;
} else {
$url .= "&sid=" . $session;
}
}
$lang = Core::getRequest()->getPOST("lang") ? Core::getRequest()->getPOST("lang") : Core::getRequest()->getGET("lang");
if (self::APPEND_LANG_TO_URL && $lang) {
if (Str::inString("?", $url)) {
$url = $url . "?lang=" . $lang;
} else {
$url = $url . "&lang=" . $lang;
}
} else {
if (!Link::isExternal($url) && !preg_match("~^" . BASE_URL . "~si", $url) && self::APPEND_HOST_PATH) {
$url = BASE_URL . $url;
}
}
return $url;
}
示例14: updateAction
/**
* Saves resource production factor.
*
* @return Bengine_Game_Controller_Resource
*/
protected function updateAction()
{
if (!Core::getUser()->get("umode")) {
$post = Core::getRequest()->getPOST();
Hook::event("SaveResources");
foreach ($this->data as $key => $value) {
if ($value["level"] > 0) {
$factor = abs(isset($post[$key]) ? $post[$key] : 100);
$factor = $factor > 100 ? 100 : $factor;
Core::getQuery()->update("building2planet", array("prod_factor" => $factor), "buildingid = ? AND planetid = ?", array($key, Core::getUser()->get("curplanet")));
}
}
if (Game::getPlanet()->getBuilding(Bengine_Game_Planet::SOLAR_SAT_ID) > 0) {
$satelliteProd = abs($post[39]);
$satelliteProd = $satelliteProd > 100 ? 100 : $satelliteProd;
Core::getQuery()->update("planet", array("solar_satellite_prod" => $satelliteProd), "planetid = ?", array(Core::getUser()->get("curplanet")));
}
}
$this->redirect("game/" . SID . "/Resource");
return $this;
}
示例15: getParam
/**
* Returns a request parameter.
*
* @param string $param Parameter name
* @param mixed $default Default return value
*
* @return mixed
*/
protected function getParam($param, $default = null)
{
if (empty($param)) {
return $default;
}
if (($value = Core::getRequest()->getPOST($param, null)) !== null) {
return $value;
}
return Core::getRequest()->getGET($param, $default);
}