@@ -3,7 +3,7 @@ |
||
| 3 | 3 | |
| 4 | 4 | use nzedb\Category; |
| 5 | 5 | |
| 6 | -$page = new AdminPage(); |
|
| 6 | +$page = new AdminPage(); |
|
| 7 | 7 | $page->title = "Category List"; |
| 8 | 8 | $page->smarty->assign('categorylist', (new Category(['Settings' => $page->settings]))->getFlat()); |
| 9 | 9 | |
@@ -10,8 +10,7 @@ |
||
| 10 | 10 | $regex = ['id' => '', 'regex' => '', 'description' => '', 'group_regex' => '', 'ordinal' => '']; |
| 11 | 11 | |
| 12 | 12 | switch ((isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view')) { |
| 13 | - case 'submit': |
|
| 14 | - if ($_POST["group_regex"] == '') { |
|
| 13 | + case 'submit' : if ($_POST["group_regex"] == '') { |
|
| 15 | 14 | $error = "Group regex must not be empty!"; |
| 16 | 15 | break; |
| 17 | 16 | } |
@@ -9,8 +9,7 @@ |
||
| 9 | 9 | $release = []; |
| 10 | 10 | |
| 11 | 11 | switch ((isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view')) { |
| 12 | - case 'submit': |
|
| 13 | - $values = parseResponse($_POST); |
|
| 12 | + case 'submit' : $values = parseResponse($_POST); |
|
| 14 | 13 | if ($values === false) { |
| 15 | 14 | $page->smarty->assign('error', 'Your search criteria is wrong.'); |
| 16 | 15 | } else { |
@@ -14,8 +14,7 @@ |
||
| 14 | 14 | $genre = ['id' => '', 'title' => '', 'disabled' => '']; |
| 15 | 15 | |
| 16 | 16 | switch ((isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view')) { |
| 17 | - case 'submit': |
|
| 18 | - $ret = $genres->update($_POST["id"], $_POST["disabled"]); |
|
| 17 | + case 'submit' : $ret = $genres->update($_POST["id"], $_POST["disabled"]); |
|
| 19 | 18 | header("Location:" . WWW_TOP . "/musicgenre-list.php"); |
| 20 | 19 | break; |
| 21 | 20 | |
@@ -10,8 +10,7 @@ |
||
| 10 | 10 | $regex = ['id' => '', 'group_regex' => '', 'regex' => '', 'description' => '', 'ordinal' => '']; |
| 11 | 11 | |
| 12 | 12 | switch ((isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view')) { |
| 13 | - case 'submit': |
|
| 14 | - if ($_POST["group_regex"] == '') { |
|
| 13 | + case 'submit' : if ($_POST["group_regex"] == '') { |
|
| 15 | 14 | $error = "Group regex must not be empty!"; |
| 16 | 15 | break; |
| 17 | 16 | } |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | |
| 4 | 4 | use nzedb\Videos; |
| 5 | 5 | |
| 6 | -$page = new AdminPage(); |
|
| 6 | +$page = new AdminPage(); |
|
| 7 | 7 | $tv = new Videos(['Settings' => $page->settings]); |
| 8 | 8 | |
| 9 | 9 | $page->title = "TV Shows List"; |
@@ -22,8 +22,7 @@ |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | switch ((isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view')) { |
| 25 | - case 'add': |
|
| 26 | - $user += [ |
|
| 25 | + case 'add' : $user += [ |
|
| 27 | 26 | 'role' => $defaultRole, |
| 28 | 27 | 'invites' => $defaultInvites, |
| 29 | 28 | 'movieview' => '1', |
@@ -22,48 +22,48 @@ discard block |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | switch ((isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view')) { |
| 25 | - case 'add': |
|
| 26 | - $user += [ |
|
| 27 | - 'role' => $defaultRole, |
|
| 28 | - 'invites' => $defaultInvites, |
|
| 29 | - 'movieview' => '1', |
|
| 30 | - 'xxxview' => '1', |
|
| 31 | - 'musicview' => '1', |
|
| 32 | - 'consoleview' => '1', |
|
| 33 | - 'gameview' => '1', |
|
| 34 | - 'bookview' => '1' |
|
| 35 | - ]; |
|
| 36 | - break; |
|
| 37 | - |
|
| 38 | - case 'submit': |
|
| 39 | - if ($_POST["id"] == '') { |
|
| 40 | - $invites = $defaultInvites; |
|
| 41 | - foreach ($userRoles as $role) { |
|
| 42 | - if ($role['id'] == $_POST['role']) { |
|
| 43 | - $invites = $role['defaultinvites']; |
|
| 25 | + case 'add': |
|
| 26 | + $user += [ |
|
| 27 | + 'role' => $defaultRole, |
|
| 28 | + 'invites' => $defaultInvites, |
|
| 29 | + 'movieview' => '1', |
|
| 30 | + 'xxxview' => '1', |
|
| 31 | + 'musicview' => '1', |
|
| 32 | + 'consoleview' => '1', |
|
| 33 | + 'gameview' => '1', |
|
| 34 | + 'bookview' => '1' |
|
| 35 | + ]; |
|
| 36 | + break; |
|
| 37 | + |
|
| 38 | + case 'submit': |
|
| 39 | + if ($_POST["id"] == '') { |
|
| 40 | + $invites = $defaultInvites; |
|
| 41 | + foreach ($userRoles as $role) { |
|
| 42 | + if ($role['id'] == $_POST['role']) { |
|
| 43 | + $invites = $role['defaultinvites']; |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | + $ret = $page->users->signUp( |
|
| 47 | + $_POST["username"], $_POST["firstname"], $_POST["lastname"], $_POST["password"], |
|
| 48 | + $_POST["email"], '', $_POST["role"], $invites, '', true |
|
| 49 | + ); |
|
| 50 | + } else { |
|
| 51 | + $ret = $page->users->update( |
|
| 52 | + $_POST["id"], $_POST["username"], $_POST["firstname"], $_POST["lastname"], $_POST["email"], |
|
| 53 | + $_POST["grabs"], $_POST["role"], $_POST["invites"], (isset($_POST['movieview']) ? '1' : '0'), |
|
| 54 | + (isset($_POST['xxxview']) ? '1' : '0'), (isset($_POST['musicview']) ? '1' : '0'), |
|
| 55 | + (isset($_POST['consoleview']) ? '1' : '0'), (isset($_POST['gameview']) ? '1' : '0'), |
|
| 56 | + (isset($_POST['bookview']) ? '1' : '0') |
|
| 57 | + ); |
|
| 58 | + if ($_POST['password'] != '') { |
|
| 59 | + $page->users->updatePassword($_POST["id"], $_POST['password']); |
|
| 44 | 60 | } |
| 45 | 61 | } |
| 46 | - $ret = $page->users->signUp( |
|
| 47 | - $_POST["username"], $_POST["firstname"], $_POST["lastname"], $_POST["password"], |
|
| 48 | - $_POST["email"], '', $_POST["role"], $invites, '', true |
|
| 49 | - ); |
|
| 50 | - } else { |
|
| 51 | - $ret = $page->users->update( |
|
| 52 | - $_POST["id"], $_POST["username"], $_POST["firstname"], $_POST["lastname"], $_POST["email"], |
|
| 53 | - $_POST["grabs"], $_POST["role"], $_POST["invites"], (isset($_POST['movieview']) ? '1' : '0'), |
|
| 54 | - (isset($_POST['xxxview']) ? '1' : '0'), (isset($_POST['musicview']) ? '1' : '0'), |
|
| 55 | - (isset($_POST['consoleview']) ? '1' : '0'), (isset($_POST['gameview']) ? '1' : '0'), |
|
| 56 | - (isset($_POST['bookview']) ? '1' : '0') |
|
| 57 | - ); |
|
| 58 | - if ($_POST['password'] != '') { |
|
| 59 | - $page->users->updatePassword($_POST["id"], $_POST['password']); |
|
| 60 | - } |
|
| 61 | - } |
|
| 62 | 62 | |
| 63 | - if ($ret >= 0) { |
|
| 64 | - header("Location:" . WWW_TOP . "/user-list.php"); |
|
| 65 | - } else { |
|
| 66 | - switch ($ret) { |
|
| 63 | + if ($ret >= 0) { |
|
| 64 | + header("Location:" . WWW_TOP . "/user-list.php"); |
|
| 65 | + } else { |
|
| 66 | + switch ($ret) { |
|
| 67 | 67 | case Users::ERR_SIGNUP_BADUNAME: |
| 68 | 68 | $error = "Bad username. Try a better one."; |
| 69 | 69 | break; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | default: |
| 88 | 88 | $error = "Unknown save error."; |
| 89 | 89 | break; |
| 90 | - } |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | 92 | $user = [ |
| 93 | 93 | 'id' => $_POST["id"], |
@@ -103,13 +103,13 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | break; |
| 105 | 105 | |
| 106 | - case 'view': |
|
| 107 | - default: |
|
| 108 | - if (isset($_GET["id"])) { |
|
| 109 | - $page->title = "User Edit"; |
|
| 110 | - $user = $page->users->getById($_GET["id"]); |
|
| 111 | - } |
|
| 112 | - break; |
|
| 106 | + case 'view': |
|
| 107 | + default: |
|
| 108 | + if (isset($_GET["id"])) { |
|
| 109 | + $page->title = "User Edit"; |
|
| 110 | + $user = $page->users->getById($_GET["id"]); |
|
| 111 | + } |
|
| 112 | + break; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $page->smarty->assign('error', $error); |
@@ -46,7 +46,8 @@ |
||
| 46 | 46 | $page->content = $page->smarty->fetch('user-list.tpl'); |
| 47 | 47 | $page->render(); |
| 48 | 48 | |
| 49 | -function checkREQUEST($param) { |
|
| 49 | +function checkREQUEST($param) |
|
| 50 | +{ |
|
| 50 | 51 | global $uSearch, $variables; |
| 51 | 52 | if (isset($_REQUEST[$param])) { |
| 52 | 53 | $variables[$param] = $_REQUEST[$param]; |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | spl_autoload_register( |
| 4 | - function ($className) { |
|
| 4 | + function($className) { |
|
| 5 | 5 | $paths = [ |
| 6 | 6 | nZEDb_WWW . 'pages' . DS, |
| 7 | 7 | nZEDb_WWW . 'pages' . DS . 'admin' . DS, |