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


PHP Core::getUser方法代码示例

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


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

示例1: onAuthorize

 /**
  * (non-PHPdoc)
  * @see TAuthManager::onAuthorize()
  */
 public function onAuthorize($param)
 {
     $application = $this->getApplication();
     //if this is a call back function and its session timed out/invalid, then redirect the page to homepage
     if ($this->getRequest()->contains(TPage::FIELD_CALLBACK_TARGET) && !$application->getAuthorizationRules()->isUserAllowed($application->getUser(), $application->getRequest()->getRequestType(), $application->getRequest()->getUserHostAddress())) {
         // Create a callback adapter which counstructor will set up TCallbackReponseAdapter in the HttpResponse class adapter property
         $callbackAdapter = new TActivePageAdapter(new TPage());
         // Redirect (now the adapter is not null)
         $this->Response->redirect('/');
         // Create a html writer
         $writer = $this->Response->createHtmlWriter();
         // Render the response
         $callbackAdapter->renderCallbackResponse($writer);
         //Flush the output
         $application->flushOutput();
         //exit application do not process the futher part
         exit;
     }
     parent::onAuthorize($param);
     $u = Core::getUser();
     if ($u instanceof UserAccount) {
         $r = Core::getRole();
         Core::setUser($u, $r);
     }
 }
开发者ID:larryu,项目名称:magento-b2b,代码行数:29,代码来源:AuthManager.php

