Skip to content

Commit

Permalink
Merge pull request #43 from dcz/ticket/42
Browse files Browse the repository at this point in the history
[ticket/42] Generate ngix rewrite rules from acp
  • Loading branch information
dcz committed Sep 15, 2014
2 parents 54f7e14 + 2cbb28b commit 68349ae
Show file tree
Hide file tree
Showing 8 changed files with 597 additions and 387 deletions.
802 changes: 485 additions & 317 deletions acp/usu.php

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions acp/usu_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
),
Expand Down
64 changes: 36 additions & 28 deletions adm/style/event/acp_overall_footer_after.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,42 @@
<script type="text/javascript">
// <![CDATA[
$(document).ready(function() {
if ($("#htaccess_toggle").length) {
$("#htaccess_toggle").on('click', function() {
var $this = $('#htaccess_code');
if ($this.is(':visible')) {
$this.hide(300);
} else {
$this.show(300);
}
}).css({cursor:'pointer'});
$("#htaccess_select").on('click', function() {
var
doc = document,
text = doc.getElementById('htaccess_code_select'),
range,
selection;
if (doc.body.createTextRange) { //ms
range = doc.body.createTextRange();
range.moveToElementText(text);
range.select();
} else if (window.getSelection) { //all others
selection = window.getSelection();
range = doc.createRange();
range.selectNodeContents(text);
selection.removeAllRanges();
selection.addRange(range);
}
}).css({cursor:'pointer'});
}
var seo_rewrite_engines = {SEO_REWRITE_ENGINES};
// for (var i in seo_rewrite_engines) {
$(seo_rewrite_engines).each(function(i) {
var engine = seo_rewrite_engines[i];
if (!engine) {
return true;
}
if ($("#" + engine + "_toggle").length) {
$("#" + engine + "_toggle").on('click', function() {
var $this = $("#" + engine + "_code");
if ($this.is(":visible")) {
$this.hide(300);
} else {
$this.show(300);
}
}).css({cursor:"pointer"});
$("#" + engine + "_select").on('click', function() {
var
doc = document,
text = doc.getElementById(engine + "_code_select"),
range,
selection;
if (doc.body.createTextRange) { //ms
range = doc.body.createTextRange();
range.moveToElementText(text);
range.select();
} else if (window.getSelection) { //all others
selection = window.getSelection();
range = doc.createRange();
range.selectNodeContents(text);
selection.removeAllRanges();
selection.addRange(range);
}
}).css({cursor:'pointer'});
}
});
});
// ]]>
</script>
Expand Down
38 changes: 21 additions & 17 deletions language/en/acp_usu.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br/>Forum in green colors are cached, the one in red are not yet.<br/><br/><b style="color:red">Please Note :</b><br/><em><b>any-title-fxx/</b> will always be properly redirected with the Zero Duplicate but it won’t be the case if you edit <b>any-title/</b> to <b>something-else/</b>.<br/> In such case, <b>any-title/</b> will for now be treated as a forum that does not exist if you do not set appropriate redirections.</em>',
'ACP_NO_FORUM_URL' => '<b>Forum URL Management disabled<b><br/>The forum URL management is only available in advanced and Mixed mode and when Forum URL caching is activated.<br/>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.<br/>The version proposed below is based on your phpBB/ext/phpbbseo/usu/customise.php settings.<br/>You can edit the $seo_ext and $seo_static values before you install the .htaccess to get personalized URLs.<br/>You can for example choose to use .htm instead of .html, "message" instead of "post" "mysite-team" instead of "the-team" and so on.<br/>If you edit these while they were already indexed in SE, you’ll need personalized redirections.<br/>The default settings are not bad at all, you can skip this step without worries if you prefer,<br/>though it’s the best time to do it. Doing it after a while will require some personalized redirections.<br/>By default the following .htaccess shall be uploaded in the domain’s root (eg where www.example.com is linked).<br/>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 ?<br/>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.<br/>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.<br/>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.<br/>The version proposed below is based on your phpBB/ext/phpbbseo/usu/customise.php settings.<br/>You can edit the $seo_ext and $seo_static values before you install the server config to get personalized URLs.<br/>You can for example choose to use .htm instead of .html, "message" instead of "post" "mysite-team" instead of "the-team" and so on.<br/>If you edit these while they were already indexed in SE, you’ll need personalized redirections.<br/>The default settings are not bad at all, you can skip this step without worries if you prefer,<br/>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.<br/>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.<br/>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.<br/>First make sure mod_rewrite is activated on your server.<br/>Then, make sure you uploaded it in the right folder, and that another one is not perturbing.<br/>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.<br/> 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.<br/><br/>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.<br/> 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.<br/><br/>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.<br/> 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',
Expand Down
2 changes: 1 addition & 1 deletion language/en/info_acp_usu.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => '<h1>Release announcement</h1>
Expand Down
Loading

0 comments on commit 68349ae

Please sign in to comment.