예제 #1
0
 /**
  * Список опубликованых топиков в открытых блогах (с кешированием)
  *
  * @param int $iPage
  *
  * @return array
  */
 public function getTopicsForSitemap($iPage = 0)
 {
     $sCacheKey = "sitemap_topics_{$iPage}_" . C::Get('plugin.sitemap.items_per_page');
     if (false === ($aData = E::ModuleCache()->Get($sCacheKey))) {
         $aFilter = $this->GetNamedFilter('sitemap');
         $aTopics = E::ModuleTopic()->GetTopicsByFilter($aFilter, $iPage, C::Get('plugin.sitemap.items_per_page'), array('blog' => array('owner' => array())));
         $aData = array();
         $iIndex = 0;
         $aPriority = F::Array_Str2Array(C::Get('plugin.sitemap.type.topics.priority'));
         $nPriority = sizeof($aPriority) ? reset($aPriority) : null;
         $aChangeFreq = F::Array_Str2Array(C::Get('plugin.sitemap.type.topics.changefreq'));
         $sChangeFreq = sizeof($aChangeFreq) ? reset($aChangeFreq) : null;
         /** @var ModuleTopic_EntityTopic $oTopic */
         foreach ($aTopics['collection'] as $oTopic) {
             if ($aPriority) {
                 if (isset($aPriority[$iIndex])) {
                     $nPriority = $aPriority[$iIndex];
                 }
             }
             if ($aChangeFreq) {
                 if (isset($aChangeFreq[$iIndex])) {
                     $sChangeFreq = $aChangeFreq[$iIndex];
                 }
             }
             $aData[] = E::ModuleSitemap()->GetDataForSitemapRow($oTopic->getLink(), $oTopic->getDateLastMod(), $sChangeFreq, $nPriority);
             $iIndex += 1;
         }
         // тег 'blog_update' т.к. при редактировании блога его тип может измениться
         // с открытого на закрытый или наоборот
         E::ModuleCache()->Set($aData, $sCacheKey, array('topic_new', 'topic_update', 'blog_update'), C::Get('plugin.sitemap.type.topics.cache_lifetime'));
     }
     return $aData;
 }
예제 #2
0
 /**
  * Регистрация евентов
  */
 protected function RegisterEvent()
 {
     if (C::Get('rating.enabled')) {
         $this->AddEventPreg('/^vote$/i', '/^comment$/', 'EventVoteComment');
         $this->AddEventPreg('/^vote$/i', '/^topic$/', 'EventVoteTopic');
         $this->AddEventPreg('/^vote$/i', '/^blog$/', 'EventVoteBlog');
         $this->AddEventPreg('/^vote$/i', '/^user$/', 'EventVoteUser');
     }
     $this->AddEventPreg('/^vote$/i', '/^poll$/', 'EventVotePoll');
     $this->AddEventPreg('/^vote$/i', '/^question$/', 'EventVoteQuestion');
     $this->AddEventPreg('/^favourite$/i', '/^save-tags/', 'EventFavouriteSaveTags');
     $this->AddEventPreg('/^favourite$/i', '/^topic$/', 'EventFavouriteTopic');
     $this->AddEventPreg('/^favourite$/i', '/^comment$/', 'EventFavouriteComment');
     $this->AddEventPreg('/^favourite$/i', '/^talk$/', 'EventFavouriteTalk');
     $this->AddEventPreg('/^stream$/i', '/^comment$/', 'EventStreamComment');
     $this->AddEventPreg('/^stream$/i', '/^topic$/', 'EventStreamTopic');
     $this->AddEventPreg('/^stream$/i', '/^wall/', 'EventStreamWall');
     $this->AddEventPreg('/^blogs$/i', '/^top$/', 'EventBlogsTop');
     $this->AddEventPreg('/^blogs$/i', '/^self$/', 'EventBlogsSelf');
     $this->AddEventPreg('/^blogs$/i', '/^join$/', 'EventBlogsJoin');
     $this->AddEventPreg('/^preview$/i', '/^text$/', 'EventPreviewText');
     $this->AddEventPreg('/^preview$/i', '/^topic/', 'EventPreviewTopic');
     $this->AddEventPreg('/^upload$/i', '/^image$/', 'EventUploadImage');
     $this->AddEventPreg('/^autocompleter$/i', '/^tag$/', 'EventAutocompleterTag');
     $this->AddEventPreg('/^autocompleter$/i', '/^user$/', 'EventAutocompleterUser');
     $this->AddEventPreg('/^comment$/i', '/^delete$/', 'EventCommentDelete');
     $this->AddEventPreg('/^geo/i', '/^get/', '/^regions$/', 'EventGeoGetRegions');
     $this->AddEventPreg('/^geo/i', '/^get/', '/^cities/', 'EventGeoGetCities');
     $this->AddEventPreg('/^infobox/i', '/^info/', '/^blog/', 'EventInfoboxInfoBlog');
     $this->AddEvent('fetch', 'EventFetch');
     // Менеджер изображений
     $this->AddEvent('image-manager-load-tree', 'EventImageManagerLoadTree');
     $this->AddEvent('image-manager-load-images', 'EventImageManagerLoadImages');
 }
