X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/d06f9e8ea6cefcfae1ad28bb203a7e4e562820a8..0e362c3a8a13e7e2ae7d5c1a5d2e5eaa163d153f:/src/phorkie/HtmlHelper.php diff --git a/src/phorkie/HtmlHelper.php b/src/phorkie/HtmlHelper.php index efde714..c3336c3 100644 --- a/src/phorkie/HtmlHelper.php +++ b/src/phorkie/HtmlHelper.php @@ -40,10 +40,37 @@ class HtmlHelper return $html; } + public function getDomain($url) + { + return parse_url($url, PHP_URL_HOST); + } + public function fullUrl($path = '') { return Tools::fullUrl($path); } + + public function mayWriteLocally() + { + if ($GLOBALS['phorkie']['auth']['securityLevel'] == 0) { + //everyone may do everything + return true; + } + + $logged_in = false; + if (!isset($_SESSION['identity'])) { + //not logged in + } else if ($GLOBALS['phorkie']['auth']['listedUsersOnly']) { + if (in_array($_SESSION['identity'], $GLOBALS['phorkie']['auth']['users'])) { + $logged_in = true; + } + } else { + //session identity exists, no special checks required + $logged_in = true; + } + + return $logged_in; + } } ?>