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;
 }
 /**
  * Запуск обработки
  */
 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('*****@*****.**');
 }
 /**
  * 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;
 }
 /**
  * Отправляет пользователю сообщение о добавлении его в друзья
  *
  * @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();
     }
 }
Exemple #5
0
 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'));
     }
 }
 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;
 }
Exemple #7
0
    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;
    }
 /**
  * Запуск обработки
  */
 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('*****@*****.**');
 }
 /**
  * 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;
 }
Exemple #10
0
 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 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;
 }
 /**
  * Добавление новой записи
  */
 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 GetSubscriptionByMail($sMail, $sSubscriptionHash, $sUnsubscriptionHash)
 {
     $sql = "SELECT * FROM " . Config::Get('db.table.subscription_mail') . " WHERE subscription_mail=? { AND subscription_subscribe_hash=? } { AND subscription_unsubscribe_hash=? } AND subscription_unsubscribe_date IS NULL LIMIT 0,1;";
     if ($aRow = $this->oDb->selectRow($sql, $sMail, !is_null($sSubscriptionHash) ? $sSubscriptionHash : DBSIMPLE_SKIP, !is_null($sUnsubscriptionHash) ? $sUnsubscriptionHash : DBSIMPLE_SKIP)) {
         return Engine::GetEntity('PluginSubscription_ModuleSubscription_EntitySubscription', $aRow);
     }
     return false;
 }
 public function GetUserTalkSerialise($sUserId)
 {
     $sql = "SELECT * FROM " . Config::Get('plugin.talkbell.table.talk_bell') . " WHERE user_id = ?d";
     if ($aRow = $this->oDb->selectRow($sql, $sUserId)) {
         return Engine::GetEntity('PluginTalkbell_Talkbell', $aRow);
     }
     return false;
 }
Exemple #15
0
 /**
  * Запись события в ленту
  * @param type $oUser
  * @param type $iEventType
  * @param type $iTargetId
  */
 public function Write($iUserId, $sEventType, $iTargetId)
 {
     $oEvent = Engine::GetEntity('Stream_Event');
     $oEvent->setEventType($sEventType);
     $oEvent->setUserId($iUserId);
     $oEvent->setTargetId($iTargetId);
     $oEvent->setDateAdded(date("Y-m-d H:i:s"));
     $this->AddEvent($oEvent);
 }
 public function getValueTypeObject()
 {
     if (!$this->_getDataOne('value_type_object')) {
         $oObject = Engine::GetEntity('ModuleProperty_EntityValueType' . func_camelize($this->getPropertyType()));
         $oObject->setValueObject($this);
         $this->setValueTypeObject($oObject);
     }
     return $this->_getDataOne('value_type_object');
 }
 protected function EntityByTableRow($sEntity, $aRow)
 {
     if ($aRow) {
         $sEntityFull = "PluginFeedbacks_ModuleFeedbacks_Entity" . $sEntity;
         return Engine::GetEntity($sEntityFull, $aRow);
     } else {
         return false;
     }
 }