예제 #3
0
 /**
  * @param string $sType
  * @param bool   $bClear
  *
  * @throws Exception
  */
 public function loadConfig($sType = 'default', $bClear = true)
 {
     if ($bClear) {
         $this->tagsRules = array();
     }
     $aConfig = C::Get('qevix.' . $sType);
     if (is_array($aConfig)) {
         foreach ($aConfig as $sMethod => $aExec) {
             if ($sMethod == 'cfgSetAutoReplace') {
                 $this->aAutoReplace = $aExec;
                 continue;
             }
             foreach ($aExec as $aParams) {
                 call_user_func_array(array($this, $sMethod), $aParams);
             }
         }
         // * Хардкодим некоторые параметры
         unset($this->entities1['&']);
         // разрешаем в параметрах символ &
         if (C::Get('view.noindex') && isset($this->tagsRules['a'])) {
             $this->cfgSetTagParamDefault('a', 'rel', 'nofollow', true);
         }
     }
     if (C::Get('module.text.char.@')) {
         $this->cfgSetSpecialCharCallback('@', array(E::ModuleText(), 'CallbackTagAt'));
     }
     if ($aData = C::Get('module.text.autoreplace')) {
         $this->aAutoReplace = array(array_keys($aData), array_values($aData));
     }
 }
예제 #4
0
 /**
  * Регистрация событий на хуки
  */
 public function RegisterHook()
 {
     // Выводим интерфейс работы с рейтингом только если он включён
     if (C::Get('rating.enabled')) {
         if (C::Get('plugin.simplerating.user.vote')) {
             $this->AddHook('template_profile_header', 'HookProfileRatingInject');
             $this->AddHook('template_user_list_header', 'HookUserListHeaderInject');
             $this->AddHook('template_user_list_line', 'HookUserListLineInject');
             $this->AddHook('template_user_list_linexxs', 'HookUserListLineXssInject');
         }
         if (C::Get('plugin.simplerating.blog.vote')) {
             $this->AddHook('template_blog_infobox', 'HookBlogInfoboxRatingValueInject');
             $this->AddHook('template_blog_list_header', 'HookBlogListHeaderInject');
             $this->AddHook('template_blog_list_line', 'HookBlogListLineInject');
             $this->AddHook('template_blog_list_linexxs', 'HookBlogListLineXssInject');
             $this->AddHook('template_blog_header', 'HookBlogHeaderInject');
             $this->AddHook('template_blog_stat', 'HookBlogStatInject');
         }
         if (C::Get('plugin.simplerating.comment.vote')) {
             $this->AddHook('template_comment_list_info', 'HookCommentListInfoInject');
             $this->AddHook('template_comment_info', 'HookCommentInfoInject');
         }
         if (C::Get('plugin.simplerating.topic.vote')) {
             $this->AddHook('template_topic_show_info', 'HookTopicShowInfoInject');
         }
     }
 }
예제 #5
0
 /**
  * @param string $sType
  * @param bool   $bClear
  *
  * @throws Exception
  */
 public function loadConfig($sType = 'default', $bClear = true)
 {
     if ($bClear) {
         $this->tagsRules = array();
     }
     $aConfig = C::Get('jevix.' . $sType);
     if (is_array($aConfig)) {
         foreach ($aConfig as $sMethod => $aExec) {
             foreach ($aExec as $aParams) {
                 if (in_array(strtolower($sMethod), array_map('strtolower', array('cfgSetTagCallbackFull', 'cfgSetTagCallback')))) {
                     if (isset($aParams[1][0]) && $aParams[1][0] == '_this_') {
                         $aParams[1][0] = E::ModuleText();
                     }
                 }
                 call_user_func_array(array($this, $sMethod), $aParams);
             }
         }
         // * Хардкодим некоторые параметры
         unset($this->entities1['&']);
         // разрешаем в параметрах символ &
         if (C::Get('view.noindex') && isset($this->tagsRules['a'])) {
             $this->cfgSetTagParamDefault('a', 'rel', 'nofollow', true);
         }
     }
 }
