protected function EventShowBlogs()
 {
     /**
      * Передан ли номер страницы
      */
     $iPage = preg_match("/^\\d+\$/i", $this->GetEventMatch(2)) ? $this->GetEventMatch(2) : 1;
     /**
      * Получаем список блогов
      */
     $aResult = $this->Blog_GetBlogsRating($iPage, Config::Get('module.blog.per_page'));
     $aBlogs = $aResult['collection'];
     /**
      * Формируем постраничность
      */
     $aPaging = $this->Viewer_MakePaging($aResult['count'], $iPage, Config::Get('module.blog.per_page'), 4, Router::GetPath('blogs'));
     /**
      * Загружаем переменные в шаблон
      */
     $this->Viewer_Assign('aPaging', $aPaging);
     $this->Viewer_Assign("aBlogs", $aBlogs);
     $this->Viewer_AddHtmlTitle($this->Lang_Get('blog_menu_all_list'));
     /**
      * Устанавливаем шаблон вывода
      */
     $this->SetTemplateAction('index');
 }
Example #2
0
 /**
  * Выводим комментарии
  *
  */
 protected function EventComments()
 {
     /**
      * Передан ли номер страницы
      */
     $iPage = $this->GetEventMatch(2) ? $this->GetEventMatch(2) : 1;
     /**
      * Исключаем из выборки идентификаторы закрытых блогов (target_parent_id)
      */
     $aCloseBlogs = $this->oUserCurrent ? $this->Blog_GetInaccessibleBlogsByUser($this->oUserCurrent) : $this->Blog_GetInaccessibleBlogsByUser();
     /**
      * Получаем список комментов
      */
     $aResult = $this->Comment_GetCommentsAll('topic', $iPage, Config::Get('module.comment.per_page'), array(), $aCloseBlogs);
     $aComments = $aResult['collection'];
     /**
      * Формируем постраничность
      */
     $aPaging = $this->Viewer_MakePaging($aResult['count'], $iPage, Config::Get('module.comment.per_page'), 4, Router::GetPath('comments'));
     /**
      * Загружаем переменные в шаблон
      */
     $this->Viewer_Assign('aPaging', $aPaging);
     $this->Viewer_Assign("aComments", $aComments);
     $this->Viewer_AddHtmlTitle($this->Lang_Get('comments_all'));
     $this->Viewer_SetHtmlRssAlternate(Router::GetPath('rss') . 'allcomments/', $this->Lang_Get('comments_all'));
     /**
      * Устанавливаем шаблон вывода
      */
     $this->SetTemplateAction('index');
 }
Example #3
0
 protected function EventShowCatBlogs()
 {
     //Получаем категорию из адресной строки
     $sFirstCat = $this->sCurrentEvent;
     //Первая категория соответсвует имени эвента
     $aParam = $this->GetParams();
     //Последний параметр может оказаться номером страницы, проверяем
     $iPage = 1;
     if (isset($aParam[count($aParam) - 1])) {
         if (preg_match("/^page\\d+\$/i", $aParam[count($aParam) - 1])) {
             $sPage = array_pop($aParam);
             $iPage = (int) substr($sPage, 4);
         }
     }
     array_unshift($aParam, $sFirstCat);
     $sFullCatName = strtoupper(implode(':', $aParam));
     if (!$this->PluginCommunitycats_ModuleCategory_IsFullCategoryExist($sFullCatName)) {
         return parent::EventNotFound();
     }
     //Получаем список блогов
     $aFilter = array('in' => array('blog_type' => array('open', 'close')), 'beginLike' => array('blog_cat' => $sFullCatName));
     $aBlogs = $this->PluginCommunitycats_ModuleCategory_GetBlogsByFilter($aFilter, array(), array('iPage' => $iPage, 'iElementsPerPage' => Config::Get('module.blog.per_page')), false);
     $iCountBlogs = $this->PluginCommunitycats_ModuleCategory_GetCountBlogsByFilter($aFilter);
     //Формируем постраничность
     $aPaging = $this->Viewer_MakePaging($iCountBlogs, $iPage, Config::Get('module.blog.per_page'), 4, Router::GetPath('blogs') . implode('/', $aParam));
     //Загружаем переменные в шаблон
     $this->Viewer_Assign('aPath', $aParam);
     $this->Viewer_Assign('aPaging', $aPaging);
     $this->Viewer_Assign('aBlogs', $aBlogs);
     $this->Viewer_AddHtmlTitle($this->Lang_Get('blog_menu_all_list'));
     //Устанавливаем шаблон вывода
     $this->SetTemplateAction('index');
 }
 public function SaveConfig($sMode)
 {
     $this->Security_ValidateSendForm();
     $aConfigSet = array();
     foreach ($this->aFields[$sMode] as $sName => $aField) {
         if ($aField['type'] != 'section') {
             $aConfigField['key'] = 'config.all.' . $aField['config'];
             if (!isset($_POST[$sName]) || !$_POST[$sName]) {
                 if (isset($aField['empty'])) {
                     $aConfigField['val'] = $aField['empty'];
                 } else {
                     if ($aField['valtype'] == 'boolean') {
                         $val = false;
                     } else {
                         $val = '';
                     }
                 }
             } else {
                 $val = $_POST[$sName];
                 settype($val, $aField['valtype']);
             }
             $aConfigField['val'] = serialize($val);
             $aConfigSet[] = $aConfigField;
         }
     }
     $sDataFile = $this->PluginAceadminpanel_Admin_GetCustomConfigFile();
     if ($this->PluginAceAdminPanel_Admin_SetValueArray($aConfigSet)) {
         $aConfigSet = $this->PluginAceAdminPanel_Admin_GetValueArrayByPrefix('config.all.');
         file_put_contents($sDataFile, serialize($aConfigSet));
         $this->oAdminAction->Message('notice', $this->Lang_Get('adm_saved_ok'), null, true);
     } else {
         $this->oAdminAction->Message('error', $this->Lang_Get('adm_saved_err'), null, true);
     }
     admHeaderLocation(Router::GetPath('admin') . 'site/settings/' . $this->sMenuNavItemSelect);
 }
 /**
  * Генерирует карту Sitemap-ов, разбивая каждый тип сущностей на наборы
  *
  * @return void
  */
 protected function eventSitemapIndex()
 {
     $iPerPage = Config::Get('plugin.sitemap.objects_per_page');
     $aCounters = array('general' => 1, 'blogs' => (int) ceil($this->PluginSitemap_Blog_GetOpenCollectiveBlogsCount() / $iPerPage), 'topics' => (int) ceil($this->PluginSitemap_Topic_GetOpenTopicsCount() / $iPerPage), 'users' => (int) ceil($this->PluginSitemap_User_GetUsersCount() / Config::Get('plugin.sitemap.users_per_page')));
     // Возможность сторонними плагинами добавлять свои данные в Sitemap Index
     $aExternalCounters = $this->PluginSitemap_Sitemap_GetExternalCounters();
     if (is_array($aExternalCounters)) {
         foreach ($aExternalCounters as $k => $v) {
             if (is_string($k) && is_numeric($v)) {
                 $aCounters[$k] = (int) $v;
             }
         }
     }
     //        /**
     //         * Вызов хуков
     //         */
     //        Engine::getInstance()->_CallModule('Hook_Run',array('sitemap_index_counters',&$aCounters));
     // Генерируем ссылки на конечные Sitemap'ы для Sitemap Index
     $aData = array();
     $sRootWeb = rtrim(str_replace('index/', '', Router::GetPath('index')), '/');
     foreach ($aCounters as $sType => $iCount) {
         if ($iCount > 0) {
             for ($i = 1; $i <= $iCount; ++$i) {
                 $aData[] = array('loc' => $sRootWeb . '/sitemap_' . $sType . '_' . $i . '.xml');
             }
         }
     }
     $aLinks = $this->PluginSitemap_Sitemap_GetExternalLinks();
     foreach ($aLinks as $sLink) {
         $aData[] = array('loc' => $sLink);
     }
     $this->_displaySitemap($aData, 'sitemap_index.tpl');
 }