Exemple #18
0
 public function getAdmList($iYear)
 {
     $sql = "SELECT\n\t\t\t\t\t*\n\t\t\t\tFROM " . Config::Get('db.table.adm') . " \n\t\t\t\tWHERE \n \t\t\t\t\tyear =?d\n\t\t";
     $aResult = array();
     $aRows = $this->oDb->select($sql, $iYear);
     foreach ($aRows as $aRow) {
         $aResult[] = Engine::GetEntity('PluginAdm_Admprofile_Admprofile', $aRow);
     }
     return $aResult;
 }
 public function GetUserByUid($iUid)
 {
     $sql = "SELECT \n\t\t\t\tuid,\n\t\t\t\tfio,\n\t\t\t\tphone,\n\t\t\t\t_vlan as vlan\n\t\t\tFROM \n\t\t\t\tusers_pi \n\t\t\tWHERE uid = ?";
     if ($aRows = $this->oDb->select($sql, $iUid)) {
         foreach ($aRows as $aRow) {
             $aResult = Engine::GetEntity('PluginCoverage_Abills', $aRow);
         }
     }
     return $aResult;
 }
 public function GetOldAdmProfiles($oUser, $iYear)
 {
     $sql = "SELECT\n\t\t\t\t\t*\n\t\t\t\tFROM " . Config::Get('db.table.adm') . " \n\t\t\t\tWHERE \n\t\t\t\t\tuser_id = ?d\n\t\t\t\t\tand year !=?d\n\t\t";
     $oResult = array();
     $aRows = $this->oDb->select($sql, $oUser->getId(), $iYear);
     foreach ($aRows as $aRow) {
         $oResult[] = Engine::GetEntity('PluginAdm_Admprofile_Admprofile', $aRow);
     }
     return $oResult;
 }
 public function EventMHB()
 {
     $aBlogs = $this->Blog_GetBlogs();
     if (isPost('submit_mhb')) {
         $this->Security_ValidateSendForm();
         $this->PluginMHB_ModuleMain_DeleteAllMhb();
         foreach ($_REQUEST as $key => $var) {
             $oMhb = null;
             if (strpos($key, 'mhb_auto_join_') === 0) {
                 $iBlogId = substr($key, 14);
                 $oMhb = $this->PluginMHB_ModuleMain_GetMhbByBlogId($iBlogId);
                 if (!$oMhb) {
                     $oMhb = Engine::GetEntity('PluginMHB_Main_Mhb');
                     $oMhb->setBlogId($iBlogId);
                     $oMhb->setAutoJoin(1);
                     $oMhb->setCantLeave(0);
                     $this->PluginMHB_ModuleMain_AddMhb($oMhb);
                 } else {
                     $oMhb->setAutoJoin(1);
                     $this->PluginMHB_ModuleMain_UpdateMhb($oMhb);
                 }
             }
             if (strpos($key, 'mhb_cant_leave_') === 0) {
                 $iBlogId = substr($key, 15);
                 $oMhb = $this->PluginMHB_ModuleMain_GetMhbByBlogId($iBlogId);
                 if (!$oMhb) {
                     $oMhb = Engine::GetEntity('PluginMHB_Main_Mhb');
                     $oMhb->setBlogId($iBlogId);
                     $oMhb->setAutoJoin(0);
                     $oMhb->setCantLeave(1);
                     $this->PluginMHB_ModuleMain_AddMhb($oMhb);
                 } else {
                     $oMhb->setCantLeave(1);
                     $this->PluginMHB_ModuleMain_UpdateMhb($oMhb);
                 }
             }
         }
     }
     $aMhb = $this->PluginMHB_ModuleMain_GetAllMhb();
     $aData = array();
     foreach ($aBlogs as $oBlog) {
         $data['blog_id'] = $oBlog->getId();
         $data['title'] = $oBlog->getTitle();
         $data['closed'] = $oBlog->getType() == 'close';
         $data['auto_join'] = false;
         $data['cant_leave'] = false;
         if (isset($aMhb[$oBlog->getId()])) {
             $data['auto_join'] = $aMhb[$oBlog->getId()]->getAutoJoin();
             $data['cant_leave'] = $aMhb[$oBlog->getId()]->getCantLeave();
         }
         $aData[] = $data;
     }
     $this->Viewer_AddBlock('right', 'block.info.tpl', array('plugin' => 'mhb'), 100);
     $this->Viewer_Assign("aData", $aData);
 }
 public function GetVoteById($sId, $sTargetType)
 {
     $sql = "SELECT \n\t\t\t\t\t*\t\t\t\t\t\t\t \n\t\t\t\tFROM \n\t\t\t\t\t" . Config::Get('db.table.vote') . "\n\t\t\t\tWHERE \t\t\t\t\t\n\t\t\t\t\ttarget_id = ? \t\n\t\t\t\t\tAND\n\t\t\t\t\ttarget_type = ? ";
     $aVotes = array();
     if ($aRows = $this->oDb->select($sql, $sId, $sTargetType)) {
         foreach ($aRows as $aRow) {
             $aVotes[] = Engine::GetEntity('Vote', $aRow);
         }
     }
     return $aVotes;
 }
 public function GetTasks($iLimit)
 {
     $sql = "SELECT *\n\t\t\t\tFROM " . Config::Get('db.table.notify_task') . "\t\n\t\t\t\tORDER BY date_created ASC\n\t\t\t\tLIMIT ?d";
     $aTasks = array();
     if ($aRows = $this->oDb->select($sql, $iLimit)) {
         foreach ($aRows as $aTask) {
             $aTasks[] = Engine::GetEntity('Notify_Task', $aTask);
         }
     }
     return $aTasks;
 }
 public function GetFiles($sQuestionId)
 {
     $sql = "SELECT * FROM " . Config::Get('db.table.receptiondesk_files') . " WHERE question_id=?d;";
     $aReturn = array();
     if ($aRows = $this->oDb->select($sql, $sQuestionId)) {
         foreach ($aRows as $aRow) {
             $aReturn[] = Engine::GetEntity('PluginReceptiondesk_ModuleTools_EntityFile', $aRow);
         }
     }
     return $aReturn;
 }
 public function GetAllMhb()
 {
     $sql = "SELECT * FROM " . Config::Get('plugin.mhb.table.mhb');
     $aRes = array();
     if ($aRows = $this->oDb->select($sql)) {
         foreach ($aRows as $aRow) {
             $aRes[$aRow['blog_id']] = Engine::GetEntity('PluginMHB_Main_Mhb', $aRow);
         }
     }
     return $aRes;
 }
