pwet

Sign in or create your account | Project List | Help | pwet.fr | Planet eZ Publish.fr | Bioutifoul Photos

pwet Svn Source Tree

Root/trunk/www/soap.php

1<?php
2/**
3 * @copyright Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
4 * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
5 * @version 2011.7
6 * @package kernel
7 */
8
9/*!
10  \brief The SOAP file will handle all eZ Publish soap requests.
11
12  SOAP functions are
13*/
14
15ob_start();
16
17ini_set( "display_errors" , "0" );
18
19// Set a default time zone if none is given. The time zone can be overriden
20// in config.php or php.ini.
21if ( !ini_get( "date.timezone" ) )
22{
23    date_default_timezone_set( "UTC" );
24}
25
26require 'autoload.php';
27
28/*!
29 Reads settings from site.ini and passes them to eZDebug.
30*/
31function eZUpdateDebugSettings()
32{
33    $ini = eZINI::instance();
34
35    list( $debugSettings['debug-enabled'], $debugSettings['debug-by-ip'], $debugSettings['debug-by-user'], $debugSettings['debug-ip-list'], $debugSettings['debug-user-list'] ) =
36        $ini->variableMulti( 'DebugSettings', array( 'DebugOutput', 'DebugByIP', 'DebugByUser', 'DebugIPList', 'DebugUserIDList' ), array ( 'enabled', 'enabled', 'enabled' ) );
37    eZDebug::updateSettings( $debugSettings );
38}
39
40$ini = eZINI::instance();
41
42// Initialize/set the index file.
43eZSys::init( 'soap.php', $ini->variable( 'SiteAccessSettings', 'ForceVirtualHost' ) === 'true' );
44$uri = eZURI::instance( eZSys::requestURI() );
45$GLOBALS['eZRequestedURI'] = $uri;
46
47// Check for extension
48require_once( 'kernel/common/ezincludefunctions.php' );
49eZExtension::activateExtensions( 'default' );
50// Extension check end
51
52// Activate correct siteaccess
53$soapINI = eZINI::instance( 'soap.ini' );
54if ( $soapINI->variable( 'GeneralSettings', 'UseDefaultAccess' ) === 'enabled' )
55{
56    $access = array( 'name' => $ini->variable( 'SiteSettings', 'DefaultAccess' ),
57                     'type' => eZSiteAccess::TYPE_DEFAULT );
58}
59else
60{
61    $access = eZSiteAccess::match( $uri,
62                          eZSys::hostname(),
63                          eZSys::serverPort(),
64                          eZSys::indexFile() );
65}
66$access = eZSiteAccess::change( $access );
67// Siteaccess activation end
68
69// Check for activating Debug by user ID (Final checking. The first was in eZDebug::updateSettings())
70eZDebug::checkDebugByUser();
71
72// Check for siteaccess extension
73eZExtension::activateExtensions( 'access' );
74// Siteaccess extension check end
75
76// Now that all extensions are activated and siteaccess has been changed, reset
77// all eZINI instances as they may not take into account siteaccess specific settings.
78eZINI::resetAllInstances( false );
79
80/*!
81 Reads settings from i18n.ini and passes them to eZTextCodec.
82*/
83function eZUpdateTextCodecSettings()
84{
85    $ini = eZINI::instance( 'i18n.ini' );
86
87    list( $i18nSettings['internal-charset'], $i18nSettings['http-charset'], $i18nSettings['mbstring-extension'] ) =
88        $ini->variableMulti( 'CharacterSettings', array( 'Charset', 'HTTPCharset', 'MBStringExtension' ), array( false, false, 'enabled' ) );
89
90    eZTextCodec::updateSettings( $i18nSettings );
91}
92
93// Initialize text codec settings
94eZUpdateTextCodecSettings();
95
96// Initialize module loading
97$moduleRepositories = eZModule::activeModuleRepositories();
98eZModule::setGlobalPathList( $moduleRepositories );
99
100// Load soap extensions
101$enableSOAP = $soapINI->variable( 'GeneralSettings', 'EnableSOAP' );
102
103if ( $enableSOAP == 'true' )
104{
105    // Login if we have username and password.
106    if ( eZHTTPTool::username() and eZHTTPTool::password() )
107        eZUser::loginUser( eZHTTPTool::username(), eZHTTPTool::password() );
108
109    $server = new eZSOAPServer();
110
111    foreach( $soapINI->variable( 'ExtensionSettings', 'SOAPExtensions' ) as $extension )
112    {
113        include_once( eZExtension::baseDirectory() . '/' . $extension . '/soap/initialize.php' );
114    }
115
116    $server->processRequest();
117}
118
119ob_end_flush();
120
121eZExecution::cleanExit();
122
123?>
124

Archive Download this file

Revision: HEAD