diff --git a/install/dist/lib/fedora.lib.php b/install/dist/lib/fedora.lib.php index 628f012dba0efa91278e048cad2c197f6e6e97bf..3d86492dca4bafdcd674dd274da184bc3c2b0c22 100644 --- a/install/dist/lib/fedora.lib.php +++ b/install/dist/lib/fedora.lib.php @@ -226,8 +226,8 @@ class installer_dist extends installer_base { if(is_file('/var/lib/mailman/data/aliases')) unlink('/var/lib/mailman/data/aliases'); if(!is_link('/var/lib/mailman/data/aliases')) symlink('/etc/mailman/aliases', '/var/lib/mailman/data/aliases'); exec('postalias /var/lib/mailman/data/aliases'); - if(!is_file('/var/lib/mailman/data/virtual-mailman')) touch('/var/lib/mailman/data/virtual-mailman'); - exec('postmap /var/lib/mailman/data/virtual-mailman'); + if(!is_file('/etc/mailman/virtual-mailman')) touch('/etc/mailman/virtual-mailman'); + exec('postmap /etc/mailman/virtual-mailman'); if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman'); exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman'); diff --git a/install/sql/incremental/upd_0066.sql b/install/sql/incremental/upd_0066.sql new file mode 100644 index 0000000000000000000000000000000000000000..65ed31682e335f682f4d25b7cdf714c47c0fefd6 --- /dev/null +++ b/install/sql/incremental/upd_0066.sql @@ -0,0 +1,2 @@ +ALTER TABLE `sys_config` DROP `config_id`, + ADD PRIMARY KEY (`group`, `name`); diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 81a4cf3a97e3d29e0696f47a085d8de98c1c7c87..9c8f04e26363f627199f6c4c5575a9948847449b 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -1486,10 +1486,10 @@ CREATE TABLE `support_message` ( -- CREATE TABLE `sys_config` ( - `config_id` int(11) unsigned NOT NULL, `group` varchar(64) NOT NULL, `name` varchar(64) NOT NULL, - `value` varchar(255) NOT NULL + `value` varchar(255) NOT NULL, + PRIMARY KEY (`group`, `name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -2280,7 +2280,7 @@ INSERT INTO `sys_user` (`userid`, `sys_userid`, `sys_groupid`, `sys_perm_user`, -- Dumping data for table `sys_config` -- -INSERT INTO sys_config VALUES ('1','db','db_version','3.0.5.3'); -INSERT INTO sys_config VALUES ('2','interface','session_timeout','0'); +INSERT INTO sys_config VALUES ('db','db_version','3.0.5.3'); +INSERT INTO sys_config VALUES ('interface','session_timeout','0'); SET FOREIGN_KEY_CHECKS = 1; diff --git a/install/tpl/fedora_postfix.conf.master b/install/tpl/fedora_postfix.conf.master index 4401f706e0d43c6e3a3460be1a4b5b034eeb93df..f4367efb6a9ac6563c629cbead848002500bf54b 100644 --- a/install/tpl/fedora_postfix.conf.master +++ b/install/tpl/fedora_postfix.conf.master @@ -1,5 +1,5 @@ virtual_alias_domains = -virtual_alias_maps = proxy:mysql:{config_dir}/mysql-virtual_forwardings.cf, proxy:mysql:{config_dir}/mysql-virtual_email2email.cf +virtual_alias_maps = proxy:mysql:{config_dir}/mysql-virtual_forwardings.cf, proxy:mysql:{config_dir}/mysql-virtual_email2email.cf, hash:/etc/mailman/virtual-mailman virtual_mailbox_domains = proxy:mysql:{config_dir}/mysql-virtual_domains.cf virtual_mailbox_maps = proxy:mysql:{config_dir}/mysql-virtual_mailboxes.cf virtual_mailbox_base = {vmail_mailbox_base} diff --git a/interface/lib/app.inc.php b/interface/lib/app.inc.php index 64d22488edaef14327bf7f7c57f7b65fe1f30a1d..1d80b8abc5b4f5578a2cf0ba58caf15958389f12 100755 --- a/interface/lib/app.inc.php +++ b/interface/lib/app.inc.php @@ -48,6 +48,8 @@ class app { private $_wb; private $_loaded_classes = array(); private $_conf; + + public $loaded_plugins = array(); public function __construct() { global $conf; @@ -55,7 +57,7 @@ class app { if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS']) || isset($_REQUEST['s']) || isset($_REQUEST['s_old']) || isset($_REQUEST['conf'])) { die('Internal Error: var override attempt detected'); } - + $this->_conf = $conf; if($this->_conf['start_db'] == true) { $this->load('db_'.$this->_conf['db_type']); @@ -66,8 +68,8 @@ class app { if($this->_conf['start_session'] == true) { $this->uses('session'); - $tmp = $this->db->queryOneRecord("SELECT `value` FROM sys_config WHERE `config_id` = 2 AND `group` = 'interface' AND `name` = 'session_timeout'"); - if($tmp && $tmp['value'] > 0) { + $sess_timeout = $this->conf('interface', 'session_timeout'); + if($sess_timeout) { /* check if user wants to stay logged in */ if(isset($_POST['s_mod']) && isset($_POST['s_pg']) && $_POST['s_mod'] == 'login' && $_POST['s_pg'] == 'index' && isset($_POST['stay']) && $_POST['stay'] == '1') { /* check if staying logged in is allowed */ @@ -75,8 +77,8 @@ class app { $tmp = $this->db->queryOneRecord('SELECT config FROM sys_ini WHERE sysini_id = 1'); $tmp = $this->ini_parser->parse_ini_string(stripslashes($tmp['config'])); if(!isset($tmp['misc']['session_allow_endless']) || $tmp['misc']['session_allow_endless'] != 'y') { - $this->session->set_timeout($tmp['value']); - session_set_cookie_params(($tmp['value'] * 60) + 300); // make the cookie live 5 minutes longer + $this->session->set_timeout($sess_timeout); + session_set_cookie_params(($sess_timeout * 60) + 300); // make the cookie live 5 minutes longer } else { // we are doing login here, so we need to set the session data $this->session->set_permanent(true); @@ -84,8 +86,8 @@ class app { session_set_cookie_params(365 * 24 * 3600); // make the cookie live 5 minutes longer } } else { - $this->session->set_timeout($tmp['value']); - session_set_cookie_params(($tmp['value'] * 60) + 300); // make the cookie live 5 minutes longer + $this->session->set_timeout($sess_timeout); + session_set_cookie_params(($sess_timeout * 60) + 300); // make the cookie live 5 minutes longer } } else { session_set_cookie_params(0); // until browser is closed @@ -110,6 +112,14 @@ class app { $this->uses('auth,plugin'); } + public function __get($prop) { + if(property_exists($this, $prop)) return $this->{$prop}; + + $this->uses($prop); + if(property_exists($this, $prop)) return $this->{$prop}; + else return null; + } + public function __destruct() { session_write_close(); } @@ -120,7 +130,7 @@ class app { foreach($cl as $classname) { $classname = trim($classname); //* Class is not loaded so load it - if(!array_key_exists($classname, $this->_loaded_classes)) { + if(!array_key_exists($classname, $this->_loaded_classes) && is_file(ISPC_CLASS_PATH."/$classname.inc.php")) { include_once ISPC_CLASS_PATH."/$classname.inc.php"; $this->$classname = new $classname(); $this->_loaded_classes[$classname] = true; @@ -138,6 +148,22 @@ class app { } } } + + public function conf($plugin, $key, $value = null) { + if(is_null($value)) { + $tmpconf = $this->db->queryOneRecord("SELECT `value` FROM `sys_config` WHERE `group` = '" . $this->db->quote($plugin) . "' AND `name` = '" . $this->db->quote($key) . "'"); + if($tmpconf) return $tmpconf['value']; + else return null; + } else { + if($value === false) { + $this->db->query("DELETE FROM `sys_config` WHERE `group` = '" . $this->db->quote($plugin) . "' AND `name` = '" . $this->db->quote($key) . "'"); + return null; + } else { + $this->db->query("REPLACE INTO `sys_config` (`group`, `name`, `value`) VALUES ('" . $this->db->quote($plugin) . "', '" . $this->db->quote($key) . "', '" . $this->db->quote($value) . "')"); + return $value; + } + } + } /** Priority values are: 0 = DEBUG, 1 = WARNING, 2 = ERROR */ diff --git a/interface/web/admin/lib/remote.conf.php b/interface/web/admin/lib/remote.conf.php index c40e8bf07257ddbbdaeae7e39395b6081b244398..37aec717946d5dc66ffbdda4b76cbfbff95a3d9a 100644 --- a/interface/web/admin/lib/remote.conf.php +++ b/interface/web/admin/lib/remote.conf.php @@ -1,6 +1,6 @@ diff --git a/interface/web/admin/system_config_edit.php b/interface/web/admin/system_config_edit.php index 9c69cfa401da62cbdb7138a4ee8780aef9efea76..3a2ac8e76584ddb13750d56ae7a0b7dfcbeceffd 100644 --- a/interface/web/admin/system_config_edit.php +++ b/interface/web/admin/system_config_edit.php @@ -156,8 +156,7 @@ class page_action extends tform_actions { } elseif($section == 'mail') { if($new_config['smtp_pass'] == '') $new_config['smtp_pass'] = $server_config_array['mail']['smtp_pass']; } elseif($section == 'misc' && $new_config['session_timeout'] != $server_config_array['misc']['session_timeout']) { - $app->db->query("DELETE FROM sys_config WHERE `config_id` = 2 AND `group` = 'interface' AND `name` = 'session_timeout'"); - $app->db->query("INSERT INTO sys_config (`config_id`, `group`, `name`, `value`) VALUES (2, 'interface', 'session_timeout', '" . intval($new_config['session_timeout']) . "')"); + $app->conf('interface', 'session_timeout', intval($new_config['session_timeout'])); } $server_config_array[$section] = $new_config; $server_config_str = $app->ini_parser->get_ini_string($server_config_array); diff --git a/interface/web/tools/lib/lang/en_resync.lng b/interface/web/tools/lib/lang/en_resync.lng index bfb22d05d3b9d05c9abe242d9eafe7e4930d6b1e..891416bea68408a8b4006234fec67e2d57d0bb08 100644 --- a/interface/web/tools/lib/lang/en_resync.lng +++ b/interface/web/tools/lib/lang/en_resync.lng @@ -9,6 +9,7 @@ $wb['resync_db_txt'] = 'Resync clientdb config'; $wb['resync_mailbox_txt'] = 'Resync Mailboxes'; $wb['resync_dkim_txt'] = 'Resync DKIM-Keys'; $wb['resync_dns_txt'] = 'Resync DNS records'; +$wb['resync_client_txt'] = 'Resync Client records'; $wb['btn_start_txt'] = 'Start'; $wb['btn_cancel_txt'] = 'Cancel'; ?> diff --git a/interface/web/tools/resync.php b/interface/web/tools/resync.php index ad716f7bf7bd675171556993be7aaccf0f7cd41d..4e5f20610aa97e791102555ca055d3afe545ea23 100644 --- a/interface/web/tools/resync.php +++ b/interface/web/tools/resync.php @@ -106,6 +106,16 @@ if(isset($_POST['resync_cron']) && $_POST['resync_cron'] == 1) { //* Resyncing Databases if(isset($_POST['resync_db']) && $_POST['resync_db'] == 1) { + $db_table = 'web_database_user'; + $index_field = 'database_user_id'; + $sql = "SELECT * FROM ".$db_table." WHERE 1"; + $records = $app->db->queryAllRecords($sql); + if(is_array($records)) { + foreach($records as $rec) { + $app->db->datalogUpdate($db_table, $rec, $index_field, $rec[$index_field], true); + $msg .= "Resynced Database user: ".$rec['database_user'].'
'; + } + } $db_table = 'web_database'; $index_field = 'database_id'; $sql = "SELECT * FROM ".$db_table." WHERE active = 'y'"; @@ -144,6 +154,16 @@ if(isset($_POST['resync_mailbox']) && $_POST['resync_mailbox'] == 1) { $msg .= "Resynced Mailbox: ".$rec['email'].'
'; } } + $db_table = 'mail_forwarding'; + $index_field = 'forwarding_id'; + $sql = "SELECT * FROM ".$db_table; + $records = $app->db->queryAllRecords($sql); + if(is_array($records)) { + foreach($records as $rec) { + $app->db->datalogUpdate($db_table, $rec, $index_field, $rec[$index_field], true); + $msg .= "Resynced Alias: ".$rec['source'].'
'; + } + } } //* Resyncing DKIM-Keys @@ -183,6 +203,31 @@ if(isset($_POST['resync_dns']) && $_POST['resync_dns'] == 1) { } +//* Resyncing Clients +if(isset($_POST['resync_client']) && $_POST['resync_client'] == 1) { + $tform_def_file = "form/client.tform.php"; + $app->uses('tpl,tform,tform_actions'); + $app->load('tform_actions'); + + $db_table = 'client'; + $index_field = 'client_id'; + $sql = "SELECT * FROM ".$db_table; + $records = $app->db->queryAllRecords($sql); + if(is_array($records)) { + foreach($records as $rec) { + $app->db->datalogUpdate($db_table, $rec, $index_field, $rec[$index_field], true); + $tmp = new tform_actions; + $tmp->id = $rec[$index_field]; + $tmp->dataRecord = $rec; + $tmp->oldDataRecord = $rec; + $app->plugin->raiseEvent('client:client:on_after_update', $tmp); + $msg .= "Resynced Client: ".$rec['contact_name'].'
'; + unset($tmp); + } + } +} + + $app->tpl->setVar('msg', $msg); $app->tpl->setVar('error', $error); diff --git a/interface/web/tools/templates/resync.htm b/interface/web/tools/templates/resync.htm index 2bb8b064e7cdf44e890b8fecad2d2747e68d7199..845949fa8b2d5b05cf9425a33d16e001d13a154b 100644 --- a/interface/web/tools/templates/resync.htm +++ b/interface/web/tools/templates/resync.htm @@ -52,6 +52,12 @@
+ +
+

{tmpl_var name="resync_client_txt"}

+
+ +
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 8940cfd58f0acf509c1b5d3af8ba3846ce3ef10c..c43040be43076074e5af67989692637c11721466 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -778,7 +778,7 @@ class apache2_plugin { if($web_config['security_level'] == 20) { $app->system->chmod($data['new']['document_root'], 0755); - $app->system->chmod($data['new']['document_root'].'/web', 0710); + $app->system->chmod($data['new']['document_root'].'/web', 0711); $app->system->chmod($data['new']['document_root'].'/webdav', 0710); $app->system->chmod($data['new']['document_root'].'/private', 0710); $app->system->chmod($data['new']['document_root'].'/ssl', 0755); diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index abe085862c39397535b03c45d4cb6f81f3440125..127161eb470bdcc64f2a20a63eacf53df819e129 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -693,7 +693,7 @@ class nginx_plugin { if($web_config['security_level'] == 20) { $app->system->chmod($data['new']['document_root'], 0755); - $app->system->chmod($data['new']['document_root'].'/web', 0710); + $app->system->chmod($data['new']['document_root'].'/web', 0711); //$app->system->chmod($data['new']['document_root'].'/webdav',0710); $app->system->chmod($data['new']['document_root'].'/private', 0710); $app->system->chmod($data['new']['document_root'].'/ssl', 0755);