Configure the new TinyMCE to have almost the same buttons as the old one.
Configure the new TinyMCE to have almost the same buttons as the old one.

File last commit:

dc98d7eb2bb1
3cf3f8fd35f8
Show More
twitter.php
63 lines | 2.1 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)
{
global $mtdb, $info, $error;
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
Update include/*.php to use mysqli_* functions.
r4 $row = $mtdb->getRow( sprintf('SELECT id, username, oauth_token, oauth_token_secret FROM twitter_user WHERE username="%s"', mysqli_real_escape_string($mtdb->link, $user)));
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) {
global $mtdb;
$id = (int)$userid;
Switch to mysqli_* in other php files.
r5 if( $mtdb->query( sprintf('UPDATE twitter_user SET oauth_token="%s", oauth_token_secret="%s", username="%s" WHERE id=%d', mysqli_real_escape_string($mtdb->link, $oauth_token), mysqli_real_escape_string($mtdb->link, $oauth_token_secret), mysqli_real_escape_string($mtdb->link, $username), $id )) )
Add most necessary files for admin interface.
r1 return true;
return false;
}
?>