Updated acknowledgements page
[openemr.git] / interface / logview / erx_logview.php
blob33d0f92bbaad09e976e69d05aa52ebe1110a2150
1 <?php
2 // +-----------------------------------------------------------------------------+
3 // Copyright (C) 2011 ZMG LLC <sam@zhservices.com>
4 //
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
18 // A copy of the GNU General Public License is included along with this program:
19 // openemr/interface/login/GnuGPL.html
20 // For more information write to the Free Software
21 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 // Author: Eldho Chacko <eldho@zhservices.com>
24 // Vinish K <vinish@zhservices.com>
26 // +------------------------------------------------------------------------------+
27 //SANITIZE ALL ESCAPES
28 $sanitize_all_escapes=true;
31 //STOP FAKE REGISTER GLOBALS
32 $fake_register_globals=false;
34 include_once("../globals.php");
35 include_once("$srcdir/log.inc");
36 include_once("$srcdir/formdata.inc.php");
37 require_once("$srcdir/formatting.inc.php");
38 $error_log_path=$GLOBALS['OE_SITE_DIR']."/documents/erx_error";
39 if($_REQUEST['filename'])
41 $bat_content='';
42 preg_match('/erx_error-\d{4}-\d{1,2}-\d{1,2}\.log/',$_REQUEST['filename'],$matches);
43 if($matches){
44 if ($fd = fopen ($error_log_path."/".$_REQUEST['filename'], "r")) {
45 $bat_content = fread($fd, filesize($error_log_path."/".$_REQUEST['filename']));
47 $filename=$_REQUEST['filename'];
48 header("Pragma: public");
49 header("Expires: 0");
50 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
51 header("Content-Type: application/force-download");
52 header("Content-Disposition: attachment; filename=$filename");
53 header("Content-Description: File Transfer");
54 header("Content-Length: " . strlen($bat_content));
55 echo $bat_content;
56 die;
59 $start_date=$_REQUEST['start_date'];
61 <html>
62 <head>
63 <?php html_header_show();?>
64 <link rel="stylesheet" href='<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar.css' type='text/css'>
65 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script>
66 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar.js"></script>
67 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
68 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar_setup.js"></script>
70 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-1.2.2.min.js"></script>
71 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
72 </head>
73 <body class="body_top">
74 <form method="post">
75 <font class="title"><?php echo htmlspecialchars(xl('eRx Logs'), ENT_QUOTES) ?></font><br><br>
76 <table>
77 <tr>
78 <td>
79 <span class="text"><?php echo htmlspecialchars(xl('Date'), ENT_QUOTES) ?>: </span>
80 </td>
81 <td>
82 <input type="text" size="10" name="start_date" id="start_date" value="<?php echo $start_date ? substr($start_date, 0, 10) : date('Y-m-d'); ?>" title="<?php echo htmlspecialchars(xl('yyyy-mm-dd Date of service'), ENT_QUOTES); ?>" onkeyup="datekeyup(this,mypcc)" onblur="dateblur(this,mypcc)" />
83 <img src="../pic/show_calendar.gif" align="absbottom" width="24" height="22" id="img_begin_date" border="0" alt="[?]" style="cursor: pointer; cursor: hand" title="<?php echo htmlspecialchars(xl('Click here to choose a date'), ENT_QUOTES); ?>">&nbsp;
84 </td>
85 <td>
86 <input type="submit" name="search_logs" value="<?php echo htmlspecialchars(xl('Search'), ENT_QUOTES);?>">
87 </td>
88 </tr>
89 </table>
90 </form>
91 <?php
92 $check_for_file=0;
93 if($_REQUEST['search_logs'])
95 if ($handle = opendir($error_log_path)) {
96 while (false !== ($file = readdir($handle))) {
97 $file_as_in_folder="erx_error-$start_date.log";
98 if($file!='.' && $file!='..' && $file_as_in_folder==$file){
99 $check_for_file=1;
100 $fd = fopen ($error_log_path."/".$file, "r");
101 $bat_content = fread($fd, filesize($error_log_path."/".$file));
103 <a href="erx_logview.php?filename=<?php echo htmlspecialchars($file,ENT_QUOTES);?>"><?php echo htmlspecialchars($file,ENT_NOQUOTES)?></a><br>
104 <textarea rows="35" cols="132"><?php echo htmlspecialchars($bat_content, ENT_QUOTES);?></textarea>
105 <?php
109 if($check_for_file==0)
110 echo htmlspecialchars( xl("No log file exist for the selected date"),ENT_QUOTES);
113 </body>
114 <script language="javascript">
115 Calendar.setup({inputField:"start_date", ifFormat:"%Y-%m-%d", button:"img_begin_date"});
116 </script>
117 </html>