tx_ter_wsdl.php 2.03 KB
Newer Older
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
<?php
/**
 * This file is part of the TYPO3 CMS project.
 *
 * It is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, either version 2
 * of the License, or any later version.
 *
 * For the full copyright and license information, please read the
 * LICENSE.txt file that was distributed with this source code.
 *
 * The TYPO3 project - inspiring people to share!
 */
/**
 * WSDL wrapper for the TYPO3 Extension Repository
 *
 * Note: We expect that you call this script from a directory "wsdl" in the
 * site's main directory (PATH_site)
 *
 * $Id$
 *
 * @author    Robert Lemke <robert@typo3.org>
 */
error_reporting(E_ALL ^ E_NOTICE);

define('TYPO3_OS', stristr(PHP_OS, 'win') && !stristr(PHP_OS, 'darwin') ? 'WIN' : '');
define('TYPO3_MODE', 'FE');
Markus Sommer's avatar
Markus Sommer committed
28 29 30 31 32
define('PATH_thisScript', str_replace('//', '/', str_replace(
    '\\',
    '/',
    (php_sapi_name() == 'cgi' || php_sapi_name() == 'isapi' || php_sapi_name() == 'cgi-fcgi') && ($_SERVER['ORIG_PATH_TRANSLATED'] ? $_SERVER['ORIG_PATH_TRANSLATED'] : $_SERVER['PATH_TRANSLATED']) ? ($_SERVER['ORIG_PATH_TRANSLATED'] ? $_SERVER['ORIG_PATH_TRANSLATED'] : $_SERVER['PATH_TRANSLATED']) : ($_SERVER['ORIG_SCRIPT_FILENAME'] ? $_SERVER['ORIG_SCRIPT_FILENAME'] : $_SERVER['SCRIPT_FILENAME'])
)));
33 34 35 36 37 38 39

define('PATH_site', str_replace(['/wsdl', '/typo3conf/ext/ter'], '', dirname(PATH_thisScript)) . '/');
define('PATH_typo3', PATH_site . 'typo3/');
define('PATH_tslib', PATH_typo3 . 'sysext/cms/tslib/');
define('PATH_typo3conf', PATH_site . 'typo3conf/');
define('TYPO3_mainDir', 'typo3/');

Jens Jacobsen's avatar
Jens Jacobsen committed
40
$serviceLocation = 'https://' . $_SERVER['HTTP_HOST'] . '/index.php?id=ter';
41 42

$wsdlFileName = 'tx_ter.wsdl';
43
if (getenv('TYPO3_CONTEXT') === 'Production/Stage') {
44 45 46 47
    $wsdlFileName = 'tx_ter.stage.wsdl';
}

$WSDLSource = file_get_contents($wsdlFileName);
48 49 50 51 52 53
$WSDLSource = trim(str_replace('---SERVICE_LOCATION---', $serviceLocation, $WSDLSource));

if (!headers_sent()) {
    header('Content-type: text/xml');
    header('Content-Length: ' . strlen($WSDLSource));
}
54
echo $WSDLSource;