• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP getRequestStr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: EventTopics

 /**
  * Показ топиков
  *
  */
 protected function EventTopics()
 {
     $sPeriod = 1;
     // по дефолту 1 день
     if (in_array(getRequestStr('period'), array(1, 7, 30, 'all'))) {
         $sPeriod = getRequestStr('period');
     }
     $sShowType = $this->sCurrentEvent;
     if (!in_array($sShowType, array('discussed', 'top'))) {
         $sPeriod = 'all';
     }
     /**
      * Меню
      */
     $this->sMenuSubItemSelect = $sShowType == 'newall' ? 'new' : $sShowType;
     /**
      * Передан ли номер страницы
      */
     $iPage = $this->GetParamEventMatch(0, 2) ? $this->GetParamEventMatch(0, 2) : 1;
     if ($iPage == 1 and !getRequest('period')) {
         $this->Viewer_SetHtmlCanonical(Router::GetPath('personal_blog') . $sShowType . '/');
     }
     /**
      * Получаем список топиков
      */
     $aResult = $this->Topic_GetTopicsPersonal($iPage, Config::Get('module.topic.per_page'), $sShowType, $sPeriod == 'all' ? null : $sPeriod * 60 * 60 * 24);
     /**
      * Если нет топиков за 1 день, то показываем за неделю (7)
      */
     if (in_array($sShowType, array('discussed', 'top')) and !$aResult['count'] and $iPage == 1 and !getRequest('period')) {
         $sPeriod = 7;
         $aResult = $this->Topic_GetTopicsPersonal($iPage, Config::Get('module.topic.per_page'), $sShowType, $sPeriod == 'all' ? null : $sPeriod * 60 * 60 * 24);
     }
     $aTopics = $aResult['collection'];
     /**
      * Вызов хуков
      */
     $this->Hook_Run('topics_list_show', array('aTopics' => $aTopics));
     /**
      * Формируем постраничность
      */
     $aPaging = $this->Viewer_MakePaging($aResult['count'], $iPage, Config::Get('module.topic.per_page'), Config::Get('pagination.pages.count'), Router::GetPath('personal_blog') . $sShowType, in_array($sShowType, array('discussed', 'top')) ? array('period' => $sPeriod) : array());
     /**
      * Вызов хуков
      */
     $this->Hook_Run('personal_show', array('sShowType' => $sShowType));
     /**
      * Загружаем переменные в шаблон
      */
     $this->Viewer_Assign('aTopics', $aTopics);
     $this->Viewer_Assign('aPaging', $aPaging);
     if (in_array($sShowType, array('discussed', 'top'))) {
         $this->Viewer_Assign('sPeriodSelectCurrent', $sPeriod);
         $this->Viewer_Assign('sPeriodSelectRoot', Router::GetPath('personal_blog') . $sShowType . '/');
     }
     /**
      * Устанавливаем шаблон вывода
      */
     $this->SetTemplateAction('index');
 }
开发者ID:cbrspc,项目名称:LIVESTREET-1-DISTRIB,代码行数:64,代码来源:ActionPersonalBlog.class.php


示例2: EventSubscriptionAjaxSetSubscription

 protected function EventSubscriptionAjaxSetSubscription()
 {
     $this->Viewer_SetResponseAjax('json');
     require_once Config::Get('path.root.engine') . '/lib/external/XXTEA/encrypt.php';
     if (!($sSubscriptionMail = getRequestStr('subscription_mail'))) {
         $this->Message_AddErrorSingle($this->Lang_Get('plugin.subscription.subscription_mail_error_empty'), $this->Lang_Get('error'));
         return;
     }
     $oSubscription = Engine::GetEntity('PluginSubscription_ModuleSubscription_EntitySubscription');
     $oSubscription->_setValidateScenario('subscription_mail');
     $oSubscription->setMail($sSubscriptionMail);
     $oSubscription->_Validate();
     if ($oSubscription->_hasValidateErrors()) {
         $this->Message_AddErrorSingle($oSubscription->_getValidateError());
         return false;
     }
     if ($oSubscription = $this->PluginSubscription_Subscription_GetSubscriptionByMail($sSubscriptionMail)) {
         if ($oSubscription->getUnsubscribeHash()) {
             $sUnsubscribeCode = $oSubscription->getUnsubscribeHash();
             $sUnsubscribeCode .= base64_encode(xxtea_encrypt($oSubscription->getMail(), $oSubscription->getUnsubscribeHash()));
             $sUnsubscribeCode = str_replace(array('/', '+'), array('{', '}'), $sUnsubscribeCode);
             $this->Notify_Send($oSubscription->getMail(), 'notify.subscription_unsubscription.tpl', $this->Lang_Get('plugin.subscription.subscription_mail_message_subject'), array('sUnsubscribeCode' => $sUnsubscribeCode), 'subscription');
             $this->Viewer_AssignAjax('sText', $this->Lang_Get('plugin.subscription.subscription_block_subscription_submit_unsubscrib_ok'));
         } else {
             if ($oSubscription->getSubscribeDate()) {
                 $this->Viewer_AssignAjax('sText', $this->Lang_Get('plugin.subscription.subscription_mail_error_used'));
             } else {
                 $sSubscribeCode = $oSubscription->getSubscribeHash();
                 $sSubscribeCode .= base64_encode(xxtea_encrypt($oSubscription->getMail(), $oSubscription->getSubscribeHash()));
                 $sSubscribeCode = str_replace(array('/', '+'), array('{', '}'), $sSubscribeCode);
                 $this->Notify_Send($oSubscription->getMail(), 'notify.subscription_subscription.tpl', $this->Lang_Get('plugin.subscription.subscription_mail_message_subject'), array('sSubscribeCode' => $sSubscribeCode), 'subscription');
                 $this->Viewer_AssignAjax('sText', $this->Lang_Get('plugin.subscription.subscription_block_subscription_submit_repeatedly_ok'));
             }
         }
     } else {
         $oSubscription = Engine::GetEntity('PluginSubscription_ModuleSubscription_EntitySubscription');
         $oSubscription->setMail($sSubscriptionMail);
         $oSubscription->setSubscribeHash(func_generator());
         if ($this->PluginSubscription_Subscription_AddSubscription($oSubscription)) {
             $sSubscribeCode = $oSubscription->getSubscribeHash();
             $sSubscribeCode .= base64_encode(xxtea_encrypt($oSubscription->getMail(), $oSubscription->getSubscribeHash()));
             $sSubscribeCode = str_replace(array('/', '+'), array('{', '}'), $sSubscribeCode);
             $this->Notify_Send($oSubscription->getMail(), 'notify.subscription_subscription.tpl', $this->Lang_Get('plugin.subscription.subscription_mail_message_subject'), array('sSubscribeCode' => $sSubscribeCode), 'subscription');
             $this->Viewer_AssignAjax('sText', $this->Lang_Get('plugin.subscription.subscription_block_subscription_submit_ok'));
         } else {
             $this->Viewer_AssignAjax('sText', $this->Lang_Get('system_error'));
         }
     }
     return true;
 }