Example #6
0
 /**
  * Отображение топиков
  *
  */
 protected function EventTags()
 {
     /**
      * Получаем тег из УРЛа
      */
     $sTag = $this->sCurrentEvent;
     /**
      * Передан ли номер страницы
      */
     $iPage = $this->GetParamEventMatch(0, 2) ? $this->GetParamEventMatch(0, 2) : 1;
     /**
      * Получаем список топиков
      */
     $aResult = $this->Topic_GetTopicsByTag($sTag, $iPage, Config::Get('module.topic.per_page'));
     $aTopics = $aResult['collection'];
     /**
      * Формируем постраничность
      */
     $aPaging = $this->Viewer_MakePaging($aResult['count'], $iPage, Config::Get('module.topic.per_page'), 4, Router::GetPath('tag') . htmlspecialchars($sTag));
     /**
      * Загружаем переменные в шаблон
      */
     $this->Viewer_Assign('aPaging', $aPaging);
     $this->Viewer_Assign('aTopics', $aTopics);
     $this->Viewer_Assign('sTag', $sTag);
     $this->Viewer_AddHtmlTitle($this->Lang_Get('tag_title'));
     $this->Viewer_AddHtmlTitle($sTag);
     $this->Viewer_SetHtmlRssAlternate(Router::GetPath('rss') . 'tag/' . $sTag . '/', $sTag);
     /**
      * Устанавливаем шаблон вывода
      */
     $this->SetTemplateAction('index');
 }
 public function AddRssLink()
 {
     if (Config::Get('general.close') and Config::Get('plugin.getlasttopics.enable_rss')) {
         $aHtmlRssAlternate = null;
         $aHtmlRssAlternate['url'] = htmlspecialchars(Router::GetPath('rss'));
         $aHtmlRssAlternate['title'] = htmlspecialchars(Config::Get('view.name'));
         $this->Viewer_Assign('aHtmlRssAlternate', $aHtmlRssAlternate);
         return $this->Viewer_Fetch(Plugin::GetTemplatePath(__CLASS__) . 'rsslink.tpl');
     }
 }
Example #8
0
 protected function EventShowCatUsers()
 {
     //Получаем категорию из адресной строки
     $sFirstCat = $this->sCurrentEvent;
     //Первая категория соответсвует имени эвента
     $aParam = $this->GetParams();
     //Последний параметр может оказаться номером страницы, проверяем
     $iPage = 1;
     if (isset($aParam[count($aParam) - 1])) {
         if (preg_match("/^page\\d+\$/i", $aParam[count($aParam) - 1])) {
             $sPage = array_pop($aParam);
             $iPage = (int) substr($sPage, 4);
         }
     }
     array_unshift($aParam, $sFirstCat);
     //Категории пользователей отделяются от категорий блогов словом cat
     $sFullBlogCatName = '';
     $sFullUserCatName = '';
     if (($iCatPosition = array_search('cat', $aParam)) !== false) {
         $aUserCats = array_slice($aParam, 0, $iCatPosition);
         $aBlogCats = array_slice($aParam, $iCatPosition + 1);
         $sFullBlogCatName = strtoupper(implode(':', $aBlogCats));
     } else {
         $aUserCats = $aParam;
     }
     $sFullUserCatName = strtoupper(implode(':', $aUserCats));
     if ($sFullUserCatName && !$this->PluginUsercats_ModuleCategory_IsFullCategoryExist($sFullUserCatName)) {
         return parent::EventNotFound();
     }
     if ($sFullBlogCatName && !$this->PluginCommunitycats_ModuleCategory_IsFullCategoryExist($sFullBlogCatName)) {
         return parent::EventNotFound();
     }
     if (!$sFullBlogCatName && !$sFullUserCatName) {
         return Router::Action('people', 'good');
     }
     //Получаем список пользователей
     $aFilters = array();
     if ($sFullUserCatName) {
         $aFilters['aUserFilter'] = array('beginLike' => array('user_cat' => $sFullUserCatName));
     }
     if ($sFullBlogCatName) {
         $aFilters['aBlogFilter'] = array('beginLike' => array('blog_cat' => $sFullBlogCatName), 'eq' => array('blog_type' => 'personal'));
     }
     $aUsers = $this->PluginUsercats_ModuleCategory_GetUsersByFilters($aFilters, array(), array('iPage' => $iPage, 'iElementsPerPage' => Config::Get('module.user.per_page')), false);
     $iCountUsers = $this->PluginUsercats_ModuleCategory_GetCountUsersByFilters($aFilters);
     //Формируем постраничность
     $aPaging = $this->Viewer_MakePaging($iCountUsers, $iPage, Config::Get('module.user.per_page'), 4, Router::GetPath('people') . implode('/', $aParam));
     //Загружаем переменные в шаблон
     $this->Viewer_Assign('aPath', $aParam);
     $this->Viewer_Assign('aPaging', $aPaging);
     $this->Viewer_Assign('aUsersRating', $aUsers);
     $this->GetStats();
     //Устанавливаем шаблон вывода
     $this->SetTemplateAction('index');
 }
