diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-08-07 18:30:50 +0000 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-08-07 18:30:50 +0000 |
commit | a7e5c508d476eb46d13d0c2fa40266c72f7c0ed4 (patch) | |
tree | 6c2532633150e81dff8ce2f96dd61cf11c298f08 /update/library/trunk | |
parent | 0fd7bd1ff56a6d5ba027ef0880aa25dd1bffc390 (diff) | |
download | instadisc-a7e5c508d476eb46d13d0c2fa40266c72f7c0ed4.tar.gz instadisc-a7e5c508d476eb46d13d0c2fa40266c72f7c0ed4.tar.bz2 instadisc-a7e5c508d476eb46d13d0c2fa40266c72f7c0ed4.zip |
Update: Added multiple subscription support
Closes #22
Diffstat (limited to 'update/library/trunk')
-rw-r--r-- | update/library/trunk/instadisc.php | 38 | ||||
-rw-r--r-- | update/library/trunk/subscription.php | 12 |
2 files changed, 33 insertions, 17 deletions
diff --git a/update/library/trunk/instadisc.php b/update/library/trunk/instadisc.php index 8405110..fc3ac08 100644 --- a/update/library/trunk/instadisc.php +++ b/update/library/trunk/instadisc.php | |||
@@ -4,24 +4,25 @@ | |||
4 | 4 | ||
5 | include('xmlrpc/xmlrpc.inc'); | 5 | include('xmlrpc/xmlrpc.inc'); |
6 | 6 | ||
7 | $idusUsername = ''; // Set this to the username you've registered | 7 | $idusUsername = array(); |
8 | $idusPassword = ''; // Set this to the password you've registered | 8 | $idusPassword = array(); |
9 | $idusCentralServer = ''; // Set this to the Central Server you've signed up with | 9 | $idusCentralServer = array(); |
10 | $idusSubscriptionURI = ''; // Set this to your unique URI | 10 | $idusSubscriptionURI = array(); |
11 | $idusSubscriptionTitle = ''; // Set this to your Subscription's title | 11 | $idusSubscriptionTitle = array(); |
12 | $idusSubscriptionCategory = ''; // Set this to the category your subscription uses | 12 | $idusSubscriptionCategory = array(); |
13 | $idusActivationKey = ''; // See http://fourisland.com/projects/instadisc/wiki/Update/Library | 13 | $idusActivationKey = array(); |
14 | $instaDisc_subCount = 0; | ||
14 | 15 | ||
15 | function instaDisc_sendItem($title, $author, $url, $semantics) | 16 | function instaDisc_sendItem($id, $title, $author, $url, $semantics) |
16 | { | 17 | { |
17 | global $idusUsername, $idusPassword, $idusCentralServer, $idusSubscriptionURI; | 18 | global $idusUsername, $idusPassword, $idusCentralServer, $idusSubscriptionURI; |
18 | $verID = rand(1,65536); | 19 | $verID = rand(1,65536); |
19 | 20 | ||
20 | $client = new xmlrpc_client($idusCentralServer); | 21 | $client = new xmlrpc_client($idusCentralServer[$id]); |
21 | $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval($idusUsername, 'string'), | 22 | $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval($idusUsername[$id], 'string'), |
22 | new xmlrpcval(md5($idusUsername . ":" . md5($idusPassword) . ":" . $verID), 'string'), | 23 | new xmlrpcval(md5($idusUsername[$id] . ":" . md5($idusPassword[$id]) . ":" . $verID), 'string'), |
23 | new xmlrpcval($verID, 'int'), | 24 | new xmlrpcval($verID, 'int'), |
24 | new xmlrpcval($idusSubscriptionURI, 'string'), | 25 | new xmlrpcval($idusSubscriptionURI[$id], 'string'), |
25 | new xmlrpcval($title, 'string'), | 26 | new xmlrpcval($title, 'string'), |
26 | new xmlrpcval($author, 'string'), | 27 | new xmlrpcval($author, 'string'), |
27 | new xmlrpcval($url, 'string'), | 28 | new xmlrpcval($url, 'string'), |
@@ -29,4 +30,17 @@ function instaDisc_sendItem($title, $author, $url, $semantics) | |||
29 | $client->send($msg); | 30 | $client->send($msg); |
30 | } | 31 | } |
31 | 32 | ||
33 | function instaDisc_addSubscription($username, $password, $central, $uri, $title, $category, $key = '') | ||
34 | { | ||
35 | global $instaDisc_subCount, $idusUsername, $idusPassword, $idusCentralServer, $idusSubscriptionURI, $idusSubscriptionTitle, $idusSubscriptionCategory, $idusActivationKey; | ||
36 | $idusUsername[$instaDisc_subCount] = $username; | ||
37 | $idusPassword[$instaDisc_subCount] = $password; | ||
38 | $idusCentralServer[$instaDisc_subCount] = $central; | ||
39 | $idusSubscriptionURI[$instaDisc_subCount] = $uri; | ||
40 | $idusSubscriptionTitle[$instaDisc_subCount] = $title; | ||
41 | $idusSubscriptionCategory[$instaDisc_subCount] = $category; | ||
42 | $idusActivationKey[$instaDisc_subCount] = $key; | ||
43 | $instaDisc_subCount++; | ||
44 | } | ||
45 | |||
32 | ?> | 46 | ?> |
diff --git a/update/library/trunk/subscription.php b/update/library/trunk/subscription.php index 7e05f5b..863c30c 100644 --- a/update/library/trunk/subscription.php +++ b/update/library/trunk/subscription.php | |||
@@ -4,13 +4,15 @@ | |||
4 | 4 | ||
5 | include('instadisc.php'); // Make sure that if you move me away from instadisc.php that you update this include! | 5 | include('instadisc.php'); // Make sure that if you move me away from instadisc.php that you update this include! |
6 | 6 | ||
7 | echo('Subscription: ' . $idusSubscriptionURI . "\n"); | 7 | $id = (isset($_GET['id']) ? $_GET['id'] : 0); |
8 | echo('Title: ' . $idusSubscriptionTitle . "\n"); | ||
9 | echo('Category: ' . $idusSubscriptionCategory . "\n"); | ||
10 | 8 | ||
11 | if ($idusActivationKey != '') | 9 | echo('Subscription: ' . $idusSubscriptionURI[$id] . "\n"); |
10 | echo('Title: ' . $idusSubscriptionTitle[$id] . "\n"); | ||
11 | echo('Category: ' . $idusSubscriptionCategory[$id] . "\n"); | ||
12 | |||
13 | if ($idusActivationKey[$id] != '') | ||
12 | { | 14 | { |
13 | echo('Key: ' . $idusActivationKey . "\n"); | 15 | echo('Key: ' . $idusActivationKey[$id] . "\n"); |
14 | } | 16 | } |
15 | 17 | ||
16 | ?> | 18 | ?> |