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


PHP Core\Auth类代码示例

本文整理汇总了PHP中XLite\Core\Auth的典型用法代码示例。如果您正苦于以下问题:PHP Auth类的具体用法?PHP Auth怎么用?PHP Auth使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: correctProfileIdForURLParams

 /**
  * Remove profileId from URL params if it is profileId of already logged in user
  * 
  * @param integer $profileId Profile ID
  *  
  * @return integer
  */
 protected function correctProfileIdForURLParams($profileId)
 {
     if (\XLite\Core\Auth::getInstance()->getProfile()->getProfileId() === $profileId) {
         $profileId = null;
     }
     return $profileId;
 }
开发者ID:kingsj,项目名称:core,代码行数:14,代码来源:AddressBook.php

示例2: getPortalDrupalArgs

 /**
  * Argument convertion: <LC> --> <DRUPAL>
  *
  * @param string $path Drupal path
  * @param array  $args LC URL arguments OPTIONAL
  *
  * @return array
  */
 public static function getPortalDrupalArgs($path, array $args = array())
 {
     $id = empty($args['profile_id']) ? \XLite\Core\Auth::getInstance()->getProfile()->getProfileId() : $args['profile_id'];
     unset($args['profile_id']);
     list($path, $args) = parent::getPortalDrupalArgs($path, $args);
     $path = preg_replace('/\\%/', static::getDrupalProfileId($id), $path, 1);
     return array($path, $args);
 }
开发者ID:kingsj,项目名称:core,代码行数:16,代码来源:OrderList.php

