[geeklog-cvs] Geeklog-1.x/system lib-webservices.php,1.7,1.8

Dirk Haun dhaun at qs1489.pair.com
Sun Sep 16 12:48:17 EDT 2007


Update of /cvsroot/geeklog/Geeklog-1.x/system
In directory qs1489.pair.com:/tmp/cvs-serv9234/system

Modified Files:
	lib-webservices.php 
Log Message:
Fixed 'content' handling (I think - at least the XHTML case makes more sense now)


Index: lib-webservices.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/system/lib-webservices.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** lib-webservices.php	10 Sep 2007 19:04:13 -0000	1.7
--- lib-webservices.php	16 Sep 2007 16:48:15 -0000	1.8
***************
*** 226,230 ****
          $workspace->appendChild($collection);
  
!         $title = $atom_doc->createElement('atom:title', 'Entries');
          $collection->appendChild($title);
  
--- 226,230 ----
          $workspace->appendChild($collection);
  
!         $title = $atom_doc->createElement('atom:title', $WS_PLUGIN);
          $collection->appendChild($title);
  
***************
*** 356,359 ****
--- 356,402 ----
  
  /**
+  * Get 'content', depending on the type
+  *
+  * @param   array      &$args       the array to which the content is to be appended
+  * @param   object      $atom_doc   current DOMDocument
+  * @param   object      $node       the 'content' node
+  * @bugs    I guess we could at least support 'text/plain', 'text/html', etc.
+  */
+ function WS_getContent(&$args, $atom_doc, $node)
+ {
+     $type = (string) $node->getAttribute('type');
+     if (empty($type)) {
+         $type = 'text';
+     }
+ 
+     switch ($type) {
+     case 'text':
+         $args['content'] = (string) $node->nodeValue;
+         $args['content_type'] = 'text';
+         break;
+ 
+     case 'html':
+         $args['content'] = (string) $node->nodeValue;
+         $args['content_type'] = 'html';
+         break;
+ 
+     case 'xhtml':
+         /* The XHTML div element itself MUST NOT be considered part of the
+          * content. -- RFC 4287, 3.1.1.3. XHTML
+          */
+         $div = $node->firstChild;
+         if (($div->nodeName == 'div') || ($div->nodeName == 'xhtml:div')) {
+             $args['content'] = (string) $atom_doc->saveXML($div->firstChild);
+             $args['content_type'] = 'html'; // it's all the same to us ...
+         }
+         break;
+ 
+     default:
+         // we can't handle any other types yet
+         break;
+     }
+ }
+ 
+ /**
   * Converts the input XML into an argument array
   *
***************
*** 412,416 ****
                  break;
              case 'content':
!                 $args['content'] = (string)$atom_doc->saveXML($node->firstChild);
                  break;
              default:
--- 455,459 ----
                  break;
              case 'content':
!                 WS_getContent($args, $atom_doc, $node);
                  break;
              default:
***************
*** 549,555 ****
          $status = SEC_authenticate($username, $password, $uid);
      } elseif (!empty($_REQUEST['gl_auth_header'])) {
!         /* PHP installed as CGI may not have access to authorization headers of Apache
!          * In that case, use .htaccess to store the auth header as a request variable
!          * called gl_auth_digest
           */
  
--- 592,598 ----
          $status = SEC_authenticate($username, $password, $uid);
      } elseif (!empty($_REQUEST['gl_auth_header'])) {
!         /* PHP installed as CGI may not have access to authorization headers of
!          * Apache. In that case, use .htaccess to store the auth header as a
!          * request variable called gl_auth_digest
           */
  




More information about the geeklog-cvs mailing list