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


PHP Thread::update方法代码示例

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


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

示例1: update

 public function update($queryString)
 {
     $user_name = $_POST['user_name'];
     $user_email = $_POST['user_email'];
     $thread_topic = $_POST['thread_topic'];
     $thread_content = $_POST['thread_content'];
     Thread::update($queryString, $user_name, $user_email, $thread_topic, $thread_content);
     header("Location: index.php");
 }
开发者ID:rahmanadianto,项目名称:IF3110-2015-T1,代码行数:9,代码来源:class.threadcontroller.php

示例2: updateThread

 public static function updateThread($id)
 {
     $params = $_POST;
     $oldThread = new Thread(Thread::find($id));
     $attributes = $oldThread->asArray();
     $attributes['id'] = $id;
     $attributes['name'] = $params['name'];
     $thread = new Thread($attributes);
     $errors = $thread->errors();
     if (count($errors) == 0) {
         $thread->update();
         Redirect::to('/thread/' . $id);
     } else {
         $thread = Thread::find($id);
         View::make('thread/thread_edit.html', array('errors' => $errors, 'thread' => $thread, 'attributes' => $attributes));
     }
 }
开发者ID:CarnivoreBarnacle,项目名称:Forum,代码行数:17,代码来源:thread_controller.php

示例3: edit

 public static function edit($thread_id, $post_id)
 {
     // begin
     if ($_SESSION[KEY_SESSION][Account::KEY_USERNAME] == "guest") {
         Utils::showNoPermissionPage();
         die;
     }
     // end
     $isMobile = Utils::is_mobile();
     $thread = new Thread();
     $error_message = "";
     $textarea_title = "";
     $textarea_content = "";
     $thread->initWithId($thread_id);
     $post = $thread->getPostById($post_id);
     if (!empty($_POST) && $post->getAuthor()->getId() == $_SESSION[KEY_SESSION][Account::KEY_ID]) {
         // update post
         $title = $_POST["title"];
         $update_time = Utils::getCurrentTime();
         $update_date = Utils::getCurrentDate();
         $latest_update = time();
         $content = $_POST["content"];
         $permission = $_POST["permission"];
         $title_len = strlen($title);
         $content_len = 0;
         if ($isMobile) {
             $content = preg_replace("/<br \\/>|<br\\/>|<br>/", '', $content);
             $content = preg_replace("/\r\n|\r|\n/", '<br />', $content);
             $content_len = strlen($content);
         } else {
             $content_len = Utils::textLength($content);
         }
         if ($content_len > 5 && $title_len > 5) {
             // success
             if ($thread->getHost()->getId() == $_SESSION[KEY_SESSION][Account::KEY_ID] && in_array($permission, Thread::$PERMISSIONS)) {
                 $thread->update($post_id, $title, $update_time, $update_date, $latest_update, $content, $permission);
             } else {
                 $thread->update($post_id, $title, $update_time, $update_date, $latest_update, $content, $thread->getPermission());
             }
             header("Location: /thread/" . $thread_id);
             unset($thread);
             unset($post_id);
             unset($thread_id);
             die;
         } else {
             // fail
             $error_message = "コンテンツ文字数は必ず5文字以上でなければいけません。";
             $textarea_content = $content;
             $textarea_title = $title;
         }
     } 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;
         }
         $textarea_title = $thread->getTitle();
         $textarea_content = $post->getContent();
     }
     $textarea_content = preg_replace('/src="\\/?uploadManager\\//', " src=\"/common/uploadManager/", $textarea_content);
     if (get_magic_quotes_gpc()) {
         $textarea_content = stripslashes($textarea_content);
     }
     $textarea_content = new HTML_To_Markdown($textarea_content);
     $textarea_content = preg_replace_callback('/\\!\\[(.*?)\\]\\((.*?) \\"(.*?)\\"\\)/', function ($m) {
         $m[2] = preg_replace("/\\s/", "%20", $m[2]);
         return "![{$m['1']}]({$m['2']} \"{$m['3']}\")";
     }, $textarea_content);
     $content = "edit.php";
     include VIEWS_PATH . "private-nav.php";
     include VIEWS_PATH . "thread/thread.php";
 }
开发者ID:plainbanana,项目名称:eicforum,代码行数:75,代码来源:thread.php

示例4: Thread

include __DIR__ . "/parts/sign_in_form.php";
require_once __DIR__ . '/../class/thread.php';
$get_id = filter_input(INPUT_GET, "id");
$action = $_SERVER['REQUEST_METHOD'];
if ($get_action = filter_input(INPUT_POST, "action")) {
    $action = filter_input(INPUT_POST, "action");
}
switch ($action) {
    case 'POST':
        $title = filter_input(INPUT_POST, "title");
        $text = filter_input(INPUT_POST, "text");
        $thread = new Thread();
        if ($get_id) {
            //既存をupdate
            $params = array('thread_id' => $get_id, 'title' => $title, 'text' => $text);
            $thread->update($params);
        } else {
            //新規をPOST
            $user_id = $_SESSION["user_id"];
            $params = array('user_id' => $user_id, 'title' => $title, 'text' => $text);
            $get_id = $thread->add($params);
        }
        break;
    case 'delete':
        print $action;
        if ($get_id) {
            //DELETE
            $thread = new Thread();
            $thread->deleteRow($get_id);
            header('Location: /bbs/');
            exit;
开发者ID:nagamoto,项目名称:php_bbs,代码行数:31,代码来源:threads.php


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