Passed
Push — dev ( 76ce63...ac1a94 )
by Darko
11:33
created
www/plugins/modifier.parray.php 1 patch
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,9 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 function smarty_modifier_parray ($string,$explode,$limit=NULL)
3 3
 {
4
-	if($limit == NULL)
5
-		return explode( $explode , $string );
6
-	else
7
-		return explode( $explode , $string , $limit);
8
-}
4
+	if($limit == NULL) {
5
+			return explode( $explode , $string );
6
+	} else {
7
+			return explode( $explode , $string , $limit);
8
+	}
9
+	}
9 10
 ?>
10 11
\ No newline at end of file
Please login to merge, or discard this patch.
www/pages/Page.php 1 patch
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,8 +28,9 @@  discard block
 block discarded – undo
28 28
 		);
29 29
 
30 30
 		$role = Users::ROLE_GUEST;
31
-		if ($this->userdata != null)
32
-			$role = $this->userdata["role"];
31
+		if ($this->userdata != null) {
32
+					$role = $this->userdata["role"];
33
+		}
33 34
 
34 35
 		$content = new Contents(['Settings' => $this->settings]);
35 36
 		$f = new Forum();
@@ -37,24 +38,27 @@  discard block
 block discarded – undo
37 38
 		$this->smarty->assign('menulist',$menu->get($role, $this->serverurl));
