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


PHP Thread::delete方法代码示例

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


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

示例1: delete

 public static function delete($thread_id, $post_id)
 {
     // begin
     if ($_SESSION[KEY_SESSION][Account::KEY_USERNAME] == "guest") {
         Utils::showNoPermissionPage();
         die;
     }
     // end
     $thread = new Thread();
     $thread->initWithId($thread_id);
     $post = $thread->getPostById($post_id);
     if (!empty($_GET["confirm"]) && $_GET["confirm"] == "true") {
         // delete post, if current person is thread's host, delete thread as well
         if ($post->getAuthor()->getId() == $_SESSION[KEY_SESSION][Account::KEY_ID]) {
             $redirect_to = "/thread/";
             // it means host thread
             if ($post->isHost()) {
                 $thread->delete();
                 $post->delete();
             } else {
                 $post->delete();
                 $latest_update = Post::getLastModifiedPost($thread_id)->getModifiedTime();
                 $dt = new DateTime();
                 $dt->setTimestamp($latest_update);
                 $update_time = $dt->format("g:iA");
                 $update_date = $dt->format("Y/m/d");
                 $thread->updateUpdateTime($update_time, $update_date, $latest_update);
                 $redirect_to .= $thread_id;
             }
             header("Location: " . $redirect_to);
             die;
         } else {
             // you are not the owner of the post, you don't have the permission to alter
             Utils::showNoPermissionPage();
             include VIEWS_PATH . "private-nav.php";
             include VIEWS_PATH . "thread/thread.php";
             die;
         }
     } else {
         // get request
         $thread->initWithId($thread_id);
         $post = $thread->getPostById($post_id);
     }
     $permission = $thread->getPermission();
     if (!self::checkingPermission($thread_id, $post_id, $permission) || !($_SESSION[KEY_SESSION][Account::KEY_ID] == $post->getAuthor()->getId())) {
         Utils::showNoPermissionPage();
         return;
     }
     $content = "delete.php";
     include VIEWS_PATH . "private-nav.php";
     include VIEWS_PATH . "thread/thread.php";
 }
开发者ID:plainbanana,项目名称:eicforum,代码行数:52,代码来源:thread.php

示例2: destroyThread

 public static function destroyThread($id)
 {
     $thread = new Thread(Thread::find($id));
     $thread->delete();
     Redirect::to('/thread', array('message' => 'Thread deleted.'));
 }
开发者ID:CarnivoreBarnacle,项目名称:Forum,代码行数:6,代码来源:thread_controller.php

示例3: delete

 public function delete($queryString)
 {
     Thread::delete($queryString);
     header("Location: index.php");
 }
开发者ID:rahmanadianto,项目名称:IF3110-2015-T1,代码行数:5,代码来源:class.threadcontroller.php

示例4: delete

 public function delete()
 {
     $thread_id = Param::get('thread_id');
     authorize_user_request($thread_id, self::AUTH_THREAD_DELETE);
     $user_id = get_authenticated_user_id($_SESSION['userid']);
     try {
         Thread::delete($thread_id);
     } catch (PDOException $e) {
         $_SESSION['deleteHasError'] = true;
     }
     $page_to_go = Param::get('page');
     if ($page_to_go === self::PROFILE_PAGE) {
         redirect(PROFILE_PAGE, array("user_id" => $user_id));
     }
     redirect(THREAD_PAGE);
 }
开发者ID:renzosunico,项目名称:MyClassroom,代码行数:16,代码来源:thread_controller.php


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