diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-13 14:03:55 +0000 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-13 14:03:55 +0000 |
commit | 96b0d994165c677a840bdb42661ed8447df244d2 (patch) | |
tree | 4853e9568b50b25df16c9d8372cedb94fd470e44 /update/plugin/mediawiki | |
parent | f5f6ee6c6dd20b9a1181c50941b887bd70147be6 (diff) | |
download | instadisc-96b0d994165c677a840bdb42661ed8447df244d2.tar.gz instadisc-96b0d994165c677a840bdb42661ed8447df244d2.tar.bz2 instadisc-96b0d994165c677a840bdb42661ed8447df244d2.zip |
Update: Started worked on MediaWiki plugin
Refs #19
Diffstat (limited to 'update/plugin/mediawiki')
-rw-r--r-- | update/plugin/mediawiki/trunk/extensions/instadisc.php | 64 |
1 files changed, 64 insertions, 0 deletions
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 @@ | |||
1 | <?php | ||
2 | |||
3 | /* InstaDisc Update - A Four Island Project */ | ||
4 | |||
5 | $wgExtensionCredits['other'][] = array( | ||
6 | 'name' => 'InstaDisc', | ||
7 | 'author' => 'Starla Insigna', | ||
8 | 'url' => 'http://fourisland.com/projects/instadisc/wiki/Update/MediaWiki', | ||
9 | 'description' => 'This plugin provides an InstaDisc feed for your MediaWiki wiki, a page-change subscription.' | ||
10 | ); | ||
11 | |||
12 | $wgHooks['ArticleSaveComplete'][] = 'instaDisc_sendItem'; | ||
13 | |||
14 | function instaDisc_sendItem(&$article, &$user, &$text, &$summary, &$minoredit, &$watchthis, &$sectionanchor, &$flags, &$revision) | ||
15 | { | ||
16 | global $instaDisc_password, $instaDisc_subscriptionPersonal, $instaDisc_seriesURL, $instaDisc_seriesUsername, $instaDisc_seriesPassword, $instaDisc_subscriptionID, $instaDisc_subscriptionURL, $instaDisc_subscriptionTitle, $instaDisc_subscriptionCategory; | ||
17 | |||
18 | 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)) | ||
19 | { | ||
20 | return false; | ||
21 | } | ||
22 | |||
23 | $title = $article->getTitle()->getText(); | ||
24 | $author = $user->getName(); | ||
25 | $url = $article->getTitle()->getFullURL(); | ||
26 | |||
27 | $encID = 0; | ||
28 | if ($instaDisc_password != '') | ||
29 | { | ||
30 | $encID = encryptData($title, $author, $url, $instaDisc_password); | ||
31 | } | ||
32 | |||
33 | $instaDisc_subscriptionPersonal = ($instaDisc_subscriptionPersonal == 'true' ? 'true' : 'false'); | ||
34 | |||
35 | $verID = rand(1,2147483647); | ||
36 | |||
37 | $client = new xmlrpc_client($instaDisc_seriesURL); | ||
38 | $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval($instaDisc_seriesUsername, 'string'), | ||
39 | new xmlrpcval(md5($instaDisc_seriesUsername . ':' . md5($instaDisc_seriesPassword) . ':' . $verID), 'string'), | ||
40 | new xmlrpcval($verID, 'int'), | ||
41 | new xmlrpcval($instaDisc_seriesURL, 'string'), | ||
42 | new xmlrpcval($instaDisc_subscriptionID, 'string'), | ||
43 | new xmlrpcval($instaDisc_subscriptionURL, 'string'), | ||
44 | new xmlrpcval($instaDisc_subscriptionTitle, 'string'), | ||
45 | new xmlrpcval($instaDisc_subscriptionCategory, 'string'), | ||
46 | new xmlrpcval($instaDisc_subscriptionPersonal, 'string'), | ||
47 | new xmlrpcval($title, 'string'), | ||
48 | new xmlrpcval($author, 'string'), | ||
49 | new xmlrpcval($url, 'string'), | ||
50 | new xmlrpcval(serialize(array()), 'string'), | ||
51 | new xmlrpcval($encID, 'int'))); | ||
52 | $resp = $client->send($msg); | ||
53 | $val = $resp->value()->scalarVal(); | ||
54 | |||
55 | if ($val == 2) | ||
56 | { | ||
57 | instaDisc_sendItem($article, $user, $text, $summary, $minoredit, $watchthis, $sectionanchor, $flags, $revision); | ||
58 | } else if ($val == 0) | ||
59 | { | ||
60 | return true; | ||
61 | } else { | ||
62 | return false; | ||
63 | } | ||
64 | } | ||