bashtube/templates/header.shs

23 lines
720 B
Bash

#!/bin/bash
declare -A strings_
echo "<link rel='stylesheet' href='/css/style.css'><a href='/'><img src='/img/bashtube.png'></a><br>"
# TODO: move this to a *real* template
# we'll need to figure out conditional templates first tho
if ! session_verify "${cookies[sh_session]}"; then
echo "<a href='/login.shs'>Log in</a> | <a href='/register.shs'>Register</a>"
else
echo "Logged in as ${cookies[username]} | <a href='/logout.shs'>Log out</a> | <a href='/feed.shs'>Your feed</a> | <a href='/fav.shs'>Your favourites</a>"
fi
if [[ "$query_nice" != '' ]]; then
strings_[query_nice]="$query_nice"
else
strings_[query_nice]=''
fi
render strings_ "${cfg[namespace]}/templates/themes/${cfg[template]}/elements/top.t"