Odyssey
siteSettings.prg
1 <?php
2 
3  /*
4  * siteSettings
5  *
6  * Configuration script for the Credit union to allow them to customize
7  * the languages, menu, content theme
8  *
9  * Possible changes to the brand.css would need to be uploaded and not done through
10  * this screen.
11  * SPB 10/30/2015-- Now uses monitorView.i
12  */
13 
14 
15  // ** Include these scripts, mostly to ensure that the Monitor security is maintained
16  $monLibrary= dirname(__FILE__) . "/../library";
17  require_once("$monLibrary/cu_top.i");
18  require_once("$monLibrary/ck_hticket.i");
19  require_once("$monLibrary/monitorView.i");
20 
21  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
22  // ** Permissions failed
23  // ** redirect to new page
24  header("Location: /hcuadm/hcu_noperm.prg");
25  exit;
26  }
27 
28  /*
29  * Local Variables
30  *
31  */
32  /**
33  * The status of the settings file
34  * loaded from default or CU specific
35  */
36  $settingsFileStatus = '';
37  $loadedFromTemplate = false; // Fix E_NOTICE error.
38  try {
39 
40  // ** Import the necessary fields
41  $string = array("filter" => HCUFILTER_INPUT_STRING);
42  $dms_ok = array('user_name' => $string, 'loadSettings' => $string, 'buildFolder' => $string);
43  $parameters = array("a" => array("user_name" => "", "loadSettings" => "", "buildFolder" => ""));
44  HCU_ImportVars($parameters, "a", $dms_ok);
45  extract($parameters["a"]);
46 
47  $loadSettings = ($loadSettings == '' ? 'production' : $loadSettings);
48  $cuSettingsFileName = "hcuSettings.i";
49 
50  // ** Configure location of the hcuSettings file for the Credit Union
51  $cuSettingsDir = "/home/{$user_name}/public_html/bankingIncludes/";
52  $cuPublicDir = "/home/{$user_name}/public_html/";
53 
54  // ** Attempt to build the Folders IF buildFolder is set
55  if ($buildFolder == 1) {
56  $buildUserName = preg_replace("/[^A-Za-z0-9]/", "", $user_name);
57  // * Try and create the directory
58  // * check the user_name is set
59  if ($buildUserName == '') {
60  throw new Exception('Upgrade Directory Creation - <br/>Username not specified.', 800);
61  }
62  // * check the directory /home/{user_name} exists
63  if (!file_exists("/home/{$buildUserName}/public_html")) {
64  throw new Exception("Upgrade Directory Creation - <br/>Home directory for $buildUserName does not exist.", 800);
65  }
66  // * attempt to add the directories
67  $sourceDir = '/home/cuskel/hbupgrade/';
68  $destDir = "/home/{$buildUserName}/public_html/";
69  if (!copyr($sourceDir, $destDir)) {
70  throw new Exception("Upgrade Directory Creation - <br/>An error occurred while creating the directories.", 800);
71  }
72  // * check the existence of the new folders being created
73  if (!file_exists("/home/{$buildUserName}/public_html/bankingIncludes")) {
74  throw new Exception("Upgrade Directory Creation - <br/>Directory not found after attempt to create.", 800);
75  }
76  }
77  // ** Set the cuLoad and cuSave values
78  if ($loadSettings == 'production') {
79  $cuSaveSettingsFilePath = $loadSettings . '/' . $cuSettingsFileName;
80  $cuLoadSettingsFilePath = $loadSettings . '/' . $cuSettingsFileName;
81  } elseif ($loadSettings == 'preview' || $loadSettings == 'previewreload') {
82  // ** ALWAYS save to the preview folder in this instance
83  $cuSaveSettingsFilePath = 'preview/' . $cuSettingsFileName;
84  if ($loadSettings == 'preview' && is_readable($cuSettingsDir . $loadSettings . '/' . $cuSettingsFileName)) {
85  $cuLoadSettingsFilePath = $loadSettings . '/' . $cuSettingsFileName;
86  } else {
87  // ** Load the preview FROM the production file if it exists
88  $cuLoadSettingsFilePath = 'production/' . $cuSettingsFileName;
89  $loadedFromTemplate = true;
90  }
91  } else {
92  // ** ERROR -- invalid parameter
93  throw new Exception('Invalid parameter setting', 903);
94  }
95  $cuSaveSettingsFilePath = $loadSettings . '/' . $cuSettingsFileName;
96 
97  // ** Configure location of the default hcuSettings
98  $cuDefaultSettingsDir = "/home/homecu/public_html/bankingIncludes/";
99  $cuLoadSettingsFile = '';
100 
101  /* Determine if the settings file exists */
102 
103  if (is_readable($cuSettingsDir . $cuSaveSettingsFilePath) && !is_writable($cuSettingsDir . $cuSaveSettingsFilePath)) {
104  // ** UNABLE to write to the desired file
105  throw new Exception('Credit Union settings file not configured with correct permission. Unable to save settings file.', 903);
106  } elseif (is_writable($cuSettingsDir)) {
107  // ** They have a Settings file, we will want load from there
108  // ** LOAD FILE
109  // ** Determine Settings file to load from
110  if (is_readable($cuSettingsDir . $cuLoadSettingsFilePath)) {
111  $cuLoadSettingsFile = $cuSettingsDir . $cuLoadSettingsFilePath;
112  $settingsFileStatus = "<strong>Settings Found</strong><br/>Loaded From<br/>{$cuLoadSettingsFilePath}";
113  } elseif (is_readable($cuDefaultSettingsDir . $cuSettingsFileName)) {
114  // ** Load from the template directory if it is readable
115  $settingsFileStatus = '<strong>Settings Not Found</strong><br/>Loaded From Template';
116  $cuLoadSettingsFile = $cuDefaultSettingsDir . $cuSettingsFileName;
117  $loadedFromTemplate = true;
118  } else {
119  // ** RAISE ERROR -- NOT SURE WHAT WE ARE DOING HERE
120  throw new Exception('Credit Union configuration error', 901);
121  }
122  } elseif (is_readable($cuSettingsDir . $cuSaveSettingsFilePath) && !is_writable($cuSettingsDir . $cuSaveSettingsFilePath)) {
123  // ** ERROR -- Found the settings file, unable to update
124  throw new Exception('Credit Union settings file not configured with correct permission', 903);
125  } elseif (!is_dir($cuSettingsDir) && !is_writable($cuPublicDir)) {
126  // ** ERROR -- Unable to find the directory, and not able to create
127  // ** SETUP ERROR
128  throw new Exception('Credit Union not configured with correct permission or directory', 900);
129  } elseif (!is_dir($cuSettingsDir) && is_writable($cuPublicDir)) {
130  // ** MILD ERROR -- Unable to Find directory, BUT we can offer to create it
131  // * for the user
132  throw new Exception('Credit Union Settings Directory not found', 800);
133  } else {
134  // ** RAISE ERROR -- NOT SURE WHAT WE ARE DOING HERE
135  throw new Exception('Credit Union configuration error', 901);
136  }
137 
138  // ** I want to remove the possibility of previewreload at this point. It does not matter
139  // * where the file was from now. What we want to do is always save to the preview directory
140  $loadSettings = ($loadSettings == 'previewreload' ? 'preview' : $loadSettings);
141  // ** Retrieve the Master Language List
142  $langList = returnMasterLanguageList();
143 
144  /*
145  * LOAD
146  */
147  // ** Menu Found - Load into an array
148  $settingsContent = file_get_contents($cuLoadSettingsFile);
149 
150  // ** Now decode it and hope for the best
151  $cuSettings = HCU_JsonDecode($settingsContent);
152 
153  if ($cuSettings['contentTheme'] == '') {
154  $cuSettings['contentTheme'] = 'silver';
155  }
156  // language key MUST be an array. If it is NOT, then I will set to an empty array
157  if (!is_array($cuSettings['language'])) {
158  $cuSettings['language'] = array();
159  }
160 
161  $imageLocations = HCU_array_key_exists("imageLocations", $cuSettings) ? (is_array($cuSettings["imageLocations"]) ? $cuSettings["imageLocations"] : array()) : array();
162 
163  /*
164  * Create Menu Datasource
165  *
166  */
167  $title = "Home Banking Site Settings";
168  printMonitorPageTop($title, $homecuKendoVersion, $cloudfrontDomainName);
169  ?>
170  <script type="text/javascript" src="/monitor/js/siteSettings.js"></script>
171  <?php printMonitorPageMiddle($title, null, true); ?>
172  <div id="currentStatus" class='k-block settingStatus clean'>
173  <div class="section">
174  <span class="fa fa-question-circle-o detailsTip" title='Which settings file to modify. Choose "Reload preview" to start preview with production settings.'></span>
175  <select id="selectFileSettings">
176  <option value="production">Production</option>
177  <option value="preview">Preview</option>
178  <option value="previewreload">Reload preview</option>
179  </select>
180  </div>
181  <div class='section'>
182  <?php echo $settingsFileStatus; ?>
183  </div>
184  <div class='section-clean'>
185  <strong>No Changes made</strong>
186  <?php if ($loadSettings == 'preview'): ?>
187  <button name='btnSaveToProd' id='btnSaveToProd' class='k-button'>Save to Production</button>
188  <?php endif; ?>
189  </div>
190  <div class='section-dirty'>
191  <strong>Changes Have been made</strong><Br/>
192  <button name="btnUpdate" id="btnUpdate" class='k-button'>Save Changes</button>
193 
194  </div>
195  <div class='section-response'>
196  <strong>Response from the server:</strong><Br/>
197  <div id='currentStatusResponse'></div>
198  </div>
199  <div id='serverResponseSpinner'></div>
200  </div>
201  <section id='editLanguage' class="k-content">
202  <form id='formSettings'>
203  <input type='hidden' name='user_name' value='<?php echo $user_name; ?>'/>
204  <input type='hidden' id='loadSettings' name='loadSettings' value='<?php echo $loadSettings; ?>'/>
205  <input type='hidden' id='postMenuOptions' name='postMenuOptions' value=''/>
206  <input type='hidden' id='postScriptProxy' name='postScriptProxy' value=''/>
207  <input type='hidden' id='postLogout' name='postLogout' value=''/>
208  <input type='hidden' id='postContentTheme' name='postContentTheme' value=''/>
209  <input type='hidden' id='postil' name='postil' value=''/>
210  <div class="sectionTitle">Language <span class="fa fa-question-circle-o detailsTip" title='Select the language options for the Credit Union.'></span></div>
211  <div class="sectionLine"></div>
212  <div class='configuration configuration-language'>
213  <ul>
214  <?php foreach ($langList as $langKey => $langDesc):
215  $fieldDisabled = ($langKey == 'en_US' ? 'disabled' : '');
216  $fieldChecked = ($langKey == 'en_US' ? 'checked' : (HCU_array_key_exists($langKey, $cuSettings['language']) ? 'checked' : ''));
217  ?>
218  <li>
219  <span class="lang-select"><input type="checkbox" name="langSelect[]" id="lang_<?php echo $langKey; ?>" value="<?php echo $langKey; ?>"
220  <?php echo $fieldDisabled . ' ' . $fieldChecked; ?>/></span>
221  <span class="lang-title"><label for="lang_<?php echo $langKey; ?>"><?php echo $langDesc; ?></label></span>
222  </li>
223  <?php endforeach; ?>
224  </ul>
225  </div>
226  </form>
227 
228  </section>
229  <section id='editMenu' class="k-content" style='display:none'>
230  <div class="sectionTitle">Menu <span class="fa fa-question-circle-o detailsTip" title='This section will help setup the menu.'></span></div>
231  <div class='menuTree'>
232  <button name='btnAddNode' id='btnAddNode' class='k-button'>Add Menu Item</button>
233  <?php
234  // * PRINT the English for the text to use
235  $menuOnlyItems = Array(
236  "display" => Array(),
237  "suppressdetail" => '',
238  "default" => ''
239  );
240  $menuTreeView = Array();
241  if(HCU_array_key_exists("menu", $cuSettings) && is_array($cuSettings['menu'])) {
242  foreach ($cuSettings['menu'] as $menuIdx => $menuDetails) {
243  // * Print the beginning of the li
244  // * Create the data-dms json string for the Menu options
245 
246  if ($menuDetails['suppressdetail'] == 1) {
247  // ** This is a Menu Group LINK -- NO MENU
248  // ** Merge the link information to the data object
249  $dataDms = array_merge(array_intersect_key($menuDetails, $menuOnlyItems), $menuDetails['detail'][0]);
250  } else {
251  $dataDms = array_intersect_key($menuDetails, $menuOnlyItems);
252  }
253  $dataMenuJson = HCU_JsonEncode($dataDms);
254 
255  $menuItems = Array();
256  if (is_array($menuDetails['detail']) && $menuDetails['suppressdetail'] != 1) {
257  // ** Loop through child and print it's list
258  foreach ($menuDetails['detail'] as $childIdx => $childDetails) {
259  // ** Create the detail link
260  $dataDmsJson = HCU_JsonEncode($childDetails);
261 
262  $menuItems[] = Array("text" => $childDetails['display']['en_US'],
263  "datadms" => $dataDmsJson);
264  }
265  }
266  $menuTreeView[] = Array("text" => $menuDetails['display']['en_US'],
267  "datadms" => $dataMenuJson,
268  "items" => $menuItems);
269  }
270  }
271  ?>
272  <div id='customMenu'></div>
273  <script>
274  treeMenuData = <?php echo HCU_JsonEncode($menuTreeView); ?>;
275 
276  function selectSettings(e) {
277  e.preventDefault();
278  var value = $('#selectFileSettings').data('kendoDropDownList').value()
279  document.location = '<?php echo $_SERVER['PHP_SELF']; ?>?user_name=<?php echo $user_name; ?>&loadSettings=' + value;
280  }
281  $(document).ready(function() {
282  $('#selectFileSettings').kendoDropDownList({
283  change: selectSettings
284  });
285  var selFileSettings = $('#selectFileSettings').data('kendoDropDownList');
286  selFileSettings.value('<?php echo $loadSettings; ?>');
287 
288  homecuTooltip.reset();
289  $(".detailsTip").each(function() {
290  homecuTooltip.custom.content = $(this).attr("title");
291  $(this).kendoTooltip(homecuTooltip.custom);
292  });
293  });
294  </script>
295  </div>
296  <div class='menuDetails'>
297  <div style='height:20px'></div>
298  <div id='detailConfiguration' class="configuration" style='display:none;'>
299  <span class="configHead" id='detailsTitle'></span>
300  <ul class="options">
301  <li>
302  <fieldset class="language">
303  <legend>Display <span class="k-icon k-i-info detailsTip" title='Enter the menu description for each language. Note: language option above must be selected to use'></span></legend>
304  <div class="k-block">
305  <?php
306  reset($langList);
307  foreach ($langList as $langKey => $langDesc):
308  $fieldDisabled = ($langKey == 'en_US' ? 'disabled' : '');
309  $fieldChecked = ($langKey == 'en_US' ? 'checked' : (HCU_array_key_exists($langKey, $cuSettings['language']) ? 'checked' : ''));
310  ?>
311  <label for="details_display_<?php echo $langKey; ?>"><?php echo $langDesc; ?></label>
312  <input type="text" id="details_display_<?php echo $langKey; ?>" name="details_display_<?php echo $langKey; ?>" class="k-textbox" data-field='<?php echo $langKey; ?>' data-bind="value: display.<?php echo $langKey; ?>" style="width:300px"/>
313  <?php endforeach; ?>
314  </div>
315  </fieldset>
316  </li>
317  <li>
318  <fieldset class="language">
319  <legend>Link Attributes <span class="fa fa-question-circle-o detailsTip" title='General attribute related to the menu link'></span></legend>
320  <div class="k-block">
321  <fieldset id='fields_suppressdetail'>
322  <label>Suppress (Hide Sub-Menu) Detail? <span class="fa fa-question-circle-o detailsTip" title='For Menu options, suppressing the detail will create a link instead of the detail sub-menu.'></span></label>
323  <select id='details_suppressdetail' name='details_suppressdetail' data-bind="value: suppressdetail">
324  <option value='0' SELECTED>No</option>
325  <option value='1'>Yes</option>
326  </select>
327  </fieldset>
328  <fieldset id='fields_linkattr'>
329  <label for='details_href'>Address <span class="fa fa-question-circle-o detailsTip" title='Enter the Home Banking script or URL to the page to open'></span></label>
330  <input type="text" id="details_href" name="details_href" class="k-textbox" style="width:300px" data-bind="value: href" value=""/>
331  <label for='details_target'>Target <span class="k-icon k-i-info detailsTip" title='Select where the page should open'></span></label>
332  <select id="details_target" name="details_target" data-bind="value: target">
333  <option value=''>Current Window</option>
334  <option value='_blank'>New Window</option>
335  </select>
336  <label for='details_urlquery'>Use HomeBanking query on url <span class="fa fa-question-circle-o detailsTip" title='Select this option to include the Home Banking URL parameters after the script name. ie cu=XXX'></span></label>
337  <select id="details_urlquery" name="details_urlquery" data-bind="value: hrefUrlQuery">
338  <option value='0'>No</option>
339  <option value='1'>Yes</option>
340  </select>
341  <label for='details_extraparams'>Extra Parameters <span class="fa fa-question-circle-o detailsTip" title='Add any extra parameters to the URL here. ie one=sampe&two=fields'></span></label>
342  <input type="text" id="details_extraparams" name="details_extraparams" class="k-textbox" style="width:300px" data-bind="value: hrefExtraParam" value=""/>
343  <label for='details_hrefmultiple'>href Multiple Identifier <span class="fa fa-question-circle-o detailsTip" title='Enter a value here if the Home Banking script is included more than once in menu. Be sure they are unique.'></span></label>
344  <select id='details_hrefmultiple' name='details_hrefmultiple' data-bind="value: hrefMultiple">
345  <option value='' >Not Set</option>
346  <?php for ($mltIdx = 1; $mltIdx <= 10; $mltIdx++): ?>
347  <option value='<?php echo $mltIdx; ?>'><?php echo $mltIdx; ?></option>
348  <?php endfor; ?>
349  </select>
350  </fieldset>
351  </div>
352  </fieldset>
353  </li>
354  <li>
355  <fieldset class='language' id="fields_default">
356  <legend>Default Link</legend>
357  <input name="details_default" id="details_default" data-bind="value: default" style="width:200px;"/>
358  <span class="k-icon k-i-info detailsTip" title='Select the menu option to use when clicking on the menu group'></span>
359  </fieldset>
360  </li>
361 
362  <li>
363  <button name='btnRemoveNode' id='btnRemoveNode' class='k-button'>Remove Item</button>
364  </li>
365  </ul>
366  </div>
367  </div>
368 
369  </section>
370  <section id="editURLs">
371  <script>
372  $(document).ready(function() {
373  imageLocationModel = kendo.observable({desktopCULogoLocation: "<?php echo $imageLocations['desktopCULogoLocation']; ?>"});
374  updateilData(false); <?php // Need to have the value in the field. Otherwise, a change elsewhere will remove this from the settings file. ?>
375 
376  kendo.bind($('#editURLs'), imageLocationModel);
377 
378  imageLocationModel.bind('change', function(e) {
379  updateilData(true);
380  });
381  });
382 
383  function updateilData(isDirty)
384  {
385  var ilString = JSON.stringify(imageLocationModel.toJSON());
386  $('#postil').val(ilString);
387 
388  formDirtyFlag(isDirty);
389  }
390 
391  </script>
392  <div class='menuDetails'>
393  <div class="sectionTitle">Edit Image Locations <span class="fa fa-question-circle-o detailsTip"
394  title='For now, this is only the image location of the CU logo inside of banking. Use a full URL of the image.'></span></div>
395  <fieldset class="language">
396  <div class="k-block">
397  <table>
398  <tr>
399  <td style='padding:5px;'><label for="desktopCULogoLocation" style='width:100px;'>Desktop CU Logo Location</label></td>
400  <td><input type="text" id="desktopCULogoLocation" name="desktopCULogoLocation" class="k-textbox" data-bind="value: desktopCULogoLocation" style="width:400px" /></td>
401  </tr>
402  <tr>
403  <td style='padding:5px;'><label for="photoUpload" style='width:100px;'>Upload Image File <span class="fa fa-question-circle-o detailsTip" title='This can be used for the CU Logo or custom content.'></span></label></td>
404  <td><input type="file" name="photoUpload" id="photoUpload" accept="image/*"></td>
405  </tr>
406 
407 
408  </table>
409  </div>
410  </fieldset>
411  </div>
412  </section>
413  <section id='editTheme' class='k-content'>
414  <script>
415  $(document).ready(function() {
416  $('#editTheme').find('[data-value=<?php echo $cuSettings['contentTheme']; ?>]').addClass('active');
417 
418  <?php
419  // * If we loaded the Setings From template ,then I want to set
420  // * the form to be dirty
421  if ($loadedFromTemplate): ?>
422  formDirtyFlag(true);
423  <?php endif; ?>
424 
425  });
426  </script>
427  <style>
428  .tc-color {
429  border-radius: 50%;
430  display: inline-block;
431  width: 10px;
432  height: 10px;
433  height: 10
434  }
435 
436  #pageContents {
437  top: 59px !important;
438  }
439 
440  #currentStatus {
441  top: 86px !important;
442  }
443  </style>
444  <div class="sectionTitle">Theme <span class="fa fa-question-circle-o detailsTip" title='Set the themed color for the content window'></span></div>
445  <div class=''>
446  <ul class="tc-theme-container" style="display: block;">
447  <li class="tc-theme">
448  <a href="#" class="tc-link" data-value="default">
449  <span class="tc-color" style="background-color: #ef6f1c"></span>
450  <span class="tc-color" style="background-color: #e24b17"></span>
451  <span class="tc-color" style="background-color: #5a4b43"></span>
452  <span class="tc-theme-name">Default</span>
453  </a>
454  </li>
455  <li class="tc-theme">
456  <a href="#" class="tc-link" data-value="blueopal">
457  <span class="tc-color" style="background-color: #076186"></span>
458  <span class="tc-color" style="background-color: #7ed3f6"></span>
459  <span class="tc-color" style="background-color: #94c0d2"></span>
460  <span class="tc-theme-name">Blue Opal</span>
461  </a>
462  </li>
463  <li class="tc-theme">
464  <a href="#" class="tc-link" data-value="bootstrap">
465  <span class="tc-color" style="background-color: #3276b1"></span>
466  <span class="tc-color" style="background-color: #67afe9"></span>
467  <span class="tc-color" style="background-color: #ffffff"></span>
468  <span class="tc-theme-name">Bootstrap</span>
469  </a>
470  </li>
471  <li class="tc-theme">
472  <a href="#" class="tc-link" data-value="silver">
473  <span class="tc-color" style="background-color: #298bc8"></span>
474  <span class="tc-color" style="background-color: #515967"></span>
475  <span class="tc-color" style="background-color: #eaeaec"></span>
476  <span class="tc-theme-name">Silver</span>
477  </a>
478  </li>
479  <li class="tc-theme">
480  <a href="#" class="tc-link" data-value="uniform">
481  <span class="tc-color" style="background-color: #666666"></span>
482  <span class="tc-color" style="background-color: #cccccc"></span>
483  <span class="tc-color" style="background-color: #ffffff"></span>
484  <span class="tc-theme-name">Uniform</span>
485  </a>
486  </li>
487  <li class="tc-theme">
488  <a href="#" class="tc-link" data-value="metro">
489  <span class="tc-color" style="background-color: #8ebc00"></span>
490  <span class="tc-color" style="background-color: #787878"></span>
491  <span class="tc-color" style="background-color: #ffffff"></span>
492  <span class="tc-theme-name">Metro</span>
493  </a>
494  </li>
495  <li class="tc-theme">
496  <a href="#" class="tc-link" data-value="flat">
497  <span class="tc-color" style="background-color: #363940"></span>
498  <span class="tc-color" style="background-color: #2eb3a6"></span>
499  <span class="tc-color" style="background-color: #ffffff"></span>
500  <span class="tc-theme-name">Flat</span>
501  </a>
502  </li>
503 
504  <li class="tc-theme">
505  <a href="#" class="tc-link" data-value="material">
506  <span class="tc-color" style="background-color: #3d4fb0"></span>
507  <span class="tc-color" style="background-color: #03a9f4"></span>
508  <span class="tc-color" style="background-color: #f2c81c"></span>
509  <span class="tc-theme-name">Material</span>
510  </a>
511  </li>
512  <li class="tc-theme">
513  <a href="#" class="tc-link" data-value="office365">
514  <span class="tc-color" style="background-color: #0272c6"></span>
515  <span class="tc-color" style="background-color: #5db2ff"></span>
516  <span class="tc-color" style="background-color: #82ba00"></span>
517  <span class="tc-theme-name">Office 365</span>
518  </a>
519  </li>
520  <li class="tc-theme">
521  <a href="#" class="tc-link" data-value="fiori">
522  <span class="tc-color" style="background-color: #0289cf"></span>
523  <span class="tc-color" style="background-color: #99d100"></span>
524  <span class="tc-color" style="background-color: #ed4f5b"></span>
525  <span class="tc-theme-name">Fiori</span>
526  </a>
527  </li>
528  <li class="tc-theme">
529  <a href="#" class="tc-link" data-value="nova">
530  <span class="tc-color" style="background-color: #fd3b48"></span>
531  <span class="tc-color" style="background-color: #ff9ea5"></span>
532  <span class="tc-color" style="background-color: #7edde9"></span>
533  <span class="tc-theme-name">Nova</span>
534  </a>
535  </li>
536  </ul>
537  </div>
538  </section>
539  <section id='editLogout' class='k-content'>
540  <?php
541  $logoutData = HCU_jsondecode(HCU_array_key_value("Logout", $cuSettings));
542  ?>
543 
544  <div class='menuDetails'>
545  <div class="sectionTitle">Specify Logout Location <span class="fa fa-question-circle-o detailsTip" title='The Footer Name will be used in the Footer logout link, otherwise the product name will be used. The Logout URL, if set, will cause all user-initiated logouts to be redirected to that URL.'></span></div>
546  <fieldset class="language">
547  <div class="k-block">
548  <table>
549  <tr>
550  <td style='padding:5px;'><label for="footer_name" style='width:100px;'>Footer Name</label></td>
551  <td><input type="text" id="footer_name" name="footer_name" class="k-textbox" data-bind="value: footerName" style="width:300px" /></td>
552  </tr>
553  <tr>
554  <td style='padding:5px;'><label for="logout_url" style='width:100px;'>Logout URL</label></td>
555  <td><input type="text" id="logout_url" name="logout_url" class="k-textbox" data-bind="value: url" style="width:300px" /></td>
556  </tr>
557  </table>
558  </div>
559  </fieldset>
560  </div>
561  </section>
562 
563  <script>
564  $(document).ready(function() {
565  var uploader = $("#photoUpload").kendoUpload({
566  async: {
567  saveUrl: "siteSettings.data?user_name=<?php echo $user_name;?>&operation=loadImage",
568  removeUrl: "siteSettings.data?user_name=<?php echo $user_name;?>&operation=removeImage"
569  },
570  multiple: false,
571  validation: {
572  allowedExtensions: [".jpg", ".png", ".gif", ".jpeg"]
573  },
574  success: function(e) {
575  return e.response.code === "000";
576  }
577  }).data("kendoUpload");
578 
579  logoutViewModel.footerName = "<?php echo HCU_array_key_value("footerName", $logoutData); ?>";
580  logoutViewModel.url = "<?php echo HCU_array_key_value("url", $logoutData); ?>";
581 
582  // re-bind to force the data to show
583  kendo.bind($('#editLogout'), logoutViewModel);
584 
585  });
586  </script>
587 <?php
588  printMonitorPageBottom();
589  } catch (Exception $e) {
590  // ERROR CAUGHT
591  /*
592  * ERRORS FOR THE SCRIPT
593  *
594  * 900 - Unable to Create the Needed directories. This may be caused by permissions
595  * or public_html not existing
596  * 901 - Unable to continue - This is a catch all, not exactly sure why we could be here
597  *
598  * 902 - Unable to continue - Found the settings file, but failed on parsing
599  *
600  * 800 - Unable to find the Credit Union Settings directory.. BUT we can offer
601  * to create it.
602  */
603 
604  $errorTitle = "Credit Union Home Banking Settings";
605  printMonitorPageTop($errorTitle, $homecuKendoVersion, $cloudfrontDomainName);
606  printMonitorPageMiddle($errorTitle, null, true);
607 ?>
608  <div class=''>
609  <div class='k-block k-error-colored' style='margin: 0 auto; width:300px; padding:20px;'>
610  <?php switch($e->getCode()):
611  case '900': ?>
612  900 - <?php echo $e->getMessage(); ?>
613  <?php break; ?>
614  <?php case '800': ?>
615  800 - <?php echo $e->getMessage(); ?>
616  </br> </br>
617  <button id='updateCU'>Create Upgrade Folders</button>
618  <script>
619  $(document).ready(function() {
620  $('#updateCU').kendoButton({
621  spriteCssClass: 'k-icon k-i-folder-add'
622  });
623  $('#updateCU').click(function() {
624  var winMsg = 'This will add the necessary folders to the credit union <?php echo $user_name; ?>. Are you sure you wish to continue?';
625  if (window.confirm(winMsg)) {
626  document.location = '<?php print $_SERVER['PHP_SELF']; ?>?user_name=<?php print $user_name; ?>&buildFolder=1';
627  }
628  });
629  });
630  </script>
631  <?php break; ?>
632  <?php case '902': ?>
633  902 - File found, but unable to parse <?php echo $cuLoadSettingsFile; ?>
634  <?php break; ?>
635  <?php case '903': ?>
636  <?php echo $e->getMessage(); ?>
637  <?php break; ?>
638  <?php case '901': ?>
639  <?php default: ?>
640  Please see a programmer<br/>
641  I could be here because directory was found but has insufficient permissions
642  <br/>
643  OR it was found and unable to create needed directory
644  <br/>
645  OR there the default settings file was NOT found.
646  <?php endswitch;?>
647  </div>
648  </div>
649 <?php
650  printMonitorPageBottom();
651  }
652 /**
653  * Copy a file, or recursively copy a folder and its contents
654  *
655  * @author Aidan Lister <aidan@php.net>
656  * @version 1.0.1
657  * @link http://aidanlister.com/2004/04/recursively-copying-directories-in-php/
658  * @param string $source Source path
659  * @param string $dest Destination path
660  * @return bool Returns TRUE on success, FALSE on failure
661  */
662 function copyr($source, $dest) {
663  // Check for symlinks
664  if (is_link($source)) {
665  return symlink(readlink($source), $dest);
666  }
667 
668  // Simple copy for a file
669  if (is_file($source)) {
670  return copy($source, $dest);
671  }
672 
673  // Make destination directory
674  if (!is_dir($dest)) {
675  mkdir($dest);
676  }
677 
678  // Loop through the folder
679  $dir = dir($source);
680  while (false !== $entry = $dir->read()) {
681  // Skip pointers
682  if ($entry == '.' || $entry == '..') {
683  continue;
684  }
685 
686  // Deep copy directories
687  copyr("$source/$entry", "$dest/$entry");
688  }
689 
690  // Clean up
691  $dir->close();
692  return true;
693 }