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


PHP Comments::update方法代码示例

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


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

示例1: update

 public function update()
 {
     Response::header('Content-Type', 'application/json');
     // process post request
     if (Input::method() == 'POST') {
         Comments::update();
     }
 }
开发者ID:reqshark,项目名称:anchor-cms,代码行数:8,代码来源:comments.php

示例2: editCommentAction

 public function editCommentAction(Episodes $episode, Comments $comment)
 {
     if ($this->request->isPost()) {
         $comment->update($this->request->getPost());
         return $this->redirectByRoute(['for' => 'movies.showEpisode', 'movie' => $episode->getMovie()->id, 'episode' => $episode->id]);
     }
     $this->view->comment = $comment;
     $this->view->form = myForm::buildCommentForm($episode, $comment);
 }
开发者ID:huoybb,项目名称:movie,代码行数:9,代码来源:EpisodesController.php

示例3: editCommentAction

 public function editCommentAction(Sites $site, Comments $comment)
 {
     if ($this->request->isPost()) {
         $comment->update($this->request->getPost());
         $this->redirectByRoute(['for' => 'sites.show', 'site' => $site->id]);
     }
     $this->view->comment = $comment;
     $this->view->form = myForm::buildCommentForm($site, $comment);
 }
开发者ID:huoybb,项目名称:movie,代码行数:9,代码来源:SitesController.php

示例4: editCommentAction

 public function editCommentAction(Tags $tag, Comments $comment)
 {
     if ($this->request->isPost()) {
         $comment->update($this->request->getPost());
         return $this->success();
     }
     $this->view->mytag = $tag;
     $this->view->comment = $comment;
     $this->view->form = myForm::buildCommentForm($tag, $comment);
     //        dd($this->view->form);
 }
开发者ID:huoybb,项目名称:standard,代码行数:11,代码来源:TagsController.php

