Skip to content

Commit 992797f

Browse files
author
Marius Cramer
committed
Copied files from svn 3.0.5 stable branch (git migration)
1 parent 7b47c0a commit 992797f

File tree

885 files changed

+9037
-11079
lines changed

Some content is hidden

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

885 files changed

+9037
-11079
lines changed

install/autoupdate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@
285285
//if(@is_dir('/etc/Bastille')) {
286286
//* Configure Firewall
287287
swriteln('Configuring Firewall');
288-
$inst->configure_bastille_firewall();
288+
$inst->configure_firewall();
289289
//}
290290

291291
//** Configure ISPConfig

install/dist/lib/fedora.lib.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ public function install_ispconfig()
845845
$content = str_replace('{language}', $conf['language'], $content);
846846
$content = str_replace('{timezone}', $conf['timezone'], $content);
847847
$content = str_replace('{theme}', $conf['theme'], $content);
848+
$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
848849

849850
wf("$install_dir/interface/lib/$configfile", $content);
850851

@@ -869,6 +870,7 @@ public function install_ispconfig()
869870
$content = str_replace('{language}', $conf['language'], $content);
870871
$content = str_replace('{timezone}', $conf['timezone'], $content);
871872
$content = str_replace('{theme}', $conf['theme'], $content);
873+
$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
872874

873875
wf("$install_dir/server/lib/$configfile", $content);
874876

install/dist/lib/gentoo.lib.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,7 @@ public function install_ispconfig()
725725
$content = str_replace('{language}', $conf['language'], $content);
726726
$content = str_replace('{timezone}', $conf['timezone'], $content);
727727
$content = str_replace('{theme}', $conf['theme'], $content);
728+
$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
728729

729730
$this->write_config_file("$install_dir/interface/lib/$configfile", $content);
730731

install/dist/lib/opensuse.lib.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,7 @@ public function install_ispconfig()
900900
$content = str_replace('{language}', $conf['language'], $content);
901901
$content = str_replace('{timezone}', $conf['timezone'], $content);
902902
$content = str_replace('{theme}', $conf['theme'], $content);
903+
$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
903904

904905
wf("$install_dir/interface/lib/$configfile", $content);
905906

@@ -924,6 +925,7 @@ public function install_ispconfig()
924925
$content = str_replace('{language}', $conf['language'], $content);
925926
$content = str_replace('{timezone}', $conf['timezone'], $content);
926927
$content = str_replace('{theme}', $conf['theme'], $content);
928+
$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
927929

928930
wf("$install_dir/server/lib/$configfile", $content);
929931

install/install.php

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434

3535
error_reporting(E_ALL|E_STRICT);
3636

37+
define('INSTALLER_RUN', true);
38+
3739
//** The banner on the command line
3840
echo "\n\n".str_repeat('-',80)."\n";
3941
echo " _____ ___________ _____ __ _ ____
@@ -106,8 +108,9 @@
106108
$conf['language'] = $inst->simple_query('Select language', array('en','de'), 'en');
107109
$conf['timezone'] = get_system_timezone();
108110

109-
//* Set defaukt theme
111+
//* Set default theme
110112
$conf['theme'] = 'default';
113+
$conf['language_file_import_enabled'] = true;
111114

112115
//** Select installation mode
113116
$install_mode = $inst->simple_query('Installation mode', array('standard','expert'), 'standard');
@@ -257,17 +260,10 @@
257260
$inst->configure_apps_vhost();
258261

259262
//* Configure Firewall
260-
if($conf['ufw']['installed'] == true) {
261-
//* Configure Ubuntu Firewall
262-
$conf['services']['firewall'] = true;
263-
swriteln('Configuring Ubuntu Firewall');
264-
$inst->configure_ufw_firewall();
265-
} else {
266-
//* Configure Bastille Firewall
267-
$conf['services']['firewall'] = true;
268-
swriteln('Configuring Bastille Firewall');
269-
$inst->configure_bastille_firewall();
270-
}
263+
//* Configure Bastille Firewall
264+
$conf['services']['firewall'] = true;
265+
swriteln('Configuring Bastille Firewall');
266+
$inst->configure_firewall();
271267

