当前位置: 首页>>代码示例>>PHP>>正文


PHP forum::update_change_time方法代码示例

本文整理汇总了PHP中forum::update_change_time方法的典型用法代码示例。如果您正苦于以下问题:PHP forum::update_change_time方法的具体用法?PHP forum::update_change_time怎么用?PHP forum::update_change_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在forum的用法示例。


在下文中一共展示了forum::update_change_time方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add_reply

 /**
  * Legg til nytt forumsvar
  * @param string $text
  * @param boolean $no_concatenate ikke sammenslå med evt. forrige forumsvar
  * @param boolean $announce annonser på IRC/spilleloggen
  */
 public function add_reply($text, $no_concatenate, $announce)
 {
     if (!\login::$logged_in) {
         throw new HSNotLoggedIn();
     }
     // er forumtråden låst?
     if ($this->info['ft_locked'] != 0 && !$this->forum->fmod) {
         $this->add_reply_error_locked();
         return;
     }
     // er forumtråden slettet?
     if ($this->info['ft_deleted'] != 0) {
         $this->add_reply_error_deleted();
         return;
     }
     // kontroller blokkering
     if ($this->forum->check_block()) {
         return;
     }
     // kontroller ventetid før nytt forumsvar kan legges til
     $this->forum->check_timers();
     if ($this->forum->wait_reply > 0) {
         $this->add_reply_error_wait($this->forum->wait_reply);
         return;
     }
     // kontroller tekstlengde
     $text = trim($text);
     if (\Kofradia\Forum\Category::check_length($text) < \Kofradia\Forum\Category::REPLY_MIN_LENGTH) {
         $this->add_reply_error_length();
         return;
     }
     // sjekk om vi skal sammenslå dette med det siste forumsvaret
     if (!$no_concatenate) {
         // hent siste forumsvaret
         $result = \Kofradia\DB::get()->query("SELECT fr_id, fr_up_id, fr_time FROM forum_replies WHERE fr_ft_id = {$this->id} AND fr_deleted = 0 ORDER BY fr_time DESC LIMIT 1");
         $row = $result->fetch();
         // fant forumsvar, og tilhører brukeren
         // forumsvaret er nyere enn 6 timer
         if ($row && $row['fr_up_id'] == \login::$user->player->id && time() - $row['fr_time'] < 21600) {
             // slå sammen med dette forumsvaret
             $text = "\n\n[hr]\n\n{$text}";
             \Kofradia\DB::get()->exec("UPDATE forum_replies SET fr_text = CONCAT(fr_text, " . \Kofradia\DB::quote($text) . "), fr_last_edit = " . time() . ", fr_last_edit_up_id = " . \login::$user->player->id . " WHERE fr_id = {$row['fr_id']}");
             // annonsere forumsvaret?
             if ($announce && ($reply = $this->get_reply($row['fr_id']))) {
                 $reply->announce();
             }
             // logg
             \Kofradia\Forum\Log::add_reply_concatenated($this, $row['fr_id']);
             $this->add_reply_merged($row['fr_id']);
             return;
         }
     }
     // legg til som nytt forumsvar
     \Kofradia\DB::get()->exec("INSERT INTO forum_replies SET fr_time = " . time() . ", fr_up_id = " . \login::$user->player->id . ", fr_text = " . \Kofradia\DB::quote($text) . ", fr_ft_id = {$this->id}");
     $reply_id = \Kofradia\DB::get()->lastInsertId();
     // oppdater forumtråden med antall forumsvar og siste forumsvar
     \Kofradia\DB::get()->exec("UPDATE forum_topics SET ft_replies = ft_replies + 1, ft_last_reply = {$reply_id} WHERE ft_id = {$this->id}");
     // oppdater spilleren
     if ($this->forum->ff) {
         \Kofradia\DB::get()->exec("UPDATE ff_members SET ffm_forum_replies = ffm_forum_replies + 1 WHERE ffm_up_id = " . \login::$user->player->id . " AND ffm_ff_id = {$this->forum->ff->id}");
         \Kofradia\DB::get()->exec("UPDATE users_players SET up_forum_ff_num_replies = up_forum_ff_num_replies + 1 WHERE up_id = " . \login::$user->player->id);
     } else {
         \Kofradia\DB::get()->exec("UPDATE users, users_players SET up_forum_num_replies = up_forum_num_replies + 1, u_forum_reply_time = " . time() . " WHERE up_id = " . \login::$user->player->id . " AND up_u_id = u_id");
     }
     // annonsere forumsvaret?
     if ($announce && ($reply = $this->get_reply($reply_id))) {
         $reply->announce();
     }
     // oppdater tid om nødvendig
     $this->forum->update_change_time();
     // logg
     \Kofradia\Forum\Log::add_reply_added($this, $reply_id);
     // fullført
     $this->add_reply_complete($reply_id);
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:81,代码来源:Topic.php


注:本文中的forum::update_change_time方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。