Skip to content

Commit ce9867c

Browse files
committed
Merged revisions 2292,2296,2299 from satble branch.
1 parent 532ae59 commit ce9867c

File tree

5 files changed

+74
-2
lines changed

5 files changed

+74
-2
lines changed

install/tpl/system.ini.master

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ new_domain_html=Please contact our support to create a new domain for you.
3030

3131
[misc]
3232
dashboard_atom_url=http://www.ispconfig.org/atom
33+
monitor_key=

interface/web/admin/form/system_config.tform.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,12 @@
260260
'default' => 'http://www.ispconfig.org/atom',
261261
'value' => ''
262262
),
263+
'monitor_key' => array (
264+
'datatype' => 'VARCHAR',
265+
'formtype' => 'TEXT',
266+
'default' => '',
267+
'value' => ''
268+
),
263269
##################################
264270
# ENDE Datatable fields
265271
##################################

interface/web/admin/lib/lang/en_system_config.lng

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ $wb["use_domain_module_txt"] = 'Use the domain-module to add new domains';
2121
$wb["use_domain_module_hint"] = 'If you use this module, your customers can only select one of the domains the admin creates for them. They cannot free edit the domain-field.You have to re-login after changing this value, to make the changes visible.';
2222
$wb["new_domain_txt"] = 'HTML to create a new domain';
2323
$wb["webftp_url_txt"] = 'WebFTP URL';
24-
$wb['admin_mail_txt'] = 'Administrator\'s e-mail';
25-
$wb['admin_name_txt'] = 'Administrator\'s name';
24+
$wb['admin_mail_txt'] = 'Administrator\'s e-mail';
25+
$wb["monitor_key_txt"] = 'Monitor keyword';
26+
$wb['admin_name_txt'] = 'Administrator\'s name';
2627
?>

interface/web/admin/templates/system_config_misc_edit.htm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ <h2><tmpl_var name="list_head_txt"></h2>
99
<label for="dashboard_atom_url">{tmpl_var name='dashboard_atom_url_txt'}</label>
1010
<input name="dashboard_atom_url" id="dashboard_atom_url" value="{tmpl_var name='dashboard_atom_url'}" size="" maxlength="" type="text" class="textInput" />
1111
</div>
12+
<div class="ctrlHolder">
13+
<label for="monitor_key">{tmpl_var name='monitor_key_txt'}</label>
14+
<input name="monitor_key" id="monitor_key" value="{tmpl_var name='monitor_key'}" size="" maxlength="" type="text" class="textInput" />
15+
</div>
1216
</fieldset>
1317

1418
<input type="hidden" name="id" value="{tmpl_var name='id'}">

interface/web/remote/monitor.php

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
require_once('../../lib/config.inc.php');
3+
$conf['start_session'] = false;
4+
require_once('../../lib/app.inc.php');
5+
6+
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
7+
8+
header('Content-Type: application/json; charset=utf-8');
9+
header('Access-Control-Allow-Origin: *');
10+
header('Access-Control-Allow-Headers: X-Requested-With');
11+
header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1
12+
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
13+
14+
$type = addslashes($_GET['type']);
15+
$token = addslashes($_GET['token']);
16+
$server_id = intval($_GET['server']);
17+
18+
$app->uses('getconf');
19+
$interface_config = $app->getconf->get_global_config('misc');
20+
$secret = $interface_config['monitor_key'];
21+
22+
$out = array();
23+
24+
if($token == '' or $secret == '' or $token != $secret) {
25+
$out['state'] = 'syserror';
26+
$out['data'] = 'Password empty or incorrect.';
27+
$out['time'] = date('Y-m-d H:i');
28+
} else {
29+
if($type == 'serverlist') {
30+
$sql = 'SELECT server_id, server_name FROM server WHERE 1 ORDER BY server_id';
31+
$records = $app->db->queryAllRecords($sql);
32+
$out['state'] = 'ok';
33+
$out['data'] = $records;
34+
$out['time'] = date('Y-m-d H:i',$rec['created']);
35+
} else {
36+
$rec = $app->db->queryOneRecord("SELECT * FROM monitor_data WHERE type = '$type' AND server_id = $server_id");
37+
if(is_array($rec)) {
38+
$out['state'] = $rec['state'];
39+
$out['data'] = unserialize(stripslashes($rec['data']));
40+
if(is_array($out['data']) && sizeof($out['data']) > 0){
41+
foreach($out['data'] as $key => $val){
42+
if(!$val) $out['data'][$key] = "&nbsp;";
43+
}
44+
}
45+
$out['time'] = date('Y-m-d H:i',$rec['created']);
46+
} else {
47+
$out['state'] = 'syserror';
48+
$out['data'] = 'No monitor record found.';
49+
$out['time'] = date('Y-m-d H:i');
50+
}
51+
$sql = 'SELECT server_id, server_name FROM server WHERE 1 ORDER BY server_id';
52+
$records = $app->db->queryAllRecords($sql);
53+
$out['serverlist'] = $records;
54+
}
55+
}
56+
$out['type'] = $type;
57+
58+
echo json_encode($out);
59+
exit;
60+
?>

0 commit comments

Comments
 (0)