public function addConsoleCategory() { $consoleCatID = ""; if ($this->pluginConsoleCategory != "") { $result = $this->MySQL->query("SELECT consolecategory_id FROM " . $this->MySQL->get_tablePrefix() . "consolecategory WHERE name = '" . $this->pluginConsoleCategory . "'"); if ($result->num_rows == 0) { $consoleCatObj = new ConsoleCategory($this->MySQL); $newOrderNum = $consoleCatObj->getHighestOrderNum() + 1; $consoleCatObj->addNew(array("name", "ordernum"), array($this->pluginConsoleCategory, $newOrderNum)); $consoleCatID = $consoleCatObj->get_info("consolecategory_id"); } else { $row = $result->fetch_assoc(); $consoleCatID = $row['consolecategory_id']; } } return $consoleCatID; }
} if ($countErrors == 0) { $sql = "\n\t\t\n\t\tCREATE TABLE IF NOT EXISTS `" . $dbprefix . "twitter` (\n\t\t `twitter_id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t `member_id` int(11) NOT NULL,\n\t\t `oauth_token` varchar(255) NOT NULL,\n\t\t `oauth_tokensecret` varchar(255) NOT NULL,\n\t\t `username` varchar(20) NOT NULL,\n\t\t `name` varchar(255) NOT NULL,\n\t\t `description` text NOT NULL,\n\t\t `followers` int(11) NOT NULL,\n\t\t `following` int(11) NOT NULL,\n\t\t `tweets` int(11) NOT NULL,\n\t\t `profilepic` text NOT NULL,\n\t\t `lasttweet_id` varchar(255) NOT NULL,\n\t\t `lasttweet_html` text NOT NULL,\n\t\t `showfeed` int(11) NOT NULL,\n\t\t `embedtweet` int(11) NOT NULL,\n\t\t `infocard` int(11) NOT NULL,\n\t\t `allowlogin` int(11) NOT NULL,\n\t\t `lastupdate` int(11) NOT NULL,\n\t\t `loginhash` varchar(32) NOT NULL,\n\t\t PRIMARY KEY (`twitter_id`)\n\t\t) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\n\t\n\t\t"; if ($mysqli->query($sql)) { $jsonAPIKey = json_encode($arrAPIKeys); $pluginObj->addNew(array("name", "filepath", "dateinstalled", "apikey"), array($PLUGIN_NAME, $_POST['pluginDir'], time(), $jsonAPIKey)); $pluginID = $pluginObj->get_info("plugin_id"); $pluginObj->pluginPage->setCategoryKeyValue($pluginID); $pluginPageSortNum = $pluginObj->pluginPage->getHighestSortNum() + 1; $pluginObj->pluginPage->addNew(array("plugin_id", "page", "pagepath", "sortnum"), array($pluginID, "profile", "plugins/twitter/_profile.php", $pluginPageSortNum)); // Check if need to add new console category $result = $mysqli->query("SELECT consolecategory_id FROM " . $dbprefix . "consolecategory WHERE name = 'Social Media Connect'"); if ($result->num_rows == 0) { $consoleCatObj = new ConsoleCategory($mysqli); $newOrderNum = $consoleCatObj->getHighestOrderNum() + 1; $consoleCatObj->addNew(array("name", "ordernum"), array("Social Media Connect", $newOrderNum)); $consoleCatID = $consoleCatObj->get_info("consolecategory_id"); } else { $row = $result->fetch_assoc(); $consoleCatID = $row['consolecategory_id']; } $consoleObj->setCategoryKeyValue($consoleCatID); $newSortNum = $consoleObj->getHighestSortNum() + 1; $consoleObj->addNew(array("consolecategory_id", "pagetitle", "filename", "sortnum"), array($consoleCatID, $PLUGIN_NAME, "../plugins/twitter/twitterconnect.php", $newSortNum)); } else { $countErrors++; $dispError[] = "Unable to create plugin database table."; } } $arrReturn = array(); if ($countErrors == 0) {
if ($num_rows > 0) { $countErrors++; $dispError .= " <b>·</b> You selected an invalid category order. (category)<br>"; } else { $intNewOrderSpot = 1; } } else { if ($_POST['beforeafter'] != "before" and $_POST['beforeafter'] != "after") { $countErrors++; $dispError .= " <b>·</b> You selected an invalid category order. (before/after)<br>"; } else { $intNewOrderSpot = $consoleCatObj->makeRoom($_POST['beforeafter']); } } if ($countErrors == 0) { if ($consoleCatObj->addNew(array("name", "ordernum"), array($_POST['catname'], $intNewOrderSpot))) { echo "\n\t\t\t<div style='display: none' id='successBox'>\n\t\t\t\t<p align='center'>\n\t\t\t\t\tSuccessfully Added New Console Category!\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t\t\n\t\t\t<script type='text/javascript'>\n\t\t\t\tpopupDialog('Add New Console Category', '" . $MAIN_ROOT . "members', 'successBox');\n\t\t\t</script>\n\t\t\t"; } } else { $_POST = filterArray($_POST); $_POST['submit'] = false; } } if (!$_POST['submit']) { $countCategories = 0; $result = $mysqli->query("SELECT * FROM " . $dbprefix . "consolecategory WHERE adminoption = '0' ORDER BY ordernum DESC"); while ($row = $result->fetch_assoc()) { $catOrderOptions .= "<option value='" . $row['consolecategory_id'] . "'>" . filterText($row['name']) . "</option>"; $countCategories++; } if ($countCategories == 0) {
if ($mysqli->multi_query($sql)) { do { if ($result = $mysqli->store_result()) { $result->free(); } } while ($mysqli->next_result()); $pluginObj->addNew(array("name", "filepath", "dateinstalled"), array($PLUGIN_NAME, $_POST['pluginDir'], time())); $pluginID = $pluginObj->get_info("plugin_id"); $pluginObj->pluginPage->setCategoryKeyValue($pluginID); $pluginObj->pluginPage->addNew(array("plugin_id", "page", "pagepath"), array($pluginID, "mods", "plugins/donations/include/menu_module.php")); // Check if need to add new console category $result = $mysqli->query("SELECT consolecategory_id FROM " . $dbprefix . "consolecategory WHERE name = 'Donations'"); if ($result->num_rows == 0) { $consoleCatObj = new ConsoleCategory($mysqli); $newOrderNum = $consoleCatObj->getHighestOrderNum() + 1; $consoleCatObj->addNew(array("name", "ordernum"), array("Donations", $newOrderNum)); $consoleCatID = $consoleCatObj->get_info("consolecategory_id"); } else { $row = $result->fetch_assoc(); $consoleCatID = $row['consolecategory_id']; } $consoleObj->setCategoryKeyValue($consoleCatID); $newSortNum = $consoleObj->getHighestSortNum() + 1; $consoleObj->addNew(array("consolecategory_id", "pagetitle", "filename", "sortnum"), array($consoleCatID, "Create a Donation Campaign", "../plugins/donations/console/createcampaign.php", $newSortNum++)); $consoleObj->addNew(array("consolecategory_id", "pagetitle", "filename", "sortnum"), array($consoleCatID, "Manage Donation Campaigns", "../plugins/donations/console/managecampaign.php", $newSortNum++)); } else { $countErrors++; $dispError[] = "Unable to create plugin database table."; } } $arrReturn = array();
$arrConsoleCategoryIDs = array(); $arrCheckConsoleCategories = array(); $result = $mysqli->query("SELECT * FROM " . $_POST['tableprefix'] . "consolecategory ORDER BY ordernum DESC"); while ($row = $result->fetch_assoc()) { $arrCheckConsoleCategories[] = $row['name']; if (in_array($row['name'], $arrConsoleCategories)) { $tempCatID = array_search($row['name'], $arrConsoleCategories); $arrConsoleCategoryIDs[$tempCatID] = $row['consolecategory_id']; } } $pmCatID = ""; foreach ($arrConsoleCategories as $consoleCategory) { if (!in_array($consoleCategory, $arrCheckConsoleCategories)) { $consoleCatObj->selectByOrder(1); $newOrderNum = $consoleCatObj->makeRoom("after"); $consoleCatObj->addNew(array("name", "ordernum"), array($consoleCategory, $newOrderNum)); $tempCatID = array_search($consoleCategory, $arrConsoleCategories); $arrConsoleCategoryIDs[$tempCatID] = $consoleCatObj->get_info("consolecategory_id"); $consoleCatObj->resortOrder(); if ($consoleCategory == "Private Messages") { $pmCatID = $arrConsoleCategoryIDs[$tempCatID]; } } } // Checking Console Options $arrColumns = array("consolecategory_id", "pagetitle", "filename", "sortnum", "defaultconsole", "hide", "sep"); foreach ($arrConsoleOptionNames as $key => $consoleOptionName) { $checkConsole = $consoleOptionObj->findConsoleIDByName($consoleOptionName); if ($checkConsole === false) { $tempCatID = $arrConsoleCategoryIDs[$arrConsoleOptionInfo[$key]['category']]; $consoleOptionObj->setCategoryKeyValue($tempCatID);