vogelor
2008-11-02 e035056676d055eacea6db137cbce188d378a800
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
43 $refresh = intval($_GET["refresh"]);
44 $logParam = $_GET["log"];
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 */
91 $refresh_values = array('0' => '- No Refresh -','5' => '5','10' => '10','15' => '15','30' => '30','60' => '60');
92 $tmp = '';
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 $data = unserialize($record['data']);
106
107 $logData = nl2br($data);
108
109 $app->tpl->setVar("log_data", $logData);
110 $app->tpl->setVar("title", $title);
111 $app->tpl->setVar("log_id",$logId);
112
113
114 $app->tpl_defaults();
115 $app->tpl->pparse();
116 ?>