/**
  * Формирует и возвращает полный ЧПУ URL для топика
  *
  * @param ModuleTopic_EntityTopic $oTopic
  * @param bool $bAbsolute При false вернет относительный УРЛ
  * @return string
  */
 public function BuildUrlForTopic($oTopic, $bAbsolute = true)
 {
     $sUrlMask = Config::Get('module.topic.url');
     $iDateCreate = strtotime($oTopic->getDatePublish());
     $aReplace = array('%year%' => date("Y", $iDateCreate), '%month%' => date("m", $iDateCreate), '%day%' => date("d", $iDateCreate), '%hour%' => date("H", $iDateCreate), '%minute%' => date("i", $iDateCreate), '%second%' => date("s", $iDateCreate), '%login%' => '', '%blog%' => '', '%id%' => $oTopic->getId(), '%title%' => $oTopic->getSlug(), '%type%' => $oTopic->getType());
     /**
      * Получаем связанные данные только если в этом есть необходимость
      */
     if (strpos($sUrlMask, '%blog%') !== false) {
         if (!($oBlog = $oTopic->GetBlog())) {
             $oBlog = $this->Blog_GetBlogById($oTopic->getBlogId());
         }
         if ($oBlog) {
             if ($oBlog->getType() == 'personal') {
                 $sUrlMask = str_replace('%blog%', '%login%', $sUrlMask);
             } else {
                 $aReplace['%blog%'] = $oBlog->getUrl();
             }
         }
     }
     if (strpos($sUrlMask, '%login%') !== false) {
         if (!($oUser = $oTopic->GetUser())) {
             $oUser = $this->User_GetUserById($oTopic->getUserId());
         }
         if ($oUser) {
             $aReplace['%login%'] = $oUser->getLogin();
         }
     }
     $sUrl = strtr($sUrlMask, $aReplace);
     return $bAbsolute ? Router::GetPathRootWeb() . '/' . $sUrl : $sUrl;
 }
 /**
  * Обновляет топик
  *
  * @param ModuleTopic_EntityTopic $oTopic Объект топика
  * @return bool
  */
 public function UpdateTopic(ModuleTopic_EntityTopic $oTopic)
 {
     $sql = "UPDATE " . Config::Get('db.table.topic') . "\n\t\t\tSET \n\t\t\t\tblog_id= ?d,\n\t\t\t\tblog_id2= ?d,\n\t\t\t\tblog_id3= ?d,\n\t\t\t\tblog_id4= ?d,\n\t\t\t\tblog_id5= ?d,\n\t\t\t\ttopic_title= ?,\n\t\t\t\ttopic_slug= ?,\n\t\t\t\ttopic_tags= ?,\n\t\t\t\ttopic_date_add = ?,\n\t\t\t\ttopic_date_edit = ?,\n\t\t\t\ttopic_date_edit_content = ?,\n\t\t\t\ttopic_date_publish = ?,\n\t\t\t\ttopic_user_ip= ?,\n\t\t\t\ttopic_publish= ?d ,\n\t\t\t\ttopic_publish_draft= ?d ,\n\t\t\t\ttopic_publish_index= ?d,\n\t\t\t\ttopic_skip_index= ?d,\n\t\t\t\ttopic_rating= ?f,\n\t\t\t\ttopic_count_vote= ?d,\n\t\t\t\ttopic_count_vote_up= ?d,\n\t\t\t\ttopic_count_vote_down= ?d,\n\t\t\t\ttopic_count_vote_abstain= ?d,\n\t\t\t\ttopic_count_read= ?d,\n\t\t\t\ttopic_count_comment= ?d, \n\t\t\t\ttopic_count_favourite= ?d,\n\t\t\t\ttopic_cut_text = ? ,\n\t\t\t\ttopic_forbid_comment = ? ,\n\t\t\t\ttopic_text_hash = ? \n\t\t\tWHERE\n\t\t\t\ttopic_id = ?d\n\t\t";
     $res = $this->oDb->query($sql, $oTopic->getBlogId(), $oTopic->getBlogId2(), $oTopic->getBlogId3(), $oTopic->getBlogId4(), $oTopic->getBlogId5(), $oTopic->getTitle(), $oTopic->getSlug(), $oTopic->getTags(), $oTopic->getDateAdd(), $oTopic->getDateEdit(), $oTopic->getDateEditContent(), $oTopic->getDatePublish(), $oTopic->getUserIp(), $oTopic->getPublish(), $oTopic->getPublishDraft(), $oTopic->getPublishIndex(), $oTopic->getSkipIndex(), $oTopic->getRating(), $oTopic->getCountVote(), $oTopic->getCountVoteUp(), $oTopic->getCountVoteDown(), $oTopic->getCountVoteAbstain(), $oTopic->getCountRead(), $oTopic->getCountComment(), $oTopic->getCountFavourite(), $oTopic->getCutText(), $oTopic->getForbidComment(), $oTopic->getTextHash(), $oTopic->getId());
     if ($res !== false and !is_null($res)) {
         $this->UpdateTopicContent($oTopic);
         return true;
     }
     return false;
 }