-
Notifications
You must be signed in to change notification settings - Fork 9
/
webservicescontroller.php
144 lines (112 loc) · 4.6 KB
/
webservicescontroller.php
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
141
142
143
144
<?php
/**
* This file will handle all incoming WS requests, regardless of protocol.
* Defaulting to xmlrpc, it can simply be included by different 'meta-controllers'
* that just set up the WS_PROTOCOL constant.
* Code copied over from soap.php from eZP 4.0
*
* @author G. Giunta
* @copyright (C) 2009-2022 G. Giunta
* @license code licensed under the GPL License: see LICENSE file
*/
if ( !defined( 'WS_PROTOCOL' ) )
{
define( 'WS_PROTOCOL', 'xmlrpc' );
}
ob_start();
ini_set( "display_errors" , "0" );
//require_once( "lib/ezutils/classes/ezdebug.php" );
//include_once( "lib/ezutils/classes/ezini.php" );
//include_once( 'lib/ezutils/classes/ezsys.php' );
//require_once( 'lib/ezutils/classes/ezexecution.php' );
// Set a default time zone if none is given. The time zone can be overridden
// in config.php or php.ini.
if ( !ini_get( "date.timezone" ) )
{
date_default_timezone_set( "UTC" );
}
require 'autoload.php';
/**
Reads settings from site.ini and passes them to eZDebug.
*/
function eZUpdateDebugSettings()
{
$ini = eZINI::instance();
list( $debugSettings['debug-enabled'], $debugSettings['debug-by-ip'], $debugSettings['debug-by-user'], $debugSettings['debug-ip-list'], $debugSettings['debug-user-list'] ) =
$ini->variableMulti( 'DebugSettings', array( 'DebugOutput', 'DebugByIP', 'DebugByUser', 'DebugIPList', 'DebugUserIDList' ), array ( 'enabled', 'enabled', 'enabled' ) );
eZDebug::updateSettings( $debugSettings );
}
$ini = eZINI::instance();
// Initialize/set the index file.
eZSys::init( WS_PROTOCOL . '.php', $ini->variable( 'SiteAccessSettings', 'ForceVirtualHost' ) == 'true' );
$uri = eZURI::instance( eZSys::requestURI() );
$GLOBALS['eZRequestedURI'] = $uri;
// include ezsession override implementation
require_once( "lib/ezutils/classes/ezsession.php" );
// Check for extension
//include_once( 'lib/ezutils/classes/ezextension.php' );
require_once( 'kernel/common/ezincludefunctions.php' );
eZExtension::activateExtensions( 'default' );
// Extension check end
// Activate correct siteaccess
require_once( 'access.php' );
$wsINI = eZINI::instance( ggeZWebservices::configFileByProtocol( WS_PROTOCOL ) );
if ( $wsINI->variable( 'GeneralSettings', 'UseDefaultAccess' ) === 'enabled' )
{
$access = array( 'name' => $ini->variable( 'SiteSettings', 'DefaultAccess' ),
'type' => EZ_ACCESS_TYPE_DEFAULT );
}
else
{
$access = accessType( $uri,
eZSys::hostname(),
eZSys::serverPort(),
eZSys::indexFile() );
}
$access = changeAccess( $access );
// Siteaccess activation end
// reload wsproviders ini file, as there might be per-siteaccess settings
$wsINI->loadCache();
// Check for activating Debug by user ID (Final checking. The first was in eZDebug::updateSettings())
eZDebug::checkDebugByUser();
// Check for siteaccess extension
eZExtension::activateExtensions( 'access' );
// Siteaccess extension check end
/**
Reads settings from i18n.ini and passes them to eZTextCodec.
*/
function eZUpdateTextCodecSettings()
{
$ini = eZINI::instance( 'i18n.ini' );
list( $i18nSettings['internal-charset'], $i18nSettings['http-charset'], $i18nSettings['mbstring-extension'] ) =
$ini->variableMulti( 'CharacterSettings', array( 'Charset', 'HTTPCharset', 'MBStringExtension' ), array( false, false, 'enabled' ) );
//include_once( 'lib/ezi18n/classes/eztextcodec.php' );
eZTextCodec::updateSettings( $i18nSettings );
}
// Initialize text codec settings
eZUpdateTextCodecSettings();
//include_once( 'lib/ezdb/classes/ezdb.php' );
//$db = eZDB::instance();
// Initialize module loading
//include_once( "lib/ezutils/classes/ezmodule.php" );
$moduleRepositories = eZModule::activeModuleRepositories();
eZModule::setGlobalPathList( $moduleRepositories );
// Load extensions
$enable = $wsINI->variable( 'GeneralSettings', 'Enable' . strtoupper( WS_PROTOCOL ) );
if ( $enable == 'true' )
{
eZSys::init( WS_PROTOCOL . '.php' );
//include_once( 'kernel/classes/datatypes/ezuser/ezuser.php' );
// Login if we have username and password.
if ( eZHTTPTool::username() and eZHTTPTool::password() )
eZUser::loginUser( eZHTTPTool::username(), eZHTTPTool::password() );
//include_once( 'lib/ezsoap/classes/ezsoapserver.php' );
$server_class = 'gg' . strtoupper( WS_PROTOCOL ) . 'Server';
$server = new $server_class();
// nb: this will register methods declared only for $protocol or for all
// protocols, depending on ini settings
ggeZWebservices::registerAvailableMethods( $server, WS_PROTOCOL );
$server->processRequest();
}
ob_end_flush();
eZExecution::cleanExit();