예제 #6
0
 /**
  * Обрабатывает поля конфига и возвращает данные для компиляции
  *
  * @param $aFields
  * @param $bSave
  * @return array
  */
 private function _processConfig($aFields, $bSave)
 {
     if ($bSave) {
         // Сохраняемые данные
         $aData = array();
         // Компилируемые данные
         $aCompiledData = array();
         foreach ($aFields as $sFieldConfig => $aFieldDefault) {
             $sFieldName = str_replace('.', '_', $sFieldConfig);
             $aData["plugin.estheme.{$sFieldConfig}"] = getRequest($sFieldName, $aFieldDefault[0]);
             $_REQUEST[$sFieldName] = $aData["plugin.estheme.{$sFieldConfig}"];
             if (isset($aFieldDefault[2])) {
                 // Если нужно, то используем форматированиеперед вставкой стилевого значения less
                 $aCompiledData[$aFieldDefault[1]] = str_replace('{{value}}', $aData["plugin.estheme.{$sFieldConfig}"], $aFieldDefault[2]);
             } else {
                 $aCompiledData[$aFieldDefault[1]] = $aData["plugin.estheme.{$sFieldConfig}"];
             }
         }
         Config::WriteCustomConfig($aData);
         return $aCompiledData;
     } else {
         foreach ($aFields as $sFieldConfig => $aFieldDefault) {
             $sFieldName = str_replace('.', '_', $sFieldConfig);
             $_REQUEST[$sFieldName] = C::Get("plugin.estheme.{$sFieldConfig}");
         }
         return array();
     }
 }
 public function setRating($nRating)
 {
     parent::setRating($nRating);
     if ((double) $nRating >= C::Get('plugin.sandbox.topic_rating_out')) {
         $this->setTopicStatus(0);
     }
 }
예제 #8
0
 public static function Init($sFuncStats)
 {
     if (!self::IsAvailable()) {
         return false;
     }
     $oCache = new Zend_Cache_Backend_File(array('cache_dir' => C::Get('sys.cache.dir'), 'file_name_prefix' => E::ModuleCache()->GetCachePrefix(), 'read_control_type' => 'crc32', 'hashed_directory_level' => C::Get('sys.cache.directory_level'), 'read_control' => true, 'file_locking' => true));
     return new self($oCache, $sFuncStats);
 }
예제 #9
0
 /**
  * Инициализация модуля
  *
  */
 public function Init()
 {
     $sCharset = C::Get('db.params.charset');
     if (!$sCharset) {
         $sCharset = 'utf8';
     }
     $this->aInitSql = str_replace('%%charset%%', $sCharset, $this->aInitSql);
 }
예제 #10
0
 /**
  * Деактивация плагина
  * @return bool
  */
 public function Deactivate()
 {
     $aMenuList = C::Get('menu.data.user.list');
     unset($aMenuList['plugin_menutest_my_menu']);
     C::WriteCustomConfig(array('menu.data.user.list' => $aMenuList));
     C::ResetCustomConfig('menu.data.user.list.plugin_menutest_my_menu');
     return TRUE;
 }
예제 #11
0
 /**
  * Create a typographer and load its configuration
  */
 protected function _createTextParser()
 {
     $sParser = C::Get('module.text.parser');
     $sClassName = 'TextParser' . $sParser;
     $sFileName = './parser/' . $sClassName . '.class.php';
     F::IncludeFile($sFileName);
     $this->oTextParser = new $sClassName();
 }
예제 #12
0
 public static function Init($sFuncStats)
 {
     if (!self::IsAvailable()) {
         return false;
     }
     $aConfigMem = C::Get('memcache');
     $oCache = new Dklab_Cache_Backend_MemcachedMultiload($aConfigMem);
     return new self(new Dklab_Cache_Backend_Profiler($oCache, $sFuncStats));
 }
예제 #13
0
 /**
  * Инициализация модуля
  *
  */
 public function Init()
 {
     $sCharset = C::Get('db.params.charset');
     if (!$sCharset) {
         $sCharset = 'utf8';
     }
     $this->aInitSql = str_replace('%%charset%%', $sCharset, $this->aInitSql);
     $this->sLogFile = Config::Get('sys.logs.sql_query_file');
 }
예제 #14
0
 /**
  * Регистрация евентов
  *
  */
 protected function RegisterEvent()
 {
     $this->AddEventPreg('/^(page([1-9]\\d{0,5}))?$/i', 'EventIndex');
     $this->AddEventPreg('/^new$/i', '/^(page([1-9]\\d{0,5}))?$/i', 'EventNew');
     $this->AddEventPreg('/^newall$/i', '/^(page([1-9]\\d{0,5}))?$/i', 'EventNewAll');
     $this->AddEventPreg('/^discussed/i', '/^(page([1-9]\\d{0,5}))?$/i', 'EventDiscussed');
     if (C::Get('rating.enabled')) {
         $this->AddEventPreg('/^top/i', '/^(page([1-9]\\d{0,5}))?$/i', 'EventTop');
     }
 }
