@@ -40,7 +40,7 @@ class installer_base {
4040 public function __construct ()
4141 {
4242 global $ conf ; //TODO: maybe $conf should be passed to constructor
43- $ this ->conf = $ conf ;
43+ // $this->conf = $conf;
4444 }
4545
4646 //: TODO Implement the translation function and language files for the installer.
@@ -152,7 +152,7 @@ public function add_database_server_record() {
152152 if ($ cf ['host ' ] == 'localhost ' ) {
153153 $ from_host = 'localhost ' ;
154154 } else {
155- $ from_host = $ this -> conf ['hostname ' ];
155+ $ from_host = $ conf ['hostname ' ];
156156 }
157157
158158 //* Create the ISPConfig database user
@@ -172,34 +172,34 @@ public function add_database_server_record() {
172172 $ server_ini_content = rf ("tpl/server.ini.master " );
173173 $ server_ini_content = addslashes ($ server_ini_content );
174174
175- $ sql = "INSERT INTO `server` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `vserver_server`, `config`, `updated`, `active`) VALUES (1, 1, 'riud', 'riud', 'r', ' " .$ this -> conf ['hostname ' ]."', 1, 1, 1, 1, 1, 1, ' $ server_ini_content', 0, 1); " ;
175+ $ sql = "INSERT INTO `server` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `vserver_server`, `config`, `updated`, `active`) VALUES (1, 1, 'riud', 'riud', 'r', ' " .$ conf ['hostname ' ]."', 1, 1, 1, 1, 1, 1, ' $ server_ini_content', 0, 1); " ;
176176 $ this ->db ->query ($ sql );
177177 $ conf ['server_id ' ] = $ this ->db ->insertID ();
178- $ this -> conf ['server_id ' ] = $ conf ['server_id ' ];
178+ $ conf ['server_id ' ] = $ conf ['server_id ' ];
179179 }
180180
181181
182182 //** writes postfix configuration files
183183 private function process_postfix_config ($ configfile )
184184 {
185- $ config_dir = $ this -> conf ['postfix ' ]['config_dir ' ].'/ ' ;
185+ $ config_dir = $ conf ['postfix ' ]['config_dir ' ].'/ ' ;
186186 $ full_file_name = $ config_dir .$ configfile ;
187187 //* Backup exiting file
188188 if (is_file ($ full_file_name )){
189189 copy ($ full_file_name , $ config_dir .$ configfile .'~ ' );
190190 }
191191 $ content = rf ('tpl/ ' .$ configfile .'.master ' );
192- $ content = str_replace ('{mysql_server_ispconfig_user} ' , $ this -> conf ['mysql ' ]['ispconfig_user ' ], $ content );
193- $ content = str_replace ('{mysql_server_ispconfig_password} ' , $ this -> conf ['mysql ' ]['ispconfig_password ' ], $ content );
194- $ content = str_replace ('{mysql_server_database} ' , $ this -> conf ['mysql ' ]['database ' ], $ content );
195- $ content = str_replace ('{mysql_server_ip} ' , $ this -> conf ['mysql ' ]['ip ' ], $ content );
196- $ content = str_replace ('{server_id} ' , $ this -> conf ['server_id ' ], $ content );
192+ $ content = str_replace ('{mysql_server_ispconfig_user} ' , $ conf ['mysql ' ]['ispconfig_user ' ], $ content );
193+ $ content = str_replace ('{mysql_server_ispconfig_password} ' , $ conf ['mysql ' ]['ispconfig_password ' ], $ content );
194+ $ content = str_replace ('{mysql_server_database} ' , $ conf ['mysql ' ]['database ' ], $ content );
195+ $ content = str_replace ('{mysql_server_ip} ' , $ conf ['mysql ' ]['ip ' ], $ content );
196+ $ content = str_replace ('{server_id} ' , $ conf ['server_id ' ], $ content );
197197 wf ($ full_file_name , $ content );
198198 }
199199
200200 public function configure_jailkit ()
201201 {
202- $ cf = $ this -> conf ['jailkit ' ];
202+ $ cf = $ conf ['jailkit ' ];
203203 $ config_dir = $ cf ['config_dir ' ];
204204 $ jk_init = $ cf ['jk_init ' ];
205205 $ jk_chrootsh = $ cf ['jk_chrootsh ' ];
@@ -217,7 +217,8 @@ public function configure_jailkit()
217217
218218 public function configure_postfix ($ options = '' )
219219 {
220- $ cf = $ this ->conf ['postfix ' ];
220+ global $ conf ;
221+ $ cf = $ conf ['postfix ' ];
221222 $ config_dir = $ cf ['config_dir ' ];
222223
223224 if (!is_dir ($ config_dir )){
@@ -265,8 +266,8 @@ public function configure_postfix($options = '')
265266 caselog ("$ command &> /dev/null " , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
266267
267268 $ postconf_commands = array (
268- 'myhostname = ' .$ this -> conf ['hostname ' ],
269- 'mydestination = ' .$ this -> conf ['hostname ' ].', localhost, localhost.localdomain ' ,
269+ 'myhostname = ' .$ conf ['hostname ' ],
270+ 'mydestination = ' .$ conf ['hostname ' ].', localhost, localhost.localdomain ' ,
270271 'mynetworks = 127.0.0.0/8 ' ,
271272 'virtual_alias_domains = ' ,
272273 'virtual_alias_maps = proxy:mysql: ' .$ config_dir .'/mysql-virtual_forwardings.cf, mysql: ' .$ config_dir .'/mysql-virtual_email2email.cf ' ,
@@ -382,10 +383,10 @@ function configure_saslauthd() {
382383 if (is_file ($ conf ["postfix " ]["config_dir " ].'/sasl/smtpd.conf ' )) copy ($ conf ["postfix " ]["config_dir " ].'/sasl/smtpd.conf ' ,$ conf ["postfix " ]["config_dir " ].'/sasl/smtpd.conf~ ' );
383384 if (is_file ($ conf ["postfix " ]["config_dir " ].'/sasl/smtpd.conf~ ' )) exec ('chmod 400 ' .$ conf ["postfix " ]["config_dir " ].'/sasl/smtpd.conf~ ' );
384385 $ content = rf ("tpl/ " .$ configfile .".master " );
385- $ content = str_replace ('{mysql_server_ispconfig_user} ' ,$ this -> conf ['mysql ' ]['ispconfig_user ' ],$ content );
386- $ content = str_replace ('{mysql_server_ispconfig_password} ' ,$ this -> conf ['mysql ' ]['ispconfig_password ' ], $ content );
387- $ content = str_replace ('{mysql_server_database} ' ,$ this -> conf ['mysql ' ]['database ' ],$ content );
388- $ content = str_replace ('{mysql_server_ip} ' ,$ this -> conf ['mysql ' ]['ip ' ],$ content );
386+ $ content = str_replace ('{mysql_server_ispconfig_user} ' ,$ conf ['mysql ' ]['ispconfig_user ' ],$ content );
387+ $ content = str_replace ('{mysql_server_ispconfig_password} ' ,$ conf ['mysql ' ]['ispconfig_password ' ], $ content );
388+ $ content = str_replace ('{mysql_server_database} ' ,$ conf ['mysql ' ]['database ' ],$ content );
389+ $ content = str_replace ('{mysql_server_ip} ' ,$ conf ['mysql ' ]['ip ' ],$ content );
389390 wf ($ conf ["postfix " ]["config_dir " ].'/sasl/smtpd.conf ' ,$ content );
390391
391392 // TODO: Chmod and chown on the config file
@@ -415,17 +416,18 @@ function configure_saslauthd() {
415416
416417 public function configure_pam ()
417418 {
418- $ pam = $ this ->conf ['pam ' ];
419+ global $ conf ;
420+ $ pam = $ conf ['pam ' ];
419421 //* configure pam for SMTP authentication agains the ispconfig database
420422 $ configfile = 'pamd_smtp ' ;
421423 if (is_file ("$ pam/smtp " )) copy ("$ pam/smtp " , "$ pam/smtp~ " );
422424 if (is_file ("$ pam/smtp~ " )) exec ("chmod 400 $ pam/smtp~ " );
423425
424426 $ content = rf ("tpl/ $ configfile.master " );
425- $ content = str_replace ('{mysql_server_ispconfig_user} ' , $ this -> conf ['mysql ' ]['ispconfig_user ' ], $ content );
426- $ content = str_replace ('{mysql_server_ispconfig_password} ' , $ this -> conf ['mysql ' ]['ispconfig_password ' ], $ content );
427- $ content = str_replace ('{mysql_server_database} ' , $ this -> conf ['mysql ' ]['database ' ], $ content );
428- $ content = str_replace ('{mysql_server_ip} ' , $ this -> conf ['mysql ' ]['ip ' ], $ content );
427+ $ content = str_replace ('{mysql_server_ispconfig_user} ' , $ conf ['mysql ' ]['ispconfig_user ' ], $ content );
428+ $ content = str_replace ('{mysql_server_ispconfig_password} ' , $ conf ['mysql ' ]['ispconfig_password ' ], $ content );
429+ $ content = str_replace ('{mysql_server_database} ' , $ conf ['mysql ' ]['database ' ], $ content );
430+ $ content = str_replace ('{mysql_server_ip} ' , $ conf ['mysql ' ]['ip ' ], $ content );
429431 wf ("$ pam/smtp " , $ content );
430432 exec ("chmod 660 $ pam/smtp " );
431433 exec ("chown daemon:daemon $ pam/smtp " );
@@ -434,25 +436,26 @@ public function configure_pam()
434436
435437 public function configure_courier ()
436438 {
437- $ config_dir = $ this ->conf ['courier ' ]['config_dir ' ];
439+ global $ conf ;
440+ $ config_dir = $ conf ['courier ' ]['config_dir ' ];
438441 //* authmysqlrc
439442 $ configfile = 'authmysqlrc ' ;
440443 if (is_file ("$ config_dir/ $ configfile " )){
441444 copy ("$ config_dir/ $ configfile " , "$ config_dir/ $ configfile~ " );
442445 }
443446 exec ("chmod 400 $ config_dir/ $ configfile~ " );
444447 $ content = rf ("tpl/ $ configfile.master " );
445- $ content = str_replace ('{mysql_server_ispconfig_user} ' ,$ this -> conf ['mysql ' ]['ispconfig_user ' ],$ content );
446- $ content = str_replace ('{mysql_server_ispconfig_password} ' ,$ this -> conf ['mysql ' ]['ispconfig_password ' ], $ content );
447- $ content = str_replace ('{mysql_server_database} ' ,$ this -> conf ['mysql ' ]['database ' ],$ content );
448- $ content = str_replace ('{mysql_server_host} ' ,$ this -> conf ['mysql ' ]['host ' ],$ content );
448+ $ content = str_replace ('{mysql_server_ispconfig_user} ' ,$ conf ['mysql ' ]['ispconfig_user ' ],$ content );
449+ $ content = str_replace ('{mysql_server_ispconfig_password} ' ,$ conf ['mysql ' ]['ispconfig_password ' ], $ content );
450+ $ content = str_replace ('{mysql_server_database} ' ,$ conf ['mysql ' ]['database ' ],$ content );
451+ $ content = str_replace ('{mysql_server_host} ' ,$ conf ['mysql ' ]['host ' ],$ content );
449452 wf ("$ config_dir/ $ configfile " , $ content );
450453
451454 exec ("chmod 660 $ config_dir/ $ configfile " );
452455 exec ("chown daemon:daemon $ config_dir/ $ configfile " );
453456
454457 //* authdaemonrc
455- $ configfile = $ this -> conf ['courier ' ]['config_dir ' ].'/authdaemonrc ' ;
458+ $ configfile = $ conf ['courier ' ]['config_dir ' ].'/authdaemonrc ' ;
456459 if (is_file ($ configfile )){
457460 copy ($ configfile , $ configfile .'~ ' );
458461 }
@@ -472,11 +475,11 @@ function configure_amavis() {
472475 if (is_file ($ conf ["amavis " ]["config_dir " ].'/conf.d/50-user ' )) copy ($ conf ["amavis " ]["config_dir " ].'/conf.d/50-user ' ,$ conf ["courier " ]["config_dir " ].'/50-user~ ' );
473476 if (is_file ($ conf ["amavis " ]["config_dir " ].'/conf.d/50-user~ ' )) exec ('chmod 400 ' .$ conf ["amavis " ]["config_dir " ].'/conf.d/50-user~ ' );
474477 $ content = rf ("tpl/ " .$ configfile .".master " );
475- $ content = str_replace ('{mysql_server_ispconfig_user} ' ,$ this -> conf ['mysql ' ]['ispconfig_user ' ],$ content );
476- $ content = str_replace ('{mysql_server_ispconfig_password} ' ,$ this -> conf ['mysql ' ]['ispconfig_password ' ], $ content );
477- $ content = str_replace ('{mysql_server_database} ' ,$ this -> conf ['mysql ' ]['database ' ],$ content );
478+ $ content = str_replace ('{mysql_server_ispconfig_user} ' ,$ conf ['mysql ' ]['ispconfig_user ' ],$ content );
479+ $ content = str_replace ('{mysql_server_ispconfig_password} ' ,$ conf ['mysql ' ]['ispconfig_password ' ], $ content );
480+ $ content = str_replace ('{mysql_server_database} ' ,$ conf ['mysql ' ]['database ' ],$ content );
478481 $ content = str_replace ('{mysql_server_port} ' ,$ conf ["mysql " ]["port " ],$ content );
479- $ content = str_replace ('{mysql_server_ip} ' ,$ this -> conf ['mysql ' ]['ip ' ],$ content );
482+ $ content = str_replace ('{mysql_server_ip} ' ,$ conf ['mysql ' ]['ip ' ],$ content );
480483 wf ($ conf ["amavis " ]["config_dir " ].'/conf.d/50-user ' ,$ content );
481484
482485 // TODO: chmod and chown on the config file
@@ -513,6 +516,8 @@ function configure_amavis() {
513516
514517 public function configure_spamassassin ()
515518 {
519+ global $ conf ;
520+
516521 //* Enable spamasasssin on debian and ubuntu
517522 $ configfile = '/etc/default/spamassassin ' ;
518523 if (is_file ($ configfile )){
@@ -525,7 +530,7 @@ public function configure_spamassassin()
525530
526531 public function configure_getmail ()
527532 {
528- $ config_dir = $ this -> conf ['getmail ' ]['config_dir ' ];
533+ $ config_dir = $ conf ['getmail ' ]['config_dir ' ];
529534
530535 if (!is_dir ($ config_dir )) exec ("mkdir -p " .escapeshellcmd ($ config_dir ));
531536
@@ -544,7 +549,7 @@ public function configure_pureftpd()
544549 {
545550 global $ conf ;
546551
547- $ config_dir = $ this -> conf ['pureftpd ' ]['config_dir ' ];
552+ $ config_dir = $ conf ['pureftpd ' ]['config_dir ' ];
548553
549554 //* configure pam for SMTP authentication agains the ispconfig database
550555 $ configfile = 'db/mysql.conf ' ;
@@ -612,7 +617,7 @@ public function configure_firewall()
612617 $ tcp_public_services = '' ;
613618 $ udp_public_services = '' ;
614619
615- $ row = $ this ->db ->queryOneRecord ("SELECT * FROM firewall WHERE server_id = " .intval ($ this -> conf ['server_id ' ]));
620+ $ row = $ this ->db ->queryOneRecord ("SELECT * FROM firewall WHERE server_id = " .intval ($ conf ['server_id ' ]));
616621
617622 if (trim ($ row ["tcp_port " ]) != '' || trim ($ row ["udp_port " ]) != '' ){
618623 $ tcp_public_services = trim (str_replace (', ' ,' ' ,$ row ["tcp_port " ]));
@@ -654,7 +659,7 @@ public function install_ispconfig()
654659 {
655660 global $ conf ;
656661
657- $ install_dir = $ this -> conf ['ispconfig_install_dir ' ];
662+ $ install_dir = $ conf ['ispconfig_install_dir ' ];
658663
659664 //* Create the ISPConfig installation directory
660665 if (!@is_dir ("$ install_dir " )) {
@@ -786,14 +791,14 @@ public function install_ispconfig()
786791
787792 //* Copy the ISPConfig vhost for the controlpanel
788793 // TODO: These are missing! should they be "vhost_dist_*_dir" ?
789- $ vhost_conf_dir = $ this -> conf ['apache ' ]['vhost_conf_dir ' ];
790- $ vhost_conf_enabled_dir = $ this -> conf ['apache ' ]['vhost_conf_enabled_dir ' ];
794+ $ vhost_conf_dir = $ conf ['apache ' ]['vhost_conf_dir ' ];
795+ $ vhost_conf_enabled_dir = $ conf ['apache ' ]['vhost_conf_enabled_dir ' ];
791796
792797
793798 // Dont just copy over the virtualhost template but add some custom settings
794799
795800 $ content = rf ("tpl/apache_ispconfig.vhost.master " );
796- $ content = str_replace ('{vhost_port} ' , $ this -> conf ['apache ' ]['vhost_port ' ], $ content );
801+ $ content = str_replace ('{vhost_port} ' , $ conf ['apache ' ]['vhost_port ' ], $ content );
797802 wf ("$ vhost_conf_dir/ispconfig.vhost " , $ content );
798803
799804 //copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
@@ -830,7 +835,7 @@ public function configure_dbserver()
830835 global $ conf ;
831836
832837 //* If this server shall act as database server for client DB's, we configure this here
833- $ install_dir = $ this -> conf ['ispconfig_install_dir ' ];
838+ $ install_dir = $ conf ['ispconfig_install_dir ' ];
834839
835840 // Create a file with the database login details which
836841 // are used to create the client databases.
@@ -851,6 +856,8 @@ public function configure_dbserver()
851856
852857 public function install_crontab ()
853858 {
859+ global $ conf ;
860+
854861 //* Root Crontab
855862 exec ('crontab -u root -l > crontab.txt ' );
856863 $ existing_root_cron_jobs = file ('crontab.txt ' );
@@ -869,7 +876,7 @@ public function install_crontab()
869876 unlink ('crontab.txt ' );
870877
871878 //* Getmail crontab
872- $ cf = $ this -> conf ['getmail ' ];
879+ $ cf = $ conf ['getmail ' ];
873880 exec ('crontab -u getmail -l > crontab.txt ' );
874881 $ existing_cron_jobs = file ('crontab.txt ' );
875882
0 commit comments