Commit 7883fc57 authored by Florian Schaal's avatar Florian Schaal
parents ae3cf84b 9893e01f
......@@ -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');
......
ALTER TABLE `sys_config` DROP `config_id`,
ADD PRIMARY KEY (`group`, `name`);
......@@ -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;
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}
......
......@@ -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 */
......
<?php
$function_list['server_get,get_function_list,client_templates_get_all,server_get_serverid_by_ip,server_ip_add,server_ip_update,server_ip_delete'] = 'Server functions';
$function_list['server_get,get_function_list,client_templates_get_all,server_get_serverid_by_ip,server_ip_get,server_ip_add,server_ip_update,server_ip_delete'] = 'Server functions';
$function_list['admin_record_permissions'] = 'Record permission changes';
?>
......@@ -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);
......
......@@ -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';
?>
......@@ -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'].'<br />';
}
}
$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'].'<br />';
}
}
$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'].'<br />';
}
}
}
//* 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'].'<br />';
unset($tmp);
}
}
}
$app->tpl->setVar('msg', $msg);
$app->tpl->setVar('error', $error);
......
......@@ -52,6 +52,12 @@
<div class="multiField">
<input id="resync_dns" type="checkbox" value="1" name="resync_dns" />
</div>
</div>
<div class="ctrlHolder">
<p class="label">{tmpl_var name="resync_client_txt"}</p>
<div class="multiField">
<input id="resync_client" type="checkbox" value="1" name="resync_client" />
</div>
</div>
</fieldset>
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment