Merge pull request #37 from Programvareverkstedet/patch
Various patches; Fix admin groups, update deps
This commit is contained in:
commit
31d9a955df
@ -2,6 +2,6 @@
|
||||
FROM php:7.4-cli
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
sqlite \
|
||||
sqlite3 \
|
||||
unzip \
|
||||
git
|
||||
|
@ -5,5 +5,10 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-pdo_sqlite": "*"
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"simplesamlphp/composer-module-installer": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,17 +51,17 @@ function loginBar($sp = null, $pdo = null) {
|
||||
$userManager = new \pvv\admin\UserManager($pdo);
|
||||
$isAdmin = $userManager->isAdmin($uname);
|
||||
}
|
||||
$result .= "\t<a id=\"login\" href=\"#usermenu\" aria-hidden=\"true\">${svg}" . htmlspecialchars($uname) . "</a>\n";
|
||||
$result .= "\t<a id=\"login\" href=\"#usermenu\" aria-hidden=\"true\">{$svg}" . htmlspecialchars($uname) . "</a>\n";
|
||||
|
||||
$result .= "\n\t<ul id=\"usermenu\">\n";
|
||||
$result .= "\n\t\t<li><a id=\"login\" href=\"#\">${svg}" . htmlspecialchars($uname) . "</a></li>\n";
|
||||
$result .= "\n\t\t<li><a id=\"login\" href=\"#\">{$svg}" . htmlspecialchars($uname) . "</a></li>\n";
|
||||
if ($isAdmin) {
|
||||
$result .= "\n\t\t<li><a href=\"/admin/\">Admin</a></li>\n";
|
||||
}
|
||||
$result .= "\n\t\t<li><a href=\"" . htmlspecialchars($as->getLogoutURL()) . "\">Logg ut</a></li>\n";
|
||||
$result .= "\n\t</ul>\n";
|
||||
} else {
|
||||
$result .= "\t<a id=\"login\" href=\"" . htmlspecialchars($as->getLoginURL()) . "\">${svg}Logg inn</a>\n";
|
||||
$result .= "\t<a id=\"login\" href=\"" . htmlspecialchars($as->getLoginURL()) . "\">{$svg}Logg inn</a>\n";
|
||||
}
|
||||
|
||||
$result .= "\n\t<a href=\"#menu\" id=\"menu_toggle\" aria-hidden=\"true\"><big>☰ </big>MENU</a>\n";
|
||||
|
@ -32,7 +32,7 @@ class UserManager{
|
||||
}
|
||||
|
||||
public function addGroup($uname, $group){
|
||||
$userFlags = $this->getUsergroups();
|
||||
$userFlags = $this->getUsergroups($uname);
|
||||
|
||||
if($userFlags){
|
||||
$newFlags = ($group | $userFlags);
|
||||
@ -41,7 +41,7 @@ class UserManager{
|
||||
}
|
||||
|
||||
public function removeGroup($uname, $group){
|
||||
$userFlags = $this->getUsergroups();
|
||||
$userFlags = $this->getUsergroups($uname);
|
||||
|
||||
if($userFlags){
|
||||
$newFlags = ($userFlags & (~ $group));
|
||||
@ -131,4 +131,4 @@ class UserManager{
|
||||
|
||||
return $users;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -111,6 +111,11 @@ $imageTemplate = '
|
||||
];
|
||||
echo strtr($imageTemplate, $vars);
|
||||
}
|
||||
|
||||
if (count($images) == 0) {
|
||||
echo "<h3 class='no-images'>Det er dessverre ingen bilder å vise.</h3>";
|
||||
}
|
||||
|
||||
?>
|
||||
</main>
|
||||
<div id="modal" class="modal">
|
||||
|
Loading…
Reference in New Issue
Block a user