[geeklog-cvs] Geeklog-1.x/system lib-webservices.php,1.37,1.38

Dirk Haun dhaun at qs1489.pair.com
Sat Jun 28 15:37:42 EDT 2008


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

Modified Files:
	lib-webservices.php 
Log Message:
Allow remote users to use the webservices (bug #0000640). Plus some E_ALL fixes.


Index: lib-webservices.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/system/lib-webservices.php,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** lib-webservices.php	31 May 2008 21:42:27 -0000	1.37
--- lib-webservices.php	28 Jun 2008 19:37:40 -0000	1.38
***************
*** 236,240 ****
      $args['gl_svc']  = true;
      $args['gl_edit'] = true;
!     $args['gl_etag'] = trim($_SERVER['HTTP_IF_MATCH'], '"');
  
      // Call PLG_invokeService here
--- 236,243 ----
      $args['gl_svc']  = true;
      $args['gl_edit'] = true;
!     $args['gl_etag'] = '';
!     if (isset($_SERVER['HTTP_IF_MATCH'])) {
!         $args['gl_etag'] = trim($_SERVER['HTTP_IF_MATCH'], '"');
!     }
  
      // Call PLG_invokeService here
***************
*** 246,249 ****
--- 249,256 ----
      }
  
+     if (!isset($svc_msg['error_desc'])) {
+         $svc_msg['error_desc'] = '';
+     }
+ 
      WS_error($ret, $svc_msg['error_desc']);
  }
***************
*** 347,351 ****
          if (!$svc_msg['gl_feed']) {
              /* This is an entry, not a feed */
!             $etag = trim($_SERVER['HTTP_IF_NONE_MATCH'], '"');
              if (!empty($etag) && ($out['updated'] == $etag)) {
                  header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
--- 354,361 ----
          if (!$svc_msg['gl_feed']) {
              /* This is an entry, not a feed */
!             $etag = '';
!             if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
!                 $etag = trim($_SERVER['HTTP_IF_NONE_MATCH'], '"');
!             }
              if (!empty($etag) && ($out['updated'] == $etag)) {
                  header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
***************
*** 673,696 ****
  
      foreach ($extn_elements as $elem) {
-         if (is_array($arr[$elem])) {
-             $count = 0;
-             $extn_elem = $atom_doc->createElement('gl:' . $elem);
-             foreach ($arr[$elem] as $param) {
-                 if (empty($param)) {
-                     continue;
-                 }
  
!                 $count += 1;
  
!                 $param_elem = $atom_doc->createElement('gl:param', $param);
!                 $extn_elem->appendChild($param_elem);
!             }
!             if ($count > 0) {
!                 $entry_elem->appendChild($extn_elem);
!             }
!         } else {
!             $extn_elem = $atom_doc->createElement('gl:' . $elem, $arr[$elem]);
!             if (!empty($arr[$elem])) {
!                 $entry_elem->appendChild($extn_elem);
              }
          }
--- 683,709 ----
  
      foreach ($extn_elements as $elem) {
  
!         if (isset($arr[$elem])) {
!             if (is_array($arr[$elem])) {
!                 $count = 0;
!                 $extn_elem = $atom_doc->createElement('gl:' . $elem);
!                 foreach ($arr[$elem] as $param) {
!                     if (empty($param)) {
!                         continue;
!                     }
  
!                     $count += 1;
! 
!                     $param_elem = $atom_doc->createElement('gl:param', $param);
!                     $extn_elem->appendChild($param_elem);
!                 }
!                 if ($count > 0) {
!                     $entry_elem->appendChild($extn_elem);
!                 }
!             } else {
!                 $extn_elem = $atom_doc->createElement('gl:' . $elem, $arr[$elem]);
!                 if (!empty($arr[$elem])) {
!                     $entry_elem->appendChild($extn_elem);
!                 }
              }
          }
***************
*** 825,829 ****
  
      if (!empty($username) && !empty($password)) {
!         if ($_CONF['user_login_method']['standard']) {
              $status = SEC_authenticate($username, $password, $uid);
          }
--- 838,861 ----
  
      if (!empty($username) && !empty($password)) {
!         if ($_CONF['user_login_method']['3rdparty']) {
!             // remote users will have to use username at servicename
!             $u = explode('@', $username);
!             if (count($u) > 1) {
!                 $sv = $u[count($u) - 1];
!                 if (!empty($sv)) {
!                     $modules = SEC_collectRemoteAuthenticationModules();
!                     foreach ($modules as $smod) {
!                         if (strcasecmp($sv, $smod) == 0) {
!                             array_pop($u); // drop the service name
!                             $uname = implode('@', $u);
!                             $status = SEC_remoteAuthentication($uname,
!                                                     $password, $smod, $uid);
!                             break;
!                         }
!                     }
!                 }
!             }
!         }
!         if (($status == -1) && $_CONF['user_login_method']['standard']) {
              $status = SEC_authenticate($username, $password, $uid);
          }




More information about the geeklog-cvs mailing list