2023-10-06 14:48:06 +01:00
< ? php
if ( ! isset ( $sitename )) { $sitename = " meowboard " ; }
2024-07-28 21:23:46 +01:00
$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="/index.php" id="menu">home</a></li><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="/index.php" id="menu">home</a></li><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="/index.php" id="menu">home</a></li><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>This website is powered by <form style="display:inline;"><button type="submit" formaction="https://git.colean.cc/threeoh6000/meowboard">meowboard</button></form>, licenced under the EUPL 1.2. This theme uses the <form style="display:inline;"><button type="submit" formaction="https://firezenk.github.io/zimit/">Zimit framework</button></form>, licenced under the MIT licence.</footer></body></html>' ;
2024-08-01 14:06:36 +01:00
function printTag ( $tag , $largerFontSize = false ) {
if ( $largerFontSize == false ) {
echo '<tag color="black">' . $tag . '</tag>' ;
} else {
echo '<tag color="black" style="font-size: 1em;">' . $tag . '</tag>' ;
}
}
2023-10-06 14:48:06 +01:00
function dispImage ( $imgurl , $tags ) {
2024-08-01 14:23:06 +01:00
$imgstart = '<div class="thumbnail" style="padding:10px;"><img src="' . $imgurl . '" style="max-height: 200px;"/><br/><div class="details" style="font-size:20px;">' ;
2024-08-01 14:06:36 +01:00
$imgend = '</div></div>' ;
echo " $imgstart " ;
for ( $x = 0 ; $x < count ( $tags ); $x ++ ) {
printTag ( $tags [ $x ]);
}
echo " $imgend " ;
2023-10-06 14:48:06 +01:00
}
function showHeader ( $hideButtons = 0 ) {
2024-08-01 14:06:36 +01:00
// PHP is so quirky!!! I love scoping :sparkling-heart:
global $headerNoButtons ;
global $headerLoggedIn ;
global $headerGuest ;
global $headerAdmin ;
global $db ;
2023-10-06 14:48:06 +01:00
2024-08-01 14:06:36 +01:00
if ( $hideButtons == 1 ) { echo $headerNoButtons ; return ; }
if ( ! empty ( $db ) && isset ( $_COOKIE [ " meowboardSession " ])) {
if ( isAdmin ( tokenToUuid ( $_COOKIE [ " meowboardSession " ])) == 1 ) {
echo $headerAdmin ;
return ;
} else {
echo $headerLoggedIn ;
return ;
}
}
if ( isset ( $_COOKIE [ " meowboardSession " ])) { echo $headerLoggedIn ; return ; }
echo $headerGuest ;
2023-10-06 14:48:06 +01:00
}
?>