@@ -69,7 +69,8 @@ |
||
| 69 | 69 | * |
| 70 | 70 | * @access private |
| 71 | 71 | */ |
| 72 | - function unix2DosTime($unixtime = 0) { |
|
| 72 | + function unix2DosTime($unixtime = 0) |
|
| 73 | + { |
|
| 73 | 74 | $timearray = ($unixtime == 0) ? getdate() : getdate($unixtime); |
| 74 | 75 | |
| 75 | 76 | if ($timearray['year'] < 1980) { |
@@ -63,35 +63,44 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $site = $this->row2Object($form); |
| 65 | 65 | |
| 66 | - if (substr($site->nzbpath, strlen($site->nzbpath) - 1) != '/') |
|
| 67 | - $site->nzbpath = $site->nzbpath . "/"; |
|
| 66 | + if (substr($site->nzbpath, strlen($site->nzbpath) - 1) != '/') { |
|
| 67 | + $site->nzbpath = $site->nzbpath . "/"; |
|
| 68 | + } |
|
| 68 | 69 | |
| 69 | 70 | // |
| 70 | 71 | // Validate site settings |
| 71 | 72 | // |
| 72 | - if ($site->mediainfopath != "" && !is_file($site->mediainfopath)) |
|
| 73 | - return Sites::ERR_BADMEDIAINFOPATH; |
|
| 73 | + if ($site->mediainfopath != "" && !is_file($site->mediainfopath)) { |
|
| 74 | + return Sites::ERR_BADMEDIAINFOPATH; |
|
| 75 | + } |
|
| 74 | 76 | |
| 75 | - if ($site->ffmpegpath != "" && !is_file($site->ffmpegpath)) |
|
| 76 | - return Sites::ERR_BADFFMPEGPATH; |
|
| 77 | + if ($site->ffmpegpath != "" && !is_file($site->ffmpegpath)) { |
|
| 78 | + return Sites::ERR_BADFFMPEGPATH; |
|
| 79 | + } |
|
| 77 | 80 | |
| 78 | - if ($site->unrarpath != "" && !is_file($site->unrarpath)) |
|
| 79 | - return Sites::ERR_BADUNRARPATH; |
|
| 81 | + if ($site->unrarpath != "" && !is_file($site->unrarpath)) { |
|
| 82 | + return Sites::ERR_BADUNRARPATH; |
|
| 83 | + } |
|
| 80 | 84 | |
| 81 | - if ($site->nzbpath != "" && !file_exists($site->nzbpath)) |
|
| 82 | - return Sites::ERR_BADNZBPATH; |
|
| 85 | + if ($site->nzbpath != "" && !file_exists($site->nzbpath)) { |
|
| 86 | + return Sites::ERR_BADNZBPATH; |
|
| 87 | + } |
|
| 83 | 88 | |
| 84 | - if ($site->checkpasswordedrar == 2 && !is_file($site->unrarpath)) |
|
| 85 | - return Sites::ERR_DEEPNOUNRAR; |
|
| 89 | + if ($site->checkpasswordedrar == 2 && !is_file($site->unrarpath)) { |
|
| 90 | + return Sites::ERR_DEEPNOUNRAR; |
|
| 91 | + } |
|
| 86 | 92 | |
| 87 | - if ($site->tmpunrarpath != "" && !file_exists($site->tmpunrarpath)) |
|
| 88 | - return Sites::ERR_BADTMPUNRARPATH; |
|
| 93 | + if ($site->tmpunrarpath != "" && !file_exists($site->tmpunrarpath)) { |
|
| 94 | + return Sites::ERR_BADTMPUNRARPATH; |
|
| 95 | + } |
|
| 89 | 96 | |
| 90 | - if ($site->lamepath != "" && !file_exists($site->lamepath)) |
|
| 91 | - return Sites::ERR_BADLAMEPATH; |
|
| 97 | + if ($site->lamepath != "" && !file_exists($site->lamepath)) { |
|
| 98 | + return Sites::ERR_BADLAMEPATH; |
|
| 99 | + } |
|
| 92 | 100 | |
| 93 | - if ($site->sabcompletedir != "" && !file_exists($site->sabcompletedir)) |
|
| 94 | - return Sites::ERR_SABCOMPLETEPATH; |
|
| 101 | + if ($site->sabcompletedir != "" && !file_exists($site->sabcompletedir)) { |
|
| 102 | + return Sites::ERR_SABCOMPLETEPATH; |
|
| 103 | + } |
|
| 95 | 104 | |
| 96 | 105 | $sql = $sqlKeys = []; |
| 97 | 106 | foreach ($form as $settingK => $settingV) { |
@@ -115,8 +124,9 @@ discard block |
||
| 115 | 124 | |
| 116 | 125 | $rows = $this->_db->query($sql, true, NN_CACHE_EXPIRY_MEDIUM); |
| 117 | 126 | |
| 118 | - if ($rows === false) |
|
| 119 | - return false; |
|
| 127 | + if ($rows === false) { |
|
| 128 | + return false; |
|
| 129 | + } |
|
| 120 | 130 | |
| 121 | 131 | return $this->rows2Object($rows); |
| 122 | 132 | } |
@@ -124,8 +134,9 @@ discard block |
||
| 124 | 134 | public function rows2Object($rows) |
| 125 | 135 | { |
| 126 | 136 | $obj = new \stdClass; |
| 127 | - foreach ($rows as $row) |
|
| 128 | - $obj->{$row['setting']} = $row['value']; |
|
| 137 | + foreach ($rows as $row) { |
|
| 138 | + $obj->{$row['setting']} = $row['value']; |
|
| 139 | + } |
|
| 129 | 140 | |
| 130 | 141 | $obj->{'version'} = $this->version(); |
| 131 | 142 | |
@@ -136,8 +147,9 @@ discard block |
||
| 136 | 147 | { |
| 137 | 148 | $obj = new \stdClass; |
| 138 | 149 | $rowKeys = array_keys($row); |
| 139 | - foreach ($rowKeys as $key) |
|
| 140 | - $obj->{$key} = $row[$key]; |
|
| 150 | + foreach ($rowKeys as $key) { |
|
| 151 | + $obj->{$key} = $row[$key]; |
|
| 152 | + } |
|
| 141 | 153 | |
| 142 | 154 | return $obj; |
| 143 | 155 | } |
@@ -154,8 +166,9 @@ discard block |
||
| 154 | 166 | $filecontents = file_get_contents($file); |
| 155 | 167 | if (preg_match("/Rev\: (\d+)/", $filecontents, $matches)) { |
| 156 | 168 | $patchrev = $matches[1]; |
| 157 | - if ($patchrev > $currentrev) |
|
| 158 | - $missingpatch[] = $file; |
|
| 169 | + if ($patchrev > $currentrev) { |
|
| 170 | + $missingpatch[] = $file; |
|
| 171 | + } |
|
| 159 | 172 | } |
| 160 | 173 | } |
| 161 | 174 | |
@@ -177,8 +190,9 @@ discard block |
||
| 177 | 190 | public function getLicense($html = false) |
| 178 | 191 | { |
| 179 | 192 | $n = "\r\n"; |
| 180 | - if ($html) |
|
| 181 | - $n = "<br/>"; |
|
| 193 | + if ($html) { |
|
| 194 | + $n = "<br/>"; |
|
| 195 | + } |
|
| 182 | 196 | |
| 183 | 197 | return $n . "newznab " . $this->version() . " Copyright (C) " . date("Y") . " newznab.com" . $n . " |
| 184 | 198 | |
@@ -271,8 +271,9 @@ discard block |
||
| 271 | 271 | " from categories c left outer join categories cp on cp.id = c.parentid where c.id = %d", $id |
| 272 | 272 | ) |
| 273 | 273 | ); |
| 274 | - if (!$res) |
|
| 275 | - return null; |
|
| 274 | + if (!$res) { |
|
| 275 | + return null; |
|
| 276 | + } |
|
| 276 | 277 | |
| 277 | 278 | $min = intval($res['minsizetoformrelease']); |
| 278 | 279 | $max = intval($res['maxsizetoformrelease']); |
@@ -427,8 +428,9 @@ discard block |
||
| 427 | 428 | $temp_array[-1] = "--Please Select--"; |
| 428 | 429 | } |
| 429 | 430 | |
| 430 | - foreach ($categories as $category) |
|
| 431 | - $temp_array[$category["id"]] = $category["title"]; |
|
| 431 | + foreach ($categories as $category) { |
|
| 432 | + $temp_array[$category["id"]] = $category["title"]; |
|
| 433 | + } |
|
| 432 | 434 | |
| 433 | 435 | return $temp_array; |
| 434 | 436 | } |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | $this->_classUsed = "steam"; |
| 418 | 418 | $this->_getGame->cookie = $this->cookie; |
| 419 | 419 | $this->_getGame->searchTerm = $gameInfo['title']; |
| 420 | - if($this->_getGame->search() !== false){ |
|
| 420 | + if($this->_getGame->search() !== false) { |
|
| 421 | 421 | $this->_gameResults = $this->_getGame->getAll(); |
| 422 | 422 | } |
| 423 | 423 | if (count($this->_gameResults) < 1) { |
@@ -444,10 +444,10 @@ discard block |
||
| 444 | 444 | return false; |
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | - if(empty($this->_gameResults['title'])){ |
|
| 447 | + if(empty($this->_gameResults['title'])) { |
|
| 448 | 448 | return false; |
| 449 | 449 | } |
| 450 | - if(!is_array($this->_gameResults)){ |
|
| 450 | + if(!is_array($this->_gameResults)) { |
|
| 451 | 451 | return false; |
| 452 | 452 | } |
| 453 | 453 | if (count($this->_gameResults) > 1) { |
@@ -636,14 +636,14 @@ discard block |
||
| 636 | 636 | if (empty($con['title'])) { |
| 637 | 637 | $con['title'] = $gameInfo['title']; |
| 638 | 638 | } |
| 639 | - if(!isset($con['releasedate'])){ |
|
| 639 | + if(!isset($con['releasedate'])) { |
|
| 640 | 640 | $con['releasedate'] = ""; |
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | if ($con['releasedate'] == "''") { |
| 644 | 644 | $con['releasedate'] = ""; |
| 645 | 645 | } |
| 646 | - if(!isset($con['review'])){ |
|
| 646 | + if(!isset($con['review'])) { |
|
| 647 | 647 | $con['review'] = 'No Review'; |
| 648 | 648 | } |
| 649 | 649 | $con['classused'] = $this->_classUsed; |
@@ -730,10 +730,10 @@ discard block |
||
| 730 | 730 | $this->pdo->log->primary($con['title']) |
| 731 | 731 | ); |
| 732 | 732 | } |
| 733 | - if($con['cover'] === 1){ |
|
| 733 | + if($con['cover'] === 1) { |
|
| 734 | 734 | $con['cover'] = $ri->saveImage($gamesId, $con['coverurl'], $this->imgSavePath, 250, 250); |
| 735 | 735 | } |
| 736 | - if($con['backdrop'] === 1){ |
|
| 736 | + if($con['backdrop'] === 1) { |
|
| 737 | 737 | $con['backdrop'] = $ri->saveImage($gamesId . '-backdrop', $con['backdropurl'], $this->imgSavePath, 1920, 1024); |
| 738 | 738 | } |
| 739 | 739 | } else { |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | $gameId = -2; |
| 871 | 871 | |
| 872 | 872 | // Leave gamesinfo_id 0 to parse again |
| 873 | - if($this->maxHitRequest === true){ |
|
| 873 | + if($this->maxHitRequest === true) { |
|
| 874 | 874 | $gameId = 0; |
| 875 | 875 | } |
| 876 | 876 | } |
@@ -942,7 +942,7 @@ discard block |
||
| 942 | 942 | $result['title'] = $dlc[0]; |
| 943 | 943 | } |
| 944 | 944 | } |
| 945 | - if(empty($result['title'])){ |
|
| 945 | + if(empty($result['title'])) { |
|
| 946 | 946 | return false; |
| 947 | 947 | } |
| 948 | 948 | $browseNode = '94'; |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | break; |
| 1011 | 1011 | } |
| 1012 | 1012 | } |
| 1013 | - if(empty($genreName)){ |
|
| 1013 | + if(empty($genreName)) { |
|
| 1014 | 1014 | $genreName = $tmpGenre[0]; |
| 1015 | 1015 | } |
| 1016 | 1016 | } else { |
@@ -34,11 +34,16 @@ |
||
| 34 | 34 | { |
| 35 | 35 | $db = new Settings(); |
| 36 | 36 | |
| 37 | - if($epabsolute == '0') //as string - not int. |
|
| 37 | + if($epabsolute == '0') { |
|
| 38 | + //as string - not int. |
|
| 38 | 39 | if(!preg_match('/[21]\d{3}\/\d{2}\/\d{2}/', $fullep)) |
| 39 | 40 | $additionalSql = sprintf('AND fullep = %s', $db->escapeString($fullep)); |
| 40 | - else $additionalSql = sprintf('AND airdate LIKE %s', $db->escapeString($fullep.' %')); |
|
| 41 | - else $additionalSql = sprintf('AND epabsolute = %s', $db->escapeString($epabsolute)); |
|
| 41 | + } else { |
|
| 42 | + $additionalSql = sprintf('AND airdate LIKE %s', $db->escapeString($fullep.' %')); |
|
| 43 | + } |
|
| 44 | + else { |
|
| 45 | + $additionalSql = sprintf('AND epabsolute = %s', $db->escapeString($epabsolute)); |
|
| 46 | + } |
|
| 42 | 47 | |
| 43 | 48 | return $db->queryOneRow(sprintf('SELECT * FROM episodeinfo WHERE showtitle = %s %s', $db->escapeString($showtitle), $additionalSql)); |
| 44 | 49 | } |
@@ -8,8 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | public function __construct() |
| 10 | 10 | { |
| 11 | - if (is_null($this->session)) |
|
| 12 | - { |
|
| 11 | + if (is_null($this->session)) { |
|
| 13 | 12 | $this->getNonce(); |
| 14 | 13 | $this->login(); |
| 15 | 14 | } |
@@ -63,8 +62,7 @@ discard block |
||
| 63 | 62 | { |
| 64 | 63 | $params = array('sessionid' => $this->session); |
| 65 | 64 | $response = $this->sendRequest(sprintf('app/webUpdate'), $params); |
| 66 | - foreach ($response['nzbs'] as &$nzb) |
|
| 67 | - { |
|
| 65 | + foreach ($response['nzbs'] as &$nzb) { |
|
| 68 | 66 | $nzb['original_state'] = $nzb['state']; |
| 69 | 67 | $nzb['state'] = (1 == $nzb['isPaused']) ? 'Paused' : $this->getState($nzb['state']); |
| 70 | 68 | } |
@@ -80,8 +78,7 @@ discard block |
||
| 80 | 78 | */ |
| 81 | 79 | public function addQueue($nzb = '') |
| 82 | 80 | { |
| 83 | - if (!empty($nzb)) |
|
| 84 | - { |
|
| 81 | + if (!empty($nzb)) { |
|
| 85 | 82 | $page = new Page; |
| 86 | 83 | $user = new Users; |
| 87 | 84 | |
@@ -107,8 +104,7 @@ discard block |
||
| 107 | 104 | */ |
| 108 | 105 | public function resume($id = 0) |
| 109 | 106 | { |
| 110 | - if ($id > 0) |
|
| 111 | - { |
|
| 107 | + if ($id > 0) { |
|
| 112 | 108 | # /nzb/(id)/resume |
| 113 | 109 | $params = array('sessionid' => $this->session); |
| 114 | 110 | $response = $this->sendRequest(sprintf('nzb/%s/resume', $id), $params); |
@@ -123,8 +119,7 @@ discard block |
||
| 123 | 119 | */ |
| 124 | 120 | public function pause($id = 0) |
| 125 | 121 | { |
| 126 | - if ($id > 0) |
|
| 127 | - { |
|
| 122 | + if ($id > 0) { |
|
| 128 | 123 | # /nzb/(id)/pause |
| 129 | 124 | $params = array('sessionid' => $this->session); |
| 130 | 125 | $response = $this->sendRequest(sprintf('nzb/%s/pause', $id), $params); |
@@ -139,8 +134,7 @@ discard block |
||
| 139 | 134 | */ |
| 140 | 135 | public function moveUp($id = 0) |
| 141 | 136 | { |
| 142 | - if ($id > 0) |
|
| 143 | - { |
|
| 137 | + if ($id > 0) { |
|
| 144 | 138 | # nzb/(nzbid)/moveup |
| 145 | 139 | $params = array('sessionid' => $this->session); |
| 146 | 140 | $response = $this->sendRequest(sprintf('nzb/%s/moveup', $id), $params); |
@@ -155,8 +149,7 @@ discard block |
||
| 155 | 149 | */ |
| 156 | 150 | public function moveDown($id = 0) |
| 157 | 151 | { |
| 158 | - if ($id > 0) |
|
| 159 | - { |
|
| 152 | + if ($id > 0) { |
|
| 160 | 153 | # nzb/(nzbid)/movedown |
| 161 | 154 | $params = array('sessionid' => $this->session); |
| 162 | 155 | $response = $this->sendRequest(sprintf('nzb/%s/movedown', $id), $params); |
@@ -171,8 +164,7 @@ discard block |
||
| 171 | 164 | */ |
| 172 | 165 | public function moveBottom($id = 0) |
| 173 | 166 | { |
| 174 | - if ($id > 0) |
|
| 175 | - { |
|
| 167 | + if ($id > 0) { |
|
| 176 | 168 | # nzb/(nzbid)/movebottom |
| 177 | 169 | $params = array('sessionid' => $this->session); |
| 178 | 170 | $response = $this->sendRequest(sprintf('nzb/%s/movebottom', $id), $params); |
@@ -187,8 +179,7 @@ discard block |
||
| 187 | 179 | */ |
| 188 | 180 | public function delete($id = 0) |
| 189 | 181 | { |
| 190 | - if ($id > 0) |
|
| 191 | - { |
|
| 182 | + if ($id > 0) { |
|
| 192 | 183 | # nzb/(nzbid)/movebottom |
| 193 | 184 | $params = array('sessionid' => $this->session); |
| 194 | 185 | $response = $this->sendRequest(sprintf('nzb/%s/cancelDelete', $id), $params); |
@@ -203,8 +194,7 @@ discard block |
||
| 203 | 194 | */ |
| 204 | 195 | public function moveTop($id = 0) |
| 205 | 196 | { |
| 206 | - if ($id > 0) |
|
| 207 | - { |
|
| 197 | + if ($id > 0) { |
|
| 208 | 198 | # nzb/(nzbid)/movebottom |
| 209 | 199 | $params = array('sessionid' => $this->session); |
| 210 | 200 | $response = $this->sendRequest(sprintf('nzb/%s/movetop', $id), $params); |
@@ -219,8 +209,7 @@ discard block |
||
| 219 | 209 | */ |
| 220 | 210 | public function getFilelist($id = 0) |
| 221 | 211 | { |
| 222 | - if ($id > 0) |
|
| 223 | - { |
|
| 212 | + if ($id > 0) { |
|
| 224 | 213 | # file/(nzbid) |
| 225 | 214 | $params = array('sessionid' => $this->session); |
| 226 | 215 | $response = $this->sendRequest(sprintf('file/%s', $id), $params); |
@@ -261,8 +250,9 @@ discard block |
||
| 261 | 250 | |
| 262 | 251 | $response = $this->sendRequest('auth/login', $params); |
| 263 | 252 | |
| 264 | - if ('successful' == $response['loginResult']) |
|
| 265 | - $this->session = $response['sessionID']; |
|
| 253 | + if ('successful' == $response['loginResult']) { |
|
| 254 | + $this->session = $response['sessionID']; |
|
| 255 | + } |
|
| 266 | 256 | |
| 267 | 257 | if ('failed' == $response['loginResult']) { } |
| 268 | 258 | } |
@@ -301,8 +291,7 @@ discard block |
||
| 301 | 291 | |
| 302 | 292 | curl_close($ch); |
| 303 | 293 | |
| 304 | - switch ($status) |
|
| 305 | - { |
|
| 294 | + switch ($status) { |
|
| 306 | 295 | case 0: |
| 307 | 296 | throw new \Exception(sprintf('Unable to connect. Is NZBVortex running? Is your API key correct? Is something blocking ports? (Err: %s)', $error)); |
| 308 | 297 | break; |
@@ -354,18 +354,12 @@ discard block |
||
| 354 | 354 | $apaiIo = new ApaiIO($conf); |
| 355 | 355 | |
| 356 | 356 | $response = $apaiIo->runOperation($search); |
| 357 | - if ($response === false) |
|
| 358 | - { |
|
| 357 | + if ($response === false) { |
|
| 359 | 358 | throw new \Exception("Could not connect to Amazon"); |
| 360 | - } |
|
| 361 | - else |
|
| 362 | - { |
|
| 363 | - if (isset($response->Items->Item->ItemAttributes->Title)) |
|
| 364 | - { |
|
| 359 | + } else { |
|
| 360 | + if (isset($response->Items->Item->ItemAttributes->Title)) { |
|
| 365 | 361 | return $response; |
| 366 | - } |
|
| 367 | - else |
|
| 368 | - { |
|
| 362 | + } else { |
|
| 369 | 363 | return false; |
| 370 | 364 | } |
| 371 | 365 | } |
@@ -455,7 +449,8 @@ discard block |
||
| 455 | 449 | |
| 456 | 450 | // Update release. |
| 457 | 451 | $this->pdo->queryExec(sprintf('UPDATE releases SET bookinfo_id = %d WHERE id = %d', $bookId, $arr['id'])); |
| 458 | - } else { // Could not parse release title. |
|
| 452 | + } else { |
|
| 453 | +// Could not parse release title. |
|
| 459 | 454 | $this->pdo->queryExec(sprintf('UPDATE releases SET bookinfo_id = %d WHERE id = %d', -2, $arr['id'])); |
| 460 | 455 | if ($this->echooutput) { |
| 461 | 456 | echo '.'; |
@@ -340,7 +340,7 @@ |
||
| 340 | 340 | : '' |
| 341 | 341 | ); |
| 342 | 342 | |
| 343 | - if ($query === 'UPDATE predb SET '){ |
|
| 343 | + if ($query === 'UPDATE predb SET ') { |
|
| 344 | 344 | return; |
| 345 | 345 | } |
| 346 | 346 | |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function getCommentCount($refdate=Null, $localOnly=Null) |
| 71 | 71 | { |
| 72 | - if($refdate !== Null){ |
|
| 73 | - if(is_string($refdate)){ |
|
| 72 | + if($refdate !== Null) { |
|
| 73 | + if(is_string($refdate)) { |
|
| 74 | 74 | // ensure we're in the right format |
| 75 | 75 | $refdate=date("Y-m-d H:i:s", strtotime($refdate)); |
| 76 | - }else if(is_int($refdate)){ |
|
| 76 | + } else if(is_int($refdate)) { |
|
| 77 | 77 | // ensure we're in the right format |
| 78 | 78 | $refdate=date("Y-m-d H:i:s", $refdate); |
| 79 | - }else{ |
|
| 79 | + } else { |
|
| 80 | 80 | // leave it as null (bad content anyhow) |
| 81 | 81 | $refdate = Null; |
| 82 | 82 | } |
@@ -84,20 +84,22 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $q = "SELECT count(id) AS num FROM release_comments"; |
| 86 | 86 | $clause = []; |
| 87 | - if($refdate !== Null) |
|
| 88 | - $clause[] = "createddate >= '$refdate'"; |
|
| 87 | + if($refdate !== Null) { |
|
| 88 | + $clause[] = "createddate >= '$refdate'"; |
|
| 89 | + } |
|
| 89 | 90 | |
| 90 | 91 | // set localOnly to Null to include both local and remote |
| 91 | 92 | // set localOnly to true to only receive local comment count |
| 92 | 93 | // set localOnly to false to only receive remote comment count |
| 93 | - if($localOnly === true){ |
|
| 94 | + if($localOnly === true) { |
|
| 94 | 95 | $clause[] = "sourceid = 0"; |
| 95 | - }else if($localOnly === false){ |
|
| 96 | + } else if($localOnly === false) { |
|
| 96 | 97 | $clause[] = "sourceid != 0"; |
| 97 | 98 | } |
| 98 | 99 | |
| 99 | - if(count($clause)) |
|
| 100 | - $q .= " WHERE ".implode(" AND ", $clause); |
|
| 100 | + if(count($clause)) { |
|
| 101 | + $q .= " WHERE ".implode(" AND ", $clause); |
|
| 102 | + } |
|
| 101 | 103 | |
| 102 | 104 | $res = $this->pdo->queryOneRow($q); |
| 103 | 105 | return $res["num"]; |
@@ -125,8 +127,7 @@ discard block |
||
| 125 | 127 | public function deleteCommentsForRelease($id) |
| 126 | 128 | { |
| 127 | 129 | $res = $this->getCommentById($id); |
| 128 | - if ($res) |
|
| 129 | - { |
|
| 130 | + if ($res) { |
|
| 130 | 131 | $this->pdo->queryExec(sprintf("DELETE rc.* FROM release_comments rc JOIN releases r ON r.gid = rc.gid WHERE r.id = %d", $id)); |
| 131 | 132 | $this->updateReleaseCommentCount($res["gid"]); |
| 132 | 133 | } |
@@ -140,11 +141,9 @@ discard block |
||
| 140 | 141 | public function deleteCommentsForUser($id) |
| 141 | 142 | { |
| 142 | 143 | $numcomments = $this->getCommentCountForUser($id); |
| 143 | - if ($numcomments > 0) |
|
| 144 | - { |
|
| 144 | + if ($numcomments > 0) { |
|
| 145 | 145 | $comments = $this->getCommentsForUserRange($id, 0, $numcomments); |
| 146 | - foreach ($comments as $comment) |
|
| 147 | - { |
|
| 146 | + foreach ($comments as $comment) { |
|
| 148 | 147 | $this->deleteComment($comment["id"]); |
| 149 | 148 | $this->updateReleaseCommentCount($comment["gid"]); |
| 150 | 149 | } |
@@ -244,10 +243,11 @@ discard block |
||
| 244 | 243 | */ |
| 245 | 244 | public function getCommentsForUserRange($uid, $start, $num) |
| 246 | 245 | { |
| 247 | - if ($start === false) |
|
| 248 | - $limit = ""; |
|
| 249 | - else |
|
| 250 | - $limit = " LIMIT ".$start.",".$num; |
|
| 246 | + if ($start === false) { |
|
| 247 | + $limit = ""; |
|
| 248 | + } else { |
|
| 249 | + $limit = " LIMIT ".$start.",".$num; |
|
| 250 | + } |
|
| 251 | 251 | |
| 252 | 252 | return $this->pdo->query(sprintf("SELECT release_comments.*, r.guid, r.searchname, users.username FROM release_comments INNER JOIN releases r ON r.id = release_comments.releases_id LEFT OUTER JOIN users ON users.id = release_comments.users_id WHERE users_id = %d ORDER BY release_comments.createddate DESC ".$limit, $uid)); |
| 253 | 253 | } |