From 5e84520b571eda5f69ce907aa838820533fd0737 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 7 Sep 2008 14:55:06 +0000 Subject: Series: Started ACP Refs #53 --- series/core/trunk/admin.php | 21 +++++++ series/core/trunk/admin/login.php | 95 ++++++++++++++++++++++++++++++++ series/core/trunk/admin/main.php | 25 +++++++++ series/core/trunk/includes/instadisc.php | 5 ++ series/core/trunk/theme/loggedin.tpl | 14 +++++ series/core/trunk/theme/login.tpl | 61 ++++++++++++++++++++ series/core/trunk/theme/main.tpl | 13 +++++ 7 files changed, 234 insertions(+) create mode 100644 series/core/trunk/admin.php create mode 100644 series/core/trunk/admin/login.php create mode 100644 series/core/trunk/admin/main.php create mode 100644 series/core/trunk/theme/loggedin.tpl create mode 100644 series/core/trunk/theme/login.tpl create mode 100644 series/core/trunk/theme/main.tpl (limited to 'series') diff --git a/series/core/trunk/admin.php b/series/core/trunk/admin.php new file mode 100644 index 0000000..db637bd --- /dev/null +++ b/series/core/trunk/admin.php @@ -0,0 +1,21 @@ + diff --git a/series/core/trunk/admin/login.php b/series/core/trunk/admin/login.php new file mode 100644 index 0000000..fe394a1 --- /dev/null +++ b/series/core/trunk/admin/login.php @@ -0,0 +1,95 @@ +add('SITENAME', instaDisc_getConfig('siteName')); + $template->display(); + } else { + addError($numOfErrors, $errors, '', 'Account could not be found'); + showForm($_POST['username'], $_POST['password'], $errors); + } +} + +function showForm($username, $password, $errors) +{ + $template = new FITemplate('login'); + $template->add('SITENAME', instaDisc_getConfig('siteName')); + + if (isset($errors[1])) + { + $template->adds_block('ERROR', array('ex'=>'1')); + + foreach ($errors as $name => $value) + { + $template->adds_block('ERRORS', array( 'NAME' => $name, + 'MSG' => $value['msg'])); + } + } + + $template->add('USERNAME_ERR', ifErrors($errors, 'username')); + $template->add('PASSWORD_ERR', ifErrors($errors, 'password')); + + doErrors($template, $errors, 'username'); + doErrors($template, $errors, 'password'); + + $template->add('USERNAME', $username); + $template->add('PASSWORD', $password); + + $template->display(); +} + +function ifErrors($errors, $id) +{ + foreach ($errors as $name => $value) + { + if ($value['field'] == $id) + { + return ' error'; + } + } + + return ''; +} + +function doErrors($template, $errors, $id) +{ + foreach ($errors as $name => $value) + { + if ($value['field'] == $id) + { + $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, + 'VALUE' => $value['msg'])); + } + } +} + +function addError(&$numOfErrors, &$errors, $field, $msg) +{ + $numOfErrors++; + $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); +} + +?> diff --git a/series/core/trunk/admin/main.php b/series/core/trunk/admin/main.php new file mode 100644 index 0000000..eb0e35b --- /dev/null +++ b/series/core/trunk/admin/main.php @@ -0,0 +1,25 @@ +add('SITENAME',instaDisc_getConfig('siteName')); +$template->display(); + +?> diff --git a/series/core/trunk/includes/instadisc.php b/series/core/trunk/includes/instadisc.php index 3e0ff32..e044cdc 100644 --- a/series/core/trunk/includes/instadisc.php +++ b/series/core/trunk/includes/instadisc.php @@ -51,4 +51,9 @@ function instaDisc_getConfig($name) return $getconfig3['value']; } +function instaDisc_verifyUser($username, $password) +{ + return (($username == instaDisc_getConfig('adminUser')) && (md5($password) == instaDisc_getConfig('adminPass'))); +} + ?> diff --git a/series/core/trunk/theme/loggedin.tpl b/series/core/trunk/theme/loggedin.tpl new file mode 100644 index 0000000..b5e317a --- /dev/null +++ b/series/core/trunk/theme/loggedin.tpl @@ -0,0 +1,14 @@ + + + <!--SITENAME--> InstaDisc Series Control + + + +
+

InstaDisc Sign-in

+ +

Thank you for logging in. You may now procede to the ACP +

+ + + diff --git a/series/core/trunk/theme/login.tpl b/series/core/trunk/theme/login.tpl new file mode 100644 index 0000000..2cc2a82 --- /dev/null +++ b/series/core/trunk/theme/login.tpl @@ -0,0 +1,61 @@ + + + <!--SITENAME--> InstaDisc Series Control + + + + +
+

InstaDisc Sign-in

+ +

If you are the administrator of this Series Control, feel free to login here. +

+ +
+ + +
Uh oh! Validation errors!

+

    + + + +
  1. + + + +
+
+ + +
+ User Details + +
+ +

* + +

+ + + + +
+ +
+ +

* + +

+ + + + +
+
+ +
+ +
+
+ + diff --git a/series/core/trunk/theme/main.tpl b/series/core/trunk/theme/main.tpl new file mode 100644 index 0000000..982be74 --- /dev/null +++ b/series/core/trunk/theme/main.tpl @@ -0,0 +1,13 @@ +
+

+

Series Control ACP

+ +Here are some actions you can preform: + +

+
-- cgit 1.4.1