예제 #15
0
 public function ClearUrl($sUrl)
 {
     $sUrl = trim(filter_var($sUrl, FILTER_SANITIZE_URL), '/');
     if (C::Get('plugin.seopack.url.skip_scheme')) {
         if (preg_match('/^https?:(.*)$/i', $sUrl, $aMatches)) {
             $sUrl = $aMatches[1];
         }
     }
     return $sUrl;
 }
 /**
  * Получить ID комментариев, сгрупированных по типу (для вывода прямого эфира)
  *
  * @param string $sTargetType        Тип владельца комментария
  * @param array  $aExcludeTargets    Список ID владельцев для исключения
  * @param int    $iLimit             Количество элементов
  *
  * @return int[]
  */
 public function GetCommentsIdOnline($sTargetType, $aExcludeTargets, $iLimit)
 {
     if (C::Get('plugin.sandbox.widget_stream_split') && ($sTargetType == 'topic' || $sTargetType == 'sandbox')) {
         $sql = "SELECT\n\t\t\t\t\tcomment_id\n\t\t\t\tFROM\n\t\t\t\t\t?_comment_online AS c\n\t\t\t\t\tINNER JOIN ?_topic AS t ON t.topic_id = c.target_id\n\t\t\t\tWHERE\n\t\t\t\t\tc.target_type = 'topic'\n\t\t\t\t\t{ AND t.topic_status != ?d }\n\t\t\t\t\t{ AND t.topic_status = ?d }\n\t\t\t\t    { AND target_parent_id NOT IN(?a) }\n\t\t\t\tORDER by comment_online_id DESC\n\t\t\t\tLIMIT 0, ?d ;";
         $aCommentsId = $this->oDb->selectCol($sql, $sTargetType == 'topic' ? TOPIC_STATUS_SANDBOX : DBSIMPLE_SKIP, $sTargetType == 'sandbox' ? TOPIC_STATUS_SANDBOX : DBSIMPLE_SKIP, !empty($aExcludeTargets) ? $aExcludeTargets : DBSIMPLE_SKIP, $iLimit);
     } else {
         $sql = "SELECT\n\t\t\t\t\tcomment_id\n\t\t\t\tFROM\n\t\t\t\t\t?_comment_online\n\t\t\t\tWHERE\n\t\t\t\t\ttarget_type = ?\n\t\t\t\t{ AND target_parent_id NOT IN(?a) }\n\t\t\t\tORDER by comment_online_id DESC\n\t\t\t\tLIMIT 0, ?d ;";
         $aCommentsId = $this->oDb->selectCol($sql, $sTargetType, !empty($aExcludeTargets) ? $aExcludeTargets : DBSIMPLE_SKIP, $iLimit);
     }
     return $aCommentsId ? $aCommentsId : array();
 }
예제 #17
0
 /**
  * @param string $sType
  * @param bool   $bClear
  *
  * @return ITextParser
  */
 public static function newTextParser($sType = 'default', $bClear = true)
 {
     $sParser = C::Get('module.text.parser');
     $sClassName = 'TextParser' . $sParser;
     $sFileName = './parser/' . $sClassName . '.class.php';
     F::IncludeFile($sFileName);
     /** @var ITextParser $oTextParser */
     $oTextParser = new $sClassName();
     $oTextParser->loadConfig($sType, $bClear);
     return $oTextParser;
 }
