summaryrefslogtreecommitdiff
path: root/src/views/pages/auth.php
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-09-04 21:13:47 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-09-04 21:13:47 -0400
commitad4a7ff9159c2c64cea98d7189f46fa7d6174fc2 (patch)
tree508f971f1dbc6c6f01207426c675542b55e0333e /src/views/pages/auth.php
parentf3b3ea69fb46e45bf3598aa7a6bcf62aa80e4703 (diff)
Screw it, I'm tired of trying to break this into individual commits
Diffstat (limited to 'src/views/pages/auth.php')
-rw-r--r--src/views/pages/auth.php65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/views/pages/auth.php b/src/views/pages/auth.php
deleted file mode 100644
index 2132d67..0000000
--- a/src/views/pages/auth.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php global $mm;
-/**
- * This is the view for the main login page.
- */
-
-// TODO: We should probably check to make sure PAGE is just 'auth' or
-// 'auth/', and not something like 'auth/foobar', for which we should
-// throw a 404.
-
-@$action = $_POST['action'];
-switch ($action) {
-case 'login': login(); break;
-case 'logout': logout(); break;
-case '': maybe_login(); break;
-default: badrequest(); break;
-}
-
-function maybe_login() {
- global $mm;
- $uid = $mm->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();
-}