/**
  * Method that permits to delete one or more categories
  *
  * @access	private
  */
 private function delete()
 {
     if (VPost::delete(false) && $this->_user['delete_content']) {
         if (VPost::category_id()) {
             try {
                 foreach (VPost::category_id() as $id) {
                     $cat = new Category();
                     $cat->_id = $id;
                     $cat->read('_name');
                     $cat->read('_type');
                     $type = $cat->_type;
                     if ($this->check_usage($id, $type)) {
                         throw new Exception('Can\'t delete ' . $cat->_name . ' because it\'s used!');
                     }
                     $cat->delete();
                     $this->check_empty($type);
                 }
                 Session::monitor_activity('deleted ' . count(VPost::category_id()) . ' category(ies)');
                 $result = true;
             } catch (Exception $e) {
                 $result = $e->getMessage();
             }
             $this->_action_msg = ActionMessages::deleted($result);
         }
     } elseif (VGet::action() == 'delete' && VGet::id()) {
         try {
             $cat = new Category();
             $cat->_id = VGet::id();
             $cat->read('_name');
             $cat->read('_type');
             $type = $cat->_type;
             if ($this->check_usage(VGet::id(), $type)) {
                 throw new Exception('Can\'t delete ' . ucwords($cat->_name) . ' because it\'s used!');
             }
             $cat->delete();
             $this->check_empty($type);
             Session::monitor_activity('deleted a category');
             $result = true;
         } catch (Exception $e) {
             $result = $e->getMessage();
         }
         $this->_action_msg = ActionMessages::deleted($result);
     } elseif ((VPost::delete(false) || VGet::action() == 'delete' && VGet::id()) && !$this->_user['delete_content']) {
         $this->_action_msg = ActionMessages::action_no_perm();
     }
 }
    /**
     * Create category table
     *
     * @access	private
     */
    private function create_category()
    {
        $sql = 'CREATE TABLE `' . $this->_db_prefix . 'category` (
			  `CATEGORY_ID` int(11) unsigned NOT NULL AUTO_INCREMENT,
			  `category_name` tinytext NOT NULL,
			  `category_type` tinytext NOT NULL,
			  PRIMARY KEY (`CATEGORY_ID`)
			) ENGINE=MyISAM DEFAULT CHARSET=utf8;';
        $create = $this->_db->prepare($sql);
        $create->execute();
        if ($create->errorCode() != '00000') {
            throw new Exception('false create');
        } else {
            $cat = new Category();
            $cat->_name = 'uncategorized';
            $cat->_type = 'post';
            $cat->create();
            $cat = new Category();
            $cat->_name = 'uncategorized';
            $cat->_type = 'album';
            $cat->create();
            $cat = new Category();
            $cat->_name = 'uncategorized';
            $cat->_type = 'video';
            $cat->create();
        }
    }