38 39
 		$this->smarty->assign('usefulcontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEUSEFUL, $role));
39 40
 		$this->smarty->assign('articlecontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEARTICLE, $role));
40
-		if ($this->userdata != null)
41
-			$this->smarty->assign('recentforumpostslist',$f->getPosts($this->settings->getSetting('showrecentforumposts')));
41
+		if ($this->userdata != null) {
42
+					$this->smarty->assign('recentforumpostslist',$f->getPosts($this->settings->getSetting('showrecentforumposts')));
43
+		}
42 44
 
43 45
 		$this->smarty->assign('main_menu',$this->smarty->fetch('mainmenu.tpl'));
44 46
 		$this->smarty->assign('useful_menu',$this->smarty->fetch('usefullinksmenu.tpl'));
45 47
 		$this->smarty->assign('article_menu',$this->smarty->fetch('articlesmenu.tpl'));
46 48
 
47 49
 		$category = new Category(['Settings' => $content->pdo]);
48
-		if ($this->userdata != null)
49
-			$parentcatlist = $category->getForMenu($this->userdata["categoryexclusions"]);
50
-		else
51
-			$parentcatlist = $category->getForMenu();
50
+		if ($this->userdata != null) {
51
+					$parentcatlist = $category->getForMenu($this->userdata["categoryexclusions"]);
52
+		} else {
53
+					$parentcatlist = $category->getForMenu();
54
+		}
52 55
 
53 56
 		$this->smarty->assign('parentcatlist',$parentcatlist);
54 57
 		$this->smarty->assign('catClass', $category);
55 58
 		$searchStr = '';
56
-		if ($this->page == 'search' && isset($_REQUEST["id"]))
57
-			$searchStr = (string) $_REQUEST["id"];
59
+		if ($this->page == 'search' && isset($_REQUEST["id"])) {
60
+					$searchStr = (string) $_REQUEST["id"];
61
+		}
58 62
 		$this->smarty->assign('header_menu_search',$searchStr);
59 63
 
60 64
 		if (isset($_REQUEST["t"])) {
Please login to merge, or discard this patch.
www/pages/sendtocouch.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 use nntmux\CouchPotato;
4 4
 
5
-if (!$page->users->isLoggedIn()){
5
+if (!$page->users->isLoggedIn()) {
6 6
 	$page->show403();
7 7
 }
8 8
 
Please login to merge, or discard this patch.
www/pages/ajax_profile.php 1 patch
Braces   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,18 +1,17 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!$page->users->isLoggedIn())
3
+if (!$page->users->isLoggedIn()) {
4 4
 	$page->show403();
5
+}
5 6
 
6
-if (isset($_GET['action']) && $_GET['action'] == "1" && isset($_GET['emailto']))
7
-{
7
+if (isset($_GET['action']) && $_GET['action'] == "1" && isset($_GET['emailto'])) {
8 8
 	$emailto = $_GET['emailto'];
9 9
 	$ret = $page->users->sendInvite($page->settings->getSetting('title'), $page->settings->getSetting('email'), $page->serverurl, $page->users->currentUserId(), $emailto);
10
-	if (!$ret)
11
-		print "Invite not sent.";
12
-	else
13
-		print "Invite sent. Alternatively paste them following link to register - ".$ret;
14
-}
15
-else
16
-{
10
+	if (!$ret) {
11
+			print "Invite not sent.";
12
+	} else {
13
+			print "Invite sent. Alternatively paste them following link to register - ".$ret;
14
+	}
15
+	} else {
17 16
 	print "Invite not sent.";
18 17
 }
Please login to merge, or discard this patch.
www/pages/forumpost.php 1 patch
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2,22 +2,21 @@
 block discarded – undo
2 2
 
3 3
 use nntmux\Forum;
4 4
 
5
-if (!$page->users->isLoggedIn())
5
+if (!$page->users->isLoggedIn()) {
6 6
 	$page->show403();
7
+}
7 8
 
8 9
 $id = $_GET["id"] + 0;
9 10
 
10 11
 $forum = new Forum();
11
-if ($page->isPostBack())
12
-{
12
+if ($page->isPostBack()) {
13 13
 		$forum->add($id, $page->users->currentUserId(), "", $_POST["addMessage"]);
14 14
 		header("Location:".WWW_TOP."/forumpost/".$id."#last");
15 15
 		die();
16 16
 }
17 17
 
18 18
 $results = $forum->getPosts($id);
19
-if (count($results) == 0)
20
-{
19
+if (count($results) == 0) {
21 20
 	header("Location:".WWW_TOP."/forum");
22 21
 	die();
23 22
 }
Please login to merge, or discard this patch.
www/pages/AdminPage.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,9 @@
 block discarded – undo
24 24
 			]
25 25
 		);
26 26
 
27
-		if (!$this->users->isLoggedIn() || !isset($this->userdata["role"]) || $this->userdata["role"] != Users::ROLE_ADMIN)
28
-			$this->show403(true);
27
+		if (!$this->users->isLoggedIn() || !isset($this->userdata["role"]) || $this->userdata["role"] != Users::ROLE_ADMIN) {
28
+					$this->show403(true);
29
+		}
29 30
 
30 31
 	}
31 32
 
Please login to merge, or discard this patch.
www/pages/profileedit.php 1 patch
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,15 +11,17 @@  discard block
 block discarded – undo
11 11
 $nzbGet = new NZBGet($page);
12 12
 $page->users = new Users();
13 13
 
14
-if (!$page->users->isLoggedIn())
14
+if (!$page->users->isLoggedIn()) {
15 15
 	$page->show403();
16
+}
16 17
 
17 18
 $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
18 19
 
19 20
 $userid = $page->users->currentUserId();
20 21
 $data = $page->users->getById($userid);
21
-if (!$data)
22
+if (!$data) {
22 23
 	$page->show404();
24
+}
23 25
 
24 26
 $errorStr = '';
25 27
 
@@ -35,8 +37,9 @@  discard block
 block discarded – undo
35 37
 	case 'submit':
36 38
 
37 39
 		$data["email"] = $_POST['email'];
38
-		if (isset($_POST['saburl']) && strlen(trim($_POST['saburl'])) > 0 && !Utility::endsWith($_POST['saburl'], "/"))
39
-			$_POST['saburl'] = $_POST['saburl'] . "/";
40
+		if (isset($_POST['saburl']) && strlen(trim($_POST['saburl'])) > 0 && !Utility::endsWith($_POST['saburl'], "/")) {
41
+					$_POST['saburl'] = $_POST['saburl'] . "/";
42
+		}
40 43
 
41 44
 		if ($_POST['password'] != "" && $_POST['password'] != $_POST['confirmpassword']) {
42 45
 			$errorStr = "Password Mismatch";
@@ -90,8 +93,9 @@  discard block
 block discarded – undo
90 93
 				$_POST['exccat'] = (!isset($_POST['exccat']) || !is_array($_POST['exccat'])) ? [] : $_POST['exccat'];
91 94
 				$page->users->addCategoryExclusions($userid, $_POST['exccat']);
92 95
 
93
-				if ($_POST['password'] != "")
94
-					$page->users->updatePassword($userid, $_POST['password']);
96
+				if ($_POST['password'] != "") {
97
+									$page->users->updatePassword($userid, $_POST['password']);
98
+				}
95 99
 
96 100
 				header("Location:" . WWW_TOP . "/profile");
97 101
 				die();
Please login to merge, or discard this patch.
www/pages/bookmodal.php 1 patch
Braces   +13 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,14 +4,15 @@  discard block
 block discarded – undo
4 4
 
5 5
 $b = new Books;
6 6
 
7
-if (!$page->users->isLoggedIn())
7
+if (!$page->users->isLoggedIn()) {
8 8
 	$page->show403();
9
+}
9 10
 
10
-if (isset($_GET["id"]) && ctype_digit($_GET["id"]))
11
-{
11
+if (isset($_GET["id"]) && ctype_digit($_GET["id"])) {
12 12
 	$book = $b->getBookInfo($_GET['id']);
13
-	if (!$book)
14
-		$page->show404();
13
+	if (!$book) {
14
+			$page->show404();
15
+	}
15 16
 
16 17
 	$page->smarty->assign('book', $book);
17 18
 
@@ -22,17 +23,17 @@  discard block
 block discarded – undo
22 23
 	$page->smarty->registerPlugin('modifier', 'ss', 'stripslashes');
23 24
 
24 25
 	$modal = false;
25
-	if (isset($_GET['modal']))
26
-	{
26
+	if (isset($_GET['modal'])) {
27 27
 		$modal = true;
28 28
 		$page->smarty->assign('modal', true);
29 29
 	}
30 30
 
31 31
 	$page->content = $page->smarty->fetch('viewbook.tpl');
32 32
 
33
-	if ($modal)
34
-		echo $page->content;
35
-	else
36
-		$page->render();
37
-}
33
+	if ($modal) {
34
+			echo $page->content;
35
+	} else {
36
+			$page->render();
37
+	}
38
+	}
38 39
 
Please login to merge, or discard this patch.
www/pages/queuedata.php 1 patch
Braces   +18 added lines, -34 removed lines patch added patch discarded remove patch
@@ -3,25 +3,25 @@  discard block
 block discarded – undo
3 3
 use nntmux\SABnzbd;
4 4
 use nntmux\NZBGet;
5 5
 
6
-if (!$page->users->isLoggedIn())
6
+if (!$page->users->isLoggedIn()) {
7 7
 	$page->show403();
8
+}
8 9
 
9 10
 $sab = new SABnzbd($page);
10 11
 $nzbget = new NZBGet($page);
11 12
 
12
-if (empty($sab->url) && empty($sab->apikey) && empty($nzbget->url) && empty($nzbget->username))
13
+if (empty($sab->url) && empty($sab->apikey) && empty($nzbget->url) && empty($nzbget->username)) {
13 14
 	$page->show404();
15
+}
14 16
 
15 17
 $output = "";
16 18
 $reqtype = isset($_REQUEST["type"]) ? $_REQUEST["type"] : "queue";
17 19
 
18
-switch ($reqtype)
19
-{
20
+switch ($reqtype) {
20 21
     case "queue":
21 22
     {
22 23
         $json = $sab->getQueue();
23
-        if ($json !== false)
24
-        {
24
+        if ($json !== false) {
25 25
             $obj = json_decode($json);
26 26
             $queue = $obj->{'jobs'};
27 27
             $count = 1;
@@ -32,8 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
             $output .= "<p><b>Download speed:</b> ".$speed."B/s - <b>Queued:</b> ".$queued." - <b>Status:</b> ".$status."</p>";
34 34
 
35
-            if (count($queue) > 0)
36
-            {
35
+            if (count($queue) > 0) {
37 36
                 $output.="<table class=\"data highlight\">";
38 37
                 $output.="<tr>
39 38
                             <th></th>
@@ -44,13 +43,9 @@  discard block
 block discarded – undo
44 43
                             <th>time left</th>
45 44
                             <th></th>
46 45
                             </tr>";
47
-                foreach ($queue as $item)
48
-                {
49
-                    if (strpos($item->{'filename'}, "fetch NZB") > 0)
50
-                    {
51
-                    }
52
-                    else
53
-                    {
46
+                foreach ($queue as $item) {
47
+                    if (strpos($item->{'filename'}, "fetch NZB") > 0) {
48
+                    } else {
54 49
                         $output.="<tr>";
55 50
                         $output.="<td style='text-align:right;'>".$count."</td>";
56 51
                         $output.="<td>".htmlspecialchars($item->{'filename'}, ENT_QUOTES)."</td>";
@@ -64,14 +59,10 @@  discard block
 block discarded – undo
64 59
                     }
65 60
                 }
66 61
                 $output.="</table>";
67
-            }
68
-            else
69
-            {
62
+            } else {
70 63
                 $output.="<p>The queue is currently empty.</p>";
71 64
             }
72
-        }
73
-        else
74
-        {
65
+        } else {
75 66
             $output.="<p>Error retreiving queue.</p>";
76 67
         }
77 68
 
@@ -80,14 +71,12 @@  discard block
 block discarded – undo
80 71
     case "history":
81 72
     {
82 73
         $json = $sab->getHistory();
83
-        if ($json !== false)
84
-        {
74
+        if ($json !== false) {
85 75
             $obj = json_decode($json);
86 76
             $history = $obj->history->slots;
87 77
             $count = 1;
88 78
 
89
-            if (count($history) > 0)
90
-            {
79
+            if (count($history) > 0) {
91 80
                 $output.="<h2>Download History</h2>";
92 81
                 $output.="<table class=\"data highlight\">";
93 82
                 $output.="<tr>
@@ -99,8 +88,7 @@  discard block
 block discarded – undo
99 88
                             <th style='text-align:center;'>dl time</th>
100 89
                             <th style='text-align:center;'>date</th>
101 90
                             </tr>";
102
-                foreach ($history as $item)
103
-                {
91
+                foreach ($history as $item) {
104 92
                     $output.="<tr>";
105 93
                     $output.="<td class='".($item->{'fail_message'} != "" ? "sabhistoryfail" : "sabhistorysuccess")."'></td>";
106 94
                     $output.="<td>".htmlspecialchars($item->{'name'}, ENT_QUOTES)."</td>";
@@ -121,8 +109,7 @@  discard block
 block discarded – undo
121 109
     case "nzbget":
122 110
     {
123 111
         $queue = $nzbget->getQueue();
124
-        if (is_array($queue) && count($queue) > 0)
125
-        {
112
+        if (is_array($queue) && count($queue) > 0) {
126 113
             $count = 1;
127 114
             $output.="<table class=\"data highlight\">";
128 115
             $output.="<tr>
@@ -134,8 +121,7 @@  discard block
 block discarded – undo
134 121
                             <th>left</th>
135 122
                             <th></th>
136 123
                             </tr>";
137
-            foreach ($queue as $item)
138
-            {
124
+            foreach ($queue as $item) {
139 125
                 $output.="<tr>";
140 126
                 $output.="<td style='text-align:right;'>".$count."</td>";
141 127
                 $output.="<td>".htmlspecialchars($item['NZBNicename'], ENT_QUOTES)."</td>";
@@ -148,9 +134,7 @@  discard block
 block discarded – undo
148 134
                 $count++;
149 135
             }
150 136
             $output.="</table>";
151
-        }
152
-        else
153
-        {
137
+        } else {
154 138
             $output.="<p>The queue is currently empty.</p>";
155 139
         }
156 140
 
Please login to merge, or discard this patch.