/**
  * Adds new topic
  *
  * @param $oTopic
  *
  * @return bool|ModuleTopic_EntityTopic
  */
 protected function _addTopic($oTopic)
 {
     if (!E::IsAdminOrModerator()) {
         $xUserRatingOut = C::Val('plugin.sandbox.user_rating_out', false);
         if ($xUserRatingOut === false || E::User()->getUserRating() < $xUserRatingOut) {
             $oTopic->setTopicStatus(TOPIC_STATUS_SANDBOX);
         }
     }
     return parent::_addTopic($oTopic);
 }
Example #2
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);
 }
Example #3
0
 /**
  * Запуск обработки
  */
 public function Exec()
 {
     $iLimit = C::Val('widgets.tags.params.limit', 70);
     // * Получаем список тегов
     $aTags = E::ModuleTopic()->GetOpenTopicTags($iLimit);
     // * Расчитываем логарифмическое облако тегов
     if ($aTags) {
         E::ModuleTools()->MakeCloud($aTags);
         // * Устанавливаем шаблон вывода
         E::ModuleViewer()->Assign('aTags', $aTags);
     }
     // * Теги пользователя
     if ($oUserCurrent = E::ModuleUser()->GetUserCurrent()) {
         $aTags = E::ModuleTopic()->GetOpenTopicTags($iLimit, $oUserCurrent->getId());
         // * Расчитываем логарифмическое облако тегов
         if ($aTags) {
             E::ModuleTools()->MakeCloud($aTags);
             // * Устанавливаем шаблон вывода
             E::ModuleViewer()->Assign('aTagsUser', $aTags);
         }
     }
 }
Example #4
0
 /**
  * Initialization of render before Fetch() or Display()
  *
  * @param bool $bForce
  */
 protected function _initRender($bForce = false)
 {
     if ($this->bInitRender && !$bForce) {
         return;
     }
     $nTimer = microtime(true);
     E::ModuleHook()->Run('render_init_start', array('bLocal' => $this->bLocal));
     // If skin not initialized (or it was changed) then init one
     if ($this->sViewSkin != $this->GetConfigSkin()) {
         $this->_initSkin();
     } else {
         // Level could be changed after skin initialization
         Config::SetLevel(Config::LEVEL_SKIN_CUSTOM);
     }
     // init templator if not yet
     $this->_initTemplator();
     // Loads localized texts
     $aLang = E::ModuleLang()->GetLangMsg();
     // Old skin compatibility
     $aLang['registration_password_notice'] = E::ModuleLang()->Get('registration_password_notice', array('min' => C::Val('module.security.password_len', 3)));
     $this->Assign('aLang', $aLang);
     //$this->Assign('oLang', E::ModuleLang()->Dictionary());
     if (!$this->bLocal && !$this->GetResponseAjax()) {
         // Initialization of assets (JS-, CSS-files)
         $this->InitAssetFiles();
     }
     $oSkin = E::ModuleSkin()->GetSkin($this->sViewSkin);
     if (!$oSkin || !$oSkin->GetCompatible() || $oSkin->SkinCompatible('1.1', '<')) {
         // Для старых скинов загружаем объект доступа к конфигурации
         $this->Assign('oConfig', Config::getInstance());
     }
     E::ModuleHook()->Run('render_init_done', array('bLocal' => $this->bLocal));
     $this->bInitRender = true;
     self::$_preprocessTime += microtime(true) - $nTimer;
 }
Example #5
0
 /**
  * @param string     $sImageType
  * @param string|int $xSize
  *
  * @return array
  */
 protected function _defineImageSize($sImageType, $xSize)
 {
     $sSize = C::Val('module.uploader.images.' . $sImageType . '.size.' . $xSize, $xSize);
     return F::File_ImgModAttr($sSize);
 }