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


PHP AuthManager::isAuthorized方法代码示例

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


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

示例1: getCurrentUserEvents

 /**
  * Метод загружает события по переданному пользователю. Все эти события могут отражаться в маленьком личном кабинете пользователя.
  * 
  * @param PsUser $user
  */
 public function getCurrentUserEvents()
 {
     $events = array();
     if (AuthManager::isAuthorized()) {
         $this->profilerStart(__FUNCTION__);
         try {
             $this->LOGGER->info(' >> Запрошен список события для текущего пользователя');
             //Мы должны пробежаться по офисным страницам пользователя, которые поддерживают состояния, и запросить эти состояния
             foreach ($this->getUserAcessibleClassInstsFromList(self::LIST_OFFICE) as $office) {
                 if (!$office instanceof NumerableOfficePage) {
                     continue;
                 }
                 $state = $office->getNumericState();
                 if ($state) {
                     $events[$office->getIdent()] = $state;
                 }
             }
             $this->LOGGER->info(' << Список событий успешно загружен: ' . array_to_string($events, false));
         } catch (Exception $ex) {
             $this->LOGGER->info('Произошла ошибка: ' . $ex->getMessage());
             $this->profilerStop(false);
             throw $ex;
         }
         $this->profilerStop();
     }
     return $events;
 }
开发者ID:ilivanoff,项目名称:www,代码行数:32,代码来源:IdentPagesManager.php

示例2: getTestingResults

 /** @return TestingResultDB */
 public function getTestingResults($idTesting)
 {
     if (AuthManager::isAuthorized()) {
         return TestingBean::inst()->getTestingResult($idTesting, AuthManager::getUserId());
     }
     return null;
 }
开发者ID:ilivanoff,项目名称:www,代码行数:8,代码来源:TestingManager.php

示例3: smarty_modifier_post_meta

function smarty_modifier_post_meta(PostContentProvider $postCP, $news = false)
{
    $post = $postCP->getPost();
    $postId = $post->getId();
    $type = $post->getPostType();
    $pp = Handlers::getInstance()->getPostsProcessorByPostType($type);
    $rp = Handlers::getInstance()->getRubricsProcessorByPostType($type, false);
    $trStateToggle = null;
    $rubHref = null;
    $commentsHref = null;
    $name = null;
    if ($news) {
        $name = $post->getName();
        $name = "<span class=\"name\">{$name}</span>";
    }
    if (!$news && $post->getPostType() == POST_TYPE_TRAINING && AuthManager::isAuthorized()) {
        $trStateToggle = '<a href="#' . $postId . '" title="Изменить состояние урока" class="toggle">Пройден</a>';
    }
    $rubHref = $rp ? $rp->rubricHref($post->getRubricId(), null, 'rubric') : null;
    //    if (!$news) {
    $commentsCnt = $post->getCommentsCount();
    $commentsHref = $pp->postHref($post, "Комментариев: {$commentsCnt}", 'comments', array('class' => 'commentcount'));
    //    }
    if ($name || $trStateToggle || $rubHref || $commentsHref) {
        echo '<div class="post_meta">';
        echo "{$name}&nbsp;{$trStateToggle} {$rubHref} {$commentsHref}";
        echo '</div>';
    }
}
开发者ID:ilivanoff,项目名称:www,代码行数:29,代码来源:modifier.post_meta.php

示例4: getCurrentDateTimeZone

 /** @return DateTimeZone */
 public function getCurrentDateTimeZone()
 {
     if (!isset($this->curTZ)) {
         $tzName = AuthManager::isAuthorized() ? PsUser::inst()->getTimezone() : null;
         $this->curTZ = $tzName ? $this->getDateTimeZone($tzName) : $this->getDateTimeZone();
     }
     return $this->curTZ;
 }
开发者ID:ilivanoff,项目名称:www,代码行数:9,代码来源:PsTimeZone.php

