X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/9cd731256b243511a3a1a1fcec76a1d5f27eb6d3..b4c4e7fa6d27e42bd96e48dc2d844eab49778de3:/src/phorkie/HtmlHelper.php diff --git a/src/phorkie/HtmlHelper.php b/src/phorkie/HtmlHelper.php index ca5f989..0a8b926 100644 --- a/src/phorkie/HtmlHelper.php +++ b/src/phorkie/HtmlHelper.php @@ -5,11 +5,14 @@ class HtmlHelper { public function getIconUrl($email, $size = 32) { - if ($email == 'anonymous@phorkie') { + if ($email == 'anonymous@phorkie' + || !$GLOBALS['phorkie']['cfg']['avatars'] + ) { return 'phorkie/anonymous.png'; } $s = new \Services_Libravatar(); + $s->detectHttps(); return $s->url( $email, array( @@ -49,6 +52,35 @@ class HtmlHelper { 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; + } + + public function getRepositoryEmbedCode(Repository $repo) + { + return ''; + } } ?>