diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-20 00:34:01 +0000 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-20 00:34:01 +0000 |
| commit | 22273ef627cc8f9be11edb6b0207fa0ec35c267f (patch) | |
| tree | 325cb3c63fbe3223128136aa206c099c2dfada18 | |
| parent | aa169c57725ebf148e9b98af5117a2e0a067eb1b (diff) | |
| download | instadisc-22273ef627cc8f9be11edb6b0207fa0ec35c267f.tar.gz instadisc-22273ef627cc8f9be11edb6b0207fa0ec35c267f.tar.bz2 instadisc-22273ef627cc8f9be11edb6b0207fa0ec35c267f.zip | |
Update: Modified Subscription URL in Library
Refs #61
| -rw-r--r-- | update/library/trunk/instadisc.php | 31 |
1 files changed, 18 insertions, 13 deletions
| diff --git a/update/library/trunk/instadisc.php b/update/library/trunk/instadisc.php index 35b6a6f..c0af8fa 100644 --- a/update/library/trunk/instadisc.php +++ b/update/library/trunk/instadisc.php | |||
| @@ -4,13 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | include('xmlrpc/xmlrpc.inc'); | 5 | include('xmlrpc/xmlrpc.inc'); |
| 6 | 6 | ||
| 7 | $idusSubscriptionURL = array(); | 7 | function instaDisc_sendItem($subTitle, $subCategory, $title, $author, $url, $semantics) |
| 8 | $idusEncryptionKey = array(); | ||
| 9 | $instaDisc_subCount = 0; | ||
| 10 | |||
| 11 | function instaDisc_sendItem($id, $title, $author, $url, $semantics) | ||
| 12 | { | 8 | { |
| 13 | global $idusSubscriptionURL, $idusEncryptionKey; | 9 | $subscriptionURL = 'http://'' . $_SERVER['SERVER_NAME'] . '/' . $subCategory . '/' . generateSlug($subTitle) . '/'; |
| 14 | 10 | ||
| 15 | $encID = 0; | 11 | $encID = 0; |
| 16 | if (($idusEncryptionKey[$id] != '') && extension_loaded('mcrypt')) | 12 | if (($idusEncryptionKey[$id] != '') && extension_loaded('mcrypt')) |
| @@ -38,7 +34,7 @@ function instaDisc_sendItem($id, $title, $author, $url, $semantics) | |||
| 38 | $verID = rand(1,2147483647); | 34 | $verID = rand(1,2147483647); |
| 39 | 35 | ||
| 40 | $client = new xmlrpc_client('http://central.fourisland.com/xmlrpc.php'); | 36 | $client = new xmlrpc_client('http://central.fourisland.com/xmlrpc.php'); |
| 41 | $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval($idusSubscriptionURL[$id], 'string'), | 37 | $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval($subscriptionURL, 'string'), |
| 42 | new xmlrpcval($title, 'string'), | 38 | new xmlrpcval($title, 'string'), |
| 43 | new xmlrpcval($author, 'string'), | 39 | new xmlrpcval($author, 'string'), |
| 44 | new xmlrpcval($url, 'string'), | 40 | new xmlrpcval($url, 'string'), |
| @@ -49,7 +45,7 @@ function instaDisc_sendItem($id, $title, $author, $url, $semantics) | |||
| 49 | 45 | ||
| 50 | if ($val == 2) | 46 | if ($val == 2) |
| 51 | { | 47 | { |
| 52 | return instaDisc_sendItem($id, $title, $author, $url, $semantics, $encryptionID); | 48 | return instaDisc_sendItem($subTitle, $subCategory, $title, $author, $url, $semantics); |
| 53 | } else if ($val == 0) | 49 | } else if ($val == 0) |
| 54 | { | 50 | { |
| 55 | return TRUE; | 51 | return TRUE; |
| @@ -58,12 +54,21 @@ function instaDisc_sendItem($id, $title, $author, $url, $semantics) | |||
| 58 | } | 54 | } |
| 59 | } | 55 | } |
| 60 | 56 | ||
| 61 | function instaDisc_addSubscription($url, $enc = '') | 57 | function generateSlug($title) |
| 62 | { | 58 | { |
| 63 | global $instaDisc_subCount, $idusSubscriptionURL, $idusEncryptionKey; | 59 | $title = preg_replace('/[^A-Za-z0-9]/','-',$title); |
| 64 | $idusSubscriptionURL[$instaDisc_subCount] = $url; | 60 | $title = preg_replace('/-{2,}/','-',$title); |
| 65 | $idusEncryptionKey[$instaDisc_subCount] = $enc; | 61 | if (substr($title,0,1) == '-') |
| 66 | $instaDisc_subCount++; | 62 | { |
| 63 | $title = substr($title,1); | ||
| 64 | } | ||
| 65 | if (substr($title,strlen($title)-1,1) == '-') | ||
| 66 | { | ||
| 67 | $title = substr($title,0,strlen($title)-1); | ||
| 68 | } | ||
| 69 | $title = strtolower($title); | ||
| 70 | |||
| 71 | return($title); | ||
| 67 | } | 72 | } |
| 68 | 73 | ||
| 69 | function encryptString($td, $key, $string) | 74 | function encryptString($td, $key, $string) |
