Passed
Push — dev ( 36ac9d...273395 )
by Darko
08:47
created
misc/testing/Tests/transactiontest.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,19 +9,19 @@  discard block
 block discarded – undo
9 9
     $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
10 10
 
11 11
     // Start the transaction
12
-    if( $db->beginTransaction() )
12
+    if ($db->beginTransaction())
13 13
     {
14 14
         // Loop 20 times
15
-        for($i=1 ; $i<=20 ; $i++ )
15
+        for ($i = 1; $i <= 20; $i++)
16 16
         {
17 17
             // Header
18
-            echo "--[ Insert run: {$i} ]----------------------------------------". PHP_EOL;
18
+            echo "--[ Insert run: {$i} ]----------------------------------------" . PHP_EOL;
19 19
 
20 20
             // Create a new db class instance (multiple can exist)
21 21
             $newDb = new Settings();
22 22
 
23 23
             // Check that there is a new db class instance, but no new PDO instance
24
-            var_dump( $newDb, $newDb->getPDO() );
24
+            var_dump($newDb, $newDb->getPDO());
25 25
 
26 26
             // Insert some data
27 27
             $sql = sprintf("
@@ -30,15 +30,15 @@  discard block
 block discarded – undo
30 30
                 VALUES
31 31
                 ('%s', '%s', '%s', '%s', '%s')", $i, $i, $i, $i, $i
32 32
             );
33
-            $newDb->exec( $sql );
33
+            $newDb->exec($sql);
34 34
 
35 35
             // Check for inserted data
36
-            var_dump( $newDb->query( sprintf( "SELECT * FROM `testdata` WHERE id = %d", $i ) ) );
36
+            var_dump($newDb->query(sprintf("SELECT * FROM `testdata` WHERE id = %d", $i)));
37 37
         }
38 38
 
39 39
         // Now rollback using the last db class instance
40
-        var_dump( $newDb->rollback() );
40
+        var_dump($newDb->rollback());
41 41
     }
42
-} catch(PDOException $e) {
43
-    var_dump( $e );
42
+} catch (PDOException $e) {
43
+    var_dump($e);
44 44
 }
45 45
\ No newline at end of file
Please login to merge, or discard this patch.
misc/testing/Tests/memcache.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
     echo "extension not loaded";
13 13
 
14 14
 $mc = new Memcached();
15
-$mc->connect("localhost", 11211) ;
15
+$mc->connect("localhost", 11211);
16 16
 
17 17
 print_r($mc->getStats());
Please login to merge, or discard this patch.
misc/testing/Tests/regexverify.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -33,25 +33,25 @@
 block discarded – undo
33 33
 # fetch enabled regular expression
34 34
 $catsql = "select ID,groupname,regex from releaseregex where status = 1";
35 35
 $res = $db->query($catsql);
36
-$total=count($res);
37
-$errcnt=0;
36
+$total = count($res);
37
+$errcnt = 0;
38 38
 
39 39
 echo "\n";
40 40
 foreach ($res as $regexrow)
41 41
 {
42
-   foreach ($regs as $regex){
42
+   foreach ($regs as $regex) {
43 43
       try {
44
-         $res=preg_match($regexrow["regex"], $regex);
45
-      }catch(Exception $e){
44
+         $res = preg_match($regexrow["regex"], $regex);
45
+      } catch (Exception $e) {
46 46
          $errcnt++;
47
-         $strerr=str_pad((int) $errcnt,2," ",STR_PAD_LEFT);
48
-         echo "$strerr. id=".$regexrow["id"].
49
-            ", group=".$regexrow["groupname"]."\n";
50
-         echo "    regex='".$regexrow["regex"]."'\n";
51
-         echo "    error=".$e->getMessage()."\n\n";
47
+         $strerr = str_pad((int)$errcnt, 2, " ", STR_PAD_LEFT);
48
+         echo "$strerr. id=" . $regexrow["id"] .
49
+            ", group=" . $regexrow["groupname"] . "\n";
50
+         echo "    regex='" . $regexrow["regex"] . "'\n";
51
+         echo "    error=" . $e->getMessage() . "\n\n";
52 52
          break;
53 53
       }
54 54
    }
55 55
 }
56 56
 echo "Scanned $total record(s), $errcnt error(s) found.\n";
57
-exit(($errcnt>0)?1:0);
57
+exit(($errcnt > 0) ? 1 : 0);
Please login to merge, or discard this patch.
misc/testing/Tests/test_tvdb_API.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 	// Use the first show found (highest match) and get the requested season/episode from $argv
25 25
 	if ($series) {
26 26
 
27
-		echo PHP_EOL . $c->info("Server Time: " . $serverTime) .  PHP_EOL;
27
+		echo PHP_EOL . $c->info("Server Time: " . $serverTime) . PHP_EOL;
28 28
 		print_r($series[0]);
29 29
 
30 30
 		if ($season > 0 && $episode > 0 && $day === '') {
Please login to merge, or discard this patch.
misc/testing/_run_once/tpg_fixes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
 						break;
75 75
 				}
76 76
 			}
77
-			echo 'Finished fixing group ' . $group['id'] . ', ' . (--$groupCount) . ' to go!' .PHP_EOL;
77
+			echo 'Finished fixing group ' . $group['id'] . ', ' . (--$groupCount) . ' to go!' . PHP_EOL;
78 78
 		}