Example #9
0
 protected function EventSeopack()
 {
     $this->sMainMenuItem = 'content';
     $this->_setTitle(E::ModuleLang()->Get('plugin.seopack.seopack_title'));
     $nPage = $this->_getPageNum();
     $aSeopack = E::ModuleSeopack()->GetSeopackItemsByFilter(array('#page' => 1, '#limit' => array(($nPage - 1) * Config::Get('admin.items_per_page'), Config::Get('admin.items_per_page'))));
     $aPaging = E::ModuleViewer()->MakePaging($aSeopack['count'], $nPage, Config::Get('admin.items_per_page'), 4, Router::GetPath('admin') . 'seopack/');
     E::ModuleViewer()->Assign('aSeopack', $aSeopack['collection']);
     E::ModuleViewer()->Assign('aPaging', $aPaging);
     $this->SetTemplateAction('seopack_list');
 }
Example #10
0
 public function show($param = null, $template = null)
 {
     if (!$template) {
         $path = Router::GetPath();
         $template = trim($path, '/');
         $template .= Template::DEFAULT_TEMPLATE_SUFFIX;
     }
     $param = $param ? $param : array();
     $this->params = $this->params ? $this->params : array();
     $param = array_merge($this->params, $param);
     $this->params = $param;
     Template::Show($template, $param);
 }
Example #11
0
 protected function EventTopics()
 {
     /**
      * Получаем логин из УРЛа
      */
     $sUserLogin = $this->sCurrentEvent;
     /**
      * Проверяем есть ли такой юзер
      */
     if (!($this->oUserProfile = $this->User_GetUserByLogin($sUserLogin))) {
         return parent::EventNotFound();
     }
     /**
      * Передан ли номер страницы
      */
     if ($this->GetParamEventMatch(0, 0) == 'blog') {
         $iPage = $this->GetParamEventMatch(1, 2) ? $this->GetParamEventMatch(1, 2) : 1;
     } else {
         $iPage = $this->GetParamEventMatch(0, 2) ? $this->GetParamEventMatch(0, 2) : 1;
     }
     /**
      * Получаем список топиков (исключая зафиксированные)
      */
     $aResultNotFixed = $this->PluginTopicfix_ModuleTofix_GetTopicsPersonalByUserNotFixed($this->oUserProfile->getId(), 1, $iPage, Config::Get('module.topic.per_page'));
     $aTopics = $aResultNotFixed['collection'];
     /**
      * Получаем список зафиксированных топиков
      */
     $aResultFixed = $this->PluginTopicfix_ModuleTofix_GetTopicsPersonalByUserFixed($this->oUserProfile->getId(), 1);
     $aTopicsFixed = $aResultFixed['collection'];
     /**
      * Формируем постраничность
      */
     $aPaging = $this->Viewer_MakePaging($aResultNotFixed['count'], $iPage, Config::Get('module.topic.per_page'), 4, Router::GetPath('my') . $this->oUserProfile->getLogin());
     /**
      * Загружаем переменные в шаблон
      */
     $this->Viewer_Assign('aPaging', $aPaging);
     $this->Viewer_Assign('aTopics', $aTopics);
     $this->Viewer_Assign('aTopicsFixed', $aTopicsFixed);
     $this->Viewer_Assign('oUserOwner', $this->oUserProfile);
     $this->Viewer_AddHtmlTitle($this->Lang_Get('user_menu_publication') . ' ' . $this->oUserProfile->getLogin());
     $this->Viewer_AddHtmlTitle($this->Lang_Get('user_menu_publication_blog'));
     $this->Viewer_SetHtmlRssAlternate(Router::GetPath('rss') . 'personal_blog/' . $this->oUserProfile->getLogin() . '/', $this->oUserProfile->getLogin());
     /**
      * Устанавливаем шаблон вывода
      */
     $this->SetTemplateAction('blog');
 }
