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


PHP Comment::deleteComment方法代码示例

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


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

示例1: actionDeleteComment

 public function actionDeleteComment()
 {
     if (empty($_POST['id']) || !App::isAdmin()) {
         return $this->redirect('/article');
     }
     $currentArticleUrl = Article::findById(Comment::findById($_POST['id'])->article_id)->url;
     Comment::deleteComment($_POST['id']);
     $this->redirect('/article/show/' . $currentArticleUrl);
 }
开发者ID:ArtemRochev,项目名称:MVC-Framework,代码行数:9,代码来源:ControllerArticle.php

示例2: deleteComment

 public function deleteComment()
 {
     $msg = "";
     $id = $_GET['id'];
     $comment = new Comment();
     $comment->setIdAvis($id);
     $delComment = $comment->deleteComment();
     $msg .= '<div class="alert alert-success">';
     $msg .= 'Avis supprimé !';
     $msg .= '</div>';
     include "views/comments/deleteComment.php";
 }
开发者ID:GiGis971,项目名称:evoyage,代码行数:12,代码来源:comments.php

示例3: handleRequest

 public function handleRequest($command, $comment)
 {
     switch ($command) {
         case 'set':
             $response = Comment::setComment($comment);
             break;
         case 'delete':
             $response = Comment::deleteComment($comment);
             break;
         default:
             throw new Exception("Unsupported property!");
             break;
     }
     if (empty($response)) {
         $response = false;
     }
     $formattedResponse = Comment::formatResponse($response);
     render('comment', array('comments' => $formattedResponse));
 }
开发者ID:rquiring,项目名称:klipsmobile,代码行数:19,代码来源:comment.controller.php

