Passed
Push — dev ( 273395...f26621 )
by Darko
08:55
created
misc/testing/rottentom.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@
 block discarded – undo
8 8
 $rtkey = $s->getSetting('rottentomatokey');
9 9
 $rt = new RottenTomato($rtkey);
10 10
 
11
-if (isset($rtkey) && $rtkey !='')
12
-{
11
+if (isset($rtkey) && $rtkey !='') {
13 12
 	$rt = new RottenTomato($rtkey);
14 13
 
15 14
 	//print_r($rt->getMoviesBoxOffice());
Please login to merge, or discard this patch.
misc/testing/dumpnfo.php 1 patch
Braces   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,17 +14,16 @@
 block discarded – undo
14 14
 $db = new Settings();
15 15
 
16 16
 $res = $db->queryDirect("select releases.searchname, releases.postdate, uncompress(release_nfos.nfo) as nfo from releases inner join release_nfos on releases.ID = release_nfos.releaseID and release_nfos.nfo is not null order by postdate");
17
-while ($row = $db->getAssocArray($res))
18
-{
17
+while ($row = $db->getAssocArray($res)) {
19 18
 	$dir = date("Ymd", strtotime($row["postdate"]));
20 19
 
21
-	if (!file_exists($dir))
22
-		mkdir($dir);
20
+	if (!file_exists($dir)) {
21
+			mkdir($dir);
22
+	}
23 23
 
24 24
 	$filename = $dir."/".safeFilename($row["searchname"]).".nfo";
25 25
 
26
-	if (!file_exists($filename))
27
-	{
26
+	if (!file_exists($filename)) {
28 27
 		$fh = fopen($filename, 'w');
29 28
 		fwrite($fh, Utility::cp437toUTF($row["nfo"]));
30 29
 		fclose($fh);
Please login to merge, or discard this patch.
misc/testing/spotnab.php 1 patch
Braces   +37 added lines, -39 removed lines patch added patch discarded remove patch
@@ -212,7 +212,8 @@  discard block
 block discarded – undo
212 212
 
213 213
 $options = getopt($shortopts, $longopts);
214 214
 
215
-function display_help(){
215
+function display_help()
216
+{
216 217
 	echo "\n";
217 218
 	echo "SpotNab v0.97.4, Author: l2g\n";
218 219
 	echo "Syntax: spotnab.php <action>\n";
@@ -270,7 +271,7 @@  discard block
 block discarded – undo
270 271
 
271 272
 $delete_broken_releases = false;
272 273
 if(array_key_exists("G", $options) ||
273
-	array_key_exists("populate-fix-gid", $options)){
274
+	array_key_exists("populate-fix-gid", $options)) {
274 275
 	echo "Updating GID in releases table + fix ...";
275 276
 	$spotnab = new SpotNab();
276 277
 	$spotnab->processGID(0,5000,true);
@@ -278,7 +279,7 @@  discard block
 block discarded – undo
278 279
 }
279 280
 
280 281
 if(array_key_exists("g", $options) ||
281
-	array_key_exists("populate-gid", $options)){
282
+	array_key_exists("populate-gid", $options)) {
282 283
 	echo "Updating GID in releases table ...";
283 284
 	$spotnab = new SpotNab();
284 285
 	$spotnab->processGID();
@@ -286,7 +287,7 @@  discard block
 block discarded – undo
286 287
 }
287 288
 
288 289
 if(array_key_exists("r", $options) ||
289
-	array_key_exists("soft-reset", $options)){
290
+	array_key_exists("soft-reset", $options)) {
290 291
 	echo "Soft Reseting Spotnab... ";
291 292
 	$spotnab = new SpotNab();
292 293
 	$spotnab->soft_reset();
@@ -295,18 +296,17 @@  discard block
 block discarded – undo
295 296
 
296 297
 $force_keygen_save = false;
297 298
 if(array_key_exists("K", $options) ||
298
-	array_key_exists("force-keygen", $options)){
299
+	array_key_exists("force-keygen", $options)) {
299 300
 	$spotnab = new SpotNab();
300 301
 	$spotnab->keygen(true, true);
301
-}
302
-else if(array_key_exists("k", $options) ||
303
-	array_key_exists("keygen", $options)){
302
+} else if(array_key_exists("k", $options) ||
303
+	array_key_exists("keygen", $options)) {
304 304
 	$spotnab = new SpotNab();
305 305
 	$spotnab->keygen(true);
306 306
 }
307 307
 
308 308
 if(array_key_exists("p", $options) ||
309
-	array_key_exists("post", $options)){
309
+	array_key_exists("post", $options)) {
310 310
 	echo "Posting... ";
311 311
 	$spotnab = new SpotNab();
312 312
 	$spotnab->post();
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 }
315 315
 
316 316
 if(array_key_exists("d", $options) ||
317
-	array_key_exists("discover", $options)){
317
+	array_key_exists("discover", $options)) {
318 318
 	echo "Discovering... ";
319 319
 	$spotnab = new SpotNab();
320 320
 	$spotnab->fetch_discovery();
@@ -322,15 +322,15 @@  discard block
 block discarded – undo
322 322
 }
323 323
 
324 324
 if(array_key_exists("F", $options) ||
325
-	array_key_exists("fetch-backfill", $options)){
325
+	array_key_exists("fetch-backfill", $options)) {
326 326
 	$days = array_key_exists("F", $options)?$options["F"]:$options["fetch-backfill"];
327
-    try{
327
+    try {
328 328
     	$days = abs(intval($days));
329
-    }catch(Exception $e){
329
+    } catch(Exception $e) {
330 330
 		$days = -1;
331 331
     }
332 332
 
333
-    if($days <= 0){
333
+    if($days <= 0) {
334 334
     	echo "Error: A SpotNab fetch backfill requires you specify the number of days to look back.\n";
335 335
     	echo "Syntax: php spontnab.php -F=<days>\n";
336 336
         exit(1);
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 	echo "Done\n";
342 342
 
343 343
 
344
-}else if (array_key_exists("f", $options) ||
345
-	array_key_exists("fetch", $options)){
344
+} else if (array_key_exists("f", $options) ||
345
+	array_key_exists("fetch", $options)) {
346 346
 	echo "Fetching... ";
347 347
 	$spotnab = new SpotNab();
348 348
 	$spotnab->fetch();
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 }
351 351
 
352 352
 if(array_key_exists("b", $options) ||
353
-	array_key_exists("broadcast", $options)){
353
+	array_key_exists("broadcast", $options)) {
354 354
 	echo "Broadcasting... ";
355 355
 	$spotnab = new SpotNab();
356 356
 	$spotnab->post_discovery();
@@ -358,24 +358,22 @@  discard block
 block discarded – undo
358 358
 }
359 359
 
360 360
 if(array_key_exists("t", $options) ||
361
-	array_key_exists("test", $options)){
361
+	array_key_exists("test", $options)) {
362 362
 	$spotnab = new SpotNab();
363 363
 
364
-	if($spotnab->has_openssl())
365
-	{
364
+	if($spotnab->has_openssl()) {
366 365
 		printf("%s INFO - Testing SSL Key Generator ...",
367 366
 					date("Y-m-d H:i:s"));
368 367
 		$keys = $spotnab->keygen(false);
369 368
 		if(is_array($keys) &&
370 369
 			array_key_exists("pubkey", $keys) &&
371
-			array_key_exists("prvkey", $keys))
372
-		{
370
+			array_key_exists("prvkey", $keys)) {
373 371
 			$prvkey = $spotnab->decompstr($keys['prvkey']);
374 372
 			$pubkey = $spotnab->decompstr($keys['pubkey']);
375 373
 			$refc = $spotnab->getRandomStr(80);
376 374
 			$refd = $spotnab->decrypt($spotnab->encrypt($refc, $prvkey), $pubkey);
377 375
 			echo ($refc == $refd)?"Successful!\n":"Failed!\n";
378
-		}else{
376
+		} else {
379 377
 			echo "Failed!\n";
380 378
 		}
381 379
 
@@ -383,11 +381,11 @@  discard block
 block discarded – undo
383 381
 				date("Y-m-d H:i:s"));
384 382
 		$preMsg = $spotnab->getRandomStr(800);
385 383
 		$postMsg = $spotnab->decrypt($spotnab->encrypt($preMsg));
386
-		if($postMsg === false){
384
+		if($postMsg === false) {
387 385
 			echo "Failed!\n";
388
-		}else if(!strcmp($preMsg, $postMsg)){
386
+		} else if(!strcmp($preMsg, $postMsg)) {
389 387
 				echo "Successful!\n";
390
-		}else{
388
+		} else {
391 389
 			echo "Failed!\n";
392 390
 		}
393 391
 
@@ -419,14 +417,14 @@  discard block
 block discarded – undo
419 417
 			)
420 418
 		);
421 419
 		$article = $spotnab->encodePost($before, Null, true);
422
-		if($article !== false){
420
+		if($article !== false) {
423 421
 			$after = $spotnab->decodePost($article[1]);
424
-			if($before === $after){
422
+			if($before === $after) {
425 423
 				echo "Successful!\n";
426
-			}else{
424
+			} else {
427 425
 				echo "Failed!\n";
428 426
 			}
429
-		}else{
427
+		} else {
430 428
 			echo "Failed!\n";
431 429
 		}
432 430
 		printf("%s INFO - Testing big message encode/decode ...",
@@ -439,7 +437,7 @@  discard block
 block discarded – undo
439 437
 			'postdate_utc' => $spotnab->local2utc(),
440 438
 			'comments' => []
441 439
 		);
442
-		for($i=0;$i<3000;$i++){
440
+		for($i=0;$i<3000;$i++) {
443 441
 			// Build large post
444 442
 			$before['comments'][] =array(
445 443
 				'gid' => 'ABCDEFHIJKLMNOPQRSTUVWXYZ0123456',
@@ -451,14 +449,14 @@  discard block
 block discarded – undo
451 449
 			);
452 450
 		}
453 451
 		$article = $spotnab->encodePost($before, Null, true);
454
-		if($article !== false){
452
+		if($article !== false) {
455 453
 			$after = $spotnab->decodePost($article[1]);
456
-			if($before === $after){
454
+			if($before === $after) {
457 455
 				echo "Successful!\n";
458
-			}else{
456
+			} else {
459 457
 				echo "Failed!\n";
460 458
 			}
461
-		}else{
459
+		} else {
462 460
 			echo "Failed!\n";
463 461
 		}
464 462
 
@@ -480,14 +478,14 @@  discard block
 block discarded – undo
480 478
 		$headers = array($article[2]);
481 479
 
482 480
 		$matched = $spotnab->process_comment_headers($headers, $hash, false);
483
-		if($matched !== false){
481
+		if($matched !== false) {
484 482
 			$inserted = $matched[0];
485 483
 			$updated = $matched[1];
486 484
 			echo ($matched > 0)?"Successful!\n":"Failed!\n";
487
-		}else{
485
+		} else {
488 486
 			echo "Failed\n";
489 487
 		}
490
-	}else{
488
+	} else {
491 489
 		printf("%s WARNING - openssl is not correctly installed; broadcasts and posts will be disabled.\n",
492 490
 				date("Y-m-d H:i:s"));
493 491
 	}
@@ -525,7 +523,7 @@  discard block
 block discarded – undo
525 523
 }
526 524
 
527 525
 if(array_key_exists("o", $options) ||
528
-	array_key_exists("clean-orphan-comments", $options)){
526
+	array_key_exists("clean-orphan-comments", $options)) {
529 527
 	echo "Removing orphan comments...";
530 528
 	$spotnab = new SpotNab();
531 529
 	printf("%d record(s) removed.\n", $spotnab->orphan_comment_clean());
Please login to merge, or discard this patch.
misc/testing/DB/resetdb.php 1 patch
Braces   +11 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,15 +11,17 @@  discard block
 block discarded – undo
11 11
 Utility::clearScreen();
12 12
 $pdo = new DB();
13 13
 
14
-if (!isset($argv[1]) || (isset($argv[1]) && $argv[1] !== 'true'))
14
+if (!isset($argv[1]) || (isset($argv[1]) && $argv[1] !== 'true')) {
15 15
 	exit($pdo->log->error("\nThis script removes all releases and release related files. To run:\nphp resetdb.php true\n"));
16
+}
16 17
 
17 18
 echo $pdo->log->warning("This script removes all releases, nzb files, samples, previews , nfos, truncates all article tables and resets all groups.");
18 19
 echo $pdo->log->header("Are you sure you want reset the DB?  Type 'DESTROY' to continue:  \n");
19 20
 echo $pdo->log->warningOver("\n");
20 21
 $line = fgets(STDIN);
21
-if (trim($line) != 'DESTROY')
22
+if (trim($line) != 'DESTROY') {
22 23
 	exit($pdo->log->error("This script is dangerous you must type DESTROY for it function."));
24
+}
23 25
 
24 26
 echo "\n";
25 27
 echo $pdo->log->header("Thank you, continuing...\n\n");
@@ -41,9 +43,10 @@  discard block
 block discarded – undo
41 43
 ];
42 44
 foreach ($arr as &$value) {
43 45
 	$rel = $pdo->queryExec("TRUNCATE TABLE $value");
44
-	if ($rel !== false)
45
-		echo $pdo->log->primary("Truncating ${value} completed.");
46
-}
46
+	if ($rel !== false) {
47
+			echo $pdo->log->primary("Truncating ${value} completed.");
48
+	}
49
+	}
47 50
 unset($value);
48 51
 
49 52
 $sql = "SHOW table status";
@@ -53,8 +56,9 @@  discard block
 block discarded – undo
53 56
 	$tbl = $row['name'];
54 57
 	if (preg_match('/binaries_\d+/', $tbl) || preg_match('/parts_\d+/', $tbl) || preg_match('/collections_\d+/', $tbl) || preg_match('/partrepair_\d+/', $tbl) || preg_match('/\d+_binaries/', $tbl) || preg_match('/\d+_collections/', $tbl) || preg_match('/\d+_parts/', $tbl) || preg_match('/\d+_partrepair_\d+/', $tbl)) {
55 58
 		$rel = $pdo->queryDirect(sprintf('DROP TABLE %s', $tbl));
56
-		if ($rel !== false)
57
-			echo $pdo->log->primary("Dropping ${tbl} completed.");
59
+		if ($rel !== false) {
60
+					echo $pdo->log->primary("Dropping ${tbl} completed.");
61
+		}
58 62
 	}
59 63
 }
60 64
 
Please login to merge, or discard this patch.
misc/testing/fix_filesize.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@
 block discarded – undo
19 19
 $compl = 0;
20 20
 echo "Updating file size for " . count($items) . " release(s)\n";
21 21
 
22
-while ($item = array_pop($items))
23
-{
22
+while ($item = array_pop($items)) {
24 23
 	$nzbpath = $nzb->getNZBPath($item['guid'], $pdo->getSetting('nzbpath'));
25 24
 
26 25
 	ob_start();
Please login to merge, or discard this patch.
app/extensions/util/Versions.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -110,10 +110,12 @@
 block discarded – undo
110 110
 				$this->changes |= self::UPDATED_GIT_TAG;
111 111
 
112 112
 				return $this->versions->git->tag;
113
-			} else { // They're NOT the same but we were told not to update.
113
+			} else {
114
+// They're NOT the same but we were told not to update.
114 115
 				return false;
115 116
 			}
116
-		} else { // They're the same so return true
117
+		} else {
118
+// They're the same so return true
117 119
 			return true;
118 120
 		}
119 121
 	}
Please login to merge, or discard this patch.
app/controllers/HelloWorldController.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,17 +8,21 @@
 block discarded – undo
8 8
 
9 9
 namespace app\controllers;
10 10
 
11
-class HelloWorldController extends \lithium\action\Controller {
11
+class HelloWorldController extends \lithium\action\Controller
12
+{
12 13
 
13
-	public function index() {
14
+	public function index()
15
+	{
14 16
 		return $this->render(array('layout' => false));
15 17
 	}
16 18
 
17
-	public function to_string() {
19
+	public function to_string()
20
+	{
18 21
 		return "Hello World";
19 22
 	}
20 23
 
21
-	public function to_json() {
24
+	public function to_json()
25
+	{
22 26
 		return $this->render(array('json' => 'Hello World'));
23 27
 	}
24 28
 }
Please login to merge, or discard this patch.
app/controllers/PagesController.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,9 +23,11 @@
 block discarded – undo
23 23
  * For example, browsing to `/pages/about/company` will render
24 24
  * `/views/pages/about/company.html.php`.
25 25
  */
26
-class PagesController extends \lithium\action\Controller {
26
+class PagesController extends \lithium\action\Controller
27
+{
27 28
 
28
-	public function view() {
29
+	public function view()
30
+	{
29 31
 		$options = array();
30 32
 		$path = func_get_args();
31 33
 
Please login to merge, or discard this patch.
app/controllers/SettingsController.php 1 patch
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,19 +22,23 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.