Odyssey
hcuPreContent.i
1 <?php
2  /*
3  * hcuPreContent
4  *
5  * Purpose: this should be the main HTML page for digital banking PRIOR to any
6  * content being printed.
7  *
8  * Variables: This is a possible list of values that can be set before calling
9  * this script to print on the page
10  *
11  * contentTitle - If entered, a header bar will be printed in the content with
12  * this title
13  *
14  *
15  * TEST FOR the WEB CLient allowing GZIP, deflate for encoding
16  * If it does, then point to the .gz files for each included files
17  */
18 
19  // ** Variables
20  $keepBannerVisible = (isset($preKeepBanner) && $preKeepBanner ? true : false);
21 
22  /*
23  * Secure Mail Setup
24  * if secure mail is an option in the menu, then show the icon in the upper
25  * right. This field will be set empty with no option,
26  * If the option is enabled, then it will be the URL to direct to
27  */
28  $secureMailURL = '';
29  $secureMailText = '';
30  $secureMailEnabled = false;
31 
32  /*
33  * BUILD MENU -- I may need to use the results to help build the page
34  */
35  // ** Loop through the items in menuSite
36  $menuSelectedDetail = '';
37  $printedMainMenu = '';
38  $sitemapDetail = '';
39  $reportPacketError = false;
40 
41  $navigationClass = "";
42  $hideNavigation = false;
43  if ( hcuIsAppPhone($HB_ENV) && !$keepBannerVisible ) {
44  $navigationClass = "hide-header";
45  $hideNavigation = true;
46  }
47 
48  /**
49  * For standard OLB Framework use the IF
50  * the else is a quick bootstrap framework intended to introduce responsive to the site
51  */
52 
53  if (!$serviceLoadMenu) {
54  // ** Not loading menu -- make sure all menu items are false
55  $serviceShowMenu = false;
56  }
57  if ($serviceShowMenu) {
58  // * If we are showing the menu then retrieve the 'li' variable from the url -
59  // * this is the Location Item used to identify the menu item that will be highlighted
60  /* * IMPORT VARIABLES * */
61  $importFieldAry = Array (
62  "li" => array('filter' => FILTER_SANITIZE_NUMBER_INT)
63  );
64  HCU_ImportVars($HB_ENV, 'menu-location', $importFieldAry);
65 
66  $secureMailEnabled = (($HB_ENV['Fset2'] & $CU2_ALLOWMESSAGE) > 0);
67  }
68 
69  /*
70  ** Live Status Check **
71  * If this is a LIVE CU I need to be sure the packetStatus information is up to date
72  *
73  * IF serviceLiveCheck IS set and the packetStatus array_key_exists
74  * then I want to SAVE the information in the packetStatus to the packetStatus Cookie
75  *
76  * ELSE
77  * if the packetStatus cookie is found then I want to load the information from the
78  * cookie and save into the packetStatus in HB_ENV
79  */
80 
81  if ($HB_ENV['live']) {
82  if ($serviceLiveCheck && HCU_array_key_exists('packetStatus', $HB_ENV)) {
83  // ** Save Packet Status to Cookie
84  if (savePacketStatusCookie($HB_ENV)) {
85  // ** ONLY Report A Packet ERROR ONCE --
86  // ** when true is returned, this indicates the value in the cookie was updated
87  $reportPacketError = true;
88  } else{
89  // ** IF we did NOT need to update the packet information,
90  // * then I want to load the data from the cookie if possible
91  // * the reason is the 'too soon to ask again'. It actually returns
92  // * a '0'. Using that value the error is NOW gone, even though the
93  // * data is still out of date
94  retrievePacketStatusCookie($HB_ENV);
95  }
96 
97  } else {
98  // ** Retrieve Packet Status FROM cookie
99  // * HB_ENV -- is passed by reference to allow the necesary changes
100  retrievePacketStatusCookie($HB_ENV);
101  }
102  }
103 
104 
105  // UNCOMMENT TO SHOW Secure Mail $secureMailURL = 'hcuSecureMail.prg?cu=SCRUBCU';
106  $secureMailNewCount = 0;
107  if ($secureMailEnabled) {
108  // ** Check for the existence of new messages
109  $secureMailNewCount = ReturnUnreadSecureMsg($dbh, $HB_ENV);
110  }
111 
112  $acctFailNotify = false;
113  $infoFailNotify = false;
114  $infoDataNotify = false;
115 
116  $infoIconNotify = false;
117  $ucTransactionsCount = 0;
118 
119  $displayLastDataMsg = '';
120 
121  $serviceShowInfo= $serviceViewFromCuAdmin ? false : $serviceShowInfo;
122  $Fplog= "";
123  $Fflog= "";
124  $acctIconNotify= "";
125  if ($serviceShowInfo) {
126 
127 
128  /**
129  * check for transaction not posted by this user
130  * check if any of these transactions are not confirmed
131  * check if this user can confirm each transaction based on feature_code
132  * update count if this user can confirm each transaction.
133  */
134  $ucTransactions = ReturnUnconfirmedTransactions($HB_ENV['dbh'], $HB_ENV);
135  if (is_array($ucTransactions)) {
136  foreach ($ucTransactions as $key => $value) {
137  $canConfirm = Perm_AccessRights($dbh, $HB_ENV, array("feature" => $value['feature_code']));
138  if ($canConfirm['confirm']) {
139  $ucTransactionsCount ++;
140  }
141  }
142  }
143 
144  // ** Determine if there are any errors for Logins, Data, or General Account
145 
146  $Fplog = HCU_array_key_value("Fplog", $HB_ENV) ? ($HB_ENV['Fplog'] == 'None' ? '' : strftime("%D %R", strtotime($HB_ENV['Fplog']))) : "";
147  $Fflog = HCU_array_key_value("Fflog", $HB_ENV) ? ($HB_ENV['Fflog'] == 'None' ? '' : strftime("%D %R", strtotime($HB_ENV['Fflog']))) : "";
148 
149  if ($Fplog != '' && $Fflog != '') {
150  // ** These fields should now be well formed dates, so I will use make time from string
151  // and if the failed login is > than the last login, then set the notify
152  if (strtotime($Fflog) >= strtotime($Fplog)) {
153  $infoFailNotify = true;
154  }
155  } else if ($Fflog != '') {
156  $infoFailNotify = true;
157  }
158 
159  // ** Check for data being stale
160  if ($HB_ENV['live']) {
161  $curPacketStatusAry = HCU_array_key_value('packetStatus', $HB_ENV);
162  // ** If status is 200, 201, 202 then report stale data
163  //if ($HB_ENV['packetStatus']['status'] == '200' || $HB_ENV['packetStatus']['status'] == '201' || $HB_ENV['packetStatus']['status'] == '202' || $HB_ENV['packetStatus']['status'] == '999') {
164  // ** 200, 201, 202 are no longer used. Ignore. Treat as bad response
165  if (in_array(HCU_array_key_value('status', $curPacketStatusAry), Array('999'))) {
166  $infoDataNotify = true;
167  // * *Suspend notices here
168  $suspendNotices = true;
169  }
170  }
171 
172  $infoIconNotify = ($infoDataNotify || $infoFailNotify);
173 
174  /* Set Last Data Message */
175  if ($infoDataNotify) {
176  if ($HB_ENV['packetStatus']['status'] == '999') {
177 
178  $displayLastDataMsg = <<< DATAMSG
179  {$MC->msg('Unable to load')}:
180  <!--<br/>
181  {$MC->msg('Credit Union responded')}:{$HB_ENV['packetStatus']['reason']} ({$HB_ENV['packetStatus']['status']})-->
182  <Br/>
183  {$MC->msg('Please try again later')}
184 DATAMSG;
185  } else {
186  $displayLastDataMsg = <<< DATAMSG
187  {$MC->msg('Credit Union not responding')}
188 DATAMSG;
189  }
190  } else {
191  $displayLastDataMsg = $HB_ENV['lastupdate'];
192  }
193 
194  // ** Check other reasons
195 
196  if ($HB_ENV['Ffchg'] == 'Y') {
197  // * Force Password Change
198  $acctFailNotify = true;
199  }
200  if ( ($HB_ENV['Ffreset'] & GetUserFlagsValue("MEM_FORCE_RESET")) > 0 ) {
201  // * Force Password Change
202  $acctFailNotify = true;
203  }
204  if (($HB_ENV['Fmsg_tx'] & GetMsgTxValue('MSGTX_FORCE_EM')) > 0) {
205  // ** Verify Email?
206  $acctFailNotify = true;
207  }
208  $acctIconNotify = ($acctFailNotify != '' ? 'exclamation' : '');
209 
210  $secureMailEnabled = (($HB_ENV['Fset2'] & $CU2_ALLOWMESSAGE) > 0);
211 
212 
213  }
214 
215  // ** Determine if we show the banner.
216  $bannerDiv = '';
217  // ** if we do we will also need to add a class to the body tag
218  if (!$serviceSuppressBanner) {
219  if ((HCU_array_key_value('Fset2', $HB_ENV) & GetFlagsetValue("CU2_SHOWBANNER"))) {
220  // ** Banners are on and not suppressed at the script level
221  $aryBanner = Get_BannerText($dbh, $HB_ENV, $MC, 'D');
222  if ($aryBanner['status']['code'] != '000') {
223  $txtBannerData = '';
224  } else {
225  $aryBannerData = Translate_BannerText($HB_ENV,$aryBanner['banner']['bannertext']);
226  if ($aryBannerData['status']['code'] != '000') {
227  $txtBannerData = '';
228  } else {
229  $txtBannerData = $aryBannerData['banner']['bannertext'];
230  }
231  }
232  if ($txtBannerData != '') {
233  $bannerBodyClass = 'showHomecuBanner';
234  $bannerDiv = "
235  <div id='homecuBannerArea'>
236  {$txtBannerData}
237  </div>
238  ";
239  }
240  }
241  }
242 
243  /**
244  * Set the Logo URL
245  */
246  $logoutData = HCU_JsonDecode(HCU_array_key_value("Logout", $cuSettings));
247 
248  $logoURL = (HCU_array_key_value("url", $logoutData) != '' ? $logoutData['url'] : '#');
249  $showExternalMsg = ($logoURL !== "#");
250 
251  /**
252  * ***********************
253  * BOOTSTRAP TEMP FRAMEWORK
254  * ***********************
255  */
256  header ("Pragma: no-cache");
257  header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
258  header ("Cache-Control: no-cache, no-store, must-revalidate, max_age=0");
259  header ("Expires: 0");
260  header('X-Frame-Options: sameorigin');
261 
262 ?><!DOCTYPE html>
263 <html>
264  <head>
265  <title><?php echo hcu_displayHtml($HB_ENV['orgname']); ?></title>
266  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
267  <meta name="robots" content="noindex,nofollow,noarchive,nocache" />
268  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
269  <meta name="referrer" content="always">
270 
271 
272  <meta name="viewport" content="width=device-width, initial-scale=1" />
273  <?php
274  print setIncludeFiles(true, true, HCU_array_key_value("contentTheme", $cuSettings), true, $HB_ENV, $MC);
275  ?>
276  <script>
277 
278  $(document).ready(function(){
279  <?php
280  if ( !$hideNavigation ) {
281  ?>
282  /* Set the width of the side navigation to 250px and the left margin of the page content to 250px and add a black background color to body */
283  function openNav() {
284  $('#body-wrapper').addClass('collapse');
285  $('#body-wrapper').addClass('in');
286  }
287 
288  /* Set the width of the side navigation to 0 and the left margin of the page content to 0, and the background color of body to white */
289  function closeNav() {
290  $('#body-wrapper').removeClass('collapse');
291  $('#body-wrapper').removeClass('in');
292  }
293 
294  $("#hcu-nav-toggle").on("click", function(){
295  var menuVisible = ($('#sidebar-nav:visible').length > 0);
296  if (menuVisible) {
297  closeNav();
298  } else {
299  openNav();
300  }
301  });
302 
303  $("#hcu-close-nav").on("click", function(){
304  closeNav();
305  });
306 
307  <?php
308  }
309  ?>
310 
311 
312  $(".hcu-lang-toggle").on("click", function(){
313  var lang = this.name;
314  ChangeLanguage(lang);
315  });
316 
317  function ChangeLanguage(langCode) {
318  if (langCode !== '' && langCode !== '<?php echo $HB_ENV['Flang']; ?>') {
319  postData = "homecuLang=" + langCode;
320  $.post('<?php echo $HB_ENV['loginpath'] . "/hcuSetLang.prg?" . $HB_ENV['currentQuery']; ?>', postData, function(data) {}, 'json')
321  .done(function(data) {
322  try {
323  if (data.homecuInfo == 'OK') {
324  // ** After setting the language, reload the current page
325  document.location = '<?php echo $HB_ENV['loginpath'] . "/" . $HB_ENV['currentscript'] . "?" . $HB_ENV['currentQuery']; ?>';
326  }
327  } catch (err) {
328  // * There seems to be a syntax error of sorts. -- do nothing at moment
329  }
330  });
331  }
332  return false;
333  }
334 
335  });
336 </script>
337 
338  </head>
339  <body>
340  <?php echo $bannerDiv; ?>
341  <div id="body-wrapper" class="<?php echo (!$serviceShowInfo ? ' no-show-info ' : '') . (!$serviceShowMenu ? ' no-show-menu ' : '') . (!$secureMailEnabled ? ' no-show-secure-mail ' : ''); ?>">
342  <!-- top navbar -->
343  <nav id="header" class="navbar navbar-inverse navbar-static-top <?php echo $navigationClass ?>" style="margin-bottom: 0px">
344  <div>
345  <div class="navbar-header">
346  <button id="hcu-nav-toggle" type="button" class="navbar-toggle collapsed" aria-expanded="false">
347  <span class="sr-only">Toggle navigation</span>
348  <span class="icon-bar"></span>
349  <span class="icon-bar"></span>
350  <span class="icon-bar"></span>
351  </button>
352 
353  <div id="logo-bar">
354  <a class="navbar-brand" <?php echo ($showExternalMsg ? 'rel="external"' : ''); ?> href="<?php echo $logoURL; ?>">
355  <?php
356  /**
357  *
358  * CUSTOM LOGO LOCATION
359  *
360  * The logo source will need to be added to the hcuSettings.i file. This can be loaded dynamically and then
361  * referenced below. The reason for this is that the logo MUST be in an IMG tag rather than div. The IMG tag
362  * is scalable where as the background in a div is not
363  *
364  */
365  ?>
366  <img alt="Digital Banking Logo" class="logo" src="<?php echo $cuSettings['imageLocations']['desktopCULogoLocation']; ?>"/>
367  </a>
368  </div>
369  <?php if (count($cuSettings['language']) > 1): ?>
370  <div class="desk-lang-select hidden-xs" role="menu">
371  <?php
372  foreach ($cuSettings['language'] as $langKey => $langValue) {
373  if ($langKey != $HB_ENV['Flang']) {
374  ?>
375  <a href="#" class="hcu-lang-toggle" name="<?php echo $langKey; ?>" title="Select <?php echo $langValue; ?>"><div class="flag_icons flag_icons_<?php echo $langKey; ?>"></div></a>
376  <?php
377  }
378  }
379  ?>
380  </div>
381  <?php endif; ?>
382  </div>
383 
384  <?php
385  require_once('../library/menu-creators/compass-menu.i');
386  ?>
387 
388  </div>
389  </nav>
390 
391  <nav id="side-menu" class="navbar-default sidebar sidenav <?php echo $navigationClass ?>">
392  <div id="sidebar-nav" class="sidebar-nav navbar-collapse ">
393  <?php
394  if ($serviceShowMenu) {
395 
396  $paramList = Array ("Uid" => $HB_ENV['Uid'],
397  "menuId" => "menu",
398  "output" => "HTML");
399  // ** FeatureAccessList
400  PrintFeatureMenu($dbh, $HB_ENV, 'HTML', $paramList, $serviceViewFromCuAdmin);
401 
402  }
403  ?>
404  </div>
405  </nav>
406  <div id='hideSubmitWait' style='position:relative; left:-2000px;top:-2000px;'>
407  <div id='homecuSubmitWait' class='k-block' >
408  <div class='k-loading-image'></div>
409  </div>
410  </div>
411  <div id="content-wrapper" class="<?php echo (hcuIsAppPhone($HB_ENV) ? " mobile-app-view " : ""); ?> nothere <?php echo $navigationClass ?>">
412  <div id="formStatus" class="homecu-formStatus k-block k-error-colored" style='display:none; margin-bottom:10px;max-width:800px;'></div>
413  <a href="#" id="hcu-close-nav" class="overlay-close" data-toggle="collapse" >&nbsp;</a>
414  <div id="main-container" role="main">
415  <div id="homecu-wrapper">
416  <div id="homecu-container">
417  <div id="homecu-padding-top" class="col-xs-12"></div> <!-- homecu-padding -->