示例4: setComment

 public static function setComment($inputcomment)
 {
     global $db;
     $user = $_SESSION['username'];
     try {
         extract($inputcomment);
         $qdate = dateStripSlashes($date);
         //check if comment for specific lecture and date already in database
         $st = $db->query(utf8_encode("SELECT * FROM zusatz \n\t\t\t\t WHERE \t`user` LIKE '{$user}' AND\n\t\t\t\t \t\t`veranstaltungsID` = '{$id}' AND\n\t\t\t\t\t\t`datum` = '{$qdate}'"));
         $qresponse = $st->fetchAll();
         //if comment already exists, delete...
         if (!empty($qresponse)) {
             $r = Comment::deleteComment($inputcomment);
             if (!$r) {
                 throw new Exception('Unknown Error');
             }
         }
         //...and (over)write
         $st = $db->exec(utf8_encode("INSERT INTO zusatz (user, veranstaltungsID, titel, datum) VALUES ('{$user}', '{$id}', '{$comment}', '{$qdate}')"));
         return true;
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:rquiring,项目名称:klipsmobile,代码行数:24,代码来源:comment.model.php

示例5: deleteComment

function deleteComment()
{
    $comment = new Comment();
    $comment->deleteComment($_POST['cId']);
}
开发者ID:neequole,项目名称:sp2,代码行数:5,代码来源:commentFunc.php

示例6: printf

$users = DocumentsManager::showUsers();
while ($row = $users->fetch_assoc()) {
    printf("%s\n", $row['username']);
}
////////////////////////////
//Comment UNIT TESTS
////////////////////////////
printf("/////////////////////////////////\n");
printf("STARTING Comment UNIT TESTS\n");
printf("/////////////////////////////////\n");
//construct empty comment
$comment = new Comment();
//add comment
$comment->createComment(1083097730, "kmassey", "I love this studyguide.");
//delete comment
$comment->deleteComment();
//fetch existing comment
$comment2 = new Comment(255494673);
//fetch body of existing comment
$comment_body = $comment2->getCommentBody();
printf("Fetched Comment: %s\n", $comment_body);
//block comment
printf("Blocking comment %d\n", 255494673);
$comment2->block();
$isBlocked = $comment2->isBlocked();
$bool_str = $isBlocked ? "true" : "false";
printf("Comment %d is blocked:  %s\n", 255494673, $bool_str);
//unblock comment
printf("Unblocking comment %d\n", 255494673);
$comment2->unblock();
$isBlocked = $comment2->isBlocked();
开发者ID:anokbakn,项目名称:StudyHall,代码行数:31,代码来源:index.php

示例7: deleteTrashComments

 /**
  * Delete all comments marked as trash from a given module.
  * @param	$moduleId	Module identifier.
  */
 function deleteTrashComments($moduleId = "")
 {
     if ($this->hasDeletePermission()) {
         global $dbi;
         $result = $dbi->query("SELECT id FROM " . commentTableName . " WHERE " . (!empty($moduleId) ? "moduleId=" . $dbi->quote($moduleId) . " AND " : "") . "trash='1'");
         if ($result->rows()) {
             for ($i = 0; list($id) = $result->fetchrow_array(); $i++) {
                 $comment = new Comment($id);
                 $comment->deleteComment(true);
             }
         }
     }
 }
开发者ID:gkathir15,项目名称:catmis,代码行数:17,代码来源:Comment.class.php

示例8: Comment

require_once "../../include/common.php";
// Create Comment object
$comment = new Comment();
// Check if user has edit permission
if (!$comment->hasAdministerPermission()) {
    $login->printLoginForm();
    exit;
}
// Delete comments
$deleteComments = getValue("deleteComments");
if (!empty($deleteComments)) {
    $comments = getValue("comments");
    if (!empty($comments)) {
        for ($i = 0; $i < sizeof($comments); $i++) {
            $comment = new Comment($comments[$i]);
            $comment->deleteComment($commentType > 0 ? true : false);
        }
    }
    // Redirect
    redirect(!empty($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : scriptUrl . "/" . folderComment . "/" . folderCommentIndex);
}
// Delete spam comments
$deleteSpamComments = getPostValue("deleteSpamComments");
if (!empty($deleteSpamComments)) {
    $comment = new Comment();
    $comment->deleteSpamComments();
    // Redirect
    redirect(!empty($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : scriptUrl . "/" . folderComment . "/" . folderCommentIndex);
}
// Delete trash comments
$deleteTrashComments = getPostValue("deleteTrashComments");
开发者ID:gkathir15,项目名称:catmis,代码行数:31,代码来源:index.php

示例9: use

*/
$app->notFound(function () use($app) {
    require_once 'core/user.inc.php';
    $user = new User();
    $loggedIn = 0;
    session_start();
    if ($user->isLoggedIn()) {
        $loggedIn = 1;
    }
    $app->render('lost.php', array('loggedIn' => $loggedIn));
});
$app->post('/delete-post/:id', function ($id) use($app) {
    $req = $app->request();
    if ($req->post('delete-post')) {
        require_once 'core/post.inc.php';
        $post = new Post();
        $post->deletePost($id);
        $app->redirect('/Blog-It/me');
    }
});
$app->post('/delete-comment/:id', function ($id) use($app) {
    $req = $app->request();
    // echo $req->post('delete-comment');
    if ($req->post('delete-comment')) {
        require_once 'core/comment.inc.php';
        $post = new Comment();
        $post->deleteComment($id);
        $app->redirect("/Blog-It/post/" . $req->post('delete-comment'));
    }
});
$app->run();
开发者ID:nikhilsaldanha,项目名称:Blog-It,代码行数:31,代码来源:index.php

示例10: die

     }
     $remove = QNA::downvote($PostID, USER_ID);
     if ($remove === true) {
         die(json_encode(['status' => true]));
     }
     break;
 case 'delete':
     $CommentID = sanitize_id($data['id']);
     $comment = Comment::getComment($CommentID);
     if (!is_array($comment)) {
         die(json_encode(['status' => false, 'id' => $CommentID, 'err' => 'Comment was not found.']));
     }
     if (USER_ID !== $comment['uid']) {
         die(json_encode(['status' => false, 'id' => $CommentID, 'err' => 'Authentication error.']));
     }
     $delete = Comment::deleteComment($CommentID);
     if ($delete === true) {
         die(json_encode(['status' => true, 'id' => $CommentID]));
     } else {
         die(json_encode(['status' => false, 'id' => $CommentID, 'err' => 'Unknown error.']));
     }
     break;
 case 'edit':
     $CommentID = sanitize_id($data['id']);
     $content = $data['content'];
     $comment = Comment::getComment($CommentID);
     if (!is_array($comment)) {
         die(json_encode(['status' => false, 'id' => $CommentID, 'err' => 'Comment was not found.']));
     }
     if (USER_ID !== $comment['uid']) {
         die(json_encode(['status' => false, 'id' => $CommentID, 'err' => 'Authentication error.']));
开发者ID:khaledkhalil94,项目名称:SH.A,代码行数:31,代码来源:_comment.php

示例11: trim

<?php

require_once "../../common.php";
require_once "../classes/class.Comment.php";
if (isset($_GET['a']) && isset($_GET['c'])) {
    $articleID = trim(htmlentities($_GET['a'], ENT_QUOTES, "UTF-8"));
    $commentID = trim(htmlentities($_GET['c'], ENT_QUOTES, "UTF-8"));
    $comment = new Comment();
    $comment->deleteComment($commentID, "../article/showarticle.php?a={$articleID}");
} else {
    die("Es ist etwas schief gegangen.");
}
开发者ID:vladvoth,项目名称:crollect,代码行数:12,代码来源:deleteComment.php

示例12: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($rating_id, $id)
 {
     $result = Comment::deleteComment($rating_id, $id);
     return Response::json($result);
 }
开发者ID:anht37,项目名称:winelover_server,代码行数:11,代码来源:CommentController.php

示例13: delete

 /**
  * delete a question
  *
  * @return boolean
  */
 public function delete()
 {
     global $connection;
     $table = static::$table;
     $comments = $this->get_Qcomments();
     while ($comments) {
         $comment = array_shift($comments);
         Comment::deleteComment($comment->id);
     }
     // delete question points
     $sql = "DELETE FROM " . TABLE_POINTS . " WHERE post_id = {$this->PostID}";
     $connection->exec($sql);
     // delete the question
     //$sql = "UPDATE {$table} SET status = 0 WHERE id = {$this->PostID}";
     $sql = "DELETE FROM {$table} WHERE id = {$this->PostID}";
     $connection->exec($sql);
     return true;
 }
开发者ID:khaledkhalil94,项目名称:SH.A,代码行数:23,代码来源:QNA.php

示例14: Comment

<?php

session_start();
define('DB_NAME_FOR_COMMENTS', "{$_SESSION['const']}");
//така сама константа, значення якої беремр з $_SESSION[const]
include "Comment.class.php";
$obj = new Comment();
$id_com = $_GET['id_com'];
//отрммуємо id коментаря
$obj->deleteComment($id_com);
//видаляємо коментар
header("Location: {$_SERVER['HTTP_REFERER']}");
开发者ID:nzhovniriv,项目名称:onlinestore,代码行数:12,代码来源:delComment.php


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