Skip to content

Commit b25f400

Browse files
author
Till Brehm
committed
Merge branch 'master' of git.ispconfig.org:ispconfig/ispconfig3
2 parents 41b80be + 216ea12 commit b25f400

File tree

668 files changed

+6202
-5173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

668 files changed

+6202
-5173
lines changed

install/install.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@
115115
include_once $cmd_opt['autoinstall'];
116116
} elseif($path_parts['extension'] == 'ini') {
117117
$tmp = ini_to_array(file_get_contents('autoinstall.ini'));
118+
if(!is_array($tmp['install'])) $tmp['install'] = array();
119+
if(!is_array($tmp['ssl_cert'])) $tmp['ssl_cert'] = array();
120+
if(!is_array($tmp['expert'])) $tmp['expert'] = array();
121+
if(!is_array($tmp['update'])) $tmp['update'] = array();
118122
$autoinstall = $tmp['install'] + $tmp['ssl_cert'] + $tmp['expert'] + $tmp['update'];
119123
unset($tmp);
120124
}

install/sql/incremental/upd_dev_collection.sql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@ ALTER TABLE `client_template` ADD `default_webserver` INT(11) NOT NULL DEFAULT 1
1010
ALTER TABLE `client_template` ADD `default_dnsserver` INT(11) NOT NULL DEFAULT 1;
1111
ALTER TABLE `client_template` ADD `default_slave_dnsserver` INT(11) NOT NULL DEFAULT 1;
1212
ALTER TABLE `client_template` ADD `default_dbserver` INT(11) NOT NULL DEFAULT 1;
13+
ALTER TABLE `client_template`
14+
ADD COLUMN `default_xmppserver` int(11) unsigned NOT NULL DEFAULT '1',
15+
ADD COLUMN `xmpp_servers` blob,
16+
ADD COLUMN `limit_xmpp_domain` int(11) NOT NULL DEFAULT '-1',
17+
ADD COLUMN `limit_xmpp_user` int(11) NOT NULL DEFAULT '-1',
18+
ADD COLUMN `limit_xmpp_muc` ENUM( 'n', 'y' ) NOT NULL default 'n',
19+
ADD COLUMN `limit_xmpp_anon` ENUM( 'n', 'y' ) NOT NULL default 'n',
20+
ADD COLUMN `limit_xmpp_vjud` ENUM( 'n', 'y' ) NOT NULL default 'n',
21+
ADD COLUMN `limit_xmpp_proxy` ENUM( 'n', 'y' ) NOT NULL default 'n',
22+
ADD COLUMN `limit_xmpp_status` ENUM( 'n', 'y' ) NOT NULL default 'n',
23+
ADD COLUMN `limit_xmpp_pastebin` ENUM( 'n', 'y' ) NOT NULL default 'n',
24+
ADD COLUMN `limit_xmpp_httparchive` ENUM( 'n', 'y' ) NOT NULL default 'n';
25+
1326
ALTER TABLE `client` ADD `contact_firstname` VARCHAR( 64 ) NOT NULL DEFAULT '' AFTER `gender`;
1427

1528
UPDATE `dns_template` SET `fields` = 'DOMAIN,IP,NS1,NS2,EMAIL,DKIM' WHERE `dns_template`.`template_id` =1;
@@ -174,3 +187,5 @@ ALTER TABLE openvz_template ADD COLUMN `custom` text;
174187
ALTER TABLE openvz_vm
175188
ADD COLUMN `bootorder` INT(11) NOT NULL DEFAULT '1' AFTER `start_boot`,
176189
ADD COLUMN `custom` text;
190+
191+
ALTER TABLE `web_domain` ADD `ssl_letsencrypt` enum('n','y') NOT NULL DEFAULT 'n' AFETR `ssl`;

