karailiev
2008-11-21 88134f50d36458269ed612287be3df9574ff4478
commit | author | age
b7489f 1 <?php
V 2
3 /*
4 Copyright (c) 2007-2008, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
5 All rights reserved.
6
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
9
10     * Redistributions of source code must retain the above copyright notice,
11       this list of conditions and the following disclaimer.
12     * Redistributions in binary form must reproduce the above copyright notice,
13       this list of conditions and the following disclaimer in the documentation
14       and/or other materials provided with the distribution.
15     * Neither the name of ISPConfig nor the names of its contributors
16       may be used to endorse or promote products derived from this software without
17       specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 require_once('../../lib/config.inc.php');
32 require_once('../../lib/app.inc.php');
33
34 //* Check permissions for module
35 $app->auth->check_module_permissions('monitor');
36
37 // Loading the template
38 $app->uses('tpl');
39 $app->tpl->newTemplate("form.tpl.htm");
40 $app->tpl->setInclude('content_tpl','templates/show_log.htm');
41
42 // Importing the GET values
b3c1ca 43 $refresh = (isset($_GET["refresh"]))?intval($_GET["refresh"]):0;
b7489f 44 $logParam = $_GET["log"];
V 45
46
47 /*
48  Setting the db-type and the caption
49  */
50 switch($logParam) {
51     case 'log_mail':
52         $logId = 'log_mail';
53         $title = 'Mail - Log (Server: ' . $_SESSION['monitor']['server_name'] . ')';
54         break;
55     case 'log_mail_warn':
56         $logId = 'log_mail_warn';
57         $title = 'Mail-Warn - Log (Server: ' . $_SESSION['monitor']['server_name'] . ')';
58         break;
59     case 'log_mail_err':
60         $logId = 'log_mail_err';
61         $title = 'Mail-Error - Log (Server: ' . $_SESSION['monitor']['server_name'] . ')';
62         break;
63     case 'log_messages':
64         $logId = 'log_messages';
65         $title = 'Messages (Server: ' . $_SESSION['monitor']['server_name'] . ')';
66         break;
67     case 'log_freshclam':
68         $logId = 'log_freshclam';
69         $title = 'Freshclam - Log (Server: ' . $_SESSION['monitor']['server_name'] . ')';
70         break;
71     case 'log_clamav':
72         $logId = 'log_clamav';
73         $title = 'Clamav - Log (Server: ' . $_SESSION['monitor']['server_name'] . ')';
74         break;
75     case 'log_ispconfig':
76         $logId = 'log_ispconfig';
77         $title = 'ISP Config - Log (Server: ' . $_SESSION['monitor']['server_name'] . ')';
78         break;
79     default:
80         $logId = '???';
81         $title = '???';
82         break;
83 }
84
85
86 /*
87  Creating the array with the refresh intervals
88  Attention: the core-moule ist triggered every 5 minutes, 
89             so reload every 2 minutes is impossible!
90 */
88134f 91 $refresh_values = array('0' => '- '.$app->lng("No Refresh").' -','5' => '5 '.$app->lng("minutes"),'10' => '10 '.$app->lng("minutes"),'15' => '15 '.$app->lng("minutes"),'30' => '30 '.$app->lng("minutes"),'60' => '60 '.$app->lng("minutes"));
b7489f 92 $tmp = '';
V 93 foreach($refresh_values as $key => $val) {
94     if($key == $refresh) {
95         $tmp .= "<option value='$key' SELECTED>$val</option>";
96     } else {
97         $tmp .= "<option value='$key'>$val</option>";
98     }
99 }
100 $app->tpl->setVar("refresh",$tmp);
101
102
103 /* fetch the Data from the DB */
104 $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = '" . $app->db->quote($logId) . "' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
105
b3c1ca 106 if(isset($record['data'])) {
T 107     $data = unserialize($record['data']);
b7489f 108
b3c1ca 109     $logData = nl2br($data);
T 110
111     $app->tpl->setVar("log_data", $logData);
112 } else {
113     $app->tpl->setVar("log_data", $app->lng("no_logdata_txt"));
114 }
115
b7489f 116 $app->tpl->setVar("title", $title);
V 117 $app->tpl->setVar("log_id",$logId);
118
119
120 $app->tpl_defaults();
121 $app->tpl->pparse();
88134f 122 ?>