[ Index ]
 

Code source de CMS made simple 1.0.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/ -> soap.php (source)

   1  <?php
   2  #CMS - CMS Made Simple
   3  #(c)2004 by Ted Kulp (wishy@users.sf.net)
   4  #This project's homepage is: http://cmsmadesimple.sf.net
   5  #
   6  #This program is free software; you can redistribute it and/or modify
   7  #it under the terms of the GNU General Public License as published by
   8  #the Free Software Foundation; either version 2 of the License, or
   9  #(at your option) any later version.
  10  #
  11  #This program is distributed in the hope that it will be useful,
  12  #but WITHOUT ANY WARRANTY; without even the implied warranty of
  13  #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14  #GNU General Public License for more details.
  15  #You should have received a copy of the GNU General Public License
  16  #along with this program; if not, write to the Free Software
  17  #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18  #
  19  #$Id: soap.php 2258 2005-12-03 03:30:54Z wishy $
  20  
  21  require_once(dirname(__FILE__).'/fileloc.php');
  22  
  23  function soap_error( $str )
  24  {
  25    $namespaces = array(
  26                'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
  27                'xsd' => 'http://www.w3.org/2001/XMLSchema',
  28                'xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
  29                'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/'
  30                );
  31    $ns_string = '';
  32    foreach( $namespaces as $k => $v )
  33      {
  34        $ns_string .= "\n  xmlns:$k=\"$v\"";
  35      }
  36    $txt = 
  37          '<?xml version="1.0" encoding="ISO-8859-1"?>'.
  38          '<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"'.$ns_string.">\n".
  39          '<SOAP-ENV:Body>'. 
  40          '<SOAP-ENV:Fault>'.
  41                  '<faultcode>Server</faultcode>'.
  42              '<faultstring>'.$str.'</faultstring>'.
  43          '</SOAP-ENV:Fault>'.
  44          '</SOAP-ENV:Body>'.
  45      '</SOAP-ENV:Envelope>';
  46    echo $txt;
  47  }
  48  
  49  /**
  50   * Entry point for all non-admin pages
  51   *
  52   * @package CMS
  53   */    
  54  $starttime = microtime();
  55  
  56  //@ob_start();
  57  
  58  if (!file_exists(CONFIG_FILE_LOCATION) || filesize(CONFIG_FILE_LOCATION) < 800)
  59  {
  60      require_once ("lib/misc.functions.php");
  61      redirect("install/install.php");
  62  }
  63  else if (file_exists(TMP_CACHE_LOCATION.'/SITEDOWN'))
  64  {
  65    header('Content-Type: text/xml');
  66    echo soap_error('site down for maintenance');
  67    exit;
  68  }
  69  
  70  require_once(dirname(__FILE__)."/include.php"); #Makes gCms object
  71  $params = array_merge($_GET, $_POST);
  72  
  73  if( !isset( $params['module'] ) )
  74    {
  75      header('Content-Type: text/xml');
  76      echo soap_error('missing module parameter');
  77      exit;
  78    }
  79  if( !isset( $gCms->modules[$params['module']] ) )
  80    {
  81      header('Content-Type: text/xml');
  82      echo soap_error("module ".$params['module']." not found");  
  83      exit;
  84    }
  85  
  86  // this code copied from function.cms_module.php
  87  // then slightly hacked
  88  $cmsmodules = &$gCms->modules;
  89  
  90  $modresult = '';
  91  if (isset($cmsmodules))
  92    {
  93      $modulename = $params['module'];
  94      
  95      foreach ($cmsmodules as $key=>$value)
  96        {
  97      if (strtolower($modulename) == strtolower($key))
  98        {
  99          $modulename = $key;
 100        }
 101        }
 102      
 103      if (isset($modulename))
 104        {
 105      if (isset($cmsmodules[$modulename]))
 106        {
 107          if (isset($cmsmodules[$modulename]['object'])
 108          && $cmsmodules[$modulename]['installed'] == true
 109          && $cmsmodules[$modulename]['active'] == true
 110              && $cmsmodules[$modulename]['object']->IsSoapModule())
 111            {
 112          //@ob_start();
 113          $id = 'm' . ++$gCms->variables["modulenum"];
 114          $params = array_merge($params, GetModuleParameters($id));
 115          $action = 'soap';
 116          if (isset($params['action']))
 117            {
 118              $action = $params['action'];
 119            }
 120          
 121          $returnid = '';
 122          if (isset($gCms->variables['pageinfo']) && isset($gCms->variables['pageinfo']->content_id) )
 123            {
 124              $returnid = $gCms->variables['pageinfo']->content_id;
 125            }
 126          $params['HTTP_RAW_POST_DATA'] = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
 127          $result = $cmsmodules[$modulename]['object']->DoActionBase($action, $id, $params, $returnid);
 128          if ($result !== FALSE)
 129            {
 130              echo $result;
 131            }
 132          $modresult = @ob_get_contents();
 133          //@ob_end_clean();
 134            }
 135          else
 136            {
 137          return "<!-- Not a tag module -->\n";
 138            }
 139        }
 140        }
 141    }
 142  
 143  // here's the output
 144  echo $modresult;
 145  
 146  // end of soap stuff
 147  //@ob_flush();
 148  
 149  $endtime = microtime();
 150  
 151  # vim:ts=4 sw=4 noet
 152  ?>


Généré le : Tue Apr 3 18:50:37 2007 par Balluche grâce à PHPXref 0.7