Example #1
0
     $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'];
         }
         $consoleObj->setCategoryKeyValue($consoleCatID);
Example #2
0
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$prevFolder = "../../";
$PAGE_NAME = "Twitter Connect - " . $consoleTitle . " - ";
$dispBreadCrumb = "<a href='" . $MAIN_ROOT . "'>Home</a> > <a href='" . $MAIN_ROOT . "members'>My Account</a> > <a href='" . $MAIN_ROOT . "members/console.php?cID=" . $cID . "'>" . $consoleTitle . "</a> > Twitter Connect Settings";
$EXTERNAL_JAVASCRIPT .= "\n<script type='text/javascript' src='" . $MAIN_ROOT . "members/js/console.js'></script>\n<script type='text/javascript' src='" . $MAIN_ROOT . "members/js/main.js'></script>\n";
include "../../themes/" . $THEME . "/_header.php";
echo "\n<div class='breadCrumbTitle' id='breadCrumbTitle'>Twitter Connect Settings</div>\n<div class='breadCrumb' id='breadCrumb' style='padding-top: 0px; margin-top: 0px'>\n{$dispBreadCrumb}\n</div>\n";
// Check Login
$LOGIN_FAIL = true;
if ($member->authorizeLogin($_SESSION['btPassword']) && $member->hasAccess($consoleObj)) {
    $twitterObj = new Twitter($mysqli);
    $memberInfo = $member->get_info_filtered();
    $pluginObj->selectByName("Twitter Connect");
    //$result = $mysqli->query("SELECT * FROM ".$dbprefix."plugins WHERE name = 'Twitter Connect'");
    $pluginInfo = $pluginObj->get_info();
    $pluginObj->pluginPage->setCategoryKeyValue($pluginInfo['plugin_id']);
    $pluginPageInfo = $pluginObj->getPluginPage("profile", $pluginInfo['plugin_id']);
    $arrProfileModules = array("User Information", "Custom Profile Options", "Games Statistics", "Squads", "Medals");
    $countErrors = 0;
    $dispError = "";
    if ($_POST['submit']) {
        // Check Display Order (before/after)
        if ($_POST['beforeafter'] != "before" && $_POST['beforeafter'] != "after") {
            $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You selected an invalid display order (before/after).<br>";
            $countErrors++;
        }
        // Check Display Order
        if (!in_array($_POST['displayorder'], array_keys($arrProfileModules))) {
            $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You selected an invalid display order.<br>";
            $countErrors++;