about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--update/plugin/wordpress/trunk/instadisc/instadisc.php57
1 files changed, 24 insertions, 33 deletions
diff --git a/update/plugin/wordpress/trunk/instadisc/instadisc.php b/update/plugin/wordpress/trunk/instadisc/instadisc.php index d6a62d5..b56bb20 100644 --- a/update/plugin/wordpress/trunk/instadisc/instadisc.php +++ b/update/plugin/wordpress/trunk/instadisc/instadisc.php
@@ -64,20 +64,6 @@ function id_settings_page()
64</TABLE> 64</TABLE>
65<H3>Blog Posts Subscription</H3> 65<H3>Blog Posts Subscription</H3>
66<TABLE CLASS="form-table"> 66<TABLE CLASS="form-table">
67<TR VALIGN="top">
68 <TH SCOPE="row"><LABEL>Series Control URL</LABEL>
69 <TD>
70 <INPUT TYPE="text" NAME="instaDisc_blogPost_seriesURL" VALUE="<?php echo(get_option('instaDisc_blogPost_seriesURL')); ?>" SIZE="40">
71 <BR>This is the XML-RPC URL of your Series Control.
72 </TD>
73</TR>
74<TR VALIGN="top">
75 <TH SCOPE="row"><LABEL>Subscription ID</LABEL>
76 <TD>
77 <INPUT TYPE="text" NAME="instaDisc_blogPost_subscriptionID" VALUE="<?php echo(get_option('instaDisc_blogPost_subscriptionID')); ?>" SIZE="40">
78 <BR>This is the unique identifier this subscription is listed under on your Series Control.
79 </TD>
80</TR>
81<?php 67<?php
82 if (extension_loaded('mcrypt')) 68 if (extension_loaded('mcrypt'))
83 { 69 {
@@ -95,20 +81,6 @@ function id_settings_page()
95</TABLE> 81</TABLE>
96<H3>Comments Subscription</H3> 82<H3>Comments Subscription</H3>
97<TABLE CLASS="form-table"> 83<TABLE CLASS="form-table">
98<TR VALIGN="top">
99 <TH SCOPE="row"><LABEL>Series Control URL</LABEL>
100 <TD>
101 <INPUT TYPE="text" NAME="instaDisc_comment_seriesURL" VALUE="<?php echo(get_option('instaDisc_comment_seriesURL')); ?>" SIZE="40">
102 <BR>This is the XML-RPC URL of your Series Control.
103 </TD>
104</TR>
105<TR VALIGN="top">
106 <TH SCOPE="row"><LABEL>Subscription ID</LABEL>
107 <TD>
108 <INPUT TYPE="text" NAME="instaDisc_comment_subscriptionID" VALUE="<?php echo(get_option('instaDisc_comment_subscriptionID')); ?>" SIZE="40">
109 <BR>This is the unique identifier this subscription is listed under on your Series Control.
110 </TD>
111</TR>
112<?php 84<?php
113 if (extension_loaded('mcrypt')) 85 if (extension_loaded('mcrypt'))
114 { 86 {
@@ -125,7 +97,7 @@ function id_settings_page()
125?> 97?>
126</TABLE> 98</TABLE>
127<INPUT TYPE="hidden" NAME="action" VALUE="update"> 99<INPUT TYPE="hidden" NAME="action" VALUE="update">
128<INPUT TYPE="hidden" NAME="page_options" VALUE="instaDisc_subscription_title,instaDisc_blogPost_seriesURL,instaDisc_blogPost_subscriptionID,instaDisc_comment_seriesURL,instaDisc_comment_subscriptionID,instaDisc_blogPost_password,instaDisc_comment_password"> 100<INPUT TYPE="hidden" NAME="page_options" VALUE="instaDisc_subscription_title,instaDisc_blogPost_password,instaDisc_comment_password">
129<P CLASS="submit"><INPUT TYPE="submit" NAME="Submit" VALUE="<?php _e('Save Changes') ?>"></P> 101<P CLASS="submit"><INPUT TYPE="submit" NAME="Submit" VALUE="<?php _e('Save Changes') ?>"></P>
130</FORM></DIV><?php 102</FORM></DIV><?php
131} 103}
@@ -142,6 +114,8 @@ function sendPost($id)
142 $authorName = $author->display_name; 114 $authorName = $author->display_name;
143 $url = get_permalink($id); 115 $url = get_permalink($id);
144 116
117 $subscriptionURL = 'http://' . $_SERVER['SERVER_NAME'] . '/blog-post/' . generateSlug(get_option('instaDisc_subscription_title')) . '/';
118
145 $encID = 0; 119 $encID = 0;
146 if (get_option('instaDisc_blogPost_password') != '') 120 if (get_option('instaDisc_blogPost_password') != '')
147 { 121 {
@@ -151,8 +125,7 @@ function sendPost($id)
151 $verID = rand(1,2147483647); 125 $verID = rand(1,2147483647);
152 126
153 $client = new xmlrpc_client('http://central.fourisland.com/xmlrpc.php'); 127 $client = new xmlrpc_client('http://central.fourisland.com/xmlrpc.php');
154 $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval(get_option('instaDisc_blogPost_seriesURL')), 128 $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval($subscriptionURL, 'string'),
155 new xmlrpcval(get_option('instaDisc_blogPost_subscriptionID')),
156 new xmlrpcval($title, 'string'), 129 new xmlrpcval($title, 'string'),
157 new xmlrpcval($authorName, 'string'), 130 new xmlrpcval($authorName, 'string'),
158 new xmlrpcval($url, 'string'), 131 new xmlrpcval($url, 'string'),
@@ -177,6 +150,8 @@ function sendComment($id)
177 $author = $comment->comment_author; 150 $author = $comment->comment_author;
178 $url = get_permalink($comment->comment_post_ID) . "#comments-" . $id; 151 $url = get_permalink($comment->comment_post_ID) . "#comments-" . $id;
179 152
153 $subscriptionURL = 'http://' . $_SERVER['SERVER_NAME'] . '/blog-comment/' . generateSlug(get_option('instaDisc_subscription_title')) . '/';
154
180 $encID = 0; 155 $encID = 0;
181 if (get_option('instaDisc_comment_password') != '') 156 if (get_option('instaDisc_comment_password') != '')
182 { 157 {
@@ -186,8 +161,7 @@ function sendComment($id)
186 $verID = rand(1,2147483647); 161 $verID = rand(1,2147483647);
187 162
188 $client = new xmlrpc_client('http://central.fourisland.com/xmlrpc.php'); 163 $client = new xmlrpc_client('http://central.fourisland.com/xmlrpc.php');
189 $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval(get_option('instaDisc_comment_seriesURL')), 164 $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval($subscriptionURL, 'string'),
190 new xmlrpcval(get_option('instaDisc_comment_subscriptionID')),
191 new xmlrpcval($title, 'string'), 165 new xmlrpcval($title, 'string'),
192 new xmlrpcval($author, 'string'), 166 new xmlrpcval($author, 'string'),
193 new xmlrpcval($url, 'string'), 167 new xmlrpcval($url, 'string'),
@@ -202,6 +176,23 @@ function sendComment($id)
202 } 176 }
203} 177}
204 178
179function generateSlug($title)
180{
181 $title = preg_replace('/[^A-Za-z0-9]/','-',$title);
182 $title = preg_replace('/-{2,}/','-',$title);
183 if (substr($title,0,1) == '-')
184 {
185 $title = substr($title,1);
186 }
187 if (substr($title,strlen($title)-1,1) == '-')
188 {
189 $title = substr($title,0,strlen($title)-1);
190 }
191 $title = strtolower($title);
192
193 return($title);
194}
195
205function encryptData(&$title, &$author, &$url, $password) 196function encryptData(&$title, &$author, &$url, $password)
206{ 197{
207 $encID = rand(1,2147483647); 198 $encID = rand(1,2147483647);