[geeklog-cvs] Geeklog-1.x/system lib-webservices.php,1.18,1.19

Dirk Haun dhaun at qs1489.pair.com
Sun Nov 18 15:59:24 EST 2007


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

Modified Files:
	lib-webservices.php 
Log Message:
Return the created entry after a POST, if possible, to appease some clients (e.g. the APE)


Index: lib-webservices.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/system/lib-webservices.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** lib-webservices.php	18 Nov 2007 18:48:03 -0000	1.18
--- lib-webservices.php	18 Nov 2007 20:59:22 -0000	1.19
***************
*** 167,171 ****
          header($_SERVER['SERVER_PROTOCOL'] . ' 201 Created');
          header('Location: ' . $_CONF['site_url'] . '/webservices/atom/?plugin=' . $WS_PLUGIN . '&id' . '=' . $svc_msg['id']);
!         // Output the actual object here
          return;
      }
--- 167,192 ----
          header($_SERVER['SERVER_PROTOCOL'] . ' 201 Created');
          header('Location: ' . $_CONF['site_url'] . '/webservices/atom/?plugin=' . $WS_PLUGIN . '&id' . '=' . $svc_msg['id']);
! 
!         /* While RFC 5023 only states that the server SHOULD return the created
!          * entry, some clients (e.g. Tim Bray's APE) seem to insist on it.
!          * So let's see what we can do ...
!          */
!         $getargs = array();
!         $getargs['gl_svc'] = true;
!         $getargs['sid'] = $svc_msg['id'];
! 
!         $ret = PLG_invokeService($WS_PLUGIN, 'get', $getargs, $out, $svc_msg);
!         if ($ret == PLG_RET_OK) {
!             $atom_doc = new DOMDocument('1.0', 'utf-8');
! 
!             $entry_elem = $atom_doc->createElementNS($WS_ATOM_NS, 'atom:entry');
!             $atom_doc->appendChild($entry_elem);
!             $atom_doc->createAttributeNS($WS_APP_NS, 'app:entry');
!             $atom_doc->createAttributeNS($WS_EXTN_NS, 'gl:entry');
! 
!             WS_arrayToEntryXML($out, $svc_msg['output_fields'], $entry_elem, $atom_doc);
!             WS_write($atom_doc->saveXML());
!         }
! 
          return;
      }




More information about the geeklog-cvs mailing list