示例3: getUserTypes

 /**
  * Get user types
  *
  * @return array
  */
 protected function getUserTypes()
 {
     $types = array('C' => static::t('Registered Customers'), 'N' => static::t('Anonymous Customers'));
     if (\XLite\Core\Auth::getInstance()->isPermissionAllowed('manage admins')) {
         $types['A'] = static::t('Administrator');
     }
     return $types;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:UserType.php

示例4: defineWidgetParams

 /**
  * Define widget parameters
  *
  * @return void
  */
 protected function defineWidgetParams()
 {
     parent::defineWidgetParams();
     $this->widgetParams[static::PARAM_LIST]->setValue('content');
     $this->widgetParams[static::PARAM_CLASS]->setValue('hl');
     $this->widgetParams[static::PARAM_TITLE]->setValue(static::t('Content'));
     $this->widgetParams[static::PARAM_TARGET]->setValue(\XLite\Core\Auth::getInstance()->isPermissionAllowed('manage custom pages') ? 'pages' : 'menus');
 }
开发者ID:kingsj,项目名称:core,代码行数:13,代码来源:Content.php

示例5: fireEvent

 /**
  * Fire event 
  * 
  * @return void
  */
 protected function fireEvent()
 {
     \XLite\Core\Event::switchStorefront(array('opened' => !\XLite\Core\Auth::getInstance()->isClosedStorefront(), 'link' => $this->buildURL('storefront', '', array('action' => \XLite\Core\Auth::getInstance()->isClosedStorefront() ? 'open' : 'close')), 'privatelink' => $this->getAccessibleShopURL(false)));
     if ($this->isAJAX()) {
         $this->silent = true;
         $this->setSuppressOutput(true);
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:Storefront.php

示例6: checkFieldValue

 /**
  * Check field value validity
  *
  * @return boolean
  */
 protected function checkFieldValue()
 {
     $isAllowedForCurrentUser = TRUE;
     if (!\XLite\Core\Auth::getInstance()->isPermissionAllowed('manage admins') && $this->getValue() == \XLite\Core\Auth::getInstance()->getAdminAccessLevel()) {
         $isAllowedForCurrentUser = FALSE;
     }
     return $isAllowedForCurrentUser && in_array($this->getValue(), \XLite\Core\Auth::getInstance()->getAccessLevelsList());
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:AccessLevel.php

示例7: doActionConfirmWithPassword

 /**
  * Do action
  *
  * @return void
  */
 protected function doActionConfirmWithPassword()
 {
     $password = \XLite\Core\Request::getInstance()->password;
     $result = null !== $password && \XLite\Core\Auth::comparePassword(\XLite\Core\Auth::getInstance()->getProfile()->getPassword(), $password);
     if (!$result) {
         \XLite\Core\TopMessage::addError('Incorrect password. Please try again.');
     }
     \XLite\Core\Event::passwordConfirmed(array('result' => $result));
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:14,代码来源:Confirm.php

示例8: getInstance

 /**
  * Method to access a singleton
  *
  * @param boolean $doCalculate Flag for cart recalculation OPTIONAL
  *
  * @return \XLite\Model\Cart
  */
 public static function getInstance($doCalculate = true)
 {
     $className = get_called_class();
     // Create new instance of the object (if it is not already created)
     if (!isset(static::$instances[$className])) {
         $auth = \XLite\Core\Auth::getInstance();
         if ($auth->isLogged()) {
             // Try to find cart of logged in user
             $cart = \XLite\Core\Database::getRepo('XLite\\Model\\Cart')->findOneByProfile($auth->getProfile());
         }
         if (empty($cart)) {
             // Try to get cart from session
             $orderId = \XLite\Core\Session::getInstance()->order_id;
             if ($orderId) {
                 $cart = \XLite\Core\Database::getRepo('XLite\\Model\\Cart')->findOneForCustomer($orderId);
                 // Forget cart if cart is order
                 if ($cart && !$cart->hasCartStatus()) {
                     unset(\XLite\Core\Session::getInstance()->order_id, $cart);
                 }
             }
         }
         if (!isset($cart)) {
             // Cart not found - create a new instance
             $cart = new $className();
             $cart->initializeCart();
         }
         static::$instances[$className] = $cart;
         if ($auth->isLogged() && (!$cart->getProfile() || $auth->getProfile()->getProfileId() != $cart->getProfile()->getProfileId())) {
             $cart->setProfile($auth->getProfile());
             $cart->setOrigProfile($auth->getProfile());
         }
         // Check login state
         if (\XLite\Core\Session::getInstance()->lastLoginUnique === null && $cart->getProfile() && $cart->getProfile()->getAnonymous() && $cart->getProfile()->getLogin()) {
             $tmpProfile = new \XLite\Model\Profile();
             $tmpProfile->setProfileId(0);
             $tmpProfile->setLogin($cart->getProfile()->getLogin());
             $profile2 = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->findUserWithSameLogin($tmpProfile);
             if ($profile2) {
                 \XLite\Core\Database::getEM()->detach($profile2);
             }
             \XLite\Core\Session::getInstance()->lastLoginUnique = !$profile2;
         }
         if (!$doCalculate) {
             $cart->setIgnoreLongCalculations();
         }
         if (!$cart->isIgnoreLongCalculations() && ($cart instanceof \XLite\Model\Cart || \XLite\Core\Converter::time() - static::RENEW_PERIOD > $cart->getLastRenewDate())) {
             $cart->renew();
         } else {
             $cart->calculate();
         }
         $cart->renewSoft();
         \XLite\Core\Session::getInstance()->order_id = $cart->getOrderId();
     }
     return static::$instances[$className];
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:62,代码来源:Cart.php

示例9: doActionConfirmWithPassword

 /**
  * Do action
  *
  * @return void
  */
 protected function doActionConfirmWithPassword()
 {
     $password = \XLite\Core\Request::getInstance()->password;
     $result = null !== $password && \XLite\Core\Auth::comparePassword(\XLite\Core\Auth::getInstance()->getProfile()->getPassword(), $password);
     if ($result) {
         echo 1;
     } else {
         \XLite\Core\TopMessage::addError('Incorrect password. Please try again.');
         echo 0;
     }
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:16,代码来源:Confirm.php

示例10: getAdminAreaURLArgs

 /**
  * Return URL to redirect to
  *
  * @return string
  */
 protected function getAdminAreaURLArgs()
 {
     $query = '';
     if (\XLite\Core\Auth::getInstance()->isAdmin()) {
         $query .= '?' . \XLite\Core\Session::getInstance()->getName();
         $query .= '=' . \XLite\Core\Session::getInstance()->getId();
         $query .= '&' . static::PARAM_DRUPAL_RETURN_URL;
         $query .= '=' . urlencode(\Includes\Utils\URLManager::getCurrentURL());
     }
     return $query;
 }
开发者ID:kingsj,项目名称:core,代码行数:16,代码来源:Module.php

示例11: defineItems

 /**
  * Define menu items
  *
  * @return array
  */
 protected function defineItems()
 {
     $menu = array();
     $cnd = new \XLite\Core\CommonCell();
     $cnd->type = \XLite\Module\CDev\SimpleCMS\Model\Menu::MENU_TYPE_FOOTER;
     $cnd->enabled = true;
     $cnd->visibleFor = array('AL', \XLite\Core\Auth::getInstance()->isLogged() ? 'L' : 'A');
     foreach (\XLite\Core\Database::getRepo('XLite\\Module\\CDev\\SimpleCMS\\Model\\Menu')->search($cnd) as $v) {
         $menu[] = array('url' => $v->getURL(), 'label' => $v->getName(), 'controller' => $v->getLinkController());
     }
     return $menu ?: parent::defineItems();
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:17,代码来源:FooterMenu.php

示例12: defineItems

 /**
  * Define menu items
  *
  * @return array
  */
 protected function defineItems()
 {
     $menu = array();
     $cnd = new \XLite\Core\CommonCell();
     $cnd->type = \XLite\Module\CDev\SimpleCMS\Model\Menu::MENU_TYPE_PRIMARY;
     $cnd->enabled = true;
     $cnd->visibleFor = array('AL', \XLite\Core\Auth::getInstance()->isLogged() ? 'L' : 'A');
     foreach (\XLite\Core\Database::getRepo('XLite\\Module\\CDev\\SimpleCMS\\Model\\Menu')->search($cnd) as $v) {
         $menu[] = $this->defineItem($v);
     }
     return \XLite\Core\Config::getInstance()->CDev->SimpleCMS->show_default_menu ? array_merge(parent::defineItems(), $menu) : ($menu ?: parent::defineItems());
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:17,代码来源:PrimaryMenu.php

示例13: getProfile

 /**
  * getProfile
  *
  * @return \XLite\Model\Profile
  */
 public function getProfile()
 {
     if (!isset($this->profile)) {
         $profileId = \XLite\Core\Request::getInstance()->profile_id;
         if (isset($profileId)) {
             $this->profile = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->find($profileId);
         } else {
             $this->profile = \XLite\Core\Auth::getInstance()->getProfile();
         }
     }
     return $this->profile;
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:17,代码来源:AdminProfileAbstract.php

示例14: defineItems

 /**
  * Define menu items
  *
  * @return array
  */
 protected function defineItems()
 {
     $menu = array();
     $menu[] = array('target' => \XLite::TARGET_DEFAULT, 'url' => $this->buildURL(''), 'label' => static::t('Home'));
     $menu[] = array('target' => 'cart', 'url' => $this->buildURL('cart'), 'label' => static::t('Shopping bag'));
     if (\XLite\Core\Auth::getInstance()->isLogged()) {
         $menu[] = array('target' => 'profile', 'url' => $this->buildURL('profile'), 'label' => static::t('My account'));
     } else {
         $menu[] = array('target' => 'profile', 'url' => $this->buildURL('profile', '', array('mode' => 'register')), 'label' => static::t('Register'));
     }
     return $menu;
 }
开发者ID:kingsj,项目名称:core,代码行数:17,代码来源:Top.php

示例15: __construct

 /**
  * Override constructor to add new tab
  *
  * @param array $params Handler params OPTIONAL
  *
  * @return void
  */
 public function __construct(array $params = array())
 {
     if ($this->isLogged()) {
         $cnd = new \XLite\Core\CommonCell();
         $cnd->user = \XLite\Core\Auth::getInstance()->getProfile();
         $count = \XLite\Core\Database::getRepo('XLite\\Model\\Order')->searchWithPinCodes($cnd, true);
         if ($count > 0) {
             $this->tabs['pin_codes'] = array('title' => 'PIN codes', 'template' => 'modules/CDev/PINCodes/account_pin_codes.tpl');
         }
     }
     parent::__construct($params);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:19,代码来源:Account.php


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