From 738c3d47f74d8a117175452aac2cd662b0e3b95b Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Mon, 10 Feb 2014 09:14:49 -0500
Subject: [PATCH] Merge remote-tracking branch 'origin/stable-3.0.5'
---
interface/web/admin/lib/lang/en_system_config.lng | 1
server/scripts/update_from_svn.sh | 8 --
install/dist/lib/fedora.lib.php | 8 +-
install/lib/update.lib.php | 4
server/scripts/update_from_dev.sh | 11 +++
install/dist/lib/gentoo.lib.php | 12 ++--
install/dist/lib/opensuse.lib.php | 8 +-
interface/web/admin/lib/lang/de_system_config.lng | 1
server/scripts/ispconfig_update.php | 4
interface/web/admin/templates/system_config_mail_edit.htm | 6 +-
interface/web/client/domain_edit.php | 58 ++++++++++++++++--
interface/web/admin/form/system_config.tform.php | 6 +-
install/lib/installer_base.lib.php | 8 +-
install/lib/install.lib.php | 37 ------------
interface/web/client/templates/domain_edit.htm | 2
interface/web/sites/shell_user_edit.php | 4 +
16 files changed, 96 insertions(+), 82 deletions(-)
diff --git a/install/dist/lib/fedora.lib.php b/install/dist/lib/fedora.lib.php
index f5c04ad..2d3cc30 100644
--- a/install/dist/lib/fedora.lib.php
+++ b/install/dist/lib/fedora.lib.php
@@ -1167,14 +1167,14 @@
//exec('chmod +r /var/log/clamav/freshclam.log');
//* Install the update script
- if(is_file('/usr/local/bin/ispconfig_update_from_svn.sh')) unlink('/usr/local/bin/ispconfig_update_from_svn.sh');
- exec('chown root /usr/local/ispconfig/server/scripts/update_from_svn.sh');
- exec('chmod 700 /usr/local/ispconfig/server/scripts/update_from_svn.sh');
+ if(is_file('/usr/local/bin/ispconfig_update_from_dev.sh')) unlink('/usr/local/bin/ispconfig_update_from_dev.sh');
+ exec('chown root /usr/local/ispconfig/server/scripts/update_from_dev.sh');
+ exec('chmod 700 /usr/local/ispconfig/server/scripts/update_from_dev.sh');
exec('chown root /usr/local/ispconfig/server/scripts/update_from_tgz.sh');
exec('chmod 700 /usr/local/ispconfig/server/scripts/update_from_tgz.sh');
exec('chown root /usr/local/ispconfig/server/scripts/ispconfig_update.sh');
exec('chmod 700 /usr/local/ispconfig/server/scripts/ispconfig_update.sh');
- if(!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update_from_svn.sh');
+ if(!is_link('/usr/local/bin/ispconfig_update_from_dev.sh')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update_from_dev.sh');
if(!is_link('/usr/local/bin/ispconfig_update.sh')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update.sh');
// set the fast cgi starter script to executable
diff --git a/install/dist/lib/gentoo.lib.php b/install/dist/lib/gentoo.lib.php
index 40f552c..3ee3939 100644
--- a/install/dist/lib/gentoo.lib.php
+++ b/install/dist/lib/gentoo.lib.php
@@ -1014,19 +1014,19 @@
}
//* Install the update script
- if (is_file('/usr/local/bin/ispconfig_update_from_svn.sh')) {
- unlink('/usr/local/bin/ispconfig_update_from_svn.sh');
+ if (is_file('/usr/local/bin/ispconfig_update_from_dev.sh')) {
+ unlink('/usr/local/bin/ispconfig_update_from_dev.sh');
}
- chown($install_dir.'/server/scripts/update_from_svn.sh', 'root');
- chmod($install_dir.'/server/scripts/update_from_svn.sh', 0700);
+ chown($install_dir.'/server/scripts/update_from_dev.sh', 'root');
+ chmod($install_dir.'/server/scripts/update_from_dev.sh', 0700);
chown($install_dir.'/server/scripts/update_from_tgz.sh', 'root');
chmod($install_dir.'/server/scripts/update_from_tgz.sh', 0700);
chown($install_dir.'/server/scripts/ispconfig_update.sh', 'root');
chmod($install_dir.'/server/scripts/ispconfig_update.sh', 0700);
- if (!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) {
- symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update_from_svn.sh');
+ if (!is_link('/usr/local/bin/ispconfig_update_from_dev.sh')) {
+ symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update_from_dev.sh');
}
if (!is_link('/usr/local/bin/ispconfig_update.sh')) {
diff --git a/install/dist/lib/opensuse.lib.php b/install/dist/lib/opensuse.lib.php
index 1c47271..7d97977 100644
--- a/install/dist/lib/opensuse.lib.php
+++ b/install/dist/lib/opensuse.lib.php
@@ -1218,14 +1218,14 @@
//exec('chmod +r /var/log/clamav/freshclam.log');
//* Install the update script
- if(is_file('/usr/local/bin/ispconfig_update_from_svn.sh')) unlink('/usr/local/bin/ispconfig_update_from_svn.sh');
- exec('chown root /usr/local/ispconfig/server/scripts/update_from_svn.sh');
- exec('chmod 700 /usr/local/ispconfig/server/scripts/update_from_svn.sh');
+ if(is_file('/usr/local/bin/ispconfig_update_from_dev.sh')) unlink('/usr/local/bin/ispconfig_update_from_dev.sh');
+ exec('chown root /usr/local/ispconfig/server/scripts/update_from_dev.sh');
+ exec('chmod 700 /usr/local/ispconfig/server/scripts/update_from_dev.sh');
exec('chown root /usr/local/ispconfig/server/scripts/update_from_tgz.sh');
exec('chmod 700 /usr/local/ispconfig/server/scripts/update_from_tgz.sh');
exec('chown root /usr/local/ispconfig/server/scripts/ispconfig_update.sh');
exec('chmod 700 /usr/local/ispconfig/server/scripts/ispconfig_update.sh');
- if(!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update_from_svn.sh');
+ if(!is_link('/usr/local/bin/ispconfig_update_from_dev.sh')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update_from_dev.sh');
if(!is_link('/usr/local/bin/ispconfig_update.sh')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update.sh');
//set the fast cgi starter script to executable
diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php
index 501cf3b..4d5fe87 100644
--- a/install/lib/install.lib.php
+++ b/install/lib/install.lib.php
@@ -693,43 +693,6 @@
}
/*
- * Compare ISPConfig version number.
- * return values:
- * -1 $current version is newer then $new version (downgrade)
- * 0 $current version = $new version
- * 1 $current version is older then new version (update)
-
-*/
-function compare_ispconfig_version($current, $new) {
- if( $current == $new) {
- return 0;
- }
-
- $p = explode('.', $current);
- $tmp = '';
- $tmp .= str_pad(intval($p[0]), 3, '0', STR_PAD_LEFT);
- $tmp .= (isset($p[1]))?str_pad(intval($p[1]), 3, '0', STR_PAD_LEFT):'000';
- $tmp .= (isset($p[2]))?str_pad(intval($p[2]), 3, '0', STR_PAD_LEFT):'000';
- $tmp .= (isset($p[3]))?str_pad(intval($p[3]), 3, '0', STR_PAD_LEFT):'000';
- $current = $tmp;
-
- $p = explode('.', $new);
- $tmp = '';
- $tmp .= str_pad(intval($p[0]), 3, '0', STR_PAD_LEFT);
- $tmp .= (isset($p[1]))?str_pad(intval($p[1]), 3, '0', STR_PAD_LEFT):'000';
- $tmp .= (isset($p[2]))?str_pad(intval($p[2]), 3, '0', STR_PAD_LEFT):'000';
- $tmp .= (isset($p[3]))?str_pad(intval($p[3]), 3, '0', STR_PAD_LEFT):'000';
- $new = $tmp;
-
- if($new > $current) {
- return 1;
- } else {
- return -1;
- }
-
-}
-
-/*
* Get the port number of the ISPConfig controlpanel vhost
*/
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 61a1fba..065df30 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -2035,14 +2035,14 @@
}
//* Install the update script
- if(is_file('/usr/local/bin/ispconfig_update_from_svn.sh')) unlink('/usr/local/bin/ispconfig_update_from_svn.sh');
- chown($install_dir.'/server/scripts/update_from_svn.sh', 'root');
- chmod($install_dir.'/server/scripts/update_from_svn.sh', 0700);
+ if(is_file('/usr/local/bin/ispconfig_update_from_dev.sh')) unlink('/usr/local/bin/ispconfig_update_from_dev.sh');
+ chown($install_dir.'/server/scripts/update_from_dev.sh', 'root');
+ chmod($install_dir.'/server/scripts/update_from_dev.sh', 0700);
chown($install_dir.'/server/scripts/update_from_tgz.sh', 'root');
chmod($install_dir.'/server/scripts/update_from_tgz.sh', 0700);
chown($install_dir.'/server/scripts/ispconfig_update.sh', 'root');
chmod($install_dir.'/server/scripts/ispconfig_update.sh', 0700);
- if(!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update_from_svn.sh');
+ if(!is_link('/usr/local/bin/ispconfig_update_from_dev.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update_from_dev.sh');
if(!is_link('/usr/local/bin/ispconfig_update.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update.sh');
//* Make the logs readable for the ispconfig user
diff --git a/install/lib/update.lib.php b/install/lib/update.lib.php
index 61f400b..678faf9 100644
--- a/install/lib/update.lib.php
+++ b/install/lib/update.lib.php
@@ -153,8 +153,8 @@
$conf['nginx']['installed'] = false;
}
- //* Do incremental DB updates only on installed ISPConfig versions > 3.0.3
- if(compare_ispconfig_version('3.0.3', ISPC_APP_VERSION) >= 0) {
+ //* Do incremental DB updates only on installed ISPConfig versions >= 3.0.3
+ if(version_compare('3.0.3', ISPC_APP_VERSION, '<=')) {
swriteln($inst->lng('Starting incremental database update.'));
diff --git a/interface/web/admin/form/system_config.tform.php b/interface/web/admin/form/system_config.tform.php
index eaa0f6f..889e6d5 100644
--- a/interface/web/admin/form/system_config.tform.php
+++ b/interface/web/admin/form/system_config.tform.php
@@ -317,9 +317,9 @@
),
'smtp_crypt' => array (
'datatype' => 'VARCHAR',
- 'formtype' => 'CHECKBOX',
- 'default' => 'n',
- 'value' => array(0 => 'n', 1 => 'y')
+ 'formtype' => 'SELECT',
+ 'default' => '',
+ 'value' => array('' => 'No', 'ssl' => 'SSL', 'tls' => 'STARTTLS')
),
//#################################
// ENDE Datatable fields
diff --git a/interface/web/admin/lib/lang/de_system_config.lng b/interface/web/admin/lib/lang/de_system_config.lng
index 5349ade..29d0cf7 100644
--- a/interface/web/admin/lib/lang/de_system_config.lng
+++ b/interface/web/admin/lib/lang/de_system_config.lng
@@ -68,4 +68,5 @@
$wb['customer_no_counter_txt'] = 'Kundennummer Zähler';
$wb['session_timeout_txt'] = 'Session-Timeout (Minuten)';
$wb['session_allow_endless_txt'] = '"Eingeloggt bleiben" aktivieren';
+$wb['No'] = 'Nein';
?>
diff --git a/interface/web/admin/lib/lang/en_system_config.lng b/interface/web/admin/lib/lang/en_system_config.lng
index 1c045cf..e1e11fc 100644
--- a/interface/web/admin/lib/lang/en_system_config.lng
+++ b/interface/web/admin/lib/lang/en_system_config.lng
@@ -70,4 +70,5 @@
$wb['customer_no_counter_txt'] = 'Customer No. counter';
$wb['session_timeout_txt'] = 'Session timeout (minutes)';
$wb['session_allow_endless_txt'] = 'Enable "stay logged in"';
+$wb['No'] = 'No';
?>
diff --git a/interface/web/admin/templates/system_config_mail_edit.htm b/interface/web/admin/templates/system_config_mail_edit.htm
index e9c0c0e..8697e72 100644
--- a/interface/web/admin/templates/system_config_mail_edit.htm
+++ b/interface/web/admin/templates/system_config_mail_edit.htm
@@ -80,10 +80,10 @@
<input name="smtp_pass" id="smtp_pass" value="" size="30" maxlength="255" type="password" class="textInput" />
</div>
<div class="ctrlHolder">
- <p class="label">{tmpl_var name='smtp_crypt_txt'}</p>
- <div class="multiField">
+ <label for="smtp_crypt">{tmpl_var name='smtp_crypt_txt'}</label>
+ <select name="smtp_crypt" id="smtp_crypt" class="selectInput formLengthHalf">
{tmpl_var name='smtp_crypt'}
- </div>
+ </select>
</div>
</fieldset>
diff --git a/interface/web/client/domain_edit.php b/interface/web/client/domain_edit.php
index 07929f9..7b24e46 100644
--- a/interface/web/client/domain_edit.php
+++ b/interface/web/client/domain_edit.php
@@ -52,14 +52,6 @@
$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'.lng';
include $lng_file;
-if(!$app->tform->checkClientLimit('limit_domainmodule')) {
- $app->uses('ini_parser,getconf');
- $settings = $app->getconf->get_global_config('domains');
- if ($settings['use_domain_module'] == 'y') {
- $app->error($settings['new_domain_html']);
- }
-}
-
class page_action extends tform_actions {
@@ -75,6 +67,16 @@
function onShowEnd() {
global $app, $conf, $wb;
+
+ if($_SESSION["s"]["user"]["typ"] != 'admin' && $this->id == 0) {
+ if(!$app->tform->checkClientLimit('limit_domainmodule')) {
+ $app->uses('ini_parser,getconf');
+ $settings = $app->getconf->get_global_config('domains');
+ if ($settings['use_domain_module'] == 'y') {
+ $app->error($settings['new_domain_html']);
+ }
+ }
+ }
if($_SESSION["s"]["user"]["typ"] == 'admin') {
// Getting Clients of the user
@@ -92,6 +94,28 @@
}
$app->tpl->setVar("client_group_id", $client_select);
+ } else {
+ // Get the limits of the client
+ $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
+ $client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+ // Fill the client select field
+ $sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
+ //die($sql);
+ $records = $app->db->queryAllRecords($sql);
+ $tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$app->functions->intval($client['client_id']));
+ $client_select = '<option value="'.$tmp['groupid'].'">'.$client['contactname'].'</option>';
+ //$tmp_data_record = $app->tform->getDataRecord($this->id);
+ if(is_array($records)) {
+ $selected_client_group_id = 0; // needed to get list of PHP versions
+ foreach( $records as $rec) {
+ if(is_array($this->dataRecord) && ($rec["groupid"] == $this->dataRecord['client_group_id'] || $rec["groupid"] == $this->dataRecord['sys_groupid']) && !$selected_client_group_id) $selected_client_group_id = $rec["groupid"];
+ $selected = @(is_array($this->dataRecord) && ($rec["groupid"] == $this->dataRecord['client_group_id'] || $rec["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
+ if($selected == 'SELECTED') $selected_client_group_id = $rec["groupid"];
+ $client_select .= "<option value='$rec[groupid]' $selected>$rec[contactname]</option>\r\n";
+ }
+ }
+ $app->tpl->setVar("client_group_id", $client_select);
}
if($this->id > 0) {
@@ -127,6 +151,24 @@
*/
$this->dataRecord = $app->tform->getDataRecord($this->id);
}
+ } elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+ if ($this->id == 0) {
+ /*
+ * We create a new record
+ */
+ // Check if the user is empty
+ if(isset($this->dataRecord['client_group_id']) && $this->dataRecord['client_group_id'] == 0) {
+ $app->tform->errorMessage .= $wb['error_client_group_id_empty'];
+ }
+ //* make sure that the domain is lowercase
+ if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
+ }
+ else {
+ /*
+ * We edit a existing one, but there is nothing to edit
+ */
+ $this->dataRecord = $app->tform->getDataRecord($this->id);
+ }
} else {
if($this->id > 0) {
/*
diff --git a/interface/web/client/templates/domain_edit.htm b/interface/web/client/templates/domain_edit.htm
index 03f3aaf..aaafa6e 100644
--- a/interface/web/client/templates/domain_edit.htm
+++ b/interface/web/client/templates/domain_edit.htm
@@ -12,7 +12,6 @@
<input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" />
</tmpl_if>
</div>
- <tmpl_if name="is_admin">
<div class="ctrlHolder">
<label for="client_group_id">{tmpl_var name='client_txt'}</label>
<tmpl_if name="edit_disabled">
@@ -25,7 +24,6 @@
</select>
</tmpl_if>
</div>
- </tmpl_if>
</fieldset>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
diff --git a/interface/web/sites/shell_user_edit.php b/interface/web/sites/shell_user_edit.php
index 9a8f266..5a54b33 100644
--- a/interface/web/sites/shell_user_edit.php
+++ b/interface/web/sites/shell_user_edit.php
@@ -158,6 +158,7 @@
global $app, $conf;
$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
+
$server_id = $app->functions->intval($web["server_id"]);
$dir = $app->db->quote($web["document_root"]);
$uid = $app->db->quote($web["system_user"]);
@@ -166,8 +167,9 @@
// The FTP user shall be owned by the same group then the website
$sys_groupid = $app->functions->intval($web['sys_groupid']);
- $sql = "UPDATE shell_user SET server_id = $server_id, dir = '$dir', puser = '$puser', pgroup = '$pgroup', sys_groupid = '$sys_groupid' WHERE shell_user_id = ".$this->id;
+ $sql = "UPDATE shell_user SET server_id = $server_id, dir = '$dir', puser = '$uid', pgroup = '$gid', sys_groupid = '$sys_groupid' WHERE shell_user_id = ".$this->id;
$app->db->query($sql);
+ die($sql);
}
diff --git a/server/scripts/ispconfig_update.php b/server/scripts/ispconfig_update.php
index 6843e7b..1001f4f 100644
--- a/server/scripts/ispconfig_update.php
+++ b/server/scripts/ispconfig_update.php
@@ -93,14 +93,14 @@
if($method == 'stable') {
$new_version = @file_get_contents('http://www.ispconfig.org/downloads/ispconfig3_version.txt') or die('Unable to retrieve version file.');
$new_version = trim($new_version);
- if($new_version != ISPC_APP_VERSION) {
+ if(version_compare($new_version, ISPC_APP_VERSION, '>') {
passthru('/usr/local/ispconfig/server/scripts/update_from_tgz.sh');
exit;
} else {
echo "There are no updates available for ISPConfig ".ISPC_APP_VERSION."\n";
}
} else {
- passthru('/usr/local/ispconfig/server/scripts/update_from_svn.sh');
+ passthru('/usr/local/ispconfig/server/scripts/update_from_dev.sh');
exit;
}
diff --git a/server/scripts/update_from_dev.sh b/server/scripts/update_from_dev.sh
new file mode 100644
index 0000000..de93fd9
--- /dev/null
+++ b/server/scripts/update_from_dev.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+cd /tmp
+wget -O ispconfig3-dev.tar.gz "http://git.ispconfig.org/ispconfig/ispconfig3/repository/archive.tar.gz?ref=master"
+tar xzf ispconfig3-dev.tar.gz
+cd ispconfig3.git/install
+php -q update.php
+cd /tmp
+rm -rf /tmp/ispconfig3.git /tmp/ispconfig3-dev.tar.gz
+
+exit 0
\ No newline at end of file
diff --git a/server/scripts/update_from_svn.sh b/server/scripts/update_from_svn.sh
index d8ed236..8c8ee2a 100644
--- a/server/scripts/update_from_svn.sh
+++ b/server/scripts/update_from_svn.sh
@@ -1,10 +1,6 @@
#!/bin/bash
-cd /tmp
-svn export svn://svn.ispconfig.org/ispconfig3/trunk/
-cd trunk/install
-php -q update.php
-cd /tmp
-rm -rf /tmp/trunk
+CUR=`dirname $0`
+bash ${CUR}/update_from_dev.sh
exit 0
\ No newline at end of file
--
Gitblit v1.9.1