Odyssey
html_hist.prg
1 <?php
2 $monLibrary= dirname(__FILE__) . "/../library";
3 require_once("$monLibrary/cu_top.i");
4 require_once("$monLibrary/ck_hticket.i");
5 
6  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
7  // ** Permissions failed
8  // ** redirect to new page
9  header("Location: /hcuadm/hcu_noperm.prg");
10  exit;
11  }
12 
13  $dms_ok=array('rowid'=>'string');
14 
15  dms_import($dms_ok);
16 
17  cu_header("$rowid HTML History");
18  print "<form>
19  <table border=1 cellpadding=1 cellspacing=1>
20  <tr>
21  <td class='bar' align=center>
22  $rowid HTML History
23  </td>
24  </tr>";
25  $cu_dir = $rowid . "/admin/";
26  $protectdir = "/home/";
27 
28  $filepath = $protectdir . $cu_dir;
29  // The filepath should be the admin directory for the credit union
30 
31  $fp = popen("ls -1r $filepath/*.html", "r");
32  // Now fp points to all the filenames that are in the directory
33 
34  while (!feof($fp)) {
35  $filename = fgets($fp, 4096);
36  // Strip the filepath off the file and the .out off the file to get the filename
37  $filename = str_replace($filepath . "/", "", $filename);
38  $filename = trim(str_replace(".html", "", $filename));
39 
40  // Don't show the status file
41  if ($filename != "status" && trim($filename != "")) {
42  // What can happen is the first characters will be based on 100 instead of 2000,
43  // So if the first characters is 1, then format one way, if 2 then format another
44  if (substr($filename, 0, 1) == '1') {
45  $disp_filename = preg_replace("/^([0-9]{3})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{1,6})$/",
46  "\\1-\\2-\\3 \\4:\\5:\\6.\\7", $filename);
47  }
48  else {
49  // What needs to be done is to parse the file up into pieces so it can be more easily read.
50  $disp_filename = preg_replace("/^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{1,6})$/",
51  "\\1-\\2-\\3 \\4:\\5:\\6.\\7", $filename);
52  }
53  printf ("<tr>\n<td class='hdr'>\n<a href=\"files/%s%s.html\" target=\"CONTENT\">%s</a></td>\n</tr>\n", $cu_dir, $filename, $disp_filename);
54  }
55  }
56  pclose($fp);
57 ?>
58  </table>
59  </form>
60 </body>
61 </html>