Disable "Swap Comics" pending further investigation.
Disable "Swap Comics" pending further investigation.

File last commit:

03778752b7d9
81988dfe45dd
Show More
twitter.php
63 lines | 1.9 KiB | text/x-php | PhpLexer
/ include / twitter.php
Add most necessary files for admin interface.
r1 <?php
function twitterpost($message, $user=TWITTER_USER, $password=TWITTER_PASS)
{
More database updates.
r34 global $dbConnection, $info, $error;
Add most necessary files for admin interface.
r1 if( $user == '' ) {
# preserve existing twitterpost(message) style posting until OAuth has been vetted.
$user = TWITTER_USER;
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, TWITTER_HOST);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=".urlencode($message));
curl_setopt($curl_handle, CURLOPT_USERPWD, urlencode($user).":".urlencode($password));
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
if(empty($buffer))
{
adminlog("Twitter post failed for user $user!", MTS_TWITTER, MTA_ADD);
}
return !empty($buffer);
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 } else {
# OAuth Mode
More database updates.
r34 $row = $dbConnection->executeQuery('SELECT id, username, oauth_token, oauth_token_secret FROM twitter_user WHERE username = ?', array($user))->fetch();
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 $username = $row->username;
$oauth_token = $row->oauth_token;
$oauth_token_secret = $row->oauth_token_secret;
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $oauth_token, $oauth_token_secret);
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 $parameters = array('status' => $message );
$status = $connection->post('statuses/update', $parameters);
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 switch( $connection->http_code ) {
case 200:
adminlog("Twitter post succeeded for user $username!", MTS_TWITTER, MTA_ADD);
return true;
default:
adminlog("Twitter post failed for user $username!", MTS_TWITTER, MTA_ADD);
return false;
}
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1 }
Update include/*.php to use mysqli_* functions.
r4
Add most necessary files for admin interface.
r1
}
function setOAuthTokens($userid,$oauth_token,$oauth_token_secret, $username) {
Finish (I think) refactoring to use DBAL.
r36 global $dbConnection;
Add most necessary files for admin interface.
r1 $id = (int)$userid;
More database updates.
r34 if ($dbConnection->executeUpdate('UPDATE twitter_user SET oauth_token = ?, oauth_token_secret = ?, username = ? WHERE id = ?', array($oauth_token, $oauth_token_secret, $username, $id)))
Add most necessary files for admin interface.
r1 return true;
return false;
}
?>