From 492d6b6680b820670bc894c0102fe96780c660ba Mon Sep 17 00:00:00 2001
From: dcz
Date: Mon, 15 Sep 2014 12:44:05 +0200
Subject: [PATCH 1/2] [ticket/42] Generate ngix rewrite rules from acp
---
acp/usu.php | 801 +++++++++++-------
acp/usu_info.php | 12 +-
adm/style/event/acp_overall_footer_after.html | 64 +-
language/en/acp_usu.php | 38 +-
language/en/info_acp_usu.php | 2 +-
language/fr/acp_usu.php | 38 +-
language/fr/info_acp_usu.php | 2 +-
migrations/release_2_0_0_b2.php | 26 +
8 files changed, 597 insertions(+), 386 deletions(-)
diff --git a/acp/usu.php b/acp/usu.php
index e4cf0ce..49142b1 100644
--- a/acp/usu.php
+++ b/acp/usu.php
@@ -48,7 +48,6 @@ class usu
var $array_type_cfg = array();
var $multiple_options = array();
var $modrtype_lang = array();
- var $write_type = 'forum';
var $lengh_limit = 20;
var $word_limit = 3;
var $seo_unset_opts = array();
@@ -136,7 +135,6 @@ function main($id, $mode)
switch ($mode)
{
case 'settings':
- $this->write_type = 'forum';
$display_vars['title'] = 'ACP_PHPBB_SEO_CLASS';
$this->user->lang['ACP_PHPBB_SEO_CLASS_EXPLAIN'] = sprintf($this->user->lang['ACP_PHPBB_SEO_CLASS_EXPLAIN'], $this->modrtype_lang['ulink'], $this->modrtype_lang['uforumlink'], '
' . $this->user->lang['ACP_PHPBB_SEO_MODE'] . ' : ' . $this->modrtype_lang['link'] . ' - ( ' . $this->modrtype_lang['forumlink'] . ' )
');
$display_vars['vars'] = array();
@@ -193,8 +191,6 @@ function main($id, $mode)
break;
case 'forum_url':
- // used for cache
- $this->write_type = 'forum';
$forbidden = array(
$this->core->seo_static['forum'],
@@ -310,13 +306,17 @@ function main($id, $mode)
break;
- case 'htaccess':
- $this->write_type = 'htaccess';
- $display_vars['title'] = 'ACP_HTACCESS';
- $this->user->lang['ACP_HTACCESS_EXPLAIN'] .= '
' . $this->user->lang['ACP_PHPBB_SEO_VERSION'] . ' : ' . $this->modrtype_lang['link'] . ' - ( ' . $this->modrtype_lang['forumlink'] . ' )
';
+ case 'server':
+
+ $display_vars['title'] = 'ACP_REWRITE_CONF';
+ $this->user->lang['ACP_REWRITE_CONF_EXPLAIN'] .= '
' . $this->user->lang['ACP_PHPBB_SEO_VERSION'] . ' : ' . $this->modrtype_lang['link'] . ' - ( ' . $this->modrtype_lang['forumlink'] . ' )
';
$display_vars['vars'] = array();
- $display_vars['vars']['legend1'] = 'ACP_HTACCESS';
- $display_vars['vars']['save'] = array('lang' => 'SEO_HTACCESS_SAVE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true);
+ $display_vars['vars']['legend1'] = 'ACP_REWRITE_CONF';
+ if ($this->core->seo_path['phpbb_script'] && !$this->core->seo_opt['virtual_root'])
+ {
+ $display_vars['vars']['rbase'] = array('lang' => 'SEO_SERVER_CONF_RBASE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true);
+ }
+ $display_vars['vars']['save'] = array('lang' => 'SEO_SERVER_CONF_SAVE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true);
$display_vars['vars']['more_options'] = array('lang' => 'SEO_MORE_OPTION', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true);
$this->new_config['save'] = false;
$cfg_array = ($this->request->is_set('config')) ? utf8_normalize_nfc($this->request->variable('config', array('' => ''), true)) : $this->new_config;
@@ -325,19 +325,14 @@ function main($id, $mode)
$this->new_config['wslash'] = isset($cfg_array['wslash']) ? $cfg_array['wslash'] : false;
$this->new_config['rbase'] = isset($cfg_array['rbase']) ? $cfg_array['rbase'] : false;
- if ($this->core->seo_path['phpbb_script'] && !$this->core->seo_opt['virtual_root'])
- {
- $display_vars['vars']['rbase'] = array('lang' => 'SEO_HTACCESS_RBASE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true);
- }
-
if ($this->new_config['more_options'])
{
- $display_vars['vars']['slash'] = array('lang' => 'SEO_HTACCESS_SLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true);
- $display_vars['vars']['wslash'] = array('lang' => 'SEO_HTACCESS_WSLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true);
+ $display_vars['vars']['slash'] = array('lang' => 'SEO_SERVER_CONF_SLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true);
+ $display_vars['vars']['wslash'] = array('lang' => 'SEO_SERVER_CONF_WSLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true);
}
// Dirty yet simple templating
- $this->user->lang['ACP_HTACCESS_EXPLAIN'] .= $this->seo_htaccess();
+ $this->user->lang['ACP_REWRITE_CONF_EXPLAIN'] .= $this->seo_server_conf();
$this->template->assign_vars(array(
'S_SEO_HTACCESS' => 1,
@@ -742,11 +737,11 @@ function main($id, $mode)
if ($submit)
{
- if ($mode == 'htaccess')
+ if ($mode == 'server')
{
if ($this->new_config['save'])
{
- $this->write_cache($this->write_type);
+ $this->seo_server_conf(false);
add_log('admin', 'SEO_LOG_CONFIG_' . strtoupper($mode));
}
@@ -759,12 +754,18 @@ function main($id, $mode)
}
else
{
- if ($this->write_cache($this->write_type))
+ // config
+ $file = $this->core->cache_config['file'];
+ ksort($this->core->cache_config['forum_urls']);
+
+ $update = '<'.'?php' . "\n" . '/**' . "\n" . '* phpBB SEO' . "\n" . '* www.phpBB-SEO.com' . "\n" . '* @package phpBB SEO USU' . "\n" . '*/' . "\n" . 'if (!defined(\'IN_PHPBB\')) {' . "\n\t" . 'exit;' . "\n" . '}' . "\n";
+ $update .= '$settings = ' . preg_replace('`[\s]+`', ' ', var_export($this->core->cache_config['settings'], true)) . ';'. "\n";
+ $update .= '$forum_urls = ' . preg_replace('`[\s]+`', ' ', var_export($this->core->cache_config['forum_urls'], true)) . ';';
+
+ if ($this->write_cache($file, $update))
{
global $msg_long_text;
- ksort($this->core->cache_config[$this->write_type]);
-
add_log('admin', 'SEO_LOG_CONFIG_' . strtoupper($mode));
$msg = !empty($seo_msg) ? '
' . $this->user->lang['SEO_VALIDATE_INFO'] . '
' . implode(' ', $seo_msg) . '
' : '';
@@ -792,7 +793,7 @@ function main($id, $mode)
if ($mode != 'extended')
{
- $l_title_explain .= $mode == 'htaccess' ? '' : $this->check_cache_folder($this->core->seo_opt['cache_folder']);
+ $l_title_explain .= $mode == 'server' ? '' : $this->check_cache_folder($this->core->seo_opt['cache_folder']);
}
$this->template->assign_vars(array(
@@ -932,357 +933,531 @@ function seo_advices($url, $forum_id, $cached = false, $error_cust = '')
}
/**
- * seo_htaccess The evil one ;-)
+ * seo_server_conf The evil one ;-)
*/
- function seo_htaccess($html = true)
+ function seo_server_conf($html = true)
{
- $htaccess_code = '';
- $htaccess_tpl = '';
-
- if (empty($htaccess_code))
+ // get mods server_conf tpls
+ $mods_ht = $this->get_mods_server_conf();
+ $default_slash = '/';
+ $wierd_slash = '';
+ $phpbb_path = trim($this->core->seo_path['phpbb_script'], '/');
+ $show_rewritebase_opt = false;
+ $rewritebase = '';
+ $wierd_slash = $this->new_config['wslash'] ? '/' : '';
+ $default_slash = $this->new_config['slash'] ? '' : '/';
+
+ $red_slash = '/';
+
+ if (!empty($phpbb_path))
{
- // get mods .htaccess tpls
- $mods_ht = $this->get_mods_ht();
- $default_slash = '/';
- $wierd_slash = '';
- $phpbb_path = trim($this->core->seo_path['phpbb_script'], '/');
- $show_rewritebase_opt = false;
- $rewritebase = '';
- $wierd_slash = $this->new_config['wslash'] ? '/' : '';
- $default_slash = $this->new_config['slash'] ? '' : '/';
-
- if (!empty($phpbb_path))
- {
- $phpbb_path = $phpbb_path . '/';
+ $phpbb_path = $phpbb_path . '/';
- if ($this->new_config['rbase'])
- {
- $rewritebase = $phpbb_path;
- $default_slash = $this->new_config['slash'] ? '/' : '';
- }
-
- $rewritebase = $this->new_config['rbase'] ? $phpbb_path : '';
- $show_rewritebase_opt = $this->core->seo_opt['virtual_root'] ? false : true;
+ if ($this->new_config['rbase'])
+ {
+ $rewritebase = $phpbb_path;
+ $default_slash = $this->new_config['slash'] ? '/' : '';
}
- $colors = array(
- 'color' => '%2$s',
- 'static' => '#A020F0',
- 'ext' => '#6A5ACD',
- 'delim' => '#FF00FF',
- );
+ $show_rewritebase_opt = $this->core->seo_opt['virtual_root'] ? false : true;
+ }
- $tpl = array(
- 'paginpage' => '/?(%1$s([0-9]+)%2$s)?',
- 'pagin' => '(%1$s([0-9]+))?%2$s',
- 'static' => sprintf($colors['color'] , $colors['static'], '%1$s'),
- 'ext' => sprintf($colors['color'] , $colors['ext'], '%1$s'),
- 'delim' => sprintf($colors['color'] , $colors['delim'], '%1$s'),
- );
+ $colors = array(
+ 'color' => '%2$s',
+ 'static' => '#A020F0',
+ 'ext' => '#6A5ACD',
+ 'delim' => '#FF00FF',
+ );
- $modrtype = array(
- 1 => 'SIMPLE',
- 2 => 'MIXED',
- 1 => 'SIMPLE',
- 3 => 'ADVANCED',
- 'type' => intval($this->core->modrtype),
- );
+ $spritf_tpl = array(
+ 'paginpage' => '/?(%1$s([0-9]+)%2$s)?',
+ 'pagin' => '(%1$s([0-9]+))?%2$s',
+ 'static' => sprintf($colors['color'] , $colors['static'], '%1$s'),
+ 'ext' => sprintf($colors['color'] , $colors['ext'], '%1$s'),
+ 'delim' => sprintf($colors['color'] , $colors['delim'], '%1$s'),
+ );
- //
- $htaccess_tpl = '<IfModule mod_rewrite.c>' . "\n\n";
-
- $htaccess_tpl .= '# You may need to un-comment the following lines' . "\n";
- $htaccess_tpl .= '# Options +FollowSymlinks' . "\n";
- $htaccess_tpl .= '# To make sure that rewritten dir or file (/|.html) will not load dir.php in case it exist' . "\n";
- $htaccess_tpl .= '# Options -MultiViews' . "\n";
- $htaccess_tpl .= '# REMEBER YOU ONLY NEED TO STARD MOD REWRITE ONCE' . "\n";
- $htaccess_tpl .= 'RewriteEngine On' . "\n";
- $htaccess_tpl .= '# Uncomment the statement below if you want to make use of' . "\n";
- $htaccess_tpl .= '# HTTP authentication and it does not already work.' . "\n";
- $htaccess_tpl .= '# This could be required if you are for example using PHP via Apache CGI.' . "\n";
- $htaccess_tpl .= '# RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]' . "\n";
- $htaccess_tpl .= '# REWRITE BASE' . "\n";
- $htaccess_tpl .= 'RewriteBase /{REWRITEBASE}' . "\n";
- $htaccess_tpl .= '# HERE IS A GOOD PLACE TO FORCE CANONICAL DOMAIN' . "\n";
- $htaccess_tpl .= '# Define fully qualified ssl aware protocol' . "\n";
- $htaccess_tpl .= '# RewriteCond %{SERVER_PORT}s ^(443(s)|[0-9]+s)$' . "\n";
- $htaccess_tpl .= '# RewriteRule ^.*$ - [env=HttpFullProto:http%2://]' . "\n";
- $htaccess_tpl .= '# RewriteCond %{HTTP_HOST} !^' . str_replace(array('https://', 'http://', '.'), array('', '', '\\.'), trim($this->core->seo_path['root_url'], '/ ')) . '$ [NC]' . "\n";
- $htaccess_tpl .= '# RewriteRule ^(.*)$ ' . str_replace(array('https://', 'http://'), '%{ENV:HttpFullProto}', $this->core->seo_path['root_url']) . '{REWRITEBASE}$1 [QSA,L,R=301]' . "\n\n";
- $htaccess_tpl .= '# DO NOT GO FURTHER IF THE REQUESTED FILE / DIR DOES EXISTS' . "\n";
- $htaccess_tpl .= 'RewriteCond %{REQUEST_FILENAME} -f [OR]' . "\n";
- $htaccess_tpl .= 'RewriteCond %{REQUEST_FILENAME} -d' . "\n";
- $htaccess_tpl .= 'RewriteRule . - [L]' . "\n";
- $htaccess_tpl .= '#####################################################' . "\n";
- $htaccess_tpl .= '# PHPBB SEO REWRITE RULES ALL MODES' . "\n";
- $htaccess_tpl .= '#####################################################' . "\n";
- $htaccess_tpl .= '# AUTHOR : dcz www.phpbb-seo.com' . "\n";
- $htaccess_tpl .= '# STARTED : 01/2006' . "\n";
- $htaccess_tpl .= '#################################' . "\n";
- $htaccess_tpl .= '# FORUMS PAGES' . "\n";
- $htaccess_tpl .= '###############' . "\n";
-
- if (!empty($this->core->seo_static['index']))
- {
- $htaccess_tpl .= '# FORUM INDEX' . "\n";
- $htaccess_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_INDEX}{EXT_INDEX}$ {DEFAULT_SLASH}{PHPBB_RPATH}index.{PHP_EX} [QSA,L,NC]' . "\n";
- }
- else
- {
- $htaccess_tpl .= '# FORUM INDEX REWRITERULE WOULD STAND HERE IF USED. "forum" REQUIRES TO BE SET AS FORUM INDEX' . "\n";
- $htaccess_tpl .= '# RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}forum\.html$ {DEFAULT_SLASH}{PHPBB_RPATH}index.{PHP_EX} [QSA,L,NC]' . "\n";
- }
+ $modrtype = array(
+ 1 => 'SIMPLE',
+ 2 => 'MIXED',
+ 3 => 'ADVANCED',
+ 'type' => intval($this->core->modrtype),
+ );
- $htaccess_common_tpl = '# PHPBB FILES ALL MODES' . "\n";
- $htaccess_common_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_FILE_INDEX}{DELIM_FILE}[a-z0-9_-]+{DELIM_FILE}({STATIC_THUMB}{DELIM_FILE})?([0-9]+)$ {DEFAULT_SLASH}{PHPBB_RPATH}download/file.{PHP_EX}?id=$2&t=$1 [QSA,L,NC]' . "\n";
+ if (!empty($default_slash) && $this->new_config['more_options'])
+ {
+ $default_slash = $red_slash;
+ }
- if ($this->core->seo_opt['profile_noids'])
- {
- $htaccess_common_tpl .= '# PROFILES THROUGH USERNAME' . "\n";
- $htaccess_common_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_USER}/([^/]+)/?$ {DEFAULT_SLASH}{PHPBB_RPATH}memberlist.{PHP_EX}?mode=viewprofile&un=$1 [QSA,L,NC]' . "\n";
- $htaccess_common_tpl .= '# USER MESSAGES THROUGH USERNAME' . "\n";
- $htaccess_common_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_USER}/([^/]+)/(topics|posts){USER_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}search.{PHP_EX}?author=$1&sr=$2&start=$4 [QSA,L,NC]' . "\n";
- }
- else
- {
- $htaccess_common_tpl .= '# PROFILES ALL MODES WITH ID' . "\n";
- $htaccess_common_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}({STATIC_USER}|[a-z0-9_-]*{DELIM_USER})([0-9]+){EXT_USER}$ {DEFAULT_SLASH}{PHPBB_RPATH}memberlist.{PHP_EX}?mode=viewprofile&u=$2 [QSA,L,NC]' . "\n";
- $htaccess_common_tpl .= '# USER MESSAGES ALL MODES WITH ID' . "\n";
- $htaccess_common_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}({STATIC_USER}|[a-z0-9_-]*{DELIM_USER})([0-9]+){DELIM_SR}(topics|posts){USER_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}search.{PHP_EX}?author_id=$2&sr=$3&start=$5 [QSA,L,NC]' . "\n";
- }
+ if (!empty($wierd_slash) && $this->new_config['more_options'])
+ {
+ $wierd_slash = $red_slash;
+ }
- $htaccess_common_tpl .= '# GROUPS ALL MODES' . "\n";
- $htaccess_common_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}({STATIC_GROUP}|[a-z0-9_-]*{DELIM_GROUP})([0-9]+){GROUP_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}memberlist.{PHP_EX}?mode=group&g=$2&start=$4 [QSA,L,NC]' . "\n";
- $htaccess_common_tpl .= '# POST' . "\n";
- $htaccess_common_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_POST}([0-9]+){EXT_POST}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewtopic.{PHP_EX}?p=$1 [QSA,L,NC]' . "\n";
- $htaccess_common_tpl .= '# ACTIVE TOPICS' . "\n";
- $htaccess_common_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_ATOPIC}{ATOPIC_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}search.{PHP_EX}?search_id=active_topics&start=$2&sr=topics [QSA,L,NC]' . "\n";
- $htaccess_common_tpl .= '# UNANSWERED TOPICS' . "\n";
- $htaccess_common_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_UTOPIC}{UTOPIC_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}search.{PHP_EX}?search_id=unanswered&start=$2&sr=topics [QSA,L,NC]' . "\n";
- $htaccess_common_tpl .= '# NEW POSTS' . "\n";
- $htaccess_common_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_NPOST}{NPOST_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}search.{PHP_EX}?search_id=newposts&start=$2&sr=topics [QSA,L,NC]' . "\n";
- $htaccess_common_tpl .= '# UNREAD POSTS' . "\n";
- $htaccess_common_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_URPOST}{URPOST_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}search.{PHP_EX}?search_id=unreadposts&start=$2 [QSA,L,NC]' . "\n";
- $htaccess_common_tpl .= '# THE TEAM' . "\n";
- $htaccess_common_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_LEADERS}{EXT_LEADERS}$ {DEFAULT_SLASH}{PHPBB_RPATH}memberlist.{PHP_EX}?mode=leaders [QSA,L,NC]' . "\n";
- $htaccess_common_tpl .= '# HERE IS A GOOD PLACE TO ADD OTHER PHPBB RELATED REWRITERULES' . "\n\n";
-
- // We now handle all modes at once (simple / mixed / advanced)
- $htaccess_tpl .= '# FORUM ALL MODES' . "\n";
- $htaccess_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}({STATIC_FORUM}|[a-z0-9_-]*{DELIM_FORUM})([0-9]+){FORUM_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewforum.{PHP_EX}?f=$2&start=$4 [QSA,L,NC]' . "\n";
- $htaccess_tpl .= '# TOPIC WITH VIRTUAL FOLDER ALL MODES' . "\n";
- $htaccess_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}({STATIC_FORUM}|[a-z0-9_-]*{DELIM_FORUM})([0-9]+)/({STATIC_TOPIC}|[a-z0-9_-]*{DELIM_TOPIC})([0-9]+){TOPIC_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewtopic.{PHP_EX}?f=$2&t=$4&start=$6 [QSA,L,NC]' . "\n";
- // Not needed any more
- // $htaccess_tpl .= '# GLOBAL ANNOUNCEMENTS WITH VIRTUAL FOLDER ALL MODES' . "\n";
- // $htaccess_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_GLOBAL_ANNOUNCE}{EXT_GLOBAL_ANNOUNCE}({STATIC_TOPIC}|[a-z0-9_-]*{DELIM_TOPIC})([0-9]+){TOPIC_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewtopic.{PHP_EX}?t=$2&start=$4 [QSA,L,NC]' . "\n";
- $htaccess_tpl .= '# TOPIC WITHOUT FORUM ID & DELIM ALL MODES' . "\n";
- $htaccess_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}([a-z0-9_-]*)/?({STATIC_TOPIC}|[a-z0-9_-]*{DELIM_TOPIC})([0-9]+){TOPIC_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewtopic.{PHP_EX}?forum_uri=$1&t=$3&start=$5 [QSA,L,NC]' . "\n";
- $htaccess_tpl .= $htaccess_common_tpl;
-
- // mods .htaccess pos1
- if (!empty($mods_ht['pos1']))
- {
- $htaccess_tpl .= $mods_ht['pos1'];
- }
+ // The tpl array
+ $rewrite_tpl_vars = array();
- $htaccess_tpl .= '# FORUM WITHOUT ID & DELIM ALL MODES' . "\n";
+ // handle the suffixes properly in RegEx
+ // set up pagination RegEx
+ // set up ext bits
+ $seo_ext = array(
+ // force '/' for both / and empty ext to add /? in RegEx (which allows both cases)
+ 'pagination' => trim($this->core->seo_ext['pagination'], '/') ? str_replace('.', '\\.', $this->core->seo_ext['pagination']) : '/',
+ );
- if (trim($this->core->seo_ext['forum'],'/'))
- {
- $htaccess_tpl .= '# THESE FOUR LINES MUST BE LOCATED AT THE END OF YOUR HTACCESS TO WORK PROPERLY' . "\n";
- $htaccess_tpl .= 'RewriteCond %{REQUEST_FILENAME} !-f' . "\n";
- $htaccess_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}([a-z0-9_-]+)(-([0-9]+)){EXT_FORUM}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewforum.{PHP_EX}?forum_uri=$1&start=$3 [QSA,L,NC]' . "\n";
- $htaccess_tpl .= 'RewriteCond %{REQUEST_FILENAME} !-f' . "\n";
- $htaccess_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}([a-z0-9_-]+){EXT_FORUM}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewforum.{PHP_EX}?forum_uri=$1 [QSA,L,NC]' . "\n";
- }
- else
- {
- $htaccess_tpl .= '# THESE THREE LINES MUST BE LOCATED AT THE END OF YOUR HTACCESS TO WORK PROPERLY' . "\n";
- $htaccess_tpl .= 'RewriteCond %{REQUEST_FILENAME} !-f' . "\n";
- $htaccess_tpl .= 'RewriteCond %{REQUEST_FILENAME} !-d' . "\n";
- $htaccess_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}([a-z0-9_-]+){FORUM_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewforum.{PHP_EX}?forum_uri=$1&start=$3 [QSA,L,NC]' . "\n";
- }
+ $reg_ex_page = sprintf($spritf_tpl['paginpage'], $this->core->seo_static['pagination'], $seo_ext['pagination'] . ($seo_ext['pagination'] === '/' ? '?' : ''));
+
+ foreach ($this->core->seo_ext as $type => $value)
+ {
+ $_value = trim($value, '/');
+ // force '/' for both / and empty ext to add /? in RegEx (which allows both cases)
+ $seo_ext[$type] = $_value ? str_replace('.', '\\.', $value) : '/';
+ $rewrite_tpl_vars['{' . strtoupper($type) . '_PAGINATION}'] = $_value ? sprintf($spritf_tpl['pagin'], $this->core->seo_delim['start'], $seo_ext[$type]) : $reg_ex_page;
+ // use url/? to allow both url and url/ to work as expected
+ $rewrite_tpl_vars['{EXT_' . strtoupper($type) . '}'] = sprintf($spritf_tpl['ext'] , $seo_ext[$type]) . ($_value ? '' : '?');
+ }
- // fix for dumb clients unable to deal with base href
- $htaccess_tpl .= '# FIX RELATIVE PATHS : FILES' . "\n";
- $htaccess_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_RPATH}.+/(style\.{PHP_EX}|ucp\.{PHP_EX}|mcp\.{PHP_EX}|faq\.{PHP_EX}|download/file.{PHP_EX})$ {DEFAULT_SLASH}{PHPBB_RPATH}$1 [QSA,L,NC,R=301]' . "\n";
- $htaccess_tpl .= '# FIX RELATIVE PATHS : IMAGES' . "\n";
- $htaccess_tpl .= 'RewriteRule ^{WIERD_SLASH}{PHPBB_RPATH}.+/(styles/.*|images/.*)/$ {DEFAULT_SLASH}{PHPBB_RPATH}$1 [QSA,L,NC,R=301]' . "\n";
- $htaccess_tpl .= '# END PHPBB PAGES' . "\n";
- $htaccess_tpl .= '#####################################################' . "\n\n";
+ $rewrite_tpl_vars['{PAGE_PAGINATION}'] = $reg_ex_page;
- // mods .htaccess pos2
- if (!empty($mods_ht['pos2']))
+ // static bits
+ foreach ($this->core->seo_static as $type => $value)
+ {
+ if (!is_array($this->core->seo_static[$type]))
{
- $htaccess_tpl .= $mods_ht['pos2'];
+ $rewrite_tpl_vars['{STATIC_' . strtoupper($type) . '}'] = sprintf($spritf_tpl['static'], $this->core->seo_static[$type]);
}
+ }
+
+ // delim bits
+ foreach ($this->core->seo_delim as $type => $value)
+ {
+ $rewrite_tpl_vars['{DELIM_' . strtoupper($type) . '}'] = sprintf($spritf_tpl['delim'], $this->core->seo_delim[$type]);
+ }
- $htaccess_tpl .= '#
-# The following 3 lines will rewrite URLs passed through the front controller
-# to not require app.php in the actual URL. In other words, a controller is
-# by default accessed at /app.php/my/controller, but can also be accessed at
-# /my/controller
-#
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
-RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}(.*)$ app.{PHP_EX} [QSA,L]' . "\n\n";
+ // common server_conf vars
+ $rewrite_tpl_vars += array(
+ '{REWRITEBASE}' => $rewritebase,
+ '{PHP_EX}' => $this->php_ext,
+ '{PHPBB_LPATH}' => ($this->new_config['rbase'] || $this->core->seo_opt['virtual_root']) ? '' : $phpbb_path,
+ '{PHPBB_RPATH}' => $this->new_config['rbase'] ? '' : $phpbb_path,
+ '{DEFAULT_SLASH}' => $default_slash,
+ '{WIERD_SLASH}' => $wierd_slash,
+ '{RED_SLASH}' => $this->new_config['more_options'] ? $red_slash : '/',
+ '{MOD_RTYPE}' => $modrtype[$modrtype['type']],
+ );
- $htaccess_tpl .= '</IfModule>' . "\n\n";
+ // prettify rules
+ $prettify_common = array(
+ 'comments' => array(
+ 'find' => array(
+ '`^(\s*)(#.*)$`m',
+ '`^(\s*)(//.*)$`m',
+ '`^(\s*)(/\*.*\*/)$`Um',
+ ),
+ 'replace' => '\1\2',
+ ),
+ 'rewrite' => array(
+ 'find' => '`^(\s*)(rewrite|RewriteRule|RewriteCond|RewriteBase|RewriteEngine)`m',
+ 'replace' => '\1\2',
+ ),
+ );
- $htaccess_tpl .= '# With Apache 2.4 the "Order, Deny" syntax has been deprecated and moved from
+ $rewrite_conf = array(
+ 'apache' => array(
+ 'header' => "
+ # You may need to un-comment the following lines
+ # Options +FollowSymlinks
+ # To make sure that rewritten dir or file (/|.html) will not load dir.php in case it exist
+ # Options -MultiViews
+ # REMEBER YOU ONLY NEED TO STARD MOD REWRITE ONCE
+ RewriteEngine On
+
+ # Uncomment the statement below if you want to make use of
+ # HTTP authentication and it does not already work.
+ # This could be required if you are for example using PHP via Apache CGI.
+ # RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
+
+ # REWRITE BASE
+ RewriteBase /{REWRITEBASE}
+
+ # HERE IS A GOOD PLACE TO FORCE CANONICAL DOMAIN
+ # Define fully qualified ssl aware protocol
+ # RewriteCond %{SERVER_PORT}s ^(443(s)|[0-9]+s)$
+ # RewriteRule ^.*$ - [env=HttpFullProto:http%2://]
+ # RewriteCond %{HTTP_HOST} !^" . str_replace(array('https://', 'http://', '.'), array('', '', '\\.'), trim($this->core->seo_path['root_url'], '/ ')) . "$ [NC]
+ # RewriteRule ^(.*)$ " . str_replace(array('https://', 'http://'), '%{ENV:HttpFullProto}', $this->core->seo_path['root_url']) . "{REWRITEBASE}$1 [QSA,L,R=301]
+
+ # DO NOT GO FURTHER IF THE REQUESTED FILE / DIR DOES EXISTS
+ RewriteCond %{REQUEST_FILENAME} -f [OR]
+ RewriteCond %{REQUEST_FILENAME} -d
+ RewriteRule . - [L]",
+
+ 'footer' => ' #
+ # The following 3 lines will rewrite URLs passed through the front controller
+ # to not require app.php in the actual URL. In other words, a controller is
+ # by default accessed at /app.php/my/controller, but can also be accessed at
+ # /my/controller
+ #
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}(.*)$ app.{PHP_EX} [QSA,L]
+
+
+
+# With Apache 2.4 the "Order, Deny" syntax has been deprecated and moved from
# module mod_authz_host to a new module called mod_access_compat (which may be
# disabled) and a new "Require" syntax has been introduced to mod_authz_host.
# We could just conditionally provide both versions, but unfortunately Apache
# does not explicitly tell us its version if the module mod_version is not
# available. In this case, we check for the availability of module
# mod_authz_core (which should be on 2.4 or higher only) as a best guess.
-<IfModule mod_version.c>
- <IfVersion < 2.4>
- <Files "config.php">
+
+
+
Order Allow,Deny
Deny from All
- </Files>
- <Files "common.php">
+
+
Order Allow,Deny
Deny from All
- </Files>
- </IfVersion>
- <IfVersion >= 2.4>
- <Files "config.php">
+
+
+ = 2.4>
+
Require all denied
- </Files>
- <Files "common.php">
+
+
Require all denied
- </Files>
- </IfVersion>
-</IfModule>
-<IfModule !mod_version.c>
- <IfModule !mod_authz_core.c>
- <Files "config.php">
+
+
+
+
+
+
Order Allow,Deny
Deny from All
- </Files>
- <Files "common.php">
+
+
Order Allow,Deny
Deny from All
- </Files>
- </IfModule>
- <IfModule mod_authz_core.c>
- <Files "config.php">
+
+
+
+
Require all denied
- </Files>
- <Files "common.php">
+
+
Require all denied
- </Files>
- </IfModule>
-</IfModule>';
+
+
+',
+ 'prettify' => array(
+ 'struct' => array(
+ 'find' => array(
+ '`^(\s*)(\<(IfModule|IfVersion|Files)([^>]+)\>)$`Um',
+ '`^(\s*)(\</(IfModule|IfVersion|Files)\>)$`Um',
+ '`(\s+)(\[[A-Z0-9,=]+\])$`Um'
+ ),
+ 'replace' => array(
+ '\1<\3\4>',
+ '\1\2',
+ '\1\2',
+ ),
+ ),
+ ),
+ 'header_title' => $this->user->lang['SEO_APACHE_CONF'],
+ 'header_message' => $show_rewritebase_opt && $this->new_config['rbase'] ?
+ sprintf($this->user->lang['SEO_HTACCESS_FOLDER_MSG'], '' . $this->core->seo_path['phpbb_url'] . '') :
+ sprintf($this->user->lang['SEO_HTACCESS_ROOT_MSG'], '' . $this->core->seo_path['root_url'] . ''),
+ 'filename' => '.htaccess',
+ ),
+
+ // ngix
+ 'ngix' => array(
+ 'header' => 'location /{REWRITEBASE} {
+ # DO NOT GO FURTHER IF THE REQUESTED FILE / DIR DOES EXISTS
+ if (-e $request_filename) {
+ break;
+ }',
+ 'footer' => ' #
+ # The following 3 lines will rewrite URLs passed through the front controller
+ # to not require app.php in the actual URL. In other words, a controller is
+ # by default accessed at /app.php/my/controller, but can also be accessed at
+ # /my/controller
+ #
+ if (!-e $request_filename) {
+ rewrite ^{WIERD_SLASH}{PHPBB_RPATH}(.*)$ {DEFAULT_SLASH}{PHPBB_RPATH}app.{PHP_EX} last;
+ }
+}',
+ 'prettify' => array(
+ 'struct' => array(
+ 'find' => array(
+ '`(break|last|permanent);$`m',
+ '`^(location)`m',
+ '`^(\s*)if \(([^)]+)\) {$`Um',
+ ),
+ 'replace' => array(
+ '\1;',
+ '\1',
+ '\1if (\2) {',
+ ),
+ ),
+ ),
+ 'translate' => array(
+ 'find' => array(
+ 'RewriteRule',
+ '[QSA,L,NC]',
+ '[QSA,L,NC,R=301]',
+ '{WIERD_SLASH}',
+ '{DEFAULT_SLASH}',
+ ),
+ 'replace' => array(
+ 'rewrite',
+ 'last;',
+ 'permanent;',
+ $wierd_slash ? '' : '{RED_SLASH}',
+ $rewritebase ? ($this->new_config['slash'] ? '' : '{RED_SLASH}') : '{RED_SLASH}',
+ ),
+ ),
+ 'header_title' => $this->user->lang['SEO_NGIX_CONF'],
+ 'header_message' => $this->user->lang['SEO_NGIX_CONF_EXPLAIN'],
+ 'filename' => 'ngix.conf',
+ ),
+ );
- if (!empty($default_slash) && $this->new_config['more_options'])
- {
- $default_slash = '' . $default_slash . '';
- }
+ $rewrite_rules = array();
+ if (!empty($this->core->seo_static['index']))
+ {
+ $rewrite_rules += array(
+ 'forum_index' => ' # FORUM INDEX
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_INDEX}{EXT_INDEX}$ {DEFAULT_SLASH}{PHPBB_RPATH}index.{PHP_EX} [QSA,L,NC]',
+ );
+ }
+ else
+ {
+ $rewrite_rules += array(
+ 'forum_index' => ' # FORUM INDEX REWRITERULE WOULD STAND HERE IF USED. "forum" REQUIRES TO BE SET AS FORUM INDEX
+ # RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}forum\.html$ {DEFAULT_SLASH}{PHPBB_RPATH}index.{PHP_EX} [QSA,L,NC]',
+ );
+ }
+ $rewrite_rules += array(
+ 'forum' => ' # FORUM ALL MODES
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}({STATIC_FORUM}|[a-z0-9_-]*{DELIM_FORUM})([0-9]+){FORUM_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewforum.{PHP_EX}?f=$2&start=$4 [QSA,L,NC]',
+ 'topic_vfolder' => ' # TOPIC WITH VIRTUAL FOLDER ALL MODES
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}({STATIC_FORUM}|[a-z0-9_-]*{DELIM_FORUM})([0-9]+)/({STATIC_TOPIC}|[a-z0-9_-]*{DELIM_TOPIC})([0-9]+){TOPIC_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewtopic.{PHP_EX}?f=$2&t=$4&start=$6 [QSA,L,NC]',
+
+ 'topic_nofid' => ' # TOPIC WITHOUT FORUM ID & DELIM ALL MODES
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}([a-z0-9_-]*)/?({STATIC_TOPIC}|[a-z0-9_-]*{DELIM_TOPIC})([0-9]+){TOPIC_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewtopic.{PHP_EX}?forum_uri=$1&t=$3&start=$5 [QSA,L,NC]',
+ );
+ if ($this->core->seo_opt['profile_noids'])
+ {
+ $rewrite_rules += array(
+ 'profile' => ' # PROFILES THROUGH USERNAME
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_USER}/([^/]+)/?$ {DEFAULT_SLASH}{PHPBB_RPATH}memberlist.{PHP_EX}?mode=viewprofile&un=$1 [QSA,L,NC]',
+
+ 'user_messages' => ' USER MESSAGES THROUGH USERNAME
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_USER}/([^/]+)/(topics|posts){USER_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}search.{PHP_EX}?author=$1&sr=$2&start=$4 [QSA,L,NC]',
+ );
+ }
+ else
+ {
+ $rewrite_rules += array(
+ 'profile' => ' # PROFILES ALL MODES WITH ID
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}({STATIC_USER}|[a-z0-9_-]*{DELIM_USER})([0-9]+){EXT_USER}$ {DEFAULT_SLASH}{PHPBB_RPATH}memberlist.{PHP_EX}?mode=viewprofile&u=$2 [QSA,L,NC]',
+
+ 'user_messages' => ' # USER MESSAGES ALL MODES WITH ID
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}({STATIC_USER}|[a-z0-9_-]*{DELIM_USER})([0-9]+){DELIM_SR}(topics|posts){USER_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}search.{PHP_EX}?author_id=$2&sr=$3&start=$5 [QSA,L,NC]',
+ );
+ }
+
+ $rewrite_rules += array(
+ 'group' => ' # GROUPS ALL MODES
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}({STATIC_GROUP}|[a-z0-9_-]*{DELIM_GROUP})([0-9]+){GROUP_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}memberlist.{PHP_EX}?mode=group&g=$2&start=$4 [QSA,L,NC]',
+ 'posts' => ' # POSTS
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_POST}([0-9]+){EXT_POST}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewtopic.{PHP_EX}?p=$1 [QSA,L,NC]',
+
+ 'active_topics' => ' # ACTIVE TOPICS
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_ATOPIC}{ATOPIC_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}search.{PHP_EX}?search_id=active_topics&start=$2&sr=topics [QSA,L,NC]',
+
+ 'unanswered_topics' => ' # UNANSWERED TOPICS
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_UTOPIC}{UTOPIC_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}search.{PHP_EX}?search_id=unanswered&start=$2&sr=topics [QSA,L,NC]',
+
+ 'new_posts' => ' # NEW POSTS
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_NPOST}{NPOST_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}search.{PHP_EX}?search_id=newposts&start=$2&sr=topics [QSA,L,NC]',
+
+ 'unread_posts' => ' # UNREAD POSTS
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_URPOST}{URPOST_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}search.{PHP_EX}?search_id=unreadposts&start=$2 [QSA,L,NC]',
- // The tpl array
- $htaccess_tpl_vars = array();
+ 'the_team' => ' # THE TEAM
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}{STATIC_LEADERS}{EXT_LEADERS}$ {DEFAULT_SLASH}{PHPBB_RPATH}memberlist.{PHP_EX}?mode=leaders [QSA,L,NC]',
- // handle the suffixes proper in the RegEx
- // set up pagination reg ex
- // set up ext bits
- $seo_ext = array(
- // force '/' for both / and empty ext to add /? in RegEx (which allows both cases)
- 'pagination' => trim($this->core->seo_ext['pagination'], '/') ? str_replace('.', '\\.', $this->core->seo_ext['pagination']) : '/',
+ 'comment_more_rules' => ' # HERE IS A GOOD PLACE TO ADD OTHER PHPBB RELATED REWRITERULES
+',
+ );
+
+ // mods server_conf pos1
+ if (!empty($mods_ht['pos1']))
+ {
+ $rewrite_rules += $mods_ht['pos1'];
+ }
+ $rewrite_rules += array(
+ 'comment_forum_noid' => ' # FORUM WITHOUT ID & DELIM ALL MODES
+ # THESE LINES MUST BE LOCATED AT THE END OF YOUR HTACCESS TO WORK PROPERLY',
+ );
+ if (trim($this->core->seo_ext['forum'],'/'))
+ {
+ $rewrite_rules += array(
+ 'forum_noid' => array(
+ 'apache' => ' RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}([a-z0-9_-]+)(-([0-9]+)){EXT_FORUM}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewforum.{PHP_EX}?forum_uri=$1&start=$3 [QSA,L,NC]
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}([a-z0-9_-]+){EXT_FORUM}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewforum.{PHP_EX}?forum_uri=$1 [QSA,L,NC]',
+ 'ngix' => ' if (!-e $request_filename) {
+ rewrite ^{WIERD_SLASH}{PHPBB_LPATH}([a-z0-9_-]+)(-([0-9]+)){EXT_FORUM}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewforum.{PHP_EX}?forum_uri=$1&start=$3 last;
+ rewrite ^{WIERD_SLASH}{PHPBB_LPATH}([a-z0-9_-]+){EXT_FORUM}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewforum.{PHP_EX}?forum_uri=$1 last;
+ }',
+ ),
);
+ }
+ else
+ {
+ $rewrite_rules += array(
+ 'forum_noid' => array(
+ 'apache' => ' RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteRule ^{WIERD_SLASH}{PHPBB_LPATH}([a-z0-9_-]+){FORUM_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewforum.{PHP_EX}?forum_uri=$1&start=$3 [QSA,L,NC]',
+ 'ngix' => ' if (!-e $request_filename) {
+ rewrite ^{WIERD_SLASH}{PHPBB_LPATH}([a-z0-9_-]+){FORUM_PAGINATION}$ {DEFAULT_SLASH}{PHPBB_RPATH}viewforum.{PHP_EX}?forum_uri=$1&start=$3 last;
+ }',
+ ),
+ );
+ }
+
+ $rewrite_rules += array(
+ 'relative_files' => ' # FIX RELATIVE PATHS : FILES
+ RewriteRule ^{WIERD_SLASH}{PHPBB_RPATH}.+/(style\.{PHP_EX}|ucp\.{PHP_EX}|mcp\.{PHP_EX}|faq\.{PHP_EX}|download/file.{PHP_EX})$ {DEFAULT_SLASH}{PHPBB_RPATH}$1 [QSA,L,NC,R=301]',
+
+ 'relative_images' => ' # FIX RELATIVE PATHS : IMAGES
+ RewriteRule ^{WIERD_SLASH}{PHPBB_RPATH}.+/(styles/.*|images/.*)/$ {DEFAULT_SLASH}{PHPBB_RPATH}$1 [QSA,L,NC,R=301]',
+ );
+
+ // mods server_conf pos2
+ if (!empty($mods_ht['pos2']))
+ {
+ $rewrite_rules += $mods_ht['pos2'];
+ }
- $reg_ex_page = sprintf($tpl['paginpage'], $this->core->seo_static['pagination'], $seo_ext['pagination'] . ($seo_ext['pagination'] === '/' ? '?' : ''));
+ // build rewrite conf
+ $rewrite_conf_result = array();
+ $html_output = '';
+ foreach ($rewrite_conf as $engine => $setup)
+ {
+ $translate = !empty($setup['translate']) ? $setup['translate'] : false;
- foreach ($this->core->seo_ext as $type => $value)
+ if (!empty($translate))
{
- $_value = trim($value, '/');
- // force '/' for both / and empty ext to add /? in RegEx (which allows both cases)
- $seo_ext[$type] = $_value ? str_replace('.', '\\.', $value) : '/';
- $htaccess_tpl_vars['{' . strtoupper($type) . '_PAGINATION}'] = $_value ? sprintf($tpl['pagin'], $this->core->seo_delim['start'], $seo_ext[$type]) : $reg_ex_page;
- // use url/? to allow both url and url/ to work as expected
- $htaccess_tpl_vars['{EXT_' . strtoupper($type) . '}'] = sprintf($tpl['ext'] , $seo_ext[$type]) . ($_value ? '' : '?');
+ $setup['header'] = str_replace($translate['find'], $translate['replace'], $setup['header']);
+ $setup['footer'] = str_replace($translate['find'], $translate['replace'], $setup['footer']);
}
- $htaccess_tpl_vars['{PAGE_PAGINATION}'] = $reg_ex_page;
+ $rewrite_conf_result[$engine] = $setup['header'] . "\n";
- // static bits
- foreach ($this->core->seo_static as $type => $value)
+ // add rewrite rules
+ foreach ($rewrite_rules as $key => $rule)
{
- if (!is_array($this->core->seo_static[$type]))
+ if (is_array($rule))
+ {
+ $rule = $rule[$engine];
+ }
+ if (!empty($translate))
{
- $htaccess_tpl_vars['{STATIC_' . strtoupper($type) . '}'] = sprintf($tpl['static'], $this->core->seo_static[$type]);
+ $rule = str_replace($translate['find'], $translate['replace'], $rule);
}
+ $rewrite_conf_result[$engine] .= "$rule\n";
}
- // delim bits
- foreach ($this->core->seo_delim as $type => $value)
- {
- $htaccess_tpl_vars['{DELIM_' . strtoupper($type) . '}'] = sprintf($tpl['delim'], $this->core->seo_delim[$type]);
- }
+ $rewrite_conf_result[$engine] .= $setup['footer'] . "\n";
- // common .htaccess vars
- $htaccess_tpl_vars += array(
- '{REWRITEBASE}' => $rewritebase,
- '{PHP_EX}' => $this->php_ext,
- '{PHPBB_LPATH}' => ($this->new_config['rbase'] || $this->core->seo_opt['virtual_root']) ? '' : $phpbb_path,
- '{PHPBB_RPATH}' => $this->new_config['rbase'] ? '' : $phpbb_path,
- '{DEFAULT_SLASH}' => $default_slash,
- '{WIERD_SLASH}' => $wierd_slash,
- '{MOD_RTYPE}' => $modrtype[$modrtype['type']],
+ // parse template variables
+ $rewrite_conf_result[$engine] = array(
+ 'html' => str_replace(array_keys($rewrite_tpl_vars), array_values($rewrite_tpl_vars), utf8_htmlspecialchars($rewrite_conf_result[$engine])),
);
+ $rewrite_conf_result[$engine]['raw'] = str_replace(array('<', '>', '&'), array('<', '>', '&'), strip_tags($rewrite_conf_result[$engine]['html']));
+ if ($html)
+ {
+ // prettify
+ foreach ($prettify_common as $type => $prettify)
+ {
+ $rewrite_conf_result[$engine]['html'] = preg_replace($prettify['find'], $prettify['replace'], $rewrite_conf_result[$engine]['html']);
+ }
- // Parse .htaccess
- $htaccess_code = str_replace(array_keys($htaccess_tpl_vars), array_values($htaccess_tpl_vars), $htaccess_tpl);
- } // else the .htaccess is already generated
+ if (!empty($setup['prettify']))
+ {
+ foreach ($setup['prettify'] as $_type => $_prettify)
+ {
+ $rewrite_conf_result[$engine]['html'] = preg_replace($_prettify['find'], $_prettify['replace'], $rewrite_conf_result[$engine]['html']);
+ }
+ }
+
+ $rewrite_conf_result[$engine]['html_output'] = '
+
+
' . $setup['header_title'] . '
+ ' . $setup['header_message'] . '
+
+
+
';
+ $html_output .= $rewrite_conf_result[$engine]['html_output'];
+ }
+ }
+
+ $this->template->assign_vars(array(
+ 'SEO_REWRITE_ENGINES' => '["' . (implode('","', array_keys($rewrite_conf))) . '"]',
+ ));
if ($html)
{
// HTML output
- $htaccess_output = '';
+ $html_output = '' . $html_output;
+ $html_output .= '' . $this->user->lang['SEO_SERVER_CONF_CAPTION'] . ':
+ - ' . $this->user->lang['SEO_SERVER_CONF_CAPTION_COMMENT'] . '
+ - ' . $this->user->lang['SEO_SERVER_CONF_CAPTION_STATIC'] . '
+ - ' . $this->user->lang['SEO_SERVER_CONF_CAPTION_SUFFIX'] . '
+ - ' . $this->user->lang['SEO_SERVER_CONF_CAPTION_DELIM'] . '
' . "\n";
- // build location message
- if ($show_rewritebase_opt && $this->new_config['rbase'])
- {
- $msg_loc = sprintf($this->user->lang['SEO_HTACCESS_FOLDER_MSG'], '' . $this->core->seo_path['phpbb_url'] . '');
- }
- else
- {
- $msg_loc = sprintf($this->user->lang['SEO_HTACCESS_ROOT_MSG'], '' . $this->core->seo_path['root_url'] . '');
- }
-
- $htaccess_output .= '
' . "\n" . '
⇒ ' . $msg_loc . '
' . "\n";
- $htaccess_output .= '
.htaccess : ' . $this->user->lang['SEO_SHOW'] . ' / ' . $this->user->lang['SEO_HIDE'] . '' . "\n";
- $htaccess_output .= '
- ' . $this->user->lang['SEO_SELECT_ALL'] . '
' . "\n";
- $htaccess_output .= '
' . str_replace("\n", '
', $htaccess_code) . '
' . "\n";
- $htaccess_output .= '
' . "\n";
- $htaccess_output .= '
' . $this->user->lang['SEO_HTACCESS_CAPTION'] . ':' . "\n";
- $htaccess_output .= '- ' . $this->user->lang['SEO_HTACCESS_CAPTION_COMMENT'] . '
' . "\n";
- $htaccess_output .= '- ' . $this->user->lang['SEO_HTACCESS_CAPTION_STATIC'] . '
' . "\n";
- $htaccess_output .= '- ' . $this->user->lang['SEO_HTACCESS_CAPTION_SUFFIX'] . '
' . "\n";
- $htaccess_output .= '- ' . $this->user->lang['SEO_HTACCESS_CAPTION_DELIM'] . '
' . "\n";
if ($this->new_config['more_options'])
{
- $htaccess_output .= '- ' . $this->user->lang['SEO_HTACCESS_CAPTION_SLASH'] . '
' . "\n";
+ $html_output .= '- ' . $this->user->lang['SEO_SERVER_CONF_CAPTION_SLASH'] . '
' . "\n";
}
- $htaccess_output .= '
' . "\n" . '
' . "\n";
+ $html_output .= '
' . "\n";
+ return $html_output;
}
else
{
// File output
- $htaccess_output = str_replace(array('<', '>', '&'), array('<', '>', '&'), strip_tags($htaccess_code));
+ foreach ($rewrite_conf as $engine => $setup)
+ {
+ $file = $this->core->seo_opt['cache_folder'] . $setup['filename'];
+ $update = $rewrite_conf_result[$engine]['raw'];
+ $this->write_cache($file, $update);
+ }
}
-
- return $htaccess_output;
}
/**
- * get_mods_ht Get all mods htaccess tpls
+ * get_mods_server_conf Get all mods server_conf tpls
*/
- function get_mods_ht()
+ function get_mods_server_conf()
{
$all_ht_tpl = array('pos1' => '', 'pos2' => '');
$path = PHPBB_SEO_USU_ROOT_DIR . 'htmods';
@@ -1435,7 +1610,16 @@ function check_cache_folder($cache_dir, $msg = true)
// check if the config cache file is here already and writeable
$check = $this->core->cache_config['file'];
- $checks = array("{$check}.old", "{$check}.current", "{$cache_dir}.htaccess", "{$cache_dir}.htaccess.old", "{$cache_dir}.htaccess.current");
+ $checks = array(
+ "{$check}.old",
+ "{$check}.current",
+ "{$cache_dir}.htaccess",
+ "{$cache_dir}.htaccess.old",
+ "{$cache_dir}.htaccess.current",
+ "{$cache_dir}ngix.conf",
+ "{$cache_dir}ngix.conf.old",
+ "{$cache_dir}ngix.conf.current",
+ );
// let's check all files
$inner_write = true;
@@ -1481,28 +1665,13 @@ function check_cache_folder($cache_dir, $msg = true)
/**
* write_cache( ) will write the cached file and keep backups.
*/
- function write_cache($type = 'forum')
+ function write_cache($file, $update)
{
if(!$this->core->cache_config['cache_enable'])
{
return false;
}
- if ($type == 'htaccess')
- {
- // .htaccess case
- $file = $this->core->seo_opt['cache_folder'] . '.htaccess';
- $update = $this->seo_htaccess(false);
- }
- else
- {
- // config
- $file = $this->core->cache_config['file'];
- $update = '<'.'?php' . "\n" . '/**' . "\n" . '* phpBB SEO' . "\n" . '* www.phpBB-SEO.com' . "\n" . '* @package phpBB SEO USU' . "\n" . '*/' . "\n" . 'if (!defined(\'IN_PHPBB\')) {' . "\n\t" . 'exit;' . "\n" . '}' . "\n";
- $update .= '$settings = ' . preg_replace('`[\s]+`', ' ', var_export($this->core->cache_config['settings'], true)) . ';'. "\n";
- $update .= '$forum_urls = ' . preg_replace('`[\s]+`', ' ', var_export($this->core->cache_config['forum_urls'], true)) . ';';
- }
-
// Keep a backup of the previous settings
@copy($file, $file . '.old');
$handle = @fopen($file, 'wb');
diff --git a/acp/usu_info.php b/acp/usu_info.php
index 6f180d1..bbcb219 100644
--- a/acp/usu_info.php
+++ b/acp/usu_info.php
@@ -29,18 +29,18 @@ function module()
'auth' => 'ext_phpbbseo/usu && acl_a_board',
'cat' => array('ACP_MOD_REWRITE')
),
- 'htaccess' => array(
- 'title' => 'ACP_HTACCESS',
+ 'server' => array(
+ 'title' => 'ACP_REWRITE_CONF',
'auth' => 'ext_phpbbseo/usu && acl_a_board',
'cat' => array('ACP_MOD_REWRITE')
),
- 'extended' => array(
- 'title' => 'ACP_SEO_EXTENDED',
+ 'sync_url' => array(
+ 'title' => 'ACP_SYNC_URL',
'auth' => 'ext_phpbbseo/usu && acl_a_board',
'cat' => array('ACP_MOD_REWRITE')
),
- 'sync_url' => array(
- 'title' => 'ACP_SYNC_URL',
+ 'extended' => array(
+ 'title' => 'ACP_SEO_EXTENDED',
'auth' => 'ext_phpbbseo/usu && acl_a_board',
'cat' => array('ACP_MOD_REWRITE')
),
diff --git a/adm/style/event/acp_overall_footer_after.html b/adm/style/event/acp_overall_footer_after.html
index 6360a6a..7b6c59e 100644
--- a/adm/style/event/acp_overall_footer_after.html
+++ b/adm/style/event/acp_overall_footer_after.html
@@ -12,34 +12,42 @@
diff --git a/language/en/acp_usu.php b/language/en/acp_usu.php
index 59f2525..9f7964e 100644
--- a/language/en/acp_usu.php
+++ b/language/en/acp_usu.php
@@ -49,32 +49,36 @@
'ACP_FORUM_URL_EXPLAIN' => 'Here you can see what’s in the cache file containing the forum title to inject in their URLs.
Forum in green colors are cached, the one in red are not yet.
Please Note :
any-title-fxx/ will always be properly redirected with the Zero Duplicate but it won’t be the case if you edit any-title/ to something-else/.
In such case, any-title/ will for now be treated as a forum that does not exist if you do not set appropriate redirections.',
'ACP_NO_FORUM_URL' => 'Forum URL Management disabled
The forum URL management is only available in advanced and Mixed mode and when Forum URL caching is activated.
Forum URLs already configured will stay active in advanced and Mixed mode.',
// ACP .htaccess
- 'ACP_HTACCESS' => '.htaccess',
- 'ACP_HTACCESS_EXPLAIN' => 'This tool will help you out building your .htaccess.
The version proposed below is based on your phpBB/ext/phpbbseo/usu/customise.php settings.
You can edit the $seo_ext and $seo_static values before you install the .htaccess to get personalized URLs.
You can for example choose to use .htm instead of .html, "message" instead of "post" "mysite-team" instead of "the-team" and so on.
If you edit these while they were already indexed in SE, you’ll need personalized redirections.
The default settings are not bad at all, you can skip this step without worries if you prefer,
though it’s the best time to do it. Doing it after a while will require some personalized redirections.
By default the following .htaccess shall be uploaded in the domain’s root (eg where www.example.com is linked).
If phpBB is installed in a sub folder, hitting the more option below will add an option to upload it in the phpBB folder instead.',
- 'SEO_HTACCESS_RBASE' => '.htaccess location',
- 'SEO_HTACCESS_RBASE_EXPLAIN' => 'Put the .htaccess in the phpBB folder ?
The RewriteBase setting allow to put the forum’s .htaccess in its folder. It’s usually more convenient to put the .htaccess in the domain’s root folder even when phpBB is installed in a sub-folder, but you may prefer to put it in the forum folder instead.',
- 'SEO_HTACCESS_SLASH' => 'RegEx Right Slash',
- 'SEO_HTACCESS_SLASH_EXPLAIN' => 'Depending on the specific host you are using, you might have to get rid of or add the slash ("/") at the beginning of the right part of each RewriteRules. This particular slash is used by default when .htaccess are located at the root level. It’s the contrary for when phpBB would be installed in a sub-folder and you’d want to use an .htaccess in the same folder.
Default settings should generally work, but if it’s not the case, try regenerating an .htaccess by hitting the "Re-generate" button.',
- 'SEO_HTACCESS_WSLASH' => 'RegEx Left Slash',
- 'SEO_HTACCESS_WSLASH_EXPLAIN' => 'Depending on the specific host you are using, you might have to add a slash ("/") at the beginning of the left part of each RewriteRules. This particular slash ("/") is never used by default.
Default settings should generally work, but if it’s not the case, try regenerating an .htaccess by hitting the "Re-generate" button.',
+ 'ACP_REWRITE_CONF' => 'Server Config',
+ 'ACP_REWRITE_CONF_EXPLAIN' => 'This tool will help you out building your server config.
The version proposed below is based on your phpBB/ext/phpbbseo/usu/customise.php settings.
You can edit the $seo_ext and $seo_static values before you install the server config to get personalized URLs.
You can for example choose to use .htm instead of .html, "message" instead of "post" "mysite-team" instead of "the-team" and so on.
If you edit these while they were already indexed in SE, you’ll need personalized redirections.
The default settings are not bad at all, you can skip this step without worries if you prefer,
though it’s the best time to do it. Doing it after a while will require some personalized redirections.',
+ 'SEO_SERVER_CONF_RBASE' => 'Config Scope',
+ 'SEO_SERVER_CONF_RBASE_EXPLAIN' => 'The server config can be limited to phpBB’s physical directory. It is usually desired to limit teh server config to where it is useful, but it can be handy to group everything in the domain’s root.',
+ 'SEO_SERVER_CONF_SLASH' => 'RegEx Right Slash',
+ 'SEO_SERVER_CONF_SLASH_EXPLAIN' => 'Depending on the specific host you are using, you might have to get rid of or add the slash ("/") at the beginning of the right part of each RewriteRules. This particular slash is for example used by default when .htaccess are located at the root level and it’s the contrary for when phpBB would be installed in a sub-folder with an .htaccess in the same folder.
Default settings should generally work, but if it’s not the case, try a server config with this option.',
+ 'SEO_SERVER_CONF_WSLASH' => 'RegEx Left Slash',
+ 'SEO_SERVER_CONF_WSLASH_EXPLAIN' => 'Depending on the specific host you are using, you might have to add a slash ("/") at the beginning of the left part of each RewriteRules. This particular slash ("/") is for example not used by default with Apache but is with Ngix.
Default settings should generally work, but if it’s not the case, try a server config with this option.',
'SEO_MORE_OPTION' => 'More Options',
'SEO_MORE_OPTION_EXPLAIN' => 'If the first suggested .htaccess does not work.
First make sure mod_rewrite is activated on your server.
Then, make sure you uploaded it in the right folder, and that another one is not perturbing.
If not enough, hit the "more option" button.',
- 'SEO_HTACCESS_SAVE' => 'Save the .htaccess',
- 'SEO_HTACCESS_SAVE_EXPLAIN' => 'If checked, an .htaccess file will be generated upon submit in the phpbb_seo/cache/ folder. It’s ready to go with your last settings, you will still have to move it in the right place.',
- 'SEO_HTACCESS_ROOT_MSG' => 'Once you are ready, you can select the .htaccess code, and paste it in an .htaccess file or use the "Save .htaccess" option below.
This .htaccess is meant to be used in the domain’s root folder, which in your case is where %1$s leads to in your FTP.
You can generate an .htaccess meant to be used in the eventual phpBB sub-directory using the "More options" option below.',
+ 'SEO_SERVER_CONF_SAVE' => 'Save the server config',
+ 'SEO_SERVER_CONF_SAVE_EXPLAIN' => 'If checked, server config files will be generated upon submit in the phpbb_seo/cache/ folder. They are ready to go with your last settings, just pick the proper file/config for you server and put it in the right place.',
+ 'SEO_HTACCESS_ROOT_MSG' => 'Once you are ready, you can select the .htaccess code, and paste it in an .htaccess file or use the "Save .htaccess" option below.
This .htaccess is meant to be used in the domain’s root folder, which in your case is where %1$s leads to in your FTP.
You can generate an .htaccess meant to be used in the eventual phpBB sub-directory using the "htaccess location" option below.',
'SEO_HTACCESS_FOLDER_MSG' => 'Once you are ready, you can select the .htaccess code, and paste it in an .htaccess file or use the "Save .htaccess" option below.
This .htaccess is meant to be used in the folder where phpBB is installed, which in your case is where %1$s leads to in your FTP.',
- 'SEO_HTACCESS_CAPTION' => 'Caption',
- 'SEO_HTACCESS_CAPTION_COMMENT' => 'Comments',
- 'SEO_HTACCESS_CAPTION_STATIC' => 'Static parts, editable in phpBB/ext/phpbbseo/usu/customise.php',
- 'SEO_HTACCESS_CAPTION_DELIM' => 'Delimiters, editable in phpBB/ext/phpbbseo/usu/customise.php',
- 'SEO_HTACCESS_CAPTION_SUFFIX' => 'Suffixes, editable in phpBB/ext/phpbbseo/usu/customise.php',
- 'SEO_HTACCESS_CAPTION_SLASH' => 'Optional slashes',
+ 'SEO_SERVER_CONF_CAPTION' => 'Caption',
+ 'SEO_SERVER_CONF_CAPTION_COMMENT' => 'Comments',
+ 'SEO_SERVER_CONF_CAPTION_STATIC' => 'Static parts, editable in phpBB/ext/phpbbseo/usu/customise.php',
+ 'SEO_SERVER_CONF_CAPTION_DELIM' => 'Delimiters, editable in phpBB/ext/phpbbseo/usu/customise.php',
+ 'SEO_SERVER_CONF_CAPTION_SUFFIX' => 'Suffixes, editable in phpBB/ext/phpbbseo/usu/customise.php',
+ 'SEO_SERVER_CONF_CAPTION_SLASH' => 'Optional slashes',
'SEO_SLASH_DEFAULT' => 'Default',
'SEO_SLASH_ALT' => 'Alternate',
'SEO_MOD_TYPE_ER' => 'The mod rewrite type is not set up properly in phpBB/ext/phpbbseo/usu/core.php.',
'SEO_SHOW' => 'Show',
'SEO_HIDE' => 'Hide',
'SEO_SELECT_ALL' => 'Select all',
+ 'SEO_APACHE_CONF' => 'Apache config',
+ //Ngix
+ 'SEO_NGIX_CONF' => 'Ngix config',
+ 'SEO_NGIX_CONF_EXPLAIN' => 'Copy and paste this code into your webserver configuration file and restart Ngix.',
// ACP extended
'ACP_SEO_EXTENDED_EXPLAIN' => 'phpBB SEO mods extended settings.',
'SEO_EXTERNAL_LINKS' => 'External links',
diff --git a/language/en/info_acp_usu.php b/language/en/info_acp_usu.php
index 6553617..c08cc54 100644
--- a/language/en/info_acp_usu.php
+++ b/language/en/info_acp_usu.php
@@ -39,7 +39,7 @@
'ACP_MOD_REWRITE' => 'URL Rewriting settings',
'ACP_PHPBB_SEO_CLASS' => 'phpBB SEO Class settings',
'ACP_FORUM_URL' => 'Forum URL Management',
- 'ACP_HTACCESS' => '.htaccess',
+ 'ACP_REWRITE_CONF' => 'Server Config',
'ACP_SEO_EXTENDED' => 'Extended config',
'ACP_SYNC_URL' => 'URL Synchronization',
'ACP_PREMOD_UPDATE' => 'Release announcement
diff --git a/language/fr/acp_usu.php b/language/fr/acp_usu.php
index 1655c6d..1d264ff 100644
--- a/language/fr/acp_usu.php
+++ b/language/fr/acp_usu.php
@@ -49,32 +49,36 @@
'ACP_FORUM_URL_EXPLAIN' => 'Vous pouvez régler ici le contenu du cache, qui sera injecté dans les URLs des forums.
Les forums en vert sont en cache, ceux en rouge ne le sont pas encore.
Nota Bene :
mots-cles-fxx/ sera toujours convenablement redirigé par le Zéro Duplicate, mais pas si vous le modifiez par la suite : mots-cles/ ne sera pas directement redirigé vers autres-mots-cles/.
Dans ce cas, mots-cles/ sera considéré comme un forum qui n’existe pas, à défaut de redirections personnalisées.
',
'ACP_NO_FORUM_URL' => 'La configuration des URLs des forums est désactivée
La configuration des URLs des forums est uniquemant possible en mode Avancé ou Intermédiaire et lorsque le Cache des URLs des forums est activé.
Les URLs éventuellement configurées continuent cependant d’être utilisées en mode Avancé ou Intermédiaire.',
// ACP .htaccess
- 'ACP_HTACCESS' => 'htaccess',
- 'ACP_HTACCESS_EXPLAIN' => 'Cet outil vous aidera à construire votre .htaccess.
La version proposée ci-dessous prend en compte les réglages du fichier phpBB/ext/phpbbseo/usu/customise.php.
Vous pouvez modifier les valeurs des tableaux $seo_ext et $seo_static et personnaliser vos URLs avant de générer un .htaccess.
Vous pouvez par exemple choisir d’utiliser .htm au lieu de .html, ’message’ au lieu de ’post’, ’mon-equipe’ au lieu de ’equipe’ etc ...
Si vous modifiez ces valeurs après que vos pages aient été indexées, vous aurez besoin de redirections personnalisées.
Les réglages par défaut ne sont pas du tout mauvais, vous pouvez sauter la première étape de personnalisation sans soucis si vous préférez.
Par défaut, le .htacess ci-dessous doit être placé à la racine de votre domaine (ie : où www.example.com est installé).
Si phpBB est installé dans un sous dossier, cliquez sur le bouton "Plus d’options" ci-dessous, cela ajoutera une option pour permettre son utilisation dans un sous dossier.',
- 'SEO_HTACCESS_RBASE' => 'Emplacement du .htaccess',
- 'SEO_HTACCESS_RBASE_EXPLAIN' => 'Mettre le .htaccess dans le dossier de phpBB ?
La directive RewriteBase nous permet de mettre le .htaccess dans le dossier du forum. Il est généralement plus simple de le mettre à la racine du domaine même quand phpBB est installé dans un sous-dossier, mais vous pourriez préférer de le mettre dans le dossier du forum.',
- 'SEO_HTACCESS_SLASH' => 'Slash droit RegEx',
- 'SEO_HTACCESS_SLASH_EXPLAIN' => 'En fonction de votre hébergeur, il se peut que vous ayez à retirer les slashes ("/") se trouvant devant la partie droite des RewriteRule. Ce slash particulier est utilisé par défaut quand le .htaccess est instalé à la racine du domaine. C’est le contraire quand phpBB est installé dans un sous dossier et que vous souhaitez mettre le .htaccess dans celui-ci.
Les réglages par défaut fonctionneront le plus souvent, si ce n’est pas le cas, essayez de générer et tester différentes versions de .htaccess.',
- 'SEO_HTACCESS_WSLASH' => 'Slash gauche RegEx',
- 'SEO_HTACCESS_WSLASH_EXPLAIN' => 'En fonction de votre hébergeur, il se peut que vous ayez à ajouter des slashes ("/") se trouvant devant la partie gauche des RewriteRule. Ce slash particulier n’est jamais utilisé par défaut.
Les réglages par défaut fonctionneront le plus souvent, si ce n’est pas le cas, essayez de générer et tester différentes versions de .htaccess.',
+ 'ACP_REWRITE_CONF' => 'Config Serveur',
+ 'ACP_REWRITE_CONF_EXPLAIN' => 'Cet outil vous aidera à construire votre config serveur.
La version proposée ci-dessous prend en compte les réglages du fichier phpBB/ext/phpbbseo/usu/customise.php.
Vous pouvez modifier les valeurs des tableaux $seo_ext et $seo_static et personnaliser vos URLs avant de générer une config serveur.
Vous pouvez par exemple choisir d’utiliser .htm au lieu de .html, ’message’ au lieu de ’post’, ’mon-equipe’ au lieu de ’equipe’ etc ...
Si vous modifiez ces valeurs après que vos pages aient été indexées, vous aurez besoin de redirections personnalisées.
Les réglages par défaut ne sont pas du tout mauvais, vous pouvez sauter la première étape de personnalisation sans soucis si vous préférez.',
+ 'SEO_SERVER_CONF_RBASE' => 'Portée de la config serveur',
+ 'SEO_SERVER_CONF_RBASE_EXPLAIN' => 'La configuration du serveur peut être limitée au dossier physique de phpBB. Il est en générale préférable de limiter la portée de la config à l’endroit ou elle est utilisée, mais il peut être plus pratique de tout regrouper sur la racine du serveur.',
+ 'SEO_SERVER_CONF_SLASH' => 'Slash droit RegEx',
+ 'SEO_SERVER_CONF_SLASH_EXPLAIN' => 'En fonction de votre hébergeur, il se peut que vous ayez à retirer les slashes ("/") se trouvant devant la partie droite des RewriteRule. Ce slash particulier est par exemple utilisé par défaut pour Apache quand le .htaccess est instalé à la racine du domaine, et c’est le contraire quand phpBB est installé dans un sous dossier et que vous souhaitez mettre le .htaccess dans celui-ci.
Les réglages par défaut fonctionneront le plus souvent, si ce n’est pas le cas, essayez de générer une config serveur avec cette option.',
+ 'SEO_SERVER_CONF_WSLASH' => 'Slash gauche RegEx',
+ 'SEO_SERVER_CONF_WSLASH_EXPLAIN' => 'En fonction de votre hébergeur, il se peut que vous ayez à ajouter des slashes ("/") se trouvant devant la partie gauche des RewriteRule. Ce slash particulier par exemple pas utilisé par défaut par Apache, mais l’est par Ngix.
Les réglages par défaut fonctionneront le plus souvent, si ce n’est pas le cas, essayez de générer une config serveur avec cette option.',
'SEO_MORE_OPTION' => 'Plus d’options',
'SEO_MORE_OPTION_EXPLAIN' => 'Si le premier .htaccess suggéré ne fonctionne pas :
Assurez vous tout d’abord que le mod_rewrite est bien activé sur votre serveur.
Ensuite assurez vous d’avoir bien mis le .htaccess au bon endroit, et qu’il n’est pas perturbé par un autre se trouvant dans un autre dossier.
Si ça ne suffit pas, activez cette option et validez pour découvrir plus d’options.',
- 'SEO_HTACCESS_SAVE' => 'Sauvegarder le .htaccess',
- 'SEO_HTACCESS_SAVE_EXPLAIN' => 'Si vous cochez l’option, un fichier .htaccess sera généré dans le dossier phpbb_seo/cache/. Il est prêt à l’emploi et prend en compte vos réglages actuels, mais vous devrez tout de même le déplacer au bon endroit.',
- 'SEO_HTACCESS_ROOT_MSG' => 'Une fois prêt, vous pouvez sélectionner le code ci-dessous et le copier dans un fichier .htaccess vide ou utiliser l’option "Sauvegarder le .htaccess" ci-dessous.
Ce .htaccess est fait pour être utilisé à la racine du domaine, ce qui dans votre cas signifie le dossier de votre ftp qui correspond à %1$s.
Vous pouvez générer un .htaccess fait pour être utilisé dans le sous-dossier éventuel de phpBB en utilisant l’option "Plus d’options" ci-dessous.',
+ 'SEO_SERVER_CONF_SAVE' => 'Sauvegarder la config serveur',
+ 'SEO_SERVER_CONF_SAVE_EXPLAIN' => 'Si vous cochez l’option, des fichiers contenant la config serveur seront générés dans le dossier phpbb_seo/cache/. Ils sont prêt à l’emploi et prennent en compte vos réglages actuels. Vous devrez simplement déplacer/copier le fichier correspondant à votre servuer (Apache .htaccess, config Ngix ...) au bon endroit.',
+ 'SEO_HTACCESS_ROOT_MSG' => 'Une fois prêt, vous pouvez sélectionner le code ci-dessous et le copier dans un fichier .htaccess vide ou utiliser l’option "Sauvegarder le .htaccess" ci-dessous.
Ce .htaccess est fait pour être utilisé à la racine du domaine, ce qui dans votre cas signifie le dossier de votre ftp qui correspond à %1$s.
Vous pouvez générer un .htaccess fait pour être utilisé dans le sous-dossier éventuel de phpBB en utilisant l’option "Emplacement du .htaccess" ci-dessous.',
'SEO_HTACCESS_FOLDER_MSG' => 'Une fois prêt, sélectionnez le code ci-dessous et copiez le dans un fichier .htaccess vide ou utilisez l’option "Sauvegarder le .htaccess" ci dessus.
Ce .htaccess est fait pour être utilisé dans le dossier utilisé par phpBB, ce qui dans votre cas signifie le dossier de votre ftp qui correspond à %1$s.',
- 'SEO_HTACCESS_CAPTION' => 'Légende',
- 'SEO_HTACCESS_CAPTION_COMMENT' => 'Commentaires',
- 'SEO_HTACCESS_CAPTION_STATIC' => 'Parties statiques, modifiables dans phpBB/ext/phpbbseo/usu/customise.php',
- 'SEO_HTACCESS_CAPTION_SUFFIX' => 'Extensions, modifiables dans phpBB/ext/phpbbseo/usu/customise.php',
- 'SEO_HTACCESS_CAPTION_DELIM' => 'Délimiteurs, modifiables dans phpBB/ext/phpbbseo/usu/customise.php',
- 'SEO_HTACCESS_CAPTION_SLASH' => 'Slashes Optionnels',
+ 'SEO_SERVER_CONF_CAPTION' => 'Légende',
+ 'SEO_SERVER_CONF_CAPTION_COMMENT' => 'Commentaires',
+ 'SEO_SERVER_CONF_CAPTION_STATIC' => 'Parties statiques, modifiables dans phpBB/ext/phpbbseo/usu/customise.php',
+ 'SEO_SERVER_CONF_CAPTION_SUFFIX' => 'Extensions, modifiables dans phpBB/ext/phpbbseo/usu/customise.php',
+ 'SEO_SERVER_CONF_CAPTION_DELIM' => 'Délimiteurs, modifiables dans phpBB/ext/phpbbseo/usu/customise.php',
+ 'SEO_SERVER_CONF_CAPTION_SLASH' => 'Slashes Optionnels',
'SEO_SLASH_DEFAULT' => 'Défaut',
'SEO_SLASH_ALT' => 'Alternative',
'SEO_MOD_TYPE_ER' => 'Le type de mod rewrite n’est pas convenablement configuré dans phpBB/ext/phpbbseo/usu/customise.php',
'SEO_SHOW' => 'Montrer',
'SEO_HIDE' => 'Cacher',
'SEO_SELECT_ALL' => 'Sélectionner',
+ 'SEO_APACHE_CONF' => 'Config Apache',
+ //Ngix
+ 'SEO_NGIX_CONF' => 'Config Ngix',
+ 'SEO_NGIX_CONF_EXPLAIN' => 'Copiez / collez ce code this dans la configuration du serveur web et redemarrez Ngix.',
// ACP extended
'ACP_SEO_EXTENDED_EXPLAIN' => 'Configuration additionnelle des mods phpBB SEO.',
// External links
diff --git a/language/fr/info_acp_usu.php b/language/fr/info_acp_usu.php
index ae7ca35..cdc9868 100644
--- a/language/fr/info_acp_usu.php
+++ b/language/fr/info_acp_usu.php
@@ -39,7 +39,7 @@
'ACP_MOD_REWRITE' => 'Réécriture d’url',
'ACP_PHPBB_SEO_CLASS' => 'Configuration de la classe phpBB SEO',
'ACP_FORUM_URL' => 'Configuration des URLs des forums',
- 'ACP_HTACCESS' => '.htaccess',
+ 'ACP_REWRITE_CONF' => 'Config Serveur',
'ACP_SEO_EXTENDED' => 'Configuration additionnelle',
'ACP_SYNC_URL' => 'Synchronisation des URLs',
'ACP_PREMOD_UPDATE' => 'Annonce de mise à jour
diff --git a/migrations/release_2_0_0_b2.php b/migrations/release_2_0_0_b2.php
index fa95c86..d8be96c 100644
--- a/migrations/release_2_0_0_b2.php
+++ b/migrations/release_2_0_0_b2.php
@@ -31,6 +31,32 @@ public function update_data()
{
return array(
array('config.add', array('seo_usu_version', '2.0.0-b2')),
+ array(
+ 'module.remove',
+ array(
+ 'acp',
+ 'ACP_MOD_REWRITE',
+ array(
+ 'module_basename' => '\phpbbseo\usu\acp\usu',
+ 'module_langname' => 'ACP_HTACCESS',
+ 'module_mode' => 'htaccess',
+ 'module_auth' => 'ext_phpbbseo/usu && acl_a_board',
+ ),
+ )
+ ),
+ array(
+ 'module.add',
+ array(
+ 'acp',
+ 'ACP_MOD_REWRITE',
+ array(
+ 'module_basename' => '\phpbbseo\usu\acp\usu',
+ 'module_langname' => 'ACP_REWRITE_CONF',
+ 'module_mode' => 'server',
+ 'module_auth' => 'ext_phpbbseo/usu && acl_a_board',
+ ),
+ )
+ ),
array(
'module.add',
array(
From 2cbb28bb32f10bbbc15e758cafae9ecae59e9b81 Mon Sep 17 00:00:00 2001
From: dcz
Date: Mon, 15 Sep 2014 13:22:36 +0200
Subject: [PATCH 2/2] [ticket/42] Remove empty line
---
acp/usu.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/acp/usu.php b/acp/usu.php
index 49142b1..57cfe6e 100644
--- a/acp/usu.php
+++ b/acp/usu.php
@@ -1433,7 +1433,6 @@ function seo_server_conf($html = true)
' . $this->user->lang['SEO_SERVER_CONF_CAPTION_SUFFIX'] . '
' . $this->user->lang['SEO_SERVER_CONF_CAPTION_DELIM'] . '' . "\n";
-
if ($this->new_config['more_options'])
{
$html_output .= ' ' . $this->user->lang['SEO_SERVER_CONF_CAPTION_SLASH'] . '' . "\n";