<?php
define( '_VALID_MOS', 1 );
define( '_JEXEC', 1 );
//if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
* Virtuemart Categorie SOA Connector
*
* THis file generate wsdl dynamicly whith good <soap:address location = ....
*
* @package mod_vm_soa
* @subpackage classes
* @author Mickael cabanas (cabanas.mickael|at|gmail.com)
* @copyright 2010 Mickael Cabanas
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @version $Id:$
*/
ob_start();
global $mosConfig_absolute_path, $sess;
global $jscook_type, $jscookMenu_style, $jscookTree_style;
$mosConfig_absolute_path= realpath( dirname(__FILE__).'/../../../..' );
// Load the joomla main cfg
if( file_exists(dirname(__FILE__).'/configuration.php' )) {
require_once( $mosConfig_absolute_path.'/configuration.php' );
} else {
require_once( $mosConfig_absolute_path.'/configuration.php');
}
// Load the virtuemart main parse code
if( file_exists(dirname(__FILE__).'/../../../../components/com_virtuemart/virtuemart_parser.php' )) {
require_once( dirname(__FILE__).'/../../../../components/com_virtuemart/virtuemart_parser.php' );
$mosConfig_absolute_path = realpath( dirname(__FILE__).'/../..' );
} else {
require_once( dirname(__FILE__).'/../../../../components/com_virtuemart/virtuemart_parser.php');
}
include('../vm_soa_conf.php');
//clean buffer
ob_end_clean();
global $mosConfig_live_site;
$URL_BASE ='';
if( $mosConfig_live_site[strlen( $mosConfig_live_site)-1] == '/' ) {
$URL_BASE = $mosConfig_live_site;
}
else {
$URL_BASE = $mosConfig_live_site.'/';
}
//end of loading conf
$filename = $conf['wsdl_cat'];
$string = file_get_contents('VM_Categories.wsdl',"r");
// Génère : <body text='black'>
//$wsdlReplace = str_replace("___HOST___", $conf['URL'], $string);
$wsdlReplace = $string;
//Get URL + BASE From Joomla conf
if (empty($conf['BASESITE']) && empty($conf['URL']) ){
$wsdlReplace = str_replace('http://___HOST___/___BASE___/', $URL_BASE, $wsdlReplace);
}
// Else Get URL + BASE form SOA For VM Conf
else if (empty($conf['BASESITE']) && !empty($conf['URL'])){
$wsdlReplace = str_replace("___HOST___", $conf['URL'], $string);
$wsdlReplace = str_replace("___BASE___/", $conf['BASESITE'], $wsdlReplace);
} else {
$wsdlReplace = str_replace("___HOST___", $conf['URL'], $string);
$wsdlReplace = str_replace("___BASE___", $conf['BASESITE'], $wsdlReplace);
}
$wsdlReplace = str_replace("___SERVICE___", $conf['EP_cat'], $wsdlReplace);
//$taille = filesize($filename);
//$file = readfile($filename);
header('Content-type: text/xml; charset=UTF-8');
header("Content-Length: ".strlen($wsdlReplace));
if ($conf['cat_actif']=="on"){
echo $wsdlReplace;
}
else{
echo "This Web Service (Categories) is disabled";
}
?>