install/sql/ispconfig3.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,17 @@ CREATE TABLE `client_template` (
308308
`limit_spamfilter_wblist` int(11) NOT NULL default '0',
309309
`limit_spamfilter_user` int(11) NOT NULL default '0',
310310
`limit_spamfilter_policy` int(11) NOT NULL default '0',
311+
`default_xmppserver` int(11) unsigned NOT NULL DEFAULT '1',
312+
`xmpp_servers` blob,
313+
`limit_xmpp_domain` int(11) NOT NULL DEFAULT '-1',
314+
`limit_xmpp_user` int(11) NOT NULL DEFAULT '-1',
315+
`limit_xmpp_muc` ENUM( 'n', 'y' ) NOT NULL default 'n',
316+
`limit_xmpp_anon` ENUM( 'n', 'y' ) NOT NULL default 'n',
317+
`limit_xmpp_vjud` ENUM( 'n', 'y' ) NOT NULL default 'n',
318+
`limit_xmpp_proxy` ENUM( 'n', 'y' ) NOT NULL default 'n',
319+
`limit_xmpp_status` ENUM( 'n', 'y' ) NOT NULL default 'n',
320+
`limit_xmpp_pastebin` ENUM( 'n', 'y' ) NOT NULL default 'n',
321+
`limit_xmpp_httparchive` ENUM( 'n', 'y' ) NOT NULL default 'n',
311322
`limit_web_ip` text,
312323
`limit_web_domain` int(11) NOT NULL default '-1',
313324
`limit_web_quota` int(11) NOT NULL default '-1',
@@ -1892,6 +1903,7 @@ CREATE TABLE `web_domain` (
18921903
`seo_redirect` varchar(255) default NULL,
18931904
`rewrite_to_https` ENUM('y','n') NOT NULL DEFAULT 'n',
18941905
`ssl` enum('n','y') NOT NULL default 'n',
1906+
`ssl_letsencrypt` enum('n','y') NOT NULL DEFAULT 'n',
18951907
`ssl_state` varchar(255) NULL,
18961908
`ssl_locality` varchar(255) NULL,
18971909
`ssl_organisation` varchar(255) NULL,

install/update.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@
120120
include_once $cmd_opt['autoinstall'];
121121
} elseif($path_parts['extension'] == 'ini') {
122122
$tmp = ini_to_array(file_get_contents('autoinstall.ini'));
123+
if(!is_array($tmp['install'])) $tmp['install'] = array();
124+
if(!is_array($tmp['ssl_cert'])) $tmp['ssl_cert'] = array();
125+
if(!is_array($tmp['expert'])) $tmp['expert'] = array();
126+
if(!is_array($tmp['update'])) $tmp['update'] = array();
123127
$autoinstall = $tmp['install'] + $tmp['ssl_cert'] + $tmp['expert'] + $tmp['update'];
124128
unset($tmp);
125129
}

interface/lib/classes/plugin.inc.php

Lines changed: 73 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -43,35 +43,51 @@ private function loadPluginCache() {
4343

4444

4545
if(isset($_SESSION['s']['plugin_cache'])) unset($_SESSION['s']['plugin_cache']);
46-
47-
$plugins_dir = ISPC_LIB_PATH.FS_DIV.'plugins'.FS_DIV;
46+
47+
$plugin_dirs = array();
48+
$plugin_dirs[] = ISPC_LIB_PATH.FS_DIV.'plugins';
49+
50+
if(is_dir(ISPC_WEB_PATH)) {
51+
if($dh = opendir(ISPC_WEB_PATH)) {
52+
while(($file = readdir($dh)) !== false) {
53+
if($file !== '.' && $file !== '..' && is_dir(ISPC_WEB_PATH . FS_DIV . $file) && is_dir(ISPC_WEB_PATH . FS_DIV . $file . FS_DIV . 'lib' . FS_DIV . 'plugin.d')) $plugin_dirs[] = ISPC_WEB_PATH . FS_DIV . $file . FS_DIV . 'lib' . FS_DIV . 'plugin.d';
54+
}
55+
closedir($dh);
56+
}
57+
}
58+
4859
$_SESSION['s']['plugin_cache'] = array();
4960
$tmp_plugins = array();
50-
51-
if (is_dir($plugins_dir)) {
52-
if ($dh = opendir($plugins_dir)) {
53-
//** Go trough all files in the plugin dir
54-
while (($file = readdir($dh)) !== false) {
55-
if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
56-
$plugin_name = substr($file, 0, -8);
57-
$tmp_plugins[$plugin_name] = $file;
61+
62+
for($d = 0; $d < count($plugin_dirs); $d++) {
63+
$plugins_dir = $plugin_dirs[$d];
64+
if (is_dir($plugins_dir)) {
65+
if ($dh = opendir($plugins_dir)) {
66+
$tmp_plugins = array();
67+
//** Go trough all files in the plugin dir
68+
while (($file = readdir($dh)) !== false) {
69+
if($file !== '.' && $file !== '..' && substr($file, -8, 8) == '.inc.php') {
70+
$plugin_name = substr($file, 0, -8);
71+
$tmp_plugins[$plugin_name] = $file;
72+
}
5873
}
59-
}
60-
//** sort the plugins by name
61-
ksort($tmp_plugins);
62-
63-
//** load the plugins
64-
foreach($tmp_plugins as $plugin_name => $file) {
65-
include_once $plugins_dir.$file;
66-
if($this->debug) $app->log('Loading plugin: '.$plugin_name, LOGLEVEL_DEBUG);
67-
$app->loaded_plugins[$plugin_name] = new $plugin_name;
68-
$app->loaded_plugins[$plugin_name]->onLoad();
74+
closedir($dh);
75+
//** sort the plugins by name
76+
ksort($tmp_plugins);
77+
78+
//** load the plugins
79+
foreach($tmp_plugins as $plugin_name => $file) {
80+
require $plugins_dir . FS_DIV . $file;
81+
if($this->debug) $app->log('Loading plugin: '.$plugin_name, LOGLEVEL_DEBUG);
82+
$app->loaded_plugins[$plugin_name] = new $plugin_name;
83+
$app->loaded_plugins[$plugin_name]->onLoad();
84+
}
85+
} else {
86+
$app->log('Unable to open the plugins directory: '.$plugins_dir, LOGLEVEL_ERROR);
6987
}
7088
} else {
71-
$app->log('Unable to open the plugins directory: '.$plugins_dir, LOGLEVEL_ERROR);
89+
$app->log('Plugins directory missing: '.$plugins_dir, LOGLEVEL_ERROR);
7290
}
73-
} else {
74-
$app->log('Plugins directory missing: '.$plugins_dir, LOGLEVEL_ERROR);
7591
}
7692

7793
}
@@ -81,39 +97,44 @@ private function loadPluginCache() {
8197
for faster lookups without the need to load all plugins for every page.
8298
*/
8399

84-
public function registerEvent($event_name, $plugin_name, $function_name) {
100+
public function registerEvent($event_name, $plugin_name, $function_name, $module_name = '') {
85101
global $app;
86102

87-
$_SESSION['s']['plugin_cache'][$event_name][] = array('plugin' => $plugin_name, 'function' => $function_name);
103+
$_SESSION['s']['plugin_cache'][$event_name][] = array('plugin' => $plugin_name, 'function' => $function_name, 'module' => $module_name);
88104
if($this->debug) $app->log("Plugin '$plugin_name' has registered the function '$function_name' for the event '$event_name'", LOGLEVEL_DEBUG);
89105
}
90106

91107
/*
92108
This function is called when a certian action occurs, e.g. a form gets saved or a user is logged in.
93109
*/
94110

95-
public function raiseEvent($event_name, $data) {
111+
public function raiseEvent($event_name, $data, $return_data = false) {
96112
global $app;
97113

98114
if(!isset($_SESSION['s']['plugin_cache'])) {
99115
$this->loadPluginCache();
100116
if($this->debug) $app->log('Loaded the plugin cache.', LOGLEVEL_DEBUG);
101117
}
102-
103-
118+
119+
$result = '';
104120
$sub_events = explode(':', $event_name);
105121

106122
if(is_array($sub_events)) {
107123
if(count($sub_events) == 3) {
108124
$tmp_event = $sub_events[2];
109125
if($this->debug) $app->log("Called Event '$tmp_event'", LOGLEVEL_DEBUG);
110-
$this->callPluginEvent($tmp_event, $data);
126+
$tmpresult = $this->callPluginEvent($tmp_event, $data, $return_data);
127+
if($return_data == true && $tmpresult) $result .= $tmpresult;
128+
111129
$tmp_event = $sub_events[0].':'.$sub_events[2];
112130
if($this->debug) $app->log("Called Event '$tmp_event'", LOGLEVEL_DEBUG);
113-
$this->callPluginEvent($tmp_event, $data);
131+
$tmpresult = $this->callPluginEvent($tmp_event, $data, $return_data);
132+
if($return_data == true && $tmpresult) $result .= $tmpresult;
133+
114134
$tmp_event = $sub_events[0].':'.$sub_events[1].':'.$sub_events[2];
115135
if($this->debug) $app->log("Called Event '$tmp_event'", LOGLEVEL_DEBUG);
116-
$this->callPluginEvent($tmp_event, $data);
136+
$tmpresult = $this->callPluginEvent($tmp_event, $data, $return_data);
137+
if($return_data == true && $tmpresult) $result .= $tmpresult;
117138

118139
/*$sub_events = array_reverse($sub_events);
119140
$tmp_event = '';
@@ -125,23 +146,36 @@ public function raiseEvent($event_name, $data) {
125146
*/
126147
} else {
127148
if($this->debug) $app->log("Called Event '$sub_events[0]'", LOGLEVEL_DEBUG);
128-
$this->callPluginEvent($sub_events[0], $data);
149+
$tmpresult = $this->callPluginEvent($sub_events[0], $data, $return_data);
150+
if($return_data == true && $tmpresult) $result .= $tmpresult;
129151
}
130152
}
153+
154+
if($return_data == true) return $result;
131155

132156
} // end function raiseEvent
133157

134158
//* Internal function to load the plugin and call the event function in the plugin.
135-
private function callPluginEvent($event_name, $data) {
159+
private function callPluginEvent($event_name, $data, $return_data = false) {
136160
global $app;
137161

162+
$result = '';
163+
138164
//* execute the functions for the events
139165
if(@is_array($_SESSION['s']['plugin_cache'][$event_name])) {
140166
foreach($_SESSION['s']['plugin_cache'][$event_name] as $rec) {
141167
$plugin_name = $rec['plugin'];
142168
$function_name = $rec['function'];
143-
$plugin_file = ISPC_LIB_PATH.FS_DIV.'plugins'.FS_DIV.$plugin_name.'.inc.php';
144-
169+
$module_name = $rec['module'];
170+
if($module_name != '') {
171+
if(strpos($module_name, '..') !== false || strpos($module_name, '/') !== false) {
172+
if($this->debug) $app->log('Module name ' . $module_name . ' contains illegal characters.', LOGLEVEL_DEBUG);
173+
continue;
174+
}
175+
$plugin_file = ISPC_WEB_PATH . FS_DIV . $module_name . FS_DIV . 'lib' . FS_DIV . 'plugin.d' . FS_DIV . $plugin_name . '.inc.php';
176+
} else {
177+
$plugin_file = ISPC_LIB_PATH . FS_DIV . 'plugins' . FS_DIV . $plugin_name . '.inc.php';
178+
}
145179

146180
if(is_file($plugin_file)) {
147181
if(!isset($app->loaded_plugins[$plugin_name])) {
@@ -152,12 +186,14 @@ private function callPluginEvent($event_name, $data) {
152186
if($this->debug) $app->log("Called method: '$function_name' in plugin '$plugin_name' for event '$event_name'", LOGLEVEL_DEBUG);
153187
// call_user_method($function_name,$app->loaded_plugins[$plugin_name],$event_name,$data);
154188

155-
call_user_func(array($app->loaded_plugins[$plugin_name], $function_name), $event_name, $data);
156-
189+
$tmpresult = call_user_func(array($app->loaded_plugins[$plugin_name], $function_name), $event_name, $data);
190+
if($return_data == true && $tmpresult) $result .= $tmpresult;
157191
}
158192
}
159193

160194
}
195+
196+
if($return_data == true) return $result;
161197

162198
} // end functiom callPluginEvent
163199

interface/lib/classes/plugin_backuplist.inc.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ function onShow() {
8585
$server_id = $this->form->dataRecord['server_id'];
8686
$backup = $app->db->queryOneRecord("SELECT * FROM web_backup WHERE backup_id = ?", $backup_id);
8787
if($backup['server_id'] > 0) $server_id = $backup['server_id'];
88-
$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_restore' AND action_param = '$backup_id'";
89-
$tmp = $app->db->queryOneRecord($sql);
88+
$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_restore' AND action_param = ?";
89+
$tmp = $app->db->queryOneRecord($sql, $backup_id);
9090
if($tmp['number'] == 0) {
9191
$message .= $wb['restore_info_txt'];
9292
$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
@@ -96,6 +96,21 @@ function onShow() {
9696
$error .= $wb['restore_pending_txt'];
9797
}
9898
}
99+
if($_GET['backup_action'] == 'delete' && $backup_id > 0) {
100+
$server_id = $this->form->dataRecord['server_id'];
101+
$backup = $app->db->queryOneRecord("SELECT * FROM web_backup WHERE backup_id = ?", $backup_id);
102+
if($backup['server_id'] > 0) $server_id = $backup['server_id'];
103+
$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_delete' AND action_param = ?";
104+
$tmp = $app->db->queryOneRecord($sql, $backup_id);
105+
if($tmp['number'] == 0) {
106+
$message .= $wb['delete_info_txt'];
107+
$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
108+
"VALUES (?, UNIX_TIMESTAMP(), 'backup_delete', ?, 'pending', '')";
109+
$app->db->query($sql, $server_id, $backup_id);
110+
} else {
111+
$error .= $wb['delete_pending_txt'];
112+
}
113+
}
99114

100115
}
101116

interface/lib/classes/plugin_backuplist_mail.inc.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,24 @@ function onShow() {
6262
if($tmp['number'] == 0) {
6363
$message .= $wb['restore_info_txt'];
6464
$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
65-
"VALUES (?, ? 'backup_restore_mail', ?, 'pending','')";
65+
"VALUES (?, ?, 'backup_restore_mail', ?, 'pending','')";
6666
$app->db->query($sql, $this->form->dataRecord['server_id'], time(), $backup_id);
6767
} else {
6868
$error .= $wb['restore_pending_txt'];
6969
}
70+
}
71+
72+
if($_GET['backup_action'] == 'delete_mail' && $backup_id > 0) {
73+
$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_delete_mail' AND action_param = '$backup_id'";
74+
$tmp = $app->db->queryOneRecord($sql);
75+
if($tmp['number'] == 0) {
76+
$message .= $wb['delete_info_txt'];
77+
$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
78+
"VALUES (?, ?, 'backup_delete_mail, ?, 'pending', '')";
79+
$app->db->query($sql, $this->form->dataRecord['server_id'], time(), $backup_id);
80+
} else {
81+
$error .= $wb['delete_pending_txt'];
82+
}
7083
}
7184
}
7285

interface/lib/classes/remote.d/mail.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ public function mail_user_backup($session_id, $primary_id, $action_type)
357357
return false;
358358
}
359359

360-
if (/*$action_type != 'backup_download_mail' and*/ $action_type != 'backup_restore_mail') {
360+
if (/*$action_type != 'backup_download_mail' and*/ $action_type != 'backup_restore_mail' and $action_type != 'backup_delete_mail') {
361361
$this->server->fault('invalid_action', "Invalid action_type $action_type");
362362
return false;
363363
}

interface/lib/classes/remote.d/sites.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ public function sites_web_domain_backup($session_id, $primary_id, $action_type)
931931
return false;
932932
}
933933

934-
if ($action_type != 'backup_download' and $action_type != 'backup_restore') {
934+
if ($action_type != 'backup_download' and $action_type != 'backup_restore' and $action_type != 'backup_delete') {
935935
$this->server->fault('invalid_action', "Invalid action_type $action_type");
936936
return false;
937937
}

interface/lib/classes/tform_actions.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function onLoad() {
4646
$app->tpl->newTemplate("tabbed_form.tpl.htm");
4747

4848
// Load table definition from file
49-
$app->tform->loadFormDef($tform_def_file);
49+
$app->tform->loadFormDef($tform_def_file, (isset($_SESSION['s']['module']['name']) ? $_SESSION['s']['module']['name'] : ''));
5050

5151
// Importing ID
5252
$this->id = (isset($_REQUEST["id"]))?$app->functions->intval($_REQUEST["id"]):0;
@@ -594,7 +594,7 @@ function loadPlugins($next_tab) {
594594
$app->load($plugin_class);
595595
$this->plugins[$plugin_name] = new $plugin_class;
596596
$this->plugins[$plugin_name]->setOptions($plugin_name, $plugin_settings['options']);
597-
// Make the data of the form easily accessible for the plugib
597+
// Make the data of the form easily accessible for the plugin
598598
$this->plugins[$plugin_name]->form = $this;
599599
$this->plugins[$plugin_name]->onLoad();
600600
}

0 commit comments

Comments
 (0)