about summary refs log tree commit diff stats
path: root/series/core/trunk/admin
diff options
context:
space:
mode:
Diffstat (limited to 'series/core/trunk/admin')
-rw-r--r--series/core/trunk/admin/addsub.php129
-rw-r--r--series/core/trunk/admin/chpwd.php132
-rw-r--r--series/core/trunk/admin/login.php95
-rw-r--r--series/core/trunk/admin/logout.php26
-rw-r--r--series/core/trunk/admin/main.php25
5 files changed, 0 insertions, 407 deletions
diff --git a/series/core/trunk/admin/addsub.php b/series/core/trunk/admin/addsub.php deleted file mode 100644 index f462d3f..0000000 --- a/series/core/trunk/admin/addsub.php +++ /dev/null
@@ -1,129 +0,0 @@
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 */
14require_once('includes/instadisc.php');
15
16if (!isset($_SESSION['username']))
17{
18 header('Location: index.php');
19 exit;
20}
21
22if (!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
61function 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
98function 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
111function 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
123function addError(&$numOfErrors, &$errors, $field, $msg)
124{
125 $numOfErrors++;
126 $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg);
127}
128
129?>
diff --git a/series/core/trunk/admin/chpwd.php b/series/core/trunk/admin/chpwd.php deleted file mode 100644 index 2f5368d..0000000 --- a/series/core/trunk/admin/chpwd.php +++ /dev/null
@@ -1,132 +0,0 @@
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 */
14require_once('includes/instadisc.php');
15
16if (!isset($_SESSION['username']))
17{
18 header('Location: index.php');
19}
20
21if (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
70function 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
101function 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
114function 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
126function addError(&$numOfErrors, &$errors, $field, $msg)
127{
128 $numOfErrors++;
129 $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg);
130}
131
132?>
diff --git a/series/core/trunk/admin/login.php b/series/core/trunk/admin/login.php deleted file mode 100644 index fe394a1..0000000 --- a/series/core/trunk/admin/login.php +++ /dev/null
@@ -1,95 +0,0 @@
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 */
14require_once('includes/instadisc.php');
15
16if (!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
36function 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
64function 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
77function 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
89function addError(&$numOfErrors, &$errors, $field, $msg)
90{
91 $numOfErrors++;
92 $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg);
93}
94
95?>
diff --git a/series/core/trunk/admin/logout.php b/series/core/trunk/admin/logout.php deleted file mode 100644 index 779a1d2..0000000 --- a/series/core/trunk/admin/logout.php +++ /dev/null
@@ -1,26 +0,0 @@
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 */
14require_once('includes/instadisc.php');
15
16if (!isset($_SESSION['username']))
17{
18 header('Location: index.php');
19 exit;
20}
21
22unset($_SESSION['username']);
23
24header('Location: index.php');
25
26?>
diff --git a/series/core/trunk/admin/main.php b/series/core/trunk/admin/main.php deleted file mode 100644 index eb0e35b..0000000 --- a/series/core/trunk/admin/main.php +++ /dev/null
@@ -1,25 +0,0 @@
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 */
14require_once('includes/instadisc.php');
15
16if (!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?>