79 79
 	}
80 80
 	echo 'All done!' . PHP_EOL;
Please login to merge, or discard this patch.
misc/testing/updateCategories.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@
 block discarded – undo
31 31
 	$categoryID = $category->determineCategory($rel['groupname'], $rel['searchname']);
32 32
 	if (($categoryID != $rel['rcat']) && ($categoryID != '7900'))
33 33
 	{
34
-		$changedcount ++;
35
-		echo "Changing category for ".$rel['searchname']." New (".$categoryID.") Old (".$rel['rcat'].")\n";
34
+		$changedcount++;
35
+		echo "Changing category for " . $rel['searchname'] . " New (" . $categoryID . ") Old (" . $rel['rcat'] . ")\n";
36 36
 		$db->exec(sprintf("update releases SET categories_id = %d WHERE ID = %d", $categoryID, $rel['id']));
37 37
 	}
38 38
 }
39 39
 
40
-echo $rescount." releases \n";
41
-echo $changedcount." releases changed\n";
40
+echo $rescount . " releases \n";
41
+echo $changedcount . " releases changed\n";
Please login to merge, or discard this patch.
misc/testing/rottentom.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 $rtkey = $s->getSetting('rottentomatokey');
9 9
 $rt = new RottenTomato($rtkey);
10 10
 
