@@ -21,17 +21,32 @@ |
||
| 21 | 21 | |
| 22 | 22 | use app\controllers\SettingsController; |
| 23 | 23 | |
| 24 | -class SettingsControllerTest extends \lithium\test\Unit { |
|
| 24 | +class SettingsControllerTest extends \lithium\test\Unit |
|
| 25 | +{ |
|
| 25 | 26 | |
| 26 | - public function setUp() {} |
|
| 27 | + public function setUp() |
|
| 28 | + { |
|
| 29 | +} |
|
| 27 | 30 | |
| 28 | - public function tearDown() {} |
|
| 31 | + public function tearDown() |
|
| 32 | + { |
|
| 33 | +} |
|
| 29 | 34 | |
| 30 | - public function testIndex() {} |
|
| 31 | - public function testView() {} |
|
| 32 | - public function testAdd() {} |
|
| 33 | - public function testEdit() {} |
|
| 34 | - public function testDelete() {} |
|
| 35 | + public function testIndex() |
|
| 36 | + { |
|
| 37 | +} |
|
| 38 | + public function testView() |
|
| 39 | + { |
|
| 40 | +} |
|
| 41 | + public function testAdd() |
|
| 42 | + { |
|
| 43 | +} |
|
| 44 | + public function testEdit() |
|
| 45 | + { |
|
| 46 | +} |
|
| 47 | + public function testDelete() |
|
| 48 | + { |
|
| 49 | +} |
|
| 35 | 50 | } |
| 36 | 51 | |
| 37 | 52 | ?> |
@@ -22,19 +22,23 @@ discard block |
||
| 22 | 22 | use app\models\Settings; |
| 23 | 23 | use lithium\action\DispatchException; |
| 24 | 24 | |
| 25 | -class SettingsController extends \lithium\action\Controller { |
|
| 25 | +class SettingsController extends \lithium\action\Controller |
|
| 26 | +{ |
|
| 26 | 27 | |
| 27 | - public function index() { |
|
| 28 | + public function index() |
|
| 29 | + { |
|
| 28 | 30 | $settings = Settings::all(); |
| 29 | 31 | return compact('settings'); |
| 30 | 32 | } |
| 31 | 33 | |
| 32 | - public function view() { |
|
| 34 | + public function view() |
|
| 35 | + { |
|
| 33 | 36 | $setting = Settings::first($this->request->id); |
| 34 | 37 | return compact('setting'); |
| 35 | 38 | } |
| 36 | 39 | |
| 37 | - public function add() { |
|
| 40 | + public function add() |
|
| 41 | + { |
|
| 38 | 42 | $setting = Settings::create(); |
| 39 | 43 | |
| 40 | 44 | if (($this->request->data) && $setting->save($this->request->data)) { |
@@ -43,7 +47,8 @@ discard block |
||
| 43 | 47 | return compact('setting'); |
| 44 | 48 | } |
| 45 | 49 | |
| 46 | - public function edit() { |
|
| 50 | + public function edit() |
|
| 51 | + { |
|
| 47 | 52 | $setting = Settings::find($this->request->id); |
| 48 | 53 | |
| 49 | 54 | if (!$setting) { |
@@ -55,7 +60,8 @@ discard block |
||
| 55 | 60 | return compact('setting'); |
| 56 | 61 | } |
| 57 | 62 | |
| 58 | - public function delete() { |
|
| 63 | + public function delete() |
|
| 64 | + { |
|
| 59 | 65 | if (!$this->request->is('post') && !$this->request->is('delete')) { |
| 60 | 66 | $msg = "Settings::delete can only be called with http:post or http:delete."; |
| 61 | 67 | throw new DispatchException($msg); |
@@ -196,8 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | // convert from a string array to an int array as we want to use int |
| 198 | 198 | $book_reqids_ids = array_map( |
| 199 | - function($value) |
|
| 200 | - { |
|
| 199 | + function($value) { |
|
| 201 | 200 | return (int)$value; |
| 202 | 201 | }, |
| 203 | 202 | $book_reqids_ids |
@@ -210,8 +209,7 @@ discard block |
||
| 210 | 209 | |
| 211 | 210 | // convert from a string array to an int array |
| 212 | 211 | $books_selected = array_map( |
| 213 | - function($value) |
|
| 214 | - { |
|
| 212 | + function($value) { |
|
| 215 | 213 | return (int)$value; |
| 216 | 214 | }, |
| 217 | 215 | $books_selected |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | use nzedb\CouchPotato; |
| 4 | 4 | |
| 5 | -if (!$page->users->isLoggedIn()){ |
|
| 5 | +if (!$page->users->isLoggedIn()) { |
|
| 6 | 6 | $page->show403(); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -8,8 +8,7 @@ |
||
| 8 | 8 | $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; |
| 9 | 9 | $id = (isset($_REQUEST['id'])) ? $_REQUEST['id'] : ''; |
| 10 | 10 | |
| 11 | -switch($action) |
|
| 12 | -{ |
|
| 11 | +switch($action) { |
|
| 13 | 12 | case 'grabs': |
| 14 | 13 | $u->delDownloadRequests($id); |
| 15 | 14 | break; |
@@ -1050,8 +1050,9 @@ discard block |
||
| 1050 | 1050 | { |
| 1051 | 1051 | $ret = []; |
| 1052 | 1052 | $data = $this->pdo->query(sprintf("SELECT categories_id FROM role_excluded_categories WHERE role = %d", $role)); |
| 1053 | - foreach ($data as $d) |
|
| 1054 | - $ret[] = $d["categories_id"]; |
|
| 1053 | + foreach ($data as $d) { |
|
| 1054 | + $ret[] = $d["categories_id"]; |
|
| 1055 | + } |
|
| 1055 | 1056 | |
| 1056 | 1057 | return $ret; |
| 1057 | 1058 | } |
@@ -1501,7 +1502,8 @@ discard block |
||
| 1501 | 1502 | * @param string|int $user |
| 1502 | 1503 | * @return bool |
| 1503 | 1504 | */ |
| 1504 | - public function roleCheck($roleID, $user) { |
|
| 1505 | + public function roleCheck($roleID, $user) |
|
| 1506 | + { |
|
| 1505 | 1507 | |
| 1506 | 1508 | if (is_string($user) && strlen($user) > 0) { |
| 1507 | 1509 | $user = $this->pdo->escapeString($user); |
@@ -1528,7 +1530,8 @@ discard block |
||
| 1528 | 1530 | * @param int $userID |
| 1529 | 1531 | * @return bool |
| 1530 | 1532 | */ |
| 1531 | - public function isAdmin($userID) { |
|
| 1533 | + public function isAdmin($userID) |
|
| 1534 | + { |
|
| 1532 | 1535 | return $this->roleCheck(self::ROLE_ADMIN, (integer) $userID); |
| 1533 | 1536 | } |
| 1534 | 1537 | |
@@ -1538,7 +1541,8 @@ discard block |
||
| 1538 | 1541 | * @param int $userId |
| 1539 | 1542 | * @return bool |
| 1540 | 1543 | */ |
| 1541 | - public function isModerator($userId) { |
|
| 1544 | + public function isModerator($userId) |
|
| 1545 | + { |
|
| 1542 | 1546 | return $this->roleCheck(self::ROLE_MODERATOR, (integer) $userId); |
| 1543 | 1547 | } |
| 1544 | 1548 | } |
@@ -8,8 +8,7 @@ |
||
| 8 | 8 | $forum = new Forum(); |
| 9 | 9 | $id = $_GET['id'] + 0; |
| 10 | 10 | |
| 11 | -if (isset($id)) |
|
| 12 | -{ |
|
| 11 | +if (isset($id)) { |
|
| 13 | 12 | $forum->deleteParent($id); |
| 14 | 13 | header("Location:" . WWW_TOP . "/forum"); |
| 15 | 14 | } |
@@ -820,8 +820,7 @@ |
||
| 820 | 820 | $total = $releases->rowCount(); |
| 821 | 821 | // Init vars for writing the NZB's. |
| 822 | 822 | $this->nzb->initiateForWrite($groupID); |
| 823 | - foreach ($releases as $release) |
|
| 824 | - { |
|
| 823 | + foreach ($releases as $release) { |
|
| 825 | 824 | if ($this->nzb->writeNZBforReleaseId($release['id'], $release['guid'], $release['name'], $release['title']) === true) { |
| 826 | 825 | $nzbCount++; |
| 827 | 826 | if ($this->echoCLI) { |
@@ -925,8 +925,7 @@ |
||
| 925 | 925 | public function searchShows( |
| 926 | 926 | $siteIdArr = array(), $series = '', $episode = '', $airdate = '', $offset = 0, |
| 927 | 927 | $limit = 100, $name = '', $cat = [-1], $maxAge = -1, $minSize = 0 |
| 928 | - ) |
|
| 929 | - { |
|
| 928 | + ) { |
|
| 930 | 929 | $siteSQL = array(); |
| 931 | 930 | $showSql = ''; |
| 932 | 931 | |