示例5: processImpl

 protected function processImpl(PostArrayAdapter $adapter, $button)
 {
     $FEEDBACK = FeedbackManager::inst();
     /*
      * Тема
      */
     $theme = $adapter->str(FORM_PARAM_THEME);
     $error = UserInputValidator::validateShortText($theme);
     if ($error) {
         return array(FORM_PARAM_THEME => $error);
     }
     $theme = UserInputTools::safeShortText($theme);
     /*
      * Комментарий
      */
     $text = $adapter->str(FORM_PARAM_COMMENT);
     $error = UserInputValidator::validateLongText($text);
     if ($error) {
         return array(FORM_PARAM_COMMENT => $error);
     }
     $text = UserInputTools::safeLongText($text);
     /*
      * АВТОРИЗОВАН - пользуемся стандартным механизмом добавления сообщения в тред.
      * Кодом треда, при этом, является сам пользователь.
      */
     if (AuthManager::isAuthorized()) {
         $msg = $FEEDBACK->saveMessage(PsUser::inst()->getId(), null, $text, $theme, PsUser::inst());
         return new AjaxSuccess($FEEDBACK->buildLeaf($msg));
     }
     /*
      * НЕ АВТОРИЗОВАН - сохраняем сообщение в таблицу анонимных пользователей.
      */
     if (!AuthManager::isAuthorized()) {
         /*
          * Имя пользователя
          */
         $name = $adapter->str(FORM_PARAM_NAME);
         $error = UserInputValidator::validateShortText($name);
         if ($error) {
             return array(FORM_PARAM_NAME => $error);
         }
         $name = UserInputTools::safeShortText($name);
         /*
          * Контакты
          */
         $contacts = $adapter->str(FORM_PARAM_REG_CONTACTS);
         if ($contacts) {
             $error = UserInputValidator::validateShortText($contacts, false);
             if ($error) {
                 return array(FORM_PARAM_REG_CONTACTS => $error);
             }
             $contacts = UserInputTools::safeShortText($contacts);
         }
         $FEEDBACK->saveAnonimousFeedback($name, $contacts, $theme, $text);
         return new AjaxSuccess();
     }
 }
开发者ID:ilivanoff,项目名称:www,代码行数:57,代码来源:FeedbackForm.php

示例6: login

 public function login()
 {
     if (FORM_AdminLoginForm::getInstance()->isValid4Process()) {
         $data = FORM_AdminLoginForm::getInstance()->getData();
         $login = $data->getLogin();
         $passwd = $data->getPassword();
         AuthManager::loginAdmin($login, $passwd);
     }
     return AuthManager::isAuthorized();
 }
开发者ID:ilivanoff,项目名称:www,代码行数:10,代码来源:AdminAuthManager.php

示例7: getUserPassedLessons

 public function getUserPassedLessons()
 {
     $result = array();
     if (AuthManager::isAuthorized()) {
         foreach (TRBean::inst()->getPassedLessons(AuthManager::getUserId()) as $id) {
             $result["tr{$id}"] = true;
         }
     }
     return $result;
 }
开发者ID:ilivanoff,项目名称:www,代码行数:10,代码来源:TrainManager.php

示例8: getStructure

 public function getStructure()
 {
     $cacheId = AuthManager::isAuthorized() ? 'a' : 'na' . '_structure';
     $structure = PSCache::POSTS()->getFromCache($cacheId);
     if (!is_array($structure)) {
         PsProfiler::inst(__CLASS__)->start('Build structure');
         $structure = $this->getStructureImpl()->toArray();
         PsProfiler::inst(__CLASS__)->stop();
         PSCache::POSTS()->saveToCache($structure, $cacheId);
     }
     return $structure;
 }
开发者ID:ilivanoff,项目名称:www,代码行数:12,代码来源:NavigationManager.php

示例9: jsCommon

 private function jsCommon()
 {
     $params['url'] = PsUrl::current();
     $params['userId'] = AuthManager::getUserIdOrNull();
     $params['isAuthorized'] = AuthManager::isAuthorized();
     $params['isDOA'] = PsSettings::DEVMODE_OR_ADMIN();
     $params['isLogging'] = PsSettings::DEVMODE_OR_ADMIN();
     $params['currentSubmitTimeout'] = ActivityWatcher::getWaitTime();
     $params['tzOffset'] = PsTimeZone::inst()->getCurrentDateTimeZone()->getOffset(new DateTime());
     $params['marker'] = AuthManager::getUserSessoinMarker();
     $params['foldings'] = FoldedStorage::listEntitiesRel();
     return $params;
 }
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:13,代码来源:PageBuilder.php

