diff --git a/htdocs/public/website/index.php b/htdocs/public/website/index.php index 81781cbf8ee..b624a847dc5 100644 --- a/htdocs/public/website/index.php +++ b/htdocs/public/website/index.php @@ -61,7 +61,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $error=0; $websitekey=GETPOST('website', 'alpha'); $pageid=GETPOST('page', 'alpha')?GETPOST('page', 'alpha'):GETPOST('pageid', 'alpha'); -$pageref=GETPOST('pageref', 'aZ09')?GETPOST('pageref', 'aZ09'):''; +$pageref=GETPOST('pageref', 'alphanohtml')?GETPOST('pageref', 'alphanohtml'):''; $accessallowed = 1; $type=''; diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 3069de349d3..516640d15fb 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -177,7 +177,7 @@ class WebsitePage extends CommonObject * - If this is 0, the value into $page will be used. If not found or $page not defined, the default page of website_id will be used or the first page found if not set. * - If value is < 0, we must exclude this ID. * @param string $website_id Web site id (page name must also be filled if this parameter is used) - * @param string $page Page name (website id must also be filled if this parameter is used) + * @param string $page Page name (website id must also be filled if this parameter is used). Exemple 'myaliaspage' or 'fr/myaliaspage' * @param string $aliasalt Alternative alias to search page (slow) * * @return int <0 if KO, 0 if not found, >0 if OK @@ -219,7 +219,17 @@ class WebsitePage extends CommonObject if ($id < 0) $sql .= ' AND t.rowid <> '.abs($id); if (null !== $website_id) { $sql .= " AND t.fk_website = '".$this->db->escape($website_id)."'"; - if ($page) $sql .= " AND t.pageurl = '".$this->db->escape($page)."'"; + if ($page) { + $pagetouse = $page; + $langtouse = ''; + $tmppage = explode('/', $page); + if (! empty($tmppage[1])) { + $pagetouse = $tmppage[1]; + if (strlen($tmppage[0])) $langtouse = $tmppage[0]; + } + $sql .= " AND t.pageurl = '".$this->db->escape($pagetouse)."'"; + if ($langtouse) $sql .= " AND t.lang = '".$this->db->escape($langtouse)."'"; + } if ($aliasalt) $sql .= " AND (t.aliasalt LIKE '%,".$this->db->escape($aliasalt).",%' OR t.aliasalt LIKE '%, ".$this->db->escape($aliasalt).",%')"; } } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 1fd59e0423f..6b8d741968a 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -51,7 +51,7 @@ $websiteid = GETPOST('websiteid', 'int'); $websitekey = GETPOST('website', 'alpha'); $page = GETPOST('page', 'alpha'); $pageid = GETPOST('pageid', 'int'); -$pageref = GETPOST('pageref', 'aZ09'); +$pageref = GETPOST('pageref', 'alphanohtml'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha');