Esempio n. 1
0
 public function Delete()
 {
     global $user, $bd_names;
     if (empty($user) or !$user->getPermission('add_news') or !$this->Exist()) {
         return false;
     }
     $result = getDB()->ask("SELECT `id` FROM `{$bd_names['comments']}` " . "WHERE `item_id`='" . $this->id . "' AND `item_type` = '" . $this->type() . "'");
     loadTool('comment.class.php');
     while ($line = $result->fetch('num')) {
         $comments_item = new Comments_Item($line[0], false);
         $comments_item->Delete();
         unset($comments_item);
     }
     getDB()->ask("DELETE FROM `{$bd_names['likes']}` " . "WHERE `item_id` = '" . $this->id . "' AND `item_type` = '" . $this->type() . "'");
     return parent::Delete();
 }
Esempio n. 2
0
     }
     loadTool('comment.class.php');
     $comments_item = new Comments_Item(false, 'news/comments/');
     $comments_item->aCreate($comment, $user, $item_id, $item_type);
     break;
 case 'del_com':
     $id = Filter::input('item_id', 'post', 'int');
     if (empty($user) or !$id) {
         aExit(1);
     }
     loadTool('comment.class.php');
     $comments_item = new Comments_Item($id);
     if (!$user->getPermission('adm_comm') and $comments_item->GetAuthorID() != $user->id()) {
         aExit(1);
     }
     if ($comments_item->Delete()) {
         aExit(0);
     } else {
         aExit(1);
     }
     break;
 case 'load_info':
     $id = Filter::input('id', 'post', 'int');
     if (!$id) {
         aExit(1, 'Empty POST param ID');
     }
     loadTool('profile.class.php');
     $user_profile = new Profile($id, 'other/');
     $ajax_message['player_info'] = $user_profile->Show();
     aExit(0);
     break;
Esempio n. 3
0
 public function Delete()
 {
     global $bd_users, $bd_names;
     if (!$this->id) {
         return false;
     }
     loadTool('catalog.class.php');
     $this->deleteCloak();
     $this->deleteSkin();
     $this->deleteBuffer();
     $result = getDB()->ask("SELECT `id` FROM `{$bd_names['comments']}` " . "WHERE `user_id`='{$this->id}'");
     while ($line = $result->fetch('num')) {
         $comment_del = new Comments_Item($line[0]);
         $comment_del->Delete();
         unset($comment_del);
     }
     getDB()->ask("DELETE FROM `{$this->db}` WHERE `{$bd_users['id']}`= '{$this->id}'");
     $this->id = false;
     return true;
 }