示例10: jsCommon

 private function jsCommon(PageContext $ctxt)
 {
     $params['url'] = $ctxt->getRequestUrl();
     $params['isPopup'] = $ctxt->isPopupPage();
     $params['userId'] = AuthManager::getUserIdOrNull();
     $params['isAuthorized'] = AuthManager::isAuthorized();
     $params['isDOA'] = PsSettings::DEVMODE_OR_ADMIN();
     $params['isLogging'] = PsSettings::DEVMODE_OR_ADMIN();
     $params['currentSubmitTimeout'] = ActivityWatcher::getWaitTime();
     $params['tzOffset'] = PsTimeZone::inst()->getCurrentDateTimeZone()->getOffset(new DateTime());
     $params['marker'] = AuthManager::getUserSessoinMarker();
     /* @var $folding FoldedResources */
     foreach (Handlers::getInstance()->getFoldingsIndexed() as $unique => $folding) {
         $params['foldings'][$unique] = $folding->getResourcesDm()->relDirPath();
     }
     return $params;
 }
开发者ID:ilivanoff,项目名称:www,代码行数:17,代码来源:PageBuilder.php

示例11: buildLeaf

 /**
  * Метод строит html листочка на дереве дискуссии:
  * 
  * <li>
  * ....
  *    <ul>
  *       <li>
  *       ....
  *       </li>
  *    </ul>
  * </li>
  * 
  * @param DiscussionMsg $msg
  */
 public final function buildLeaf(DiscussionMsg $msg, $simple = false)
 {
     $msgId = $msg->getId();
     $author = $msg->getUser();
     $isDeleted = $msg->isDeleted();
     $isUserComment = $author->isAuthorised();
     $isCanConfirm = !$isUserComment && !$msg->isConfirmed() && !$isDeleted && AuthManager::isAuthorizedAsAdmin();
     $notKnown = !$msg->isKnown() && $msg->getUserTo() && $msg->getUserTo()->isIt(PsUser::instOrNull());
     $msgUnique = $msg->getUnique();
     $threadUnique = $this->SETTINGS->getThreadUnique($msg->getThreadId());
     //Мы открываем страницу для показа этого комментария
     $liId = RequestArrayAdapter::inst()->str(GET_PARAM_GOTO_MSG) === $msgUnique ? " id=\"{$msgUnique}\"" : '';
     //Классы li
     $liClasses = array('msg');
     if ($isDeleted) {
         $liClasses[] = 'deleted';
     }
     //Классы Comment
     $divClasses = array('comment', $msgUnique);
     if ($isUserComment) {
         $divClasses[] = 'user_comment';
     }
     if ($isCanConfirm) {
         $divClasses[] = 'not_confirmed';
     }
     //Данные для Comment
     $divData['unique'] = $msgUnique;
     //Имя пользователя
     $userName = $author->getName() . ($isUserComment ? ' (вы)' : '');
     //КНОПКИ УПРАВЛЕНИЯ СВЕРХУ
     $controlsTop = array();
     if (!$simple) {
         //Кнопки управления сверху
         $controlsTop[] = PsHtml::a(array('href' => '#'), '#');
         if (!$msg->isRoot()) {
             $controlsTop[] = PsHtml::a(array('href' => '#', 'class' => 'parent'), '↑');
         }
     }
     //Кнопки голосования
     if ($this->SETTINGS->isVotable()) {
         $userCanVote = AuthManager::isAuthorized() && !$isUserComment;
         $votes = VotesManager::inst()->getVotesCount($threadUnique, $msgId);
         $likeCtrl = array();
         if ($userCanVote) {
             $vote = VotesManager::inst()->getUserVotes($threadUnique, $msgId, AuthManager::getUserId());
             $likeCtrl[] = PsHtml::a(array('class' => 'like ' . ($vote > 0 ? 'active' : 'clickable')), '+1');
             $likeCtrl[] = PsHtml::a(array('class' => 'votes' . ($vote == 0 ? '' : ' clickable') . ($votes == 0 ? '' : ($votes > 0 ? ' green' : ' red'))), abs($votes));
             $likeCtrl[] = PsHtml::a(array('class' => 'dislike ' . ($vote < 0 ? 'active' : 'clickable')), '−1');
         } else {
             $likeCtrl[] = PsHtml::a(array('class' => 'votes' . ($votes == 0 ? '' : ($votes > 0 ? ' green' : ' red'))), abs($votes));
         }
         $controlsTop[] = PsHtml::span(array('class' => 'vote'), implode('', $likeCtrl));
     }
     $controlsTop = implode('', $controlsTop);
     //КНОПКИ УПРАВЛЕНИЯ СНИЗУ
     $controlsBottom = '';
     if (!$simple && !$isDeleted) {
         $controlsBottom = array();
         $controlsBottom['id'] = $msgId;
         if ($isCanConfirm) {
             $controlsBottom[SmartyFunctions::ACTION_CONFIRM] = 'Принять';
         }
         if (!$msg->isMaxDeepLevel()) {
             $controlsBottom[SmartyFunctions::ACTION_REPLY] = 'Ответить';
         }
         if ($isUserComment) {
             $controlsBottom[SmartyFunctions::ACTION_DELETE] = 'Удалить';
         } elseif (AuthManager::isAuthorizedAsAdmin()) {
             $controlsBottom[SmartyFunctions::ACTION_DELETE] = 'Удалить (админ)';
         }
         $controlsBottom = SmartyFunctions::psctrl($controlsBottom);
     }
     //Собираем параметры в кучу
     $params['msg'] = $msg;
     $params['new'] = $notKnown;
     $params['builder'] = $this;
     $params['liId'] = $liId;
     $params['liClasses'] = implode(' ', $liClasses);
     $params['divClasses'] = implode(' ', $divClasses);
     $params['divData'] = PsHtml::data2string($divData);
     $params['msgId'] = $msgId;
     $params['simple'] = $simple;
     $params['avatar'] = $author->getAvatarImg('42x', array('class' => 'small'));
     $params['userName'] = $userName;
     $params['controlsTop'] = $controlsTop;
     $params['controlsBottom'] = $controlsBottom;
//.........这里部分代码省略.........
开发者ID:ilivanoff,项目名称:www,代码行数:101,代码来源:DiscussionController.php

示例12: isAddCapture

 /**
  * Метод проверяет, должна ли форма быть защищена с помощью капчи.
  * Это выполняется в том случае, если пользователь не авторизован и форма работает с капчей.
  */
 private function isAddCapture()
 {
     return $this->isCheckCapture() && !AuthManager::isAuthorized();
 }
开发者ID:ilivanoff,项目名称:www,代码行数:8,代码来源:AbstractForm.php

示例13: smarty_function_html_input

function smarty_function_html_input($params, Smarty_Internal_Template &$smarty)
{
    $adapter = ArrayAdapter::inst($params);
    $fieldId = $adapter->get('id');
    $label = $adapter->get('label');
    $value = $adapter->get('val');
    $inputType = $adapter->str('type');
    $help = $adapter->str('help');
    $RQ = PostArrayAdapter::inst();
    $attrs = array();
    switch ($inputType) {
        case 'hidden':
            echo PsHtml::hidden($fieldId, $value);
            break;
        case 'text':
            echo PsHtmlForm::text($label, $fieldId, $RQ->str($fieldId, $value), $attrs, $help);
            break;
        case 'datetime':
            $attrs['class'][] = 'ps-datetime-picker';
            echo PsHtmlForm::text($label, $fieldId, $RQ->str($fieldId, $value), $attrs, $help);
            break;
        case 'pass':
            echo PsHtmlForm::password($label, $fieldId, $RQ->str($fieldId));
            break;
        case 'file':
            $label = $adapter->get('label', 'Файл');
            $fieldId = $fieldId ? $fieldId : FORM_PARAM_FILE;
            echo PsHtmlForm::file($label, $fieldId, $help);
            break;
        case 'user':
            $label = $adapter->get('label', 'Ваше имя');
            if (AuthManager::isAuthorized()) {
                echo PsHtmlForm::textInfo($label, PsUser::inst()->getName());
            } else {
                $fieldId = $fieldId ? $fieldId : FORM_PARAM_NAME;
                echo PsHtmlForm::text($label, $fieldId, $RQ->str($fieldId), $attrs, $help);
            }
            break;
        case 'textarea':
            $label = $adapter->get('label', 'Текст сообщения');
            $fieldId = $fieldId ? $fieldId : FORM_PARAM_COMMENT;
            $value = $value ? $value : $RQ->str($fieldId, $value);
            $maxlen = $adapter->str(array('maxlen', 'maxlength'));
            $manual = $adapter->bool('manual');
            $codemirror = $adapter->str('codemirror');
            echo PsHtmlForm::textarea($label, $fieldId, $value, $maxlen, $manual, $codemirror, $attrs, $help);
            break;
        case 'submit':
            $buttons[] = $label ? $label : 'Отправить';
            for ($idx = 0; $idx <= 10; $idx++) {
                $button = $adapter->get("label{$idx}");
                if ($button) {
                    $buttons[] = $button;
                }
            }
            $canReset = $adapter->bool('reset');
            echo PsHtmlForm::submit($buttons, $canReset);
            break;
        case 'yesno':
            $fieldId = $fieldId ? $fieldId : 'yesno';
            $options[] = PsHtml::comboOption(0, 'Нет');
            $options[] = PsHtml::comboOption(1, 'Да');
            echo PsHtmlForm::select($label, $fieldId, $attrs, $options, 0);
            break;
        case 'sex':
            $value = $value ? $value : $RQ->int($fieldId);
            $options[] = PsHtml::comboOption(SEX_GIRL, 'Женский');
            $options[] = PsHtml::comboOption(SEX_BOY, 'Мужской');
            echo PsHtmlForm::select($label, $fieldId, $attrs, $options, $value);
            break;
        case 'posttype':
            $label = $label ? $label : 'Тип поста';
            $fieldId = $fieldId ? $fieldId : FORM_PARAM_POST_TYPE;
            $options = array();
            /* @var $pr PostsProcessor */
            foreach (Handlers::getInstance()->getPostsProcessors() as $type => $pr) {
                $title = $pr->postTitle();
                $options[] = PsHtml::comboOption($type, "{$title} ({$type})");
            }
            echo PsHtmlForm::select($label, $fieldId, $attrs, $options);
            break;
        case 'select':
            echo PsHtmlForm::select($label, $fieldId, $attrs, $adapter->arr('options'), $adapter->str('curVal'), $adapter->bool('hasEmpty'), $help);
            break;
        case 'timezone':
            $label = $label ? $label : 'Выберите временную зону';
            $tzSelect = PsTimeZone::inst()->zonesSelectHtml();
            echo PsHtmlForm::field($label, $tzSelect, $help);
            break;
        default:
            raise_error("Unsupported html input type: [{$inputType}]");
    }
}
开发者ID:ilivanoff,项目名称:www,代码行数:93,代码来源:function.html_input.php

示例14: buildPanel

 public function buildPanel($panelName)
 {
     $listName = AuthManager::isAuthorized() ? self::LIST_ADMIN : self::LIST_CLIENT;
     return new ClientBoxPanel($this->getUserAcessibleClassInstsFromList($listName));
 }
开发者ID:ilivanoff,项目名称:www,代码行数:5,代码来源:ClientBoxManager.php

示例15: authed

 public static final function authed()
 {
     return AuthManager::isAuthorized();
 }
开发者ID:ilivanoff,项目名称:www,代码行数:4,代码来源:SmartyReplacesIf.php


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