Odyssey
Fragmntc.prg
1 <?php
2 $monLibrary= dirname(__FILE__) . "/../library";
3 require_once("$monLibrary/cu_top.i");
4 require_once("$monLibrary/ck_hticket.i");
5 
6  // Create a file array for each file that will be sought after for the screen
7  /*
8  Array Definition
9  field1 (script) - This is the fragment script name
10  field2 (call_from) - Script that calls the fragment
11  field3 (desc) - Short Description of the purpose of this script
12  field4 (odd color) - color code to be used when displaying odd rows
13  field5 (even color) - color code to be used when displaying even rows
14  field6 (permissions) - this should be an octal number identifying the chmod permissions to give to the file after it has been saved
15 
16  Template --
17  The fragment template is always stored on live in the /hcuadm directory.
18  The name given to the template file is "skel_" + script name
19  This is then used when a new fragment is added for a credit union to start as a template
20  */
21 
22 // $file_list[] = array("script"=>"nobitfrag.html", "call_from"=>"Scout", "desc"=>"Bit E-statement ID not found", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
23  $file_list[] = array("script"=>"alertfrag.html", "call_from"=>"Alerts", "desc"=>"Alerts Terms of Use", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
24  $file_list[] = array("script"=>"nobillpayfrag.html", "call_from"=>"Scout", "desc"=>"Bill Pay ID not Found", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
25  $file_list[] = array("script"=>"agreefrag.html", "call_from"=>"Agree", "desc"=>"E-Statement START", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
26  $file_list[] = array("script"=>"unagreefrag.html", "call_from"=>"Agree", "desc"=>"E-Statement STOP", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
27  $file_list[] = array("script"=>"noestmntfrag.html", "call_from"=>"EStatement", "desc"=>"E-Statement Flag Not Set", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
28  $file_list[] = array("script"=>"EStatement.html", "call_from"=>"Tellme", "desc"=>"E-Statement Message", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
29  $file_list[] = array("script"=>"disclosure.html", "call_from"=>"Home Page", "desc"=>"Home Banking Terms (BATCH)", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
30  $file_list[] = array("script"=>"signupfrm.html", "call_from"=>"Home Page", "desc"=>"Home Banking Signup Form", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
31  $file_list[] = array("script"=>"onlinereply.html", "call_from"=>"Home Page", "desc"=>"Home Banking Signup Reply", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
32  $file_list[] = array("script"=>"ipayenrollfrag.html", "call_from"=>"Astro", "desc"=>"iPay SSO Auto-Enroll Message", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
33  $file_list[] = array("script"=>"LoginNotice.html", "call_from"=>"cu_login", "desc"=>"Login NCUA Notice", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
34  $file_list[] = array("script"=>"Promo.html", "call_from"=>"Promo", "desc"=>"Login Promo Page", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
35  $file_list[] = array("script"=>"NDTPromo.html", "call_from"=>"Promo", "desc"=>"CU-Dismissable Login Promo Page", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
36  $file_list[] = array("script"=>"memsettingsfrag.html", "call_from"=>"MemberSettings", "desc"=>"Member Settings (BATCH)", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
37  $file_list[] = array("script"=>"addchangefrm.html", "call_from"=>"Home Page", "desc"=>"Member Address Change Form", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
38  $file_list[] = array("script"=>"addchangefrm2.html", "call_from"=>"Home Page", "desc"=>"Member Address Change Secure Form output", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
39  $file_list[] = array("script"=>"thanks_ac.html", "call_from"=>"Home Page", "desc"=>"Member Address Change Thanks page", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
40  $file_list[] = array("script"=>"MemberActfrag.html", "call_from"=>"ActivateMember", "desc"=>"Member Auto-Activate authentication form", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
41  $file_list[] = array("script"=>"MemberActThxfrag.html", "call_from"=>"ActivateMember", "desc"=>"Member Auto-Activate Display new Password", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
42  $file_list[] = array("script"=>"unlockfrag.html", "call_from"=>"UnlockMember", "desc"=>"Member Password Reset", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
43  $file_list[] = array("script"=>"lmenu.html", "call_from"=>"Mobile Banking", "desc"=>"Mobile Banking Embedded Menu", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
44  $file_list[] = array("script"=>"onldepositdisclosure.html", "call_from"=>"OnLineDeposit", "desc"=>"On-Line Deposit Terms of Use", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
45  $file_list[] = array("script"=>"onldepositaddr.html", "call_from"=>"OnLineDeposit", "desc"=>"On-Line Deposit Deposit Address", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
46  $file_list[] = array("script"=>"lnappCuPortal.html", "call_from"=>"AppMain", "desc"=>"On-Line Loan App Portal Menu", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
47  $file_list[] = array("script"=>"pwdRules.html", "call_from"=>"MemberSettings_MemberSetCfg", "desc"=>"Password selection hints", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
48 
49 // This option is NOT intended for live, but does not cause any problems to be there
50  $file_list[] = array("script"=>"repeattxfrag.html", "call_from"=>"RecurTx", "desc"=>"Repeating Transfers Terms of Use", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
51  $file_list[] = array("script"=>"noRDCfrag.html", "call_from"=>"RemoteDep", "desc"=>"Remote Deposit Capture Terms of Use / Enroll Request", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
52  $file_list[] = array("script"=>"sms_agree.html", "call_from"=>"Cellsms", "desc"=>"SMS Terms of Use", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
53  $file_list[] = array("script"=>"sms_helpfrag.html", "call_from"=>"Cellsms", "desc"=>"SMS User Help Fragment", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
54  $file_list[] = array("script"=>"Stopformfrag.html", "call_from"=>"Stopform", "desc"=>"Stop Payment terms", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
55  $file_list[] = array("script"=>"TxnDownloadHelp.html", "call_from"=>"Tellme", "desc"=>"Transaction Download Help", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
56 # $file_list[] = array("script"=>"WebConnect.html", "call_from"=>"Tellme", "desc"=>"Transaction Download Quicken Help", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
57 # $file_list[] = array("script"=>"IntuitDownload.html", "call_from"=>"Tellme", "desc"=>"Transaction Download Intuit Message", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
58  $file_list[] = array("script"=>"Transfer.html", "call_from"=>"Tellme", "desc"=>"Transfer Message", "odd"=>"#eeeeee", "even"=>"#dddddd", "perm"=>0644);
59  $file_list[] = array("script"=>"appconfig.xml", "call_from"=>"OFXRequest", "desc"=>"App Config file for mobile devices", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
60  $file_list[] = array("script"=>"mblnav.html", "call_from"=>"", "desc"=>"MBL Navigation Menu", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
61  $file_list[] = array("script"=>"mblnav_test.html", "call_from"=>"", "desc"=>"MBL Navigation Menu TEST", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
62  $file_list[] = array("script"=>"mblfooter.html", "call_from"=>"", "desc"=>"MBL Footer Content", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
63  $file_list[] = array("script"=>"mblEStatement.html", "call_from"=>"Tellme", "desc"=>"MBL E-Statement Message", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
64  $file_list[] = array("script"=>"mblLoginNotice.html", "call_from"=>"cu_login", "desc"=>"MBL Login NCUA Notice", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
65  $file_list[] = array("script"=>"mblPromo.html", "call_from"=>"Promo", "desc"=>"MBL Login Promo Page", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
66  $file_list[] = array("script"=>"mblNDTPromo.html", "call_from"=>"Promo", "desc"=>"MBL CU-Dismissable Login Promo Page", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
67  $file_list[] = array("script"=>"mblpwdRules.html", "call_from"=>"MemberSettings_MemberSetCfg", "desc"=>"MBL Password selection hints", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
68  $file_list[] = array("script"=>"mblTxnDownloadHelp.html", "call_from"=>"Tellme", "desc"=>"MBL Transaction Download Help", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
69  $file_list[] = array("script"=>"mblTransfer.html", "call_from"=>"Tellme", "desc"=>"MBL Transfer Message", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
70  $file_list[] = array("script"=>"mblnobillpayfrag.html", "call_from"=>"paybills", "desc"=>"Bill Pay ID not Found", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
71  $file_list[] = array("script"=>"alertfrag_es.html", "call_from"=>"Alerts", "desc"=>"(Spanish) Alerts Terms of Use", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
72  $file_list[] = array("script"=>"agreefrag_es.html", "call_from"=>"Agree", "desc"=>"(Spanish) E-Statement START", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
73  $file_list[] = array("script"=>"unagreefrag_es.html", "call_from"=>"Agree", "desc"=>"(Spanish)E-Statement STOP", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
74  $file_list[] = array("script"=>"noestmntfrag_es.html", "call_from"=>"EStatement", "desc"=>"(Spanish) E-Statement Flag Not Set", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
75  $file_list[] = array("script"=>"EStatement_es.html", "call_from"=>"Tellme", "desc"=>"(Spanish) E-Statement Message", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
76  $file_list[] = array("script"=>"mmenu_es.html", "call_from"=>"Home Page", "desc"=>"(Spanish) Home Banking Menu", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
77  $file_list[] = array("script"=>"mindex_es.html", "call_from"=>"Home Page", "desc"=>"(Spanish) Home Banking mindex_es.html", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
78  $file_list[] = array("script"=>"disclosure_es.html", "call_from"=>"Home Page", "desc"=>"(Spanish) Home Banking Terms (BATCH)", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
79  $file_list[] = array("script"=>"signupfrm_es.html", "call_from"=>"Home Page", "desc"=>"(Spanish) Home Banking Signup Form", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
80  $file_list[] = array("script"=>"onlinereply_es.html", "call_from"=>"Home Page", "desc"=>"(Spanish) Home Banking Signup Reply", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
81  $file_list[] = array("script"=>"LoginNotice_es.html", "call_from"=>"cu_login", "desc"=>"(Spanish) Login NCUA Notice", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
82  $file_list[] = array("script"=>"Promo_es.html", "call_from"=>"Promo", "desc"=>"(Spanish) Login Promo Page", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
83  $file_list[] = array("script"=>"NDTPromo_es.html", "call_from"=>"Promo", "desc"=>"(Spanish) CU-Dismissable Login Promo Page", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
84  $file_list[] = array("script"=>"memsettingsfrag_es.html", "call_from"=>"MemberSettings", "desc"=>"(Spanish) Member Settings (BATCH)", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
85  $file_list[] = array("script"=>"addchangefrm_es.html", "call_from"=>"Home Page", "desc"=>"(Spanish) Member Address Change Form (uses English output)", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
86  $file_list[] = array("script"=>"thanks_ac_es.html", "call_from"=>"Home Page", "desc"=>"(Spanish) Member Address Change Thanks page", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
87  $file_list[] = array("script"=>"MemberActfrag_es.html", "call_from"=>"ActivateMember", "desc"=>"(Spanish) Member Auto-Activate authentication form", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
88  $file_list[] = array("script"=>"MemberActThxfrag_es.html", "call_from"=>"ActivateMember", "desc"=>"(Spanish) Member Auto-Activate Display new Password", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
89  $file_list[] = array("script"=>"unlockfrag_es.html", "call_from"=>"UnlockMember", "desc"=>"(Spanish) Member Password Reset", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
90  $file_list[] = array("script"=>"lmenu_es.html", "call_from"=>"Mobile Banking", "desc"=>"(Spanish) Mobile Banking Embedded Menu", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
91  $file_list[] = array("script"=>"pwdRules_es.html", "call_from"=>"MemberSettings_MemberSetCfg", "desc"=>"(Spanish) Password selection hints", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
92  $file_list[] = array("script"=>"repeattxfrag_es.html", "call_from"=>"RecurTx", "desc"=>"(Spanish) Repeating Transfers Terms of Use", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
93  $file_list[] = array("script"=>"sms_agree_es.html", "call_from"=>"Cellsms", "desc"=>"(Spanish) SMS Terms of Use", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
94  $file_list[] = array("script"=>"sms_helpfrag_es.html", "call_from"=>"Cellsms", "desc"=>"(Spanish) SMS User Help Fragment", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
95  $file_list[] = array("script"=>"TxnDownloadHelp_es.html", "call_from"=>"Tellme", "desc"=>"(Spanish) Transaction Download Help", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
96  $file_list[] = array("script"=>"Transfer_es.html", "call_from"=>"Tellme", "desc"=>"(Spanish) Transfer Message", "odd"=>"#d7e1cc", "even"=>"#f0f0e2", "perm"=>0644);
97  $file_list[] = array("script"=>"mblnav_es.html", "call_from"=>"", "desc"=>"(Spanish) MBL Navigation Menu", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
98  $file_list[] = array("script"=>"mblnav_es_test.html", "call_from"=>"", "desc"=>"(Spanish) MBL Navigation Menu TEST", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
99  $file_list[] = array("script"=>"mblfooter_es.html", "call_from"=>"", "desc"=>"(Spanish) MBL Footer Content", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
100  $file_list[] = array("script"=>"mblEStatement_es.html", "call_from"=>"Tellme", "desc"=>"(Spanish) MBL E-Statement Message", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
101  $file_list[] = array("script"=>"mblLoginNotice_es.html", "call_from"=>"cu_login", "desc"=>"(Spanish) MBL Login NCUA Notice", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
102  $file_list[] = array("script"=>"mblPromo_es.html", "call_from"=>"Promo", "desc"=>"(Spanish) MBL Login Promo Page", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
103  $file_list[] = array("script"=>"mblNDTPromo_es.html", "call_from"=>"Promo", "desc"=>"(Spanish) MBL CU-Dismissable Login Promo Page", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
104  $file_list[] = array("script"=>"mblpwdRules_es.html", "call_from"=>"MemberSettings_MemberSetCfg", "desc"=>"(Spanish) MBL Password selection hints", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
105  $file_list[] = array("script"=>"mblTxnDownloadHelp_es.html", "call_from"=>"Tellme", "desc"=>"(Spanish) MBL Transaction Download Help", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
106  $file_list[] = array("script"=>"mblTransfer_es.html", "call_from"=>"Tellme", "desc"=>"(Spanish) MBL Transfer Message", "odd"=>"#d5dfe8", "even"=>"#dfe3e7", "perm"=>0644);
107 
108  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
109  // ** Permissions failed
110  // ** redirect to new page
111  header("Location: /hcuadm/hcu_noperm.prg");
112  exit;
113  }
114 
115 $dms_ok=array('user_name'=>'string','cu_name'=>'string','act'=>'string','f'=>'string','cu_mxcu'=>'string','script_doc'=>'string');
116 
117 dms_import($dms_ok);
118 
119  $self = $_SERVER['SCRIPT_NAME'] . "?user_name={$user_name}&cu_name=" . urlencode($cu_name);
120  // Connect to the database - get the team information from the database
121  $query = "select *
122  from cuadmin
123  where user_name = '{$user_name}'";
124  $result = db_query($query, $link);
125  // Now fetch the row
126  $cuinfo_row = db_fetch_object($result);
127  $num_rows = db_num_rows($result);
128 
129  //if ($num_rows > 0):
130  if (true) :
131  $user_name = trim($cuinfo_row->user_name);
132  $cu_name = trim($cu_name);
133  $cu_mxcu = trim($cuinfo_row->mxcu);
134  $hcu_dir = ($cuinfo_row->livebatch == 'L' ? 'hculive7' : 'hcubin7');
135  switch (strtoupper($act)):
136  case "CREATE":
137  print_top();
138  // Find the script in the array
139  $file_key = search_files($f, $file_list);
140  echo "<table align=center width=\"70%\" border=0 cellpadding=0 cellspacing=1 class=\"dmsbg\"><tr><td>";
141  if ($file_key != -1) {
142  $file_info = $file_list[$file_key];
143  print <<< print_html
144  <form action="$self&act=New" method="post">
145  <input type="hidden" name="f" value="{$f}">
146  <input type="hidden" name="user_name" value="$user_name">
147  <input type="hidden" name="cu_name" value="$cu_name">
148  <input type="hidden" name="cu_mxcu" value="$cu_mxcu">
149  <input type="hidden" name="hcu_dir" value="$hcu_dir">
150  <table width="100%" border=0 cellpadding=0 cellspacing=1>
151  <tr>
152  <td class="bar" align="center">
153  Fragment Confirmation
154  </td>
155  </tr>
156  <tr>
157  <td class="dtlc" >
158  This will create the fragment '{$file_info['script']}'<br>
159  this is used for {$file_info['desc']}.<br><br>
160  Are you sure this is what you want to do?
161  </td>
162  </tr>
163  <tr>
164  <td>
165  <input type="submit" name="btnSub" value="Create this">
166  <input type="button" name="btnCan" value="I changed my mind" onclick="document.location='$self'">
167  </td>
168  </tr>
169  </table>
170 print_html;
171  } else {
172  print '
173  <table border=0 cellpadding=0 cellspacing=0 width="100%">
174  <tr>
175  <td class="dtl">
176  An incorrect selection was made, please go back to the <a href="' . $self . '">menu</a><br>
177  and select again.
178  </td>
179  </tr>
180  </table>';
181 
182  }
183  echo "</td></tr></table></form>";
184  print_bottom();
185  break;
186  case "REFRESH":
187  print_top();
188  // Find the script in the array
189  $file_key = search_files($f, $file_list);
190  echo "<table align=center width=\"70%\" border=0 cellpadding=0 cellspacing=1 class=\"dmsbg\"><tr><td>";
191  if ($file_key != -1) {
192  $file_info = $file_list[$file_key];
193  print <<< print_html
194  <form action="$self&act=CreateScript" method="post">
195  <input type="hidden" name="f" value="{$f}">
196  <input type="hidden" name="user_name" value="$user_name">
197  <input type="hidden" name="cu_name" value="$cu_name">
198  <input type="hidden" name="cu_mxcu" value="$cu_mxcu">
199  <input type="hidden" name="hcu_dir" value="$hcu_dir">
200  <table width="100%" border=0 cellpadding=0 cellspacing=1>
201  <tr>
202  <td class="bar" align="center">
203  Refresh Fragment Confirmation
204  </td>
205  </tr>
206  <tr>
207  <td class="dtlc" >
208  This will overwrite the existing fragment '{$file_info['script']}'<br>
209  that is used for {$file_info['desc']}.<br><br>
210  Are you sure this is what you want to do?
211  </td>
212  </tr>
213  <tr>
214  <td>
215  <input type="submit" name="btnSub" value="Overwrite file">
216  <input type="button" name="btnCan" value="I changed my mind" onclick="document.location='$self'">
217  </td>
218  </tr>
219  </table>
220 print_html;
221  } else {
222  print '
223  <table border=0 cellpadding=0 cellspacing=0 width="100%">
224  <tr>
225  <td class="dtl">
226  An incorrect selection was made, please go back to the <a href="' . $self . '">menu</a><br>
227  and select again.
228  </td>
229  </tr>
230  </table>';
231 
232  }
233  echo "</td></tr></table></form>";
234  print_bottom();
235  break;
236  case "CREATESCRIPT":
237  print_top();
238  // Find the script in the array
239  $file_key = search_files($f, $file_list);
240  echo "<table align=center width=\"70%\" border=0 cellpadding=0 cellspacing=1 class=\"dmsbg\"><tr><td>";
241  if ($file_key != -1) {
242  $file_info = $file_list[$file_key];
243  $skel_file = "skel_" . $file_info['script'];
244 
245  // insert the user security stuff in the url
246  $infourl = str_replace("//","//nobody:no1home@",$infourl);
247 
248  // Now read the file into memory
249  if ($fp = fopen("$infourl/hcuadm/$skel_file", "r")) {
250  while (!feof($fp)) {
251  $contents .= fread($fp, 1024);
252  }
253  fclose($fp);
254  }
255 
256  // Replace all occurrences of CULOGIN with user_name
257  $contents = str_replace("CULOGIN", $user_name, $contents);
258  $contents = str_replace("CUNAME", $cu_name, $contents);
259  $contents = str_replace("CUSERVER", $home_host, $contents);
260  $contents = str_replace("CUMXCU", "$cu_mxcu", $contents);
261  $contents = str_replace("DBPREFIX", strtoupper("$user_name"), $contents);
262  $contents = str_replace("HCUDIR", $hcu_dir, $contents);
263 
264  $save_as = "/home/$user_name/public_html/{$file_info['script']}";
265 
266  $file_save = false;
267  // First if the file already exists, make sure it is readable by the owner "nobody"
268  if (file_exists($save_as))
269  chmod($save_as, 0666);
270 
271 
272  // Make sure the file opens and saves before saying it was saved correctly
273  if ($save_fp = fopen($save_as, "w")) {
274  if (fwrite($save_fp, $contents)) {
275  $file_save = true;
276  }
277  fclose ($save_fp);
278  // Now make sure the file is read only by all, including the owner
279  chmod($save_as, 0444);
280  }
281 
282  print <<< print_html
283  <table width="100%" border=0 cellpadding=0 cellspacing=1>
284  <tr>
285  <td class="bar" align="center">
286  Fragment Script Confirmation
287  </td>
288  </tr>
289  <tr>
290  <td class="dtlc" >
291 print_html;
292  if ($file_save == true) {
293  print <<< print_html
294  The script {$file_info['script']} was saved <b>successfully</b>.<br><br>
295  <font color='red'>NOTE:For some scripts you may need to edit to the credit unions liking.<br></font>
296  To do this choose the edit option from the <a href="$self">menu</a>
297 print_html;
298  } else {
299  // Failed to open and write the file
300  print <<< print_html
301  An error occurred, the script was NOT saved successfully.<br>
302  Please try again, before screaming.
303 print_html;
304  }
305  print <<< print_html
306  </td>
307  </tr>
308  </table>
309 print_html;
310  } else {
311  print '
312  <table border=0 cellpadding=0 cellspacing=0 width="100%">
313  <tr>
314  <td class="dtl">
315  An incorrect selection was made, please go back to the <a href="' . $self . '">menu</a><br>
316  and select again.
317  </td>
318  </tr>
319  </table>';
320  }
321 
322  echo "</td></tr></table>";
323  print_bottom();
324  break;
325  case "DELETE":
326  print_top();
327  // Find the script in the array
328  $file_key = search_files($f, $file_list);
329  echo "<table align=center width=\"70%\" border=0 cellpadding=0 cellspacing=1 class=\"dmsbg\"><tr><td>";
330  if ($file_key != -1) {
331  $file_info = $file_list[$file_key];
332  print <<< print_html
333  <form action="$self&act=FileDelete" method="post">
334  <input type="hidden" name="f" value="{$f}">
335  <input type="hidden" name="user_name" value="$user_name">
336  <input type="hidden" name="cu_name" value="$cu_name">
337  <input type="hidden" name="cu_mxcu" value="$cu_mxcu">
338  <input type="hidden" name="hcu_dir" value="$hcu_dir">
339  <table width="100%" border=0 cellpadding=0 cellspacing=1>
340  <tr>
341  <td class="bar" align="center">
342  Delete Fragment Confirmation
343  </td>
344  </tr>
345  <tr>
346  <td class="dtlc" >
347  This will delete the existing fragment '{$file_info['script']}'<br>
348  that is used for {$file_info['desc']}.<br><br>
349  Are you sure this is what you want to do?
350  </td>
351  </tr>
352  <tr>
353  <td>
354  <input type="submit" name="btnSub" value="Please Delete">
355  <input type="button" name="btnCan" value="I changed my mind" onclick="document.location='$self'">
356  </td>
357  </tr>
358  </table>
359 print_html;
360  } else {
361  print '
362  <table border=0 cellpadding=0 cellspacing=0 width="100%">
363  <tr>
364  <td class="dtl">
365  An incorrect selection was made, please go back to the <a href="' . $self . '">menu</a><br>
366  and select again.
367  </td>
368  </tr>
369  </table>';
370 
371  }
372  echo "</td></tr></table></form>";
373  print_bottom();
374  break;
375  case "FILEDELETE":
376  print_top();
377  // Find the script in the array
378  $file_key = search_files($f, $file_list);
379  echo "<table align=center width=\"70%\" border=0 cellpadding=0 cellspacing=1 class=\"dmsbg\"><tr><td>";
380  if ($file_key != -1) {
381  $file_info = $file_list[$file_key];
382  $skel_file = "skel_" . $file_info['script'];
383 
384  $delete = "/home/$user_name/public_html/{$file_info['script']}";
385 
386  $file_del = false;
387  // First if the file already exists, make sure it is readable by the owner "nobody"
388  if (file_exists($delete)) {
389  if (unlink($delete)) {
390  $file_del = true;
391  }
392  }
393 
394  print <<< print_html
395  <table width="100%" border=0 cellpadding=0 cellspacing=1>
396  <tr>
397  <td class="bar" align="center">
398  Delete Fragment Script
399  </td>
400  </tr>
401  <tr>
402  <td class="dtlc" >
403 print_html;
404  if ($file_del == true) {
405  print <<< print_html
406  The script {$file_info['script']} was deleted <b>successfully</b>.<br><br>
407 print_html;
408  } else {
409  // Failed to open and write the file
410  print <<< print_html
411  An error occurred, the script was NOT deleted successfully.<br>
412  Please try again, before screaming.
413 print_html;
414  }
415  print <<< print_html
416  </td>
417  </tr>
418  </table>
419 print_html;
420  } else {
421  print '
422  <table border=0 cellpadding=0 cellspacing=0 width="100%">
423  <tr>
424  <td class="dtl">
425  An incorrect selection was made, please go back to the <a href="' . $self . '">menu</a><br>
426  and select again.
427  </td>
428  </tr>
429  </table>';
430  }
431  echo "</td></tr></table>";
432  print_bottom();
433  break;
434  case "PREVIEW":
435  $file_key = search_files($f, $file_list);
436 
437  if ($file_key != -1) {
438  $file_info = $file_list[$file_key];
439  // Read the file and send the information to the text area
440  $cu_file = "/home/$user_name/public_html/{$file_info['script']}";
441  $file_opened = false;
442  if (file_exists($cu_file)) {
443  readfile($cu_file);
444  }
445 
446  } else {
447  print_top();
448  // Problem opening the file
449  print '
450  <table align=center border=0 cellpadding=0 cellspacing=0 width="60%" class="dmsbg"><tr><td>
451  <table border=0 cellpadding=0 cellspacing=0 width="100%">
452  <tr>
453  <td class="dtl">
454  An incorrect selection was made, please go back to the <a href="' . $self . '">menu</a><br>
455  and select again.
456  </td>
457  </tr>
458  </table>
459  </td></tr></table>';
460  print_bottom();
461  }
462  break;
463  case "NEW":
464  case "EDIT":
465  print_top();
466  if (strtoupper($act) == "NEW") {
467  $set_file = $f;
468  $file_key = search_files($f, $file_list);
469  } else {
470  $set_file = $f;
471  $file_key = search_files($f, $file_list);
472  }
473 
474  if ($file_key != -1) {
475  $file_info = $file_list[$file_key];
476  if (strtoupper($act) == "NEW") {
477  $skel_file = "skel_" . $file_info['script'];
478 
479  // insert the user security stuff in the url
480  $infourl = str_replace("//","//nobody:no1home@",$infourl);
481  // Now read the file into memory
482  if ($fp = fopen("$infourl/hcuadm/$skel_file", "r")) {
483  while (!feof($fp)) {
484  $contents .= fread($fp, 1024);
485  }
486  $file_opened = true;
487  fclose($fp);
488  // Replace all occurrences of CULOGIN with user_name
489  $contents = str_replace("CULOGIN", $user_name, $contents);
490  $contents = str_replace("CUNAME", $cu_name, $contents);
491  $contents = str_replace("CUSERVER", $home_host, $contents);
492  $contents = str_replace("CUMXCU", "$cu_mxcu", $contents);
493  $contents = str_replace("DBPREFIX", strtoupper("$user_name"), $contents);
494  $contents = str_replace("HCUDIR", $hcu_dir, $contents);
495  }
496 
497  } else {
498  // Read the file and send the information to the text area
499  $cu_file = "/home/$user_name/public_html/{$file_info['script']}";
500  $file_opened = false;
501  if (file_exists($cu_file)) {
502  if ($fp = fopen($cu_file, "r")) {
503  $file_opened = true;
504  $contents = fread($fp, filesize($cu_file));
505  }
506  }
507  }
508 
509  if ($file_opened == true) {
510  $showcontents=htmlspecialchars($contents);
511  print <<< print_html
512  <script language="javascript">
513  <!--
514  var win=null;
515  function Preview() {
516  win = window.open("","htmlWin","scrollbars=1,menubar=1,status=1")
517  //win.document.write("<BASE HREF='" + document.Tag.baseHref.value + "'>")
518  win.document.write("<P>")
519  win.document.write(document.preview.script_doc.value)
520  win.document.write("</P>")
521  }
522  // -->
523  </script>
524  <form name="preview" action="$self&act=SaveEdit" method="post">
525  <input type="hidden" name="act" value="SaveEdit">
526  <input type="hidden" name="f" value="$set_file">
527  <input type="submit" name="btnSubmit" value="Save my Changes">
528  <input type="button" name="btnPrev" value="Preview my Changes" onclick="Preview();">
529  <input type="button" name="btnCanc" value="Don't save my Changes" onclick="document.location='$self'">
530  <br>
531  <textarea name="script_doc" rows=50 cols=90>$showcontents</textarea>
532  </form>
533 print_html;
534  } else {
535  // Problem opening the file
536  print '
537  <table align=center border=0 cellpadding=0 cellspacing=0 width="60%" class="dmsbg"><tr><td>
538  <table border=0 cellpadding=0 cellspacing=0 width="100%">
539  <tr>
540  <td class="dtl">
541  An incorrect selection was made, please go back to the <a href="' . $self . '">menu</a><br>
542  and select again.
543  </td>
544  </tr>
545  </table>
546  </td></tr></table>';
547  }
548  } else {
549  // Problem opening the file
550  print '
551  <table align=center border=0 cellpadding=0 cellspacing=0 width="60%" class="dmsbg"><tr><td>
552  <table border=0 cellpadding=0 cellspacing=0 width="100%">
553  <tr>
554  <td class="dtl">
555  An incorrect selection was made, please go back to the <a href="' . $self . '">menu</a><br>
556  and select again.
557  </td>
558  </tr>
559  </table>
560  </td></tr></table>';
561  }
562  print_bottom();
563  break;
564  case "SAVEEDIT":
565  print_top();
566  // Find the script in the array
567  $file_key = search_files($f, $file_list);
568  echo "<table align=center width=\"70%\" border=0 cellpadding=0 cellspacing=1 class=\"dmsbg\"><tr><td>";
569  if ($file_key != -1) {
570  $file_info = $file_list[$file_key];
571  $skel_file = "skel_" . $file_info['script'];
572 
573  // Get Permissions -- From the File_list
574  $file_perm = $file_info['perm'];
575 
576  $contents = $script_doc;
577 
578  $save_as = "/home/$user_name/public_html/{$file_info['script']}";
579 
580  $file_save = false;
581  // First if the file already exists, make sure it is readable by the owner "nobody"
582  if (file_exists($save_as))
583  chmod($save_as, 0666);
584 
585 
586  // Make sure the file opens and saves before saying it was saved correctly
587  if ($save_fp = fopen($save_as, "w")) {
588  if (fwrite($save_fp, $contents)) {
589  $file_save = true;
590  }
591  fclose ($save_fp);
592  // Now make sure the file is read only by all, including the owner
593  //chmod($save_as, 0444);
594  // save the filepermisssions according to the way it was setup in the file information
595  chmod($save_as, $file_perm);
596  }
597 
598  print <<< print_html
599  <table width="100%" border=0 cellpadding=0 cellspacing=1>
600  <tr>
601  <td class="bar" align="center">
602  Fragment Script Confirmation
603  </td>
604  </tr>
605  <tr>
606  <td class="dtlc" >
607 print_html;
608  if ($file_save == true) {
609  print <<< print_html
610  The script {$file_info['script']} was saved <b>successfully</b>.<br><br>
611  <font color='red'>NOTE:For some scripts you may need to edit to the credit unions liking.<br></font>
612  To do this choose the edit option from the <a href="$self">menu</a>
613 print_html;
614  } else {
615  // Failed to open and write the file
616  print <<< print_html
617  An error occurred, the script was NOT saved successfully.<br>
618  Please try again, before screaming.
619 print_html;
620  }
621  print <<< print_html
622  </td>
623  </tr>
624  </table>
625 print_html;
626  } else {
627  print '
628  <table border=0 cellpadding=0 cellspacing=0 width="100%">
629  <tr>
630  <td class="dtl">
631  An incorrect selection was made, please go back to the <a href="' . $self . '">menu</a><br>
632  and select again.
633  </td>
634  </tr>
635  </table>';
636  }
637  echo "</td></tr></table>";
638  print_bottom();
639  break;
640  default:
641  print_top();
642 ?>
643  <form action="<?php echo $self ?>" method="post">
644  <input type="hidden" name="user_name" value="<?php echo $user_name; ?>">
645  <input type="hidden" name="cu_name" value="<?php echo $cu_name; ?>">
646  <input type="hidden" name="cu_mxcu" value="<?php echo $cu_mxcu; ?>">
647  <input type="hidden" name="hcu_dir" value="<?php echo $hcu_dir; ?>">
648  <table align=center width="95%" cellpadding=1 cellspacing=1 border=0 class="dmsbg"><tr><td>
649  <table width="100%" cellpadding=1 cellspacing=1 border=0>
650  <tr>
651  <td class="bar" align="center"><?php echo $cuinfo_row->cu;?> Fragment Maintenance</td>
652  </tr>
653  <tr>
654  <td>
655  <table border=0 width="100%" cellpadding=1 cellspacing=1 align="center">
656  <tr>
657  <td class="hdr" width="20%">File</td>
658  <td class="hdr" width="10%" align='center'>Status</td>
659  <td class="hdr" width="40%" >Used In</td>
660  <td class="hdr" width="30%" align='center'>Action</td>
661  </tr>
662  <?php
663  foreach ($file_list as $key=>$file_array) {
664  $rgb = ($rgb == "odd" ? "even" : "odd");
665  $rcolor = ($rgb == "odd" ? $file_array['odd'] : $file_array['even']);
666 
667  // Prepare each row for the information
668  // Determine if the file exists in the users directory
669  $frag_exists = file_exists("/home/$user_name/public_html/{$file_array['script']}");
670 
671  if ($frag_exists) {
672  // File EXISTS -- so setup the fields
673  $status = "Found";
674  $file_link = "
675  <a class=\"link\" href=\"$self&act=Refresh&f={$file_array['script']}\">Refresh</a> |
676  <a class=\"link\" href=\"$self&act=Edit&f={$file_array['script']}\">Edit</a> |
677  <a class=\"link\" href=\"$self&act=Preview&f={$file_array['script']}\" target=\"_NEW\">Preview</a> |
678  <a class=\"link\" href=\"$self&act=Delete&f={$file_array['script']}\">Delete</a> ";
679  } else {
680  $status = "<font color='red'>NOT Found</font>";
681  $file_link = "<a class=\"link\" href=\"$self&act=Create&f={$file_array['script']}\">Create</a>";
682  }
683 
684 # <tr class="$rgb">
685  print <<< print_html
686  <tr bgcolor="$rcolor">
687  <td class="usu">{$file_array['script']}</td>
688  <td class="usuc">$status</td>
689  <td class="usul">{$file_array['desc']}</td>
690  <td class="usu">
691  $file_link
692  </td>
693  </tr>
694 print_html;
695  }
696  ?>
697  </table>
698  </td>
699  </tr>
700  </table>
701  </td></tr></table>
702  </form>
703 <?php
704  print_bottom();
705  endswitch;
706  else:
707  print <<< print_html
708 
709 print_html;
710  endif;
711 
712 
713  function print_top() {
714 /*
715  print <<< print_html
716  <html>
717  <head>
718  <title>Home CU - Credit Union Information</title>
719  </head>
720 
721  <body>
722 print_html;
723 */
724  cu_header('Home CU - Credit Union Information');
725  }
726 
727  function print_bottom() {
728  print <<< print_html
729  </body>
730  </html>
731 print_html;
732  }
733  function search_files($search_for, &$file_array) {
734  reset($file_array);
735  foreach ($file_array as $key=>$value) {
736  if ($value['script'] == $search_for) {
737  return $key;
738  }
739  }
740  return -1;
741  }
742 ?>