示例2: _isValid

 /**
  * Checks the event for validation.
  *
  * @return boolean
  */
 protected function _isValid()
 {
     if (isset($this->_target["userid"]) && $this->_target["userid"] == Core::getUser()->get("userid") && $this->_targetType != "tf") {
         return true;
     }
     return false;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:12,代码来源:Position.php

示例3: _isValid

 /**
  * Checks the event for validation.
  *
  * @return boolean
  */
 protected function _isValid()
 {
     if (!empty($this->_target["planetid"]) && !$this->isNewbieProtected() && $this->_target["userid"] != Core::getUser()->get("userid") && $this->_targetType != "tf" && $this->_checkProbes() && !$this->_target["umode"] && !Game::attackingStoppageEnabled()) {
         return true;
     }
     return false;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:12,代码来源:Espionage.php

示例4: _isValid

 /**
  * Checks the event for validation.
  *
  * @return boolean
  */
 protected function _isValid()
 {
     if (!empty($this->_target["userid"]) && $this->_target["userid"] != Core::getUser()->get("userid") && $this->_targetType != "tf" && !$this->_target["umode"] && $this->_relations->hasRelation($this->_target["userid"], $this->_target["aid"])) {
         return true;
     }
     return false;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:12,代码来源:Halt.php

示例5: init

 /**
  * @return Bengine_Admin_Controller_Abstract
  */
 protected function init()
 {
     if ($this->getParam("controller") != "auth" && !Core::getUser()->ifPermissions(array("HAS_AI_ACCESS"))) {
         $this->redirect("admin/auth");
     }
     return parent::init();
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:10,代码来源:Abstract.php

示例6: getPDF

 /**
  * Getting the a HTML2PDF object from an entity
  *
  * @param BaseEntityAbstract $entity
  *
  * @throws CoreException
  * @return HTML2PDF
  */
 public static function getPDF(BaseEntityAbstract $entity, $method = '')
 {
     $class = get_class($entity);
     switch ($class) {
         case 'Order':
             if (trim($method) === 'docket') {
                 $url = 'printdocket/order/' . $entity->getId() . '.html';
             } else {
                 $url = 'print/order/' . $entity->getId() . '.html';
             }
             break;
         case 'PurchaseOrder':
             $url = 'print/purchase/' . $entity->getId() . '.html';
             break;
         case 'Kit':
             $url = 'print/kit/' . $entity->getId() . '.html';
             break;
         default:
             throw new CoreException('NO such a function to covert entity:' . $class);
     }
     $url .= "?user=" . Core::getUser()->getUserName() . '&pass=' . Core::getUser()->getPassword();
     $url = 'http://' . $_SERVER["HTTP_HOST"] . '/' . $url;
     $command = '/usr/local/bin/wkhtmltopdf -B 0 -T 0 --disable-javascript "' . $url . '" ' . ($file = '/tmp/' . md5(trim(microtime()) . Core::getUser()->getId()) . '.pdf');
     $output = '';
     exec($command, $output);
     sleep(1);
     if (!is_file($file)) {
         throw new Exception('Could NOT generate pdf @' . $file . ' with command:' . $command);
     }
     return $file;
 }
开发者ID:larryu,项目名称:magento-b2b,代码行数:39,代码来源:EntityToPDF.php

示例7: _match

 /**
  * @return bool
  */
 protected function _match()
 {
     if ($this->getUser()->get("hp") == Core::getUser()->get("curplanet")) {
         return Game::getPlanet()->getData("planetname") != Core::getLang()->get("HOME_PLANET");
     }
     $planet = Game::getModel("game/planet")->load($this->getUser()->get("hp"));
     return $planet->get("planetname") != Core::getLang()->get("HOME_PLANET");
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:11,代码来源:PlanetName.php

示例8: add

 /**
  * @param integer $languageId
  * @param string $title
  * @param string $text
  * @return Bengine_Admin_Controller_News
  */
 protected function add($languageId, $title, $text)
 {
     $result = Core::getQuery()->select("news", array("MAX(sort_index) AS sort_index"), "", "", "", 1);
     $sortIndex = (int) $result->fetchColumn();
     $sortIndex++;
     $spec = array("language_id" => $languageId, "title" => $title, "text" => $text, "user_id" => Core::getUser()->get("userid"), "time" => TIME, "sort_index" => $sortIndex);
     Core::getQuery()->insert("news", $spec);
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:15,代码来源:News.php

示例9: show

 public static function show($objectId, $jsonLast = null)
 {
     $db = Core::getDb();
     $user = Core::getUser();
     $comments = array();
     $qLast = $jsonLast ? "and c.id>" . $db->escape($jsonLast) : "";
     $q = $db->buildQuery("SELECT c.id, c.body, o.ctime, u.id as local_user_id, o.user_id, c.user_connection_id, con.service, con.external_id\n      FROM comments c\n      LEFT JOIN objects o ON o.object_id=c.object_id\n      LEFT JOIN connections con ON c.user_connection_id=con.id\n\t\t\tLEFT JOIN users u ON u.id=o.user_id\n      WHERE c.in_reply_to_id=%d {$qLast}\n      ORDER BY o.ctime ASC", $objectId);
     $rs = $db->query($q);
     if ($rs && $db->numrows($rs)) {
         while ($o = $db->fetchObject($rs)) {
             $commentAuthor = ObjectCache::getByType('\\Kiki\\User', $o->user_id ? $o->user_id : $o->local_user_id);
             if ($commentAuthor) {
                 if ($o->external_id) {
                     // HACK: should not always have to load this, but this is quicker than getStoredConnections for User 0
                     $connection = User\Factory::getInstance($o->service, $o->external_id, 0);
                     // $connection = $commentAuthor->getConnection($o->service. "_". $o->external_id, true);
                     if ($connection) {
                         $serviceName = $connection->serviceName();
                         $name = $connection->name();
                         $pic = $connection->picture();
                     } else {
                         $serviceName = 'None';
                         // SNH
                         $name = $commentAuthor->name();
                         $pic = $commentAuthor->picture();
                     }
                 } else {
                     $serviceName = 'None';
                     // Kiki
                     $name = $commentAuthor->name();
                     $pic = $commentAuthor->picture();
                 }
             } else {
                 $serviceName = 'None';
                 $name = "Anonymous";
                 $pic = null;
             }
             if ($jsonLast !== null) {
                 $comments[] = Comments::showSingle($objectId, $o->id, $name, $pic, $serviceName, $o->body, $o->ctime);
             } else {
                 $comment = array('objectId' => $objectId, 'id' => $o->id, 'name' => $name, 'pic' => $pic, 'type' => $serviceName, 'body' => $o->body, 'ctime' => $o->ctime, 'dateTime' => date("c", strtotime($o->ctime)), 'relTime' => Misc::relativeTime($o->ctime));
                 $comments[] = $comment;
             }
         }
     } else {
         if ($jsonLast === null) {
             $comments[] = Comments::showDummy($objectId);
         }
     }
     if ($jsonLast !== null) {
         return $comments;
     }
     $template = new Template('parts/comments');
     $template->assign('objectId', $objectId);
     $template->assign('comments', $comments);
     return $template->fetch();
 }
开发者ID:robkaper,项目名称:kiki,代码行数:57,代码来源:comments.php

示例10: 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;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:12,代码来源:Auth.php

示例11: __construct

 /**
  * constructor
  */
 public function __construct()
 {
     parent::__construct();
     if (!Core::getUser() instanceof UserAccount && get_class($this) !== 'LoginController') {
         if (isset($_REQUEST['user']) && isset($_REQUEST['pass']) && in_array(get_class($this), array('OrderPrintController', 'POPrintController')) && ($userAccount = UserAccount::getUserByUsernameAndPassword(trim($_REQUEST['user']), trim($_REQUEST['pass']), true)) instanceof UserAccount) {
             Core::setUser($userAccount);
         } else {
             $this->getResponse()->Redirect('/login.html');
         }
     }
 }
开发者ID:larryu,项目名称:magento-b2b,代码行数:14,代码来源:BPCPageAbstract.php

示例12: getUser

 /**
  * Gets the user by id or current user
  *
  * @url GET /$id
  * @url GET /current
  */
 public function getUser($id = null)
 {
     if ($id) {
         $user = UserAccount::get($id);
         // possible user loading method
     } else {
         $user = Core::getUser();
     }
     return $user instanceof UserAccount ? $user->getJson() : array();
     // serializes object into JSON
 }
开发者ID:helin16,项目名称:pricematch,代码行数:17,代码来源:UserController.php

示例13: run

 /**
  * Runs the community application.
  *
  * @return void
  */
 public function run()
 {
     parent::run();
     Core::getUser()->removeTheme();
     Core::getTPL()->addHTMLHeaderFile("admin.css", "css");
     Core::getLang()->load(array("AI_Global"));
     $menu = new Bengine_Admin_Menu();
     Core::getTPL()->addLoop("menu", $menu->getMenu());
     $this->dispatch();
     return;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:16,代码来源:Admin.php

示例14: loadFromString

 /**
  * Load the userAccount from the session
  *
  * @param unknown_type $data
  * @return unknown
  */
 public function loadFromString($data)
 {
     if (!empty($data)) {
         //			var_dump(unserialize($data));
         list($coreStuff, $str) = unserialize($data);
         Core::unserialize($coreStuff);
         $this->userAccount = Core::getUser();
         return parent::loadFromString($str);
     } else {
         return $this;
     }
 }
开发者ID:larryu,项目名称:magento-b2b,代码行数:18,代码来源:WebUser.php

示例15: indexAction

 /**
  * Perfom log out proccess.
  *
  * @return Bengine_Game_Controller_Logout
  */
 protected function indexAction()
 {
     Hook::event("DoLogout");
     Core::getCache()->cleanUserCache(Core::getUser()->get("userid"));
     Core::getQuery()->update("sessions", array("logged" => 0), "userid = ?", array(Core::getUser()->get("userid")));
     if (Core::getConfig()->exists("SESSION_SAVING_DAYS")) {
         $days = (int) Core::getConfig()->get("SESSION_SAVING_DAYS");
     } else {
         $days = self::SESSION_SAVING_DAYS;
     }
     $deleteTime = TIME - 86400 * $days;
     Core::getQuery()->delete("sessions", "time < ?", null, null, array($deleteTime));
     Game::unlock();
     $this->redirect(BASE_URL);
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:21,代码来源:Logout.php


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