开发者ID:olegverstka,项目名称:kprf.dev,代码行数:50,代码来源:ActionAjax.class.php


示例3: AjaxAddPoint

 /**
  * Добавление точки на карту
  */
 protected function AjaxAddPoint()
 {
     $this->Viewer_SetResponseAjax('json');
     $iCity = getRequestStr('uid');
     $iUid = getRequestStr('uid');
     $iLat = getRequestStr('lat');
     $iLon = getRequestStr('lon');
     $oUser = $this->PluginCoverage_Abills_GetUserByUid($iUid);
     $iVlan = $oUser->getVlan();
     $oUser = Engine::GetEntity('PluginCoverage_Coverage_Users');
     $oUser->setLat($iLat);
     $oUser->setLon($iLon);
     $oUser->setUid($iUid);
     $oUser->setVlanId($iVlan);
     $oUser->save();
     //print_r($oUser);
     //die();
     $this->Viewer_AssignAjax('1', '');
     $this->Viewer_AssignAjax('2', $iLat);
     $this->Viewer_AssignAjax('3', $iLon);
 }
开发者ID:tomastovt,项目名称:coverage,代码行数:24,代码来源:ActionCoverage.class.php


示例4: checkPostFields

 /**
  * Проверка полей формы создания поста
  */
 private function checkPostFields($oPost)
 {
     $this->Security_ValidateSendForm();
     $bOk = true;
     /**
      * Валидация данных
      */
     if (!$oPost->_Validate()) {
         $this->Message_AddError($oPost->_getValidateError(), $this->Lang_Get('error'));
         $bOk = false;
     }
     if (!$this->User_IsAuthorization()) {
         if (!$this->Validate_Validate('captcha', getRequestStr('guest_captcha'))) {
             $this->Message_AddError($this->Validate_GetErrorLast(), $this->Lang_Get('error'));
             $bOk = false;
         }
     }
     /**
      * Проверка вложений
      */
     $iCountFiles = 0;
     if (!$oPost->getId()) {
         if (isset($_COOKIE['ls_fattach_target_tmp'])) {
             $iCountFiles = $this->PluginForum_Forum_GetCountFilesByTargetTmp($_COOKIE['ls_fattach_target_tmp']);
         } else {
             $this->Message_AddError($this->Lang_Get('system_error'), $this->Lang_Get('error'));
             $bOk = false;
         }
     } else {
         $iCountFiles = count($oPost->getFiles());
     }
     if ($iCountFiles > Config::Get('plugin.forum.attach.count_max')) {
         $this->Message_AddError($this->Lang_Get('plugin.forum.attach_error_too_much_files', array('MAX' => Config::Get('plugin.forum.attach.count_max'))), $this->Lang_Get('error'));
         $bOk = false;
     }
     /**
      * Выполнение хуков
      */
     $this->Hook_Run('forum_check_post_fields', array('bOk' => &$bOk));
     return $bOk;
 }
开发者ID:Kreddik,项目名称:lsplugin-forum,代码行数:44,代码来源:ActionForum.class.php


示例5: EventAjaxModalCropAvatar

 /**
  * Показывает модальное окно с кропом аватара
  */
 protected function EventAjaxModalCropAvatar()
 {
     $this->Viewer_SetResponseAjax('json');
     $oViewer = $this->Viewer_GetLocalViewer();
     $oViewer->Assign('image', getRequestStr('path'), true);
     $oViewer->Assign('originalWidth', (int) getRequest('original_width'), true);
     $oViewer->Assign('originalHeight', (int) getRequest('original_height'), true);
     $oViewer->Assign('width', (int) getRequest('width'), true);
     $oViewer->Assign('height', (int) getRequest('height'), true);
     $this->Viewer_AssignAjax('sText', $oViewer->Fetch("[email protected]"));
 }
