vogelor
2008-12-02 fb4c27e329659f7ebfb72855297549ac01a54f02
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');
8793b3 33 require_once('tools.inc.php');
b7489f 34
V 35 //* Check permissions for module
36 $app->auth->check_module_permissions('monitor');
37
38
39 /* Get the dataType to show */
40 $dataType = $_GET["type"];
41
42 $output = '';
43
44 switch($dataType) {
8793b3 45     case 'server_load':
V 46         $template = 'templates/show_data.htm';
47         $output .= showServerLoad();
fb4c27 48         $time = getDataTime('server_load');
8793b3 49         $title = $app->lng("Server Load").' (Server: ' . $_SESSION['monitor']['server_name'] . ')';
V 50         $description = '';
51         break;
52     case 'disk_usage':
53         $template = 'templates/show_data.htm';
54         $output .= showDiskUsage();
fb4c27 55         $time = getDataTime('disk_usage');
8793b3 56         $title = $app->lng("Disk usage").' (Server: ' . $_SESSION['monitor']['server_name'] . ')';
V 57         $description = '';
58         break;
59     case 'mem_usage':
60         $template = 'templates/show_data.htm';
61         $output .= showMemUsage();
fb4c27 62         $time = getDataTime('mem_usage');
8793b3 63         $title = $app->lng("Memory usage").' (Server: ' . $_SESSION['monitor']['server_name'] . ')';
V 64         $description = '';
65         break;
66     case 'cpu_info':
67         $template = 'templates/show_data.htm';
68         $output .= showCpuInfo();
fb4c27 69         $time = getDataTime('cpu_info');
8793b3 70         $title = $app->lng("CPU info").' (Server: ' . $_SESSION['monitor']['server_name'] . ')';
V 71         $description = '';
72         break;
73     case 'services':
74         $template = 'templates/show_data.htm';
75         $output .= showServices();
fb4c27 76         $time = getDataTime('services');
8793b3 77         $title = $app->lng("Status of services").' (Server: ' . $_SESSION['monitor']['server_name'] . ')';
V 78         $description = '';
79         break;
716255 80     case 'system_update':
V 81         $template = 'templates/show_data.htm';
82         $output .= showSystemUpdate();
fb4c27 83         $time = getDataTime('system_update');
716255 84         $title = "Update State" . ' (Server: ' . $_SESSION['monitor']['server_name'] . ')';
V 85         $description = '';
86         break;
87     case 'mailq':
88         $template = 'templates/show_data.htm';
89         $output .= showMailq();
fb4c27 90         $time = getDataTime('mailq');
716255 91         $title = "Mailq" . ' (Server: ' . $_SESSION['monitor']['server_name'] . ')';
V 92         $description = '';
93         break;
36d307 94     case 'raid_state':
V 95         $template = 'templates/show_data.htm';
96         $output .= showRaidState();
fb4c27 97         $time = getDataTime('raid_state');
36d307 98         $title = "RAID-State" . ' (Server: ' . $_SESSION['monitor']['server_name'] . ')';
V 99         $description = '';
100         break;
101     case 'rkhunter':
102         $template = 'templates/show_data.htm';
103         $output .= showRKHunter();
fb4c27 104         $time = getDataTime('rkhunter');
36d307 105         $title = "RKHunter-Log" . ' (Server: ' . $_SESSION['monitor']['server_name'] . ')';
V 106         $description = '';
107         break;
8793b3 108     default:
V 109         $template = '';
110         break;
b7489f 111 }
V 112
113
114 // Loading the template
115 $app->uses('tpl');
116 $app->tpl->newTemplate("form.tpl.htm");
fb4c27 117 $app->tpl->setInclude('content_tpl', $template);
b7489f 118
fb4c27 119 $app->tpl->setVar("output", $output);
V 120 $app->tpl->setVar("title", $title);
121 $app->tpl->setVar("description", $description);
122 $app->tpl->setVar("time", $time);
b7489f 123
V 124 $app->tpl_defaults();
125 $app->tpl->pparse();
126 ?>