Permalink
Browse files

Adds a new URL rewriting mode, in beta. Language can now be used as a…

… folder in URLs.
  • Loading branch information...
JB Lebrun
JB Lebrun committed Oct 30, 2018
1 parent 6a612c4 commit 31f26c26f6dd466ec7c04ec588e639279bccad20
@@ -4,7 +4,7 @@
* @details Engine / Object Library
* @file engine/lib/object/HTMLPage.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.1
* @version 1.0.2
* @date Creation: Jun 2005
* @date Modification: Oct 2018
* @copyright 2005 - 2018 CaMykS Team
@@ -615,7 +615,7 @@ final class HTMLPage {
echo "<html lang=\"".$this->language."\">\n<head>\n";
/* add base url for modern urls */
if ($camyks->get_confValue('friendlyurls') == 'modern' and $camyks->mode != CAMYKS_MODE_ADMIN)
if (($camyks->get_confValue('friendlyurls') == 'modern' or $camyks->get_confValue('friendlyurls') == 'modern2') and $camyks->mode != CAMYKS_MODE_ADMIN)
echo "<base href=\"".$camyks->get_rootBaseURL('absolute_long')."\" />\n";
}
@@ -8,7 +8,7 @@ Options +FollowSymlinks
Header set X-XSS-Protection "1; mode=block"
# MIME-Type sniffing protection
Header always set X-Content-Type-Options "nosniff"
# Cookie protection - Enable "secure" for HTTPS
# Cookie protection - Enable "secure" for HTTPS
Header edit Set-Cookie ^(.*)$ $1;HttpOnly;#Secure
# Enable HSTS to force use secure connections - Enable only if HTTPS is forced on both website sides
#Header always set Strict-Transport-Security "max-age=300; includeSubDomains; preload"
@@ -31,17 +31,20 @@ Options +FollowSymlinks
# admin, request (.php files)
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^([^\.]*).php$ $1.php?%{QUERY_STRING} [L]
# CaMykS assets

# CaMykS assets
# RewriteRule ^cdata/(.*)$ request.php?CaMykSAsset=$1 [L,NS,QSA]
# RewriteRule ^cplugin/(.*)$ request.php?PluginAsset=$1 [L,NS,QSA]

# site page ( .htm, .html, .xhtml, no extension )
RewriteCond %{REQUEST_FILENAME} !-s

# Legacy url rewriting
RewriteRule ^([_0-9a-zA-Z/]*/)?([_0-9a-zA-Z]*)([-_0-9a-zA-Z+]*)?(\.[a-z]{2})?(\.htm|\.html|\.xhtml)?$ index.php?page=$2&params=$3&_clg_=$4&&ext=$5&%{QUERY_STRING} [L,NS]

# Modern url rewriting
#RewriteRule ^([0-9a-zA-Z\-_]+)(/?[-_0-9a-zA-Z\(\)+]*)?(\.[a-z]{2})?(\.htm|\.html|\.xhtml)?$ index.php?page=$1&params=$2&_clg_=$3&ext=$4&%{QUERY_STRING} [L,NS]
</IfModule>

# Modern url rewriting with language as leading folder
#RewriteRule ^([a-z]{2}/)?([0-9a-zA-Z\-_]+)(/?[-_0-9a-zA-Z\(\)+]*)?(\.htm|\.html|\.xhtml)?$ index.php?page=$2&params=$3&_clg_=$1&ext=$4&%{QUERY_STRING} [L,NS]
</IfModule>
@@ -4,7 +4,7 @@
* @details Plugin / Module Library
* @file plugin/module/Admin_ContentPage/lib/ContentPage.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.1
* @version 1.0.2
* @date Creation: Jun 2005
* @date Modification: Oct 2018
* @copyright 2005 - 2018 CaMykS Team
@@ -1303,8 +1303,8 @@ final class ContentPage {
/* add params */
if (count($params) > 0) {
if ($camyks->get_confValue('friendlyurls') == 'modern')
$link .= '/'.urlencode(data_encode_properties($params, '-'));
if ($camyks->get_confValue('friendlyurls') == 'modern' or $camyks->get_confValue('friendlyurls') == 'modern2')
$link .= '/'.urlencode(data_encode_properties($params, '-', true));
else {
$link .= '-'.data_encode_properties($params, '-');
@@ -1314,14 +1314,17 @@ final class ContentPage {
}
/* add language */
if (!in_array($lg, $camyks->site_conf['site_languages'])) {
$lg = $camyks->current_language;
} else if (count($camyks->site_conf['site_languages'])>1) {
$lg = $camyks->current_language;
} else
$lg = '';
if ($lg != '') {
if (in_array($lg, $camyks->site_conf['site_languages'])) {
if ($camyks->get_confValue('friendlyurls') == 'modern2')
$link = $lg.'/'.$link;
else
$link .= '.'.$lg;
} else {
$link .= '.'.$camyks->current_language;
}
} else if (count($camyks->site_conf['site_languages'])>1) {
$link .= '.'.$camyks->current_language;
}
/* add extension */

0 comments on commit 31f26c2

Please sign in to comment.