예제 #18
0
 /**
  * Поиск текста по топикам
  *
  * @param string $sRegExp
  * @param int    $iCount
  * @param int    $iCurrPage
  * @param int    $iPerPage
  * @param array  $aParams
  *
  * @return array
  */
 public function GetTopicsIdByRegexp($sRegExp, &$iCount, $iCurrPage, $iPerPage, $aParams)
 {
     $aData = $this->PrepareRegExp($sRegExp);
     $aWeight = array();
     // Обработка возможного фильтра. Пока параметр один - это разрешённые блоги для пользователя
     // но на будущее условия разделены
     if (isset($aParams['aFilter']) && is_array($aParams['aFilter']) && !empty($aParams['aFilter'])) {
         // Если определён список типов/ид. разрешённых блогов
         if (isset($aParams['aFilter']['blog_type']) && is_array($aParams['aFilter']['blog_type']) && !empty($aParams['aFilter']['blog_type'])) {
             $sWhere = '';
             $aBlogTypes = array();
             $aOrClauses = array();
             $aParams['aFilter']['blog_type'] = F::Array_FlipIntKeys($aParams['aFilter']['blog_type'], 0);
             foreach ($aParams['aFilter']['blog_type'] as $sType => $aBlogsId) {
                 if ($aBlogsId) {
                     if ($sType == '*') {
                         $aOrClauses[] = "(t.blog_id IN ('" . join("','", $aBlogsId) . "'))";
                     } else {
                         $aOrClauses[] = "b.blog_type='" . $sType . "' AND t.blog_id IN ('" . join("','", $aBlogsId) . "')";
                     }
                 } else {
                     $aBlogTypes[] = "'" . $sType . "'";
                 }
             }
             if ($aBlogTypes) {
                 $aOrClauses[] = '(b.blog_type IN (' . join(',', $aBlogTypes) . '))';
             }
             if ($aOrClauses) {
                 $sWhere .= ' AND (' . join(' OR ', $aOrClauses) . ')';
             }
         }
     }
     $aWeight[] = "(LOWER(t.topic_title) REGEXP " . $this->oDb->escape($aData['regexp']['phrase']) . ")*" . $aData['rates']['phrase'] * $aData['rates']['title'];
     $aWeight[] = "(LOWER(tc.topic_text_source) REGEXP " . $this->oDb->escape($aData['regexp']['phrase']) . ")*" . $aData['rates']['phrase'];
     foreach ($aData['words'] as $sWord) {
         $aWeight[] = "(LOWER(t.topic_title) REGEXP " . $this->oDb->escape($sWord) . ")*" . $aData['rates']['words'] * $aData['rates']['title'];
         $aWeight[] = "(LOWER(tc.topic_text_source) REGEXP " . $this->oDb->escape($sWord) . ")*" . $aData['rates']['words'];
     }
     $sWeight = implode('+', $aWeight);
     $aResult = array();
     $sql = "\n                SELECT t.topic_id,\n                    {$sWeight} AS weight\n                FROM ?_topic AS t\n                    INNER JOIN ?_topic_content AS tc ON tc.topic_id=t.topic_id\n                    " . (C::Get('module.search.accessible') ? 'INNER JOIN ?_blog AS b ON b.blog_id=t.blog_id' : '') . "\n                WHERE \n                    (topic_publish=1)\n                    " . $sWhere . "\n                     AND topic_index_ignore=0\n                     AND (\n                        (LOWER(t.topic_title) REGEXP ?)\n                        OR (LOWER(tc.topic_text_source) REGEXP ?)\n                     )\n                ORDER BY\n                    weight DESC,\n                    t.topic_id ASC\n                LIMIT ?d, ?d\n            ";
     $aRows = $this->oDb->selectPage($iCount, $sql, $aData['regexp']['words'], $aData['regexp']['words'], ($iCurrPage - 1) * $iPerPage, $iPerPage);
     if ($aRows) {
         foreach ($aRows as $aRow) {
             $aResult[] = $aRow['topic_id'];
         }
     }
     return $aResult;
 }
예제 #19
0
 /**
  * Компилирует тему
  *
  * @param array $aParams Передаваемые параметры
  * @return bool
  */
 public function CompileTheme($aParams, $bDownload = FALSE)
 {
     if (!E::User()) {
         return FALSE;
     }
     $sCompiledStyle = E::ModuleLess()->CompileFile(array(C::Get('path.skins.dir') . 'experience-simple/themes/custom/less/theme.less' => C::Get('path.root.web')), __DIR__ . '/../../../cache/', C::Get('path.skins.dir') . 'experience-simple/themes/custom/css/theme.custom.css.map', $aParams, $bDownload);
     if ($sCompiledStyle) {
         if (!$bDownload || E::IsAdmin()) {
             F::File_PutContents(C::Get('path.skins.dir') . 'experience-simple/themes/custom/css/theme.custom.css', $sCompiledStyle);
         } else {
             $sPath = C::Get('plugin.estheme.path_for_download') . E::UserId() . '/theme.custom.css';
             F::File_PutContents($sPath, $sCompiledStyle);
         }
     }
 }
예제 #20
0
 /**
  * Запуск обработки
  */
 public function Exec()
 {
     $iLimit = C::Get('block.stream.row');
     if (empty($iLimit)) {
         $iLimit = C::Get('widgets.stream.params.limit');
     }
     if (empty($iLimit)) {
         $iLimit = 20;
     }
     // * Получаем комментарии
     if ($aComments = $this->Comment_GetCommentsOnline('topic', $iLimit)) {
         $aVars = array('aComments' => $aComments);
         // * Формируем результат в виде шаблона и возвращаем
         $sTextResult = $this->Fetch('stream_comment.tpl', $aVars);
         $this->Viewer_Assign('sStreamComments', $sTextResult);
     }
 }