11
-if (isset($rtkey) && $rtkey !='')
11
+if (isset($rtkey) && $rtkey != '')
12 12
 {
13 13
 	$rt = new RottenTomato($rtkey);
14 14
 
Please login to merge, or discard this patch.
misc/testing/dumpnfo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 	if (!file_exists($dir))
22 22
 		mkdir($dir);
23 23
 
24
-	$filename = $dir."/".safeFilename($row["searchname"]).".nfo";
24
+	$filename = $dir . "/" . safeFilename($row["searchname"]) . ".nfo";
25 25
 
26 26
 	if (!file_exists($filename))
27 27
 	{
Please login to merge, or discard this patch.
misc/testing/spotnab.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@  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
 	echo "\n";
217 217
 	echo "SpotNab v0.97.4, Author: l2g\n";
218 218
 	echo "Syntax: spotnab.php <action>\n";
@@ -265,28 +265,28 @@  discard block
 block discarded – undo
265 265
 	echo "\n";
266 266
 }
267 267
 
268
-if(!$options){ display_help(); exit(1);}
269
-if(!count($options)){ display_help(); exit(1);}
268
+if (!$options) { display_help(); exit(1); }
269
+if (!count($options)) { display_help(); exit(1); }
270 270
 
271 271
 $delete_broken_releases = false;
272
-if(array_key_exists("G", $options) ||
273
-	array_key_exists("populate-fix-gid", $options)){
272
+if (array_key_exists("G", $options) ||
273
+	array_key_exists("populate-fix-gid", $options)) {
274 274
 	echo "Updating GID in releases table + fix ...";
275 275
 	$spotnab = new SpotNab();
276
-	$spotnab->processGID(0,5000,true);
276
+	$spotnab->processGID(0, 5000, true);
277 277
 	echo "Done\n";
278 278
 }
279 279
 
280
-if(array_key_exists("g", $options) ||
281
-	array_key_exists("populate-gid", $options)){
280
+if (array_key_exists("g", $options) ||
281
+	array_key_exists("populate-gid", $options)) {
282 282
 	echo "Updating GID in releases table ...";
283 283
 	$spotnab = new SpotNab();
284 284
 	$spotnab->processGID();
285 285
 	echo "Done\n";
286 286
 }
287 287
 
288
-if(array_key_exists("r", $options) ||
289
-	array_key_exists("soft-reset", $options)){
288
+if (array_key_exists("r", $options) ||
289
+	array_key_exists("soft-reset", $options)) {
290 290
 	echo "Soft Reseting Spotnab... ";
291 291
 	$spotnab = new SpotNab();
292 292
 	$spotnab->soft_reset();
@@ -294,79 +294,79 @@  discard block
 block discarded – undo
294 294
 }
295 295
 
296 296
 $force_keygen_save = false;
297
-if(array_key_exists("K", $options) ||
298
-	array_key_exists("force-keygen", $options)){
297
+if (array_key_exists("K", $options) ||
298
+	array_key_exists("force-keygen", $options)) {
299 299
 	$spotnab = new SpotNab();
300 300
 	$spotnab->keygen(true, true);
301 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
-if(array_key_exists("p", $options) ||
309
-	array_key_exists("post", $options)){
308
+if (array_key_exists("p", $options) ||
309
+	array_key_exists("post", $options)) {
310 310
 	echo "Posting... ";
311 311
 	$spotnab = new SpotNab();
312 312
 	$spotnab->post();
313 313
 	echo "Done\n";
314 314
 }
315 315
 
316
-if(array_key_exists("d", $options) ||
317
-	array_key_exists("discover", $options)){
316
+if (array_key_exists("d", $options) ||
317
+	array_key_exists("discover", $options)) {
318 318
 	echo "Discovering... ";
319 319
 	$spotnab = new SpotNab();
320 320
 	$spotnab->fetch_discovery();
321 321
 	echo "Done\n";
322 322
 }
323 323
 
324
-if(array_key_exists("F", $options) ||
325
-	array_key_exists("fetch-backfill", $options)){
326
-	$days = array_key_exists("F", $options)?$options["F"]:$options["fetch-backfill"];
327
-    try{
324
+if (array_key_exists("F", $options) ||
325
+	array_key_exists("fetch-backfill", $options)) {
326
+	$days = array_key_exists("F", $options) ? $options["F"] : $options["fetch-backfill"];
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);
337 337
     }
338 338
 	echo "Fetching $days day(s) back ... ";
339 339
 	$spotnab = new SpotNab();
340
-	$spotnab->fetch(time()-($days*86400));
340
+	$spotnab->fetch(time() - ($days * 86400));
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();
349 349
 	echo "Done\n";
350 350
 }
351 351
 
352
-if(array_key_exists("b", $options) ||
353
-	array_key_exists("broadcast", $options)){
352
+if (array_key_exists("b", $options) ||
353
+	array_key_exists("broadcast", $options)) {
354 354
 	echo "Broadcasting... ";
355 355
 	$spotnab = new SpotNab();
356 356
 	$spotnab->post_discovery();
357 357
 	echo "Done\n";
358 358
 }
359 359
 
360
-if(array_key_exists("t", $options) ||
361
-	array_key_exists("test", $options)){
360
+if (array_key_exists("t", $options) ||
361
+	array_key_exists("test", $options)) {
362 362
 	$spotnab = new SpotNab();
363 363
 
364
-	if($spotnab->has_openssl())
364
+	if ($spotnab->has_openssl())
365 365
 	{
366 366
 		printf("%s INFO - Testing SSL Key Generator ...",
367 367
 					date("Y-m-d H:i:s"));
368 368
 		$keys = $spotnab->keygen(false);
369
-		if(is_array($keys) &&
369
+		if (is_array($keys) &&
370 370
 			array_key_exists("pubkey", $keys) &&
371 371
 			array_key_exists("prvkey", $keys))
372 372
 		{
@@ -374,8 +374,8 @@  discard block
 block discarded – undo
374 374
 			$pubkey = $spotnab->decompstr($keys['pubkey']);
375 375
 			$refc = $spotnab->getRandomStr(80);
376 376
 			$refd = $spotnab->decrypt($spotnab->encrypt($refc, $prvkey), $pubkey);
377
-			echo ($refc == $refd)?"Successful!\n":"Failed!\n";
378
-		}else{
377
+			echo ($refc == $refd) ? "Successful!\n" : "Failed!\n";
378
+		} else {
379 379
 			echo "Failed!\n";
380 380
 		}
381 381
 
@@ -383,11 +383,11 @@  discard block
 block discarded – undo
383 383
 				date("Y-m-d H:i:s"));
384 384
 		$preMsg = $spotnab->getRandomStr(800);
385 385
 		$postMsg = $spotnab->decrypt($spotnab->encrypt($preMsg));
386
-		if($postMsg === false){
386
+		if ($postMsg === false) {
387 387
 			echo "Failed!\n";
388
-		}else if(!strcmp($preMsg, $postMsg)){
388
+		} else if (!strcmp($preMsg, $postMsg)) {
389 389
 				echo "Successful!\n";
390
-		}else{
390
+		} else {
391 391
 			echo "Failed!\n";
392 392
 		}
393 393
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 					'comment' => 'testing comment 1',
407 407
 					'username' => 'l2g',
408 408
 					'is_visible' => 1,
409
-					'postdate_utc' => $spotnab->local2utc(time()-86400)
409
+					'postdate_utc' => $spotnab->local2utc(time() - 86400)
410 410
 				),
411 411
 				array(
412 412
 					'gid' => 'ABCDEFHIJKLMNOPQRSTUVWXYZ0123456',
@@ -414,19 +414,19 @@  discard block
 block discarded – undo
414 414
 					'username' => 'l2g-hater',
415 415
 					'is_visible' => 1,
416 416
 					'comment' => 'testing comment 2',
417
-					'postdate_utc' => $spotnab->local2utc(time()-86000)
417
+					'postdate_utc' => $spotnab->local2utc(time() - 86000)
418 418
 				)
419 419
 			)
420 420
 		);
421 421
 		$article = $spotnab->encodePost($before, Null, true);
422
-		if($article !== false){
422
+		if ($article !== false) {
423 423
 			$after = $spotnab->decodePost($article[1]);
424
-			if($before === $after){
424
+			if ($before === $after) {
425 425
 				echo "Successful!\n";
426
-			}else{
426
+			} else {
427 427
 				echo "Failed!\n";
428 428
 			}
429
-		}else{
429
+		} else {
430 430
 			echo "Failed!\n";
431 431
 		}
432 432
 		printf("%s INFO - Testing big message encode/decode ...",
@@ -439,26 +439,26 @@  discard block
 block discarded – undo
439 439
 			'postdate_utc' => $spotnab->local2utc(),
440 440
 			'comments' => []
441 441
 		);
442
-		for($i=0;$i<3000;$i++){
442
+		for ($i = 0; $i < 3000; $i++) {
443 443
 			// Build large post
444
-			$before['comments'][] =array(
444
+			$before['comments'][] = array(
445 445
 				'gid' => 'ABCDEFHIJKLMNOPQRSTUVWXYZ0123456',
446 446
 				'cid' => 'ABCDEFHIJKLMNOPQRSTUVWXYZ0123456',
447
-				'comment' => $refc = $spotnab->getRandomStr(rand(15,200)),
447
+				'comment' => $refc = $spotnab->getRandomStr(rand(15, 200)),
448 448
 				'username' => 'bb',
449 449
 				'is_visible' => 1,
450
-				'postdate_utc' => $spotnab->local2utc(time()-86400)
450
+				'postdate_utc' => $spotnab->local2utc(time() - 86400)
451 451
 			);
452 452
 		}
453 453
 		$article = $spotnab->encodePost($before, Null, true);
454
-		if($article !== false){
454
+		if ($article !== false) {
455 455
 			$after = $spotnab->decodePost($article[1]);
456
-			if($before === $after){
456
+			if ($before === $after) {
457 457
 				echo "Successful!\n";
458
-			}else{
458
+			} else {
459 459
 				echo "Failed!\n";
460 460
 			}
461
-		}else{
461
+		} else {
462 462
 			echo "Failed!\n";
463 463
 		}
464 464
 
@@ -473,21 +473,21 @@  discard block
 block discarded – undo
473 473
 			// We want to find new content, so to make our header
474 474
 			// new, we need to take our ref time and back down
475 475
 			// one second so it can be processed..
476
-			'ref' => $article[2]['Epoch']-1
476
+			'ref' => $article[2]['Epoch'] - 1
477 477
 		));
478 478
 
479 479
 		// Fake headers (use debug information from encodePost)
480 480
 		$headers = array($article[2]);
481 481
 
482 482
 		$matched = $spotnab->process_comment_headers($headers, $hash, false);
483
-		if($matched !== false){
483
+		if ($matched !== false) {
484 484
 			$inserted = $matched[0];
485 485
 			$updated = $matched[1];
486
-			echo ($matched > 0)?"Successful!\n":"Failed!\n";
487
-		}else{
486
+			echo ($matched > 0) ? "Successful!\n" : "Failed!\n";
487
+		} else {
488 488
 			echo "Failed\n";
489 489
 		}
490
-	}else{
490
+	} else {
491 491
 		printf("%s WARNING - openssl is not correctly installed; broadcasts and posts will be disabled.\n",
492 492
 				date("Y-m-d H:i:s"));
493 493
 	}
@@ -496,36 +496,36 @@  discard block
 block discarded – undo
496 496
 				date("Y-m-d H:i:s"));
497 497
 	$refa = $spotnab->utc2local();
498 498
 	$refb = $spotnab->utc2local($spotnab->local2utc($refa));
499
-	echo ($refa == $refb)?"Successful!\n":"Failed!\n";
499
+	echo ($refa == $refb) ? "Successful!\n" : "Failed!\n";
500 500
 	printf("%s INFO - Testing UTC/Local conversions [2/6]...",
501 501
 				date("Y-m-d H:i:s"));
502 502
 	$refa = $spotnab->local2utc();
503 503
 	$refb = $spotnab->local2utc($spotnab->utc2local($refa));
504
-	echo ($refa == $refb)?"Successful!\n":"Failed!\n";
504
+	echo ($refa == $refb) ? "Successful!\n" : "Failed!\n";
505 505
 	printf("%s INFO - Testing UTC/Local conversions [3/6]...",
506 506
 				date("Y-m-d H:i:s"));
507 507
 	$refa = $spotnab->local2utc(date("Y-m-d H:i:s"));
508 508
 	$refb = $spotnab->local2utc($spotnab->utc2local($refa));
509
-	echo ($refa == $refb)?"Successful!\n":"Failed!\n";
509
+	echo ($refa == $refb) ? "Successful!\n" : "Failed!\n";
510 510
 	printf("%s INFO - Testing UTC/Local conversions [4/6]...",
511 511
 				date("Y-m-d H:i:s"));
512 512
 	$refa = $spotnab->utc2local(time());
513 513
 	$refb = $spotnab->utc2local($spotnab->local2utc($refa));
514
-	echo ($refa == $refb)?"Successful!\n":"Failed!\n";
514
+	echo ($refa == $refb) ? "Successful!\n" : "Failed!\n";
515 515
 	printf("%s INFO - Testing UTC/Local conversions [5/6]...",
516 516
 				date("Y-m-d H:i:s"));
517 517
 	$refa = $spotnab->local2utc(time());
518 518
 	$refb = $spotnab->local2utc($spotnab->utc2local($refa));
519
-	echo ($refa == $refb)?"Successful!\n":"Failed!\n";
519
+	echo ($refa == $refb) ? "Successful!\n" : "Failed!\n";
520 520
 	printf("%s INFO - Testing UTC/Local conversions [6/6]...",
521 521
 				date("Y-m-d H:i:s"));
522 522
 	$refa = $spotnab->utc2local(gmdate("Y-m-d H:i:s"));
523 523
 	$refb = $spotnab->utc2local($spotnab->local2utc($refa));
524
-	echo ($refa == $refb)?"Successful!\n":"Failed!\n";
524
+	echo ($refa == $refb) ? "Successful!\n" : "Failed!\n";
525 525
 }
526 526
 
527
-if(array_key_exists("o", $options) ||
528
-	array_key_exists("clean-orphan-comments", $options)){
527
+if (array_key_exists("o", $options) ||
528
+	array_key_exists("clean-orphan-comments", $options)) {
529 529
 	echo "Removing orphan comments...";
530 530
 	$spotnab = new SpotNab();
531 531
 	printf("%d record(s) removed.\n", $spotnab->orphan_comment_clean());
Please login to merge, or discard this patch.