@@ -3,25 +3,25 @@ |
||
| 3 | 3 | require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'bootstrap.php'); |
| 4 | 4 | |
| 5 | 5 | use nntmux\db\DB; |
| 6 | -$res=""; |
|
| 6 | +$res = ""; |
|
| 7 | 7 | |
| 8 | 8 | $db = new DB(); |
| 9 | -$res = $db->queryOneRow( sprintf("Select now()")); |
|
| 10 | -foreach($res as $time){ |
|
| 11 | -echo "Mysql Time Is Now ".$time."\n";} |
|
| 12 | -$res=""; |
|
| 9 | +$res = $db->queryOneRow(sprintf("Select now()")); |
|
| 10 | +foreach ($res as $time) { |
|
| 11 | +echo "Mysql Time Is Now " . $time . "\n"; } |
|
| 12 | +$res = ""; |
|
| 13 | 13 | $res = date('r'); |
| 14 | -echo "PHP Time Is Now ".$res."\n"; |
|
| 15 | -$res=""; |
|
| 14 | +echo "PHP Time Is Now " . $res . "\n"; |
|
| 15 | +$res = ""; |
|
| 16 | 16 | |
| 17 | 17 | if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') |
| 18 | 18 | { |
| 19 | 19 | exec("time /t", $res); |
| 20 | - echo "System Time is Now ".$res['0']."\n"; |
|
| 20 | + echo "System Time is Now " . $res['0'] . "\n"; |
|
| 21 | 21 | } |
| 22 | 22 | else |
| 23 | 23 | { |
| 24 | 24 | exec("date", $res); |
| 25 | - echo "System Time is Now ".$res['0']."\n"; |
|
| 25 | + echo "System Time is Now " . $res['0'] . "\n"; |
|
| 26 | 26 | } |
| 27 | 27 | |
@@ -9,19 +9,19 @@ discard block |
||
| 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 |
||
| 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 |
@@ -12,6 +12,6 @@ |
||
| 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()); |
@@ -33,25 +33,25 @@ |
||
| 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); |
|
@@ -24,7 +24,7 @@ |
||
| 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 === '') { |
@@ -74,7 +74,7 @@ |
||
| 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; |
@@ -31,11 +31,11 @@ |
||
| 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"; |
|
@@ -8,7 +8,7 @@ |
||
| 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 | |
@@ -21,7 +21,7 @@ |
||
| 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 | { |