Ignore:
Timestamp:
Sep 17, 2008, 3:48:31 AM (16 years ago)
Author:
rvelices
Message:
  • fix status header (web services + IE6 min display)
  • sql optims in feed /notification
  • dont send cookie for 10 years from admin/history.php
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/ws_core.inc.php

    r2521 r2543  
    3636define( 'WS_PARAM_OPTIONAL',      0x040000 );
    3737
    38 define( 'WS_ERR_INVALID_METHOD',  1001 );
     38define( 'WS_ERR_INVALID_METHOD',  501 );
    3939define( 'WS_ERR_MISSING_PARAM',   1002 );
    4040define( 'WS_ERR_INVALID_PARAM',   1003 );
     
    4848class PwgError
    4949{
    50   var $_code;
    51   var $_codeText;
     50  private $_code;
     51  private $_codeText;
    5252
    5353  function PwgError($code, $codeText)
    5454  {
    55     set_status_header($code, $codeText);
     55    if ($code>=400 and $code<600)
     56    {
     57      set_status_header($code, $codeText);
     58    }
    5659
    5760    $this->_code = $code;
     
    8184   *      xml attributes instead of xml child elements
    8285   */
    83   function PwgNamedArray(&$arr, $itemName, $xmlAttributes=array() )
     86  function PwgNamedArray($arr, $itemName, $xmlAttributes=array() )
    8487  {
    8588    $this->_content = $arr;
     
    135138
    136139/**
    137  * Replace array_walk_recursive()
    138  *
    139  * @category    PHP
    140  * @package     PHP_Compat
    141  * @link        http://php.net/function.array_walk_recursive
    142  * @author      Tom Buskens <ortega@php.net>
    143  * @author      Aidan Lister <aidan@php.net>
    144  * @version     $Revision$
    145  * @since       PHP 5
    146  * @require     PHP 4.0.6 (is_callable)
    147  */
    148 if (!function_exists('array_walk_recursive')) {
    149     function array_walk_recursive(&$input, $funcname)
    150     {
    151         if (!is_callable($funcname)) {
    152             if (is_array($funcname)) {
    153                 $funcname = $funcname[0] . '::' . $funcname[1];
    154             }
    155             user_error('array_walk_recursive() Not a valid callback ' . $user_func,
    156                 E_USER_WARNING);
    157             return;
    158         }
    159 
    160         if (!is_array($input)) {
    161             user_error('array_walk_recursive() The argument should be an array',
    162                 E_USER_WARNING);
    163             return;
    164         }
    165 
    166         $args = func_get_args();
    167 
    168         foreach ($input as $key => $item) {
    169             if (is_array($item)) {
    170                 array_walk_recursive($item, $funcname, $args);
    171                 $input[$key] = $item;
    172             } else {
    173                 $args[0] = &$item;
    174                 $args[1] = &$key;
    175                 call_user_func_array($funcname, $args);
    176                 $input[$key] = $item;
    177             }
    178         }
    179     }
    180 }
    181 
    182 /**
    183140 * Abstract base class for request handlers.
    184141 */
     
    210167   * NOT consecutive integers starting with 0)
    211168   */
    212   function is_struct(&$data)
     169  static function is_struct(&$data)
    213170  {
    214171    if (is_array($data) )
     
    226183   * usually called by every response encoder, except rest xml.
    227184   */
    228   function flattenResponse(&$response)
     185  static function flattenResponse(&$response)
    229186  {
    230187    PwgResponseEncoder::_mergeAttributesAndContent($response);
     
    240197  }
    241198
    242   /*private*/ function _remove_named_callback(&$value, $key)
     199  private static function _remove_named_callback(&$value, $key)
    243200  {
    244201    do
     
    252209  }
    253210
    254   /*private*/ function _mergeAttributesAndContent(&$value)
     211  private static function _mergeAttributesAndContent(&$value)
    255212  {
    256213    if ( !is_array($value) )
     
    311268  }
    312269
    313   /*private*/ function _removeNamedArray(&$value)
     270  private static function _removeNamedArray(&$value)
    314271  {
    315272    if ( strtolower( get_class($value) ) =='pwgnamedarray')
     
    321278  }
    322279
    323   /*private*/ function _removeNamedStruct(&$value)
     280  private static function _removeNamedStruct(&$value)
    324281  {
    325282    if ( strtolower( get_class($value) ) =='pwgnamedstruct')
     
    389346    if ( is_null($this->_requestHandler) )
    390347    {
    391       $this->sendResponse(
    392         new PwgError(400, 'Unknown request format')
    393         );
     348      $this->sendResponse( new PwgError(400, 'Unknown request format') );
    394349      return;
    395350    }
     
    584539   * WS reflection method implementation: lists all available methods
    585540   */
    586   /*static*/ function ws_getMethodList($params, &$service)
     541  static function ws_getMethodList($params, &$service)
    587542  {
    588543    return array('methods' => new PwgNamedArray( array_keys($service->_methods),'method' ) );
     
    592547   * WS reflection method implementation: gets information about a given method
    593548   */
    594   /*static*/ function ws_getMethodDetails($params, &$service)
     549  static function ws_getMethodDetails($params, &$service)
    595550  {
    596551    $methodName = $params['methodName'];
Note: See TracChangeset for help on using the changeset viewer.