From a7e5c508d476eb46d13d0c2fa40266c72f7c0ed4 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 7 Aug 2008 18:30:50 +0000 Subject: Update: Added multiple subscription support Closes #22 --- update/library/trunk/instadisc.php | 38 ++++++++++++++++++++++++----------- update/library/trunk/subscription.php | 12 ++++++----- 2 files changed, 33 insertions(+), 17 deletions(-) (limited to 'update/library') 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 @@ include('xmlrpc/xmlrpc.inc'); -$idusUsername = ''; // Set this to the username you've registered -$idusPassword = ''; // Set this to the password you've registered -$idusCentralServer = ''; // Set this to the Central Server you've signed up with -$idusSubscriptionURI = ''; // Set this to your unique URI -$idusSubscriptionTitle = ''; // Set this to your Subscription's title -$idusSubscriptionCategory = ''; // Set this to the category your subscription uses -$idusActivationKey = ''; // See http://fourisland.com/projects/instadisc/wiki/Update/Library +$idusUsername = array(); +$idusPassword = array(); +$idusCentralServer = array(); +$idusSubscriptionURI = array(); +$idusSubscriptionTitle = array(); +$idusSubscriptionCategory = array(); +$idusActivationKey = array(); +$instaDisc_subCount = 0; -function instaDisc_sendItem($title, $author, $url, $semantics) +function instaDisc_sendItem($id, $title, $author, $url, $semantics) { global $idusUsername, $idusPassword, $idusCentralServer, $idusSubscriptionURI; $verID = rand(1,65536); - $client = new xmlrpc_client($idusCentralServer); - $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval($idusUsername, 'string'), - new xmlrpcval(md5($idusUsername . ":" . md5($idusPassword) . ":" . $verID), 'string'), + $client = new xmlrpc_client($idusCentralServer[$id]); + $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval($idusUsername[$id], 'string'), + new xmlrpcval(md5($idusUsername[$id] . ":" . md5($idusPassword[$id]) . ":" . $verID), 'string'), new xmlrpcval($verID, 'int'), - new xmlrpcval($idusSubscriptionURI, 'string'), + new xmlrpcval($idusSubscriptionURI[$id], 'string'), new xmlrpcval($title, 'string'), new xmlrpcval($author, 'string'), new xmlrpcval($url, 'string'), @@ -29,4 +30,17 @@ function instaDisc_sendItem($title, $author, $url, $semantics) $client->send($msg); } +function instaDisc_addSubscription($username, $password, $central, $uri, $title, $category, $key = '') +{ + global $instaDisc_subCount, $idusUsername, $idusPassword, $idusCentralServer, $idusSubscriptionURI, $idusSubscriptionTitle, $idusSubscriptionCategory, $idusActivationKey; + $idusUsername[$instaDisc_subCount] = $username; + $idusPassword[$instaDisc_subCount] = $password; + $idusCentralServer[$instaDisc_subCount] = $central; + $idusSubscriptionURI[$instaDisc_subCount] = $uri; + $idusSubscriptionTitle[$instaDisc_subCount] = $title; + $idusSubscriptionCategory[$instaDisc_subCount] = $category; + $idusActivationKey[$instaDisc_subCount] = $key; + $instaDisc_subCount++; +} + ?> 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 @@ include('instadisc.php'); // Make sure that if you move me away from instadisc.php that you update this include! -echo('Subscription: ' . $idusSubscriptionURI . "\n"); -echo('Title: ' . $idusSubscriptionTitle . "\n"); -echo('Category: ' . $idusSubscriptionCategory . "\n"); +$id = (isset($_GET['id']) ? $_GET['id'] : 0); -if ($idusActivationKey != '') +echo('Subscription: ' . $idusSubscriptionURI[$id] . "\n"); +echo('Title: ' . $idusSubscriptionTitle[$id] . "\n"); +echo('Category: ' . $idusSubscriptionCategory[$id] . "\n"); + +if ($idusActivationKey[$id] != '') { - echo('Key: ' . $idusActivationKey . "\n"); + echo('Key: ' . $idusActivationKey[$id] . "\n"); } ?> -- cgit 1.4.1