Пример #1
0
 /**
  * update the passed topic
  *
  * @param type $topic_id the id of the topic to update
  * @param type $name the new name
  * @param type $content the new content
  *
  * @return void
  */
 static function update($topic_id, $name, $content)
 {
     $topic = ForumEntry::getConstraints($topic_id);
     if (time() - $topic['mkdate'] > 5 * 60) {
         $content = ForumEntry::appendEdit($content);
     }
     $stmt = DBManager::get()->prepare("UPDATE forum_entries\n            SET name = ?, content = ?, chdate = UNIX_TIMESTAMP(), latest_chdate = UNIX_TIMESTAMP()\n            WHERE topic_id = ?");
     $stmt->execute(array($name, transformBeforeSave($content), $topic_id));
     // update "latest_chdate" for easier sorting of actual threads
     $parent_id = ForumEntry::getParentTopicId($topic_id);
     DBManager::get()->exec("UPDATE forum_entries SET latest_chdate = UNIX_TIMESTAMP()\n            WHERE topic_id = '" . $parent_id . "'");
 }