From 96b0d994165c677a840bdb42661ed8447df244d2 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 13 Sep 2008 14:03:55 +0000 Subject: Update: Started worked on MediaWiki plugin Refs #19 --- .../mediawiki/trunk/extensions/instadisc.php | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 update/plugin/mediawiki/trunk/extensions/instadisc.php (limited to 'update/plugin/mediawiki/trunk/extensions') diff --git a/update/plugin/mediawiki/trunk/extensions/instadisc.php b/update/plugin/mediawiki/trunk/extensions/instadisc.php new file mode 100644 index 0000000..dec5a28 --- /dev/null +++ b/update/plugin/mediawiki/trunk/extensions/instadisc.php @@ -0,0 +1,64 @@ + 'InstaDisc', + 'author' => 'Starla Insigna', + 'url' => 'http://fourisland.com/projects/instadisc/wiki/Update/MediaWiki', + 'description' => 'This plugin provides an InstaDisc feed for your MediaWiki wiki, a page-change subscription.' +); + +$wgHooks['ArticleSaveComplete'][] = 'instaDisc_sendItem'; + +function instaDisc_sendItem(&$article, &$user, &$text, &$summary, &$minoredit, &$watchthis, &$sectionanchor, &$flags, &$revision) +{ + global $instaDisc_password, $instaDisc_subscriptionPersonal, $instaDisc_seriesURL, $instaDisc_seriesUsername, $instaDisc_seriesPassword, $instaDisc_subscriptionID, $instaDisc_subscriptionURL, $instaDisc_subscriptionTitle, $instaDisc_subscriptionCategory; + + if (!isset($instaDisc_password) || !isset($instaDisc_subscriptionPersonal) || !isset($instaDisc_seriesURL) || !isset($instaDisc_seriesUsername) || !isset($instaDisc_seriesPassword) || !isset($instaDisc_subscriptionID) || !isset($instaDisc_subscriptionURL) || !isset($instaDisc_subscriptionTitle) || !isset($instaDisc_subscriptionCategory)) + { + return false; + } + + $title = $article->getTitle()->getText(); + $author = $user->getName(); + $url = $article->getTitle()->getFullURL(); + + $encID = 0; + if ($instaDisc_password != '') + { + $encID = encryptData($title, $author, $url, $instaDisc_password); + } + + $instaDisc_subscriptionPersonal = ($instaDisc_subscriptionPersonal == 'true' ? 'true' : 'false'); + + $verID = rand(1,2147483647); + + $client = new xmlrpc_client($instaDisc_seriesURL); + $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval($instaDisc_seriesUsername, 'string'), + new xmlrpcval(md5($instaDisc_seriesUsername . ':' . md5($instaDisc_seriesPassword) . ':' . $verID), 'string'), + new xmlrpcval($verID, 'int'), + new xmlrpcval($instaDisc_seriesURL, 'string'), + new xmlrpcval($instaDisc_subscriptionID, 'string'), + new xmlrpcval($instaDisc_subscriptionURL, 'string'), + new xmlrpcval($instaDisc_subscriptionTitle, 'string'), + new xmlrpcval($instaDisc_subscriptionCategory, 'string'), + new xmlrpcval($instaDisc_subscriptionPersonal, 'string'), + new xmlrpcval($title, 'string'), + new xmlrpcval($author, 'string'), + new xmlrpcval($url, 'string'), + new xmlrpcval(serialize(array()), 'string'), + new xmlrpcval($encID, 'int'))); + $resp = $client->send($msg); + $val = $resp->value()->scalarVal(); + + if ($val == 2) + { + instaDisc_sendItem($article, $user, $text, $summary, $minoredit, $watchthis, $sectionanchor, $flags, $revision); + } else if ($val == 0) + { + return true; + } else { + return false; + } +} -- cgit 1.4.1