Example #12
0
 /**
  * Get data for static pages Sitemap
  *
  * @param integer $iCurrPage
  * @return array
  */
 public function getDataForPages($iCurrPage)
 {
     $iPerPage = Config::Get('plugin.sitemap.objects_per_page');
     $sCacheKey = "sitemap_pages_{$iCurrPage}_" . $iPerPage;
     if (false === ($aData = $this->Cache_Get($sCacheKey))) {
         $iCount = 0;
         $aPages = $this->PluginPage_Page_GetListOfActivePages($iCount, $iCurrPage, $iPerPage);
         $aData = array();
         foreach ($aPages as $oPage) {
             $aData[] = $this->PluginSitemap_Sitemap_GetDataForSitemapRow(Router::GetPath('page') . $oPage->getUrlFull(), $oPage->getDateLastMod(), Config::Get('plugin.page.sitemap.sitemap_priority'), Config::Get('plugin.page.sitemap.sitemap_changefreq'));
         }
         $this->Cache_Set($aData, $sCacheKey, array('page_change'), Config::Get('plugin.page.sitemap.cache_lifetime'));
     }
     return $aData;
 }
 protected function EventReceptiondeskIndex()
 {
     $iPage = $this->GetEventMatch(2) ? $this->GetEventMatch(2) : 1;
     if ($iPage == 1) {
         $this->Viewer_SetHtmlCanonical(Router::GetPath('receptiondesk'));
     }
     $aResult = $this->PluginReceptiondesk_Question_GetQuestionList($iPage, Config::Get('plugin.receptiondesk.receptiondesk_question_per_page'), 1);
     $aPaging = $this->Viewer_MakePaging($aResult['count'], $iPage, Config::Get('plugin.receptiondesk.receptiondesk_question_per_page'), Config::Get('pagination.pages.count'), Router::GetPath('receptiondesk'));
     $this->Viewer_Assign('aQuestionList', $aResult['collection']);
     $this->Viewer_Assign('aPaging', $aPaging);
     if (Config::Get('plugin.receptiondesk.receptiondesk_create_popup')) {
         $this->Viewer_Assign('bPopup', true);
     }
     $this->SetTemplateAction('index');
 }
 /**
  * Отписка от подписки
  */
 protected function EventUnsubscribe()
 {
     if ($oSubscribe = $this->Subscribe_GetSubscribeByKey($this->getParam(0)) and $oSubscribe->getStatus() == 1) {
         $oSubscribe->setStatus(0);
         $oSubscribe->setDateRemove(date("Y-m-d H:i:s"));
         $this->Subscribe_UpdateSubscribe($oSubscribe);
         $this->Message_AddNotice($this->Lang_Get('subscribe_change_ok'), null, true);
     }
     /**
      * Получаем URL для редиректа
      */
     if (!($sUrl = $this->Subscribe_GetUrlTarget($oSubscribe->getTargetType(), $oSubscribe->getTargetId()))) {
         $sUrl = Router::GetPath('index');
     }
     Router::Location($sUrl);
 }
Example #15
0
/**
 * Плагин для смарти
 * Позволяет получать данные о роутах
 *
 * @param   array $aParams
 * @param   Smarty $oSmarty
 * @return  string
 */
function smarty_function_router($aParams, &$oSmarty)
{
    if (empty($aParams['page'])) {
        trigger_error("Router: missing 'page' parametr", E_USER_WARNING);
        return;
    }
    require_once Config::Get('path.root.engine') . '/classes/Router.class.php';
    if (!($sPath = Router::GetPath($aParams['page']))) {
        trigger_error("Router: unknown 'page' given", E_USER_WARNING);
        return;
    }
    /**
     * Возвращаем полный адрес к указаному Action
     */
    return isset($aParams['extend']) ? $sPath . $aParams['extend'] . "/" : $sPath;
}
 protected function EventSiteResetSubmit()
 {
     if (isPost('adm_cache_clear_data')) {
         $this->Cache_Clean();
     }
     if (isPost('adm_cache_clear_headfiles')) {
         admClearHeadfilesCache();
     }
     if (isPost('adm_cache_clear_smarty')) {
         admClearSmartyCache();
     }
     if (isPost('adm_reset_config_data')) {
         $this->ResetCustomConfig();
     }
     $this->Message('notice', $this->Lang_Get('adm_action_ok'));
     admHeaderLocation(Router::GetPath('admin') . 'site/reset/');
 }
 protected function EventPagesAction($sAdminAction = null)
 {
     if ($sAdminAction) {
         $oPage = $this->PluginPage_Page_GetPageById($this->_getRequestCheck('page_id'));
         if ($oPage) {
             if ($sAdminAction == 'activate' or $sAdminAction == 'deactivate') {
                 $oPage->setActive($sAdminAction == 'activate' ? 1 : 0);
                 if ($this->PluginPage_Page_UpdatePage($oPage)) {
                     $this->Message_AddNotice($this->Lang_Get('adm_action_ok'), $this->Lang_Get('attention'), true);
                 } else {
                     $this->Message_AddError($this->Lang_Get('adm_action_err'), $this->Lang_Get('error'), true);
                 }
             }
         }
     }
     Router::Location(Router::GetPath('admin') . 'pages/');
 }
 /**
  * Ajax авторизация
  */
 protected function EventAjaxLogin()
 {
     /**
      * Устанвливаем формат Ajax ответа
      */
     $this->Viewer_SetResponseAjax('json');
     /**
      * Логин и пароль являются строками?
      */
     if (!is_string(getRequest('login')) or !is_string(getRequest('password'))) {
         $this->Message_AddErrorSingle($this->Lang_Get('system_error'));
         return;
     }
     /**
      * Проверяем есть ли такой юзер по логину
      */
     if (func_check(getRequest('login'), 'mail') and $oUser = $this->User_GetUserByMail(getRequest('login')) or $oUser = $this->User_GetUserByLogin(getRequest('login'))) {
         /**
          * Сверяем хеши паролей и проверяем активен ли юзер
          */
         if ($oUser->getPassword() == func_encrypt(getRequest('password'))) {
             if (!$oUser->getActivate()) {
                 $this->Message_AddErrorSingle($this->Lang_Get('user_not_activated', array('reactivation_path' => Router::GetPath('login') . 'reactivation')));
                 return;
             }
             $bRemember = getRequest('remember', false) ? true : false;
             /**
              * Авторизуем
              */
             $this->User_Authorization($oUser, $bRemember);
             /**
              * Определяем редирект
              */
             $sUrl = Config::Get('module.user.redirect_after_login');
             if (getRequestStr('return-path')) {
                 $sUrl = getRequestStr('return-path');
             }
             $this->Viewer_AssignAjax('sUrlRedirect', $sUrl ? $sUrl : Config::Get('path.root.web'));
             return;
         }
     }
     $this->Message_AddErrorSingle($this->Lang_Get('user_login_bad'));
 }
