Add the login template
authorRobert Sesek <rsesek@bluestatic.org>
Tue, 6 Jan 2009 05:24:09 +0000 (21:24 -0800)
committerRobert Sesek <rsesek@bluestatic.org>
Tue, 6 Jan 2009 05:24:09 +0000 (21:24 -0800)
* global.php: Define some global templates, fix admin_login()
* templates/doctype.html: Whitespace-ify
* templates/headinclude.html: ditto
* templates/login.html: New file

admin/global.php
admin/templates/doctype.html
admin/templates/headinclude.html
admin/templates/login.html [new file with mode: 0644]

index 81061bcd1728cb6fc2f53bd43543f660819dbd43..83b1ecd17c92a00e88f099d3fce847cd2cb60cd4 100755 (executable)
@@ -28,38 +28,30 @@ require_once('./includes/functions.php');
 // setup admin templates
 
 require_once ISSO . '/Template.php';
-BSTemplate::$preParseHook      = 'isso_pre_parse_hook';
 // BSTemplate::$dbCacheTable   = TABLE_PREFIX . 'admintemplate';
-BSTemplate::$langcall          = 'T';
-BSTemplate::$templatePath      = 'templates/%s.tpl';
+BSTemplate::$templatePath      = 'admin/templates/%s.html';
+BSTemplate::$globalVars = array(
+       'templates'     => array(
+               'doctype'               => BSTemplate::fetch('doctype')->evaluate()->getTemplate(),
+               'nav'                   => BSTemplate::fetch('nav')->evaluate()->getTemplate(),
+               'headinclude'   => BSTemplate::fetch('headinclude')->evaluate()->getTemplate(),
+               'title'                 => T('Bugdar Administration')
+       )
+);
 
 // ###################################################################
 
 function admin_login()
 {
-       global $admin, $bugsys;
-       
-       define('ISSO_PRINTER_NO_NAVIGATION', 1);
-       
-       $admin->page_start(T('Login'), null, '', 'document.cplogin.' . (bugdar::$userinfo['email'] ? 'password' : 'email') . '.focus();');
-       
-       $admin->form_start('../login.php', 'cplogin', false, 'cplogin');
-       $admin->table_start(true, '425');
-       $admin->table_head(T('Login to Bugdar'));
-       $admin->row_input(T('Email'), 'email', bugdar::$userinfo['email'], 2, 35, false, false, 'middle');
-       $admin->row_input(T('Password'), 'password', '', 2, 35, false, true, 'middle');
-       $admin->row_submit('', T('Login'));
-       $admin->table_end();
-       $admin->form_end();
-       
-       $admin->page_end();
+       BSTemplate::fetch('login')->evaluate()->flush();
+       exit;
 }
 
 // ###################################################################
 
 if (can_perform('canadminpanel'))
 {
-       $session = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "adminsession WHERE sessionid = '" . $bugsys->input_escape(COOKIE_PREFIX . 'adminsession') . "'");
+       $session = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "adminsession WHERE sessionid = '" . $input->inputEscape(COOKIE_PREFIX . 'adminsession') . "'");
        if ($session AND $session['userid'] == bugdar::$userinfo['userid'] AND $session['dateline'] >= (TIMENOW - 3600))
        {
                // renew the cookie
@@ -69,8 +61,6 @@ if (can_perform('canadminpanel'))
        {
                BSFunctions::cookie(COOKIE_PREFIX . 'adminsession', false);
                admin_login();
-               // do we need this message?
-               $admin->error(T('Invalid admin session has been terminated.'));
        }
 }
 else
index fd6f9469abc255f126952e1ee2d62373ac94898c..aa8d9a8a35b3ed85eccd96ce380ba74c80a4c8fc 100644 (file)
@@ -1,2 +1,2 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
\ No newline at end of file
+       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
index 4f6246c287e7e09c559a562813d54c478be9bccc..9519bfa193e246de8fa12d7bdb65345b82b5ae30 100644 (file)
@@ -1,3 +1,4 @@
+
        <meta http-equiv="Content-Type" content="text/html; charset=<%- $stylevar[charset] %>" />
        <link rel="stylesheet" type="text/css" href="../includes/framework/Decorator.css.php" media="screen" />
        <script src="../includes/framework/Decorator.js" type="text/javascript"></script>
\ No newline at end of file
diff --git a/admin/templates/login.html b/admin/templates/login.html
new file mode 100644 (file)
index 0000000..b517ac1
--- /dev/null
@@ -0,0 +1,41 @@
+<%- $templates['doctype'] %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
+<head>
+       <%- $templates['headinclude'] %>
+       <title><%- $templates['title'] %> - <%- T('Login') %></title>
+</head>
+
+<body onload="document.getElementById('<%- (bugdar::$userinfo['userid']) ? 'password' : 'email' %>').focus()">
+
+<div id="title"><%- T('Bugdar Admin Control Panel Login') %></div>
+
+<div id="body">
+
+<form action="../login.php" method="post">
+<input type="hidden" name="do" value="cplogin" />
+
+<div style="width: 375px; margin: auto">
+<fieldset>
+       <legend><%- T('Login') %></legend>
+       <dfn>Please enter your Bugdar email address and password to proceed into the Admin Control Panel.</dfn>
+       
+       <dl>
+               <dt><label for="email"><%- T('Email') %></label></dt>
+               <dd><input type="text" name="email" value="<%- bugdar::$userinfo['email'] %>" id="email" /></dd>
+               
+               <dt><label for="password"><%- T('Password') %></label></dt>
+               <dd><input type="password" name="password" value="" id="password" /></dd>
+       </dl>
+</fieldset>
+<div class="submit">
+       <input type="submit" name="submit" value="<%- T('Login') %>" id="submit" />
+       <input type="button" name="cancel" value="<%- T('Cancel') %>" id="cancel" onclick="window.location='..'" />
+</div>
+</div>
+
+</form>
+
+</div>
+</body>
+
+</html>
\ No newline at end of file