Exemple #26
0
 public function AddVote(ModuleVote_EntityVote $oVote)
 {
     if (!$oVote->getIp()) {
         $oVote->setIp(func_getIp());
     }
     if ($this->oMapper->AddVote($oVote)) {
         $this->Cache_Delete("vote_{$oVote->getTargetType()}_{$oVote->getTargetId()}_{$oVote->getVoterId()}");
         $this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("vote_update_{$oVote->getTargetType()}_{$oVote->getVoterId()}"));
         if (in_array($oVote->getTargetType(), array('topic', 'comment', 'user'))) {
             $oAction = Engine::GetEntity("PluginFeedbacks_ModuleFeedbacks_EntityAction");
             $oAction->setUserIdFrom($oVote->getVoterId());
             $oAction->setId(null);
             $oAction->setAddDatetime(time());
             $oAction->setDestinationObjectId($oVote->getTargetId());
             if ($oVote->getTargetType() == 'topic') {
                 $oTopic = $this->Topic_GetTopicById($oVote->getTargetId());
                 $oAction->setUserIdTo($oTopic->getUserId());
                 if ($oVote->getDirection() > 0) {
                     $oAction->setActionType('VoteTopic');
                 }
                 if ($oVote->getDirection() < 0) {
                     $oAction->setActionType('VoteDownTopic');
                 }
                 if ($oVote->getDirection() == 0) {
                     $oAction->setActionType('VoteAbstainTopic');
                 }
             }
             if ($oVote->getTargetType() == 'comment') {
                 $oComment = $this->Comment_GetCommentById($oVote->getTargetId());
                 $oAction->setUserIdTo($oComment->getUserId());
                 if ($oVote->getDirection() > 0) {
                     $oAction->setActionType('VoteComment');
                 } else {
                     $oAction->setActionType('VoteDownComment');
                 }
             }
             if ($oVote->getTargetType() == 'user') {
                 $oAction->setUserIdTo($oVote->getTargetId());
                 if ($oVote->getDirection() > 0) {
                     $oAction->setActionType('VoteUser');
                 } else {
                     $oAction->setActionType('VoteDownUser');
                 }
             }
             return true;
             $this->PluginFeedbacks_Feedbacks_SaveAction($oAction);
         }
         return true;
     }
     return false;
 }
 protected function EventSubscriptionAjaxSetSubscription()
 {
     $this->Viewer_SetResponseAjax('json');
     require_once Config::Get('path.root.engine') . '/lib/external/XXTEA/encrypt.php';
     if (!($sSubscriptionMail = getRequestStr('subscription_mail'))) {
         $this->Message_AddErrorSingle($this->Lang_Get('plugin.subscription.subscription_mail_error_empty'), $this->Lang_Get('error'));
         return;
     }
     $oSubscription = Engine::GetEntity('PluginSubscription_ModuleSubscription_EntitySubscription');
     $oSubscription->_setValidateScenario('subscription_mail');
     $oSubscription->setMail($sSubscriptionMail);
     $oSubscription->_Validate();
     if ($oSubscription->_hasValidateErrors()) {
         $this->Message_AddErrorSingle($oSubscription->_getValidateError());
         return false;
     }
     if ($oSubscription = $this->PluginSubscription_Subscription_GetSubscriptionByMail($sSubscriptionMail)) {
         if ($oSubscription->getUnsubscribeHash()) {
             $sUnsubscribeCode = $oSubscription->getUnsubscribeHash();
             $sUnsubscribeCode .= base64_encode(xxtea_encrypt($oSubscription->getMail(), $oSubscription->getUnsubscribeHash()));
             $sUnsubscribeCode = str_replace(array('/', '+'), array('{', '}'), $sUnsubscribeCode);
             $this->Notify_Send($oSubscription->getMail(), 'notify.subscription_unsubscription.tpl', $this->Lang_Get('plugin.subscription.subscription_mail_message_subject'), array('sUnsubscribeCode' => $sUnsubscribeCode), 'subscription');
             $this->Viewer_AssignAjax('sText', $this->Lang_Get('plugin.subscription.subscription_block_subscription_submit_unsubscrib_ok'));
         } else {
             if ($oSubscription->getSubscribeDate()) {
                 $this->Viewer_AssignAjax('sText', $this->Lang_Get('plugin.subscription.subscription_mail_error_used'));
             } else {
                 $sSubscribeCode = $oSubscription->getSubscribeHash();
                 $sSubscribeCode .= base64_encode(xxtea_encrypt($oSubscription->getMail(), $oSubscription->getSubscribeHash()));
                 $sSubscribeCode = str_replace(array('/', '+'), array('{', '}'), $sSubscribeCode);
                 $this->Notify_Send($oSubscription->getMail(), 'notify.subscription_subscription.tpl', $this->Lang_Get('plugin.subscription.subscription_mail_message_subject'), array('sSubscribeCode' => $sSubscribeCode), 'subscription');
                 $this->Viewer_AssignAjax('sText', $this->Lang_Get('plugin.subscription.subscription_block_subscription_submit_repeatedly_ok'));
             }
         }
     } else {
         $oSubscription = Engine::GetEntity('PluginSubscription_ModuleSubscription_EntitySubscription');
         $oSubscription->setMail($sSubscriptionMail);
         $oSubscription->setSubscribeHash(func_generator());
         if ($this->PluginSubscription_Subscription_AddSubscription($oSubscription)) {
             $sSubscribeCode = $oSubscription->getSubscribeHash();
             $sSubscribeCode .= base64_encode(xxtea_encrypt($oSubscription->getMail(), $oSubscription->getSubscribeHash()));
             $sSubscribeCode = str_replace(array('/', '+'), array('{', '}'), $sSubscribeCode);
             $this->Notify_Send($oSubscription->getMail(), 'notify.subscription_subscription.tpl', $this->Lang_Get('plugin.subscription.subscription_mail_message_subject'), array('sSubscribeCode' => $sSubscribeCode), 'subscription');
             $this->Viewer_AssignAjax('sText', $this->Lang_Get('plugin.subscription.subscription_block_subscription_submit_ok'));
         } else {
             $this->Viewer_AssignAjax('sText', $this->Lang_Get('system_error'));
         }
     }
     return true;
 }
 /**
  * Create album
  *
  * @param $title string
  * @param $description string
  * @param $type String (personal | open | friend)
  *
  * @return bool Success
  */
 private function createAlbum($title, $description, $type)
 {
     $oUserFirst = $this->getReference('user-golfer');
     $oAlbum = Engine::GetEntity('PluginLsgallery_Album');
     $oAlbum->setUserId($oUserFirst->getId());
     $oAlbum->setTitle($title);
     $oAlbum->setDescription($description);
     $oAlbum->setType($type);
     if (!$this->oEngine->PluginLsgallery_Album_CreateAlbum($oAlbum)) {
         throw new Exception("Album \" {$title} \" is not created.");
     }
     $this->addReference("album-{$title}", $oAlbum);
     return true;
 }
 /**
  * Получить список голосований по списку айдишников
  *
  * @param array $aArrayId	Список ID владельцев
  * @param string $sTargetType	Тип владельца
  * @param int $sUserId	ID пользователя
  * @return array
  */
 public function GetVoteByArray($aArrayId, $sTargetType, $sUserId)
 {
     if (!is_array($aArrayId) or count($aArrayId) == 0) {
         return array();
     }
     $sql = "SELECT \n\t\t\t\t\t*\t\t\t\t\t\t\t \n\t\t\t\tFROM \n\t\t\t\t\t" . Config::Get('db.table.vote') . "\n\t\t\t\tWHERE \t\t\t\t\t\n\t\t\t\t\ttarget_id IN(?a) \t\n\t\t\t\t\tAND\n\t\t\t\t\ttarget_type = ? \n\t\t\t\t\tAND\n\t\t\t\t\tuser_voter_id = ?d ";
     $aVotes = array();
     if ($aRows = $this->oDb->select($sql, $aArrayId, $sTargetType, $sUserId)) {
         foreach ($aRows as $aRow) {
             $aVotes[] = Engine::GetEntity('Vote', $aRow);
         }
     }
     return $aVotes;
 }
Exemple #30
0
 public function GetCommentsByArrayId($aArrayId)
 {
     if (!is_array($aArrayId) or count($aArrayId) == 0) {
         return array();
     }
     $sql = "SELECT \t\t\t\t\t\n\t\t\t\t\t*\t\t\t\t\n\t\t\t\tFROM \n\t\t\t\t\t" . Config::Get('db.table.comment') . " \n\t\t\t\tWHERE \t\n\t\t\t\t\tcomment_id IN(?a) \t\t\t\t\t\n\t\t\t\tORDER by FIELD(comment_id,?a)";
     $aComments = array();
     if ($aRows = $this->oDb->select($sql, $aArrayId, $aArrayId)) {
         foreach ($aRows as $aRow) {
             $aComments[] = Engine::GetEntity('Comment', $aRow);
         }
     }
     return $aComments;
 }