예제 #1
0
파일: twitter.php 프로젝트: raprasad/iem
    reloadbot();
    $msg[] = sprintf("Deleted channel subscription %s for user %s, reloaded bot", $channel, $_SESSION["screen_name"]);
}
if (isset($_REQUEST['cb'])) {
    $to = new TwitterOAuth(TWITTER_KEY, TWITTER_SECRET, $_SESSION['token'], $_SESSION['token_secret']);
    $tok = $to->getAccessToken($_REQUEST['oauth_verifier']);
    unset($_SESSION['token']);
    unset($_SESSION['token_secret']);
    // $user_id = $tok['user_id'];
    $screen_name = $tok['screen_name'];
    $_SESSION['screen_name'] = $screen_name;
    $access_token = $tok['oauth_token'];
    $access_token_secret = $tok['oauth_token_secret'];
    pg_execute($pgconn, "DELETEAUTH", array($screen_name));
    pg_execute($pgconn, "SAVEAUTH", array($screen_name, $access_token, $access_token_secret));
    reloadbot();
    $msg[] = sprintf("Saved authorization for user %s", $screen_name);
}
if ($screen_name == '') {
    $connection = new TwitterOAuth(TWITTER_KEY, TWITTER_SECRET);
    $request_token = $connection->getRequestToken("https://mesonet.agron.iastate.edu/projects/iembot/twitter.php?cb");
    $_SESSION['token'] = $token = $request_token['oauth_token'];
    $_SESSION['token_secret'] = $request_token['oauth_token_secret'];
    $authenticateUrl = $connection->getAuthorizeURL($token);
    header("Location: {$authenticateUrl}");
    exit;
}
$sselect2 = "";
$rs = pg_execute($pgconn, "SELECTSUBS", array(strtolower($screen_name)));
for ($i = 0; $row = @pg_fetch_array($rs, $i); $i++) {
    $sselect2 .= sprintf('<tr><th>%s</th><td>%s</td>
예제 #2
0
파일: iembot.php 프로젝트: muthulatha/iem
}
</style>
';
$c = "";
if ($room != "" && $action != "delete") {
    $c .= "<div style=\"border: 3px solid #000; background: #eee; padding:20px;\">";
    $c .= "<p><strong>Please click the 'Update Room Settings' once done</strong><br />\n    <table width=\"800\"><tr><td width=\"400\">\n    <div class=\"x-box-tl\"><div class=\"x-box-tr\"><div class=\"x-box-tc\"></div></div></div>\n    <div class=\"x-box-ml\"><div class=\"x-box-mr\"><div class=\"x-box-mc\">\n        <div style=\"padding-top:4px;\">\n            <h3>Current Channel Subscriptions:</h3>\n        </div>\n\t    <div style=\"padding-top:4px;\">\n            Click in list to remove.\n        </div>\n\n       <div id=\"channel_del\" /></div>\n\n        <div style=\"padding-top:4px;\">\n            Enter some text to search for channels.\n        </div>\n\t\t<input type=\"text\" size=\"20\" name=\"channelsearch\"\n\t\tid=\"channelsearch\" />\n\n    </div></div></div>\n    <div class=\"x-box-bl\"><div class=\"x-box-br\"><div class=\"x-box-bc\"></div></div></div>\n</div>\n    </td><td width=\"400\">\n\n    </td></tr></table>\n\n        <script src=\"iembot.js\" type=\"text/javascript\">\n        </script>";
    $c .= "<h4><img src=\"../images/configure.png\"/> Edit room settings for: {$room}</h4>";
    $c .= sprintf("<a href=\"iembot.php?action=delete&room=%s\">Click to remove iembot from %s room</a>", $room, $room);
    $c .= "<form name=\"modify\" method=\"POST\">";
    $c .= "<input type=\"hidden\" name=\"action\" value=\"modify\">";
    $c .= "<input type=\"hidden\" name=\"room\" value=\"{$room}\">";
    $c .= "<p><input type=\"submit\" value=\"Update Room Settings\">";
    $c .= "</form>";
    $c .= "</div>";
    $alertMsg = reloadbot();
}
$table = "";
$rs = pg_execute($dbconn, "SELECTROOMS", array());
for ($i = 0; $row = @pg_fetch_array($rs, $i); $i++) {
    if ($i % 8 == 0) {
        $table .= "</tr><tr>";
    }
    $table .= sprintf("<td><a href=\"iembot.php?action=edit&room=%s\">%s</a></td>", $row["roomname"], $row["roomname"]);
}
$t->content = <<<EOF
<h3>IEMBot Chatroom Configuration Page</h3>

<div class="alert alert-warning">{$alertMsg}</div>

{$c}