/**
 * Плагин для смарти
 * Позволяет получать данные о роутах
 *
 * @param   array $aParams
 * @param   Smarty $oSmarty
 * @return  string
 */
function smarty_function_router($aParams, &$oSmarty)
{
    if (empty($aParams['page'])) {
        trigger_error("Router: missing 'page' parametr", E_USER_WARNING);
        return;
    }
    require_once Config::Get('path.framework.server') . '/classes/engine/Router.class.php';
    if (!($sPath = Router::GetPath($aParams['page']))) {
        trigger_error("Router: unknown 'page' given", E_USER_WARNING);
        return;
    }
    /**
     * Возвращаем полный адрес к указаному Action
     */
    $sReturn = isset($aParams['extend']) ? $sPath . $aParams['extend'] . "/" : $sPath;
    if (!empty($aParams['assign'])) {
        $oSmarty->assign($aParams['assign'], $sReturn);
    } else {
        return $sReturn;
    }
}
 /**
  * Выводит ленту контента(топики) для пользователя
  *
  */
 protected function EventIndex()
 {
     /**
      * Передан ли номер страницы
      */
     $iPage = $this->GetEventMatch(2) ? $this->GetEventMatch(2) : 1;
     $aResult = $this->Userfeed_read($this->oUserCurrent->getId(), $iPage, Config::Get('module.topic.per_page'));
     $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('feed'));
     /**
      * Загружаем переменные в шаблон
      */
     $this->Viewer_Assign('topics', $aTopics);
     $this->Viewer_Assign('paging', $aPaging);
     $this->SetTemplateAction('list');
 }
 /**
  * Список черновиков пользователя
  */
 protected function EventCreatedDrafts()
 {
     if (!$this->CheckUserProfile()) {
         return parent::EventNotFound();
     }
     if (!E::IsAdmin()) {
         return parent::EventNotFound();
     }
     $this->sMenuSubItemSelect = 'draft';
     /**
      * Передан ли номер страницы
      */
     $iPage = $this->GetParamEventMatch(2, 2) ? $this->GetParamEventMatch(2, 2) : 1;
     /**
      * Получаем список топиков
      */
     $aResult = E::ModuleTopic()->GetDraftsPersonalByUser($this->oUserProfile->getId(), $iPage, Config::Get('module.topic.per_page'));
     $aTopics = $aResult['collection'];
     /**
      * Вызов хуков
      */
     E::ModuleHook()->Run('topics_list_show', array('aTopics' => $aTopics));
     /**
      * Формируем постраничность
      */
     $aPaging = E::ModuleViewer()->MakePaging($aResult['count'], $iPage, Config::Get('module.topic.per_page'), Config::Get('pagination.pages.count'), $this->oUserProfile->getUserUrl() . 'created/draft');
     /**
      * Загружаем переменные в шаблон
      */
     E::ModuleViewer()->Assign('aPaging', $aPaging);
     E::ModuleViewer()->Assign('aTopics', $aTopics);
     E::ModuleViewer()->AddHtmlTitle(E::ModuleLang()->Get('user_menu_publication') . ' ' . $this->oUserProfile->getLogin());
     E::ModuleViewer()->AddHtmlTitle(E::ModuleLang()->Get('user_menu_publication_blog'));
     E::ModuleViewer()->SetHtmlRssAlternate(Router::GetPath('rss') . 'personal_blog/' . $this->oUserProfile->getLogin() . '/', $this->oUserProfile->getLogin());
     /**
      * Устанавливаем шаблон вывода
      */
     $this->SetTemplateAction('created_topics');
 }
 /**
  * Отписка от подписки
  */
 protected function EventUnsubscribe()
 {
     /**
      * Получаем подписку по ключу
      */
     if ($oSubscribe = $this->Subscribe_GetSubscribeByKey($this->getParam(0)) and $oSubscribe->getStatus() == 1) {
         /**
          * Отписываем пользователя
          */
         $oSubscribe->setStatus(0);
         $oSubscribe->setDateRemove(date("Y-m-d H:i:s"));
         $this->Subscribe_UpdateSubscribe($oSubscribe);
         $this->Message_AddNotice($this->Lang_Get('common.success.save'), null, true);
     }
     /**
      * Получаем URL для редиректа
      */
     if (!($sUrl = $this->Subscribe_GetUrlTarget($oSubscribe->getTargetType(), $oSubscribe->getTargetId()))) {
         $sUrl = Router::GetPath('index');
     }
     Router::Location($sUrl);
 }
 /**
  * Вывод всех черновиков
  */
 protected function EventDraft()
 {
     if (!E::IsAdmin()) {
         return parent::EventNotFound();
     }
     E::ModuleViewer()->SetHtmlRssAlternate(Router::GetPath('rss') . 'draft/', Config::Get('view.name'));
     /**
      * Меню
      */
     $this->sMenuSubItemSelect = 'draft';
     /**
      * Передан ли номер страницы
      */
     $iPage = $this->GetParamEventMatch(0, 2) ? $this->GetParamEventMatch(0, 2) : 1;
     /**
      * Получаем список топиков
      */
     $aResult = E::ModuleTopic()->GetTopicsDraftAll($iPage, Config::Get('module.topic.per_page'));
     $aTopics = $aResult['collection'];
     /**
      * Вызов хуков
      */
     E::ModuleHook()->Run('topics_list_show', array('aTopics' => $aTopics));
     /**
      * Формируем постраничность
      */
     $aPaging = E::ModuleViewer()->MakePaging($aResult['count'], $iPage, Config::Get('module.topic.per_page'), Config::Get('pagination.pages.count'), Router::GetPath('index') . 'draft');
     /**
      * Загружаем переменные в шаблон
      */
     E::ModuleViewer()->Assign('aTopics', $aTopics);
     E::ModuleViewer()->Assign('aPaging', $aPaging);
     /**
      * Устанавливаем шаблон вывода
      */
     $this->SetTemplateAction('index');
 }
