Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/unaio/una
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLV committed Apr 15, 2022
2 parents d2ef09a + b4d237e commit b78eef6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 6 additions & 2 deletions inc/classes/BxDolPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,7 @@ protected function _isVisiblePage ($a, $bRedirectToLoginFormForUnauthenticated =
$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) {
header("Location: " . bx_append_url_params(BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=login'), ['relocate' => bx_get_self_url()]));
exit;
$this->_redirectToLoginForm();
}
else {
return false;
Expand All @@ -656,6 +655,11 @@ protected function _isVisiblePage ($a, $bRedirectToLoginFormForUnauthenticated =
return isAdmin() || BxDolAcl::getInstance()->isMemberLevelInSet($a['visible_for_levels']);
}

protected 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;
}
}

/** @} */
12 changes: 8 additions & 4 deletions template/scripts/BxBasePageAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,15 @@ public function __construct($aObject, $oTemplate)
}
}

protected function _isVisiblePage ($a)
protected function _isVisiblePage ($a, $bRedirectToLoginFormForUnauthenticated = false)
{
if (!isLogged())
return false;
return parent::_isVisiblePage ($a);
if (!isLogged()) {
if ($bRedirectToLoginFormForUnauthenticated)
$this->_redirectToLoginForm();
else
return false;
}
return parent::_isVisiblePage ($a, $bRedirectToLoginFormForUnauthenticated);
}

protected function _addJsCss()
Expand Down

0 comments on commit b78eef6

Please sign in to comment.