15 function setLoginScript(&$p_hb_env) {
17 $loginscript =
'hcuLogin.prg';
19 $lEnvSet = HCU_array_key_value(
'SYSENV', $p_hb_env);
22 $lHttp = (HCU_array_key_value(
'require_encryption', $lEnvSet) == 0 && ($_SERVER[
'REQUEST_SCHEME'] !=
'https' && HCU_array_key_value(
'HTTP_X_FORWARDED_PROTO', $_SERVER) !=
'https') ?
'http://' :
'https://');
24 $chome = HCU_array_key_value(
"chome", $p_hb_env);
25 $p_hb_env[
'fi_path'] = $lHttp . $_SERVER[
'HTTP_HOST'] .
'/fi/' . $chome .
'/';
27 $loginpath = $lHttp . $_SERVER[
'HTTP_HOST'] . dirname($_SERVER[
'SCRIPT_NAME']);
29 $p_hb_env[
'loginscript'] =
"${loginpath}/${loginscript}";
30 $p_hb_env[
'loginpath'] = $loginpath;
34 $p_hb_env[
'homebankingpath'] = $lHttp . $_SERVER[
'HTTP_HOST'] .
"/" . returnBaseDirectory($_SERVER[
'SCRIPT_NAME']);
37 parse_str($_SERVER[
'QUERY_STRING'], $get_vars);
41 $cuAllowGet = array(
'cu'=>
'CU',
'testmenu'=>
'Show Test Menu');
43 $cu_query = array_intersect_key($get_vars, $cuAllowGet);
44 $p_hb_env[
'testmenu'] = intval(HCU_array_key_value(
'testmenu', $get_vars));
46 $p_hb_env[
'cuquery'] = http_build_query ($cu_query);
54 function recordCurrentAddress ($p_hb_env) {
60 $url_query_string = urlencode($_SERVER[
'QUERY_STRING']);
63 "https://".$_SERVER[
'HTTP_HOST'] .
64 $_SERVER[
'PHP_SELF'] .
"?" . $url_query_string,
67 $p_hb_env[
'TicketDomain'],
85 function buildMenuLinkOLD($pType, $pmenuDetail, $phb_env, $pactiveLink) {
92 if ($pType ==
'menu') {
93 $useMenuDetail = $pmenuDetail[
'detail'][$pmenuDetail[
'default']];
95 $useMenuDetail = $pmenuDetail;
105 if (substr($useMenuDetail[
'href'], 0, 4) !=
'http') {
107 $useLinkHref = $phb_env[
'homebankingpath'] . (substr($phb_env[
'homebankingpath'], -1) !=
'/' ?
'/' :
'') . $useMenuDetail[
'href'] .
"?";
109 $useLinkHref = $useMenuDetail[
'href'] .
"?";
112 if ($useMenuDetail[
'hrefUrlQuery'] == 1) {
113 $useLinkHref .= $phb_env[
'cuquery'];
116 if ($useMenuDetail[
'hrefExtraParam'] !=
'') {
117 $useLinkHref .=
"&" . $useMenuDetail[
'hrefExtraParam'];
121 if ($useMenuDetail[
'hrefMultiple'] !=
'') {
122 $useLinkHref .=
"&menuUniq=" . $useMenuDetail[
'hrefMultiple'];
125 if ($useMenuDetail[
'target'] !=
'') {
126 $useLinkTarget = $useMenuDetail[
'target'];
137 if ($pmenuDetail[
'display'][$phb_env[
'Flang']] !=
'') {
138 $useLinkDisplay = hcu_displayHtml($pmenuDetail[
'display'][$phb_env[
'Flang']]);
141 $useLinkDisplay = hcu_displayHtml($pmenuDetail[
'display'][
'en_US']);
145 if ($pType ==
'menu') {
146 $menuLink =
"<a href='{$useLinkHref}' target='{$useLinkTarget}'><span class='button " . ($pactiveLink ?
"item-active" :
"") .
"'>{$useLinkDisplay}</span></a>";
148 $menuLink =
"<li id='" . ($pactiveLink ?
"submenu-active" :
"") .
"'><a href='{$useLinkHref}' target='{$useLinkTarget}'>{$useLinkDisplay}</a>" . ($pactiveLink ?
'<span class="arrow"></span>' :
'') .
"</li>";
163 function hcuIsSerializedString($val){
164 if (!is_string($val)){
return false; }
165 if (trim($val) ==
"") {
return false; }
166 if (preg_match(
"/^(i|s|a|o|d):(.*);/si",$val) !==
false) {
return true; }
182 function SetTicket($pHbEnv, $cur, $newset) {
184 $ResetTicket = BuildSessionTicketStr($pHbEnv, $cur, $newset);
186 $lEnvSet = HCU_array_key_value(
'SYSENV', $pHbEnv);
187 HCU_setcookie_env($lEnvSet,
"Ticket", $ResetTicket, 0);
204 function BuildSessionTicketStr($pHbEnv, $currSet, $newSet) {
206 $secret = HCU_array_key_value(
'secret', $pHbEnv);
210 parse_str( urldecode($currSet), $cArray );
211 parse_str( urldecode($newSet), $newArray );
213 if ( count( $newArray) > 0 ) {
214 foreach ( $newArray as $key => $value) {
215 $cArray[$key] = $value;
219 $cArray[
'Ch'] = MD5($secret . MD5(join(
':',
222 $cArray[
'Ctime'], $cArray[
'Ce'], $cArray[
'Cu'], $cArray[
'Cn'], $cArray[
'Uid'],
223 $cArray[
'Clw'], urlencode(trim($cArray[
'Clu'])),
224 urlencode(trim($cArray[
'Fplog'])), urlencode(trim($cArray[
'Fflog'])),
225 $cArray[
'Ffchg'], $cArray[
'Ffreset'],
226 $cArray[
'Ffremain'], $cArray[
'Fmsg_tx'], $cArray[
'Fset'],
227 $cArray[
'Fset2'], $cArray[
'Fset3'], $cArray[
'Fhdays'],
228 urlencode($cArray[
'Ml']), trim($cArray[
"Ca"]), trim($cArray[
"platform"]), $cArray[
"sid"]
234 foreach ($cArray as $key => $value) {
235 $value = urlencode($value);
236 $newTicket .=
"${delim}${key}=${value}";
255 function BuildBaseSessionTicket( $pHbEnv ) {
257 $ticket =
"Cu={$pHbEnv["cu
"]}&Ce={$pHbEnv['Ce']}&Clw={$pHbEnv['Clw']}" 258 .
"&Clu={$pHbEnv['Clu']}" 259 .
"&Fplog={$pHbEnv['Fplog']}&Fflog={$pHbEnv['Fflog']}" 260 .
"&Ffchg={$pHbEnv['Ffchg']}&Ffreset={$pHbEnv['Ffreset']}" 261 .
"&Ffremain={$pHbEnv['Ffremain']}&Fmsg_tx={$pHbEnv['Fmsg_tx']}" 262 .
"&Fset={$pHbEnv['Fset']}&Fset2={$pHbEnv['Fset2']}" 263 .
"&Fhdays={$pHbEnv['Fhdays']}&Fset3={$pHbEnv['Fset3']}&Ca=";
265 $userName = isset( $pHbEnv[
"Cn"] ) ? $pHbEnv[
"Cn"] :
"";
266 $ticket .=
"&Cn=$userName";
268 $userId = isset( $pHbEnv[
"Uid"] ) ? $pHbEnv[
"Uid"] :
"";
269 $ticket .=
"&Uid=$userId";
271 $userEmail = isset( $pHbEnv[
"Ml"] ) ? $pHbEnv[
"Ml"] :
"";
272 $ticket .=
"&Ml=$userEmail";
276 $ticket .=
"&platform={$pHbEnv["platform
"]}";
279 $ticket .=
"&sid={$pHbEnv["sid
"]}";
294 function ReturnUnconfirmedTransactions($pDbh, $pHbEnv) {
296 $uId = $pHbEnv[
"Uid"];
304 t.user_id AS user_id, t.approved_status, t.feature_code, t.create_date 305 FROM cu_scheduledtxn t 306 INNER JOIN {$cu}user u 307 ON u.user_id = t.user_id 309 u.group_id = (SElECT group_id FROM {$cu}user where user_id = $uId) 313 (t.approved_status IS NULL OR t.approved_status = 0) 316 h.posted_by AS user_id, h.approved_status, h.feature_code, h.posted_date 318 INNER JOIN {$cu}user u 319 ON u.user_id = h.posted_by 321 u.group_id = (SElECT group_id FROM {$cu}user where user_id = $uId) 325 (h.approved_status IS NULL OR h.approved_status = 0)";
326 $sqlRs = db_query($sql, $pDbh);
327 $retData = db_fetch_all($sqlRs);
332 function ReturnUnreadSecureMsg ($p_dbh, $p_hb_env) {
335 $sql =
"SELECT count(*) as UnreadMsgCount 337 WHERE cu = '{$p_hb_env['Cu']}' 338 AND user_id = '{$p_hb_env['Uid']}' 342 $unreadRs = db_query($sql, $p_dbh);
344 list($retValue) = db_fetch_array($unreadRs, 0);
375 function PostSecureMessage( $formDataArray, $securePathFileName, $secureFormTitle, $emailData, $pHbEnv ) {
384 $secureFormData = <<< printblock
385 <?xml version=
"1.0"?><!doctype html>
386 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:lang=
"en" lang=
"en">
388 <title>$secureFormTitle</title>
389 <link href=
"https://{$pHbEnv['cloudfrontDomainName']}/homecu/css/KendoUI/{$pHbEnv['homecuKendoVersion']}/kendo.common.min.css" rel=
"stylesheet">
390 <link href=
"https://{$pHbEnv['cloudfrontDomainName']}/homecu/css/KendoUI/{$pHbEnv['homecuKendoVersion']}/kendo.default.min.css" rel=
"stylesheet">
392 <script type=
"text/javascript" src=
"https://{$pHbEnv['cloudfrontDomainName']}/jquery/js/jquery-1.9.1.min.js.gz"></script>
393 <script src=
"https://{$pHbEnv['cloudfrontDomainName']}/homecu/js/KendoUI/{$pHbEnv['homecuKendoVersion']}/kendo.web.min.js"></script>
396 .k-block {width: 500px}
397 .field-label-wrapper { margin: 0px 5px 5px 5px; padding: 0px 5px 5px 20px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; }
398 .field-label-wrapper label { display: block; padding: 10px 0 6px 4px; color: #333333; font-size:1.2em; margin-left: -10px; width: 100%; }
399 .field-label-wrapper label.note {color: red;font-weight: bold;}
400 .field-label-wrapper label.note:before {content:
"NOTE: "}
401 .field-label-wrapper label.field:after {content:
":"}
402 .field-label-wrapper label hr { z-index: 0; display:
inline-block; width: 100%; position:relative; top:-24px;background-color:#000000; }
405 <div
class=
'k-content'>
406 <div
class=
"k-block"><div
class=
"k-header k-shadow">$secureFormTitle</div>
410 foreach ($formDataArray as $dataIdx => $dataAttr) {
412 $printLabel = ($dataAttr[
'label'] !=
'' ?
"<label class='{$dataAttr['type']}'>{$dataAttr['label']}</label>" :
'');
413 $secureFormData .= <<< printblock
414 <div
class=
'field-label-wrapper'>
416 <div
class=
'field-value'>{$dataAttr[
'value']}</div>
421 $secureFormData .= <<< printblock
431 $secureFormFileHdl = fopen($securePathFileName,
'w');
432 if ($secureFormFileHdl) {
433 fwrite($secureFormFileHdl, $secureFormData);
434 fclose($secureFormFileHdl);
437 throw new Exception();
441 if ( $emailData && $emailData[
"target"] && $emailData[
"body"] ) {
446 $notify->mailto = $emailData[
"target"];
447 $notify->replyto = $emailData[
"reply"];
448 $notify->subject = $emailData[
"subject"];
449 $notify->msgbody = $emailData[
"body"];
450 $notify->callingfunction = __FUNCTION__;
451 $notify->file = __FILE__;
455 }
catch (Exception $ex) {
473 function GetConfirmCode() {
474 $conDate = getdate();
475 $conCode = sprintf(
'%08s',dechex(($conDate[
'yday'] + 1 .
477 $conDate[
'hours'] * 3600 +
478 $conDate[
'minutes'] * 60 +
479 $conDate[
'seconds'] )))));
481 $confirmId = sprintf(
'%s-%s-%s-%s',substr($conCode,0,2),substr($conCode,2,2),substr($conCode,4,2),substr($conCode,6,2));
493 function validateDate() {
494 # renamed copy of dms_checkdate out of cu_common_intl.i 499 if (func_num_args() == 1) {
500 $date_arg = func_get_arg(0);
503 if (preg_match(
"#^([0-9]{1,2})[/-]{1}([0-9]{1,2})[/-]{1}([0-9]{2,4})$#", $date_arg, $regs)) {
510 } elseif (func_num_args() == 3) {
511 $arg_date = func_get_args();
513 if ((strval(intval($arg_date[0])) != strval($arg_date[0])) || (strval(intval($arg_date[1])) != strval($arg_date[1])) || (strval(intval($arg_date[2])) != strval($arg_date[2]))) {
516 $m_val = $arg_date[0];
517 $d_val = $arg_date[1];
518 $y_val = $arg_date[2];
527 $retval = checkdate(intval($m_val), intval($d_val), intval($y_val));
551 function returnJsonDateValue($pCalDate) {
554 $curTZ = date_default_timezone_get();
556 date_default_timezone_set(
'UTC');
558 $strTimestamp = gmdate(
'U', strtotime($pCalDate)) * 1000;;
560 date_default_timezone_set($curTZ);
563 return $strTimestamp;
575 function savePacketStatusCookie($phb_env) {
576 $bolPacketMod =
false;
577 $logger = $phb_env[
'SYSENV'][
'logger'];
598 $curPktStatus = decodePacketStatusCookie($phb_env);
599 if ((trim($curPktStatus[
'asofdate']) != trim($phb_env[
'packetStatus'][
'asofdate'])) && $phb_env[
'packetStatus'][
'status'] !=
'900') {
600 $bolPacketMod =
true;
604 $phb_env[
'packetStatus'][
'r'] = rand(11111, 99999);
605 $encodedValue = hcu_encrypturl(json_encode($phb_env[
'packetStatus']), $phb_env[
'historyHash']);
607 HCU_setcookie_env($phb_env[
'SYSENV'], $phb_env[
'livePacketStatusCookie'], $encodedValue, 0);
611 return $bolPacketMod;
624 function retrievePacketStatusCookie(&$phb_env) {
626 $logger = $phb_env[
'SYSENV'][
'logger'];
628 if (HCU_array_key_value($phb_env[
'livePacketStatusCookie'], $_COOKIE)) {
630 $phb_env[
'packetStatus'] = decodePacketStatusCookie($phb_env);
631 $phb_env[
'lastupdate'] = $phb_env[
'packetStatus'][
'asofdate'];
652 function decodePacketStatusCookie($phb_env) {
654 $retPktStatusAry = Array (
660 if (HCU_array_key_exists($phb_env[
'livePacketStatusCookie'], $_COOKIE)) {
661 if ($_COOKIE[$phb_env[
'livePacketStatusCookie']]) {
662 $cookieValue = $_COOKIE[$phb_env[
'livePacketStatusCookie']];
663 $statusAry = json_decode(hcu_decrypturl($cookieValue, $phb_env[
'historyHash']),
true);
664 switch (json_last_error()) {
665 case JSON_ERROR_NONE:
671 if (is_array($statusAry)) {
673 if (array_key_exists(
'status', $statusAry) && array_key_exists(
'asofdate', $statusAry) && array_key_exists(
'reason', $statusAry)) {
674 $retPktStatusAry[
'status'] = substr(preg_replace(
'/[^0-9]/',
'', $statusAry[
'status']), 0, 3);
675 $retPktStatusAry[
'asofdate'] = substr(preg_replace(
'/[^0-9A-Za-z:\s]/',
'', $statusAry[
'asofdate']), 0, 30);
676 $retPktStatusAry[
'reason'] = substr(preg_replace(
'/[^0-9A-Za-z\s]/',
'', $statusAry[
'reason']), 0, 30);
683 return $retPktStatusAry;
699 function setFmsgTxCookie(&$phb_env, $pTransferListAry) {
710 if (isset($pTransferListAry[
'status'][
'Fmsg_tx']) && $phb_env[
'live']) {
711 if (intval($pTransferListAry[
'status'][
'Fmsg_tx']) != $phb_env[
'Fmsg_tx']) {
714 SetTicket($phb_env, $_COOKIE[
'Ticket'],
"Fmsg_tx=" . intval($pTransferListAry[
'status'][
'Fmsg_tx']));
716 $phb_env[
'Fmsg_tx'] = intval($pTransferListAry[
'status'][
'Fmsg_tx']);
732 function check_alias_format($p_useralias) {
736 if (preg_match(
"/^[a-zA-Z][^\\`,\"'\+\&\s;]*$/", $p_useralias) && strlen($p_useralias) > 5) {
774 function validateEmail($email_addr) {
775 # renamed copy of check_email out of cu_common_intl.i 781 (!preg_match(
"/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/", $email_addr))
783 (preg_match(
"/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/", $email_addr))
803 function GetLandingMenuTarget( $pHBEnv, $pMenuID, $pCurrentTicketCookie ) {
808 if ( $pMenuID > 0 ) {
809 $menuInfo = FetchFeatureMenu( $pHBEnv[
"dbh"], $pHBEnv[
"Cu"] );
810 if ( $menuInfo[
"code"] !=
"000" ) {
811 throw new Exception(
"Error Reading Menu", 1);
815 $menuEntry = array();
816 for ( $i = 0; $i < count( $menuInfo[
"data"] ); $i++ ) {
817 if ( $menuInfo[
"data"][$i][
"MenuItemId"] == $pMenuID ) {
818 $menuEntry = $menuInfo[
"data"][$i];
823 if ( !count( $menuEntry ) ) {
824 throw new Exception(
"Unable to find menu entry", 2);
830 if ( $menuEntry[
"details_hrefUrlQuery"] === 1 ) {
831 $params .= ( strlen( $params ) > 0 ) ?
"&" :
"";
833 $params .=
"cu=" . $pHBEnv[
'Cu'];
836 if ( strlen( $menuEntry[
"details_hrefExtraParam"] ) > 0 ) {
837 $params .= ( strlen( $params ) > 0 ) ?
"&" :
"";
839 $params .= $menuEntry[
"details_hrefExtraParam"];
843 $cookies = array(
"Ticket" => $pCurrentTicketCookie );
847 $payload = array(
"url" => $menuEntry[
"details_href"],
848 "parameters" => urlencode( $params ),
849 "cookies" => $cookies
852 $payloadJSON = HCU_JsonEncode( $payload );
855 $payloadKey = GetPayloadEncryptionKey(32);
857 $payloadEncrypted = EncryptPayloadData( $payloadJSON, $payloadKey );
859 $payloadString =
"&payload=$payloadEncrypted";
867 $target = $pHBEnv[
"homebankingpath"] .
"/webLanding.prg?cu=" . $pHBEnv[
"Cu"] . $payloadString;
868 }
catch( Exception $e ) {
886 function GetLandingURL( $pHBEnv, $pURL, $pCurrentTicketCookie ) {
890 if ( !empty($pURL) ) {
893 $pURL = urldecode($pURL);
894 $urlparts = parse_url($pURL);
895 if ( !is_array($urlparts) || !count( $urlparts ) ) {
896 throw new Exception(
"Invalid URL", 1);
898 if ( !HCU_array_key_value(
'scheme', $urlparts) ||
899 !HCU_array_key_value(
'host', $urlparts) ||
900 !HCU_array_key_value(
'path', $urlparts) ) {
901 throw new Exception(
"Invalid URL", 1);
904 $url = $urlparts[
'scheme'] .
"://" . $urlparts[
'host'];
905 if (HCU_array_key_value(
'port', $urlparts) ) {
906 $url .=
":{$urlparts['port']}";
908 $url .= $urlparts[
'path'];
910 $params = HCU_array_key_value(
'query', $urlparts);
912 $cookies = array(
"Ticket" => $pCurrentTicketCookie );
916 $payload = array(
"url" => $url,
917 "parameters" => urlencode( $params ),
918 "cookies" => $cookies
921 $payloadJSON = HCU_JsonEncode( $payload );
924 $payloadKey = GetPayloadEncryptionKey(32);
926 $payloadEncrypted = EncryptPayloadData( $payloadJSON, $payloadKey );
928 $payloadString =
"&payload=$payloadEncrypted";
936 $target = $pHBEnv[
"homebankingpath"] .
"/webLanding.prg?cu=" . $pHBEnv[
"Cu"] . $payloadString;
937 }
catch( Exception $e ) {
955 function GetUserProfileUpdates( $pHBEnv ) {
957 global $MEM_FORCE_RESET;
959 $returnInfo = array();
965 if ( HCU_array_key_exists(
"Ffchg", $pHBEnv) && $pHBEnv[
'Ffchg'] ==
'Y' ) {
966 if ( $pHBEnv[
'Ffremain'] > 1 ) {
967 $expireMessage = $MC->combo_msg(
"Login Expiring", HCU_DISPLAY_AS_HTML,
"#REMAIN#", $pHBEnv[
'Ffremain']);
968 $icon =
"exclamation";
971 $expireMessage = $MC->combo_msg(
"Login Expired");
972 $icon =
"exclamation-triangle";
976 $url = $pHBEnv[
"platform"] ==
"ADA" || $pHBEnv[
"platform"] ==
"APP" ?
"hcuProfilePwd.prg" : $pHBEnv[
'loginpath'] .
"/hcuProfilePwd.prg?" . $pHBEnv[
'cuquery'];
978 $returnInfo[
"password"] = array(
"title" => $MC->msg(
"Important"),
979 "message" => $expireMessage,
982 "link" => $MC->msg(
"Update Now"),
988 if ( HCU_array_key_exists(
"Ffreset", $pHBEnv) && (($pHBEnv[
'Ffreset'] & $MEM_FORCE_RESET) > 0) ) {
989 if ( $pHBEnv[
'Ffremain'] > 1 ) {
990 $expireMessage = $MC->combo_msg(
"Challenge Update", HCU_DISPLAY_AS_HTML,
"#REMAIN#", $pHBEnv[
'Ffremain']);
991 $icon =
"exclamation";
994 $expireMessage = $MC->combo_msg(
"Challenge Expired");
995 $icon =
"exclamation-triangle";
999 $url = $pHBEnv[
"platform"] ==
"ADA" || $pHBEnv[
"platform"] ==
"APP" ?
"hcuProfileSecurity.prg" : $pHBEnv[
'loginpath'] .
"/hcuProfileSecurity.prg?" . $pHBEnv[
'cuquery'];
1001 $returnInfo[
"security"] = array(
"title" => $MC->msg(
"Important"),
1002 "message" => $expireMessage,
1005 "link" => $MC->msg(
"Update Now"),
1011 if ( HCU_array_key_exists(
"Fmsg_tx", $pHBEnv) && (($pHBEnv[
'Fmsg_tx'] & GetMsgTxValue(
'MSGTX_FORCE_EM')) !== 0) ) {
1012 $emailTitle = $MC->msg(
"Bad Email Flag");
1013 $icon =
"exclamation-triangle";
1016 $emailTitle = $MC->msg(
"Current email Part 1");
1021 $url = $pHBEnv[
"platform"] ==
"ADA" || $pHBEnv[
"platform"] ==
"APP" ?
"hcuProfileEmail.prg" : $pHBEnv[
'loginpath'] .
"/hcuProfileEmail.prg?" . $pHBEnv[
'cuquery'];
1023 $returnInfo[
"email"] = array(
"title" => $emailTitle,
1024 "message" => HCU_array_key_exists(
"Ml", $pHBEnv) ? $pHBEnv[
'Ml'] :
"",
1027 "link" => $MC->msg(
"Update Now"),
1032 $returnString = HCU_JsonEncode( $returnInfo );
1034 return $returnString;
1112 function CompassMenuJson($HB_ENV, $dbh) {
1115 $items = [
'logout',
'activity',
'messages',
'status',
'user'];
1116 $menu_list = CompassGetBankingMenu($HB_ENV, $dbh);
1118 foreach ($items as $item) {
1120 if (! CompassValidMenuItem($item, $HB_ENV, $dbh)) {
1124 $node = CompassMenuItem($item, $HB_ENV, $dbh, $menu_list);
1126 $menu[$item] = $node;
1130 return HCU_JsonEncode($menu);
1141 function CompassGetBankingMenu($HB_ENV, $dbh) {
1143 require_once(
'sFeatureMnu.i');
1144 return FetchFeatureMenu($dbh, $HB_ENV[
'cu']);
1154 function CompassValidMenuItem($item, $HB_ENV, $dbh) {
1156 if ($item ===
'messages') {
1157 return CompassValidateSecureMessages($HB_ENV);
1160 if ($item ==
'activity') {
1161 return CompassValidateUserMenu($HB_ENV, $dbh);
1172 function CompassValidateSecureMessages($HB_ENV) {
1175 ($HB_ENV[
'Fset2'] & GetFlagsetValue(
"CU2_ALLOWMESSAGE")) !=
1176 GetFlagsetValue(
"CU2_ALLOWMESSAGE")
1190 function CompassValidateUserMenu($HB_ENV, $dbh) {
1192 $tx_types = Get_HaveTrans($dbh,$HB_ENV);
1193 return in_array(
'AT', array_keys($tx_types));
1206 function CompassMenuItem($item, $HB_ENV, $dbh, $menu_list)
1210 return CompassLogout($HB_ENV, $menu_list);
1212 return CompassActivity($HB_ENV, $dbh, $menu_list);
1214 return CompassMessages($HB_ENV, $dbh, $menu_list);
1216 return CompassStatus($HB_ENV, $menu_list);
1218 return CompassUser($HB_ENV, $menu_list);
1230 function CompassLogout($HB_ENV, $menu_list) {
1232 list (, $title) = CompassGetMenuIdAndTitle($HB_ENV, $menu_list,
'hcuLogout.prg',
'Sign Out');
1235 'display' => $title,
1236 'icon' =>
'power-off',
1239 'script' =>
'hcuLogout.prg' 1254 function CompassGetMenuIdAndTitle(
1257 $script =
'hcuAccounts.prg',
1258 $default =
'Menu Item',
1259 $banking_menu =
false 1262 $lang = ($HB_ENV[
'MC']->lang)?? ($HB_ENV[
'Flang'])??
'en_US';
1264 if ($banking_menu) {
1265 return CompassBankingMenuTitle($menu_list, $script, $lang, $default);
1268 if (isset($HB_ENV[
'MC'])) {
1270 $title = $HB_ENV[
'MC']->msg($default, HCU_DISPLAY_AS_HTML);
1272 if (empty($title)) {
1273 return [0, $default];
1279 return [0, $default];
1295 function CompassBankingMenuTitle($menu_list, $script, $lang =
'en_US', $default =
'Menu Item') {
1297 if (! isset($menu_list[
'data'])) {
1298 return [0, $default];
1301 foreach ($menu_list[
'data'] as $menu_arr) {
1306 'en_US' =>
'details_display_en_US',
1307 'es_US' =>
'details_display_es_US',
1308 'pl_US' =>
'details_display_pl_US' 1311 if ($menu_arr[
'details_href'] == $script) {
1312 return [$menu_arr[
'MenuItemId'], $menu_arr[$arr[$lang]]];
1316 return [0, $default];
1326 function CompassActivity($HB_ENV, $dbh, $menu_list) {
1328 list ($menu_id, $title) = CompassGetMenuIdAndTitle($HB_ENV, $menu_list,
'hcuUserActivity.prg',
'User Activity',
true);
1330 'display' => $title,
1332 'count' => CompassCountUserActivity($HB_ENV, $dbh),
1333 'menuid' => $menu_id,
1334 'script' =>
'hcuUserActivity.prg',
1346 function CompassCountUserActivity($HB_ENV, $dbh)
1349 $ucTransactions = ReturnUnconfirmedTransactions($dbh, $HB_ENV);
1351 if (is_array($ucTransactions)) {
1352 foreach ($ucTransactions as $key => $value) {
1354 $canConfirm = Perm_AccessRights($dbh, $HB_ENV, [
"feature" => $value[
'feature_code']]);
1356 if ($canConfirm[
'confirm']) {
1373 function CompassMessages($HB_ENV, $dbh, $menu_list) {
1375 list ($menu_id, $title) = CompassGetMenuIdAndTitle($HB_ENV, $menu_list,
'hcuSecureMail.prg',
'Secure Messages',
true);
1378 'display' => $title,
1379 'icon' =>
'comments',
1380 'count' => ReturnUnreadSecureMsg($dbh, $HB_ENV),
1381 'menuid' => $menu_id,
1382 'script' =>
'hcuSecureMail.prg',
1393 function CompassStatus($HB_ENV, $menu_list) {
1395 list ($menu_id, $title) = CompassGetMenuIdAndTitle($HB_ENV, $menu_list,
'hcuAccountStatus.prg',
'Login Status');
1398 'display' => $title,
1401 'endpoint' =>
"{$HB_ENV['homebankingpath']}/hcuAccountStatus.prg?{$HB_ENV['cuquery']}",
1407 $failed = CompassLastFailedLogin($HB_ENV, $menu_list);
1408 $prior = CompassPriorLogin($HB_ENV, $menu_list);
1409 $sys = CompassSystemStatus($HB_ENV, $menu_list);
1412 $stat_arr[
'prior'] = $prior;
1416 $stat_arr[
'fail'] = $failed;
1419 $stat_arr[
'system'] = $sys;
1422 $stat_arr[
'count'] = CompassCountWarnings($stat_arr);
1433 function CompassLastFailedLogin($HB_ENV, $menu_list) {
1435 list ($menu_id, $title) = CompassGetMenuIdAndTitle($HB_ENV, $menu_list,
'',
'Failed Login');
1437 if (isset($HB_ENV[
'Fflog']) && ! empty($HB_ENV[
'Fflog'])) {
1439 $log_level = (isFailedExceedsPrior($HB_ENV))?
'error' :
'info';
1443 'date' => date(
"D M d, Y h:ia", strtotime($HB_ENV[
'Fflog'])),
1444 'level' => $log_level
1457 function isFailedExceedsPrior($HB_ENV) {
1459 if (strtotime($HB_ENV[
'Fflog']) > strtotime($HB_ENV[
'Fplog'])) {
1472 function CompassPriorLogin($HB_ENV, $menu_list) {
1474 list ($menu_id, $title) = CompassGetMenuIdAndTitle($HB_ENV, $menu_list,
'',
'Last Login');
1476 if (isset($HB_ENV[
'Fplog']) && ! empty($HB_ENV[
'Fplog'])) {
1479 'date' => date(
"D M d, Y h:ia", strtotime($HB_ENV[
'Fplog'])),
1493 function CompassSystemStatus($HB_ENV, $menu_list) {
1495 list ($sys_msg, $level) = DisplayLastDataMsg($HB_ENV);
1496 list (, $title) = CompassGetMenuIdAndTitle($HB_ENV, $menu_list,
'',
'Account Status as of');
1510 function DisplayLastDataMsg($HB_ENV) {
1513 $infoDataNotify = GetInfoDataNotify($HB_ENV);
1515 if ($infoDataNotify) {
1518 if ($HB_ENV[
'packetStatus'][
'status'] ==
'999') {
1522 {$HB_ENV[
'MC']->msg(
'Unable to load')}:
1524 {$HB_ENV[
'MC']->msg(
'Credit Union responded')}:
1525 {$HB_ENV[
'packetStatus'][
'reason']} ({$HB_ENV[
'packetStatus'][
'status']})-->
1527 {$HB_ENV[
'MC']->msg(
'Please try again later')}
1530 $msg = $HB_ENV[
'MC']->msg(
'Credit Union not responding');
1533 $msg = isset($HB_ENV[
'lastupdate']) ?date(
"D M d, Y h:ia", strtotime($HB_ENV[
'lastupdate'])) : null;
1536 return [$msg, $level];
1544 function GetInfoDataNotify($HB_ENV) {
1546 if ($HB_ENV[
'live']) {
1547 $curPacketStatusAry = HCU_array_key_value(
'packetStatus', $HB_ENV);
1548 if (in_array(HCU_array_key_value(
'status', $curPacketStatusAry), [
'999'])) {
1562 function CompassUser($HB_ENV, $menu_list) {
1565 list ($menu_id, $utitle) = CompassGetMenuIdAndTitle($HB_ENV, $menu_list,
'',
'User Info');
1566 $user_data = HCU_JsonDecode(GetUserProfileUpdates($HB_ENV));
1569 'password' =>
'hcuProfilePwd.prg',
1570 'security' =>
'hcuProfileSecurity.prg',
1571 'email' =>
'hcuProfileEmail.prg',
1575 'display' => $utitle,
1577 'count' => CompassCountWarnings($user_data),
1581 foreach ($nodes as $node => $script) {
1583 if (isset($user_data[$node])) {
1584 $user_arr[$node] = CompassUserSubItems($HB_ENV, $menu_list, $script, $node, $user_data);
1600 function CompassUserSubItems($HB_ENV, $menu_list, $script, $node, $user_data) {
1605 list ($menu_id, $title) = CompassGetMenuIdAndTitle(
1609 ($user_data[
'email'][
'title'])??
null,
1614 unset($user_data[
'url']);
1616 $user_arr = $user_data[$node];
1617 $user_arr[
'script'] = $script;
1618 $user_arr[
'menuid'] = $menu_id;
1619 $user_arr[
'action'] =
'menu';
1630 function CompassCountWarnings($data) {
1634 foreach ($data as $arr) {
1635 if (IsCompassErrorWarning($arr)) {
1649 function IsCompassErrorWarning($arr = [])
1653 isset($arr[
'level']) &&
1654 ! empty($arr[
'level']) &&
1655 in_array($arr[
'level'], [
'warning',
'error']);