/** * Method that permits to create a new category * * @access private */ private function create() { if (VPost::add_cat(false) && VPost::name() && VPost::type() != 'no') { try { $cat = new Category(); $cat->_name = VPost::name(); $cat->_type = VPost::type(); $cat->create(); Session::monitor_activity('created a new category: ' . $cat->_name); $result = true; } catch (Exception $e) { $result = $e->getMessage(); } $this->_action_msg = ActionMessages::created($result); } elseif (VPost::add_cat(false) && (!VPost::name() || VPost::type() == 'no')) { $this->_action_msg = ActionMessages::custom_wrong('Make sure you\'ve filled all inputs!'); } }
/** * 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(); } }