diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-10 21:06:49 +0000 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-10 21:06:49 +0000 |
commit | 44c3bc48b5db7b3dc6517d2b073a55af5d4b52db (patch) | |
tree | a48f63061f3cfe5427ce1bc313147cf6be0e739a /series/trunk/admin | |
parent | a9a796498285358e7a2f1fde5043e4015de5db70 (diff) | |
download | instadisc-44c3bc48b5db7b3dc6517d2b073a55af5d4b52db.tar.gz instadisc-44c3bc48b5db7b3dc6517d2b073a55af5d4b52db.tar.bz2 instadisc-44c3bc48b5db7b3dc6517d2b073a55af5d4b52db.zip |
Series: Moved around directory structure
Refs #55
Diffstat (limited to 'series/trunk/admin')
-rw-r--r-- | series/trunk/admin/addsub.php | 129 | ||||
-rw-r--r-- | series/trunk/admin/chpwd.php | 132 | ||||
-rw-r--r-- | series/trunk/admin/login.php | 95 | ||||
-rw-r--r-- | series/trunk/admin/logout.php | 26 | ||||
-rw-r--r-- | series/trunk/admin/main.php | 25 |
5 files changed, 407 insertions, 0 deletions
diff --git a/series/trunk/admin/addsub.php b/series/trunk/admin/addsub.php new file mode 100644 index 0000000..f462d3f --- /dev/null +++ b/series/trunk/admin/addsub.php | |||
@@ -0,0 +1,129 @@ | |||
1 | <?php | ||
2 | |||
3 | /* InstaDisc Series - A Four Island Project */ | ||
4 | |||
5 | /** | ||
6 | * require_once() is used to ensure | ||
7 | * the ACP files are being called by | ||
8 | * admin.php instead of their actual | ||
9 | * locations admin/. | ||
10 | * The _once() part ensures no problem | ||
11 | * arises as includes/instadisc.php has | ||
12 | * already been included from admin.php | ||
13 | */ | ||
14 | require_once('includes/instadisc.php'); | ||
15 | |||
16 | if (!isset($_SESSION['username'])) | ||
17 | { | ||
18 | header('Location: index.php'); | ||
19 | exit; | ||
20 | } | ||
21 | |||
22 | if (!isset($_GET['submit'])) | ||
23 | { | ||
24 | showForm('','','','','',array()); | ||
25 | } else { | ||
26 | $numOfErrors = 0; | ||
27 | $errors = array(); | ||
28 | |||
29 | if ($_POST['id'] == '') | ||
30 | { | ||
31 | addError($numOfErrors, $errors, 'id', 'Subscription ID is a required field'); | ||
32 | } | ||
33 | |||
34 | if ($_POST['title'] == '') | ||
35 | { | ||
36 | addError($numOfErrors, $errors, 'title', 'Title is a required field'); | ||
37 | } | ||
38 | |||
39 | if ($_POST['url'] == '') | ||
40 | { | ||
41 | addError($numOfErrors, $errors, 'url', 'Subscription URL is a required field'); | ||
42 | } | ||
43 | |||
44 | if ($_POST['category'] == '') | ||
45 | { | ||
46 | addError($numOfErrors, $errors, 'category', 'Category is a required field'); | ||
47 | } | ||
48 | |||
49 | if ($numOfErrors > 0) | ||
50 | { | ||
51 | showForm($_POST['id'], $_POST['title'], $_POST['url'], $_POST['category'], $_POST['password'], $errors); | ||
52 | } else { | ||
53 | instaDisc_addSubscription($_POST['id'], $_POST['title'], $_POST['url'], $_POST['category'], $_POST['password']); | ||
54 | |||
55 | $template = new FITemplate('addedsub'); | ||
56 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
57 | $template->display(); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | function showForm($id, $title, $url, $category, $password, $errors) | ||
62 | { | ||
63 | $template = new FITemplate('addsub'); | ||
64 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
65 | |||
66 | if (isset($errors[1])) | ||
67 | { | ||
68 | $template->adds_block('ERROR', array('ex'=>'1')); | ||
69 | |||
70 | foreach ($errors as $name => $value) | ||
71 | { | ||
72 | $template->adds_block('ERRORS', array( 'NAME' => $name, | ||
73 | 'MSG' => $value['msg'])); | ||
74 | } | ||
75 | } | ||
76 | |||
77 | $template->add('ID_ERR', ifErrors($errors, 'id')); | ||
78 | $template->add('TITLE_ERR', ifErrors($errors, 'title')); | ||
79 | $template->add('URL_ERR', ifErrors($errors, 'url')); | ||
80 | $template->add('CATEGORY_ERR', ifErrors($errors, 'url')); | ||
81 | $template->add('PASSWORD_ERR', ifErrors($errors, 'url')); | ||
82 | |||
83 | doErrors($template, $errors, 'id'); | ||
84 | doErrors($template, $errors, 'title'); | ||
85 | doErrors($template, $errors, 'url'); | ||
86 | doErrors($template, $errors, 'category'); | ||
87 | doErrors($template, $errors, 'password'); | ||
88 | |||
89 | $template->add('ID', $id); | ||
90 | $template->add('TITLE', $title); | ||
91 | $template->add('URL', $url); | ||
92 | $template->add('CATEGORY', $category); | ||
93 | $template->add('PASSWORD', $password); | ||
94 | |||
95 | $template->display(); | ||
96 | } | ||
97 | |||
98 | function ifErrors($errors, $id) | ||
99 | { | ||
100 | foreach ($errors as $name => $value) | ||
101 | { | ||
102 | if ($value['field'] == $id) | ||
103 | { | ||
104 | return ' error'; | ||
105 | } | ||
106 | } | ||
107 | |||
108 | return ''; | ||
109 | } | ||
110 | |||
111 | function doErrors($template, $errors, $id) | ||
112 | { | ||
113 | foreach ($errors as $name => $value) | ||
114 | { | ||
115 | if ($value['field'] == $id) | ||
116 | { | ||
117 | $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, | ||
118 | 'VALUE' => $value['msg'])); | ||
119 | } | ||
120 | } | ||
121 | } | ||
122 | |||
123 | function addError(&$numOfErrors, &$errors, $field, $msg) | ||
124 | { | ||
125 | $numOfErrors++; | ||
126 | $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); | ||
127 | } | ||
128 | |||
129 | ?> | ||
diff --git a/series/trunk/admin/chpwd.php b/series/trunk/admin/chpwd.php new file mode 100644 index 0000000..2f5368d --- /dev/null +++ b/series/trunk/admin/chpwd.php | |||
@@ -0,0 +1,132 @@ | |||
1 | <?php | ||
2 | |||
3 | /* InstaDisc Series - A Four Island Project */ | ||
4 | |||
5 | /** | ||
6 | * require_once() is used to ensure | ||
7 | * the ACP files are being called by | ||
8 | * admin.php instead of their actual | ||
9 | * locations admin/. | ||
10 | * The _once() part ensures no problem | ||
11 | * arises as includes/instadisc.php has | ||
12 | * already been included from admin.php | ||
13 | */ | ||
14 | require_once('includes/instadisc.php'); | ||
15 | |||
16 | if (!isset($_SESSION['username'])) | ||
17 | { | ||
18 | header('Location: index.php'); | ||
19 | } | ||
20 | |||
21 | if (isset($_SESSION['username'])) | ||
22 | { | ||
23 | if (!isset($_GET['submit'])) | ||
24 | { | ||
25 | showForm('','','',array()); | ||
26 | } else { | ||
27 | $numOfErrors = 0; | ||
28 | $errors = array(); | ||
29 | |||
30 | if ($_POST['old'] == '') | ||
31 | { | ||
32 | addError($numOfErrors, $errors, 'old', 'Old Password is a required field'); | ||
33 | } else { | ||
34 | if (!instaDisc_verifyUser($_SESSION['username'], $_POST['old'])) | ||
35 | { | ||
36 | addError($numOfErrors, $errors, 'old', 'Old password is not correct'); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | if ($_POST['new'] == '') | ||
41 | { | ||
42 | addError($numOfErrors, $errors, 'new', 'New Password is a required field'); | ||
43 | } | ||
44 | |||
45 | if ($_POST['confirm'] == '') | ||
46 | { | ||
47 | addError($numOfErrors, $errors, 'confirm', 'Confirm New Password is a required field'); | ||
48 | } | ||
49 | |||
50 | if ($_POST['new'] != $_POST['confirm']) | ||
51 | { | ||
52 | addError($numOfErrors, $errors, 'confirm', 'Passwords do not match'); | ||
53 | } | ||
54 | |||
55 | if ($numOfErrors > 0) | ||
56 | { | ||
57 | showForm($_POST['old'], $_POST['new'], $_POST['confirm'], $errors); | ||
58 | } else { | ||
59 | instaDisc_changePassword( $_POST['new']); | ||
60 | |||
61 | $template = new FITemplate('changedpassword'); | ||
62 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
63 | $template->display(); | ||
64 | } | ||
65 | } | ||
66 | } else { | ||
67 | header('Location: index.php'); | ||
68 | } | ||
69 | |||
70 | function showForm($old, $new, $confirm, $errors) | ||
71 | { | ||
72 | $template = new FITemplate('changepassword'); | ||
73 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
74 | |||
75 | if (isset($errors[1])) | ||
76 | { | ||
77 | $template->adds_block('ERROR', array('ex'=>'1')); | ||
78 | |||
79 | foreach ($errors as $name => $value) | ||
80 | { | ||
81 | $template->adds_block('ERRORS', array( 'NAME' => $name, | ||
82 | 'MSG' => $value['msg'])); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | $template->add('OLD_ERR', ifErrors($errors, 'old')); | ||
87 | $template->add('NEW_ERR', ifErrors($errors, 'new')); | ||
88 | $template->add('CONFIRM_ERR', ifErrors($errors, 'confirm')); | ||
89 | |||
90 | doErrors($template, $errors, 'old'); | ||
91 | doErrors($template, $errors, 'new'); | ||
92 | doErrors($template, $errors, 'confirm'); | ||
93 | |||
94 | $template->add('OLD', $old); | ||
95 | $template->add('NEW', $new); | ||
96 | $template->add('CONFIRM', $confirm); | ||
97 | |||
98 | $template->display(); | ||
99 | } | ||
100 | |||
101 | function ifErrors($errors, $id) | ||
102 | { | ||
103 | foreach ($errors as $name => $value) | ||
104 | { | ||
105 | if ($value['field'] == $id) | ||
106 | { | ||
107 | return ' error'; | ||
108 | } | ||
109 | } | ||
110 | |||
111 | return ''; | ||
112 | } | ||
113 | |||
114 | function doErrors($template, $errors, $id) | ||
115 | { | ||
116 | foreach ($errors as $name => $value) | ||
117 | { | ||
118 | if ($value['field'] == $id) | ||
119 | { | ||
120 | $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, | ||
121 | 'VALUE' => $value['msg'])); | ||
122 | } | ||
123 | } | ||
124 | } | ||
125 | |||
126 | function addError(&$numOfErrors, &$errors, $field, $msg) | ||
127 | { | ||
128 | $numOfErrors++; | ||
129 | $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); | ||
130 | } | ||
131 | |||
132 | ?> | ||
diff --git a/series/trunk/admin/login.php b/series/trunk/admin/login.php new file mode 100644 index 0000000..fe394a1 --- /dev/null +++ b/series/trunk/admin/login.php | |||
@@ -0,0 +1,95 @@ | |||
1 | <?php | ||
2 | |||
3 | /* InstaDisc Series - A Four Island Project */ | ||
4 | |||
5 | /** | ||
6 | * require_once() is used to ensure | ||
7 | * the ACP files are being called by | ||
8 | * admin.php instead of their actual | ||
9 | * locations admin/. | ||
10 | * The _once() part ensures no problem | ||
11 | * arises as includes/instadisc.php has | ||
12 | * already been included from admin.php | ||
13 | */ | ||
14 | require_once('includes/instadisc.php'); | ||
15 | |||
16 | if (!isset($_GET['submit'])) | ||
17 | { | ||
18 | showForm('','',array()); | ||
19 | } else { | ||
20 | $numOfErrors = 0; | ||
21 | $errors = array(); | ||
22 | |||
23 | if (instaDisc_verifyUser($_POST['username'], $_POST['password'])) | ||
24 | { | ||
25 | $_SESSION['username'] = $_POST['username']; | ||
26 | |||
27 | $template = new FITemplate('loggedin'); | ||
28 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
29 | $template->display(); | ||
30 | } else { | ||
31 | addError($numOfErrors, $errors, '', 'Account could not be found'); | ||
32 | showForm($_POST['username'], $_POST['password'], $errors); | ||
33 | } | ||
34 | } | ||
35 | |||
36 | function showForm($username, $password, $errors) | ||
37 | { | ||
38 | $template = new FITemplate('login'); | ||
39 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
40 | |||
41 | if (isset($errors[1])) | ||
42 | { | ||
43 | $template->adds_block('ERROR', array('ex'=>'1')); | ||
44 | |||
45 | foreach ($errors as $name => $value) | ||
46 | { | ||
47 | $template->adds_block('ERRORS', array( 'NAME' => $name, | ||
48 | 'MSG' => $value['msg'])); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | $template->add('USERNAME_ERR', ifErrors($errors, 'username')); | ||
53 | $template->add('PASSWORD_ERR', ifErrors($errors, 'password')); | ||
54 | |||
55 | doErrors($template, $errors, 'username'); | ||
56 | doErrors($template, $errors, 'password'); | ||
57 | |||
58 | $template->add('USERNAME', $username); | ||
59 | $template->add('PASSWORD', $password); | ||
60 | |||
61 | $template->display(); | ||
62 | } | ||
63 | |||
64 | function ifErrors($errors, $id) | ||
65 | { | ||
66 | foreach ($errors as $name => $value) | ||
67 | { | ||
68 | if ($value['field'] == $id) | ||
69 | { | ||
70 | return ' error'; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | return ''; | ||
75 | } | ||
76 | |||
77 | function doErrors($template, $errors, $id) | ||
78 | { | ||
79 | foreach ($errors as $name => $value) | ||
80 | { | ||
81 | if ($value['field'] == $id) | ||
82 | { | ||
83 | $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, | ||
84 | 'VALUE' => $value['msg'])); | ||
85 | } | ||
86 | } | ||
87 | } | ||
88 | |||
89 | function addError(&$numOfErrors, &$errors, $field, $msg) | ||
90 | { | ||
91 | $numOfErrors++; | ||
92 | $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); | ||
93 | } | ||
94 | |||
95 | ?> | ||
diff --git a/series/trunk/admin/logout.php b/series/trunk/admin/logout.php new file mode 100644 index 0000000..779a1d2 --- /dev/null +++ b/series/trunk/admin/logout.php | |||
@@ -0,0 +1,26 @@ | |||
1 | <?php | ||
2 | |||
3 | /* InstaDisc Series - A Four Island Project */ | ||
4 | |||
5 | /** | ||
6 | * require_once() is used to ensure | ||
7 | * the ACP files are being called by | ||
8 | * admin.php instead of their actual | ||
9 | * locations admin/. | ||
10 | * The _once() part ensures no problem | ||
11 | * arises as includes/instadisc.php has | ||
12 | * already been included from admin.php | ||
13 | */ | ||
14 | require_once('includes/instadisc.php'); | ||
15 | |||
16 | if (!isset($_SESSION['username'])) | ||
17 | { | ||
18 | header('Location: index.php'); | ||
19 | exit; | ||
20 | } | ||
21 | |||
22 | unset($_SESSION['username']); | ||
23 | |||
24 | header('Location: index.php'); | ||
25 | |||
26 | ?> | ||
diff --git a/series/trunk/admin/main.php b/series/trunk/admin/main.php new file mode 100644 index 0000000..eb0e35b --- /dev/null +++ b/series/trunk/admin/main.php | |||
@@ -0,0 +1,25 @@ | |||
1 | <?php | ||
2 | |||
3 | /* InstaDisc Series - A Four Island Project */ | ||
4 | |||
5 | /** | ||
6 | * require_once() is used to ensure | ||
7 | * the ACP files are being called by | ||
8 | * admin.php instead of their actual | ||
9 | * locations admin/. | ||
10 | * The _once() part ensures no problem | ||
11 | * arises as includes/instadisc.php has | ||
12 | * already been included from admin.php | ||
13 | */ | ||
14 | require_once('includes/instadisc.php'); | ||
15 | |||
16 | if (!isset($_SESSION['username'])) | ||
17 | { | ||
18 | header('Location: index.php'); | ||
19 | } | ||
20 | |||
21 | $template = new FITemplate('main'); | ||
22 | $template->add('SITENAME',instaDisc_getConfig('siteName')); | ||
23 | $template->display(); | ||
24 | |||
25 | ?> | ||