Skip to content

Commit 91624b8

Browse files
committed
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.
1 parent dbbafff commit 91624b8

30 files changed

+65
-15
lines changed

install/tpl/config.inc.php.master

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,15 @@ $conf["server_id"] = "{server_id}";
117117
//** Interface
118118
$conf['interface_modules_enabled'] = 'dashboard,mail,sites,dns,tools';
119119

120+
//** Demo mode
121+
/* The demo mode is an option to restrict certain actions in the interface like
122+
* changing the password of users with sys_userid < 3 etc. to be
123+
* able to run the ISPConfig interface as online demo. It does not
124+
* affect the server part. The demo mode should be always set to false
125+
* on every normal installation
126+
*/
127+
$conf['demo_mode'] = false;
128+
120129

121130
//** Logging
122131
$conf["log_file"] = $conf["logpath"].$conf["fs_div"]."ispconfig.log";

interface/lib/config.inc.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@
103103
//** Interface
104104
$conf['interface_modules_enabled'] = 'dashboard,mail,sites,dns,tools';
105105

106+
//** Demo mode
107+
/* The demo mode is an option to restrict certain actions in the interface like
108+
* changing the password of users with sys_userid < 3 etc. to be
109+
* able to run the ISPConfig interface as online demo. It does not
110+
* affect the server part. The demo mode should be always set to false
111+
* on every normal installation
112+
*/
113+
$conf['demo_mode'] = false;
114+
106115

107116
//** Logging
108117
$conf["log_file"] = '/var/log/ispconfig/ispconfig.log';

interface/web/admin/language_add.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
//* This is only allowed for administrators
3737
if(!$app->auth->is_admin()) die('only allowed for administrators.');
38+
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
3839

3940
$app->uses('tpl');
4041

interface/web/admin/language_complete.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
//* Check permissions for module
3434
$app->auth->check_module_permissions('admin');
35+
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
3536

3637
//* This is only allowed for administrators
3738
if(!$app->auth->is_admin()) die('only allowed for administrators.');

interface/web/admin/language_edit.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
//* This is only allowed for administrators
3737
if(!$app->auth->is_admin()) die('only allowed for administrators.');
38+
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
3839

3940
$app->uses('tpl');
4041

interface/web/admin/language_export.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
//* This is only allowed for administrators
3737
if(!$app->auth->is_admin()) die('only allowed for administrators.');
38+
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
3839

3940
$app->uses('tpl');
4041

interface/web/admin/language_import.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
//* This is only allowed for administrators
3737
if(!$app->auth->is_admin()) die('only allowed for administrators.');
38+
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
3839

3940
$app->uses('tpl');
4041

interface/web/admin/remote_user_edit.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
die;
1414
}
1515

16+
// Disable this function in demo mode
17+
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
18+
1619
// Load the templating and form classes
1720
$app->uses('tpl,tform,tform_actions');
1821
$app->load('tform_actions');

interface/web/admin/server_config_del.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444

4545
//* Check permissions for module
4646
$app->auth->check_module_permissions('admin');
47+
if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
4748

4849
$app->uses("tform_actions");
4950
$app->tform_actions->onDelete();

interface/web/admin/server_config_edit.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,21 @@ function onShowEdit() {
7171
}
7272

7373
function onUpdateSave($sql) {
74-
global $app;
74+
global $app,$conf;
7575

7676
if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
7777
$app->uses('ini_parser,getconf');
7878

79-
$section = $app->tform->getCurrentTab();
80-
$server_id = $this->id;
79+
if($conf['demo_mode'] != true) {
80+
$section = $app->tform->getCurrentTab();
81+
$server_id = $this->id;
8182

82-
$server_config_array = $app->getconf->get_server_config($server_id);
83-
$server_config_array[$section] = $app->tform->encode($this->dataRecord,$section);
84-
$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
83+
$server_config_array = $app->getconf->get_server_config($server_id);
84+
$server_config_array[$section] = $app->tform->encode($this->dataRecord,$section);
85+
$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
8586

86-
$app->db->datalogUpdate('server', "config = '".$app->db->quote($server_config_str)."'", 'server_id', $server_id);
87+
$app->db->datalogUpdate('server', "config = '".$app->db->quote($server_config_str)."'", 'server_id', $server_id);
88+
}
8789
}
8890

8991
}

0 commit comments

Comments
 (0)