Example #24
0
 /**
  * Получает список информации о всех плагинах, загруженных в plugin-директорию
  *
  * @return array
  */
 public function GetList($aFilter = array())
 {
     if ($aPaths = glob($this->sPluginsDir . '*', GLOB_ONLYDIR)) {
         $aList = array_map('basename', $aPaths);
         $aActivePlugins = $this->GetActivePlugins();
         foreach ($aList as $sPlugin) {
             $this->aPluginsList[$sPlugin] = array('code' => $sPlugin, 'is_active' => in_array($sPlugin, $aActivePlugins));
             /**
              * Считываем данные из XML файла описания
              */
             $sPluginXML = $this->sPluginsDir . $sPlugin . '/' . self::PLUGIN_XML_FILE;
             if ($oXml = @simplexml_load_file($sPluginXML)) {
                 /**
                  * Обрабатываем данные, считанные из XML-описания
                  */
                 $sLang = $this->Lang_GetLang();
                 $this->Xlang($oXml, 'name', $sLang);
                 $this->Xlang($oXml, 'author', $sLang);
                 $this->Xlang($oXml, 'description', $sLang);
                 $oXml->homepage = $this->Text_Parser((string) $oXml->homepage);
                 $oXml->settings = preg_replace('/{([^}]+)}/', Router::GetPath('$1'), $oXml->settings);
                 $this->aPluginsList[$sPlugin]['property'] = $oXml;
             } else {
                 /**
                  * Если XML-файл описания отсутствует, или не является валидным XML,
                  * удаляем плагин из списка
                  */
                 unset($this->aPluginsList[$sPlugin]);
             }
         }
     }
     /**
      * Если нужно сортировать плагины
      */
     if (isset($aFilter['order'])) {
         if ($aFilter['order'] == 'name') {
             $aPlugins = $this->aPluginsList;
             uasort($aPlugins, create_function('$a,$b', "if ((string)\$a['property']->name->data == (string)\$b['property']->name->data) { return 0; } return ((string)\$a['property']->name->data < (string)\$b['property']->name->data) ? -1 : 1;"));
             return $aPlugins;
         }
     }
     return $this->aPluginsList;
 }
Example #25
0
 public function getUrl()
 {
     if ($this->getBlog()->getType() == 'personal') {
         return Router::GetPath('blog') . $this->getId() . '.html';
     } else {
         return Router::GetPath('blog') . $this->getBlog()->getUrl() . '/' . $this->getId() . '.html';
     }
 }
Example #26
0
 /**
  * Удаление блога
  *
  * @return bool
  */
 protected function EventDeleteBlog()
 {
     $this->Security_ValidateSendForm();
     /**
      * Проверяем передан ли в УРЛе номер блога
      */
     $sBlogId = $this->GetParam(0);
     if (!($oBlog = $this->Blog_GetBlogById($sBlogId))) {
         return parent::EventNotFound();
     }
     /**
      * Проверям авторизован ли пользователь
      */
     if (!$this->User_IsAuthorization()) {
         $this->Message_AddErrorSingle($this->Lang_Get('not_access'), $this->Lang_Get('error'));
         return Router::Action('error');
     }
     /**
      * проверяем есть ли право на удаление топика
      */
     if (!($bAccess = $this->ACL_IsAllowDeleteBlog($oBlog, $this->oUserCurrent))) {
         return parent::EventNotFound();
     }
     $aTopics = $this->Topic_GetTopicsByBlogId($sBlogId);
     switch ($bAccess) {
         case ModuleACL::CAN_DELETE_BLOG_EMPTY_ONLY:
             if (is_array($aTopics) and count($aTopics)) {
                 $this->Message_AddErrorSingle($this->Lang_Get('blog_admin_delete_not_empty'), $this->Lang_Get('error'), true);
                 Router::Location($oBlog()->getUrlFull());
             }
             break;
         case ModuleACL::CAN_DELETE_BLOG_WITH_TOPICS:
             /**
              * Если указан идентификатор блога для перемещения,
              * то делаем попытку переместить топики.
              * 
              * (-1) - выбран пункт меню "удалить топики".
              */
             if ($sBlogIdNew = getRequest('topic_move_to') and $sBlogIdNew != -1 and is_array($aTopics) and count($aTopics)) {
                 if (!($oBlogNew = $this->Blog_GetBlogById($sBlogIdNew))) {
                     $this->Message_AddErrorSingle($this->Lang_Get('blog_admin_delete_move_error'), $this->Lang_Get('error'), true);
                     Router::Location($oBlog()->getUrlFull());
                 }
                 /**
                  * Если выбранный блог является персональным, возвращаем ошибку
                  */
                 if ($oBlogNew->getType() == 'personal') {
                     $this->Message_AddErrorSingle($this->Lang_Get('blog_admin_delete_move_personal'), $this->Lang_Get('error'), true);
                     Router::Location($oBlog()->getUrlFull());
                 }
                 /**
                  * Перемещаем топики
                  */
                 $this->Topic_MoveTopics($sBlogId, $sBlogIdNew);
             }
             break;
         default:
             return parent::EventNotFound();
     }
     /**
      * Удаляяем блог и перенаправляем пользователя к списку блогов
      */
     $this->Hook_Run('blog_delete_before', array('sBlogId' => $sBlogId));
     if ($this->Blog_DeleteBlog($sBlogId)) {
         $this->Hook_Run('blog_delete_after', array('sBlogId' => $sBlogId));
         $this->Message_AddNoticeSingle($this->Lang_Get('blog_admin_delete_success'), $this->Lang_Get('attention'), true);
         Router::Location(Router::GetPath('blogs'));
     } else {
         Router::Location($oBlog()->getUrlFull());
     }
 }
 public function getUrlFull()
 {
     return Router::GetPath('forum') . 'topic/' . $this->getId() . '/';
 }
