public function saludo($nombre) { // View::set("name", $nombre); // View::set("title", "Custom MVC"); // View::render("front\\home"); $templates = new Engine('../src/App/Views/front/'); echo $templates->render('error', ['name' => 'Jonathan']); }
public function ensureCorrectGear(Engine $engine, $speed) { $engineSize = $engine->getSize(); $turbo = $engine->isTurbo(); // Some complicated code to determine correct gear // setting based on $engineSize, $turbo, $speed etc. // ... omitted ... return "Working out correct gear at {$speed}mph for a SPORT gearbox"; }
/** * @expectedException Exception */ public function testEngineExecute() { $arrConf = array('true' => array('InitContext', 'CommonParamChecker'), 'sourceFlag in [3]' => array('SdkParamChecker')); $phase = new PhaseParamCheck($arrConf); $phase = new Phase('paramCheck', $phase->actions); $engine = new Engine(); $result = $engine->executeSinglePhase($phase); $this->assertEquals(false, $result); }
public function GetQuestionByArrayId($aArrayId, $aOrder = null) { if (!is_array($aArrayId) || count($aArrayId) == 0) { return array(); } if (!is_array($aOrder)) { $aOrder = array($aOrder); } $sOrder = ''; foreach ($aOrder as $key => $value) { $value = (string) $value; if (!in_array($key, array('question_id', 'question_category_id', 'question_date_add', 'question_user_ip'))) { unset($aOrder[$key]); } elseif (in_array($value, array('asc', 'desc'))) { $sOrder .= " {$key} {$value},"; } } $sOrder = trim($sOrder, ','); $sql = "SELECT * FROM " . Config::Get('db.table.receptiondesk_questions') . " WHERE question_id IN(?a) ORDER BY { FIELD(question_id,?a) }"; if ($sOrder != '') { $sql .= $sOrder; } $aQuestion = array(); if ($aRows = $this->oDb->select($sql, $aArrayId, $sOrder == '' ? $aArrayId : DBSIMPLE_SKIP)) { foreach ($aRows as $aRow) { $aQuestion[] = Engine::GetEntity('PluginReceptiondesk_ModuleQuestion_EntityQuestion', $aRow); } } return $aQuestion; }
function call() { if (Config::get("require_login", 0) && $this->_action != 'login' && $this->_session->requireLogin()) { exit; } parent::call(); }
function _smarty_include($params) { if (isset($params['smarty_include_tpl_file'])) { $params['smarty_include_tpl_file'] = Engine::getInstance()->Plugin_GetDelegate('template', $params['smarty_include_tpl_file']); } parent::_smarty_include($params); }
public function GetSubscribes($aFilter, $aOrder, &$iCount, $iCurrPage, $iPerPage) { $aOrderAllow = array('id', 'date_add', 'status'); $sOrder = ''; foreach ($aOrder as $key => $value) { if (!in_array($key, $aOrderAllow)) { unset($aOrder[$key]); } elseif (in_array($value, array('asc', 'desc'))) { $sOrder .= " {$key} {$value},"; } } $sOrder = trim($sOrder, ','); if ($sOrder == '') { $sOrder = ' id desc '; } if (isset($aFilter['exclude_mail']) and !is_array($aFilter['exclude_mail'])) { $aFilter['exclude_mail'] = array($aFilter['exclude_mail']); } $sql = "SELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\t" . Config::Get('db.table.subscribe') . "\n\t\t\t\tWHERE\n\t\t\t\t\t1 = 1\n\t\t\t\t\t{ AND target_type = ? }\n\t\t\t\t\t{ AND target_id = ?d }\n\t\t\t\t\t{ AND mail = ? }\n\t\t\t\t\t{ AND mail not IN (?a) }\n\t\t\t\t\t{ AND `key` = ? }\n\t\t\t\t\t{ AND status = ?d }\n\t\t\t\tORDER by {$sOrder}\n\t\t\t\tLIMIT ?d, ?d ;\n\t\t\t\t\t"; $aResult = array(); if ($aRows = $this->oDb->selectPage($iCount, $sql, isset($aFilter['target_type']) ? $aFilter['target_type'] : DBSIMPLE_SKIP, isset($aFilter['target_id']) ? $aFilter['target_id'] : DBSIMPLE_SKIP, isset($aFilter['mail']) ? $aFilter['mail'] : DBSIMPLE_SKIP, (isset($aFilter['exclude_mail']) and count($aFilter['exclude_mail'])) ? $aFilter['exclude_mail'] : DBSIMPLE_SKIP, isset($aFilter['key']) ? $aFilter['key'] : DBSIMPLE_SKIP, isset($aFilter['status']) ? $aFilter['status'] : DBSIMPLE_SKIP, ($iCurrPage - 1) * $iPerPage, $iPerPage)) { foreach ($aRows as $aRow) { $aResult[] = Engine::GetEntity('Subscribe', $aRow); } } return $aResult; }
/** * Edit image * * @param PluginLsgallery_ModuleImage_EntityImage $oImage * @return boolean */ public function UpdateImage($oImage) { $oImageOld = $this->GetImageById($oImage->getId()); $oImage->setDateEdit(); /* @var $oAlbum PluginLsgallery_ModuleAlbum_EntityAlbum */ $oAlbum = $this->PluginLsgallery_Album_GetAlbumById($oImage->getAlbumId()); $this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("image_update")); $this->Cache_Delete("image_{$oImage->getId()}"); $this->oMapper->UpdateImage($oImage); if ($oImage->getImageTags() != $oImageOld->getImageTags()) { /** * Обновляем теги */ $aTags = explode(',', $oImage->getImageTags()); $this->DeleteImageTagsByImageId($oImage->getId()); if ($oAlbum->getType() == PluginLsgallery_ModuleAlbum_EntityAlbum::TYPE_OPEN) { foreach ($aTags as $sTag) { $oTag = Engine::GetEntity('PluginLsgallery_ModuleImage_EntityImageTag'); $oTag->setImageId($oImage->getId()); $oTag->setAlbumId($oImage->getAlbumId()); $oTag->setText(trim($sTag)); $this->oMapper->AddImageTag($oTag); } } } return true; }
public function Init() { $this->oMapper = Engine::GetMapper(__CLASS__); //get me my DB link baby $this->oUserCurrent = $this->User_GetUserCurrent(); //do I need this? }
public function run($template) { if (file_exists(TEMP_CONFIG_FILE)) { Engine::getConfig()->setConfigFilename(TEMP_CONFIG_FILE); Engine::getConfig()->open(); } }
/** * Запуск обработки */ public function Exec() { $sEntity = $this->GetParam('entity'); $oTarget = $this->GetParam('target'); $sTargetType = $this->GetParam('target_type'); if (!$oTarget) { $oTarget = Engine::GetEntity($sEntity); } $aBehaviors = $oTarget->GetBehaviors(); foreach ($aBehaviors as $oBehavior) { if ($oBehavior instanceof ModuleCategory_BehaviorEntity) { /** * Если в параметрах был тип, то переопределяем значение. Это необходимо для корректной работы, когда тип динамический. */ if ($sTargetType) { $oBehavior->setParam('target_type', $sTargetType); } /** * Нужное нам поведение - получаем список текущих категорий */ $this->Viewer_Assign('categoriesSelected', $oBehavior->getCategories(), true); /** * Загружаем параметры */ $aParams = $oBehavior->getParams(); $this->Viewer_Assign('params', $aParams, true); /** * Загружаем список доступных категорий */ $this->Viewer_Assign('categories', $this->Category_GetCategoriesTreeByTargetType($oBehavior->getCategoryTargetType()), true); break; } } $this->SetTemplate('*****@*****.**'); }
protected function EventAjaxSet() { if (!F::isPost('url')) { return false; } if (!$this->CheckSeopackFields()) { return false; } $sUrl = E::ModuleSeopack()->ClearUrl(F::GetRequest('url')); if (!($oSeopack = E::ModuleSeopack()->GetSeopackByUrl($sUrl))) { $oSeopack = Engine::GetEntity('PluginSeopack_ModuleSeopack_EntitySeopack'); $oSeopack->setUrl($sUrl); } if (F::GetRequest('title_auto') && F::GetRequest('description_auto') && F::GetRequest('keywords_auto')) { $oSeopack->Delete(); E::ModuleMessage()->AddNotice(E::ModuleLang()->Get('plugin.seopack.seopack_edit_submit_save_ok')); return; } $oSeopack->setTitle(F::GetRequest('title_auto') ? null : strip_tags(F::GetRequest('title'))); $oSeopack->setDescription(F::GetRequest('description_auto') ? null : strip_tags(F::GetRequest('description'))); $oSeopack->setKeywords(F::GetRequest('keywords_auto') ? null : strip_tags(F::GetRequest('keywords'))); if ($oSeopack->Save()) { if ($oSeopack->getTitle()) { E::ModuleViewer()->AssignAjax('title', $oSeopack->getTitle()); } E::ModuleMessage()->AddNotice(E::ModuleLang()->Get('plugin.seopack.seopack_edit_submit_save_ok')); } return; }
/** * Показывает блоки определенно группы * * @param unknown_type $params * @param unknown_type $smarty * @return unknown */ function smarty_function_show_blocks($aParams, &$oSmarty) { if (!array_key_exists('group', $aParams)) { trigger_error("show_blocks: missing 'group' parameter", E_USER_WARNING); return; } $sGroup = $aParams['group']; $aBlocks = Engine::getInstance()->Viewer_GetBlocks(true); $sResult = ''; if (isset($aBlocks[$sGroup]) and is_array($aBlocks[$sGroup])) { $oSmarty->loadPlugin('smarty_insert_block'); foreach ($aBlocks[$sGroup] as $aBlock) { if ($aBlock['type'] == 'block') { $sResult .= smarty_insert_block(array('block' => $aBlock['name'], 'params' => isset($aBlock['params']) ? $aBlock['params'] : array()), $oSmarty); } elseif ($aBlock['type'] == 'template') { $sResult .= $oSmarty->getSubTemplate($aBlock['name'], $oSmarty->cache_id, $oSmarty->compile_id, null, null, array('params' => isset($aBlock['params']) ? $aBlock['params'] : array()), Smarty::SCOPE_LOCAL); } } } if (!empty($aParams['assign'])) { $oSmarty->assign($aParams['assign'], $sResult); } else { return $sResult; } }
public function GetTopicsByArrayId($aArrayId) { $oUserCurrent = PluginLib_ModuleUser::GetUserCurrent(); $sAccessWhere = $oUserCurrent->isAdministrator() ? '' : ' AND ' . PluginAccesstotopic_ModuleAccess::GetAccessWhereStatment($oUserCurrent->getId()); if (!is_array($aArrayId) or count($aArrayId) == 0) { return array(); } $sql = 'SELECT t.*, tc.* FROM ' . Config::Get('db.table.topic') . ' as t JOIN ' . Config::Get('db.table.topic_content') . ' as tc ON t.topic_id=tc.topic_id WHERE t.topic_id IN(?a) ' . $sAccessWhere . ' ORDER BY FIELD(t.topic_id,?a) '; $aTopics = array(); if ($aRows = $this->oDb->select($sql, $aArrayId, $aArrayId)) { foreach ($aRows as $aTopic) { $aTopics[] = Engine::GetEntity('Topic', $aTopic); } } return $aTopics; }
/** * Create topic with default values * * @param int $iBlogId * @param int $iUserId * @param string $sTitle * @param string $sText * @param string $sTags * @param string $sDate * * @return ModuleTopic_EntityTopic */ private function _createTopic($iBlogId, $iUserId, $sTitle, $sText, $sTags, $sDate) { $this->aActivePlugins = $this->oEngine->Plugin_GetActivePlugins(); $oTopic = Engine::GetEntity('Topic'); /* @var $oTopic ModuleTopic_EntityTopic */ $oTopic->setBlogId($iBlogId); $oTopic->setUserId($iUserId); $oTopic->setUserIp('127.0.0.1'); $oTopic->setForbidComment(false); $oTopic->setType('topic'); $oTopic->setTitle($sTitle); $oTopic->setPublishIndex(true); $oTopic->setPublish(true); $oTopic->setPublishDraft(true); $oTopic->setDateAdd($sDate); $oTopic->setTextSource($sText); list($sTextShort, $sTextNew, $sTextCut) = $this->oEngine->Text_Cut($oTopic->getTextSource()); $oTopic->setCutText($sTextCut); $oTopic->setText($this->oEngine->Text_Parser($sTextNew)); $oTopic->setTextShort($this->oEngine->Text_Parser($sTextShort)); $oTopic->setTextHash(md5($oTopic->getType() . $oTopic->getTextSource() . $oTopic->getTitle())); $oTopic->setTags($sTags); //with active plugin l10n added a field topic_lang if (in_array('l10n', $this->aActivePlugins)) { $oTopic->setTopicLang(Config::Get('lang.current')); } // @todo refact this $oTopic->_setValidateScenario('topic'); $oTopic->_Validate(); $this->oEngine->Topic_AddTopic($oTopic); return $oTopic; }
public function isMatch($URL) { //Check if we're forcing a new URL $forcingNewAnalysis = $URL == $this->getNewAnalysisURL(); //Are they matching the URL? $isMatchingURL = $URL == $this->getURL() || $forcingNewAnalysis; //Are they logged in? $isLoggedIn = $this->user->isLoggedIn(); if ($isMatchingURL && $isLoggedIn) { //Only start considering if it's a match here as we need to query the database after this. $dbh = Engine::getDatabase(); //If this user exists in the database, they have used our application //before and an analysis would have been created on authentication $this->userExists = $dbh->query("SELECT * FROM Users WHERE User_ID=" . $this->user->id)->fetch(PDO::FETCH_ASSOC) != null; if (!$forcingNewAnalysis && $this->userExists) { ob_clean(); header("Location: " . Engine::getRemoteAbsolutePath((new Account())->getURL())); exit; } if (!$this->userExists) { $dbh->exec("INSERT INTO Users (User_ID, Name, Email) VALUES ('" . User::instance()->id . "', '" . User::instance()->name . "', '" . User::instance()->email . "')"); } //Otherwise, we are a new user and we don't need to force a new analysis return true; } else { if ($isMatchingURL && !$isLoggedIn) { //Go back home as we're not authenticated. require 'login.php'; } else { //Wasn't a match at all. return false; } } }
private function authenticate() { //Try gaining access to the Facebook PHP SDK try { $accessToken = SDK::instance()->helper->getAccessToken(); } catch (Facebook\Exceptions\FacebookResponseException $e) { throw new Exception("Graph returned an error: " . $e->getMessage()); } catch (Facebok\Exceptions\FacebookSDKException $e) { throw new Exception("Facebook SDK returned an error: " . $e->getMessage()); } //Assuming it went well, let's process our login state if (!is_null($this->getToken()) || isset($accessToken)) { //This if statements means that it doesn't matter if the session token is set or not, //as long as we have the access token either by request or by session, we can use the session if (is_null($this->getToken())) { $this->setToken((string) $accessToken); header("Location: " . Engine::getRemoteAbsolutePath((new Analyse())->getURL())); } //Get basic user profile information such as user id, name and email to test whether the session works try { $this->importFromJson($this->getBasicUserProfile()->getGraphUser()); } catch (Facebook\Exceptions\FacebookResponseException $e) { if (strpos($e->getMessage(), "The user has not authorized application") > -1) { Engine::clearSession(); header("Location: " . Engine::getRemoteAbsolutePath((new Home())->getURL())); } else { throw $e; } exit; } return true; } else { return false; } }
public static function initInstance($engineType = null) { if (self::$engine != null) { return self::$engine; } $parser = ModuleOperations::get_instance()->get_module_instance('Parser'); if ($engineType == null) { $engineType = $parser->GetPreference('default_engine', Engine::$PARSDOWN); } self::$process_smarty_security = $parser->GetPreference('process_smarty_security', true); self::$process_security = $parser->GetPreference('process_security', true); self::$process_quote = $parser->GetPreference('process_quote', true); self::$process_img = $parser->GetPreference('process_img', true); self::$process_codepre = $parser->GetPreference('process_codepre', true); if (Engine::$MICHELF == $engineType) { include_once dirname(__FILE__) . '/Engines/class.MichelfEngine.php'; self::$engine = new MichelfEngine(); } else { if (Engine::$MICHELF_EXTRA == $engineType) { include_once dirname(__FILE__) . '/Engines/class.MichelfExtraEngine.php'; self::$engine = new MichelfExtraEngine(); } else { if (Engine::$PARSDOWN == $engineType) { include_once dirname(__FILE__) . '/Engines/class.ParsedownEngine.php'; self::$engine = new ParsedownEngine(); } } } return self::$engine; }
public function Add(ModuleUser_EntityUser $oUser) { if ($nUser = parent::Add($oUser)) { $sId = $nUser->getId(); $aMhb = $this->PluginMHB_ModuleMain_GetAllMhb(); foreach ($aMhb as $oMhb) { if ($oMhb->getAutoJoin()) { if ($oBlog = $this->Blog_GetBlogById($oMhb->getBlogId())) { $oBlogUserNew = Engine::GetEntity('Blog_BlogUser'); $oBlogUserNew->setUserId($sId); $oBlogUserNew->setUserRole(ModuleBlog::BLOG_USER_ROLE_USER); $oBlogUserNew->setBlogId($oBlog->getId()); $bResult = $this->Blog_AddRelationBlogUser($oBlogUserNew); if ($bResult) { $oBlog->setCountUser($oBlog->getCountUser() + 1); $this->Blog_UpdateBlog($oBlog); $this->Stream_write($sId, 'join_blog', $oBlog->getId()); $this->Userfeed_subscribeUser($sId, ModuleUserfeed::SUBSCRIBE_TYPE_BLOG, $oBlog->getId()); } } } } return $nUser; } return false; }
/** * Запуск обработки */ public function Exec() { $sEntity = $this->GetParam('entity'); $oTarget = $this->GetParam('target'); $sTargetType = $this->GetParam('target_type'); if (!$oTarget) { $oTarget = Engine::GetEntity($sEntity); } $aBehaviors = $oTarget->GetBehaviors(); foreach ($aBehaviors as $oBehavior) { /** * Определяем нужное нам поведение */ if ($oBehavior instanceof ModuleProperty_BehaviorEntity) { /** * Если в параметрах был тип, то переопределяем значение. Это необходимо для корректной работы, когда тип динамический. */ if ($sTargetType) { $oBehavior->setParam('target_type', $sTargetType); } $aProperties = $this->Property_GetPropertiesForUpdate($oBehavior->getPropertyTargetType(), $oTarget->getId()); $this->Viewer_Assign('properties', $aProperties, true); break; } } $this->SetTemplate('*****@*****.**'); }
public function __construct($params = []) { $this->ENGINE = Engine::Instance(); $this->component = get_called_class(); $this->PARAMS = $params; $this->USER =& $_SESSION['USER']; }
public static function get_instance() { if (!self::$instance) { self::$instance = new Engine(); } return self::$instance; }
/** * Инициализация модуля. Это обязательный метод */ public function Init() { /** * Создаем объект маппера PluginExample_ModuleExample_MapperExample */ $this->oMapper = Engine::GetMapper(__CLASS__); }
protected function SubmitSaveSeopack() { $this->sMainMenuItem = 'content'; if (!$this->CheckSeopackFields()) { return false; } $sUrl = E::ModuleSeopack()->ClearUrl(F::GetRequest('url')); if (!F::GetRequest('seopack_id')) { if (!($oSeopack = E::ModuleSeopack()->GetSeopackByUrl($this->GetUri($sUrl)))) { $oSeopack = Engine::GetEntity('PluginSeopack_ModuleSeopack_EntitySeopack'); $oSeopack->setUrl($this->GetUri($sUrl)); } } elseif (!($oSeopack = E::ModuleSeopack()->GetSeopackBySeopackId(F::GetRequest('seopack_id')))) { $oSeopack = Engine::GetEntity('PluginSeopack_ModuleSeopack_EntitySeopack'); $oSeopack->setUrl($this->GetUri($sUrl)); } $oSeopack->setTitle(F::GetRequest('title_auto') ? null : strip_tags(F::GetRequest('title'))); $oSeopack->setDescription(F::GetRequest('description_auto') ? null : strip_tags(F::GetRequest('description'))); $oSeopack->setKeywords(F::GetRequest('keywords_auto') ? null : strip_tags(F::GetRequest('keywords'))); if ($oSeopack->Save()) { E::ModuleMessage()->AddNotice(E::ModuleLang()->Get('plugin.seopack.seopack_edit_submit_save_ok')); Router::Location('admin/seopack/'); } else { E::ModuleMessage()->AddError(E::ModuleLang()->Get('system_error')); } }
function call() { if ($this->_session->requireLogin()) { exit; } parent::call(); }
/** * Plugin for Smarty * * @param array $aParams * @param Smarty_Internal_Template $oSmartyTemplate * * @return string|null */ function smarty_function_widget_template($aParams, $oSmartyTemplate) { if (!isset($aParams['name'])) { trigger_error('Parameter "name" does not define in {widget ...} function', E_USER_WARNING); return null; } $sWidgetName = $aParams['name']; $aWidgetParams = isset($aParams['params']) ? $aParams['params'] : array(); $oEngine = Engine::getInstance(); // Проверяем делигирование $sTemplate = E::ModulePlugin()->GetDelegate('template', $sWidgetName); if ($sTemplate) { if ($aWidgetParams) { foreach ($aWidgetParams as $sKey => $sVal) { $oSmartyTemplate->assign($sKey, $sVal); } if (!isset($aWidgetParams['params'])) { /* LS-compatible */ $oSmartyTemplate->assign('params', $aWidgetParams); } $oSmartyTemplate->assign('aWidgetParams', $aWidgetParams); } $sResult = $oSmartyTemplate->fetch($sTemplate); } else { $sResult = null; } return $sResult; }
/** * Отправляет пользователю сообщение о добавлении его в друзья * * @param ModuleUser_EntityUser $oUserTo * @param ModuleUser_EntityUser $oUserFrom * @param string $sText */ public function SendUserMarkImageNew(ModuleUser_EntityUser $oUserTo, ModuleUser_EntityUser $oUserFrom, $sText) { /** * Если в конфигураторе указан отложенный метод отправки, * то добавляем задание в массив. В противном случае, * сразу отсылаем на email */ if (Config::Get('module.notify.delayed')) { $oNotifyTask = Engine::GetEntity('Notify_Task', array('user_mail' => $oUserTo->getMail(), 'user_login' => $oUserTo->getLogin(), 'notify_text' => $sText, 'notify_subject' => $this->Lang_Get('plugin.lsgallery.lsgallery_marked_subject'), 'date_created' => date("Y-m-d H:i:s"), 'notify_task_status' => self::NOTIFY_TASK_STATUS_NULL)); if (Config::Get('module.notify.insert_single')) { $this->aTask[] = $oNotifyTask; } else { $this->oMapper->AddTask($oNotifyTask); } } else { /** * Отправляем мыло */ $this->Mail_SetAdress($oUserTo->getMail(), $oUserTo->getLogin()); $this->Mail_SetSubject($this->Lang_Get('plugin.lsgallery.lsgallery_marked_subject')); $this->Mail_SetBody($sText); $this->Mail_setHTML(); $this->Mail_Send(); } }
public function initEngine() { if (!$this->oEngine) { $this->oEngine = Engine::getInstance(); $this->oEngine->Init(); } }
/** * Добавление новой записи */ protected function EventAdd() { /** * Устанавливаем title страницы */ $this->Viewer_AddHtmlTitle($this->Lang_Get('plugin.testimonials.add_testimonial_title')); /** * Проверяем авторизован ли пользователь */ if (!$this->User_IsAuthorization()) { $this->Message_AddErrorSingle($this->Lang_Get('not_access'), $this->Lang_Get('error')); return Router::Action('error'); } /** * Запускаем проверку корректности ввода полей. * Дополнительно проверяем, что был отправлен POST запрос. */ if (!$this->checkTestimonialFields()) { return false; } /** * Если все ок, заполняем свойства */ $oTestimonial = Engine::GetEntity('PluginTestimonials_Testimonials'); $oTestimonial->setTextSource(getRequestStr('text')); /** * Парсим текст на предмет разных ХТМЛ тегов */ $sText = $this->Text_Parser(getRequestStr('text')); $oTestimonial->setText($sText); $oTestimonial->setUserId($this->oUserCurrent->getId()); $oTestimonial->setDateAdd(date("Y-m-d H:i:s")); /** * Проверяем права на постинг */ if (!$this->PluginTestimonials_ACL_CanAddTestimonial($this->oUserCurrent)) { $this->Message_AddErrorSingle($this->Lang_Get('plugin.testimonials.create_error_noallow'), $this->Lang_Get('error')); return false; } /** * Проверяем разрешено ли постить по времени */ if (isPost('submit_testimonial_save') and !$this->PluginTestimonials_ACL_CanPostTestimonialTime($this->oUserCurrent)) { $this->Message_AddErrorSingle($this->Lang_Get('topic_time_limit'), $this->Lang_Get('error')); return; } /** * Добавляем запись */ if ($this->PluginTestimonials_Testimonials_AddTestimonial($oTestimonial)) { /** * Добавляем событие в ленту */ $this->Stream_write($oTestimonial->getUserId(), 'add_testimonial', $oTestimonial->getId()); Router::Location(Router::GetPath('testimonials')); } else { $this->Message_AddError($this->Lang_Get('system_error')); } }
public function ClearComments() { $sql = "SELECT co.comment_id FROM " . Config::Get('db.table.comment_online') . " AS co\n LEFT JOIN " . Config::Get('db.table.topic') . " AS t ON co.target_type='topic' AND co.target_id=t.topic_id\n WHERE t.topic_id IS NULL"; if ($aCommentId = $this->oDb->selectCol($sql)) { Engine::getInstance()->Comment_DeleteCommentOnlineByArrayId($aCommentId, 'topic'); } return true; }