Commit ce9867c8 authored by tbrehm's avatar tbrehm
Browse files

Merged revisions 2292,2296,2299 from satble branch.

parent 532ae591
......@@ -30,3 +30,4 @@ new_domain_html=Please contact our support to create a new domain for you.
[misc]
dashboard_atom_url=http://www.ispconfig.org/atom
monitor_key=
......@@ -260,6 +260,12 @@ $form["tabs"]['misc'] = array (
'default' => 'http://www.ispconfig.org/atom',
'value' => ''
),
'monitor_key' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '',
'value' => ''
),
##################################
# ENDE Datatable fields
##################################
......
......@@ -21,6 +21,7 @@ $wb["use_domain_module_txt"] = 'Use the domain-module to add new domains';
$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.';
$wb["new_domain_txt"] = 'HTML to create a new domain';
$wb["webftp_url_txt"] = 'WebFTP URL';
$wb['admin_mail_txt'] = 'Administrator\'s e-mail';
$wb['admin_name_txt'] = 'Administrator\'s name';
$wb['admin_mail_txt'] = 'Administrator\'s e-mail';
$wb["monitor_key_txt"] = 'Monitor keyword';
$wb['admin_name_txt'] = 'Administrator\'s name';
?>
......@@ -9,6 +9,10 @@
<label for="dashboard_atom_url">{tmpl_var name='dashboard_atom_url_txt'}</label>
<input name="dashboard_atom_url" id="dashboard_atom_url" value="{tmpl_var name='dashboard_atom_url'}" size="" maxlength="" type="text" class="textInput" />
</div>
<div class="ctrlHolder">
<label for="monitor_key">{tmpl_var name='monitor_key_txt'}</label>
<input name="monitor_key" id="monitor_key" value="{tmpl_var name='monitor_key'}" size="" maxlength="" type="text" class="textInput" />
</div>
</fieldset>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
......
<?php
require_once('../../lib/config.inc.php');
$conf['start_session'] = false;
require_once('../../lib/app.inc.php');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
header('Content-Type: application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: X-Requested-With');
header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
$type = addslashes($_GET['type']);
$token = addslashes($_GET['token']);
$server_id = intval($_GET['server']);
$app->uses('getconf');
$interface_config = $app->getconf->get_global_config('misc');
$secret = $interface_config['monitor_key'];
$out = array();
if($token == '' or $secret == '' or $token != $secret) {
$out['state'] = 'syserror';
$out['data'] = 'Password empty or incorrect.';
$out['time'] = date('Y-m-d H:i');
} else {
if($type == 'serverlist') {
$sql = 'SELECT server_id, server_name FROM server WHERE 1 ORDER BY server_id';
$records = $app->db->queryAllRecords($sql);
$out['state'] = 'ok';
$out['data'] = $records;
$out['time'] = date('Y-m-d H:i',$rec['created']);
} else {
$rec = $app->db->queryOneRecord("SELECT * FROM monitor_data WHERE type = '$type' AND server_id = $server_id");
if(is_array($rec)) {
$out['state'] = $rec['state'];
$out['data'] = unserialize(stripslashes($rec['data']));
if(is_array($out['data']) && sizeof($out['data']) > 0){
foreach($out['data'] as $key => $val){
if(!$val) $out['data'][$key] = "&nbsp;";
}
}
$out['time'] = date('Y-m-d H:i',$rec['created']);
} else {
$out['state'] = 'syserror';
$out['data'] = 'No monitor record found.';
$out['time'] = date('Y-m-d H:i');
}
$sql = 'SELECT server_id, server_name FROM server WHERE 1 ORDER BY server_id';
$records = $app->db->queryAllRecords($sql);
$out['serverlist'] = $records;
}
}
$out['type'] = $type;
echo json_encode($out);
exit;
?>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment