public
Description: Git mirror of the CMS Made Simple 2.0 rewrite
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsmadesimple-2-0.git
tedkulp (author)
Sun May 07 20:00:00 -0700 2006
commit  b124044c4a8d5f45aed924b8953a74347a7ed639
tree    91c734584bb4803329592ae2d48150c0b2669740
parent  911a430fd01817a7f7709cd8b98f682ddf7de318
cmsmadesimple-2-0 / soap.php
100644 140 lines (121 sloc) 3.498 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
#CMS - CMS Made Simple
#(c)2004 by Ted Kulp (wishy@users.sf.net)
#This project's homepage is: http://cmsmadesimple.sf.net
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#$Id: soap.php 2258 2005-12-03 03:30:54Z wishy $
 
require_once(dirname(__FILE__).'/fileloc.php');
 
/**
* Entry point for all non-admin pages
*
* @package CMS
*/  
$starttime = microtime();
 
//@ob_start();
 
if (!file_exists(CONFIG_FILE_LOCATION) || filesize(CONFIG_FILE_LOCATION) < 800)
{
    require_once("lib/misc.functions.php");
    redirect("install/install.php");
}
else if (file_exists(TMP_CACHE_LOCATION.'/SITEDOWN'))
{
  echo "<html><head><title>Maintenance</title></head><body><p>Site down for maintenance.</p></body></html>";
  exit;
}
 
require_once(dirname(__FILE__)."/include.php"); #Makes gCms object
$params = array_merge($_GET, $_POST);
 
if( !isset( $params['module'] ) )
  {
    echo "<html><head><title>Error</title></head><body><p>Missing module parameter</p></body></html>";
    exit;
  }
if( !isset( $gCms->modules[$params['module']] ) )
  {
    echo "<html><head><title>Error</title></head><body><p>module not found</p></body></html>";
    exit;
  }
 
if( isset( $params['debug'] ) )
  {
    echo "<html><body>";
  }
 
// soap stuff goes here
 
// this code copied from function.cms_module.php
// then slightly hacked
$cmsmodules = &$gCms->modules;
$modresult = '';
if (isset($cmsmodules))
  {
    $modulename = $params['module'];
    
    foreach ($cmsmodules as $key=>$value)
      {
  if (strtolower($modulename) == strtolower($key))
   {
   $modulename = $key;
   }
      }
    
    if (isset($modulename))
      {
  if (isset($cmsmodules[$modulename]))
   {
   if (isset($cmsmodules[$modulename]['object'])
    && $cmsmodules[$modulename]['installed'] == true
    && $cmsmodules[$modulename]['active'] == true
   && $cmsmodules[$modulename]['object']->IsSoapModule())
   {
    //@ob_start();
    $id = 'm' . ++$gCms->variables["modulenum"];
    $params = array_merge($params, @ModuleOperations::GetModuleParameters($id));
    $action = 'soap';
    if (isset($params['action']))
     {
     $action = $params['action'];
     }
    
    $returnid = '';
    if (isset($gCms->variables['pageinfo']))
     {
     $returnid = $gCms->variables['pageinfo']->content_id;
     }
    $params['HTTP_RAW_POST_DATA'] = $HTTP_RAW_POST_DATA;
    $result = $cmsmodules[$modulename]['object']->DoActionBase($action, $id, $params, $returnid);
    if ($result !== FALSE)
     {
     echo $result;
     }
    $modresult = @ob_get_contents();
    //@ob_end_clean();
   }
   else
   {
    return "<!-- Not a tag module -->\n";
   }
   }
      }
  }
 
// here's the output
echo $modresult;
 
// end of soap stuff
//@ob_flush();
 
$endtime = microtime();
 
if ($config["debug"] == true)
{
  echo $sql_queries;
  foreach ($gCms->errors as $error)
  {
    echo $error;
  }
}
 
 
# vim:ts=4 sw=4 noet
?>