Commit 91624b8a authored by tbrehm's avatar tbrehm
Browse files

Added the configuration variable $conf['demo_mode'] in the config.inc.php...

Added the configuration variable $conf['demo_mode'] in the config.inc.php file. It disables the newly introduced demo mode which limits certain actions in the interface part of ispconfig: the demo mode can be used to run the ispconfig interface part as online demo.
parent dbbafff1
......@@ -117,6 +117,15 @@ $conf["server_id"] = "{server_id}";
//** Interface
$conf['interface_modules_enabled'] = 'dashboard,mail,sites,dns,tools';
//** Demo mode
/* The demo mode is an option to restrict certain actions in the interface like
* changing the password of users with sys_userid < 3 etc. to be
* able to run the ISPConfig interface as online demo. It does not
* affect the server part. The demo mode should be always set to false
* on every normal installation
*/
$conf['demo_mode'] = false;
//** Logging
$conf["log_file"] = $conf["logpath"].$conf["fs_div"]."ispconfig.log";
......
......@@ -103,6 +103,15 @@ $conf["server_id"] = "1";
//** Interface
$conf['interface_modules_enabled'] = 'dashboard,mail,sites,dns,tools';
//** Demo mode
/* The demo mode is an option to restrict certain actions in the interface like
* changing the password of users with sys_userid < 3 etc. to be
* able to run the ISPConfig interface as online demo. It does not
* affect the server part. The demo mode should be always set to false
* on every normal installation
*/
$conf['demo_mode'] = false;
//** Logging
$conf["log_file"] = '/var/log/ispconfig/ispconfig.log';
......
......@@ -35,6 +35,7 @@ $app->auth->check_module_permissions('admin');
//* This is only allowed for administrators
if(!$app->auth->is_admin()) die('only allowed for administrators.');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
$app->uses('tpl');
......
......@@ -32,6 +32,7 @@ require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('admin');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
//* This is only allowed for administrators
if(!$app->auth->is_admin()) die('only allowed for administrators.');
......
......@@ -35,6 +35,7 @@ $app->auth->check_module_permissions('admin');
//* This is only allowed for administrators
if(!$app->auth->is_admin()) die('only allowed for administrators.');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
$app->uses('tpl');
......
......@@ -35,6 +35,7 @@ $app->auth->check_module_permissions('admin');
//* This is only allowed for administrators
if(!$app->auth->is_admin()) die('only allowed for administrators.');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
$app->uses('tpl');
......
......@@ -35,6 +35,7 @@ $app->auth->check_module_permissions('admin');
//* This is only allowed for administrators
if(!$app->auth->is_admin()) die('only allowed for administrators.');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
$app->uses('tpl');
......
......@@ -13,6 +13,9 @@ if(!stristr($_SESSION['s']['user']['modules'],'admin')) {
die;
}
// Disable this function in demo mode
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
// Load the templating and form classes
$app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
......
......@@ -44,6 +44,7 @@ require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('admin');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
$app->uses("tform_actions");
$app->tform_actions->onDelete();
......
......@@ -71,19 +71,21 @@ class page_action extends tform_actions {
}
function onUpdateSave($sql) {
global $app;
global $app,$conf;
if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
$app->uses('ini_parser,getconf');
$section = $app->tform->getCurrentTab();
$server_id = $this->id;
if($conf['demo_mode'] != true) {
$section = $app->tform->getCurrentTab();
$server_id = $this->id;
$server_config_array = $app->getconf->get_server_config($server_id);
$server_config_array[$section] = $app->tform->encode($this->dataRecord,$section);
$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
$server_config_array = $app->getconf->get_server_config($server_id);
$server_config_array[$section] = $app->tform->encode($this->dataRecord,$section);
$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
$app->db->datalogUpdate('server', "config = '".$app->db->quote($server_config_str)."'", 'server_id', $server_id);
$app->db->datalogUpdate('server', "config = '".$app->db->quote($server_config_str)."'", 'server_id', $server_id);
}
}
}
......
......@@ -44,6 +44,7 @@ require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('admin');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
$app->uses("tform_actions");
$app->tform_actions->onDelete();
......
......@@ -44,6 +44,7 @@ require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('admin');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
$app->uses("tform_actions");
$app->tform_actions->onDelete();
......
......@@ -43,6 +43,7 @@ require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('admin');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
// Loading classes
$app->uses('tpl,tform,tform_actions');
......
......@@ -78,7 +78,7 @@ class page_action extends tform_actions {
}
function onUpdateSave($sql) {
global $app;
global $app,$conf;
if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
$app->uses('ini_parser,getconf');
......@@ -90,7 +90,7 @@ class page_action extends tform_actions {
$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
$sql = "UPDATE sys_ini SET config = '".$app->db->quote($server_config_str)."' WHERE sysini_id = 1";
$app->db->query($sql);
if($conf['demo_mode'] != true) $app->db->query($sql);
/*
* If we should use the domain-module, we have to insert all existing domains into the table
......
......@@ -44,6 +44,7 @@ require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('admin');
if($conf['demo_mode'] == true && $_REQUEST['id'] <= 3) $app->error('This function is disabled in demo mode.');
$app->uses("tform_actions");
$app->tform_actions->onDelete();
......
......@@ -61,6 +61,8 @@ class page_action extends tform_actions {
function onBeforeUpdate() {
global $app, $conf;
if($conf['demo_mode'] == true && $_REQUEST['id'] <= 3) $app->error('This function is disabled in demo mode.');
if(@is_array($this->dataRecord['modules']) && !in_array($this->dataRecord['startmodule'],$this->dataRecord['modules'])) {
$app->tform->errorMessage .= $app->tform->wordbook['startmodule_err'];
}
......
......@@ -44,6 +44,7 @@ require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('client');
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
$app->uses('tpl,tform');
$app->load('tform_actions');
......
......@@ -178,7 +178,7 @@ class page_action extends tform_actions {
global $app;
// username changed
if(isset($this->dataRecord['username']) && $this->dataRecord['username'] != '' && $this->oldDataRecord['username'] != $this->dataRecord['username']) {
if($conf['demo_mode'] != true && isset($this->dataRecord['username']) && $this->dataRecord['username'] != '' && $this->oldDataRecord['username'] != $this->dataRecord['username']) {
$username = $app->db->quote($this->dataRecord["username"]);
$client_id = $this->id;
$sql = "UPDATE sys_user SET username = '$username' WHERE client_id = $client_id";
......@@ -190,7 +190,7 @@ class page_action extends tform_actions {
}
// password changed
if(isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
if($conf['demo_mode'] != true && isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
$password = $app->db->quote($this->dataRecord["password"]);
$client_id = $this->id;
$sql = "UPDATE sys_user SET passwort = md5('$password') WHERE client_id = $client_id";
......@@ -198,7 +198,7 @@ class page_action extends tform_actions {
}
// language changed
if(isset($this->dataRecord['language']) && $this->dataRecord['language'] != '' && $this->oldDataRecord['language'] != $this->dataRecord['language']) {
if($conf['demo_mode'] != true && isset($this->dataRecord['language']) && $this->dataRecord['language'] != '' && $this->oldDataRecord['language'] != $this->dataRecord['language']) {
$language = $app->db->quote($this->dataRecord["language"]);
$client_id = $this->id;
$sql = "UPDATE sys_user SET language = '$language' WHERE client_id = $client_id";
......
......@@ -55,6 +55,8 @@ class page_action extends tform_actions {
function onBeforeDelete() {
global $app, $conf;
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
$client_id = intval($this->dataRecord['client_id']);
$tmp = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE parent_client_id = ".$client_id);
......
......@@ -173,7 +173,7 @@ class page_action extends tform_actions {
global $app, $conf;
// username changed
if(isset($this->dataRecord['username']) && $this->dataRecord['username'] != '' && $this->oldDataRecord['username'] != $this->dataRecord['username']) {
if($conf['demo_mode'] != true && isset($this->dataRecord['username']) && $this->dataRecord['username'] != '' && $this->oldDataRecord['username'] != $this->dataRecord['username']) {
$username = $app->db->quote($this->dataRecord["username"]);
$client_id = $this->id;
$sql = "UPDATE sys_user SET username = '$username' WHERE client_id = $client_id";
......@@ -185,7 +185,7 @@ class page_action extends tform_actions {
}
// password changed
if(isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
if($conf['demo_mode'] != true && isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
$password = $app->db->quote($this->dataRecord["password"]);
$client_id = $this->id;
$sql = "UPDATE sys_user SET passwort = md5('$password') WHERE client_id = $client_id";
......@@ -193,7 +193,7 @@ class page_action extends tform_actions {
}
// language changed
if(isset($this->dataRecord['language']) && $this->dataRecord['language'] != '' && $this->oldDataRecord['language'] != $this->dataRecord['language']) {
if($conf['demo_mode'] != true && isset($this->dataRecord['language']) && $this->dataRecord['language'] != '' && $this->oldDataRecord['language'] != $this->dataRecord['language']) {
$language = $app->db->quote($this->dataRecord["language"]);
$client_id = $this->id;
$sql = "UPDATE sys_user SET language = '$language' WHERE client_id = $client_id";
......
Supports Markdown
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