272268
//* Configure Fail2ban
273269
if($conf['fail2ban']['installed'] == true) {
@@ -335,7 +331,7 @@
335331
if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['bind']['init_script'])) system($conf['init_scripts'].'/'.$conf['bind']['init_script'].' restart &> /dev/null');
336332
//if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['squid']['init_script'])) system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null');
337333
if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['nginx']['init_script'])) system($conf['init_scripts'].'/'.$conf['nginx']['init_script'].' restart &> /dev/null');
338-
if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['ufw']['init_script'])) system($conf['init_scripts'].'/'.$conf['ufw']['init_script'].' restart &> /dev/null');
334+
//if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['ufw']['init_script'])) system($conf['init_scripts'].'/'.$conf['ufw']['init_script'].' restart &> /dev/null');
339335
}else{
340336

341337
//* In expert mode, we select the services in the following steps, only db is always available
@@ -551,17 +547,18 @@
551547

552548
//** Configure Firewall
553549
if(strtolower($inst->simple_query('Configure Firewall Server',array('y','n'),'y')) == 'y') {
554-
if($conf['ufw']['installed'] == true) {
550+
//if($conf['bastille']['installed'] == true) {
551+
//* Configure Bastille Firewall
552+
$conf['services']['firewall'] = true;
553+
swriteln('Configuring Bastille Firewall');
554+
$inst->configure_firewall();
555+
/*} elseif($conf['ufw']['installed'] == true) {
555556
//* Configure Ubuntu Firewall
556557
$conf['services']['firewall'] = true;
557558
swriteln('Configuring Ubuntu Firewall');
558559
$inst->configure_ufw_firewall();
559-
} else {
560-
//* Configure Bastille Firewall
561-
$conf['services']['firewall'] = true;
562-
swriteln('Configuring Bastille Firewall');
563-
$inst->configure_bastille_firewall();
564560
}
561+
*/
565562
}
566563

567564
//** Configure Firewall
@@ -629,4 +626,4 @@
629626
echo "Installation completed.\n";
630627

631628

632-
?>
629+
?>

install/lib/installer_base.lib.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function find_installed_apps() {
132132
if(is_installed('named') || is_installed('bind') || is_installed('bind9')) $conf['bind']['installed'] = true;
133133
if(is_installed('squid')) $conf['squid']['installed'] = true;
134134
if(is_installed('nginx')) $conf['nginx']['installed'] = true;
135-
if(is_installed('iptables') && is_installed('ufw')) $conf['ufw']['installed'] = true;
135+
// if(is_installed('iptables') && is_installed('ufw')) $conf['ufw']['installed'] = true;
136136
if(is_installed('fail2ban-server')) $conf['fail2ban']['installed'] = true;
137137
if(is_installed('vzctl')) $conf['openvz']['installed'] = true;
138138
if(is_dir("/etc/Bastille")) $conf['bastille']['installed'] = true;
@@ -1365,6 +1365,7 @@ public function configure_squid()
13651365
exec('chown root:root '.$conf["squid"]["config_dir"].'/'.$configfile);
13661366
}
13671367

1368+
/*
13681369
public function configure_ufw_firewall()
13691370
{
13701371
$configfile = 'ufw.conf';
@@ -1374,8 +1375,9 @@ public function configure_ufw_firewall()
13741375
exec('chmod 600 /etc/ufw/ufw.conf');
13751376
exec('chown root:root /etc/ufw/ufw.conf');
13761377
}
1378+
*/
13771379

1378-
public function configure_bastille_firewall() {
1380+
public function configure_firewall() {
13791381
global $conf;
13801382

13811383
$dist_init_scripts = $conf['init_scripts'];
@@ -1691,6 +1693,7 @@ public function install_ispconfig() {
16911693
$content = str_replace('{language}', $conf['language'], $content);
16921694
$content = str_replace('{timezone}', $conf['timezone'], $content);
16931695
$content = str_replace('{theme}', $conf['theme'], $content);
1696+
$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
16941697

16951698
wf($install_dir.'/interface/lib/'.$configfile, $content);
16961699

@@ -1715,6 +1718,7 @@ public function install_ispconfig() {
17151718
$content = str_replace('{language}', $conf['language'], $content);
17161719
$content = str_replace('{timezone}', $conf['timezone'], $content);
17171720
$content = str_replace('{theme}', $conf['theme'], $content);
1721+
$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
17181722

17191723
wf($install_dir.'/server/lib/'.$configfile, $content);
17201724

install/lib/update.lib.php

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
*/
2929

30+
//* Installer patch stub class
31+
class installer_patch_update {
32+
protected function onBeforeSQL() {
33+
}
34+
protected function onAfterSQL() {
35+
}
36+
}
37+
38+
//* DB dump function
3039
function prepareDBDump() {
3140
global $conf;
3241

@@ -151,16 +160,43 @@ function updateDbAndIni() {
151160
$found = true;
152161
while($found == true) {
153162
$next_db_version = intval($current_db_version + 1);
154-
$patch_filename = realpath(dirname(__FILE__).'/../').'/sql/incremental/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.sql';
155-
if(is_file($patch_filename)) {
163+
$sql_patch_filename = realpath(dirname(__FILE__).'/../').'/sql/incremental/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.sql';
164+
$php_patch_filename = realpath(dirname(__FILE__).'/../').'/patches/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.php';
165+
166+
if(is_file($sql_patch_filename)) {
167+
168+
//* Load php patch file and instantiate object
169+
if(is_file($php_patch_filename)) {
170+
$php_patch_class_name = 'upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT);
171+
include_once($php_patch_filename);
172+
if(class_exists($php_patch_class_name)) {
173+
$php_patch = new $php_patch_class_name;
174+
} else {
175+
swriteln($inst->lng('WARNING: PHP patch file').': '.$php_patch_filename.' '.$inst->lng('contains errors.'));
176+
}
177+
}
178+
179+
//* Exec onBeforeSQL function
180+
if(isset($php_patch) && is_object($php_patch)) {
181+
$php_patch->onBeforeSQL();
182+
swriteln($inst->lng('Executing PHP patch file').': '.$php_patch_filename);
183+
}
184+
156185
//* Load patch file into database
157186
if( !empty($conf["mysql"]["admin_password"]) ) {
158-
system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." ".escapeshellarg($conf['mysql']['database'])." < ".$patch_filename);
187+
system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." ".escapeshellarg($conf['mysql']['database'])." < ".$sql_patch_filename);
159188
} else {
160-
system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['mysql']['database'])." < ".$patch_filename);
189+
system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['mysql']['database'])." < ".$sql_patch_filename);
190+
}
191+
swriteln($inst->lng('Loading SQL patch file').': '.$sql_patch_filename);
192+
193+
//* Exec onAfterSQL function
194+
if(isset($php_patch) && is_object($php_patch)) {
195+
$php_patch->onAfterSQL();
161196
}
162-
swriteln($inst->lng('Loading SQL patch file').': '.$patch_filename);
197+
163198
$current_db_version = $next_db_version;
199+
if(isset($php_patch)) unset($php_patch);
164200
} else {
165201
$found = false;
166202
}
@@ -332,4 +368,6 @@ function updateDbAndIni() {
332368
unset($new_ini);
333369
}
334370

371+
372+
335373
?>

install/patches/upd_0001.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
if(!defined('INSTALLER_RUN')) die('Patch update file access violation.');
4+
5+
/*
6+
Example installer patch update class. the classname must match
7+
the php and the sql patch update filename. The php patches are
8+
only executed when a corresponding sql patch exists.
9+
*/
10+
11+
class upd_0001 extends installer_patch_update {
12+
13+
public function onBeforeSQL() {
14+
// Do something
15+
}
16+
public function onAfterSQL() {
17+
// Do something
18+
}
19+
}
20+
21+
?>
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
ALTER TABLE `client_template` CHANGE `limit_aps` `limit_aps` INT( 11 ) NOT NULL DEFAULT '-1';
2-
ALTER TABLE `web_backup` ADD `filesize` VARCHAR(10) NOT NULL AFTER `filename`;
1+
ALTER TABLE `client_template` CHANGE `limit_aps` `limit_aps` INT( 11 ) NOT NULL DEFAULT '-1';
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
ALTER TABLE `client_template` CHANGE `limit_aps` `limit_aps` INT( 11 ) NOT NULL DEFAULT '-1';
2-
ALTER TABLE `mail_domain` ADD `dkim_public` MEDIUMTEXT NOT NULL AFTER `domain`;
3-
ALTER TABLE `mail_domain` ADD `dkim_private` MEDIUMTEXT NOT NULL AFTER `domain`;
4-
ALTER TABLE `mail_domain` ADD `dkim` ENUM( 'n', 'y' ) NOT NULL AFTER `domain`;
5-
ALTER TABLE `client` ADD `default_slave_dnsserver` INT( 11 ) UNSIGNED NOT NULL DEFAULT '1' AFTER `limit_dns_zone`;
1+
ALTER TABLE `client` ADD `default_slave_dnsserver` INT( 11 ) UNSIGNED NOT NULL DEFAULT '1' AFTER `limit_dns_zone`;

0 commit comments

Comments
 (0)