Skip to content

Commit ddb461f

Browse files
author
Marius Cramer
committed
Merge remote-tracking branch 'origin/stable-3.0.5'
Conflicts: interface/lib/classes/remoting.inc.php interface/lib/classes/remoting_lib.inc.php interface/lib/classes/tform.inc.php interface/web/admin/lib/lang/de_server_config.lng interface/web/admin/lib/lang/de_system_config.lng interface/web/admin/lib/lang/en_server_config.lng interface/web/client/lib/lang/en_client.lng interface/web/client/lib/lang/en_reseller.lng interface/web/login/lib/lang/de.lng interface/web/mail/form/mail_user.tform.php interface/web/mail/lib/lang/de_mail_user.lng interface/web/mail/lib/lang/en_mail_user.lng interface/web/sites/lib/lang/de_web_domain.lng interface/web/sites/lib/lang/de_web_vhost_subdomain.lng interface/web/sites/web_domain_edit.php server/cron_daily.php server/plugins-available/backup_plugin.inc.php
2 parents c1ff905 + c3d8a84 commit ddb461f

File tree

88 files changed

+2724
-132
lines changed

Some content is hidden

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

88 files changed

+2724
-132
lines changed

install/lib/install.lib.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,8 @@ function get_system_timezone() {
811811
exec('date +%Z', $tzinfo);
812812
$timezone = $tzinfo[0];
813813
}
814+
815+
if(substr($timezone, 0, 1) === '/') $timezone = substr($timezone, 1);
814816

815817
return $timezone;
816818
}

