diff --git a/core/trunk/core/class/web_service/class_web_service.php b/core/trunk/core/class/web_service/class_web_service.php index b9bc9b77f1fe0646514babef8272760f55233703..0d548bbb9d309effeac19522e13e4ef3179e5001 100644 --- a/core/trunk/core/class/web_service/class_web_service.php +++ b/core/trunk/core/class/web_service/class_web_service.php @@ -1,9 +1,9 @@ <?php /* -* Copyright 2010 Maarch +* Copyright 2012 Maarch * -* This file is part of Maarch Framework. +* This file is part of Maarch Framework. * * Maarch Framework is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,154 +34,248 @@ */ class webService { - /** - * load web service catalog of the Maarch core - */ - function WSCoreCatalog() { - if(file_exists($_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'ws.php')) { - require($_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'ws.php'); - } elseif(file_exists($_SESSION['config']['corepath'].DIRECTORY_SEPARATOR.'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'ws.php')) { - require('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'ws.php'); - } - } - - /** - * load web service catalog of the Maarch application - */ - function WSAppsCatalog() { - if(file_exists($_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.$_SESSION['businessapps'][0]['appid'].DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'ws.php')) { - require($_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.$_SESSION['businessapps'][0]['appid'].DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'ws.php'); - } else { - require('apps'.DIRECTORY_SEPARATOR.$_SESSION['businessapps'][0]['appid'].DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'ws.php'); - } - } - - /** - * load web service catalog of the Maarch loading modules - */ - function WSModulesCatalog() { - for($cptModules=0;$cptModules<count($_SESSION['modules']);$cptModules++) { - if($_SESSION['modules'][$cptModules]['moduleid'] <> "" && file_exists($_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.$_SESSION['modules'][$cptModules]['moduleid'].DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'ws.php')) { - require($_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.$_SESSION['modules'][$cptModules]['moduleid'].DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'ws.php'); - } elseif($_SESSION['modules'][$cptModules]['moduleid'] <> "" && file_exists($_SESSION['config']['corepath'].DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.$_SESSION['modules'][$cptModules]['moduleid'].DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'ws.php')) { - require($_SESSION['config']['corepath'].DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.$_SESSION['modules'][$cptModules]['moduleid'].DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'ws.php'); - } - } - } - - /** - * load web service catalog of the Maarch custom required - */ - function WScustomCatalog() { - if(file_exists($_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'ws.php')) { - require($_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'ws.php'); - } - } - - /** - * web service authentification - */ - function authentication() { - if((isset($_SERVER["PHP_AUTH_USER"]) && isset($_SERVER["PHP_AUTH_PW"]) && isset($_SERVER["HTTP_AUTHORIZATION"])) && $_SERVER["PHP_AUTH_USER"] && $_SERVER["PHP_AUTH_PW"] && preg_match("/^Basic /", $_SERVER["HTTP_AUTHORIZATION"])) { - list($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"]) = explode(":", base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6))); - } - $authenticated = false; - if((isset($_SERVER["PHP_AUTH_USER"]) && isset($_SERVER["PHP_AUTH_PW"])) && ($_SERVER["PHP_AUTH_USER"] || $_SERVER["PHP_AUTH_PW"])) { - require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_functions.php"); - $func = new functions(); - $connexion = new dbquery(); - $connexion->connect(); - if($func->isEncrypted() == "true") { - $_SESSION['user']['UserId'] = $func->decrypt($_SERVER["PHP_AUTH_USER"]); - $password = $func->decrypt($_SERVER["PHP_AUTH_PW"]); - } else { - //echo "ici";exit; - $_SESSION['user']['UserId'] = $_SERVER["PHP_AUTH_USER"]; - $password = $_SERVER["PHP_AUTH_PW"]; - } - $connexion->query("select * from ".$_SESSION['tablename']['users']." where user_id = '".$_SESSION['user']['UserId']."' and password = '".md5($password)."' and STATUS <> 'DEL'"); - //$connexion->show();exit; - if($connexion->nb_result() > 0) { - $authenticated = true; - } - } - return $authenticated; - } - - /** - * launch the web service engine required - */ - function launchWs() { - require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."web_service".DIRECTORY_SEPARATOR."class_soap_server.php"); - require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."web_service".DIRECTORY_SEPARATOR."class_xmlrpc_server.php"); - $soapServer = new MySoapServer(); - $xmlRPC = new MyXmlRPCServer(); - //if WSDL - if(isset($_SERVER['QUERY_STRING']) && strcasecmp($_SERVER['QUERY_STRING'],'wsdl') == 0) { - $soapServer->makeWSDL(); - } elseif(isset($_SERVER['QUERY_STRING']) && strcasecmp($_SERVER['QUERY_STRING'],'xmlrpc') == 0) { - //XMLRPC - $xmlRPC->makeXMLRPCServer(); - } else { - //if Soap - if(isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD']=='POST') { - $soapServer->makeSOAPServer(); - } else { - //default : xml Discovery - $soapServer->makeDISCO(); - } - } - } - - /** - * parse the requested method and return path, object and method to call - * @param $method string the methode in the signature - * @param $methods array array of signature - * @return array with path, object and method - */ - function parseRequestedMethod($method, $methods) { - if(is_array($methods)) { - require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_functions.php"); - $arrayMethods = array(); - $func = new functions(); - //var_dump($methods); - $arrayMethods = $func->object2array($methods); - //$func->show_array($arrayMethods); - foreach(array_keys($arrayMethods) as $keyMethod) { - if($arrayMethods[$keyMethod]["method"] == "custom") { - $resultArray = array("path" => "custom", "method" => null); - break; - } elseif($keyMethod == $method) { - $rootPathArray = array(); - $stringMethod = $arrayMethods[$keyMethod]["method"]; - $rootPathArray = explode("#",$stringMethod); - $rootPath = $rootPathArray[0]; - $objectPath = $rootPathArray[1]; - //echo "<br>generic path : ".$stringMethod."<br>"; - //echo "root path : ".$rootPath."<br>"; - //echo "object path : ".$objectPath."<br>"; - $objectPathArray = array(); - $objectPathArray = explode("::",$objectPath); - if($rootPath == "core") { - $path = "core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR.$objectPathArray[0]."_controler.php"; - } elseif($rootPath == "apps") { - $path = "apps".DIRECTORY_SEPARATOR.$_SESSION['businessapps'][0]['appid'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR.$objectPathArray[0]."_controler.php"; - } else { - preg_match("'modules'", $rootPath, $out); - if(count($out[0])) { - $modulePathArray = array(); - $modulePathArray = explode("/",$rootPath); - $path = "modules".DIRECTORY_SEPARATOR.$modulePathArray[1].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR.$objectPathArray[0]."_controler.php"; - } - } - $resultArray = array("path" => $path, "object" => $objectPathArray[0]."_controler", "method" => $objectPathArray[1]); - break; - } - } - } else { - $resultArray = array("path" => null, "method" => null); - } - return $resultArray; - } + /** + * load web service catalog of the Maarch core + */ + function WSCoreCatalog() { + if (file_exists($_SESSION['config']['corepath'] . 'custom' + . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] + . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'class' + . DIRECTORY_SEPARATOR . 'ws.php') + ) { + require($_SESSION['config']['corepath'] . 'custom' + . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] + . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR + . 'class' . DIRECTORY_SEPARATOR . 'ws.php' + ); + } elseif (file_exists($_SESSION['config']['corepath'] + . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'class' + . DIRECTORY_SEPARATOR . 'ws.php') + ) { + require('core' . DIRECTORY_SEPARATOR . 'class' + . DIRECTORY_SEPARATOR . 'ws.php' + ); + } + } + + /** + * load web service catalog of the Maarch application + */ + function WSAppsCatalog() { + if (file_exists($_SESSION['config']['corepath'] . 'custom' + . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] + . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR + . $_SESSION['businessapps'][0]['appid'] . DIRECTORY_SEPARATOR + . 'class' . DIRECTORY_SEPARATOR . 'ws.php') + ) { + require($_SESSION['config']['corepath'] . 'custom' + . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] + . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR + . $_SESSION['businessapps'][0]['appid'] . DIRECTORY_SEPARATOR + . 'class' . DIRECTORY_SEPARATOR . 'ws.php' + ); + } else { + require('apps' . DIRECTORY_SEPARATOR + . $_SESSION['businessapps'][0]['appid'] . DIRECTORY_SEPARATOR + . 'class' . DIRECTORY_SEPARATOR . 'ws.php' + ); + } + } + + /** + * load web service catalog of the Maarch loading modules + */ + function WSModulesCatalog() { + for ($cptModules=0;$cptModules<count($_SESSION['modules']);$cptModules++) { + if ( + $_SESSION['modules'][$cptModules]['moduleid'] <> "" + && file_exists($_SESSION['config']['corepath'] . 'custom' + . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] + . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR + . $_SESSION['modules'][$cptModules]['moduleid'] + . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'ws.php' + ) + ) { + require($_SESSION['config']['corepath'] . 'custom' + . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] + . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR + . $_SESSION['modules'][$cptModules]['moduleid'] + . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'ws.php' + ); + } elseif ( + $_SESSION['modules'][$cptModules]['moduleid'] <> "" + && file_exists($_SESSION['config']['corepath'] + . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR + . $_SESSION['modules'][$cptModules]['moduleid'] + . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'ws.php' + ) + ) { + require($_SESSION['config']['corepath'] . DIRECTORY_SEPARATOR + . 'modules' . DIRECTORY_SEPARATOR + . $_SESSION['modules'][$cptModules]['moduleid'] + . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'ws.php' + ); + } + } + } + + /** + * load web service catalog of the Maarch custom required + */ + function WScustomCatalog() { + if (file_exists($_SESSION['config']['corepath'] . 'custom' + . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] + . DIRECTORY_SEPARATOR . 'ws.php') + ) { + require($_SESSION['config']['corepath'] . 'custom' + . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] + . DIRECTORY_SEPARATOR . 'ws.php' + ); + } + } + + /** + * web service authentification + */ + function authentication() { + if ( + (isset($_SERVER["PHP_AUTH_USER"]) + && isset($_SERVER["PHP_AUTH_PW"]) + && isset($_SERVER["HTTP_AUTHORIZATION"]) + ) + && $_SERVER["PHP_AUTH_USER"] && $_SERVER["PHP_AUTH_PW"] + && preg_match("/^Basic /", $_SERVER["HTTP_AUTHORIZATION"]) + ) { + list($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"]) + = explode(":", base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6))); + } + $authenticated = false; + if ( + (isset($_SERVER["PHP_AUTH_USER"]) + && isset($_SERVER["PHP_AUTH_PW"]) + ) + && ($_SERVER["PHP_AUTH_USER"] || $_SERVER["PHP_AUTH_PW"]) + ) { + require_once("core" . DIRECTORY_SEPARATOR . "class" + . DIRECTORY_SEPARATOR . "class_functions.php"); + $func = new functions(); + $connexion = new dbquery(); + $connexion->connect(); + if ($func->isEncrypted() == "true") { + $_SESSION['user']['UserId'] = $func->decrypt($_SERVER["PHP_AUTH_USER"]); + $password = $func->decrypt($_SERVER["PHP_AUTH_PW"]); + } else { + //echo "ici";exit; + $_SESSION['user']['UserId'] = $_SERVER["PHP_AUTH_USER"]; + $password = $_SERVER["PHP_AUTH_PW"]; + } + $connexion->query("select * from " . $_SESSION['tablename']['users'] + . " where user_id = '" . $_SESSION['user']['UserId'] + . "' and password = '" . md5($password) . "' and STATUS <> 'DEL'"); + //$connexion->show();exit; + if ($connexion->nb_result() > 0) { + $authenticated = true; + } + } + return $authenticated; + } + + /** + * launch the web service engine required + */ + function launchWs() { + require_once("core" . DIRECTORY_SEPARATOR . "class" + . DIRECTORY_SEPARATOR . "web_service" . DIRECTORY_SEPARATOR . "class_soap_server.php"); + require_once("core" . DIRECTORY_SEPARATOR . "class" + . DIRECTORY_SEPARATOR . "web_service" . DIRECTORY_SEPARATOR . "class_xmlrpc_server.php"); + $soapServer = new MySoapServer(); + $xmlRPC = new MyXmlRPCServer(); + //if WSDL + if ( + isset($_SERVER['QUERY_STRING']) + && strcasecmp($_SERVER['QUERY_STRING'],'wsdl') == 0 + ) { + $soapServer->makeWSDL(); + } elseif ( + isset($_SERVER['QUERY_STRING']) + && strcasecmp($_SERVER['QUERY_STRING'],'xmlrpc') == 0 + ) { + //XMLRPC + $xmlRPC->makeXMLRPCServer(); + } else { + //if Soap + if ( + isset($_SERVER['REQUEST_METHOD']) + && $_SERVER['REQUEST_METHOD']=='POST' + ) { + $soapServer->makeSOAPServer(); + } else { + //default : xml Discovery + $soapServer->makeDISCO(); + } + } + } + + /** + * parse the requested method and return path, object and method to call + * @param $method string the methode in the signature + * @param $methods array array of signature + * @return array with path, object and method + */ + function parseRequestedMethod($method, $methods) { + if (is_array($methods)) { + require_once("core" . DIRECTORY_SEPARATOR . "class" + . DIRECTORY_SEPARATOR . "class_functions.php"); + $arrayMethods = array(); + $func = new functions(); + //var_dump($methods); + $arrayMethods = $func->object2array($methods); + //$func->show_array($arrayMethods); + foreach (array_keys($arrayMethods) as $keyMethod) { + if ($arrayMethods[$keyMethod]["method"] == "custom") { + $resultArray = array("path" => "custom", "method" => null); + break; + } elseif ($keyMethod == $method) { + $rootPathArray = array(); + $stringMethod = $arrayMethods[$keyMethod]["method"]; + $rootPathArray = explode("#",$stringMethod); + $rootPath = $rootPathArray[0]; + $objectPath = $rootPathArray[1]; + //echo "<br>generic path : " . $stringMethod . "<br>"; + //echo "root path : " . $rootPath . "<br>"; + //echo "object path : " . $objectPath . "<br>"; + $objectPathArray = array(); + $objectPathArray = explode("::",$objectPath); + if ($rootPath == "core") { + $path = "core" . DIRECTORY_SEPARATOR . "class" + . DIRECTORY_SEPARATOR . $objectPathArray[0] . "_controler.php"; + } elseif ($rootPath == "apps") { + $path = "apps" . DIRECTORY_SEPARATOR + . $_SESSION['businessapps'][0]['appid'] + . DIRECTORY_SEPARATOR . "class" + . DIRECTORY_SEPARATOR . $objectPathArray[0] . "_controler.php"; + } else { + preg_match("'modules'", $rootPath, $out); + if (count($out[0])) { + $modulePathArray = array(); + $modulePathArray = explode("/",$rootPath); + $path = "modules" . DIRECTORY_SEPARATOR + . $modulePathArray[1] . DIRECTORY_SEPARATOR + . "class" . DIRECTORY_SEPARATOR + . $objectPathArray[0] . "_controler.php"; + } + } + $resultArray = array( + "path" => $path, + "object" => $objectPathArray[0] . "_controler", + "method" => $objectPathArray[1] + ); + break; + } + } + } else { + $resultArray = array("path" => null, "method" => null); + } + return $resultArray; + } } -?> diff --git a/core/trunk/index.php b/core/trunk/index.php index d31810f8e492080e7f7f523804706a50fd8fa079..e455d4f54bbdb697f8dc47d82c1776aafddb3087 100644 --- a/core/trunk/index.php +++ b/core/trunk/index.php @@ -1,14 +1,31 @@ <?php -/** -* File : index.php +/* +* Copyright 2012 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework 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 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework 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. * -* Maarch Portal entry +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief Maarch root file * -* @package maarch -* @version MEP 1.3 -* @since 10/2005 -* @license GPL v3 -* @author Laurent Giovannoni <dev@maarch.org> +* @file +* @author Laurent Giovannoni <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup core */ require_once('core/class/class_functions.php'); diff --git a/core/trunk/ws_client.php b/core/trunk/ws_client.php index 789f761ad01c8b975a9896c4f6ed3bade26c56f2..aefa22480bb49d19c24afea624e0b8aec1c9cabb 100755 --- a/core/trunk/ws_client.php +++ b/core/trunk/ws_client.php @@ -8,7 +8,8 @@ $fileContentArray = array(); $fileContentArray = $client->viewResource((integer) $_REQUEST['id'], $_REQUEST['table']); if($fileContentArray->status == "ok") { $fileContent = base64_decode($fileContentArray->file_content); - $Fnm = $fileContentArray->tmp_path.DIRECTORY_SEPARATOR.rand()."_".md5($fileContent).".".strtolower($fileContentArray->ext); + $Fnm = $fileContentArray->tmp_path . DIRECTORY_SEPARATOR . rand() + . "_" . md5($fileContent) . "." . strtolower($fileContentArray->ext); $inF = fopen($Fnm, "w"); fwrite($inF, $fileContent); fclose($inF); @@ -18,7 +19,9 @@ if($fileContentArray->status == "ok") { header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: ".strtolower($fileContentArray->mime_type)); - header("Content-Disposition: inline; filename=".basename('maarch.'.strtolower($fileContentArray->ext)).";"); + header("Content-Disposition: inline; filename=" + . basename('maarch.' . strtolower($fileContentArray->ext)) . ";" + ); header("Content-Transfer-Encoding: binary"); readfile($Fnm); exit(); diff --git a/core/trunk/ws_server.php b/core/trunk/ws_server.php index 76dc1db2bdd4c7f6ccb07554c202d2419a0a4b57..ca775da6b422348fe25346d3ec7fca2cec60aaae 100755 --- a/core/trunk/ws_server.php +++ b/core/trunk/ws_server.php @@ -3,7 +3,7 @@ /* * Copyright 2010 Maarch * -* This file is part of Maarch Framework. +* This file is part of Maarch Framework. * * Maarch Framework is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,19 +30,19 @@ */ //include of classes -require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_functions.php"); -include_once("core".DIRECTORY_SEPARATOR."init.php"); -require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_portal.php"); -require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_db.php"); -require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"); -require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_core_tools.php"); -require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."web_service".DIRECTORY_SEPARATOR."class_web_service.php"); +require_once('core/class/class_functions.php'); +include_once('core/init.php'); +require_once('core/class/class_portal.php'); +require_once('core/class/class_db.php'); +require_once('core/class/class_request.php'); +require_once('core/class/class_core_tools.php'); +require_once('core/class/web_service/class_web_service.php'); //load Maarch session vars $portal = new portal(); $portal->unset_session(); $portal->build_config(); $coreTools = new core_tools(); -$_SESSION["custom_override_id"] = $coreTools->get_custom_id(); +$_SESSION['custom_override_id'] = $coreTools->get_custom_id(); if (isset($_SESSION['custom_override_id']) && ! empty($_SESSION['custom_override_id']) && isset($_SESSION['config']['corepath']) @@ -50,48 +50,51 @@ if (isset($_SESSION['custom_override_id']) ) { $path = $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR; - //echo $path; set_include_path( $path . PATH_SEPARATOR . $_SESSION['config']['corepath'] . PATH_SEPARATOR . get_include_path() ); } else if (isset($_SESSION['config']['corepath']) - && ! empty($_SESSION['config']['corepath']) + && ! empty($_SESSION['config']['corepath']) ) { set_include_path( $_SESSION['config']['corepath'] . PATH_SEPARATOR . get_include_path() ); } -$coreTools->build_core_config("core".DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR."config.xml"); -$_SESSION["config"]["app_id"] = $_SESSION["businessapps"][0]["appid"]; -require_once("apps".DIRECTORY_SEPARATOR.$_SESSION["businessapps"][0]["appid"].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_business_app_tools.php"); +$coreTools->build_core_config('core' . DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml' +); +$_SESSION['config']['app_id'] = $_SESSION['businessapps'][0]['appid']; +require_once('apps' . DIRECTORY_SEPARATOR . $_SESSION['businessapps'][0]['appid'] + . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR + . 'class_business_app_tools.php' +); $businessAppTools = new business_app_tools(); $businessAppTools->build_business_app_config(); $coreTools->load_modules_config($_SESSION['modules']); //load webservice engine $webService = new webService(); //http Authentication -//WARNING !!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING WARNING WARNING +//WARNING !!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!WARNING! if($webService->authentication()) { //if(1==1) { - $business = new business_app_tools(); - $business->load_app_var_session(); - //retrieve Maarch web service catalog - $webService->WSCoreCatalog(); - $webService->WSAppsCatalog(); - $webService->WSModulesCatalog(); - $webService->WScustomCatalog(); - //launch webservice engine - $webService->launchWs(); + $business = new business_app_tools(); + $business->load_app_var_session(); + //retrieve Maarch web service catalog + $webService->WSCoreCatalog(); + $webService->WSAppsCatalog(); + $webService->WSModulesCatalog(); + $webService->WScustomCatalog(); + //launch webservice engine + $webService->launchWs(); } else { - header("WWW-Authenticate: Basic realm=\"Maarch WebServer Engine\""); - if (preg_match("/Microsoft/", $_SERVER["SERVER_SOFTWARE"])) { - header("Status: 401 Unauthorized"); - exit(); - } else { - header("HTTP/1.0 401 Unauthorized"); - echo "Access denied"; - exit(); - } + header("WWW-Authenticate: Basic realm=\"Maarch WebServer Engine\""); + if (preg_match("/Microsoft/", $_SERVER["SERVER_SOFTWARE"])) { + header("Status: 401 Unauthorized"); + exit(); + } else { + header("HTTP/1.0 401 Unauthorized"); + echo 'Access denied'; + exit(); + } } -?>