/** * Check if the current user can access to the provided page id. * If not, the user is redirected to the login page. * * @method imCheckAccess * * @param {string} $page The id of the page to check * @param {string} $pathToRoot The path to reach the root from the current folder */ function imCheckAccess($page, $pathToRoot = "") { $pa = imPrivateArea::getInstance(); $stat = $pa->checkAccess($page); if ($stat !== 0) { $pa->savePage(); header("Location: " . $pathToRoot . "imlogin.php?loginstatus=" . $stat); exit; } }