예제 #21
0
 /**
  * Список коллективных блогов (с кешированием)
  *
  * @param integer $iPage
  *
  * @return array
  */
 public function GetBlogsForSitemap($iPage = 1)
 {
     $sCacheKey = "sitemap_blogs_{$iPage}_" . C::Get('plugin.sitemap.items_per_page');
     if (false === ($aData = E::ModuleCache()->Get($sCacheKey))) {
         $aFilter = array('include_type' => $this->GetOpenBlogTypes());
         $aBlogs = E::ModuleBlog()->GetBlogsByFilter($aFilter, $iPage, C::Get('plugin.sitemap.items_per_page'), array('owner' => array()));
         $aData = array();
         /** @var ModuleBlog_EntityBlog $oBlog */
         foreach ($aBlogs['collection'] as $oBlog) {
             // TODO временем последнего изменения блога должно быть время его обновления (публикация последнего топика),
             $aData[] = E::ModuleSitemap()->GetDataForSitemapRow($oBlog->getLink(), null, C::Get('plugin.sitemap.type.blogs.changefreq'), C::Get('plugin.sitemap.type.blogs.priority'));
             // @todo страницы блога разбиты на подстраницы. значит нужно генерировать
             // ссылки на каждую из подстраниц
             // т.е. тянуть количество топиков блога
         }
         E::ModuleCache()->Set($aData, $sCacheKey, array('blog_new'), C::Get('plugin.sitemap.type.blogs.cache_lifetime'));
     }
     return $aData;
 }
 protected function checkBlogFields($oBlog = null)
 {
     $bOk = parent::checkBlogFields($oBlog);
     if (!F::isPost('submit_blog_add')) {
         //  Проверяем есть ли подзаголовок блога
         $iMin = C::Get('plugin.blogsubtitle.min_subtitle_len');
         $iMax = C::Get('plugin.blogsubtitle.max_subtitle_len');
         $sSubtitle = F::GetRequestStr('blog_subtitle');
         if (!$sSubtitle && $iMin) {
             E::ModuleMessage()->AddError(E::ModuleLang()->Get('plugin.blogsubtitle.blog_create_subtitle_error', array('min' => $iMin, 'max' => $iMax)), E::ModuleLang()->Get('error'));
             $bOk = false;
         } elseif ($iMax) {
             if (!F::CheckVal($sSubtitle, 'text', $iMin, $iMax)) {
                 E::ModuleMessage()->AddError(E::ModuleLang()->Get('plugin.blogsubtitle.blog_create_subtitle_error', array('min' => $iMin, 'max' => $iMax)), E::ModuleLang()->Get('error'));
                 $bOk = false;
             }
         }
     }
     return $bOk;
 }
예제 #23
0
 /**
  * Список пользователей (с кешированием)
  *
  * @param integer $iPage
  *
  * @return array
  */
 public function getUsersForSitemap($iPage)
 {
     $iPerPage = C::Get('plugin.sitemap.users_per_page');
     $sCacheKey = "sitemap_users_{$iPage}_{$iPerPage}";
     if (false === ($aData = E::ModuleCache()->Get($sCacheKey))) {
         $aFilter = array('activate' => 1);
         $aUsers = E::ModuleUser()->GetUsersByFilter($aFilter, array(), $iPage, $iPerPage);
         $aData = array();
         /** @var ModuleUser_EntityUser $oUser */
         foreach ($aUsers['collection'] as $oUser) {
             // профиль пользователя
             $aData[] = E::ModuleSitemap()->GetDataForSitemapRow($oUser->getProfileUrl(), $oUser->getDateLastMod(), C::Get('plugin.sitemap.type.users.profile.changefreq'), C::Get('plugin.sitemap.type.users.profile.priority'));
             // публикации пользователя
             $aData[] = E::ModuleSitemap()->GetDataForSitemapRow($oUser->getUserTopicsLink(), null, C::Get('plugin.sitemap.type.users.my.changefreq'), C::Get('plugin.sitemap.type.users.my.priority'));
             // комментарии пользователя
             $aData[] = E::ModuleSitemap()->GetDataForSitemapRow($oUser->getUserCommentsLink(), $oUser->getDateCommentLast(), C::Get('plugin.sitemap.type.users.comments.changefreq'), C::Get('plugin.sitemap.type.users.comments.priority'));
             E::ModuleCache()->Set($aData, $sCacheKey, array('user_new', 'user_update'), C::Get('plugin.sitemap.type.users.cache_lifetime'));
         }
     }
     return $aData;
 }
