3 # Retrieve appconfig.xml file for cu specificed by ORG 4 # Insert <ANNOUNCE> tag content if applicable 6 # APPID : Identifies partner. Use OFXRQ for iPhone, OFXAA for Android 8 # APPVERSION : specify app code version 9 # DATAVERSION : specify version of returned data 18 require_once(dirname(__FILE__) .
'/../../shared/library/hcuCommon.i');
19 require_once(dirname(__FILE__) .
'/../../shared/library/dms_imp_val.i');
20 require_once(dirname(__FILE__) .
'/../../shared/library/hcuAppCommon.i');
24 "APPID" => array(
'filter' => FILTER_SANITIZE_STRING),
25 "ORG" => array(
'filter' => FILTER_SANITIZE_STRING)
28 HCU_ImportVars( $inPost,
"", $varOk );
32 if ($_SERVER[
'REQUEST_METHOD'] !=
'POST')
33 throw new Exception(
'Unauthorized Method',2010);# post method required
35 $inPost[
"APPID"] = trim( $inPost[
"APPID"] );
36 switch ($inPost[
'APPID']) {
39 $client_source_override =
'APP';
46 $client_source_override =
'ADA';
52 $HB_ENV[
'SYSENV'][
'logger']->info(
'request: ' . HCU_JsonEncode($_REQUEST));
53 $HB_ENV[
'SYSENV'][
'logger']->info(
'inPost: ' . HCU_JsonEncode($inPost));
54 throw new Exception(
"Unauthorized ID",2020); # invalid app
id 57 if (empty($inPost[
'ORG'])) {
58 throw new Exception(
"Invalid Credentials",2030); # Missing values
63 $serviceMinimal =
true;
64 $serviceShowInfo =
false;
65 $serviceLoadMenu =
false;
66 $serviceShowMenu =
false;
69 require_once(dirname(__FILE__) .
'/../library/hcuService.i');
75 $appconfig = GetAppConfig($CU,
'appconfig.xml');
86 if ($HB_ENV[
'flagset'] & GetFlagsetValue(
'CU_MEMRESET')) {
87 $links_arr[][
'hculink'] = array(
88 'url' => htmlentities(
"{$HB_ENV['loginpath']}/hcuResetPwd.prg?cu=" . trim(strtoupper($CU)), ENT_NOQUOTES | ENT_XML1,
'UTF-8', FALSE),
89 'label' => htmlentities($HB_ENV[
'MC']->msg(
'Forgot your password'), ENT_NOQUOTES | ENT_XML1,
'UTF-8', FALSE),
91 'location' =>
'FRONT');
95 if ($HB_ENV[
'flagset3'] & GetFlagsetValue(
'CU3_SHOW_ENROLL')) {
96 $links_arr[][
'hculink'] = array(
97 'url' => htmlentities(
"{$HB_ENV['loginpath']}/hcuActivate.prg?cu=" . trim(strtoupper($CU)), ENT_NOQUOTES | ENT_XML1,
'UTF-8', FALSE),
98 'label' => htmlentities($HB_ENV[
'MC']->msg(
'New To Home Banking'), ENT_NOQUOTES | ENT_XML1,
'UTF-8', FALSE),
100 'location' =>
'FRONT');
103 $frontLinks = assocArrayToXML($links_arr,
'frontlinks');
104 # add the front links results to the appconfig results 106 $appconfig = preg_replace(
'/<appfeed>/',
"<appfeed>{$frontLinks}",$appconfig);
109 header(
"Content-length: " . strlen($appconfig));
114 }
catch (Exception $e) {
115 $code = $e->getCode();
116 $message = $e->getMessage();
118 $xml_arr = array(
'STATUS' => array(
'CODE' => $code,
'SEVERITY' =>
'ERROR'),
119 'MESSAGE'=> array(
'ERR' => htmlspecialchars($message, ENT_NOQUOTES | ENT_XML1,
'UTF-8', FALSE),
'ERRNO' => 999,
'ERRSTAT' =>
'FAIL'));
121 send_response($xml_arr,
'XML');
128 function Format_AppFeed($data) {
134 $dom =
new DOMDocument();
136 $dom->preserveWhiteSpace =
false;
137 $dom->formatOutput =
true;
139 $dom->loadXML($data);
140 $out = $dom->saveXML();
142 $out = str_replace(
'<?xml version="1.0"?>',
'',$out);
147 function send_response($reply_arr, $sendas=
'XML') {
150 $xmlResp = HCU_JsonEncode($reply_arr);
151 header(
"Content-Type: application/json");
157 $xmlResp = assocArrayToXML($reply_arr,
'APPFEED');
158 header(
"Content-Type: application/x-ofx");
163 header(
"Content-length: " . strlen($xmlResp));
176 function assocArrayToXML($ar, $base=
'APPFEED')
178 $xml =
new SimpleXMLElement(
"<$base></$base>");
181 $f = create_function(
'$f,$c,$a',
' 182 foreach($a as $k=>$v) { 184 if (is_numeric($k)) { 187 $ch=$c->addChild($k); 196 $return = $xml->asXML();
198 $return = str_replace(
'<?xml version="1.0"?>',
'',$return);