X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/14786d88c624bb00e19f2451e964bffb2e7bd8ea..536ef0bf5315002c5a45c179f71562ca1a1da3d5:/src/phorkie/HtmlHelper.php diff --git a/src/phorkie/HtmlHelper.php b/src/phorkie/HtmlHelper.php index fd04d83..d234685 100644 --- a/src/phorkie/HtmlHelper.php +++ b/src/phorkie/HtmlHelper.php @@ -5,8 +5,10 @@ class HtmlHelper { public function getIconUrl($email, $size = 32) { - if ($email == 'anonymous@phorkie') { - return '/phorkie/anonymous.png'; + if ($email == 'anonymous@phorkie' + || !$GLOBALS['phorkie']['cfg']['avatars'] + ) { + return 'phorkie/anonymous.png'; } $s = new \Services_Libravatar(); @@ -14,7 +16,7 @@ class HtmlHelper $email, array( 'size' => $size, - 'default' => Tools::fullUrl('/phorkie/anonymous.png') + 'default' => Tools::fullUrl('phorkie/anonymous.png') ) ); } @@ -39,6 +41,38 @@ 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; + } } ?>