Exemple #1
0
     $countErrors++;
     $dispError[] = "The selected plugin is already installed!";
 }
 // Check if plugin table name interferes with other tables
 $result = $mysqli->query("SHOW TABLES");
 while ($row = $result->fetch_array()) {
     if ($row[0] == $PLUGIN_TABLE_NAME) {
         $countErrors++;
         $dispError[] = "There is database table that conflicts with this plugin.";
     }
 }
 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'];
         }
Exemple #2
0
 while ($row = $result->fetch_array()) {
     if (in_array($row[0], $arrPluginTables)) {
         $countErrors++;
         $dispError[] = "There is database table that conflicts with this plugin. - " . $row[0];
     }
 }
 if ($countErrors == 0) {
     // $sql variable
     include BASE_DIRECTORY . "plugins/donations/sql.php";
     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);