From 09dfe32eb6b538225686fd6ed0220240010bc574 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 1 Aug 2011 01:22:36 -0400 Subject: initial commit. Partway through a rewrite. I have some old files I didn't want to entirely delete. --- src/views/pages/auth.php | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/views/pages/auth.php (limited to 'src/views/pages/auth.php') diff --git a/src/views/pages/auth.php b/src/views/pages/auth.php new file mode 100644 index 0000000..2132d67 --- /dev/null +++ b/src/views/pages/auth.php @@ -0,0 +1,65 @@ +isLoggedIn(); + if ($uid===false) { + login(); + } else { + $mm->header('Authentication'); + $t = $mm->template(); + + $username = $mm->getUsername($uid); + + $t->openTag('div',array('class'=>'login')); + $t->text("Logged in as ".htmlentities($username).'.'); + $t->logout_button('Logout'); + $t->closeTag('div'); + + $mm->footer(); + } +} + +function login() { + include(VIEWPATH.'/pages/auth/login.php'); +} + +function logout() { + global $mm; + $t = $mm->template(); + + $mm->logout(); + + $mm->header('Authentication'); + $t->paragraph('Logged out'); + $mm->footer(); +} + +function badrequest() { + global $mm; + $mm->status('400 Bad Request'); + $t = $mm->template(); + + $mm->header('Authentication'); + $t->paragraph('The recieved POST request was malformed/invalid. '. + 'If you got here from a link, this is a bug; '. + 'Let the admin know.'. + 'If you got here from outside, then the API is being '. + 'missused.'); + $mm->footer(); +} -- cgit v1.2.3-2-g168b