[geeklog-cvs] geeklog-1.3/system lib-pingback.php,1.3,1.4 lib-story.php,1.20,1.21

dhaun at iowaoutdoors.org dhaun at iowaoutdoors.org
Sun Jan 30 15:01:24 EST 2005


Update of /var/cvs/geeklog-1.3/system
In directory www:/tmp/cvs-serv31474/system

Modified Files:
	lib-pingback.php lib-story.php 
Log Message:
Implemented Pinging weblog directory services (blo.gs, etc.). Needs a web interface to manage those sites ...


Index: lib-pingback.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/system/lib-pingback.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** lib-pingback.php	30 Jan 2005 13:51:09 -0000	1.3
--- lib-pingback.php	30 Jan 2005 20:01:22 -0000	1.4
***************
*** 153,155 ****
--- 153,237 ----
  }
  
+ /**
+ * Send a standard ping to a weblog directory service
+ *
+ * The "classic" ping, originally invented for weblogs.com
+ *
+ * @param    string  $url            URL to ping
+ * @param    string  $blogname       name of our site
+ * @param    string  $blogurl        URL of our site
+ * @param    string  $changedurl     URL of the changed / new entry
+ * @return   string                  empty string on success of error message
+ *
+ */
+ function PNB_sendPing ($url, $blogname, $blogurl, $changedurl)
+ {
+     $parts = parse_url ($url);
+     if (empty ($parts['port'])) {
+         if (strcasecmp ($parts['scheme'], 'https') == 0) {
+             $parts['port'] = 443;
+         } else {
+             $parts['port'] = 80;
+         }
+     }
+     $client = new XML_RPC_Client ($parts['path'], $parts['host'], $parts['port']);
+     //$client->setDebug (1);
+ 
+     $msg = new XML_RPC_Message ('weblogUpdates.ping',
+             array (new XML_RPC_Value ($blogname, 'string'),
+                    new XML_RPC_Value ($blogurl, 'string'),
+                    new XML_RPC_Value ($changedurl, 'string')));
+ 
+     $response = $client->send ($msg, 0, $parts['scheme']);
+     if ($response == 0) {
+         $retval = $client->errstring;
+     } else if ($response->faultCode () != 0) {
+         $retval = $response->faultString ();
+     }
+ 
+     return $retval;
+ }
+ 
+ /**
+ * Send an extended ping to a weblog directory service
+ *
+ * Supported e.g. by blo.gs
+ *
+ * @param    string  $url            URL to ping
+ * @param    string  $blogname       name of our site
+ * @param    string  $blogurl        URL of our site
+ * @param    string  $changedurl     URL of the changed / new entry
+ * @param    string  $feedurl        URL of a feed for our site
+ * @return   string                  empty string on success of error message
+ *
+ */
+ function PNB_sendExtendedPing ($url, $blogname, $blogurl, $changedurl, $feedurl)
+ {
+     $parts = parse_url ($url);
+     if (empty ($parts['port'])) {
+         if (strcasecmp ($parts['scheme'], 'https') == 0) {
+             $parts['port'] = 443;
+         } else {
+             $parts['port'] = 80;
+         }
+     }
+     $client = new XML_RPC_Client ($parts['path'], $parts['host'], $parts['port']);
+     //$client->setDebug (1);
+ 
+     $msg = new XML_RPC_Message ('weblogUpdates.extendedPing',
+             array (new XML_RPC_Value ($blogname, 'string'),
+                    new XML_RPC_Value ($blogurl, 'string'),
+                    new XML_RPC_Value ($changedurl, 'string'),
+                    new XML_RPC_Value ($feedurl, 'string')));
+ 
+     $response = $client->send ($msg, 0, $parts['scheme']);
+     if ($response == 0) {
+         $retval = $client->errstring;
+     } else if ($response->faultCode () != 0) {
+         $retval = $response->faultString ();
+     }
+ 
+     return $retval;
+ }
+ 
  ?>

Index: lib-story.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/system/lib-story.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** lib-story.php	30 Jan 2005 13:51:09 -0000	1.20
--- lib-story.php	30 Jan 2005 20:01:22 -0000	1.21
***************
*** 536,539 ****
--- 536,542 ----
                  $fields[] = 'introtext';
                  break;
+             case 'feed':
+                 $fields[] = 'tid';
+                 break;
              case 'title':
                  $fields[] = 'title';
***************
*** 564,567 ****
--- 567,588 ----
                  $retval[] = trim (stripslashes ($A['introtext']));
                  break;
+             case 'feed':
+                 $feedfile = DB_getItem ($_TABLES['syndication'], 'filename',
+                                         "topic = '::all'");
+                 if (empty ($feedfile)) {
+                     $feedfile = DB_getItem ($_TABLES['syndication'], 'filename',
+                                             "topic = '{$A['tid']}'");
+                 }
+                 if (empty ($feedfile)) {
+                     $retval[] = '';
+                 } else {
+                     $feedpath = $_CONF['rdf_file'];
+                     $pos = strrpos ($feedpath, '/');
+                     $feed = substr ($feedpath, 0, $pos + 1);
+                     $url = substr_replace ($feed, $_CONF['site_url'], 0,
+                             strlen ($_CONF['path_html']) - 1);
+                     $retval[] = $url . $feedfile;
+                 }
+                 break;
              case 'title':
                  $retval[] = stripslashes ($A['title']);




More information about the geeklog-cvs mailing list