本文整理汇总了PHP中Comments::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Comments::delete方法的具体用法?PHP Comments::delete怎么用?PHP Comments::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comments
的用法示例。
在下文中一共展示了Comments::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteComment
public function deleteComment(Comments $comment)
{
/** @var myModel $this */
if (method_exists($this, 'decreaseCount')) {
$this->decreaseCount('commentCount');
}
return $comment->delete();
}
示例2: launch
function launch()
{
global $interface;
global $user;
global $configArray;
// Process Delete Comment
if (isset($_GET['delete']) && is_object($user)) {
$comment = new Comments();
$comment->id = $_GET['delete'];
if ($comment->find(true)) {
if ($user->id == $comment->user_id) {
$comment->delete();
}
}
}
$interface->assign('id', $_GET['id']);
if (isset($_REQUEST['comment'])) {
if (!$user) {
$interface->assign('recordId', $_GET['id']);
$interface->assign('comment', $_REQUEST['comment']);
$interface->assign('followup', true);
$interface->assign('followupModule', 'EContentRecord');
$interface->assign('followupAction', 'UserComments');
$interface->setPageTitle('You must be logged in first');
$interface->assign('subTemplate', '../MyResearch/login.tpl');
$interface->setTemplate('view-alt.tpl');
$interface->display('layout.tpl', 'UserComments' . $_GET['id']);
exit;
}
$result = $this->saveComment();
}
$interface->assign('user', $user);
$eContentRecord = new EContentRecord();
$eContentRecord->id = $_GET['id'];
$eContentRecord->find(true);
$recordDriver = new EcontentRecordDriver();
$recordDriver->setDataObject($eContentRecord);
$interface->setPageTitle(translate('Comments') . ': ' . $recordDriver->getBreadcrumb());
$this->loadEContentComments();
$interface->assign('subTemplate', 'view-comments.tpl');
$interface->setTemplate('view.tpl');
// Display Page
$interface->display('layout.tpl');
}
示例3: deleteComment
/**
* Delete a comment
*
* @param int $id ID of comment to delete
* @param object $user User whose comment is being deleted.
*
* @return bool True for success, false for failure.
* @access public
*/
public static function deleteComment($id, $user)
{
$comment = new Comments();
$comment->id = $id;
if ($comment->find(true)) {
if ($user->id == $comment->user_id) {
$comment->delete();
return true;
}
}
return false;
}
示例4: validateRoute
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);
$memcache && $memcache->set($cacheId, $toplists, MEMCACHE_COMPRESSED, 60 * 60);
httpResponse($toplists);
}
break;
case validateRoute('GET', 'torrents/download/\\d+'):
$torrent = new Torrent($db, $user);
示例5: dropCommentsByObject
/**
* Drop comments by object
*
* @param ProjectDataObject
* @return boolean
*/
static function dropCommentsByObject(ProjectDataObject $object)
{
return Comments::delete(array('`rel_object_manager` = ? AND `rel_object_id` = ?', get_class($object->manager()), $object->getObjectId()));
}
示例6: Comments
<?php
require_once "../bd.php";
// Include connect to BD
require_once '../classes/base.php';
// Include main classes
//If DELETE comment
if (isset($_GET['name']) == 'comment') {
$id = $_GET['id'];
$deleteObject = new Comments();
if ($deleteObject->delete($id)) {
echo '<script>window.location.href="../index.php"</script>';
} else {
echo 'False';
}
}
//If DELETE etries
if (isset($_GET['name']) == 'entries') {
$id = $_GET['id'];
$deleteObject = new Content();
if ($deleteObject->delete($id)) {
echo '<script>window.location.href="../index.php"</script>';
} else {
echo 'False';
}
}
示例7: function
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
*/
Route::get('captcha', ['as' => 'captcha', 'uses' => function () {
Captcha::make();
$response = Response::make('', 200);
示例8: DeleteComment
function DeleteComment()
{
require_once ROOT_DIR . '/services/MyResearch/lib/Comments.php';
global $user;
global $configArray;
// Process Delete Comment
if (is_object($user)) {
$comment = new Comments();
$comment->id = $_GET['commentId'];
$comment->source = 'eContent';
if ($comment->find(true)) {
if ($user->id == $comment->user_id) {
$comment->delete();
}
}
}
return '<result>true</result>';
}
示例9: elseif
Logger::error(i18n::s('You are not allowed to perform this operation.'));
// not found
} elseif (!isset($item['id'])) {
include '../error.php';
// permission denied
} elseif (!Comments::allow_modification($anchor, $item)) {
Safe::header('Status: 401 Unauthorized', TRUE, 401);
Logger::error(i18n::s('You are not allowed to perform this operation.'));
// deletion is confirmed
} elseif (isset($_REQUEST['confirm']) && $_REQUEST['confirm'] == 'yes') {
// touch the related anchor before actual deletion, since the item has to be accessible at that time
if (is_object($anchor)) {
$anchor->touch('comment:delete', $item['id']);
}
// if no error, back to the anchor or to the index page
if (Comments::delete($item['id'])) {
Comments::clear($item);
if ($render_overlaid && isset($_REQUEST['follow_up']) && $_REQUEST['follow_up'] == 'close') {
echo "deleting done";
finalize_page(true);
} elseif (is_object($anchor)) {
Safe::redirect($anchor->get_url('comments'));
} else {
Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'comments/');
}
}
// deletion has to be confirmed
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
Logger::error(i18n::s('The action has not been confirmed.'));
} else {
// commands
示例10: authorize
<?php
authorize();
// Quick SQL injection check
if (!$_GET['postid'] || !is_number($_GET['postid'])) {
error(0);
}
// Make sure they are moderators
if (!check_perms('site_moderate_forums')) {
error(403);
}
Comments::delete((int) $_GET['postid']);
示例11: dropCommentsByObject
/**
* Drop comments by object
*
* @param ContentDataObject
* @return boolean
*/
static function dropCommentsByObject(ContentDataObject $object) {
return Comments::delete(array('`rel_object_id` = ?', $object->getObjectId()));
} // dropCommentsByObject
示例12: __construct
/**
* Create admin page
*
* @author Thibaud Rohmer
*/
public function __construct()
{
/// Check that current user is an admin or an uploader
if (!(CurrentUser::$admin || CurrentUser::$uploader)) {
return;
}
/// Get actions available for Uploaders too
if (isset($_GET['a'])) {
switch ($_GET['a']) {
case "Abo":
$this->page = new AdminAbout();
break;
case "Upl":
if (isset($_POST['path'])) {
AdminUpload::upload();
CurrentUser::$path = File::r2a(stripslashes($_POST['path']));
}
break;
case "Mov":
if (isset($_POST['pathFrom'])) {
try {
CurrentUser::$path = File::r2a(dirname(stripslashes($_POST['pathFrom'])));
} catch (Exception $e) {
CurrentUser::$path = Settings::$photos_dir;
}
}
Admin::move();
if (isset($_POST['move']) && $_POST['move'] == "rename") {
try {
if (is_dir(File::r2a(stripslashes($_POST['pathFrom'])))) {
CurrentUser::$path = dirname(File::r2a(stripslashes($_POST['pathFrom']))) . "/" . stripslashes($_POST['pathTo']);
}
} catch (Exception $e) {
CurrentUser::$path = Settings::$photos_dir;
}
}
break;
case "Del":
if (isset($_POST['del'])) {
if (!is_array($_POST['del'])) {
CurrentUser::$path = dirname(File::r2a(stripslashes($_POST['del'])));
} else {
CurrentUser::$path = dirname(File::r2a(stripslashes($_POST['del'][0])));
}
Admin::delete();
}
break;
}
}
/// Check that current user is an admin
if (!CurrentUser::$admin) {
return;
}
/// Get action
if (isset($_GET['a'])) {
switch ($_GET['a']) {
case "Sta":
$this->page = new AdminStats();
break;
case "VTk":
$this->page = new GuestToken();
break;
case "DTk":
if (isset($_POST['tokenkey'])) {
GuestToken::delete($_POST['tokenkey']);
}
$this->page = new GuestToken();
break;
case "Acc":
if (isset($_POST['edit'])) {
Account::edit($_POST['login'], $_POST['old_password'], $_POST['password'], $_POST['name'], $_POST['email'], NULL, $_POST['language']);
}
if (isset($_POST['login'])) {
$this->page = new Account($_POST['login']);
} else {
$this->page = CurrentUser::$account;
}
break;
case "GC":
Group::create($_POST['group']);
$this->page = new Group();
break;
case "AAc":
Account::create($_POST['login'], $_POST['password'], $_POST['verif']);
$this->page = new Group();
break;
case "AGA":
$a = new Account($_POST['acc']);
$a->add_group($_POST['group']);
$a->save();
$this->page = CurrentUser::$account;
break;
case "AGR":
$a = new Account($_POST['acc']);
$a->remove_group($_POST['group']);
//.........这里部分代码省略.........
示例13: deletecommentAction
public function deletecommentAction()
{
if ($this->_getParam('id', false)) {
$comments = new Comments();
$where = $comments->getAdapter()->quoteInto('comment_id = ?', (int) $this->_getParam('id'));
$comments->delete($where);
} else {
throw new Exception('No comment ID has been specified', 500);
}
}
示例14:
<?php
if (isset($_POST['task']) && $_POST['task'] == 'comment_delete') {
require_once '../sql/models/comments.php';
if (class_exists('Comments')) {
if (Comments::delete($_POST['comment_id'])) {
echo 'true';
} else {
echo 'false';
}
}
}
示例15: deletecommentAction
/** Delete a comment ajax action
* @access public
* @return mixed
* @throws Pas_Exception_Param
*/
public function deletecommentAction()
{
if ($this->getParam('id', false)) {
$comments = new Comments();
$where = $comments->getAdapter()->quoteInto('id = ?', (int) $this->getParam('id'));
$comments->delete($where);
} else {
throw new Pas_Exception_Param($this->_missingParameter, 500);
}
}