diff options
Diffstat (limited to 'series/trunk/admin')
| -rw-r--r-- | series/trunk/admin/addsub.php | 129 | ||||
| -rw-r--r-- | series/trunk/admin/adduser.php | 110 | ||||
| -rw-r--r-- | series/trunk/admin/chpwd.php | 134 | ||||
| -rw-r--r-- | series/trunk/admin/deletesub.php | 71 | ||||
| -rw-r--r-- | series/trunk/admin/deleteuser.php | 49 | ||||
| -rw-r--r-- | series/trunk/admin/editsub.php | 151 | ||||
| -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 | 32 | ||||
| -rw-r--r-- | series/trunk/admin/mansub.php | 45 | ||||
| -rw-r--r-- | series/trunk/admin/manuser.php | 46 |
11 files changed, 0 insertions, 888 deletions
| diff --git a/series/trunk/admin/addsub.php b/series/trunk/admin/addsub.php deleted file mode 100644 index 4fdd907..0000000 --- a/series/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 | */ | ||
| 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_initSubscription($_SESSION['username'], $_POST['id'], $_POST['url'], $_POST['title'], $_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, 'category')); | ||
| 81 | $template->add('PASSWORD_ERR', ifErrors($errors, 'password')); | ||
| 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/adduser.php b/series/trunk/admin/adduser.php deleted file mode 100644 index dcad5d5..0000000 --- a/series/trunk/admin/adduser.php +++ /dev/null | |||
| @@ -1,110 +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 | */ | ||
| 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['username'] == '') | ||
| 30 | { | ||
| 31 | addError($numOfErrors, $errors, 'username', 'Username is a required field'); | ||
| 32 | } | ||
| 33 | |||
| 34 | if ($_POST['password'] == '') | ||
| 35 | { | ||
| 36 | addError($numOfErrors, $errors, 'password', 'Password is a required field'); | ||
| 37 | } | ||
| 38 | |||
| 39 | if ($numOfErrors > 0) | ||
| 40 | { | ||
| 41 | showForm($_POST['username'], $_POST['password'], $errors); | ||
| 42 | } else { | ||
| 43 | instaDisc_addUser($_POST['username'], $_POST['password']); | ||
| 44 | |||
| 45 | $template = new FITemplate('addeduser'); | ||
| 46 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
| 47 | $template->display(); | ||
| 48 | } | ||
| 49 | } | ||
| 50 | |||
| 51 | function showForm($username, $password, $errors) | ||
| 52 | { | ||
| 53 | $template = new FITemplate('adduser'); | ||
| 54 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
| 55 | |||
| 56 | if (isset($errors[1])) | ||
| 57 | { | ||
| 58 | $template->adds_block('ERROR', array('ex'=>'1')); | ||
| 59 | |||
| 60 | foreach ($errors as $name => $value) | ||
| 61 | { | ||
| 62 | $template->adds_block('ERRORS', array( 'NAME' => $name, | ||
| 63 | 'MSG' => $value['msg'])); | ||
| 64 | } | ||
| 65 | } | ||
| 66 | |||
| 67 | $template->add('USERNAME_ERR', ifErrors($errors, 'username')); | ||
| 68 | $template->add('PASSWORD_ERR', ifErrors($errors, 'password')); | ||
| 69 | |||
| 70 | doErrors($template, $errors, 'username'); | ||
| 71 | doErrors($template, $errors, 'password'); | ||
| 72 | |||
| 73 | $template->add('USERNAME', $username); | ||
| 74 | $template->add('PASSWORD', $password); | ||
| 75 | |||
| 76 | $template->display(); | ||
| 77 | } | ||
| 78 | |||
| 79 | function ifErrors($errors, $id) | ||
| 80 | { | ||
| 81 | foreach ($errors as $name => $value) | ||
| 82 | { | ||
| 83 | if ($value['field'] == $id) | ||
| 84 | { | ||
| 85 | return ' error'; | ||
| 86 | } | ||
| 87 | } | ||
| 88 | |||
| 89 | return ''; | ||
| 90 | } | ||
| 91 | |||
| 92 | function doErrors($template, $errors, $id) | ||
| 93 | { | ||
| 94 | foreach ($errors as $name => $value) | ||
| 95 | { | ||
| 96 | if ($value['field'] == $id) | ||
| 97 | { | ||
| 98 | $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, | ||
| 99 | 'VALUE' => $value['msg'])); | ||
| 100 | } | ||
| 101 | } | ||
| 102 | } | ||
| 103 | |||
| 104 | function addError(&$numOfErrors, &$errors, $field, $msg) | ||
| 105 | { | ||
| 106 | $numOfErrors++; | ||
| 107 | $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); | ||
| 108 | } | ||
| 109 | |||
| 110 | ?> | ||
| diff --git a/series/trunk/admin/chpwd.php b/series/trunk/admin/chpwd.php deleted file mode 100644 index 12eff53..0000000 --- a/series/trunk/admin/chpwd.php +++ /dev/null | |||
| @@ -1,134 +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 | */ | ||
| 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($_SESSION['username'])) | ||
| 23 | { | ||
| 24 | if (!isset($_GET['submit'])) | ||
| 25 | { | ||
| 26 | showForm('','','',array()); | ||
| 27 | } else { | ||
| 28 | $numOfErrors = 0; | ||
| 29 | $errors = array(); | ||
| 30 | |||
| 31 | if ($_POST['old'] == '') | ||
| 32 | { | ||
| 33 | addError($numOfErrors, $errors, 'old', 'Old Password is a required field'); | ||
| 34 | } else { | ||
| 35 | if (!instaDisc_verifyUser($_SESSION['username'], $_POST['old'])) | ||
| 36 | { | ||
| 37 | addError($numOfErrors, $errors, 'old', 'Old password is not correct'); | ||
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 | if ($_POST['new'] == '') | ||
| 42 | { | ||
| 43 | addError($numOfErrors, $errors, 'new', 'New Password is a required field'); | ||
| 44 | } | ||
| 45 | |||
| 46 | if ($_POST['confirm'] == '') | ||
| 47 | { | ||
| 48 | addError($numOfErrors, $errors, 'confirm', 'Confirm New Password is a required field'); | ||
| 49 | } | ||
| 50 | |||
| 51 | if ($_POST['new'] != $_POST['confirm']) | ||
| 52 | { | ||
| 53 | addError($numOfErrors, $errors, 'confirm', 'Passwords do not match'); | ||
| 54 | } | ||
| 55 | |||
| 56 | if ($numOfErrors > 0) | ||
| 57 | { | ||
| 58 | showForm($_POST['old'], $_POST['new'], $_POST['confirm'], $errors); | ||
| 59 | } else { | ||
| 60 | instaDisc_changePassword($_SESSION['username'], $_POST['new']); | ||
| 61 | |||
| 62 | $template = new FITemplate('changedpassword'); | ||
| 63 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
| 64 | $template->display(); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | } else { | ||
| 68 | header('Location: index.php'); | ||
| 69 | exit; | ||
| 70 | } | ||
| 71 | |||
| 72 | function showForm($old, $new, $confirm, $errors) | ||
| 73 | { | ||
| 74 | $template = new FITemplate('changepassword'); | ||
| 75 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
| 76 | |||
| 77 | if (isset($errors[1])) | ||
| 78 | { | ||
| 79 | $template->adds_block('ERROR', array('ex'=>'1')); | ||
| 80 | |||
| 81 | foreach ($errors as $name => $value) | ||
| 82 | { | ||
| 83 | $template->adds_block('ERRORS', array( 'NAME' => $name, | ||
| 84 | 'MSG' => $value['msg'])); | ||
| 85 | } | ||
| 86 | } | ||
| 87 | |||
| 88 | $template->add('OLD_ERR', ifErrors($errors, 'old')); | ||
| 89 | $template->add('NEW_ERR', ifErrors($errors, 'new')); | ||
| 90 | $template->add('CONFIRM_ERR', ifErrors($errors, 'confirm')); | ||
| 91 | |||
| 92 | doErrors($template, $errors, 'old'); | ||
| 93 | doErrors($template, $errors, 'new'); | ||
| 94 | doErrors($template, $errors, 'confirm'); | ||
| 95 | |||
| 96 | $template->add('OLD', $old); | ||
| 97 | $template->add('NEW', $new); | ||
| 98 | $template->add('CONFIRM', $confirm); | ||
| 99 | |||
| 100 | $template->display(); | ||
| 101 | } | ||
| 102 | |||
| 103 | function ifErrors($errors, $id) | ||
| 104 | { | ||
| 105 | foreach ($errors as $name => $value) | ||
| 106 | { | ||
| 107 | if ($value['field'] == $id) | ||
| 108 | { | ||
| 109 | return ' error'; | ||
| 110 | } | ||
| 111 | } | ||
| 112 | |||
| 113 | return ''; | ||
| 114 | } | ||
| 115 | |||
| 116 | function doErrors($template, $errors, $id) | ||
| 117 | { | ||
| 118 | foreach ($errors as $name => $value) | ||
| 119 | { | ||
| 120 | if ($value['field'] == $id) | ||
| 121 | { | ||
| 122 | $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, | ||
| 123 | 'VALUE' => $value['msg'])); | ||
| 124 | } | ||
| 125 | } | ||
| 126 | } | ||
| 127 | |||
| 128 | function addError(&$numOfErrors, &$errors, $field, $msg) | ||
| 129 | { | ||
| 130 | $numOfErrors++; | ||
| 131 | $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); | ||
| 132 | } | ||
| 133 | |||
| 134 | ?> | ||
| diff --git a/series/trunk/admin/deletesub.php b/series/trunk/admin/deletesub.php deleted file mode 100644 index 102a6a3..0000000 --- a/series/trunk/admin/deletesub.php +++ /dev/null | |||
| @@ -1,71 +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 | */ | ||
| 14 | require_once('includes/instadisc.php'); | ||
| 15 | |||
| 16 | if (!isset($_SESSION['username'])) | ||
| 17 | { | ||
| 18 | header('Location: index.php'); | ||
| 19 | exit; | ||
| 20 | } | ||
| 21 | |||
| 22 | if (!instaDisc_isAdmin($_SESSION['username'])) | ||
| 23 | { | ||
| 24 | $subs = instaDisc_listSubscriptions($_SESSION['username']); | ||
| 25 | $i=0; | ||
| 26 | $notfound=1; | ||
| 27 | for ($i=0;isset($subs[$i]);$i++) | ||
| 28 | { | ||
| 29 | if (!isset($_GET['submit'])) | ||
| 30 | { | ||
| 31 | if ($subs[$i]['identity'] == $_POST['id']) | ||
| 32 | { | ||
| 33 | $notfound=0; | ||
| 34 | } | ||
| 35 | } else { | ||
| 36 | if ($subs[$i]['id'] == $_GET['subid']) | ||
| 37 | { | ||
| 38 | $notfound=0; | ||
| 39 | } | ||
| 40 | } | ||
| 41 | } | ||
| 42 | |||
| 43 | if ($notfound == 1) | ||
| 44 | { | ||
| 45 | header('Location: index.php'); | ||
| 46 | exit; | ||
| 47 | } | ||
| 48 | } | ||
| 49 | |||
| 50 | if (!isset($_GET['submit'])) | ||
| 51 | { | ||
| 52 | $template = new FITemplate('deletesub'); | ||
| 53 | $template->add('SITENAME',instaDisc_getConfig('siteName')); | ||
| 54 | $template->add('ID',$_GET['subid']); | ||
| 55 | |||
| 56 | $sub = instaDisc_getSubscriptionByID($_GET['subid']); | ||
| 57 | $template->add('IDENTITY',$sub['identity']); | ||
| 58 | $template->display(); | ||
| 59 | } else { | ||
| 60 | if ($_POST['submit'] == 'Yes') | ||
| 61 | { | ||
| 62 | instaDisc_deleteSubscription($_POST['id']); | ||
| 63 | |||
| 64 | $template = new FITemplate('deletedsub'); | ||
| 65 | $template->display(); | ||
| 66 | } else { | ||
| 67 | header('Location: admin.php?id=main'); | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| 71 | ?> | ||
| diff --git a/series/trunk/admin/deleteuser.php b/series/trunk/admin/deleteuser.php deleted file mode 100644 index 7d1b0a0..0000000 --- a/series/trunk/admin/deleteuser.php +++ /dev/null | |||
| @@ -1,49 +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 | */ | ||
| 14 | require_once('includes/instadisc.php'); | ||
| 15 | |||
| 16 | if (!isset($_SESSION['username'])) | ||
| 17 | { | ||
| 18 | header('Location: index.php'); | ||
| 19 | exit; | ||
| 20 | } | ||
| 21 | |||
| 22 | if (!instaDisc_isAdmin($_SESSION['username'])) | ||
| 23 | { | ||
| 24 | header('Location: index.php'); | ||
| 25 | exit; | ||
| 26 | } | ||
| 27 | |||
| 28 | if (!isset($_GET['submit'])) | ||
| 29 | { | ||
| 30 | $template = new FITemplate('deleteuser'); | ||
| 31 | $template->add('SITENAME',instaDisc_getConfig('siteName')); | ||
| 32 | $template->add('ID',$_GET['userid']); | ||
| 33 | |||
| 34 | $sub = instaDisc_getUserByID($_GET['userid']); | ||
| 35 | $template->add('USERNAME',$sub['username']); | ||
| 36 | $template->display(); | ||
| 37 | } else { | ||
| 38 | if ($_POST['submit'] == 'Yes') | ||
| 39 | { | ||
| 40 | instaDisc_deleteUser($_POST['id']); | ||
| 41 | |||
| 42 | $template = new FITemplate('deleteduser'); | ||
| 43 | $template->display(); | ||
| 44 | } else { | ||
| 45 | header('Location: admin.php?id=main'); | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | ?> | ||
| diff --git a/series/trunk/admin/editsub.php b/series/trunk/admin/editsub.php deleted file mode 100644 index e49a971..0000000 --- a/series/trunk/admin/editsub.php +++ /dev/null | |||
| @@ -1,151 +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 | */ | ||
| 14 | require_once('includes/instadisc.php'); | ||
| 15 | |||
| 16 | if (!isset($_SESSION['username'])) | ||
| 17 | { | ||
| 18 | header('Location: index.php'); | ||
| 19 | exit; | ||
| 20 | } | ||
| 21 | |||
| 22 | if (!instaDisc_isAdmin($_SESSION['username'])) | ||
| 23 | { | ||
| 24 | $subs = instaDisc_listSubscriptions($_SESSION['username']); | ||
| 25 | $i=0; | ||
| 26 | $notfound=1; | ||
| 27 | for ($i=0;isset($subs[$i]);$i++) | ||
| 28 | { | ||
| 29 | if (!isset($_GET['submit'])) | ||
| 30 | { | ||
| 31 | if ($subs[$i]['identity'] == $_POST['id']) | ||
| 32 | { | ||
| 33 | $notfound=0; | ||
| 34 | } | ||
| 35 | } else { | ||
| 36 | if ($subs[$i]['id'] == $_GET['subid']) | ||
| 37 | { | ||
| 38 | $notfound=0; | ||
| 39 | } | ||
| 40 | } | ||
| 41 | } | ||
| 42 | |||
| 43 | if ($notfound == 1) | ||
| 44 | { | ||
| 45 | header('Location: index.php'); | ||
| 46 | exit; | ||
| 47 | } | ||
| 48 | } | ||
| 49 | |||
| 50 | if (!isset($_GET['submit'])) | ||
| 51 | { | ||
| 52 | $sub = instaDisc_getSubscriptionByID($_GET['subid']); | ||
| 53 | showForm($sub['identity'],$sub['title'],$sub['url'],$sub['category'],$sub['password'],array()); | ||
| 54 | } else { | ||
| 55 | $numOfErrors = 0; | ||
| 56 | $errors = array(); | ||
| 57 | |||
| 58 | if ($_POST['title'] == '') | ||
| 59 | { | ||
| 60 | addError($numOfErrors, $errors, 'title', 'Title is a required field'); | ||
| 61 | } | ||
| 62 | |||
| 63 | if ($_POST['url'] == '') | ||
| 64 | { | ||
| 65 | addError($numOfErrors, $errors, 'url', 'Subscription URL is a required field'); | ||
| 66 | } | ||
| 67 | |||
| 68 | if ($_POST['category'] == '') | ||
| 69 | { | ||
| 70 | addError($numOfErrors, $errors, 'category', 'Category is a required field'); | ||
| 71 | } | ||
| 72 | |||
| 73 | if ($numOfErrors > 0) | ||
| 74 | { | ||
| 75 | showForm($_POST['id'], $_POST['title'], $_POST['url'], $_POST['category'], $_POST['password'], $errors); | ||
| 76 | } else { | ||
| 77 | instaDisc_initSubscription($_SESSION['username'], $_POST['id'], $_POST['url'], $_POST['title'], $_POST['category'], $_POST['password']); | ||
| 78 | |||
| 79 | $template = new FITemplate('editedsub'); | ||
| 80 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
| 81 | $template->display(); | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 85 | function showForm($id, $title, $url, $category, $password, $errors) | ||
| 86 | { | ||
| 87 | $template = new FITemplate('editsub'); | ||
| 88 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
| 89 | |||
| 90 | if (isset($errors[1])) | ||
| 91 | { | ||
| 92 | $template->adds_block('ERROR', array('ex'=>'1')); | ||
| 93 | |||
| 94 | foreach ($errors as $name => $value) | ||
| 95 | { | ||
| 96 | $template->adds_block('ERRORS', array( 'NAME' => $name, | ||
| 97 | 'MSG' => $value['msg'])); | ||
| 98 | } | ||
| 99 | } | ||
| 100 | |||
| 101 | $template->add('TITLE_ERR', ifErrors($errors, 'title')); | ||
| 102 | $template->add('URL_ERR', ifErrors($errors, 'url')); | ||
| 103 | $template->add('CATEGORY_ERR', ifErrors($errors, 'url')); | ||
| 104 | $template->add('PASSWORD_ERR', ifErrors($errors, 'url')); | ||
| 105 | |||
| 106 | doErrors($template, $errors, 'title'); | ||
| 107 | doErrors($template, $errors, 'url'); | ||
| 108 | doErrors($template, $errors, 'category'); | ||
| 109 | doErrors($template, $errors, 'password'); | ||
| 110 | |||
| 111 | $template->add('ID', $id); | ||
| 112 | $template->add('TITLE', $title); | ||
| 113 | $template->add('URL', $url); | ||
| 114 | $template->add('CATEGORY', $category); | ||
| 115 | $template->add('PASSWORD', $password); | ||
| 116 | |||
| 117 | $template->display(); | ||
| 118 | } | ||
| 119 | |||
| 120 | function ifErrors($errors, $id) | ||
| 121 | { | ||
| 122 | foreach ($errors as $name => $value) | ||
| 123 | { | ||
| 124 | if ($value['field'] == $id) | ||
| 125 | { | ||
| 126 | return ' error'; | ||
| 127 | } | ||
| 128 | } | ||
| 129 | |||
| 130 | return ''; | ||
| 131 | } | ||
| 132 | |||
| 133 | function doErrors($template, $errors, $id) | ||
| 134 | { | ||
| 135 | foreach ($errors as $name => $value) | ||
| 136 | { | ||
| 137 | if ($value['field'] == $id) | ||
| 138 | { | ||
| 139 | $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, | ||
| 140 | 'VALUE' => $value['msg'])); | ||
| 141 | } | ||
| 142 | } | ||
| 143 | } | ||
| 144 | |||
| 145 | function addError(&$numOfErrors, &$errors, $field, $msg) | ||
| 146 | { | ||
| 147 | $numOfErrors++; | ||
| 148 | $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); | ||
| 149 | } | ||
| 150 | |||
| 151 | ?> | ||
| diff --git a/series/trunk/admin/login.php b/series/trunk/admin/login.php deleted file mode 100644 index fe394a1..0000000 --- a/series/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 | */ | ||
| 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 deleted file mode 100644 index 779a1d2..0000000 --- a/series/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 | */ | ||
| 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 deleted file mode 100644 index 9318a5d..0000000 --- a/series/trunk/admin/main.php +++ /dev/null | |||
| @@ -1,32 +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 | */ | ||
| 14 | require_once('includes/instadisc.php'); | ||
| 15 | |||
| 16 | if (!isset($_SESSION['username'])) | ||
| 17 | { | ||
| 18 | header('Location: index.php'); | ||
| 19 | exit; | ||
| 20 | } | ||
| 21 | |||
| 22 | $template = new FITemplate('main'); | ||
| 23 | $template->add('SITENAME',instaDisc_getConfig('siteName')); | ||
| 24 | |||
| 25 | if (instaDisc_isAdmin($_SESSION['username'])) | ||
| 26 | { | ||
| 27 | $template->adds_block('ADMIN', array('exi'=>1)); | ||
| 28 | } | ||
| 29 | |||
| 30 | $template->display(); | ||
| 31 | |||
| 32 | ?> | ||
| diff --git a/series/trunk/admin/mansub.php b/series/trunk/admin/mansub.php deleted file mode 100644 index 6ad04ac..0000000 --- a/series/trunk/admin/mansub.php +++ /dev/null | |||
| @@ -1,45 +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 | */ | ||
| 14 | require_once('includes/instadisc.php'); | ||
| 15 | |||
| 16 | if (!isset($_SESSION['username'])) | ||
| 17 | { | ||
| 18 | header('Location: index.php'); | ||
| 19 | exit; | ||
| 20 | } | ||
| 21 | |||
| 22 | $template = new FITemplate('mansub'); | ||
| 23 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
| 24 | |||
| 25 | if (instaDisc_isAdmin($_SESSION['username'])) | ||
| 26 | { | ||
| 27 | $subs = instaDisc_getAllSubscriptions(); | ||
| 28 | } else { | ||
| 29 | $subs = instaDisc_listSubscriptions($_SESSION['username']); | ||
| 30 | } | ||
| 31 | $i=0; $j=0; | ||
| 32 | for ($i=0;isset($subs[$i]);$i++) | ||
| 33 | { | ||
| 34 | $j++; | ||
| 35 | } | ||
| 36 | $j--; | ||
| 37 | for ($i=0;$i<$j;$i++) | ||
| 38 | { | ||
| 39 | $template->adds_block('SUBSCRIPTIONS', array( 'IDENTITY' => $subs[$i]['identity'], | ||
| 40 | 'ID' => $subs[$i]['id'])); | ||
| 41 | } | ||
| 42 | |||
| 43 | $template->display(); | ||
| 44 | |||
| 45 | ?> | ||
| diff --git a/series/trunk/admin/manuser.php b/series/trunk/admin/manuser.php deleted file mode 100644 index 4228a36..0000000 --- a/series/trunk/admin/manuser.php +++ /dev/null | |||
| @@ -1,46 +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 | */ | ||
| 14 | require_once('includes/instadisc.php'); | ||
| 15 | |||
| 16 | if (!isset($_SESSION['username'])) | ||
| 17 | { | ||
| 18 | header('Location: index.php'); | ||
| 19 | exit; | ||
| 20 | } | ||
| 21 | |||
| 22 | $template = new FITemplate('manuser'); | ||
| 23 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
| 24 | |||
| 25 | if (instaDisc_isAdmin($_SESSION['username'])) | ||
| 26 | { | ||
| 27 | $users = instaDisc_getAllUsers(); | ||
| 28 | } else { | ||
| 29 | header('Location: index.php'); | ||
| 30 | exit; | ||
| 31 | } | ||
| 32 | $i=0; $j=0; | ||
| 33 | for ($i=0;isset($users[$i]);$i++) | ||
| 34 | { | ||
| 35 | $j++; | ||
| 36 | } | ||
| 37 | $j--; | ||
| 38 | for ($i=0;$i<$j;$i++) | ||
| 39 | { | ||
| 40 | $template->adds_block('USERS', array( 'USERNAME' => $users[$i]['username'], | ||
| 41 | 'ID' => $users[$i]['id'])); | ||
| 42 | } | ||
| 43 | |||
| 44 | $template->display(); | ||
| 45 | |||
| 46 | ?> | ||
