function __construct($dbConfig = NULL) { parent::__construct($dbConfig); // set debug mode via configuration $GLOBALS['debug'] = (bool) $this->mDbConfig['db_debug_enabled']; // preparing wsdl cache configuration if (!isset($this->mDbConfig['db_wsdl_cache_enabled'])) { $this->mDbConfig['db_wsdl_cache_enabled'] = TRUE; } $this->mDbConfig['db_wsdl_cache_lifetime'] = $this->mDbConfig['db_wsdl_cache_lifetime'] != '' ? (int) $this->mDbConfig['db_wsdl_cache_lifetime'] : 60 * 60 * 24; // defaults to 1 day $this->mDbConfig['db_wsdl_cache_path'] = file_exists($this->mDbConfig['db_wsdl_cache_path']) ? $this->mDbConfig['db_wsdl_cache_path'] : Configuration::Instance()->GetTempDir(); $this->mDbConfig['db_connection_timeout'] = $this->mDbConfig['db_connection_timeout'] != '' ? (int) $this->mDbConfig['db_connection_timeout'] : 30; // default to 30 $this->mDbConfig['db_response_timeout'] = $this->mDbConfig['db_response_timeout'] != '' ? (int) $this->mDbConfig['db_response_timeout'] : 30; require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.nusoap_base.php'; require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.soap_val.php'; require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.soap_parser.php'; require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.soap_fault.php'; require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.soap_transport_http.php'; require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.xmlschema.php'; require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.wsdl.php'; require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.soapclient.php'; require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/nusoap/class.wsdlcache.php'; SysLog::Instance()->log('SoapDatabaseEngine::__construct', 'DatabaseEngine'); }
function DoLogin() { SysLog::Instance()->log('Login(sso)::DoLogin', "login"); $ssoclient = SsoClient::Instance(); SysLog::Instance()->log('Login(sso)::DoLogin poke me!!', "login"); // echo "Is sso alive? "; // var_dump($ssoclient->isSsoAlive()); // die(); $SsoAuth = $ssoclient->authenticateSsoUser($this->mUsername, $this->mPassword, $this->mSsoSystemId); // echo "<pre>"; // var_dump($SsoAuth); // echo "</pre>"; // die(); SysLog::Instance()->log("DoLogin got SsoAuth: " . print_r($SsoAuth, true), "login"); if ($SsoAuth['status'] === true) { // save SSID $ssoclient->saveSsIdToLocal($SsoAuth['ssid'], Configuration::Instance()->GetValue('application', 'sso_group')); // request details on SSID $SsoAttr = $ssoclient->requestSsIdAttributes($SsoAuth['ssid'], $this->mSsoSystemId); SysLog::Instance()->log("DoLogin got SsoAttr: " . print_r($SsoAttr, true), "login"); $local_username = $SsoAttr['mSsoLocalUsername']; $this->mUser->mUserName = $local_username; $this->mUser->GetUser(); } // echo "<pre>"; // var_dump($SsoAttr); // echo "</pre>"; // die($local_username); return $SsoAuth['status']; }
function DoLogin() { $this->mUser->mUserName = $this->mUserName; $this->FetchUserInfo(); SysLog::Instance()->log('User (' . $this->mUserName . ') active: ' . $this->GetCurrentUser()->GetActive(), 'login'); if ($this->GetCurrentUser()->GetActive() != 'Yes') { return FALSE; } $hashed = $this->IsPasswordHashed(); $salt = $this->GetSalt(); if ($hashed) { $hash = md5(md5($salt . $this->GetCurrentUser()->GetPassword())); } else { $hash = $this->mUser->mPassword; } SysLog::Instance()->log('comparing: ' . $this->mPassword . ' == ' . $hash . ' hashed=' . $hashed . ' salt=' . $salt, 'login'); if (md5($this->mPassword) == $hash) { SysLog::Instance()->log('Logged in!', 'login'); $this->mIsLoggedIn = true; $_SESSION['is_logged_in'] = true; $_SESSION['username'] = (string) $this->mUserName; Session::Instance()->Restart(); // regenerate session_id, prevent session fixation } else { $this->mIsLoggedIn = false; $_SESSION['is_logged_in'] = false; $_SESSION['username'] = Configuration::Instance()->GetValue('application', 'default_user'); } return $this->mIsLoggedIn; }
function DoLogout() { SysLog::Instance()->log('DoLogout sso', 'login'); $ssoclient = SsoClient::Instance(); $ssid = $ssoclient->getLocalSsId(Configuration::Instance()->GetValue('application', 'sso_group')); $result = $ssoclient->invalidateSsId($ssid); SysLog::Instance()->log('DoLogout sso invalidate result' . print_r($result, true), 'login'); $result2 = $ssoclient->removeLocalSsId(Configuration::Instance()->GetValue('application', 'sso_group')); SysLog::Instance()->log('DoLogout sso removeLocalSsId result' . print_r($result2, true), 'login'); return $result; }
function __construct($dbConfig = NULL) { parent::__construct($dbConfig); SysLog::Instance()->log("creating AdodbLiteDatabaseEngine", "database"); require_once Configuration::Instance()->GetValue('application', 'gtfw_base') . 'main/lib/adodb_lite/adodb.inc.php'; $GLOBALS['ADODB_FETCH_MODE'] = ADODB_FETCH_ASSOC; // this should be in config, but how? SysLog::Instance()->log("AdodbLiteDatabaseEngine::Preparing dbtype:" . $this->mDbConfig['db_type']); $this->mrDbConnection = ADONewConnection($this->mDbConfig['db_type']); // set debug mode via configuration $this->mrDbConnection->debug = (bool) $this->mDbConfig['db_debug_enabled']; SysLog::Instance()->log("AdodbLiteDatabaseEngine::Done preparing dbtype:" . $this->mDbConfig['db_type']); }
final function Send() { $result = $this->ProcessRequest(); $dbMsg = SysLog::Instance()->getAllError(); if (isset($result["exec"]) && !empty($dbMsg)) { $result["exec"] = "message=" . json_encode($dbMsg) . ";for(var msg in message){console.log(message[msg]);};" . $result["exec"]; } elseif (isset($result["exec"]) && empty($dbMsg)) { $result["exec"] = "if(console.clear != undefined)console.clear(); if(window.clear != undefined) window.clear();" . $result["exec"]; } elseif (!isset($result["exec"]) && !empty($dbMsg)) { $result["exec"] = "message=" . json_encode($dbMsg) . ";for(var msg in message){console.log(message[msg]);};" . $result; } $result = $this->returnJSON($result); echo "{$result}"; }
function __construct($dbConfig = NULL) { parent::__construct($dbConfig); // preparing wsdl cache configuration if (!isset($this->mDbConfig['db_wsdl_cache_enabled'])) { $this->mDbConfig['db_wsdl_cache_enabled'] = TRUE; } ini_set('soap.wsdl_cache_enabled', (string) intval($this->mDbConfig['db_wsdl_cache_enabled'])); $this->mDbConfig['db_wsdl_cache_lifetime'] = $this->mDbConfig['db_wsdl_cache_lifetime'] != '' ? (int) $this->mDbConfig['db_wsdl_cache_lifetime'] : 60 * 60 * 24; // defaults to 1 day ini_set('soap.wsdl_cache_ttl', $this->mDbConfig['db_wsdl_cache_lifetime']); $this->mDbConfig['db_wsdl_cache_path'] = file_exists($this->mDbConfig['db_wsdl_cache_path']) ? $this->mDbConfig['db_wsdl_cache_path'] : Configuration::Instance()->GetTempDir(); ini_set('soap.wsdl_cache_dir', $this->mDbConfig['db_wsdl_cache_path']); $this->mDbConfig['db_connection_timeout'] = $this->mDbConfig['db_connection_timeout'] != '' ? (int) $this->mDbConfig['db_connection_timeout'] : 30; // default to 30 SysLog::Instance()->Log('PhpSoapDatabaseEngine::__construct', 'DatabaseEngine'); }
/** * Request SSID atribute (eg: username, etc) which will then be used to log into local system and run the system as usual (without SSO) * @param string $Ssid * @param string $domain system id * @return array Refer to SsidAttributes class (ssolib.php) * @todo make return value an object * @see SsidAttributes */ function requestSsidAttributes($Ssid, $domain) { // TODO: makesure it's ecrypted before trasmited over the net //$this->mSoapClient->debug = true; $result = $this->mSoapClient->call('RequestSsidAttributes', array('sso_ssid' => $Ssid, 'sso_systemid' => $domain)); SysLog::Instance()->log("requestSsidAttributes soaprequest: " . print_r($this->mSoapClient->request, true), "SsoClient"); SysLog::Instance()->log("requestSsidAttributes soapresponse: " . print_r($this->mSoapClient->response, true), "SsoClient"); //SysLog::Instance()->log("requestSsidAttributes response data: ".print_r($this->mSoapClient->responseData, true), "SsoClient"); SysLog::Instance()->log("requestSsidAttributes got SsidAttributes: " . print_r($result, true), "SsoClient"); //SysLog::Instance()->log("requestSsidAttributes debug: ".$this->mSoapClient->getDebug(), "SsoClient"); //echo htmlentities($this->mSoapClient->getDebugAsXMLComment()); //$this->mSoapClient->debug = false; // echo "<pre>".htmlentities($this->mSoapClient->Response); // var_dump($this->mSoapClient); // echo "</pre>"; // die(); return $result; }
public function AllowedToAccess($module, $submodule, $action, $type) { if (Authentication::instance()->checkValidationAppClint() && Authorization::instance()->IsAllowedToAccess($module, $submodule, $action, $type, Authentication::instance()->getApplicationId())) { return true; } elseif (!Authentication::instance()->checkValidationAppClint() && Authorization::instance()->IsAllowedToAccess($module, $submodule, $action, $type, Authentication::instance()->getApplicationId())) { return true; } else { $dbMsg = SysLog::Instance()->getAllError(); if (!empty($dbMsg)) { echo "<pre>"; for ($i = 0; $i < count($dbMsg); $i++) { echo $dbMsg[$i]; } echo "</pre>"; } Log::Instance()->SendLog('Gagal akses, request denied'); die('You don\'t have permission to access this service'); } }
function DoLogin() { $this->mUser->mUserName = $this->mUserName; $this->FetchUserInfo(); SysLog::Instance()->log('User (' . $this->mUserName . ') active: ' . $this->GetCurrentUser()->GetActive(), 'login'); if ($this->GetCurrentUser()->GetActive() != 'Yes') { return FALSE; } SysLog::Instance()->log('Comparing: (supplied) ' . md5($this->mPassword) . ' == (original) ' . $this->GetCurrentUser()->GetPassword(), 'login'); if ($this->GetCurrentUser()->GetPassword() == md5($this->mPassword)) { SysLog::Instance()->log('Logged in!', 'login'); $this->mIsLoggedIn = true; $_SESSION['is_logged_in'] = true; $_SESSION['username'] = $this->mUserName; Session::Instance()->Restart(); // regenerate session_id, prevent session fixation } else { $this->mIsLoggedIn = false; } return $this->mIsLoggedIn; }
public function __set($name, $value) { SysLog::Instance()->Log('Warning: Attempting to access security objects while security is off! Command was ' . $name . '.', 'security'); }
function DoLogin() { SysLog::Instance()->log('login(remote): Starting', 'login'); $def_svc = new LoginConsumer(); return $def_svc->service_auth_Login($this->mUsername, $this->mPassword, $this->mPasswordIsHashed); }
private function RegisterServiceBySoapClass($wsdlConfig = NULL) { if (!$wsdlConfig) { return FALSE; } list($file_name, $class_name) = Dispatcher::Instance()->GetModule($wsdlConfig['module'], $wsdlConfig['submodule'], $wsdlConfig['action'], $wsdlConfig['type']); if ($file_name !== FALSE && !class_exists($class_name, FALSE)) { require_once $file_name; eval('$service_description = ' . $class_name . '::$mServiceDescriptions;'); if (!empty($service_description)) { $soap_obj = new soap_server(); eval('$service_binding_style = ' . $class_name . '::$mServiceBindingStyle;'); $soap_obj->configureWSDL($class_name, FALSE, Configuration::Instance()->GetValue('application', 'baseaddress') . Dispatcher::Instance()->GetUrl($wsdlConfig['module'], $wsdlConfig['submodule'], $wsdlConfig['action'], $wsdlConfig['type']), $service_binding_style); // register functions to be exposed as service if (isset($service_description['service']) && is_array($service_description['service'])) { $class_methods = get_class_methods($class_name); foreach ($service_description['service'] as $func_name => $params) { // skip undeclared functions if (!in_array('Service' . $func_name, $class_methods)) { SysLog::Instance()->log('Undeclared WS operation detected! Operation name of ' . $func_name . ' has not been implemented', 'wsdlgenerator'); continue; } if (is_array($params) && $params != NULL) { $soap_obj->register($func_name, $params['in'], $params['out'], $params['namespace'], $params['soapaction'], $params['style'], $params['use'], $params['documentation'], $params['encodingStyle']); } else { $soap_obj->register($func_name); } } } // register types used in services if (isset($service_description['type']) && is_array($service_description['type'])) { foreach ($service_description['type'] as $type_name => $params) { if (is_array($params) && $params != NULL) { if ($params['typeClass'] == 'complexType' || $params['typeClass'] == 'attribute') { $soap_obj->wsdl->addComplexType($type_name, $params['typeClass'], $params['phpType'], $params['compositor'], $params['restrictionBase'], $params['elements'], $params['attrs'], $params['arrayType']); } else { if ($params['typeClass'] == 'simpleType') { // always scalar $soap_obj->wsdl->addSimpleType($type_name, $params['restrictionBase'], $params['typeClass'], 'scalar', $params['enumeration']); } } } } } $this->RegisterServiceByWsdlObject($soap_obj->wsdl); } } }
function Dispatch() { // send header first header('Cache-Control: no-cache, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); if (isset($_SERVER['HTTP_X_GTFWMODULETYPE'])) { $type = $_SERVER['HTTP_X_GTFWMODULETYPE']; } else { $type = null; } //SysLog::Log("HEADER: " .$_SERVER['X-GtfwModuleType'], 'dispatcher'); SysLog::Log("HEADER: " . $type, 'dispatcher'); $module = ''; $submodule = ''; $action = ''; $type = ''; if (Configuration::Instance()->GetValue('application', 'url_type') == 'Long') { if (isset($_REQUEST['mod']) && isset($_REQUEST['sub']) && isset($_REQUEST['act']) && isset($_REQUEST['typ']) || $_REQUEST['typ'] == "rest") { // hack for requests/responses that don't need obfuscation if (in_array($_REQUEST['typ'], Configuration::Instance()->GetValue('application', 'url_obfuscator_exception'))) { Configuration::Instance()->RegisterHook($this); } // $module = $this->Decrypt($_REQUEST['mod']); $submodule = $this->Decrypt($_REQUEST['sub']); $action = $this->Decrypt($_REQUEST['act']); $type = $this->Decrypt($_REQUEST['typ']); SysLog::Log("Long URL \$_REQUEST", 'dispatcher'); } else { SysLog::Log("No \$_REQUEST set for Long URL {$_REQUEST['mod']}", 'dispatcher'); } } elseif (Configuration::Instance()->GetValue('application', 'url_type') == 'Short') { if (isset($_REQUEST['mid'])) { $module_id = $this->Decrypt($_REQUEST['mid']); $request_translated = $this->TranslateRequestToLong($module_id); if (is_array($request_translated)) { $module = $request_translated[0]; $submodule = $request_translated[1]; $action = $request_translated[2]; $type = $request_translated[3]; } } } elseif (Configuration::Instance()->GetValue('application', 'url_type') == 'Path') { list(, , $module, , $submodule, , $action, , $type, ) = explode('/', $_SERVER['PATH_INFO']); $module = $this->Decrypt($module); $submodule = $this->Decrypt($submodule); $action = $this->Decrypt($action); $type = $this->Decrypt($type); } SysLog::Log("Translated request: {$module}/{$submodule}/{$action}/{$type} from " . print_r($_REQUEST, true), 'dispatcher'); // default if ($module == '' && $submodule == '' && $action == '' && $type == '') { $module = Configuration::Instance()->GetValue('application', 'default_module'); $submodule = Configuration::Instance()->GetValue('application', 'default_submodule'); $action = Configuration::Instance()->GetValue('application', 'default_action'); $type = Configuration::Instance()->GetValue('application', 'default_type'); } // hack to overide any typ specified before. if (isset($_COOKIE['GtfwModuleType'])) { $type = $_COOKIE['GtfwModuleType']->Raw(); // delete the cookie setcookie('GtfwModuleType', '', mktime(5, 0, 0, 7, 26, 1997)); } if (isset($_SERVER['HTTP_X_GTFWMODULETYPE'])) { $type = $_SERVER['HTTP_X_GTFWMODULETYPE']; } SysLog::Log("Final request: {$module}/{$submodule}/{$action}/{$type}", 'dispatcher'); $this->mModule = $module; $this->mSubModule = $submodule; $this->mAction = $action; $this->mType = $type; if (class_exists('ServiceSecurity')) { if (ServiceSecurity::Instance()->AllowedToAccess($module, $submodule, $action, $type)) { list($file_path, $class_name) = $this->GetModule($module, $submodule, $action, $type); if (FALSE === $file_path) { $dbMsg = SysLog::Instance()->getAllError(); if (!empty($dbMsg)) { echo "<pre>"; for ($i = 0; $i < count($dbMsg); $i++) { echo $dbMsg[$i]; } echo "</pre>"; } die('Service Not Found'); } else { $this->DispacherSend($type, $file_path, $class_name); } } } else { SysLog::Instance()->log("Security::Instance()->AllowedToAccess({$module}, {$submodule}, {$action}, {$type})", 'sanitizer'); if (Security::Instance()->AllowedToAccess($module, $submodule, $action, $type)) { list($file_path, $class_name) = $this->GetModule($module, $submodule, $action, $type); if (FALSE === $file_path) { $this->ModuleNotFound(); } else { if (!Security::Instance()->IsProtocolCheckPassed($module, $submodule, $action, $type)) { // redirect to https or http $url = Configuration::Instance()->GetValue('application', 'baseaddress'); if (!isset($_SERVER['HTTPS'])) { $url = preg_replace('/^http:/', 'https:', $url); } $url .= $this->GetUrl($module, $submodule, $action, $type); Redirector::RedirectToUrl($url); } else { $this->DispacherSend($type, $file_path, $class_name); } } } else { Security::Instance()->RequestDenied(); } } }
function DoLogout() { SysLog::Instance()->log('DoLogout default', 'login'); return TRUE; }
function invoke_method() { // debug SysLog::Instance()->log('request invocation of: ' . $this->methodname . ' from: ' . $this->methodURI, 'soapgatewaybase'); $this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction); if ($this->wsdl) { if ($this->opData = $this->wsdl->getOperationData($this->methodname)) { $this->debug('in invoke_method, found WSDL operation=' . $this->methodname); $this->appendDebug('opData=' . $this->varDump($this->opData)); } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) { // Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element $this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']); $this->appendDebug('opData=' . $this->varDump($this->opData)); $this->methodname = $this->opData['name']; } else { $this->debug('in invoke_method, no WSDL for operation=' . $this->methodname); $this->fault('Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service"); return; } } else { $this->debug('in invoke_method, no WSDL to validate method'); } if (preg_match('/(.*)?\\_(.*)/', $this->methodname, $matches)) { $prefix = $matches[1]; $methodname = $matches[2]; $this->realMethodName = $methodname; } // does method exist? $classInstance = NULL; if (isset($this->mFunctionContainer[$this->methodname])) { eval("\$classInstance = new {$this->mFunctionContainer[$this->methodname]}();"); if (method_exists($classInstance, 'providesService')) { // SoapGateway1 support $valid_method = $classInstance->providesService($this->realMethodName); } else { $valid_method = method_exists($classInstance, $this->realMethodName); } if ($invalid_method) { $this->debug("in invoke_method, function '{$this->methodname}' not found!"); $this->result = 'fault: method not found'; $this->fault('Client', "method '{$this->methodname}' not defined in service"); return; } } else { return; } // evaluate message, getting back parameters // verify that request parameters match the method's signature if (!$this->verify_method($this->methodname, $this->methodparams)) { // debug $this->debug('ERROR: request not verified against method signature'); $this->result = 'fault: request failed validation against method signature'; // return fault $this->fault('Client', "Operation '{$this->methodname}' not defined in service."); return; } // if there are parameters to pass $this->debug('in invoke_method, params:'); $this->appendDebug($this->varDump($this->methodparams)); $this->debug("in invoke_method, calling '{$this->methodname}'"); if (!function_exists('call_user_func_array')) { $this->debug('in invoke_method, calling function using eval()'); $funcCall = "\$this->methodreturn = \$classInstance->{$this->realMethodName}("; if ($this->methodparams) { foreach ($this->methodparams as $param) { if (is_array($param)) { $this->fault('Client', 'NuSOAP does not handle complexType parameters correctly when using eval; call_user_func_array must be available'); return; } $funcCall .= "\"{$param}\","; } $funcCall = substr($funcCall, 0, -1); } $funcCall .= ');'; $this->debug('in invoke_method, function call: ' . $funcCall); @eval($funcCall); } else { $this->debug('in invoke_method, calling function using call_user_func_array()'); $call_arg = array(&$classInstance, $this->realMethodName); $this->methodreturn = call_user_func_array(array(&$classInstance, $this->realMethodName), $this->methodparams); } $this->debug('in invoke_method, methodreturn:'); $this->appendDebug($this->varDump($this->methodreturn)); if (!is_object($this->methodreturn)) { $this->debug("in invoke_method, called method {$this->realMethodName}, received {$this->methodreturn} of type " . gettype($this->methodreturn)); } else { $this->debug("in invoke_method, called method {$this->realMethodName}, received result of type " . gettype($this->methodreturn)); } }
function Display($asModule = FALSE) { $urlAsModule = $_REQUEST['ascomponent']->Integer()->Raw() == 1; $this->mAsModule = $asModule || $urlAsModule; // dirty hack, for parent-child module communication $this->mrMainHtml = Dispatcher::Instance()->mrMainResponse; SysLog::Log('Finally, $this->mAsModule: ' . $this->mAsModule, 'htmlresponse'); $data = $this->ProcessRequest(); if ($this->mRedirected) { return; } // instantiate here, for efficiency reason // $vartemp = & new patTemplate(); $this->mrTemplate = new patTemplate(); $this->mrTemplate->useTemplateCache('File', array('cacheFolder' => './tmplCache', 'lifetime' => 10, 'filemode' => 0644)); // if this response is originated from dispatcher // ie. it will return the whole document // on the other side, it will return part of document (a.k.a module) // when $asModule is set to TRUE if (!$this->mAsModule) { $this->TemplateBase(); } else { // use form helper SysLog::Log('Preparing FormHelper template', 'formhelper'); $this->PrepareFormHelperTemplateBase(); } $this->TemplateModule(); $this->ParseTemplate($data); // prepare FormHelperJs $fhm = new FormHelperManager($this->mFormHelpers); if ($this->mAsModule) { $this->mrTemplate->addVar('form-helper-common', 'FORM_HELPER', $fhm->GetFormHelperManagerJs(false)); } // set body extra, i.e. onload, onclick, etc if (!$this->mAsModule) { if ($this->mrTemplate->exists('document')) { if (!empty($this->mBodyAttribute)) { $body_extra = ''; foreach ($this->mBodyAttribute as $attribute => $value) { $body_extra .= ' ' . $value[0] . '=' . $value[1]; } $this->mrTemplate->addVar('document', 'BODY_ATTRIBUTE', $body_extra); ///TODO: onload attribute will clash with formHelper, so it's better to have special treatment for onload here } if (!empty($this->mRawHead)) { $raw_head = ''; foreach ($this->mRawHead as $content) { $raw_head .= $content; } $this->mrTemplate->addVar('document', 'RAW_HEAD', $raw_head); } $this->mrTemplate->addVar('document', 'RAW_HEAD', $fhm->GetFormHelperManagerJs()); } } if (Configuration::Instance()->GetValue('application', 'url_friendly')) { $this->mrTemplate->addVar('document', 'RAW_BASEURL', Configuration::Instance()->GetValue('application', 'basedir')); $this->mrTemplate->addVar('content', 'RAW_BASEURL', Configuration::Instance()->GetValue('application', 'basedir')); } $delButton = Security::Instance()->ModuleDenied(Dispatcher::Instance()->mModule); $script = "<script>if(window.ButtonAccess){ var ba = new ButtonAccess(" . json_encode($delButton) . "); ba.removeButton();}</script>"; $dbMsg = SysLog::Instance()->getAllError(); $logMessage = "\r\n\t\t<script>\r\n\t\t\tmessage=" . json_encode($dbMsg) . ";\r\n\t\t\t\r\n\t\t\tfor(var msg in message){\r\n\t\t\t\tconsole.log(message[msg]);\r\n\t\t\t}\r\n\t\t</script>"; $cleanLog = ""; if (empty($dbMsg)) { $cleanLog = "\r\n\t\t\t<script>\r\n\t\t\t\t//if(console.clear != undefined)\r\n\t\t\t\t//\tconsole.clear();\r\n\t\t\t\t\r\n\t\t\t\t//if(window.clear != undefined)\r\n\t\t\t\t//\t\twindow.clear();\r\n\t\t\t</script>"; } ob_start(); $this->mrTemplate->displayParsedTemplate(); $content = ob_get_contents(); ob_end_clean(); # $doc = new DOMDocument; # # $doc->loadHTML($content); # # $items = $doc->getElementsByTagName("a"); # print_r($items->item(0)->getAttribute("href")); # exit; echo $content . $script . $logMessage . $cleanLog; }
private function buildResponseObject($requestOrExceptionObject, $service = null) { if (is_null($service)) { $responseBody = new RpcError($requestOrExceptionObject->getMessage(), $requestOrExceptionObject->getCode()); $responseObject = new RpcResponse($responseBody); } else { ob_start(); $callbackResult = $this->call($service, $requestOrExceptionObject); ob_end_clean(); $debugLog = SysLog::Instance()->getAllError(); if (!empty($debugLog)) { $callbackResult[] = $debugLog; } $responseObject = new RpcResponse($callbackResult, $requestOrExceptionObject->id); } return $responseObject; }
public function __call($name, $args) { SysLog::Instance()->log('Warning: about to call driver\'s specific method (' . $name . ')!', ucwords($this->mDbConfig['db_driv']) . 'DatabaseEngine'); return call_user_func_array(array(&$this->mrDbEngine, $name), $args); }
/** Interceptor. Detect service call, preceeded with service_. Dispatch accordingly */ function __call($func, $args) { if (preg_match("/service_(.*)/", $func, $found)) { // what to call SysLog::Instance()->log("Invoking: {$found[1]}", 'soapgateway'); // auto export cookie $outgoing_cookies = RemoteCookieManager::GetCookies(); SysLog::Instance()->log("outgoing cookie: \n" . print_r($outgoing_cookies, true), 'cookie'); if (is_array($outgoing_cookies)) { foreach ($outgoing_cookies as $cookie_hash => $cookie) { $this->SetCookie($cookie); } } if (isset($this->mCookies)) { foreach ($this->mCookies as $cookie) { $this->mProxy->SetCookie($cookie); } } //return call_user_func_array(array(&$this->mProxy, $func, $args )); $res = call_user_func_array(array(&$this->mProxy, $found[1]), $args); // auto import cookie $incoming_cookie = $this->mProxy->getCookies(); SysLog::Instance()->log("incoming cookie: \n" . print_r($incoming_cookie, true), 'cookie'); if (is_array($incoming_cookie)) { foreach ($incoming_cookie as $cookie) { RemoteCookieManager::SetCookie($cookie); } } return $res; } else { return call_user_func_array(array(&$this, $func), $args); } // recursive? }
public function LastInsertId() { if ($this->mrDbConnection->debug) { ob_start(); } $insertId = $this->mrDbConnection->Insert_ID(); if ($this->mrDbConnection->debug) { SysLog::Instance()->addQueryLog(strip_tags(ob_get_contents())); ob_end_clean(); } return $insertId; }
private function send() { $status = isset($this->response['status']) ? $this->response['status'] : 200; $contentType = $this->getResponseContentType($this->request['content-type']); $body = empty($this->response['body']) ? '' : $this->response['body']; $headers = 'HTTP/1.1 ' . $status . ' ' . $this->getStatusMessage($status); header($headers); header('Content-Type: ' . $contentType); $dbMsg = SysLog::Instance()->getAllError(); echo $body; print_r($dbMsg); }
public function SetDebugOff() { SysLog::Instance()->log("Debug is not available", "testdb"); }
function IsLoggedIn() { if (!$this->mSecurityEnabled) { return FALSE; } SysLog::Instance()->log('Security::IsLoggedIn: ' . $this->mAuthentication->IsLoggedIn(), 'login'); return $this->mAuthentication->IsLoggedIn(); }