public function AddTopic(ModuleTopic_EntityTopic $oTopic) {
		$sql = "INSERT INTO ".Config::Get('db.table.topic')." 
			(blog_id,
			user_id,
			topic_type,
			topic_title,			
			topic_tags,
			topic_date_add,
			topic_user_ip,
			topic_publish,
			topic_publish_draft,
			topic_publish_index,
			topic_cut_text,
			topic_forbid_comment,			
			topic_text_hash			
			)
			VALUES(?d,  ?d,	?,	?,	?,  ?, ?, ?d, ?d, ?d, ?, ?, ?)
		";			
		if ($iId=$this->oDb->query($sql,$oTopic->getBlogId(),$oTopic->getUserId(),$oTopic->getType(),$oTopic->getTitle(),
			$oTopic->getTags(),$oTopic->getDateAdd(),$oTopic->getUserIp(),$oTopic->getPublish(),$oTopic->getPublishDraft(),$oTopic->getPublishIndex(),$oTopic->getCutText(),$oTopic->getForbidComment(),$oTopic->getTextHash())) 
		{
			$oTopic->setId($iId);
			$this->AddTopicContent($oTopic);
			return $iId;
		}		
		return false;
	}
 /**
  * Добавляет топик
  *
  * @param ModuleTopic_EntityTopic $oTopic Объект топика
  * @return int|bool
  */
 public function AddTopic(ModuleTopic_EntityTopic $oTopic)
 {
     $sql = "INSERT INTO " . Config::Get('db.table.topic') . "\n\t\t\t(blog_id,\n\t\t\tblog_id2,\n\t\t\tblog_id3,\n\t\t\tblog_id4,\n\t\t\tblog_id5,\n\t\t\tuser_id,\n\t\t\ttopic_type,\n\t\t\ttopic_title,\t\t\t\n\t\t\ttopic_slug,\n\t\t\ttopic_tags,\n\t\t\ttopic_date_add,\n\t\t\ttopic_date_publish,\n\t\t\ttopic_user_ip,\n\t\t\ttopic_publish,\n\t\t\ttopic_publish_draft,\n\t\t\ttopic_publish_index,\n\t\t\ttopic_skip_index,\n\t\t\ttopic_cut_text,\n\t\t\ttopic_forbid_comment,\t\t\t\n\t\t\ttopic_text_hash\t\t\t\n\t\t\t)\n\t\t\tVALUES(?d, ?d, ?d, ?d, ?d, ?d,\t?,\t?,\t?,\t?,  ?, ?, ?, ?d, ?d, ?d, ?d, ?, ?, ?)\n\t\t";
     if ($iId = $this->oDb->query($sql, $oTopic->getBlogId(), $oTopic->getBlogId2(), $oTopic->getBlogId3(), $oTopic->getBlogId4(), $oTopic->getBlogId5(), $oTopic->getUserId(), $oTopic->getType(), $oTopic->getTitle(), $oTopic->getSlug(), $oTopic->getTags(), $oTopic->getDateAdd(), $oTopic->getDatePublish(), $oTopic->getUserIp(), $oTopic->getPublish(), $oTopic->getPublishDraft(), $oTopic->getPublishIndex(), $oTopic->getSkipIndex(), $oTopic->getCutText(), $oTopic->getForbidComment(), $oTopic->getTextHash())) {
         $oTopic->setId($iId);
         $this->AddTopicContent($oTopic);
         return $iId;
     }
     return false;
 }
Example #3
0
 /**
  * Добавляет топик
  *
  * @param ModuleTopic_EntityTopic $oTopic    Объект топика
  *
  * @return int|bool
  */
 public function AddTopic(ModuleTopic_EntityTopic $oTopic)
 {
     $sql = "INSERT INTO ?_topic (\n                blog_id,\n                user_id,\n                topic_type,\n                topic_title,\n                topic_tags,\n                topic_date_add,\n                topic_date_show,\n                topic_user_ip,\n                topic_publish,\n                topic_publish_draft,\n                topic_publish_index,\n                topic_cut_text,\n                topic_forbid_comment,\n                topic_text_hash,\n                topic_url,\n                topic_index_ignore\n\t\t\t)\n\t\t\tVALUES (\n                ?d:blog_id,\n                ?d:user_id,\n                ?:topic_type,\n                ?:topic_title,\n                ?:topic_tags,\n                ?:topic_date_add,\n                ?:topic_date_show,\n                ?:topic_user_ip,\n                ?d:topic_publish,\n                ?d:topic_publish_draft,\n                ?d:topic_publish_index,\n                ?:topic_cut_text,\n                ?d:topic_forbid_comment,\n                ?:topic_text_hash,\n                ?:topic_url,\n                ?d:topic_index_ignore\n\t\t\t)\n\t\t";
     $nId = $this->oDb->sqlQuery($sql, array(':blog_id' => $oTopic->getBlogId(), ':user_id' => $oTopic->getUserId(), ':topic_type' => $oTopic->getType(), ':topic_title' => $oTopic->getTitle(), ':topic_tags' => $oTopic->getTags(), ':topic_date_add' => $oTopic->getDateAdd(), ':topic_date_show' => $oTopic->getDateShow(), ':topic_user_ip' => $oTopic->getUserIp(), ':topic_publish' => $oTopic->getPublish() ? 1 : 0, ':topic_publish_draft' => $oTopic->getPublishDraft() ? 1 : 0, ':topic_publish_index' => $oTopic->getPublishIndex() ? 1 : 0, ':topic_cut_text' => $oTopic->getCutText(), ':topic_forbid_comment' => $oTopic->getForbidComment(), ':topic_text_hash' => $oTopic->getTextHash(), ':topic_url' => $oTopic->getTopicUrl(), ':topic_index_ignore' => $oTopic->getTopicIndexIgnore()));
     if ($nId) {
         $oTopic->setId($nId);
         $this->AddTopicContent($oTopic);
         return $nId;
     }
     return false;
 }