예제 #24
0
 protected function PrepareRegExp($sRegExp)
 {
     $sRegExpPrim = str_replace('[[:>:]]|[[:<:]]', '[[:space:]]+', $sRegExp);
     $sRegExpPrim = str_replace('|[[:<:]]', '[[:alnum:]]+[[:space:]]+', $sRegExpPrim);
     $sRegExpPrim = str_replace('[[:>:]]|', '[[:space:]]+[[:alnum:]]+', $sRegExpPrim);
     $aRegExp = array('phrase' => $sRegExpPrim, 'words' => $sRegExp);
     if (strpos($sRegExp, '[[:>:]]|[[:<:]]')) {
         $aWords = explode('[[:>:]]|[[:<:]]', $sRegExp, C::Get('module.search.rate.limit'));
         foreach ($aWords as $iIndex => $sWord) {
             if (substr($sWord, 0, 7) !== '[[:<:]]') {
                 $aWords[$iIndex] = '[[:<:]]' . $sWord;
             }
             if (substr($sWord, -7) !== '[[:>:]]') {
                 $aWords[$iIndex] .= '[[:>:]]';
             }
         }
     } else {
         $aWords = array();
     }
     $aRates = array('phrase' => (count($aWords) + 1) * C::Val('module.search.rate.phrase', 1), 'words' => C::Val('module.search.rate.words', 1), 'title' => C::Val('module.search.rate.title', 1));
     return array('regexp' => $aRegExp, 'words' => $aWords, 'rates' => $aRates);
 }
예제 #25
0
 /**
  * Инициализирует параметры вывода js- и css- файлов
  */
 public function InitAssetFiles()
 {
     // Load 'prepend' assets
     if ($this->aFilesPrepend['js']) {
         $this->aFilesPrepend['js'] = array_reverse($this->aFilesPrepend['js'], true);
     }
     if ($this->aFilesPrepend['css']) {
         $this->aFilesPrepend['css'] = array_reverse($this->aFilesPrepend['css'], true);
     }
     if ($this->aFilesPrepend['js'] || $this->aFilesPrepend['css']) {
         E::ModuleViewerAsset()->AddAssetFiles($this->aFilesPrepend);
         $this->aFilesPrepend = array();
     }
     // Compatibility with old style skins
     if ($aOldAssetsConfig = C::Get('head.default')) {
         E::ModuleViewerAsset()->AddAssetFiles($aOldAssetsConfig);
     } else {
         E::ModuleViewerAsset()->AddAssetFiles(Config::Get('assets.default'));
     }
     // Load editor's assets
     if ($aEditors = C::Get('view.set_editors')) {
         if (C::Get('view.wysiwyg')) {
             if (isset($aEditors['wysiwyg'])) {
                 $sEditor = $aEditors['wysiwyg'];
             } else {
                 $sEditor = 'tinymce';
             }
         } else {
             if (isset($aEditors['default'])) {
                 $sEditor = $aEditors['default'];
             } else {
                 $sEditor = 'markitup';
             }
         }
         $aEditorAssets = C::Get('assets.editor.' . $sEditor);
         if ($aEditorAssets) {
             E::ModuleViewerAsset()->AddAssetFiles($aEditorAssets);
         }
     }
     // Load 'append' assets
     if ($this->aFilesAppend['js'] || $this->aFilesAppend['css']) {
         E::ModuleViewerAsset()->AddAssetFiles($this->aFilesAppend);
     }
     $this->bAssetInit = true;
 }
예제 #26
0
 /**
  * Вызывается по строке "user_rating"
  * @param string $sIcon
  * @param string $sNegativeClass
  * @return bool
  */
 public function UserRating($sIcon = '', $sNegativeClass = '')
 {
     if (!C::Get('rating.enabled')) {
         return '';
     }
     if (E::IsUser()) {
         $fRating = number_format(E::User()->getRating(), C::Get('view.rating_length'));
         if ($sNegativeClass && $fRating < 0) {
             $fRating = '<span class="' . $sNegativeClass . '">' . $fRating . '</span>';
         }
         return $sIcon . $fRating;
     }
     return '';
 }
예제 #27
0
 /**
  * Creates RSS channel for the blog (without items)
  *
  * @return ModuleRss_EntityRssChannel
  */
 public function CreateRssChannel()
 {
     $aRssChannelData = array('title' => C::Get('view.name') . '/' . $this->getTitle(), 'description' => $this->getDescription(), 'link' => $this->getLink(), 'language' => C::Get('lang.current'), 'managing_editor' => $this->getOwner() ? $this->getOwner()->getMail() : '', 'web_master' => C::Get('general.rss_editor_mail'), 'generator' => 'Alto CMS v.' . ALTO_VERSION);
     $oRssChannel = E::GetEntity('ModuleRss_EntityRssChannel', $aRssChannelData);
     return $oRssChannel;
 }
