Permalink
Browse files

Completes new URLs rewriting method, initiated in update 31f26c2.

  • Loading branch information...
JB Lebrun
JB Lebrun committed Oct 30, 2018
1 parent 31f26c2 commit d1ac4b4dbdca1a13170dac6b073929c9053f5e14
Showing with 23 additions and 21 deletions.
  1. +6 −3 Camyks.php.inc
  2. +2 −2 engine/skeleton_site/.htaccess
  3. +15 −16 plugin/module/Admin_ContentPage/lib/ContentPage.php.inc
@@ -4,7 +4,7 @@
* @details Engine / Main Object
* @file Camyks.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.5
* @version 1.0.6
* @date Creation: Jun 2005
* @date Modification: Oct 2018
* @copyright 2005 - 2018 CaMykS Team
@@ -864,8 +864,11 @@ final class Camyks {
/* load language from header */
if ($type == 'admin') {
$newlg = (isset($_REQUEST['_clg_']) ? $_REQUEST['_clg_'] : '');
} else {
$newlg = (isset($_REQUEST['_clg_']) ? substr($_REQUEST['_clg_'], 1, 3) : '');
} elseif (isset($_REQUEST['_clg_'])) {
if (strlen($_REQUEST['_clg_']) == 3)
$newlg = substr($_REQUEST['_clg_'], 1, 3);
else
$newlg = $_REQUEST['_clg_'];
}
if (count($list) == 0 or $newlg == '' or !in_array ($newlg, $list)) {
@@ -14,7 +14,7 @@ Options +FollowSymlinks
#Header always set Strict-Transport-Security "max-age=300; includeSubDomains; preload"
</IfModule>

# Set up default expire value
# Set up default expire value
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month"
@@ -46,5 +46,5 @@ Options +FollowSymlinks
#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]

# 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]
# 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.2
* @version 1.0.3
* @date Creation: Jun 2005
* @date Modification: Oct 2018
* @copyright 2005 - 2018 CaMykS Team
@@ -632,7 +632,7 @@ final class ContentPage {
if ($camyks->db_conn->execute_query($sql) or $camyks->log_sqlerror($this, $sql, __FILE__, __LINE__)) {
$this->id = $camyks->db_conn->get_queryGeneratedId();
return $this->update_languages ();
return $this->update_languages();
}
return false;
}
@@ -785,7 +785,7 @@ final class ContentPage {
array('name'=>'theme', 'type'=>'text', 'desc1'=>'varchar', 'desc2'=>255, 'default'=>''),
array('name'=>'homepage', 'type'=>'int', 'desc1'=>'tinyint unsigned', 'desc2'=>'', 'default'=>0),
array('name'=>'metas', 'type'=>'text', 'desc1'=>'text', 'desc2'=>'', 'default'=>''),
);
);
for ($i=0; $i< $this->maxmodules; $i++) {
$fields[] = array('name'=>'m'.$i.'_name', 'type'=>'text', 'desc1'=>'varchar', 'desc2'=>255, 'default'=>'');
$fields[] = array('name'=>'m'.$i.'_content', 'type'=>'text', 'desc1'=>'varchar', 'desc2'=>255, 'default'=>'');
@@ -803,7 +803,7 @@ final class ContentPage {
array('name'=>'shorttitle', 'type'=>'text', 'desc1'=>'varchar', 'desc2'=>255, 'default'=>''),
array('name'=>'keywords', 'type'=>'text', 'desc1'=>'text', 'desc2'=>'', 'default'=>''),
array('name'=>'description', 'type'=>'text', 'desc1'=>'text', 'desc2'=>'', 'default'=>''),
);
);
if (!$camyks->db_conn->create_table('admin_contentpagelocale', $fields, $camyks->get_mysqlencodingvalue(), true, array('id', 'wf_version', 'language')))
return false;
@@ -1138,7 +1138,7 @@ final class ContentPage {
'content' => $meta[1],
'language' => $meta[2],
'method' => $meta[3]
);
);
}
} else {
$this->metas = array();
@@ -1233,7 +1233,7 @@ final class ContentPage {
$m[$i] = new Module('Empty', 'camyks');
}
/* theme */
if ($this->modules[$i]['theme'] != '' ) {
if ($this->modules[$i]['theme'] != '') {
$m[$i]->set_theme($this->modules[$i]['theme']);
} else {
$m[$i]->set_theme($this->theme->name);
@@ -1297,10 +1297,10 @@ final class ContentPage {
public function get_siteLink($params=array(), $lg='') {
global $camyks;
/* add name */
$link = $this->name;
/* add params */
if (count($params) > 0) {
if ($camyks->get_confValue('friendlyurls') == 'modern' or $camyks->get_confValue('friendlyurls') == 'modern2')
@@ -1313,13 +1313,12 @@ 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 = '';
/* add language */
if ($lg != '' or count($camyks->get_confValue('site_languages'))>1) {
if (!in_array($lg, $camyks->get_confValue('site_languages')))
$lg = $camyks->current_language;
}
if ($lg != '') {
if ($camyks->get_confValue('friendlyurls') == 'modern2')
$link = $lg.'/'.$link;
@@ -1699,7 +1698,7 @@ final class ContentPage {
}
/**
* Return page basic info (id, title(current_language) ) from name.
* Return page basic info (id, title(current_language)) from name.
* @param string $name
* @return ContentPage Object
* @deprecated
@@ -1729,7 +1728,7 @@ final class ContentPage {
}
/**
* Return pages basic info (id, title(current_language) ) from names.
* Return pages basic info (id, title(current_language)) from names.
* @param array $names
* @return array
* @deprecated

0 comments on commit d1ac4b4

Please sign in to comment.