|
|
@@ -459,17 +459,18 @@ class BxDolPage extends BxDolFactory implements iBxDolFactoryObject, iBxDolRepla
|
|
|
$aUris = explode('/', trim($aParts['path'], '/'));
|
|
|
|
|
|
// check if link starts with page URI and page with this URI exists
|
|
|
- if (!$aUris || empty($aUris[0]) || !($sPageName = BxDolPageQuery::getPageObjectNameByURI($aUris[0])))
|
|
|
+ if (!$aUris || empty($aUris[0]) || !($sPageName = BxDolPageQuery::getPageObjectNameByURI($aUris[0], false, true)))
|
|
|
return false;
|
|
|
|
|
|
+ $aPage = BxDolPageQuery::getPageObject ($sPageName);
|
|
|
+
|
|
|
// make final URL
|
|
|
- $s = 'page.php?i=' . $aUris[0];
|
|
|
+ $s = 'page.php?i=' . $aPage['uri'];
|
|
|
|
|
|
// add params
|
|
|
if (!empty($aUris[1])) {
|
|
|
- $aPage = BxDolPageQuery::getPageObject($sPageName);
|
|
|
if ($aPage) {
|
|
|
- $r = BxDolPageQuery::getSeoLink($aPage['module'], $aUris[0], ['uri' => urldecode($aUris[1])]);
|
|
|
+ $r = BxDolPageQuery::getSeoLink($aPage['module'], $aPage['uri'], ['uri' => urldecode($aUris[1])]);
|
|
|
if (!$r)
|
|
|
return false;
|
|
|
$s .= '&' . $r['param_name'] . '=' . $r['param_value'];
|
|
|
@@ -565,6 +566,11 @@ class BxDolPage extends BxDolFactory implements iBxDolFactoryObject, iBxDolRepla
|
|
|
if(isLogged())
|
|
|
BxDolAccount::getInstance()->isNeedChangePassword();
|
|
|
|
|
|
+ if ($this->isLockedFromUnauthenticated ($this->_aObject['uri'])) {
|
|
|
+ $this->redirectToLoginForm();
|
|
|
+ exit;
|
|
|
+ }
|
|
|
+
|
|
|
if(!$oTemplate)
|
|
|
$oTemplate = BxDolTemplate::getInstance();
|
|
|
|
|
|
@@ -676,7 +682,12 @@ class BxDolPage extends BxDolFactory implements iBxDolFactoryObject, iBxDolRepla
|
|
|
/**
|
|
|
* Check if page is visible.
|
|
|
*/
|
|
|
- protected function _isVisiblePage ($a, $bRedirectToLoginFormForUnauthenticated = false)
|
|
|
+ protected function _isVisiblePage ($a)
|
|
|
+ {
|
|
|
+ return isAdmin() || BxDolAcl::getInstance()->isMemberLevelInSet($a['visible_for_levels']);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function isLockedFromUnauthenticated ($sUri)
|
|
|
{
|
|
|
if (!isLogged() && getParam('sys_lock_from_unauthenticated') && !defined('BX_DOL_CRON_EXECUTE')) {
|
|
|
$aURIs = explode(',', getParam('sys_lock_from_unauthenticated_exceptions'));
|
|
|
@@ -684,20 +695,15 @@ class BxDolPage extends BxDolFactory implements iBxDolFactoryObject, iBxDolRepla
|
|
|
$sVal = trim($sVal);
|
|
|
});
|
|
|
$aI = array_combine($aURIs, array_fill(0, count($aURIs), 1));
|
|
|
- if (!preg_match('/\/oauth2\//', $_SERVER['REQUEST_URI']) /*&& !preg_match('/searchKeyword.php$/', $_SERVER['PHP_SELF'])*/ && !preg_match('/member.php$/', $_SERVER['PHP_SELF']) && !isset($aI[$this->_aObject['uri']])) {
|
|
|
- if ($bRedirectToLoginFormForUnauthenticated) {
|
|
|
- $this->_redirectToLoginForm();
|
|
|
- }
|
|
|
- else {
|
|
|
- return false;
|
|
|
- }
|
|
|
+ if (!preg_match('/\/oauth2\//', $_SERVER['REQUEST_URI']) /*&& !preg_match('/searchKeyword.php$/', $_SERVER['PHP_SELF'])*/ && !preg_match('/member.php$/', $_SERVER['PHP_SELF']) && !isset($aI[$sUri])) {
|
|
|
+ return true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return isAdmin() || BxDolAcl::getInstance()->isMemberLevelInSet($a['visible_for_levels']);
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
- protected function _redirectToLoginForm ()
|
|
|
+ public static function redirectToLoginForm ()
|
|
|
{
|
|
|
header("Location: " . bx_append_url_params(BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=login'), ['relocate' => bx_get_self_url()]));
|
|
|
exit;
|