开发者ID:pinguo-liguo,项目名称:livestreet,代码行数:14,代码来源:ActionBlog.class.php


示例6: AjaxAddTalkUser

 /**
  * Добавление нового участника разговора (ajax)
  *
  */
 public function AjaxAddTalkUser()
 {
     /**
      * Устанавливаем формат Ajax ответа
      */
     $this->Viewer_SetResponseAjax('json');
     $aUsers = getRequest('users', null, 'post');
     $idTalk = getRequestStr('target_id', null, 'post');
     /**
      * Валидация
      */
     if (!is_array($aUsers)) {
         return $this->EventErrorDebug();
     }
     /**
      * Если пользователь не авторизирован, возвращаем ошибку
      */
     if (!$this->User_IsAuthorization()) {
         $this->Message_AddErrorSingle($this->Lang_Get('common.error.need_authorization'), $this->Lang_Get('common.error.error'));
         return;
     }
     /**
      * Если разговор не найден, или пользователь не является его автором (или админом), возвращаем ошибку
      */
     if (!($oTalk = $this->Talk_GetTalkById($idTalk)) || $oTalk->getUserId() != $this->oUserCurrent->getId() && !$this->oUserCurrent->isAdministrator()) {
         $this->Message_AddErrorSingle($this->Lang_Get('talk.notices.not_found'), $this->Lang_Get('common.error.error'));
         return;
     }
     /**
      * Получаем список всех участников разговора
      */
     $aTalkUsers = $oTalk->getTalkUsers();
     /**
      * Получаем список пользователей, которые не принимают письма
      */
     $aUserInBlacklist = $this->Talk_GetBlacklistByTargetId($this->oUserCurrent->getId());
     /**
      * Ограничения на максимальное число участников разговора
      */
     if (count($aTalkUsers) >= Config::Get('module.talk.max_users') and !$this->oUserCurrent->isAdministrator()) {
         $this->Message_AddError($this->Lang_Get('talk.add.notices.users_error_many'), $this->Lang_Get('common.error.error'));
         return;
     }
     /**
      * Обрабатываем добавление по каждому переданному логину пользователя
      */
     foreach ($aUsers as $sUser) {
         $sUser = trim($sUser);
         if ($sUser == '') {
             continue;
         }
         /**
          * Попытка добавить себя
          */
         if (strtolower($sUser) == strtolower($this->oUserCurrent->getLogin())) {
             $aResult[] = array('bStateError' => true, 'sMsgTitle' => $this->Lang_Get('common.error.error'), 'sMsg' => $this->Lang_Get('user_list_add.notices.error_self'));
             continue;
         }
         if (($oUser = $this->User_GetUserByLogin($sUser)) && $oUser->getActivate() == 1) {
             if (!in_array($oUser->getId(), $aUserInBlacklist)) {
                 if (array_key_exists($oUser->getId(), $aTalkUsers)) {
                     switch ($aTalkUsers[$oUser->getId()]->getUserActive()) {
                         /**
                          * Если пользователь ранее был удален админом разговора, то добавляем его снова
                          */
                         case ModuleTalk::TALK_USER_DELETE_BY_AUTHOR:
                             if ($this->Talk_AddTalkUser(Engine::GetEntity('Talk_TalkUser', array('talk_id' => $idTalk, 'user_id' => $oUser->getId(), 'date_last' => null, 'talk_user_active' => ModuleTalk::TALK_USER_ACTIVE)))) {
                                 $this->Talk_SendNotifyTalkNew($oUser, $this->oUserCurrent, $oTalk);
                                 $oViewer = $this->Viewer_GetLocalViewer();
                                 $oViewer->Assign('user', $oUser, true);
                                 $oViewer->Assign('showActions', true, true);
                                 $aResult[] = array('bStateError' => false, 'sMsgTitle' => $this->Lang_Get('common.attention'), 'sMsg' => $this->Lang_Get('user_list_add.notices.success_add', array('login', htmlspecialchars($sUser))), 'user_id' => $oUser->getId(), 'user_login' => $oUser->getLogin(), 'html' => $oViewer->Fetch("[email protected]"));
                                 $bState = true;
                             } else {
                                 $aResult[] = array('bStateError' => true, 'sMsgTitle' => $this->Lang_Get('common.error.error'), 'sMsg' => $this->Lang_Get('common.error.system.base'));
                             }
                             break;
                             /**
                              * Если пользователь является активным участником разговора, возвращаем ошибку
                              */
                         /**
                          * Если пользователь является активным участником разговора, возвращаем ошибку
                          */
                         case ModuleTalk::TALK_USER_ACTIVE:
                             $aResult[] = array('bStateError' => true, 'sMsgTitle' => $this->Lang_Get('common.error.error'), 'sMsg' => $this->Lang_Get('user_list_add.notices.error_already_added', array('login' => htmlspecialchars($sUser))));
                             break;
                             /**
                              * Если пользователь удалил себя из разговора самостоятельно, то блокируем повторное добавление
                              */
                         /**
                          * Если пользователь удалил себя из разговора самостоятельно, то блокируем повторное добавление
                          */
                         case ModuleTalk::TALK_USER_DELETE_BY_SELF:
                             $aResult[] = array('bStateError' => true, 'sMsgTitle' => $this->Lang_Get('common.error.error'), 'sMsg' => $this->Lang_Get('talk.users.notices.deleted', array('login' => htmlspecialchars($sUser))));
                             break;
                         default:
//.........这里部分代码省略.........
开发者ID:Casper-SC,项目名称:livestreet,代码行数:101,代码来源:ActionTalk.class.php


示例7: EventShowBlogs

 /**
  * Отображение списка блогов
  */
 protected function EventShowBlogs()
 {
     /**
      * По какому полю сортировать
      */
     $sOrder = 'blog_rating';
     if (getRequest('order')) {
         $sOrder = getRequestStr('order');
     }
     /**
      * В каком направлении сортировать
      */
     $sOrderWay = 'desc';
     if (getRequest('order_way')) {
         $sOrderWay = getRequestStr('order_way');
     }
     /**
      * Фильтр поиска блогов
      */
     $aFilter = array('exclude_type' => 'personal');
     /**
      * Передан ли номер страницы
      */
     $iPage = preg_match("/^\\d+\$/i", $this->GetEventMatch(2)) ? $this->GetEventMatch(2) : 1;
     /**
      * Получаем список блогов
      */
     $aResult = $this->Blog_GetBlogsByFilter($aFilter, array($sOrder => $sOrderWay), $iPage, Config::Get('module.blog.per_page'));
     $aBlogs = $aResult['collection'];
     /**
      * Формируем постраничность
      */
     $aPaging = $this->Viewer_MakePaging($aResult['count'], $iPage, Config::Get('module.blog.per_page'), Config::Get('pagination.pages.count'), Router::GetPath('blogs'), array('order' => $sOrder, 'order_way' => $sOrderWay));
     /**
      * Загружаем переменные в шаблон
      */
     $this->Viewer_Assign('aPaging', $aPaging);
     $this->Viewer_Assign("aBlogs", $aBlogs);
     $this->Viewer_Assign("sBlogOrder", htmlspecialchars($sOrder));
     $this->Viewer_Assign("sBlogOrderWay", htmlspecialchars($sOrderWay));
     $this->Viewer_Assign("sBlogOrderWayNext", htmlspecialchars($sOrderWay == 'desc' ? 'asc' : 'desc'));
     /**
      * Устанавливаем title страницы
      */
     $this->Viewer_AddHtmlTitle($this->Lang_Get('blog_menu_all_list'));
     /**
      * Устанавливаем шаблон вывода
      */
     $this->SetTemplateAction('index');
 }
开发者ID:cbrspc,项目名称:LIVESTREET-1-DISTRIB,代码行数:53,代码来源:ActionBlogs.class.php


示例8: EventAjaxSearch

 /**
  * Поиск пользователей по логину
  */
 protected function EventAjaxSearch()
 {
     /**
      * Устанавливаем формат Ajax ответа
      */
     $this->Viewer_SetResponseAjax('json');
     /**
      * Формируем фильтр
      */
     $aFilter = array('activate' => 1);
     $sOrderWay = in_array(getRequestStr('order'), array('desc', 'asc')) ? getRequestStr('order') : 'desc';
     $sOrderField = in_array(getRequestStr('sort_by'), array('user_rating', 'user_date_register', 'user_login', 'user_profile_name')) ? getRequestStr('sort_by') : 'user_rating';
     if (is_numeric(getRequestStr('next_page')) and getRequestStr('next_page') > 0) {
         $iPage = getRequestStr('next_page');
     } else {
         $iPage = 1;
     }
     /**
      * Получаем из реквеста первые буквы для поиска пользователей по логину
      */
     $sTitle = getRequest('sText');
     if (is_string($sTitle) and mb_strlen($sTitle, 'utf-8')) {
         $sTitle = str_replace(array('_', '%'), array('\\_', '\\%'), $sTitle);
     } else {
         $sTitle = '';
     }
     /**
      * Как именно искать: совпадение в любой части логина, или только начало или конец логина
      */
     if ($sTitle) {
         if (getRequest('isPrefix')) {
             $sTitle .= '%';
         } elseif (getRequest('isPostfix')) {
             $sTitle = '%' . $sTitle;
         } else {
             $sTitle = '%' . $sTitle . '%';
         }
     }
     if ($sTitle) {
         $aFilter['login'] = $sTitle;
     }
     /**
      * Пол
      */
     if (in_array(getRequestStr('sex'), array('man', 'woman', 'other'))) {
         $aFilter['profile_sex'] = getRequestStr('sex');
     }
     /**
      * Онлайн
      * date_last
      */
     if (getRequest('is_online')) {
         $aFilter['date_last_more'] = date('Y-m-d H:i:s', time() - Config::Get('module.user.time_onlive'));
     }
     /**
      * Geo привязка
      */
     if (getRequestStr('city')) {
         $aFilter['geo_city'] = getRequestStr('city');
     } elseif (getRequestStr('region')) {
         $aFilter['geo_region'] = getRequestStr('region');
     } elseif (getRequestStr('country')) {
         $aFilter['geo_country'] = getRequestStr('country');
     }
     /**
      * Ищем пользователей
      */
     $aResult = $this->User_GetUsersByFilter($aFilter, array($sOrderField => $sOrderWay), $iPage, Config::Get('module.user.per_page'));
     $bHideMore = $iPage * Config::Get('module.user.per_page') >= $aResult['count'];
     /**
      * Формируем ответ
      */
     $oViewer = $this->Viewer_GetLocalViewer();
     $oViewer->Assign('users', $aResult['collection'], true);
     $oViewer->Assign('oUserCurrent', $this->User_GetUserCurrent());
     $oViewer->Assign('textEmpty', $this->Lang_Get('search.alerts.empty'), true);
     $oViewer->Assign('useMore', true, true);
     $oViewer->Assign('hideMore', $bHideMore, true);
     $oViewer->Assign('searchCount', $aResult['count'], true);
     $this->Viewer_AssignAjax('html', $oViewer->Fetch("[email protected]"));
     /**
      * Для подгрузки
      */
     $this->Viewer_AssignAjax('count_loaded', count($aResult['collection']));
     $this->Viewer_AssignAjax('next_page', count($aResult['collection']) > 0 ? $iPage + 1 : $iPage);
     $this->Viewer_AssignAjax('hide', $bHideMore);
 }
开发者ID:pinguo-liguo,项目名称:livestreet,代码行数:90,代码来源:ActionPeople.class.php


示例9: EventCommentDelete

 /**
  * Удаление/восстановление комментария
  *
  */
 protected function EventCommentDelete()
 {
     /**
      * Есть права на удаление комментария?
      */
     if (!$this->ACL_CanDeleteComment($this->oUserCurrent)) {
         $this->Message_AddErrorSingle($this->Lang_Get('not_access'), $this->Lang_Get('error'));
         return;
     }
     /**
      * Комментарий существует?
      */
     $idComment = getRequestStr('idComment', null, 'post');
     if (!($oComment = $this->Comment_GetCommentById($idComment))) {
         $this->Message_AddErrorSingle($this->Lang_Get('system_error'), $this->Lang_Get('error'));
         return;
     }
     /**
      * Устанавливаем пометку о том, что комментарий удален
      */
     $oComment->setDelete(($oComment->getDelete() + 1) % 2);
     $this->Hook_Run('comment_delete_before', array('oComment' => $oComment));
     if (!$this->Comment_UpdateCommentStatus($oComment)) {
         $this->Message_AddErrorSingle($this->Lang_Get('system_error'), $this->Lang_Get('error'));
         return;
     }
     $this->Hook_Run('comment_delete_after', array('oComment' => $oComment));
     /**
      * Формируем текст ответа
      */
     if ($bState = (bool) $oComment->getDelete()) {
         $sMsg = $this->Lang_Get('comment_delete_ok');
         $sTextToggle = $this->Lang_Get('comment_repair');
     } else {
         $sMsg = $this->Lang_Get('comment_repair_ok');
         $sTextToggle = $this->Lang_Get('comment_delete');
     }
     /**
      * Обновление события в ленте активности
      */
     $this->Stream_write($oComment->getUserId(), 'add_comment', $oComment->getId(), !$oComment->getDelete());
     /**
      * Показываем сообщение и передаем переменные в ajax ответ
      */
     $this->Message_AddNoticeSingle($sMsg, $this->Lang_Get('attention'));
     $this->Viewer_AssignAjax('bState', $bState);
     $this->Viewer_AssignAjax('sTextToggle', $sTextToggle);
 }
开发者ID:olegverstka,项目名称:kprf.dev,代码行数:52,代码来源:ActionAjax.class.php


示例10: DisplayAjax

 /**
  * Ответ на ajax запрос
  *
  * @param string $sType Варианты: json, jsonIframe, jsonp
  */
 public function DisplayAjax($sType = 'json')
 {
     /**
      * Загружаем статус ответа и сообщение
      */
     $bStateError = false;
     $sMsgTitle = '';
     $sMsg = '';
     $aMsgError = $this->Message_GetError();
     $aMsgNotice = $this->Message_GetNotice();
     if (count($aMsgError) > 0) {
         $bStateError = true;
         $sMsgTitle = $aMsgError[0]['title'];
         $sMsg = $aMsgError[0]['msg'];
     } elseif (count($aMsgNotice) > 0) {
         $sMsgTitle = $aMsgNotice[0]['title'];
         $sMsg = $aMsgNotice[0]['msg'];
     }
     $this->AssignAjax('sMsgTitle', $sMsgTitle);
     $this->AssignAjax('sMsg', $sMsg);
     $this->AssignAjax('bStateError', $bStateError);
     if ($sType == 'json') {
         if ($this->bResponseSpecificHeader and !headers_sent()) {
             header('Content-type: application/json');
         }
         echo json_encode($this->aVarsAjax);
     } elseif ($sType == 'jsonIframe') {
         // Оборачивает json в тег <textarea>, это не дает браузеру выполнить HTML, который вернул iframe
         if ($this->bResponseSpecificHeader and !headers_sent()) {
             header('Content-type: application/json');
         }
         /**
          * Избавляемся от бага, когда в возвращаемом тексте есть &quot;
          */
         echo '<textarea>' . htmlspecialchars(json_encode($this->aVarsAjax)) . '</textarea>';
     } elseif ($sType == 'jsonp') {
         if ($this->bResponseSpecificHeader and !headers_sent()) {
             header('Content-type: application/json');
         }
         $sCallbackName = getRequestStr('jsonpCallbackName') ? getRequestStr('jsonpCallbackName') : 'jsonpCallback';
         $sCallback = getRequestStr($sCallbackName);
         if (!preg_match('#^[a-z0-9\\-\\_]+$#i', $sCallback)) {
             $sCallback = 'callback';
         }
         echo $sCallback . '(' . json_encode($this->aVarsAjax) . ');';
     }
     exit;
 }
开发者ID:vgrish,项目名称:livestreet-framework,代码行数:53,代码来源:Viewer.class.php


示例11: EventAjaxReminder

 /**
  * Ajax запрос на восстановление пароля
  */
 protected function EventAjaxReminder()
 {
     /**
      * Устанвливаем формат Ajax ответа
      */
     $this->Viewer_SetResponseAjax('json');
     /**
      * Пользователь с таким емайлом существует?
      */
     if (func_check(getRequestStr('mail'), 'mail') and $oUser = $this->User_GetUserByMail(getRequestStr('mail'))) {
         /**
          * Формируем и отправляем ссылку на смену пароля
          */
         $oReminder = Engine::GetEntity('User_Reminder');
         $oReminder->setCode(func_generator(32));
         $oReminder->setDateAdd(date("Y-m-d H:i:s"));
         $oReminder->setDateExpire(date("Y-m-d H:i:s", time() + 60 * 60 * 24 * 7));
         $oReminder->setDateUsed(null);
         $oReminder->setIsUsed(0);
         $oReminder->setUserId($oUser->getId());
         if ($this->User_AddReminder($oReminder)) {
             $this->Message_AddNotice($this->Lang_Get('password_reminder_send_link'));
             $this->Notify_SendReminderCode($oUser, $oReminder);
             return;
         }
     }
     $this->Message_AddError($this->Lang_Get('password_reminder_bad_email'), $this->Lang_Get('error'));
 }
开发者ID:cbrspc,项目名称:LIVESTREET-1-DISTRIB,代码行数:31,代码来源:ActionLogin.class.php


示例12: EventImageManagerLoadImages

 /**
  * Загрузка страницы картинок
  */
 protected function EventImageManagerLoadImages()
 {
     // Менеджер изображений может запускаться в том числе и из админки
     // Если передано название скина админки, то используем его, если же
     // нет, то ту тему, которая установлена для сайта
     if (($sAdminTheme = getRequest('admin')) && E::IsAdmin()) {
         C::Set('view.skin', $sAdminTheme);
     }
     // Получим идентификатор пользователя, изображения которого нужно загрузить
     $iUserId = (int) getRequest('profile', FALSE);
     if ($iUserId && E::ModuleUser()->GetUserById($iUserId)) {
         C::Set('menu.data.profile_images.uid', $iUserId);
     } else {
         // Только пользователь может смотреть своё дерево изображений
         if (!E::IsUser()) {
             E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('system_error'));
             return;
         }
         $iUserId = E::UserId();
     }
     $sCategory = getRequestStr('category', FALSE);
     $sPage = getRequestStr('page', '1');
     $sTopicId = getRequestStr('topic_id', FALSE);
     if (!$sCategory) {
         return;
     }
     // Страница загрузки картинки с компьютера
     if ($sCategory == 'insert-from-pc') {
         $sImages = E::ModuleViewer()->GetLocalViewer()->Fetch('modals/insert_img/inject.pc.tpl');
         E::ModuleViewer()->AssignAjax('images', $sImages);
         return;
     }
     // Страница загрузки из интернета
     if ($sCategory == 'insert-from-link') {
         $sImages = E::ModuleViewer()->GetLocalViewer()->Fetch("modals/insert_img/inject.link.tpl");
         E::ModuleViewer()->AssignAjax('images', $sImages);
         return;
     }
     $sTemplateName = 'inject.images.tpl';
     $aTplVariables = array();
     $aResources = array('collection' => array());
     $iPages = 0;
     if ($sCategory == 'user') {
         //ок
         // * Аватар и фото пользователя
         $aResources = E::ModuleMresource()->GetMresourcesByFilter(array('target_type' => array('profile_avatar', 'profile_photo'), 'user_id' => $iUserId), $sPage, Config::Get('module.topic.images_per_page'));
         $sTemplateName = 'inject.images.user.tpl';
         $iPages = 0;
     } elseif ($sCategory == '_topic') {
         // * Конкретный топик
         $oTopic = E::ModuleTopic()->GetTopicById($sTopicId);
         if ($oTopic && ($oTopic->isPublished() || $oTopic->getUserId() == E::UserId()) && E::ModuleACL()->IsAllowShowBlog($oTopic->getBlog(), E::User())) {
             $aResourcesId = E::ModuleMresource()->GetCurrentTopicResourcesId($iUserId, $sTopicId);
             if ($aResourcesId) {
                 $aResources = E::ModuleMresource()->GetMresourcesByFilter(array('user_id' => $iUserId, 'mresource_id' => $aResourcesId), $sPage, Config::Get('module.topic.images_per_page'));
                 $aResources['count'] = count($aResourcesId);
                 $iPages = ceil($aResources['count'] / Config::Get('module.topic.images_per_page'));
                 $aTplVariables['oTopic'] = $oTopic;
             }
         }
         $sTemplateName = 'inject.images.tpl';
     } elseif ($sCategory == 'talk') {
         // * Письмо
         /** @var ModuleTalk_EntityTalk $oTopic */
         $oTopic = E::ModuleTalk()->GetTalkById($sTopicId);
         if ($oTopic && E::ModuleTalk()->GetTalkUser($sTopicId, $iUserId)) {
             $aResources = E::ModuleMresource()->GetMresourcesByFilter(array('user_id' => $iUserId, 'target_type' => 'talk', 'target_id' => $sTopicId), $sPage, Config::Get('module.topic.images_per_page'));
             $aResources['count'] = E::ModuleMresource()->GetMresourcesCountByTargetIdAndUserId('talk', $sTopicId, $iUserId);
             $iPages = ceil($aResources['count'] / Config::Get('module.topic.images_per_page'));
             $aTplVariables['oTopic'] = $oTopic;
         }
         $sTemplateName = 'inject.images.tpl';
     } elseif ($sCategory == 'comments') {
         // * Комментарии
         $aResources = E::ModuleMresource()->GetMresourcesByFilter(array('user_id' => $iUserId, 'target_type' => array('talk_comment', 'topic_comment')), $sPage, Config::Get('module.topic.images_per_page'));
         $aResources['count'] = E::ModuleMresource()->GetMresourcesCountByTargetAndUserId(array('talk_comment', 'topic_comment'), $iUserId);
         $iPages = ceil($aResources['count'] / Config::Get('module.topic.images_per_page'));
         $sTemplateName = 'inject.images.tpl';
     } elseif ($sCategory == 'current') {
         //ок
         // * Картинки текущего топика (текст, фотосет, одиночные картинки)
         $aResourcesId = E::ModuleMresource()->GetCurrentTopicResourcesId($iUserId, $sTopicId);
         if ($aResourcesId) {
             $aResources = E::ModuleMresource()->GetMresourcesByFilter(array('user_id' => $iUserId, 'mresource_id' => $aResourcesId), $sPage, Config::Get('module.topic.images_per_page'));
             $aResources['count'] = count($aResourcesId);
             $iPages = ceil($aResources['count'] / Config::Get('module.topic.images_per_page'));
         }
         $sTemplateName = 'inject.images.tpl';
     } elseif ($sCategory == 'blog_avatar') {
         // ок
         // * Аватары созданных блогов
         $aResources = E::ModuleMresource()->GetMresourcesByFilter(array('target_type' => 'blog_avatar', 'user_id' => $iUserId), $sPage, Config::Get('module.topic.group_images_per_page'));
         $aResources['count'] = E::ModuleMresource()->GetMresourcesCountByTargetAndUserId('blog_avatar', $iUserId);
         // Получим блоги
         $aBlogsId = array();
         foreach ($aResources['collection'] as $oResource) {
             $aBlogsId[] = $oResource->getTargetId();
//.........这里部分代码省略.........
开发者ID:ZeoNish,项目名称:altocms,代码行数:101,代码来源:ActionAjax.class.php


示例13: EventPlugins

 /**
  * Страница со списком плагинов
  *
  */
 protected function EventPlugins()
 {
     $this->sMenuHeadItemSelect = 'plugins';
     /**
      * Получаем название плагина и действие
      */
     if ($sPlugin = getRequestStr('plugin', null, 'get') and $sAction = getRequestStr('action', null, 'get')) {
         return $this->SubmitManagePlugin($sPlugin, $sAction);
     }
     /**
      * Получаем список блогов
      */
     $aPlugins = $this->PluginManager_GetPluginsItems(array('order' => 'name'));
     /**
      * Загружаем переменные в шаблон
      */
     $this->Viewer_Assign('plugins', $aPlugins);
     $this->Viewer_AddHtmlTitle($this->Lang_Get('admin.plugins.title'));
     /**
      * Устанавливаем шаблон вывода
      */
     $this->SetTemplateAction('plugins');
 }
开发者ID:pinguo-liguo,项目名称:livestreet,代码行数:27,代码来源:ActionAdmin.class.php


示例14: EventUnsubscribe

 /**
  * Отписка от блога или пользователя
  *
  */
 protected function EventUnsubscribe()
 {
     /**
      * Устанавливаем формат Ajax ответа
      */
     $this->Viewer_SetResponseAjax('json');
     if (!getRequest('id')) {
         $this->Message_AddError($this->Lang_Get('system_error'), $this->Lang_Get('error'));
         return;
     }
     $sType = getRequestStr('type');
     $iType = null;
     /**
      * Определяем от чего отписываемся
      */
     switch ($sType) {
         case 'blogs':
             $iType = ModuleUserfeed::SUBSCRIBE_TYPE_BLOG;
             break;
         case 'users':
             $iType = ModuleUserfeed::SUBSCRIBE_TYPE_USER;
             break;
         default:
             $this->Message_AddError($this->Lang_Get('system_error'), $this->Lang_Get('error'));
             return;
     }
     /**
      * Отписываем пользователя
      */
     $this->Userfeed_unsubscribeUser($this->oUserCurrent->getId(), $iType, getRequestStr('id'));
     $this->Message_AddNotice($this->Lang_Get('userfeed_subscribes_updated'), $this->Lang_Get('attention'));
 }
开发者ID:lunavod,项目名称:bunker_stable,代码行数:36,代码来源:ActionUserfeed.class.php


示例15: EventAjaxSearch

 /**
  * Поиск блогов по названию
  */
 protected function EventAjaxSearch()
 {
     /**
      * Устанавливаем формат Ajax ответа
      */
     $this->Viewer_SetResponseAjax('json');
     /**
      * Фильтр
      */
     $aFilter = array('exclude_type' => 'personal');
     $sOrderWay = in_array(getRequestStr('order'), array('desc', 'asc')) ? getRequestStr('order') : 'desc';
     $sOrderField = in_array(getRequestStr('sort_by'), array('blog_id', 'blog_title', 'blog_count_user', 'blog_count_topic')) ? getRequestStr('sort_by') : 'blog_count_user';
     if (is_numeric(getRequestStr('next_page')) and getRequestStr('next_page') > 0) {
         $iPage = getRequestStr('next_page');
     } else {
         $iPage = 1;
     }
     /**
      * Получаем из реквеста первые буквы блога
      */
     if ($sTitle = getRequestStr('sText')) {
         $sTitle = str_replace('%', '', $sTitle);
     } else {
         $sTitle = '';
     }
     if ($sTitle) {
         $aFilter['title'] = "%{$sTitle}%";
     }
     /**
      * Категории
      */
     if (getRequestStr('category') and $oCategory = $this->Category_GetCategoryById(getRequestStr('category'))) {
         /**
          * Получаем ID всех блогов
          * По сути это костыль, но т.к. блогов обычно не много, то норм
          */
         $aBlogIds = $this->Blog_GetTargetIdsByCategory($oCategory, 1, 1000, true);
         $aFilter['id'] = $aBlogIds ? $aBlogIds : array(0);
     }
     /**
      * Тип
      */
     if (in_array(getRequestStr('type'), array('open', 'close'))) {
         $aFilter['type'] = getRequestStr('type');
     }
     /**
      * Принадлежность
      */
     if ($this->oUserCurrent) {
         if (getRequestStr('relation') == 'my') {
             $aFilter['user_owner_id'] = $this->oUserCurrent->getId();
         } elseif (getRequestStr('relation') == 'join') {
             $aFilter['roles'] = array(ModuleBlog::BLOG_USER_ROLE_USER, ModuleBlog::BLOG_USER_ROLE_ADMINISTRATOR, ModuleBlog::BLOG_USER_ROLE_MODERATOR);
         }
     }
     /**
      * Ищем блоги
      */
     $aResult = $this->Blog_GetBlogsByFilter($aFilter, array($sOrderField => $sOrderWay), $iPage, Config::Get('module.blog.per_page'));
     $bHideMore = $iPage * Config::Get('module.blog.per_page') >= $aResult['count'];
     /**
      * Формируем и возвращает ответ
      */
     $oViewer = $this->Viewer_GetLocalViewer();
     $oViewer->Assign('blogs', $aResult['collection'], true);
     $oViewer->Assign('oUserCurrent', $this->User_GetUserCurrent());
     $oViewer->Assign('textEmpty', $this->Lang_Get('search.alerts.empty'), true);
     $oViewer->Assign('useMore', true, true);
     $oViewer->Assign('hideMore', $bHideMore, true);
     $oViewer->Assign('searchCount', $aResult['count'], true);
     $this->Viewer_AssignAjax('html', $oViewer->Fetch("[email protected]"));
     /**
      * Для подгрузки
      */
     $this->Viewer_AssignAjax('count_loaded', count($aResult['collection']));
     $this->Viewer_AssignAjax('next_page', count($aResult['collection']) > 0 ? $iPage + 1 : $iPage);
     $this->Viewer_AssignAjax('hide', $bHideMore);
 }
开发者ID:pinguo-liguo,项目名称:livestreet,代码行数:81,代码来源:ActionBlogs.class.php


示例16: EventInvite

 /**
  * Обработка кода приглашения при включеном режиме инвайтов
  *
  */
 protected function EventInvite()
 {
     if (!Config::Get('general.reg.invite')) {
         return parent::EventNotFound();
     }
     /**
      * Обработка отправки формы с кодом приглашения
      */
     if (isPost('submit_invite')) {
         /**
          * проверяем код приглашения на валидность
          */
         if ($this->CheckInviteRegister()) {
             $sInviteId = $this->GetInviteRegister();
         } else {
             $sInviteId = getRequestStr('invite_code');
         }
         $oInvate = $this->User_GetInviteByCode($sInviteId);
         if ($oInvate) {
             if (!$this->CheckInviteRegister()) {
                 $this->Session_Set('invite_code', $oInvate->getCode());
             }
             return Router::Action('registration');
         } else {
             $this->Message_AddError($this->Lang_Get('registration_invite_code_error'), $this->Lang_Get('error'));
         }
     }
 }
开发者ID:lunavod,项目名称:bunker_stable,代码行数:32,代码来源:ActionRegistration.class.php


示例17: EventAjaxFriendDelete


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getRequestURI函数代码示例发布时间:2022-05-15
下一篇:
PHP getRequestParams函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap