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) { $arrReturn['result'] = "success";
} elseif ($_POST['catorder'] == "first") { // "(no other categories)" selected, check to see if there are actually no other categories $result = $mysqli->query("SELECT * FROM " . $dbprefix . "consolecategory WHERE adminoption = '0'"); $num_rows = $result->num_rows; if ($num_rows > 1) { $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 { $catOrderOrderNum = $consoleCatObj->get_info("ordernum"); $addTo = -1; if ($_POST['beforeafter'] == "before") { $addTo = 1; } $checkOrderNum = $catOrderOrderNum + $addTo; if ($checkOrderNum != $consoleCatInfo['ordernum']) { $intNewOrderSpot = $consoleCatObj->makeRoom($_POST['beforeafter']); } } } if ($countErrors == 0) { $updateColumns = array("name"); $updateValues = array($_POST['catname']); if ($intNewOrderSpot != "") { $resortOrder = true;
$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); $consoleOptionObj->resortOrder(); $highestSortNum = $consoleOptionObj->getHighestSortNum();
include_once "../../../../classes/member.php"; include_once "../../../../classes/rank.php"; include_once "../../../../classes/consoleoption.php"; include_once "../../../../classes/consolecategory.php"; $member = new Member($mysqli); $member->select($_SESSION['btUsername']); $consoleObj = new ConsoleOption($mysqli); $consoleCatObj = new ConsoleCategory($mysqli); $cID = $consoleObj->findConsoleIDByName("Manage Console Options"); $consoleObj->select($cID); $_GET['cID'] = $cID; if ($member->authorizeLogin($_SESSION['btPassword'])) { $memberInfo = $member->get_info_filtered(); if ($member->hasAccess($consoleObj) && $consoleCatObj->select($_POST['cID'])) { define('MEMBERRANK_ID', $memberInfo['rank_id']); $consoleCatInfo = $consoleCatObj->get_info(); $arrAssociates = $consoleCatObj->getAssociateIDs("ORDER BY sortnum"); $resortOrder = false; if (count($arrAssociates) > 0) { $consoleObj->select($arrAssociates[0]); $intSpot = $consoleObj->makeRoom("before"); $resortOrder = true; } else { $intSpot = 1; } $consoleObj->addNew(array("consolecategory_id", "pagetitle", "sep", "sortnum"), array($_POST['cID'], "-separator-", "1", $intSpot)); $newSepID = $consoleObj->get_info("console_id"); $rankPrivObj = new Basic($mysqli, "rank_privileges", "privilege_id"); $rankPrivObj->addNew(array("console_id", "rank_id"), array($newSepID, 1)); include "main.php"; }