本文整理汇总了PHP中post::deletePost方法的典型用法代码示例。如果您正苦于以下问题:PHP post::deletePost方法的具体用法?PHP post::deletePost怎么用?PHP post::deletePost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类post
的用法示例。
在下文中一共展示了post::deletePost方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
$txtreturn = $this->lang('admin_txt_msgok');
echo '1: ' . $txtreturn;
return;
}
if ($action == 2) {
$this->db1->query("UPDATE users SET leveladmin=" . $levelnivel . ", is_network_admin=" . $level . " WHERE iduser=" . $uid . " LIMIT 1");
$txtreturn = $this->lang('admin_txt_msgok');
echo '1: ' . $txtreturn;
return;
}
if ($action == 3) {
// look for the ids of albums
$allposts = $this->network->getPostsUser($uid);
foreach ($allposts as $onepost) {
$onepost = new post($onepost->code);
$onepost->deletePost();
unset($onepost);
}
$this->db1->query("DELETE FROM activities WHERE iduser=" . $uid);
$this->db1->query("DELETE FROM chat WHERE id_from=" . $uid . " OR id_to=" . $uid);
/*****************/
$r = $this->db2->fetch_all('SELECT idpost FROM comments WHERE iduser=' . $uid);
foreach ($r as $oneitem) {
$this->db1->query("UPDATE posts SET numcomments=numcomments-1 WHERE idpost=" . $oneitem->idpost);
}
$this->db1->query("DELETE FROM comments WHERE iduser=" . $uid);
/**************/
$r = $this->db2->fetch_all('SELECT idpost FROM likes WHERE iduser=' . $uid);
foreach ($r as $oneitem) {
$this->db1->query("UPDATE posts SET numlikes=numlikes-1 WHERE idpost=" . $oneitem->idpost);
}
示例2: database
<?php
require '../../includes/config.php';
require '../../structure/database.php';
require '../../structure/forum.php';
require '../../structure/forum.post.php';
require '../../structure/base.php';
require '../../structure/user.php';
$database = new database($db_host, $db_name, $db_user, $db_password);
$post = new post($database);
$base = new base($database);
$user = new user($database);
$user->updateLastActive();
$username = $user->getUsername($_COOKIE['user'], 2);
$rank = $user->getRank($username);
//take action then log it
if ($rank > 2) {
$post->deletePost($_GET['pid'], $rank);
}
$base->appendToFile('../logs.txt', array($username . ' deleted the post ' . $_GET['pid']));
$base->redirect('../viewthread.php?forum=' . $_GET['forum'] . '&id=' . $_GET['id']);
示例3: post
require_once "models/PasswordHash.php";
require_once "models/post.php";
session_start();
//Make sure the user is logged in
if (isset($_SESSION['user'])) {
$user = $_SESSION['user'];
} else {
die;
}
//If they aren't an admin they aren't allowed here either
if ($user->admin != 2) {
die;
}
//If they are authorized to be here, make a class object to handle the post
$post = new post();
//If the id is set in the query string, do the following
if (isset($_GET['id'])) {
//First find the post in the database
$page = $post->findPost($dbh, $_GET['id']);
//If it doesn't exist, kill the page
if (!$page) {
die;
} else {
//And then send them back to the main page
$post->deletePost($dbh, $page->id);
header("Location: /");
die;
}
} else {
die;
}
示例4: post
if ($this->user->id != $idowner) {
$this->db1->query("DELETE FROM notifications WHERE notif_type=2 AND to_user_id=" . $idowner . " AND from_user_id=" . $this->user->id . " AND notif_object_type=1 AND notif_object_id=" . $ip);
$nnotifications = $this->network->getNumNotifications($idowner);
if ($nnotifications <= 0) {
$nnotifications = 0;
} else {
$nnotifications = $nnotifications - 1;
}
$this->db1->query("UPDATE users SET num_notifications=" . $nnotifications . " WHERE iduser=" . $idowner . ' LIMIT 1');
}
echo '1: Ok';
return;
}
if ($action == 3) {
$thepost = new post($codpost);
$thepost->deletePost();
unset($thepost);
echo '1: Ok';
return;
}
if ($action == 4) {
$r = $this->db1->query("INSERT INTO comments SET idpost=" . $ip . ", iduser=" . $this->user->id . ", comment='" . $comment . "', whendate='" . time() . "'");
$idcomment = $this->db1->insert_id();
$this->db1->query("UPDATE users SET num_comments=num_comments+1 WHERE iduser=" . $this->user->id . ' LIMIT 1');
$this->db1->query("UPDATE posts SET numcomments=numcomments+1 WHERE idpost=" . $ip . ' LIMIT 1');
//$this->db1->query('INSERT INTO activities SET iduser='.$this->user->id.', action=4, idresult='.$idcomment.', iditem='.$iditem.', typeitem=1, date="'.time().'"');
if ($this->user->id != $idowner) {
$this->db1->query("INSERT INTO notifications SET notif_type=3, idresult=" . $idcomment . ", to_user_id=" . $idowner . ", from_user_id=" . $this->user->id . ", notif_object_type=1, notif_object_id=" . $ip . ",date='" . time() . "'");
$this->db1->query("UPDATE users SET num_notifications=num_notifications+1 WHERE iduser=" . $idowner . ' LIMIT 1');
}
$htmlReturn = '';