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


PHP Comments::deleteComment方法代码示例

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


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

示例1: deleteAction

 public function deleteAction()
 {
     // Get, check and setup the parameters
     $comment_id = $this->getRequest()->getParam("id");
     // Get the comment and source tables
     $comments = new Comments();
     $sources = new Sources();
     // Check if the comment exist
     if (!($comment = $comments->getComment($comment_id))) {
         return $this->_helper->json->sendJson(true);
     }
     // Check if the comment belongs to the source
     if (!($source = $sources->getSource($comment->source_id))) {
         return $this->_helper->json->sendJson(true);
     }
     // Check if we are the owner of the source
     if (!($source['user_id'] == $this->_application->user->id)) {
         return $this->_helper->json->sendJson(true);
     }
     // All checks ok, we can delete !
     $comments->deleteComment($comment_id);
     return $this->_helper->json->sendJson(false);
 }
开发者ID:segphault,项目名称:storytlr,代码行数:23,代码来源:CommentsController.php

示例2: deleteAction

 public function deleteAction()
 {
     if (!$this->_authenticateUser()) {
         return;
     }
     // Get the item
     $item = $this->_getItemByIri($this->_getItemIri('item'));
     if (!$this->_isItemExists($item)) {
         return;
     }
     // Get the comment
     $comment = $this->_getCommentByIri($this->getRequest()->getParam('commentid'));
     if ($comment instanceof Comment) {
         // Delete the comment
         $comments = new Comments();
         $comments->setUser($this->_application->user);
         $comments->deleteComment($comment->getCommentId());
         // Set responses and response code
         $this->_buildResponse(Api_BaseController::HTTP_SUCCESS);
         return;
     }
     // Set responses and response code
     $this->_buildResponse(Api_BaseController::HTTP_FAILED, 'Comment does not exists');
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:24,代码来源:CommentsController.php

示例3: elseif

} elseif (isset($_GET['action']) && $_GET['action'] == 'comment_delete') {
    // Include and instantiate the comment class
    include_once 'comments.inc.php';
    $comments = new Comments();
    echo $comments->confirmDelete($_GET['id']);
    // If the confirmDelete() form was submitted, handle it here.
} elseif ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['action'] == 'comment_delete') {
    // If set, store the entry from which we came.
    $loc = isset($_POST['url']) ? $_POST['url'] : '/';
    // If the user clicked yes, continue with deletion.
    if ($_POST['confirm'] == "Yes") {
        // Include and instantiate the comments class.
        include_once 'comments.inc.php';
        $comments = new Comments();
        // Delete the comment and return to the entry
        if ($comments->deleteComment($_POST['id'])) {
            header('Location: ' . $loc);
            exit;
        } else {
            exit('Could not delete the comment.');
        }
    } else {
        header('Location: ' . $loc);
        exit;
    }
} elseif ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['action'] == 'login' && !empty($_POST['username']) && !empty($_POST['password'])) {
    // Connect to the database.
    include_once 'db.inc.php';
    $db = new PDO(DB_INFO, DB_USER, DB_PASS);
    $sql = "SELECT COUNT(*) AS num_users\n            FROM admin\n            WHERE username=?\n            AND password=SHA1(?)";
    $stmt = $db->prepare($sql);
开发者ID:n-vlad,项目名称:Blog,代码行数:31,代码来源:update.inc.php

示例4: Comments

                    break;
                case 'verify':
                    $check = $obj->verifyUser($_POST);
                    break;
                default:
                    $check = false;
                    break;
            }
            $header = $check === true ? 'Location: /admin/' : "Location: /{$obj->url0}/error/";
        }
    }
} else {
    if ($_POST['action'] == 'cmnt_post') {
        $cmnt = new Comments();
        $header = $cmnt->postComment();
    } else {
        if ($_GET['action'] == 'cmnt_delete') {
            $cmnt = new Comments();
            $header = $cmnt->deleteComment($_GET['bid'], $_GET['cmntid']);
        } else {
            if ($_GET['action'] == 'logout') {
                $admin = new Admin();
                $check = $admin->logout();
                $header = $check === true ? 'Location: /' : 'Location: /admin/error/';
            } else {
                $header = "Location: /";
            }
        }
    }
}
header($header);
开发者ID:RobMacKay,项目名称:Ennui-CMS,代码行数:31,代码来源:update.inc.php

示例5: deleteComment

 /**
  * funkce smaze komentar
  * @param int $comment_id
  * @return bool
  */
 public function deleteComment($comment_id)
 {
     try {
         return Comments::deleteComment($comment_id);
     } catch (Exception $e) {
         throw new RPCFault($e->getMessage(), $e->getCode(), $e->getCode());
     }
 }
开发者ID:kourim,项目名称:limedca,代码行数:13,代码来源:Application.php

示例6: Comments

<?php

include '../classes/class.comment.php';
$id = $_GET['id'];
$com = new Comments();
$com->comment_id = $id;
$com->deleteComment($id);
header('location:../public/Customer_feedback_6.php');
开发者ID:rodzflores,项目名称:Casing-Catering,代码行数:8,代码来源:delete_message_function.php

示例7: PDO

     break;
 case 'addcomment':
     if (!empty($_POST['content'])) {
         // Include database connection
         $db = new PDO(DB_INFO, DB_USER, DB_PASS);
         $comments = new Comments($db);
         $comments->addcomment($_POST);
         header('location: ' . $loc);
         exit;
     }
     break;
 case 'deletecomment':
     // Include database connection
     $db = new PDO(DB_INFO, DB_USER, DB_PASS);
     $comments = new Comments($db);
     $comments->deleteComment($_GET['url']);
     header('location: ' . $loc);
     exit;
     break;
 case 'editcomment':
     // Include database connection
     $db = new PDO(DB_INFO, DB_USER, DB_PASS);
     $comments = new Comments($db);
     if (isset($_GET['action'])) {
         $c = $comments->getComment($_GET['url']);
         include_once 'views/editComment.php';
         exit;
     } else {
         $c = $comments->addcomment($_POST);
         header('location: /get-lucid/dreams/' . $_POST['url']);
         exit;
开发者ID:Harrmalik,项目名称:get-lucid,代码行数:31,代码来源:index.php

示例8: header

<?php

include_once "../properties/serverproperties.php";
include_once '../classes/Comments.php';
$action = $_GET['action'];
if ($action == "delete" && isset($_GET['id'])) {
    $id = $_GET['id'];
    $receiverID = $_GET['receiver_id'];
    Comments::deleteComment($id);
    if (isset($_GET['screen']) && $_GET['screen'] == "home") {
        header("location:{$serverRoot}charhome.php#three");
        exit;
    } else {
        if (isset($_GET['screen']) && $_GET['screen'] == "externalProfile") {
            header("location:{$serverRoot}externalplayerprofile.php?userID={$receiverID}#two");
            exit;
        } else {
            header("location:{$serverRoot}profile.php#four");
            exit;
        }
    }
} else {
    if ($action == "post") {
        $receiverID = $_POST['receiver_id'];
        $senderID = $_POST['sender_id'];
        $content = $_POST['content'];
        $time = strftime('%c');
        if (Comments::postComment($senderID, $receiverID, $content, $time)) {
            if (isset($_GET['screen']) && $_GET['screen'] == "externalProfile") {
                header("location:{$serverRoot}externalplayerprofile.php?userID={$receiverID}#two");
                exit;
开发者ID:ng2k12,项目名称:MercInc,代码行数:31,代码来源:commentactions.php


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