42 lines
3 KiB
PHP
42 lines
3 KiB
PHP
|
<?php
|
||
|
|
||
|
if(!isset($sitename)) { $sitename = "meowboard"; }
|
||
|
$headerGuest = '<!DOCTYPE html><html><head><meta charset="utf-8"><title>' . $sitename . '</title><meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="stylesheet" type="text/css" href="css/zimit.min.css"><link rel="stylesheet" type="text/css" href="css/custom.css"></head><body><header><nav><a class="site">' . $sitename . '</a><ul id="menu"><li><a href="login.php" id="menu">login</a></li></ul></nav></header><br/><main>';
|
||
|
$headerNoButtons = '<!DOCTYPE html><html><head><meta charset="utf-8"><title>' . $sitename . '</title><meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="stylesheet" type="text/css" href="css/zimit.min.css"><link rel="stylesheet" type="text/css" href="css/custom.css"></head><body><header><nav><a class="site">' . $sitename . '</a></nav></header><br/><main>';
|
||
|
$headerLoggedIn = '<!DOCTYPE html><html><head><meta charset="utf-8"><title>' . $sitename . '</title><meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="stylesheet" type="text/css" href="css/zimit.min.css"><link rel="stylesheet" type="text/css" href="css/custom.css"></head><body><header><nav><a class="site">' . $sitename . '</a><ul id="menu"><li><a href="upload.php" id="menu">upload</a></li><li><a href="settings.php" id="menu">settings</a></li><li><a href="logout.php" id="menu">logout</a></li></ul></nav></header><br/><main>';
|
||
|
$headerAdmin = '<!DOCTYPE html><html><head><meta charset="utf-8"><title>' . $sitename . '</title><meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="stylesheet" type="text/css" href="css/zimit.min.css"><link rel="stylesheet" type="text/css" href="css/custom.css"></head><body><header><nav><a class="site">' . $sitename . '</a><ul id="menu"><li><a href="upload.php" id="menu">upload</a></li><li><a href="settings.php" id="menu">settings</a></li><li><a href="admin.php" id="menu">admin</a></li><li><a href="logout.php" id="menu">logout</a></li></ul></nav></header><br/><main>';
|
||
|
$footer = '</main><footer>bla bla copyright content and like uh meow</footer></body></html>';
|
||
|
function dispImage($imgurl, $tags) {
|
||
|
$imgstart = '<div class="thumbnail" style="padding:10px;"><img src="' . $imgurl . '"/><br/><div class="details" style="font-size:20px;">';
|
||
|
$imgend = '</div></div>';
|
||
|
echo "$imgstart";
|
||
|
for($x = 0; $x < count($tags); $x++) {
|
||
|
$tagblock = '<tag color="black">' . $tags[$x] . '</tag>';
|
||
|
echo "$tagblock";
|
||
|
}
|
||
|
echo "$imgend";
|
||
|
}
|
||
|
|
||
|
function showHeader($hideButtons = 0) {
|
||
|
// PHP is so quirky!!! I love scoping :sparkling-heart:
|
||
|
global $headerNoButtons;
|
||
|
global $headerLoggedIn;
|
||
|
global $headerGuest;
|
||
|
global $headerAdmin;
|
||
|
global $db;
|
||
|
|
||
|
if ($hideButtons == 1) { echo $headerNoButtons; return; }
|
||
|
if (!empty($db) && isset($_COOKIE["meowboardSession"])) {
|
||
|
if (isAdmin(tokenToUsername($_COOKIE["meowboardSession"])) == 1) {
|
||
|
echo $headerAdmin;
|
||
|
return;
|
||
|
} else {
|
||
|
echo $headerLoggedIn;
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
if (isset($_COOKIE["meowboardSession"])) { echo $headerLoggedIn; return; }
|
||
|
echo $headerGuest;
|
||
|
}
|
||
|
?>
|