Skip to content

Commit f382f09

Browse files
author
Marius Cramer
committed
Merge remote-tracking branch 'ispc/master'
2 parents f163408 + 8abd175 commit f382f09

File tree

265 files changed

+3040
-1996
lines changed

Some content is hidden

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

265 files changed

+3040
-1996
lines changed

docs/Remote_API_docs.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22

3-
The remote API documentation is in the remote_client/API-docs subfolder.
3+
The remote API documentation is in the remoting_client/API-docs subfolder.

install/lib/installer_base.lib.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,13 @@ public function grant_master_database_rights($verbose = false) {
498498
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
499499
}
500500

501+
$query = "GRANT SELECT, INSERT, DELETE ON ".$value['db'].".`mail_backup` TO '".$value['user']."'@'".$host."' ";
502+
if ($verbose){
503+
echo $query ."\n";
504+
}
505+
if(!$this->dbmaster->query($query)) {
506+
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
507+
}
501508
}
502509

503510
/*

install/lib/update.lib.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,15 @@ function updateDbAndIni() {
160160

161161
//* get the version of the db schema from the server table
162162
$found = true;
163+
$dev_patch = false;
163164
while($found == true) {
164-
$next_db_version = intval($current_db_version + 1);
165+
if($dev_patch == true) $next_db_version = 'dev_collection';
166+
else $next_db_version = intval($current_db_version + 1);
165167
$sql_patch_filename = realpath(dirname(__FILE__).'/../').'/sql/incremental/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.sql';
166168
$php_patch_filename = realpath(dirname(__FILE__).'/../').'/patches/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.php';
167169

168170
// comma separated list of version numbers were a update has to be done silently
169-
$silent_update_versions = '75';
171+
$silent_update_versions = 'dev_collection,75';
170172

171173
if(is_file($sql_patch_filename)) {
172174

@@ -204,8 +206,12 @@ function updateDbAndIni() {
204206
$php_patch->onAfterSQL();
205207
}
206208

207-
$current_db_version = $next_db_version;
209+
if($dev_patch == false) $current_db_version = $next_db_version;
210+
else $found = false;
211+
208212
if(isset($php_patch)) unset($php_patch);
213+
} elseif($dev_patch == false) {
214+
$dev_patch = true;
209215
} else {
210216
$found = false;
211217
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ALTER TABLE `mail_user`
2+
CHANGE `uid` `uid` int(11) NOT NULL DEFAULT '5000',
3+
CHANGE `gid` `gid` int(11) NOT NULL DEFAULT '5000';
4+
5+
ALTER TABLE `client_template` ADD `default_mailserver` INT(11) NOT NULL DEFAULT 1;
6+
ALTER TABLE `client_template` ADD `default_webserver` INT(11) NOT NULL DEFAULT 1;
7+
ALTER TABLE `client_template` ADD `default_dnsserver` INT(11) NOT NULL DEFAULT 1;
8+
ALTER TABLE `client_template` ADD `default_slave_dnsserver` INT(11) NOT NULL DEFAULT 1;
9+
ALTER TABLE `client_template` ADD `default_dbserver` INT(11) NOT NULL DEFAULT 1;
10+
ALTER TABLE `client` ADD `contact_firstname` VARCHAR( 64 ) NOT NULL DEFAULT '' AFTER `gender`;

install/sql/ispconfig3.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ CREATE TABLE `client` (
146146
`company_name` varchar(64) DEFAULT NULL,
147147
`company_id` varchar(255) DEFAULT NULL,
148148
`gender` enum('','m','f') NOT NULL DEFAULT '',
149+
`contact_firstname` varchar( 64 ) NOT NULL DEFAULT '',
149150
`contact_name` varchar(64) DEFAULT NULL,
150151
`customer_no` varchar(64) DEFAULT NULL,
151152
`vat_id` varchar(64) DEFAULT NULL,
@@ -897,8 +898,8 @@ CREATE TABLE `mail_user` (
897898
`login` varchar(255) NOT NULL default '',
898899
`password` varchar(255) NOT NULL default '',
899900
`name` varchar(255) NOT NULL default '',
900-
`uid` int(11) unsigned NOT NULL default '5000',
901-
`gid` int(11) unsigned NOT NULL default '5000',
901+
`uid` int(11) NOT NULL default '5000',
902+
`gid` int(11) NOT NULL default '5000',
902903
`maildir` varchar(255) NOT NULL default '',
903904
`quota` bigint(20) NOT NULL default '-1',
904905
`cc` varchar(255) NOT NULL default '',

interface/lib/classes/auth.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function has_clients($userid) {
5050

5151
$userid = $app->functions->intval($userid);
5252
$client = $app->db->queryOneRecord("SELECT client.limit_client FROM sys_user, client WHERE sys_user.userid = $userid AND sys_user.client_id = client.client_id");
53-
if($client['limit_client'] > 0) {
53+
if($client['limit_client'] != 0) {
5454
return true;
5555
} else {
5656
return false;

interface/lib/classes/client_templates.inc.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function apply_client_templates($clientId) {
109109
$sql = "SELECT template_master, template_additional,limit_client FROM client WHERE client_id = " . $app->functions->intval($clientId);
110110
$record = $app->db->queryOneRecord($sql);
111111
$masterTemplateId = $record['template_master'];
112-
$is_reseller = ($record['limit_client'] > 0)?true:false;
112+
$is_reseller = ($record['limit_client'] != 0)?true:false;
113113

114114
if($record['template_additional'] != '') {
115115
// we have to call the update_client_templates function
@@ -146,7 +146,7 @@ function apply_client_templates($clientId) {
146146
if (is_array($addLimits)){
147147
foreach($addLimits as $k => $v){
148148
/* we can remove this condition, but it is easier to debug with it (don't add ids and other non-limit values) */
149-
if (strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec'){
149+
if (strpos($k, 'limit') !== false or strpos($k, 'default') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec'){
150150
$app->log('Template processing key ' . $k . ' for client ' . $clientId, LOGLEVEL_DEBUG);
151151

152152
/* process the numerical limits */
@@ -160,6 +160,15 @@ function apply_client_templates($clientId) {
160160
if ($limits[$k] < 1) $limits[$k] = 1;
161161
break;
162162

163+
case 'default_mailserver':
164+
case 'default_webserver':
165+
case 'default_dnsserver':
166+
case 'default_slave_dnsserver':
167+
case 'default_dbserver':
168+
/* additional templates don't override default server from main template */
169+
if ($limits[$k] == 0) $limits[$k] = $v;
170+
break;
171+
163172
default:
164173
if ($limits[$k] > -1){
165174
if ($v == -1){
@@ -225,7 +234,10 @@ function apply_client_templates($clientId) {
225234
$update = '';
226235
if(!$is_reseller) unset($limits['limit_client']); // Only Resellers may have limit_client set in template to ensure that we do not convert a client to reseller accidently.
227236
foreach($limits as $k => $v){
228-
if ((strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec') && !is_array($v)){
237+
if (strpos($k, 'default') !== false and $v == 0) {
238+
continue; // template doesn't define default server, client's default musn't be changed
239+
}
240+
if ((strpos($k, 'limit') !== false or strpos($k, 'default') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec') && !is_array($v)){
229241
if ($update != '') $update .= ', ';
230242
$update .= '`' . $k . "`='" . $v . "'";
231243
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ public function client_update($session_id, $client_id, $reseller_id, $params)
182182
$app->uses('remoting_lib');
183183
$app->remoting_lib->loadFormDef('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php');
184184
$old_rec = $app->remoting_lib->getDataRecord($client_id);
185+
186+
//* merge old record with params, so only new values have to be set in $params
187+
$params = $app->functions->array_merge($old_rec,$params);
185188

186189
// we need the previuos templates assigned here
187190
$this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $client_id);

interface/lib/classes/remoting.inc.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,10 @@ protected function updateQueryPrepare($formdef_file, $client_id, $primary_id, $p
340340

341341
//* Load the form definition
342342
$app->remoting_lib->loadFormDef($formdef_file);
343+
344+
//* get old record and merge with params, so only new values have to be set in $params
345+
$old_rec = $app->remoting_lib->getDataRecord($primary_id);
346+
$params = $app->functions->array_merge($old_rec,$params);
343347

344348
//* Get the SQL query
345349
$sql = $app->remoting_lib->getSQL($params, 'UPDATE', $primary_id);

interface/lib/classes/soap_handler.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct() {
4949

5050
$name = substr($f, 0, strpos($f, '.'));
5151

52-
include $dir . '/' . $f;
52+
include_once $dir . '/' . $f;
5353
$class_name = 'remoting_' . $name;
5454
if(class_exists($class_name, false)) {
5555
$this->classes[$class_name] = new $class_name();

0 commit comments

Comments
 (0)