Example #28
0
 /**
  * Выполняет загрузку необходимый(возможно даже системный :)) переменных в шалон
  *
  */
 public function VarAssign()
 {
     /**
      * Загружаем весь $_REQUEST, предварительно обработав его функцией func_htmlspecialchars()
      */
     $aRequest = $_REQUEST;
     func_htmlspecialchars($aRequest);
     $this->Assign("_aRequest", $aRequest);
     /**
      * Параметры стандартной сессии
      */
     $this->Assign("_sPhpSessionName", session_name());
     $this->Assign("_sPhpSessionId", session_id());
     /** 
      * Short Engine aliases
      */
     $this->Assign("LS", LS::getInstance());
     /** 
      * Загружаем объект доступа к конфигурации 
      */
     $this->Assign("oConfig", Config::getInstance());
     /**
      * Загружаем роутинг с учетом правил rewrite
      */
     $aRouter = array();
     $aPages = Config::Get('router.page');
     if (!$aPages or !is_array($aPages)) {
         throw new Exception('Router rules is underfined.');
     }
     foreach ($aPages as $sPage => $aAction) {
         $aRouter[$sPage] = Router::GetPath($sPage);
     }
     $this->Assign("aRouter", $aRouter);
     /**
      * Загружаем в шаблон блоки
      */
     $this->Assign("aBlocks", $this->aBlocks);
     /**
      * Загружаем HTML заголовки
      */
     $this->Assign("sHtmlTitle", htmlspecialchars($this->sHtmlTitle));
     $this->Assign("sHtmlKeywords", htmlspecialchars($this->sHtmlKeywords));
     $this->Assign("sHtmlDescription", htmlspecialchars($this->sHtmlDescription));
     $this->Assign("aHtmlHeadFiles", $this->aHtmlHeadFiles);
     $this->Assign("aHtmlRssAlternate", $this->aHtmlRssAlternate);
     /**
      * Загружаем список активных плагинов
      */
     $aPlugins = $this->oEngine->GetPlugins();
     $this->Assign("aPluginActive", array_fill_keys(array_keys($aPlugins), true));
     /**
      * Загружаем пути до шаблонов плагинов
      */
     $aTemplateWebPathPlugin = array();
     $aTemplatePathPlugin = array();
     foreach ($aPlugins as $k => $oPlugin) {
         $aTemplateWebPathPlugin[$k] = Plugin::GetTemplateWebPath(get_class($oPlugin));
         $aTemplatePathPlugin[$k] = Plugin::GetTemplatePath(get_class($oPlugin));
     }
     $this->Assign("aTemplateWebPathPlugin", $aTemplateWebPathPlugin);
     $this->Assign("aTemplatePathPlugin", $aTemplatePathPlugin);
 }
 /**
  * Обработка напоминания пароля
  *
  */
 protected function EventReminder()
 {
     $this->Viewer_AddHtmlTitle($this->Lang_Get('password_reminder'));
     if ($this->GetParam(0) == 'send') {
         $this->SetTemplateAction('reminder_send');
         return;
     }
     /**
      * Проверка кода на восстановление пароля и генерация нового пароля
      */
     if (func_check($this->GetParam(0), 'md5')) {
         if ($oReminder = $this->User_GetReminderByCode($this->GetParam(0))) {
             if (!$oReminder->getIsUsed() and strtotime($oReminder->getDateExpire()) > time() and $oUser = $this->User_GetUserById($oReminder->getUserId())) {
                 $sNewPassword = func_generator(7);
                 $oUser->setPassword(func_encrypt($sNewPassword));
                 if ($this->User_Update($oUser)) {
                     $oReminder->setDateUsed(date("Y-m-d H:i:s"));
                     $oReminder->setIsUsed(1);
                     $this->User_UpdateReminder($oReminder);
                     $this->Notify_SendReminderPassword($oUser, $sNewPassword);
                     $this->SetTemplateAction('reminder_confirm');
                     return;
                 }
             }
         }
         $this->Message_AddErrorSingle($this->Lang_Get('password_reminder_bad_code'), $this->Lang_Get('error'));
         return Router::Action('error');
     }
     /**
      * Обрабатываем запрос на смену пароля
      */
     if (isPost('submit_reminder')) {
         if (func_check(getRequest('mail'), 'mail') and $oUser = $this->User_GetUserByMail(getRequest('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->Notify_SendReminderCode($oUser, $oReminder);
                 Router::Location(Router::GetPath('login') . 'reminder/send/');
             }
         } else {
             $this->Message_AddError($this->Lang_Get('password_reminder_bad_email'), $this->Lang_Get('error'));
         }
     }
 }
Example #30
0
    $config['data']['user'] = array('list' => array('userbar' => array('text' => array('user_name' => array(), 'count_messages' => array($sTemplate = '<span class="badge badge-danger badge-mail-counter">+{{count_messages}}</span>'), '&nbsp;<span class="caret"></span>'), 'options' => array('class' => 'dropdown', 'link_class' => 'dropdown-toggle user-button', 'image_url' => array('user_avatar_url' => array('32x32crop')), 'image_title' => array('user_name'), 'image_class' => 'user', 'link_data' => array('toggle' => 'dropdown', 'role' => 'button', 'target' => '#'), 'data' => array('hidden-class' => 'btn'))), 'talk' => FALSE));
    /**
     *  Меню пользователя + experience
     */
    $config['data']['toolbar_user'] = array('init' => array('fill' => array('list' => array('*'))), 'description' => '{{menu_user_description}}', 'list' => array('userbar' => array('text' => array('user_name' => array(), 'count_messages' => array('<span class="badge badge-danger badge-mail-counter">+{{count_messages}}</span>')), 'link' => E::User()->getProfileUrl(), 'options' => array('image_url' => array('user_avatar_url' => array('32x32crop'))))));
    /**
     *  Подменю пользователя + experience
     */
    $config['data']['toolbar_userbar'] = array('init' => array('fill' => array('list' => array('*'))), 'description' => '{{menu_toolbar_userbar_description}}', 'class' => 'dropdown-menu dropdown-user-menu animated fadeIn', 'list' => array('user' => array('text' => '<span><i class="fa fa-user"></i></span><span>{{user_menu_profile}}</span>', 'link' => E::User()->getProfileUrl(), 'options' => array('class' => 'fixed-item')), 'favourites' => array('text' => '<span><i class="fa fa-star"></i></span><span>{{user_menu_profile_favourites}}</span>', 'link' => E::User()->getProfileUrl() . 'favourites/topics/', 'options' => array('class' => 'fixed-item')), 'talk' => array('text' => array('<span><i class="fa fa-envelope"></i></span><span>{{user_privat_messages}}</span>', '&nbsp;<span class="new-messages">', 'new_talk_string' => array(), '</span>'), 'link' => Router::GetPath('talk'), 'options' => array('link_id' => 'new_messages', 'class' => 'fixed-item')), 'settings' => array('text' => '<span><i class="fa fa-cog"></i></span><span>{{user_settings}}</span>', 'link' => '___path.root.url___/settings/', 'options' => array('class' => 'fixed-item')), 'toolbar_userbar_item' => '', 'logout' => array('text' => '<span><i class="fa fa-sign-out"></i></span><span>{{exit}}</span>', 'link' => Router::GetPath('login') . 'exit/?security_key=' . E::Security_GetSecurityKey(), 'options' => array('class' => 'fixed-item'))));
    /**
     *  Подменю пользователя + experience
     */
    $config['data']['userbar'] = array('class' => 'dropdown-menu dropdown-user-menu animated fadeIn', 'list' => array('pre' => array('text' => FALSE, 'link' => FALSE, 'options' => array('class' => 'user_activity_items'), 'submenu' => 'userinfo'), 'user' => array('text' => '<i class="fa fa-user"></i>&nbsp;{{user_menu_profile}}', 'link' => E::User()->getProfileUrl()), 'create' => array('text' => '<i class="fa fa-pencil"></i>&nbsp;{{block_create}}', 'link' => '#', 'options' => array('data' => array('toggle' => 'modal', 'target' => '#modal-write'))), 'talk' => array('text' => array('<i class="fa fa-envelope-o"></i>&nbsp;{{user_privat_messages}}', '&nbsp;<span class="new-messages">', 'new_talk_string' => array(), '</span>'), 'link' => Router::GetPath('talk'), 'options' => array('link_id' => 'new_messages')), 'wall' => array('text' => '<i class="fa fa-bars"></i>&nbsp;{{user_menu_profile_wall}}', 'link' => E::User()->getProfileUrl() . 'wall/'), 'publication' => array('text' => '<i class="fa fa-file-o"></i>&nbsp;{{user_menu_publication}}', 'link' => E::User()->getProfileUrl() . 'created/topics/'), 'favourites' => array('text' => '<i class="fa fa-star-o"></i>&nbsp;{{user_menu_profile_favourites}}', 'link' => E::User()->getProfileUrl() . 'favourites/topics/'), 'settings' => array('text' => '<i class="fa fa-cogs"></i>&nbsp;{{user_settings}}', 'link' => '___path.root.url___/settings/'), 'userbar_item' => '', 'logout' => array('text' => '<i class="fa fa-sign-out"></i>&nbsp;{{exit}}', 'link' => Router::GetPath('login') . 'exit/?security_key=' . E::Security_GetSecurityKey())));
}
if (E::IsUser()) {
    $config['data']['userinfo'] = array('init' => array('fill' => array('list' => array('*'))), 'description' => 'Индикаторы пользователя', 'list' => array('user_rating' => array('text' => array('user_rating' => array('<i class="fa fa-bar-chart-o"></i>', 'negative')), 'link' => E::User()->getProfileUrl(), 'options' => array('class' => 'menu-item-user-rating')), 'user_comments' => array('text' => array('count_track' => array('<i class="fa fa-bullhorn"></i>')), 'link' => Router::GetPath('feed') . 'track/', 'options' => array('class' => 'menu-item-user-comments')), 'user_mails' => array('text' => array('new_talk_string' => array('<i class="fa fa-envelope-o"></i>')), 'link' => Router::GetPath('talk'), 'options' => array('class' => 'menu-item-user-talks'))));
}
/**
 *  Меню топиков
 */