예제 #28
0
 /**
  * hook:hook_name
  * text:just_a_text
  * func:func_name
  * conf:some.config.key
  * 
  * @param mixed $xExpression
  * @param array $aParams
  *
  * @return mixed
  */
 public static function evaluate($xExpression, $aParams = array())
 {
     if (is_bool($xExpression)) {
         return $xExpression;
     } elseif (is_numeric($xExpression)) {
         return (int) $xExpression;
     } elseif (is_object($xExpression)) {
         return $xExpression();
     } elseif (is_string($xExpression) && strpos($xExpression, ':')) {
         list($sType, $sName) = explode(':', $xExpression, 2);
         if ($sType === 'hook') {
             return E::ModuleHook()->Run($sName, $aParams, false);
         } elseif ($sType === 'text') {
             return $sName;
         } elseif ($sType === 'func') {
             return call_user_func($sName, $aParams);
         } elseif ($sType === 'call') {
             return call_user_func($sName, $aParams);
         } elseif ($sType === 'conf') {
             return C::Get($sName);
         }
     }
     return $xExpression;
 }
예제 #29
0
파일: menu.php 프로젝트: AntiqS/altocms
     */
    $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')) {
    /**
     *  Подменю топовых
     */
    $config['data']['top'] = array('init' => array('fill' => array('list' => array('*'))), 'class' => 'dropdown-menu  dropdown-content-menu animated fadeIn', 'list' => array('24h' => array('text' => '{{blog_menu_top_period_24h}}', 'link' => '___path.root.url___/index/top/?period=1', 'active' => array('compare_get_param' => array('period', 1))), '7d' => array('text' => '{{blog_menu_top_period_7d}}', 'link' => '___path.root.url___/index/top/?period=7', 'active' => array('compare_get_param' => array('period', 7))), '30d' => array('text' => '{{blog_menu_top_period_30d}}', 'link' => '___path.root.url___/index/top/?period=30', 'active' => array('compare_get_param' => array('period', 30))), 'all' => array('text' => '{{blog_menu_top_period_all}}', 'link' => '___path.root.url___/index/top/?period=all', 'active' => array('compare_get_param' => array('period', 'all')))));
}
$config['data']['image_insert'] = array('list' => array('insert_from_pc' => false, 'insert_from_link' => false));
$config['data']['footer_site_menu'] = array('class' => 'footer-column', 'list' => array('topic' => array('options' => array('link_class' => 'link link-dual link-lead link-clear')), 'blogs' => array('options' => array('link_class' => 'link link-dual link-lead link-clear')), 'people' => array('options' => array('link_class' => 'link link-dual link-lead link-clear')), 'stream_menu' => array('options' => array('link_class' => 'link link-dual link-lead link-clear'))));
$config['data']['footer_info'] = array('class' => 'footer-column', 'list' => array('about' => array('options' => array('link_class' => 'link link-dual link-lead link-clear')), 'rules' => array('options' => array('link_class' => 'link link-dual link-lead link-clear')), 'advert' => array('options' => array('link_class' => 'link link-dual link-lead link-clear')), 'help' => array('options' => array('link_class' => 'link link-dual link-lead link-clear'))));
예제 #30
0
 /**
  * Display content of sitemap and save it in cache
  *
  * @param string       $sCacheKey
  * @param string|array $xData
  * @param string       $sTemplate
  */
 protected function _displaySitemap($sCacheKey, $xData, $sTemplate = 'sitemap.tpl')
 {
     E::ModuleViewer()->SetResponseHeader('Content-type', 'application/xml; charset=utf-8');
     if (is_array($xData)) {
         $sTemplate = Plugin::GetTemplateDir('sitemap') . 'tpls/' . $sTemplate;
         $sSiteMapContent = E::ModuleViewer()->Fetch($sTemplate, array('aData' => $xData));
         $sPeriod = C::Get();
         foreach ($xData as $aItem) {
             if (!empty($aItem['changefreq'])) {
                 if (in_array($aItem['changefreq'], $this->aPeriods)) {
                     $sPeriod = $this->aPeriods[$aItem['changefreq']];
                 }
             }
         }
         if (!$sPeriod) {
             $sPeriod = 'P1D';
         }
         //$this->_setCache($sCacheKey, $sSiteMapContent, $sPeriod);
     } else {
         $sSiteMapContent = $xData;
     }
     E::ModuleViewer()->Flush($sSiteMapContent);
     exit;
 }