$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="******" 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="******"DELETE FROM chat WHERE id_from=" . $uid . " OR id_to=" . $uid);
     /*****************/
     $r = $this->db2->fetch_all('SELECT idpost FROM comments WHERE iduser='******'SELECT idpost FROM likes WHERE iduser=' . $uid);
     foreach ($r as $oneitem) {
         $this->db1->query("UPDATE posts SET numlikes=numlikes-1 WHERE idpost=" . $oneitem->idpost);
     }
Ejemplo n.º 2
0
<?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']);
Ejemplo n.º 3
0
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;
}
     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="******"INSERT INTO comments SET idpost=" . $ip . ", iduser="******", comment='" . $comment . "', whendate='" . time() . "'");
     $idcomment = $this->db1->insert_id();
     $this->db1->query("UPDATE users SET num_comments=num_comments+1 WHERE iduser="******"UPDATE posts SET numcomments=numcomments+1 WHERE idpost=" . $ip . ' LIMIT 1');
     //$this->db1->query('INSERT INTO activities SET iduser='******', 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 = '';