Commit 10b4c85a authored by tbrehm's avatar tbrehm

Merged revisons 3687-3748 from 3.0.5 stable branch.

parent 3ee39be0
......@@ -941,6 +941,11 @@ class installer_dist extends installer_base {
} else {
$content = str_replace('{ssl_comment}', '#', $content);
}
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key') && is_file($install_dir.'/interface/ssl/ispserver.bundle')) {
$content = str_replace('{ssl_bundle_comment}', '', $content);
} else {
$content = str_replace('{ssl_bundle_comment}', '#', $content);
}
wf("$vhost_conf_dir/ispconfig.vhost", $content);
......@@ -972,11 +977,11 @@ class installer_dist extends installer_base {
$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
$content = str_replace('{ssl_on}', ' ssl', $content);
$content = str_replace('{ssl_on}', ' on', $content);
$content = str_replace('{ssl_comment}', '', $content);
$content = str_replace('{fastcgi_ssl}', 'on', $content);
} else {
$content = str_replace('{ssl_on}', '', $content);
$content = str_replace('{ssl_on}', ' off', $content);
$content = str_replace('{ssl_comment}', '#', $content);
$content = str_replace('{fastcgi_ssl}', 'off', $content);
}
......
......@@ -929,6 +929,11 @@ class installer extends installer_base
} else {
$content = str_replace('{ssl_comment}', '#', $content);
}
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key') && is_file($install_dir.'/interface/ssl/ispserver.bundle')) {
$content = str_replace('{ssl_bundle_comment}', '', $content);
} else {
$content = str_replace('{ssl_bundle_comment}', '#', $content);
}
$vhost_path = $conf['apache']['vhost_conf_dir'].'/ispconfig.vhost';
$this->write_config_file($vhost_path, $content);
......@@ -954,11 +959,11 @@ class installer extends installer_base
$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
$content = str_replace('{ssl_on}', ' ssl', $content);
$content = str_replace('{ssl_on}', ' on', $content);
$content = str_replace('{ssl_comment}', '', $content);
$content = str_replace('{fastcgi_ssl}', 'on', $content);
} else {
$content = str_replace('{ssl_on}', '', $content);
$content = str_replace('{ssl_on}', ' off', $content);
$content = str_replace('{ssl_comment}', '#', $content);
$content = str_replace('{fastcgi_ssl}', 'off', $content);
}
......
......@@ -977,6 +977,11 @@ class installer_dist extends installer_base {
} else {
$content = str_replace('{ssl_comment}', '#', $content);
}
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key') && is_file($install_dir.'/interface/ssl/ispserver.bundle')) {
$content = str_replace('{ssl_bundle_comment}', '', $content);
} else {
$content = str_replace('{ssl_bundle_comment}', '#', $content);
}
$content = str_replace('/var/www/', '/srv/www/', $content);
......@@ -1015,11 +1020,11 @@ class installer_dist extends installer_base {
$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
$content = str_replace('{ssl_on}', ' ssl', $content);
$content = str_replace('{ssl_on}', ' on', $content);
$content = str_replace('{ssl_comment}', '', $content);
$content = str_replace('{fastcgi_ssl}', 'on', $content);
} else {
$content = str_replace('{ssl_on}', '', $content);
$content = str_replace('{ssl_on}', ' off', $content);
$content = str_replace('{ssl_comment}', '#', $content);
$content = str_replace('{fastcgi_ssl}', 'off', $content);
}
......
......@@ -1885,6 +1885,11 @@ class installer_base {
} else {
$content = str_replace('{ssl_comment}', '#', $content);
}
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key') && is_file($install_dir.'/interface/ssl/ispserver.bundle')) {
$content = str_replace('{ssl_bundle_comment}', '', $content);
} else {
$content = str_replace('{ssl_bundle_comment}', '#', $content);
}
wf($vhost_conf_dir.'/ispconfig.vhost', $content);
......
ALTER TABLE `web_database` ADD `database_name_prefix` VARCHAR( 50 ) NOT NULL AFTER `database_name`;
UPDATE `web_database` SET `database_name_prefix` = '#' WHERE 1;
ALTER TABLE `web_database_user` ADD `database_user_prefix` VARCHAR( 50 ) NOT NULL AFTER `database_user`;
UPDATE `web_database_user` SET `database_user_prefix` = '#' WHERE 1;
ALTER TABLE `ftp_user` ADD `username_prefix` VARCHAR( 50 ) NOT NULL AFTER `username`;
UPDATE `ftp_user` SET `username_prefix` = '#' WHERE 1;
ALTER TABLE `shell_user` ADD `username_prefix` VARCHAR( 50 ) NOT NULL AFTER `username`;
UPDATE `shell_user` SET `username_prefix` = '#' WHERE 1;
ALTER TABLE `webdav_user` ADD `username_prefix` VARCHAR( 50 ) NOT NULL AFTER `username`;
UPDATE `webdav_user` SET `username_prefix` = '#' WHERE 1;
\ No newline at end of file
......@@ -526,6 +526,7 @@ CREATE TABLE `ftp_user` (
`server_id` int(11) unsigned NOT NULL default '0',
`parent_domain_id` int(11) unsigned NOT NULL default '0',
`username` varchar(64) default NULL,
`username_prefix` varchar(50) NOT NULL default '',
`password` varchar(64) default NULL,
`quota_size` bigint(20) NOT NULL default '-1',
`active` enum('n','y') NOT NULL default 'y',
......@@ -1179,6 +1180,7 @@ CREATE TABLE `shell_user` (
`server_id` int(11) unsigned NOT NULL default '0',
`parent_domain_id` int(11) unsigned NOT NULL default '0',
`username` varchar(64) default NULL,
`username_prefix` varchar(50) NOT NULL default '',
`password` varchar(64) default NULL,
`quota_size` bigint(20) NOT NULL default '-1',
`active` enum('n','y') NOT NULL default 'y',
......@@ -1608,6 +1610,7 @@ CREATE TABLE `webdav_user` (
`server_id` int(11) unsigned NOT NULL DEFAULT '0',
`parent_domain_id` int(11) unsigned NOT NULL DEFAULT '0',
`username` varchar(64) DEFAULT NULL,
`username_prefix` varchar(50) NOT NULL default '',
`password` varchar(64) DEFAULT NULL,
`active` enum('n','y') NOT NULL DEFAULT 'y',
`dir` varchar(255) DEFAULT NULL,
......@@ -1648,6 +1651,7 @@ CREATE TABLE `web_database` (
`parent_domain_id` int(11) unsigned NOT NULL DEFAULT '0',
`type` varchar(16) NOT NULL DEFAULT 'y',
`database_name` varchar(64) DEFAULT NULL,
`database_name_prefix` varchar(50) NOT NULL default '',
`database_user_id` int(11) unsigned DEFAULT NULL,
`database_ro_user_id` int(11) unsigned DEFAULT NULL,
`database_charset` varchar(64) DEFAULT NULL,
......@@ -1676,6 +1680,7 @@ CREATE TABLE IF NOT EXISTS `web_database_user` (
`sys_perm_other` varchar(5) DEFAULT NULL,
`server_id` int(11) UNSIGNED NOT NULL DEFAULT '0',
`database_user` varchar(64) DEFAULT NULL,
`database_user_prefix` varchar(50) NOT NULL default '',
`database_password` varchar(64) DEFAULT NULL,
PRIMARY KEY (`database_user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
......
......@@ -25,6 +25,7 @@ NameVirtualHost *:{vhost_port}
Order allow,deny
Allow from all
</Directory>
IPCCommTimeout 7200
</IfModule>
# <IfModule mod_php5.c>
......@@ -52,6 +53,7 @@ NameVirtualHost *:{vhost_port}
{ssl_comment}SSLEngine On
{ssl_comment}SSLCertificateFile /usr/local/ispconfig/interface/ssl/ispserver.crt
{ssl_comment}SSLCertificateKeyFile /usr/local/ispconfig/interface/ssl/ispserver.key
{ssl_bundle_comment}SSLCACertificateFile /usr/local/ispconfig/interface/ssl/ispserver.bundle
</VirtualHost>
......
......@@ -44,7 +44,6 @@ website_basedir=/var/www
website_path=/var/www/clients/client[client_id]/web[website_id]
website_symlinks=/var/www/[website_domain]/:/var/www/clients/client[client_id]/[website_domain]/
website_symlinks_rel=n
vhost_rewrite_v6=n
vhost_conf_dir=/etc/apache2/sites-available
vhost_conf_enabled_dir=/etc/apache2/sites-enabled
nginx_vhost_conf_dir=/etc/nginx/sites-available
......
......@@ -22,6 +22,7 @@ webdavuser_prefix=[CLIENTNAME]
dblist_phpmyadmin_link=y
phpmyadmin_url=/phpmyadmin
webftp_url=
client_username_web_check_disabled=n
[tools]
......@@ -34,4 +35,8 @@ dashboard_atom_url_admin=http://www.ispconfig.org/atom
dashboard_atom_url_reseller=http://www.ispconfig.org/atom
dashboard_atom_url_client=http://www.ispconfig.org/atom
monitor_key=
tab_change_discard=n
tab_change_warning=n
use_loadindicator=y
use_combobox=y
maintenance_mode=n
......@@ -285,7 +285,7 @@ class ApsGUIController extends ApsBase
}
//* Find a free db username for the app
for($n = 1; $n <= 1000; $n++) {
$mysql_db_user = ($dbname_prefix != '' ? $dbname_prefix.'aps'.$n : uniqid('aps'));
$mysql_db_user = ($dbuser_prefix != '' ? $dbuser_prefix.'aps'.$n : uniqid('aps'));
$tmp = $app->db->queryOneRecord("SELECT count(database_user_id) as number FROM web_database_user WHERE database_user = '".$app->db->quote($mysql_db_user)."'");
if($tmp['number'] == 0) break;
}
......@@ -293,13 +293,13 @@ class ApsGUIController extends ApsBase
$mysql_db_password = $settings['main_database_password'];
//* Create the mysql database user
$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `database_user`, `database_password`)
VALUES( ".$websrv['sys_userid'].", ".$websrv['sys_groupid'].", 'riud', '".$websrv['sys_perm_group']."', '', 0, '$mysql_db_user', PASSWORD('$mysql_db_password'))";
$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `database_user`, `database_user_prefix`, `database_password`)
VALUES( ".$websrv['sys_userid'].", ".$websrv['sys_groupid'].", 'riud', '".$websrv['sys_perm_group']."', '', 0, '$mysql_db_user', '".$app->db->quote($dbuser_prefix) . "', PASSWORD('$mysql_db_password'))";
$mysql_db_user_id = $app->db->datalogInsert('web_database_user', $insert_data, 'database_user_id');
//* Create the mysql database
$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `parent_domain_id`, `type`, `database_name`, `database_user_id`, `database_ro_user_id`, `database_charset`, `remote_access`, `remote_ips`, `backup_copies`, `active`, `backup_interval`)
VALUES( ".$websrv['sys_userid'].", ".$websrv['sys_groupid'].", 'riud', '".$websrv['sys_perm_group']."', '', $mysql_db_server_id, ".$websrv['domain_id'].", 'mysql', '$mysql_db_name', '$mysql_db_user_id', 0, '', '$mysql_db_remote_access', '$mysql_db_remote_ips', ".$websrv['backup_copies'].", 'y', '".$websrv['backup_interval']."')";
$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `parent_domain_id`, `type`, `database_name`, `database_name_prefix`, `database_user_id`, `database_ro_user_id`, `database_charset`, `remote_access`, `remote_ips`, `backup_copies`, `active`, `backup_interval`)
VALUES( ".$websrv['sys_userid'].", ".$websrv['sys_groupid'].", 'riud', '".$websrv['sys_perm_group']."', '', $mysql_db_server_id, ".$websrv['domain_id'].", 'mysql', '$mysql_db_name', '" . $app->db->quote($dbname_prefix) . "', '$mysql_db_user_id', 0, '', '$mysql_db_remote_access', '$mysql_db_remote_ips', ".$websrv['backup_copies'].", 'y', '".$websrv['backup_interval']."')";
$app->db->datalogInsert('web_database', $insert_data, 'database_id');
//* Add db details to package settings
......@@ -542,7 +542,7 @@ class ApsGUIController extends ApsBase
// is not empty for further validation
if(!empty($doc_root))
{
$used_path = $docroot['document_root'];
$used_path = $doc_root['document_root'];
if(substr($used_path, -1) != '/') $used_path .= '/';
$location_for_domain = $app->db->queryOneRecord("SELECT value
......@@ -550,7 +550,7 @@ class ApsGUIController extends ApsBase
AND instance_id = '".$app->db->quote($instance_domains[$i]['instance_id'])."';");
// The location might be empty but the DB return must not be false!
if($location_for_domain) $used_path .= $location_for_domain['value'];
if($location_for_domain) $used_path .= $location_for_domain['value'];
if($new_path == $used_path)
{
......
......@@ -303,7 +303,7 @@ class functions {
}
public function intval($string, $force_numeric = false) {
if(intval($string) == 2147483647) {
if(intval($string) == 2147483647 || ($string > 0 && intval($string) < 0)) {
if($force_numeric == true) return floatval($string);
elseif(preg_match('/^([-]?)[0]*([1-9][0-9]*)([^0-9].*)*$/', $string, $match)) return $match[1].$match[2];
else return 0;
......
......@@ -142,7 +142,8 @@ class listform_actions {
if($_SESSION['s']['user']['typ'] == "admin") {
$sql_where = '';
} else {
$sql_where = $app->tform->getAuthSQL('r').' and';
$sql_where = $app->tform->getAuthSQL('r', $app->listform->listDef['table']).' and';
//$sql_where = $app->tform->getAuthSQL('r').' and';
}
}
if($this->SQLExtWhere != '') {
......
......@@ -244,6 +244,55 @@ class remoting {
return $affected_rows;
}
//* Get alias details
public function mail_aliasdomain_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'mail_aliasdomain_get')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../mail/form/mail_aliasdomain.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
}
//* aliasy email
public function mail_aliasdomain_add($session_id, $client_id, $params)
{
if (!$this->checkPerm($session_id, 'mail_aliasdomain_add'))
{
$this->server->fault('permission_denied','You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->insertQuery('../mail/form/mail_aliasdomain.tform.php', $client_id, $params);
return $affected_rows;
}
public function mail_aliasdomain_update($session_id, $client_id, $primary_id, $params)
{
if (!$this->checkPerm($session_id, 'mail_aliasdomain_update'))
{
$this->server->fault('permission_denied','You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->updateQuery('../mail/form/mail_aliasdomain.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
}
public function mail_aliasdomain_delete($session_id, $primary_id)
{
if (!$this->checkPerm($session_id, 'mail_aliasdomain_delete'))
{
$this->server->fault('permission_denied','You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../mail/form/mail_aliasdomain.tform.php', $primary_id);
return $affected_rows;
}
//* Get mail mailinglist details
public function mail_mailinglist_get($session_id, $primary_id)
{
......@@ -432,11 +481,21 @@ class remoting {
//* aliasy email
public function mail_alias_add($session_id, $client_id, $params)
{
global $app;
if (!$this->checkPerm($session_id, 'mail_alias_add'))
{
$this->server->fault('permission_denied','You do not have the permissions to access this function.');
return false;
}
//* Check if there is no active mailbox with this address
$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = '".$app->db->quote($params["source"])."'");
if($tmp['number'] > 0) {
$this->server->fault('duplicate','There is already a mailbox with this email address.');
}
unset($tmp);
$affected_rows = $this->insertQuery('../mail/form/mail_alias.tform.php', $client_id, $params);
return $affected_rows;
}
......@@ -444,13 +503,23 @@ class remoting {
public function mail_alias_update($session_id, $client_id, $primary_id, $params)
{
if (!$this->checkPerm($session_id, 'mail_alias_update'))
{
$this->server->fault('permission_denied','You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->updateQuery('../mail/form/mail_alias.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
global $app;
if (!$this->checkPerm($session_id, 'mail_alias_update'))
{
$this->server->fault('permission_denied','You do not have the permissions to access this function.');
return false;
}
//* Check if there is no active mailbox with this address
$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = '".$app->db->quote($params["source"])."'");
if($tmp['number'] > 0) {
$this->server->fault('duplicate','There is already a mailbox with this email address.');
}
unset($tmp);
$affected_rows = $this->updateQuery('../mail/form/mail_alias.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
}
public function mail_alias_delete($session_id, $primary_id)
......@@ -1363,23 +1432,56 @@ class remoting {
//* Update a record
public function sites_database_user_update($session_id, $client_id, $primary_id, $params)
{
global $app;
if(!$this->checkPerm($session_id, 'sites_database_user_update')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../sites/form/database_user.tform.php');
$old_rec = $app->remoting_lib->getDataRecord($primary_id);
$result = $this->updateQuery('../sites/form/database_user.tform.php', $client_id, $primary_id, $params);
$new_rec = $app->remoting_lib->getDataRecord($primary_id);
$records = $app->db->queryAllRecords("SELECT DISTINCT server_id FROM web_database WHERE database_user_id = '".$app->functions->intval($primary_id)."' UNION SELECT DISTINCT server_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($primary_id)."'");
foreach($records as $rec) {
$tmp_rec = $new_rec;
$tmp_rec['server_id'] = $rec['server_id'];
$app->remoting_lib->datalogSave('UPDATE', $primary_id, $old_rec, $tmp_rec);
}
unset($new_rec);
unset($old_rec);
unset($records);
return $this->updateQuery('../sites/form/database_user.tform.php', $client_id, $primary_id, $params);