install/sql/ispconfig3.sql

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ CREATE TABLE `client` (
236236
`tmp_data` mediumblob,
237237
`id_rsa` varchar(2000) NOT NULL DEFAULT '',
238238
`ssh_rsa` varchar(600) NOT NULL DEFAULT '',
239+
`customer_no_template` varchar(255) DEFAULT 'C[CUSTOMER_NO]',
240+
`customer_no_start` int(11) NOT NULL DEFAULT '1',
241+
`customer_no_counter` int(11) NOT NULL DEFAULT '0',
242+
`added_date` date NOT NULL DEFAULT '0000-00-00',
243+
`added_by` varchar(255) DEFAULT NULL,
239244
PRIMARY KEY (`client_id`)
240245
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
241246

@@ -977,7 +982,7 @@ CREATE TABLE IF NOT EXISTS `openvz_ostemplate` (
977982
-- Dumping data for table `openvz_ostemplate`
978983
--
979984

980-
INSERT INTO `openvz_ostemplate` (`ostemplate_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `template_file`, `server_id`, `allservers`, `active`, `description`) VALUES(1, 1, 1, 'riud', 'riud', '', 'Debian minimal', 'debian-minimal-x86', 1, 'y', 'y', 'Debain minmal image.');
985+
INSERT INTO `openvz_ostemplate` (`ostemplate_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `template_file`, `server_id`, `allservers`, `active`, `description`) VALUES(1, 1, 1, 'riud', 'riud', '', 'Debian minimal', 'debian-minimal-x86', 1, 'y', 'y', 'Debian minimal image.');
981986

982987
-- --------------------------------------------------------
983988

@@ -1606,6 +1611,7 @@ CREATE TABLE `sys_session` (
16061611
`session_id` varchar(64) NOT NULL DEFAULT '',
16071612
`date_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
16081613
`last_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1614+
`permanent` enum('n','y') NOT NULL DEFAULT 'n',
16091615
`session_data` longtext,
16101616
PRIMARY KEY (`session_id`),
16111617
KEY `last_updated` (`last_updated`)
@@ -1820,12 +1826,15 @@ CREATE TABLE `web_domain` (
18201826
`custom_php_ini` mediumtext,
18211827
`backup_interval` VARCHAR( 255 ) NOT NULL DEFAULT 'none',
18221828
`backup_copies` INT NOT NULL DEFAULT '1',
1829+
`backup_excludes` mediumtext,
18231830
`active` enum('n','y') NOT NULL default 'y',
18241831
`traffic_quota_lock` enum('n','y') NOT NULL default 'n',
18251832
`fastcgi_php_version` varchar(255) DEFAULT NULL,
18261833
`proxy_directives` mediumtext,
18271834
`last_quota_notification` date NULL default NULL,
18281835
`rewrite_rules` mediumtext,
1836+
`added_date` date NOT NULL DEFAULT '0000-00-00',
1837+
`added_by` varchar(255) DEFAULT NULL,
18291838
PRIMARY KEY (`domain_id`)
18301839
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
18311840

@@ -2240,5 +2249,6 @@ INSERT INTO `sys_user` (`userid`, `sys_userid`, `sys_groupid`, `sys_perm_user`,
22402249
--
22412250

22422251
INSERT INTO sys_config VALUES ('1','db','db_version','3.0.5.3');
2252+
INSERT INTO sys_config VALUES ('2','interface','session_timeout','0');
22432253

22442254
SET FOREIGN_KEY_CHECKS = 1;

install/tpl/apache_apps.vhost.master

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
ServerAdmin webmaster@localhost
1212
{apps_vhost_servername}
1313

14+
<FilesMatch "\.ph(p3?|tml)$">
15+
SetHandler None
16+
</FilesMatch>
17+
1418
<IfModule mod_php5.c>
1519
DocumentRoot {apps_vhost_dir}
1620
AddType application/x-httpd-php .php
@@ -31,12 +35,11 @@
3135
AllowOverride AuthConfig Indexes Limit Options FileInfo
3236
AddHandler fcgid-script .php
3337
FCGIWrapper {website_basedir}/php-fcgi-scripts/apps/.php-fcgi-starter .php
38+
# FcgidBusyTimeout 3600
3439
Order allow,deny
3540
Allow from all
3641
</Directory>
3742
</IfModule>
38-
39-
ServerSignature Off
4043

4144
</VirtualHost>
4245

install/tpl/server.ini.master

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ firewall=bastille
1616
loglevel=2
1717
admin_notify_events=1
1818
backup_dir=/var/backup
19+
backup_dir_is_mount=n
20+
backup_dir_mount_cmd=
1921
backup_mode=rootgz
2022
monit_url=
2123
monit_user=

install/tpl/system.ini.master

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,8 @@ reseller_dashlets_left=
4747
reseller_dashlets_right=
4848
client_dashlets_left=
4949
client_dashlets_right=
50+
customer_no_template=C[CUSTOMER_NO]
51+
customer_no_start=1
52+
customer_no_counter=0
53+
session_timeout=0
54+
session_allow_endless=0

interface/lib/app.inc.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,31 @@ public function __construct() {
6666
if($this->_conf['start_session'] == true) {
6767

6868
$this->uses('session');
69+
$tmp = $this->db->queryOneRecord("SELECT `value` FROM sys_config WHERE `config_id` = 2 AND `group` = 'interface' AND `name` = 'session_timeout'");
70+
if($tmp && $tmp['value'] > 0) {
71+
/* check if user wants to stay logged in */
72+
if(isset($_POST['s_mod']) && isset($_POST['s_pg']) && $_POST['s_mod'] == 'login' && $_POST['s_pg'] == 'index' && isset($_POST['stay']) && $_POST['stay'] == '1') {
73+
/* check if staying logged in is allowed */
74+
$this->uses('ini_parser');
75+
$tmp = $this->db->queryOneRecord('SELECT config FROM sys_ini WHERE sysini_id = 1');
76+
$tmp = $this->ini_parser->parse_ini_string(stripslashes($tmp['config']));
77+
if(!isset($tmp['misc']['session_allow_endless']) || $tmp['misc']['session_allow_endless'] != 'y') {
78+
$this->session->set_timeout($tmp['value']);
79+
session_set_cookie_params(($tmp['value'] * 60) + 300); // make the cookie live 5 minutes longer
80+
} else {
81+
// we are doing login here, so we need to set the session data
82+
$this->session->set_permanent(true);
83+
$this->session->set_timeout(365 * 24 * 3600); // one year
84+
session_set_cookie_params(365 * 24 * 3600); // make the cookie live 5 minutes longer
85+
}
86+
} else {
87+
$this->session->set_timeout($tmp['value']);
88+
session_set_cookie_params(($tmp['value'] * 60) + 300); // make the cookie live 5 minutes longer
89+
}
90+
} else {
91+
session_set_cookie_params(0); // until browser is closed
92+
}
93+
6994
session_set_save_handler( array($this->session, 'open'),
7095
array($this->session, 'close'),
7196
array($this->session, 'read'),
@@ -74,7 +99,7 @@ public function __construct() {
7499
array($this->session, 'gc'));
75100

76101
session_start();
77-
102+
78103
//* Initialize session variables
79104
if(!isset($_SESSION['s']['id']) ) $_SESSION['s']['id'] = session_id();
80105
if(empty($_SESSION['s']['theme'])) $_SESSION['s']['theme'] = $conf['theme'];

interface/lib/classes/aps_guicontroller.inc.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ public function getNewestPackageID($id)
155155
CONCAT(version, '-', CAST(`release` AS CHAR)) AS current_version
156156
FROM aps_packages
157157
WHERE name = (SELECT name FROM aps_packages WHERE id = ".$app->db->quote($id).")
158+
AND package_status = 2
158159
ORDER BY REPLACE(version, '.', '')+0 DESC, `release` DESC");
159160

160161
if(!empty($result) && ($id != $result['id'])) return $result['id'];

interface/lib/classes/ispcmail.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,11 +697,11 @@ public function send($recipients) {
697697
$recipname = $this->_encodeHeader($recipname, $this->mail_charset);
698698

699699
//Email From
700-
fputs($this->_smtp_conn, 'MAIL FROM: ' . $this->_mail_sender . $this->_crlf);
700+
fputs($this->_smtp_conn, 'MAIL FROM: <' . $this->_mail_sender . '>' . $this->_crlf);
701701
$response = fgets($this->_smtp_conn, 515);
702702

703703
//Email To
704-
fputs($this->_smtp_conn, 'RCPT TO: ' . $recip . $this->_crlf);
704+
fputs($this->_smtp_conn, 'RCPT TO: <' . $recip . '>' . $this->_crlf);
705705
$response = fgets($this->_smtp_conn, 515);
706706

707707
//The Email

interface/lib/classes/session.inc.php

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,22 @@ class session {
3232

3333
private $session_array = array();
3434
private $db;
35+
private $timeout = 0;
36+
private $permanent = false;
3537

36-
function __construct() {
38+
function __construct($session_timeout = 0) {
3739
$this->db = new db;
40+
$this->timeout = $session_timeout;
41+
}
42+
43+
function set_timeout($session_timeout = 0) {
44+
$old_timeout = $this->timeout;
45+
$this->timeout = $session_timeout;
46+
return $old_timeout;
47+
}
48+
49+
function set_permanent($value = false) {
50+
$this->permanent = $value;
3851
}
3952

4053
function open ($save_path, $session_name) {
@@ -51,8 +64,12 @@ function close () {
5164
}
5265

5366
function read ($session_id) {
54-
55-
$rec = $this->db->queryOneRecord("SELECT * FROM sys_session WHERE session_id = '".$this->db->quote($session_id)."'");
67+
68+
if($this->timeout > 0) {
69+
$rec = $this->db->queryOneRecord("SELECT * FROM sys_session WHERE session_id = '".$this->db->quote($session_id)."' AND (`permanent` = 'y' OR last_updated >= DATE_SUB(NOW(), INTERVAL " . intval($this->timeout) . " MINUTE))");
70+
} else {
71+
$rec = $this->db->queryOneRecord("SELECT * FROM sys_session WHERE session_id = '".$this->db->quote($session_id)."'");
72+
}
5673

5774
if (is_array($rec)) {
5875
$this->session_array = $rec;
@@ -82,14 +99,14 @@ function write ($session_id, $session_data) {
8299
$date_created = date('Y-m-d H:i:s');
83100
$last_updated = date('Y-m-d H:i:s');
84101
$session_data = $this->db->quote($session_data);
85-
$sql = "INSERT INTO sys_session (session_id,date_created,last_updated,session_data) VALUES ('$session_id','$date_created','$last_updated','$session_data')";
102+
$sql = "INSERT INTO sys_session (session_id,date_created,last_updated,session_data,permanent) VALUES ('$session_id','$date_created','$last_updated','$session_data','" . ($this->permanent ? 'y' : 'n') . "')";
86103
$this->db->query($sql);
87104

88105
} else {
89106
$session_id = $this->db->quote($session_id);
90107
$last_updated = date('Y-m-d H:i:s');
91108
$session_data = $this->db->quote($session_data);
92-
$sql = "UPDATE sys_session SET last_updated = '$last_updated', session_data = '$session_data' WHERE session_id = '$session_id'";
109+
$sql = "UPDATE sys_session SET last_updated = '$last_updated', session_data = '$session_data'" . ($this->permanent ? ", `permanent` = 'y'" : "") . " WHERE session_id = '$session_id'";
93110
$this->db->query($sql);
94111

95112
}
@@ -108,12 +125,23 @@ function destroy ($session_id) {
108125

109126
function gc ($max_lifetime) {
110127

111-
$real_now = date('Y-m-d H:i:s');
112-
$dt1 = strtotime("$real_now -$max_lifetime seconds");
113-
$dt2 = date('Y-m-d H:i:s', $dt1);
128+
/*if($this->timeout > 0) {
129+
$this->db->query("DELETE FROM sys_session WHERE last_updated < DATE_SUB(NOW(), INTERVAL " . intval($this->timeout) . " MINUTE)");
130+
} else {*/
131+
$real_now = date('Y-m-d H:i:s');
132+
$dt1 = strtotime("$real_now -$max_lifetime seconds");
133+
$dt2 = date('Y-m-d H:i:s', $dt1);
114134

115-
$sql = "DELETE FROM sys_session WHERE last_updated < '$dt2'";
116-
$this->db->query($sql);
135+
$sql = "DELETE FROM sys_session WHERE last_updated < '$dt2' AND `permanent` != 'y'";
136+
$this->db->query($sql);
137+
138+
/* delete very old even if they are permanent */
139+
$dt1 = strtotime("$real_now -365 days");
140+
$dt2 = date('Y-m-d H:i:s', $dt1);
141+
142+
$sql = "DELETE FROM sys_session WHERE last_updated < '$dt2'";
143+
$this->db->query($sql);
144+
//}
117145

118146
return true;
119147

interface/lib/config.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@
4444

4545
//** Application
4646
define('ISPC_APP_TITLE', 'ISPConfig');
47-
define('ISPC_APP_VERSION', '3.0.2');
47+
define('ISPC_APP_VERSION', '3.0.5.3');
4848
define('DEVSYSTEM', 0);
4949

5050

5151
//** Database
5252
$conf['db_type'] = 'mysql';
5353
$conf['db_host'] = 'localhost';
54-
$conf['db_database'] = 'ispconfig3';
54+
$conf['db_database'] = 'ispconfig3_305';
5555
$conf['db_user'] = 'root';
5656
$conf['db_password'] = '';
5757
$conf['db_charset'] = 'utf8'; // same charset as html-charset - (HTML --> MYSQL: "utf-8" --> "utf8", "iso-8859-1" --> "latin1")

0 commit comments

Comments
 (0)