Commit 86bc6556 authored by Marius Cramer's avatar Marius Cramer

- ported some patches

parent 72773a67
......@@ -2514,7 +2514,11 @@ Email Address []:
if(is_file('/usr/local/ispconfig/interface/lib/classes/db_firebird.inc.php')) unlink('/usr/local/ispconfig/interface/lib/classes/db_firebird.inc.php');
if(is_file('/usr/local/ispconfig/interface/lib/classes/form.inc.php')) unlink('/usr/local/ispconfig/interface/lib/classes/form.inc.php');
// Change mode of a few files from amavisd
if(is_file($conf['amavis']['config_dir'].'/conf.d/50-user')) chmod($conf['amavis']['config_dir'].'/conf.d/50-user', 0640);
if(is_file($conf['amavis']['config_dir'].'/50-user~')) chmod($conf['amavis']['config_dir'].'/50-user~', 0400);
if(is_file($conf['amavis']['config_dir'].'/amavisd.conf')) chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0640);
if(is_file($conf['amavis']['config_dir'].'/amavisd.conf~')) chmod($conf['amavis']['config_dir'].'/amavisd.conf~', 0400);
}
......
......@@ -710,7 +710,7 @@ class tform_base {
if($record[$key] != '' && $record[$key] != '0000-00-00') {
if(function_exists('date_parse_from_format')) {
$date_parts = date_parse_from_format($this->dateformat, $record[$key]);
$new_record[$key] = $date_parts['year'].'-'.$date_parts['month'].'-'.$date_parts['day'];
$new_record[$key] = $date_parts['year'].'-'.str_pad($date_parts['month'], 2, "0", STR_PAD_LEFT).'-'.str_pad($date_parts['day'], 2, "0", STR_PAD_LEFT);
} else {
$tmp = strtotime($record[$key]);
$new_record[$key] = date('Y-m-d', $tmp);
......
......@@ -276,6 +276,15 @@ $form["tabs"]['domain'] = array (
'default' => 'n',
'value' => array(0 => 'n', 1 => 'y')
),
'enable_pagespeed' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'n',
'value' => array (
0 => 'n',
1 => 'y'
)
),
'active' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
......
......@@ -217,6 +217,12 @@
</select></div>
</div>
{tmpl_var name="directive_snippets_id"}
<div class="form-group nginx pagespeed">
<label class="col-sm-3 control-label">{tmpl_var name='enable_pagespeed_txt'}</label>
<div class="col-sm-9">
{tmpl_var name="enable_pagespeed"}
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">{tmpl_var name='active_txt'}</label>
<div class="col-sm-9">
......@@ -276,6 +282,19 @@
});
// new Vhostsubdomains/Vhostaliasdomains
if(serverId == '') jQuery('#parent_domain_id').trigger('change');
if(jQuery('#directive_snippets_id').val() > 0){
jQuery('.pagespeed').show();
} else {
jQuery('.pagespeed').hide();
}
jQuery('#directive_snippets_id').change(function(){
if(jQuery(this).val() > 0){
jQuery('.pagespeed').show();
} else {
jQuery('.pagespeed').hide();
}
});
function reloadServerId(noFormChange) {
var parentWebId = jQuery('#parent_domain_id').val();
......@@ -291,6 +310,19 @@
if(data.servertype == "nginx"){
var selected = jQuery('#php').val();
jQuery('.apache').hide();
jQuery('.nginx').show();
if(jQuery('#directive_snippets_id').val() > 0){
jQuery('.pagespeed').show();
} else {
jQuery('.pagespeed').hide();
}
jQuery('#directive_snippets_id').change(function(){
if(jQuery(this).val() > 0){
jQuery('.pagespeed').show();
} else {
jQuery('.pagespeed').hide();
}
});
if(selected != "no" && selected != "php-fpm" && selected != "hhvm") {
jQuery('#php option[value="php-fpm"]').attr('selected', 'selected').val('php-fpm');
}
......@@ -299,6 +331,7 @@
jQuery('#php option[value="mod"]').hide();
jQuery('#php option[value="suphp"]').hide();
} else {
jQuery('.nginx').hide();
jQuery('.apache').show();
jQuery('#php option[value="fast-cgi"]').show();
jQuery('#php option[value="cgi"]').show();
......
......@@ -1091,6 +1091,7 @@ class page_action extends tform_actions {
if($web_config['enable_spdy'] === 'n') {
unset($app->tform->formDef["tabs"]['ssl']['fields']['enable_spdy']);
}
if($this->dataRecord["directive_snippets_id"] < 1) $this->dataRecord["enable_pagespeed"] = 'n';
parent::onSubmit();
}
......
......@@ -8,7 +8,7 @@ server {
listen <tmpl_var name='ip_address'>:443 ssl{tmpl_if name='enable_spdy' op='==' value='y'} spdy{/tmpl_if};
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
<tmpl_if name='ipv6_enabled'>
listen [<tmpl_var name='ipv6_address'>]:443 ssl{tmpl_if name='enable_spdy' op='==' value='y'} spdy{/tmpl_if};;
listen [<tmpl_var name='ipv6_address'>]:443 ssl{tmpl_if name='enable_spdy' op='==' value='y'} spdy{/tmpl_if};
</tmpl_if>
ssl_certificate <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.crt;
ssl_certificate_key <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.key;
......@@ -192,6 +192,54 @@ server {
<tmpl_var name='nginx_directive'>
</tmpl_loop>
<tmpl_if name='enable_pagespeed' op='==' value='y'>
pagespeed on;
pagespeed FileCachePath /var/ngx_pagespeed_cache;
<tmpl_if name='ssl_enabled'>pagespeed FetchHttps enable,allow_self_signed;</tmpl_if>
# let's speed up PageSpeed by storing it in the super duper fast memcached
pagespeed MemcachedThreads 1;
pagespeed MemcachedServers "localhost:11211";
# Filter settings
pagespeed RewriteLevel CoreFilters;
pagespeed EnableFilters collapse_whitespace,remove_comments;
# Ensure requests for pagespeed optimized resources go to the pagespeed
# handler and no extraneous headers get set.
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
access_log off;
}
location ~ "^/ngx_pagespeed_static/" {
access_log off;
}
location ~ "^/ngx_pagespeed_beacon$" {
access_log off;
}
location /ngx_pagespeed_statistics {
allow 127.0.0.1;
deny all;
access_log off;
}
location /ngx_pagespeed_global_statistics {
allow 127.0.0.1;
deny all;
access_log off;
}
location /ngx_pagespeed_message {
allow 127.0.0.1;
deny all;
access_log off;
}
location /pagespeed_console {
allow 127.0.0.1;
deny all;
access_log off;
}
</tmpl_if>
<tmpl_loop name="basic_auth_locations">
location <tmpl_var name='htpasswd_location'> { ##merge##
auth_basic "Members Only";
......
......@@ -1097,8 +1097,19 @@ class nginx_plugin {
} else {
$nginx_directives = $data['new']['nginx_directives'];
}
if($data['new']['enable_pagespeed'] == 'y'){
// if PageSpeed is already enabled, don't add configuration again
if(stripos($nginx_directives, 'pagespeed') !== false){
$vhost_data['enable_pagespeed'] = false;
} else {
$vhost_data['enable_pagespeed'] = true;
}
} else {
$vhost_data['enable_pagespeed'] = false;
}
} else {
$nginx_directives = $data['new']['nginx_directives'];
$vhost_data['enable_pagespeed'] = false;
}
// Make sure we only have Unix linebreaks
$nginx_directives = str_replace("\r\n", "\n", $nginx_directives);
......
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