C::Set('menu.data.topics.discussed.text', array('{{blog_menu_all_discussed}}', '&nbsp;<i class="caret"></i>'));
$config['data']['topics'] = array('class' => 'menu-topics', 'list' => array('good' => array('active' => array('topic_kind' => array('good')), 'options' => array('class' => 'menu-topics-good')), 'new' => array('text' => array('{{blog_menu_all_new}}', 'new_topics_count' => array('red')), 'options' => array('class' => 'menu-topics-new', 'link_title' => '{{blog_menu_top_period_24h}}')), 'newall' => array('options' => array('class' => 'menu-topics-all', 'link_title' => '{{blog_menu_top_period_24h}}')), 'feed' => array('options' => array('class' => 'menu-topics-feed role-guest-hide')), 'discussed' => array('text' => array('{{blog_menu_all_discussed}}', '&nbsp;<i class="caret"></i>'), 'submenu' => 'discussed', 'options' => array('class' => 'dropdown menu-topics-discussed', 'link_data' => array('toggle' => 'dropdown')))));
if (C::Get('rating.enabled')) {
    $config['data']['topics']['list']['top'] = array('text' => array('{{blog_menu_all_top}}', '&nbsp;<i class="caret"></i>'), 'submenu' => 'top', 'options' => array('class' => 'dropdown menu-topics-top', 'link_data' => array('toggle' => 'dropdown')));
}
/**
 *  Подменю обсуждаемых
 */
$config['data']['discussed'] = array('class' => 'dropdown-menu  dropdown-content-menu animated fadeIn');
if (C::Get('rating.enabled')) {
    /**