示例5: modify_comments_sorting

 function modify_comments_sorting(&$parent, &$count = 0, $lookup_id = '')
 {
     $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
     mysql_select_db(DB_NAME);
     if (empty($lookup_id)) {
         $query = "select id from " . TABLE_PREFIX . "project_objects where parent_id='" . $parent->getId() . "' and parent_type='" . $parent->getType() . "' and type='Comment' and (integer_field_2 is null or integer_field_2='0') order by created_on asc";
     } else {
         $query = "select id from " . TABLE_PREFIX . "project_objects where parent_id='" . $parent->getId() . "' and parent_type='" . $parent->getType() . "' and type='Comment' and integer_field_2='" . $lookup_id . "' order by created_on asc";
     }
     $result = mysql_query($query, $link);
     while ($entry = mysql_fetch_assoc($result)) {
         Comments::modify_comments_sorting($parent, $count, $entry['id']);
         $sql_data = array('position' => ++$count);
         Comments::update($sql_data, "id='" . $entry['id'] . "'", TABLE_PREFIX . 'project_objects');
     }
     mysql_close($link);
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:17,代码来源:Comments.class.php

示例6: actionProcess

function actionProcess()
{
    $id = Request::get('id');
    if (!isset($id[0])) {
        return false;
    }
    $listID = "'" . implode("','", $id) . "'";
    $action = Request::get('action');
    // die($action);
    switch ($action) {
        case 'delete':
            Comments::remove($id);
            break;
        case 'publish':
            Comments::update($id, array('status' => 1));
            break;
        case 'unpublish':
            Comments::update($id, array('status' => 0));
            break;
    }
}
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:21,代码来源:comments.php

示例7: saveComment

 /**
  * Save a user's comment to the database.
  *
  * @param object $user User whose comment is being saved.
  *
  * @return bool        True for success, false for failure.
  * @access public
  */
 public static function saveComment($user)
 {
     // What record are we operating on?
     if (!isset($_GET['id'])) {
         return false;
     }
     if ($_REQUEST['commentId'] == 0) {
         $searchObject = SearchObjectFactory::initSearchObject();
         $query = 'local_ids_str_mv:"' . addcslashes($_GET['id'], '"') . '"';
         $searchObject->disableLogging();
         $searchObject->setQueryString($query);
         $result = $searchObject->processSearch();
         $searchObject->close();
         if (PEAR::isError($result)) {
             PEAR::raiseError($result->getMessage());
         }
         if ($result['response']['numFound'] == 0) {
             $idArray = array($_GET['id']);
         } else {
             $idArray = $result['response']['docs'][0]["local_ids_str_mv"];
         }
         if ($_REQUEST['type'] == 1) {
             $commentsByUser = new Comments();
             $commentList = $commentsByUser->getComments($_REQUEST['recordId']);
             foreach ($commentList as $comment) {
                 if ($comment->user_id == $user->id) {
                     return false;
                 }
             }
         }
         $comments = new Comments();
         $comments->user_id = $user->id;
         $rating = isset($_REQUEST['rating']) ? (double) $_REQUEST['rating'] : 0;
         $comments->rating = $rating > 0 && $rating <= 5 ? $rating : null;
         $comments->comment = $_REQUEST['comment'];
         $comments->type = $_REQUEST['type'];
         $comments->created = date('Y-m-d H:i:s');
         $comments->insert();
         $comments->addLinks($idArray);
         return true;
     } else {
         $comments = new Comments();
         $comments->get($_REQUEST['commentId']);
         if ($comments->user_id == $user->id) {
             $comments->comment = $_REQUEST['comment'];
             $comments->rating = $_REQUEST['rating'];
             $comments->updated = date('Y-m-d H:i:s');
             $comments->update();
             return true;
         }
         return false;
     }
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:61,代码来源:UserComments.php

示例8: validateRoute

     break;
 case validateRoute('GET', 'torrents/\\d+/comments'):
     $torrent = new Torrent($db, $user);
     $comments = new Comments($db, $user, $torrent);
     list($result, $totalCount) = $comments->query((int) $params[1], (int) $_GET["limit"] ?: 10, (int) $_GET["index"] ?: 0);
     httpResponse($result, $totalCount);
     break;
 case validateRoute('POST', 'torrents/\\d+/comments'):
     $torrent = new Torrent($db);
     $comments = new Comments($db, $user, $torrent);
     $comments->add((int) $params[1], $postdata["data"]);
     httpResponse($result, $totalCount);
     break;
 case validateRoute('PATCH', 'torrents/\\d+/comments/\\d+'):
     $comments = new Comments($db, $user);
     $comments->update((int) $params[1], (int) $params[3], $postdata["postData"]);
     httpResponse($result, $totalCount);
     break;
 case validateRoute('DELETE', 'torrents/\\d+/comments/\\d+'):
     $torrent = new Torrent($db, $user);
     $comments = new Comments($db, $user, $torrent);
     $comments->delete((int) $params[3]);
     httpResponse();
     break;
 case validateRoute('GET', 'torrents/toplists'):
     $cacheId = 'toplists-' . $_GET["limit"];
     if ($memcache && ($cached = $memcache->get($cacheId))) {
         httpResponse($cached);
     } else {
         $torrent = new Torrent($db);
         $toplists = $torrent->getToplists($_GET["limit"] ?: 15);
开发者ID:lordgabber,项目名称:rartracker,代码行数:31,代码来源:api-v1.php

示例9: add

 /**
  * Create new comment
  *
  * @param void
  * @return null
  */
 function add()
 {
     $this->wireframe->print_button = false;
     $active_object = ProjectObjects::findById($this->request->getId('parent_id'));
     if (!instance_of($active_object, 'ProjectObject')) {
         $this->httpError(HTTP_ERR_NOT_FOUND, null, true, $this->request->isApiCall());
     }
     // if
     if (!$active_object->canComment($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN, null, true, $this->request->isApiCall());
     }
     // if
     $active_object->prepareProjectSectionBreadcrumb($this->wireframe);
     $this->wireframe->addBreadCrumb($active_object->getName(), $active_object->getViewUrl());
     if (!$active_object->canComment($this->logged_user)) {
         if ($this->request->isApiCall()) {
             $this->httpError(HTTP_ERR_FORBIDDEN, null, true, true);
         } else {
             flash_error('Parent object not found');
             $this->redirectToReferer($this->active_project->getOverviewUrl());
         }
         // if
     }
     // if
     $comment_data = $this->request->post('comment');
     $this->smarty->assign(array('active_object' => $active_object, 'page_tab' => $active_object->getProjectTab(), 'comment_data' => $comment_data, 'recent_comments' => Comments::findRecentObject($active_object, 5, STATE_VISIBLE, $this->logged_user->getVisibility())));
     if ($this->request->isSubmitted()) {
         db_begin_work();
         $complete_parent_object = (bool) array_var($comment_data, 'complete_parent_object');
         $this->active_comment = new Comment();
         $this->active_comment->log_activities = false;
         if ($complete_parent_object) {
             $this->active_comment->send_notification = false;
         }
         // if
         attach_from_files($this->active_comment, $this->logged_user);
         $this->active_comment->setAttributes($comment_data);
         $this->active_comment->setParent($active_object);
         $this->active_comment->setProjectId($this->active_project->getId());
         $this->active_comment->setState(STATE_VISIBLE);
         $this->active_comment->setVisibility($active_object->getVisibility());
         if (trim($this->active_comment->getCreatedByName()) == '' || trim($this->active_comment->getCreatedByEmail()) == '') {
             $this->active_comment->setCreatedBy($this->logged_user);
         }
         // if
         $save = $this->active_comment->save();
         if ($save && !is_error($save)) {
             $active_object->subscribe($this->logged_user);
             $activity = new NewCommentActivityLog();
             $activity->log($this->active_comment, $this->logged_user);
             if ($complete_parent_object && $active_object->canChangeCompleteStatus($this->logged_user)) {
                 $active_object->complete($this->logged_user, $this->active_comment->getFormattedBody(true));
             }
             // if
             db_commit();
             $this->active_comment->ready();
             //BOF: mod
             $subscribers_to_notify = array_var($comment_data, 'subscribers_to_notify');
             $action_request_user_id = array_var($comment_data, 'action_request');
             //$priority_actionrequest = array_var($comment_data, 'priority_actionrequest');
             //BOF:mod 20110517
             if ($complete_parent_object) {
                 $subscribers_to_notify = array();
                 $action_request_user_id = array();
             }
             //EOF:mod 20110517
             //BOF:mod 20110719
             /*
             //EOF:mod 20110719
             if (!empty($action_request_user_id)){
                 $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
                 mysql_select_db(DB_NAME);
                 foreach ($action_request_user_id as $id){
                     $query = "select * from healingcrystals_assignments_action_request where comment_id='" . $this->active_comment->getId() . "' and selected_by_user_id='" . $this->logged_user->getId() . "' and user_id='" . $id . "'";
             						$result = mysql_query($query);
             						if (mysql_num_rows($result)){
                         $query = "update healingcrystals_assignments_action_request set is_action_request='1' where comment_id='" . $this->active_comment->getId() . "' and selected_by_user_id='" . $this->logged_user->getId() . "' and user_id='" . $id . "'";
                         mysql_query($query);
             						} else {
                         $query = "insert into healingcrystals_assignments_action_request (user_id, is_action_request, is_fyi, selected_by_user_id, comment_id, date_added) values ('" . $id . "', '1', '0', '" . $this->logged_user->getId() . "', '" . $this->active_comment->getId() . "', now())";
                         mysql_query($query);
                     }
                 }
             
                 foreach($priority_actionrequest as $val){
                     $temp = explode('_', $val);
             						list($temp_user_id, $priority) = $temp;
             						if (in_array($temp_user_id, $action_request_user_id)){
                         $query = "update healingcrystals_assignments_action_request set priority_actionrequest='" . $priority . "' where comment_id='" . $this->active_comment->getId() . "' and selected_by_user_id='" . $this->logged_user->getId() . "' and user_id='" . $temp_user_id . "'";
                         mysql_query($query);
             						}
                 }
                 mysql_close($link);
             }
//.........这里部分代码省略.........
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:101,代码来源:CommentsController.class.php

示例10: function

Route::get('comments/paginate/{foreignType}/{foreignId}', function ($foreignType, $foreignId) {
    return Comments::paginate($foreignType, $foreignId)->setPath(Request::url());
});
Route::post('comments/store', ['as' => 'comments.store', 'middleware' => 'csrf', 'uses' => function () {
    $foreignType = Input::get('foreigntype');
    $foreignId = Input::get('foreignid');
    return Comments::store($foreignType, $foreignId);
}]);
Route::get('comments/{id}', function ($id) {
    return Comments::get($id);
});
Route::get('comments/{id}/edit', ['as' => 'comments.edit', 'uses' => function ($id) {
    return Comments::edit($id);
}]);
Route::put('comments/{id}/update', ['as' => 'comments.update', 'middleware' => 'csrf', 'uses' => function ($id) {
    return Comments::update($id);
}]);
Route::delete('comments/{id}/delete', ['as' => 'comments.delete', 'middleware' => 'csrf', 'uses' => function ($id) {
    return Comments::delete($id);
}]);
/*
 * Ratings
 */
Route::post('ratings/store', ['as' => 'ratings.store', 'middleware' => 'csrf', 'uses' => function () {
    $foreignType = Input::get('foreigntype');
    $foreignId = Input::get('foreignid');
    return Ratings::store($foreignType, $foreignId);
}]);
/*
 * Captcha
 */
开发者ID:chirilo,项目名称:Contentify,代码行数:31,代码来源:routes.php

示例11: editCommentAction

 public function editCommentAction(Files $file, Comments $comment)
 {
     if ($this->request->isPost()) {
         $data = $this->request->getPost();
         if ($comment->update($data)) {
             return $this->success();
         }
         dd('评论更新失败');
     }
     $this->view->file = $file;
     $this->view->comment = $comment;
     $this->view->form = myForm::buildCommentForm($file, $comment);
 }
开发者ID:huoybb,项目名称:standard,代码行数:13,代码来源:StandardsController.php

示例12: editCommentAction

 public function editCommentAction(Movies $movie, Comments $comment)
 {
     //这里应该用中间件将这种验证抽出去
     //        if(!$this->auth->has($comment)) dd('你没有去权利修改该评论,只有原作者:'.$comment->user()->name.'才能修改');
     //        dd($comment->getEditURL());
     if ($this->request->isPost()) {
         $data = $this->request->getPost();
         $comment->update($data);
         return $this->redirectByRoute(['for' => 'movies.show', 'movie' => $movie->id]);
     }
     $this->view->movie = $movie;
     $this->view->form = myForm::buildCommentForm($movie, $comment);
 }
开发者ID:huoybb,项目名称:movie,代码行数:13,代码来源:MoviesController.php


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