@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
11 | -$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
12 | -$spotter_array = $Spotter->getSpotterDataByIdent($ident,"0,1", $sort); |
|
10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
11 | +$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
12 | +$spotter_array = $Spotter->getSpotterDataByIdent($ident, "0,1", $sort); |
|
13 | 13 | |
14 | 14 | if (!empty($spotter_array)) |
15 | 15 | { |
16 | - $title = sprintf(_("Most Common Airlines of %s"),$spotter_array[0]['ident']); |
|
16 | + $title = sprintf(_("Most Common Airlines of %s"), $spotter_array[0]['ident']); |
|
17 | 17 | require_once('header.php'); |
18 | 18 | print '<div class="info column">'; |
19 | 19 | print '<h1>'.$spotter_array[0]['ident'].'</h1>'; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | include('ident-sub-menu.php'); |
25 | 25 | print '<div class="column">'; |
26 | 26 | print '<h2>'._("Most Common Airlines").'</h2>'; |
27 | - print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights using the ident/callsign <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
27 | + print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights using the ident/callsign <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
28 | 28 | |
29 | 29 | $airline_array = $Spotter->countAllAirlinesByIdent($ident); |
30 | 30 | if (!empty($airline_array)) |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | print '</thead>'; |
42 | 42 | print '<tbody>'; |
43 | 43 | $i = 1; |
44 | - foreach($airline_array as $airline_item) |
|
44 | + foreach ($airline_array as $airline_item) |
|
45 | 45 | { |
46 | 46 | print '<tr>'; |
47 | 47 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -8,24 +8,24 @@ discard block |
||
8 | 8 | * @param string $filename |
9 | 9 | */ |
10 | 10 | public static function import_file($filename) { |
11 | - $filename = filter_var($filename,FILTER_SANITIZE_STRING); |
|
11 | + $filename = filter_var($filename, FILTER_SANITIZE_STRING); |
|
12 | 12 | $Connection = new Connection(); |
13 | 13 | //Connection::$db->beginTransaction(); |
14 | 14 | $templine = ''; |
15 | - $handle = @fopen($filename,"r"); |
|
15 | + $handle = @fopen($filename, "r"); |
|
16 | 16 | if ($handle) { |
17 | 17 | //$lines = file($filename); |
18 | 18 | //foreach ($lines as $line) |
19 | - while (($line = fgets($handle,4096)) !== false) |
|
19 | + while (($line = fgets($handle, 4096)) !== false) |
|
20 | 20 | { |
21 | - if (substr($line,0,2) == '--' || $line == '') continue; |
|
21 | + if (substr($line, 0, 2) == '--' || $line == '') continue; |
|
22 | 22 | $templine .= $line; |
23 | - if (substr(trim($line), -1,1) == ';') |
|
23 | + if (substr(trim($line), -1, 1) == ';') |
|
24 | 24 | { |
25 | 25 | try { |
26 | 26 | $sth = $Connection->db->prepare($templine); |
27 | 27 | $sth->execute(); |
28 | - } catch(PDOException $e) { |
|
28 | + } catch (PDOException $e) { |
|
29 | 29 | return "error (import ".$filename.") : ".$e->getMessage()."\n"; |
30 | 30 | } |
31 | 31 | $templine = ''; |
@@ -42,27 +42,27 @@ discard block |
||
42 | 42 | $error = ''; |
43 | 43 | $dh = opendir($directory); |
44 | 44 | //foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $filename) |
45 | - while(false !== ($filename = readdir($dh))) |
|
45 | + while (false !== ($filename = readdir($dh))) |
|
46 | 46 | { |
47 | - if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename); |
|
47 | + if (preg_match('/\.sql$/', $filename)) $error .= create_db::import_file($directory.$filename); |
|
48 | 48 | } |
49 | 49 | return $error; |
50 | 50 | } |
51 | 51 | |
52 | - public static function create_database($root,$root_pass,$user,$pass,$db,$db_type,$host) { |
|
53 | - $root = filter_var($root,FILTER_SANITIZE_STRING); |
|
54 | - $root_pass = filter_var($root_pass,FILTER_SANITIZE_STRING); |
|
55 | - $user = filter_var($user,FILTER_SANITIZE_STRING); |
|
56 | - $password = filter_var($pass,FILTER_SANITIZE_STRING); |
|
57 | - $db = filter_var($db,FILTER_SANITIZE_STRING); |
|
58 | - $db_type = filter_var($db_type,FILTER_SANITIZE_STRING); |
|
59 | - $host = filter_var($host,FILTER_SANITIZE_STRING); |
|
52 | + public static function create_database($root, $root_pass, $user, $pass, $db, $db_type, $host) { |
|
53 | + $root = filter_var($root, FILTER_SANITIZE_STRING); |
|
54 | + $root_pass = filter_var($root_pass, FILTER_SANITIZE_STRING); |
|
55 | + $user = filter_var($user, FILTER_SANITIZE_STRING); |
|
56 | + $password = filter_var($pass, FILTER_SANITIZE_STRING); |
|
57 | + $db = filter_var($db, FILTER_SANITIZE_STRING); |
|
58 | + $db_type = filter_var($db_type, FILTER_SANITIZE_STRING); |
|
59 | + $host = filter_var($host, FILTER_SANITIZE_STRING); |
|
60 | 60 | // Dirty hack |
61 | 61 | if ($host != 'localhost' && $host != '127.0.0.1') { |
62 | 62 | $grantright = $_SERVER['SERVER_ADDR']; |
63 | 63 | } else $grantright = 'localhost'; |
64 | 64 | try { |
65 | - $dbh = new PDO($db_type.':host='.$host,$root,$root_pass); |
|
65 | + $dbh = new PDO($db_type.':host='.$host, $root, $root_pass); |
|
66 | 66 | $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
67 | 67 | if ($db_type == 'mysql') { |
68 | 68 | $dbh->exec('CREATE DATABASE IF NOT EXISTS `'.$db.'`;GRANT ALL ON `'.$db."`.* TO '".$user."'@'".$grantright."' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;"); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $dbh->exec("CREATE USER ".$user." WITH PASSWORD '".$password."'; |
73 | 73 | GRANT ALL PRIVILEGES ON DATABASE ".$db." TO ".$user.";"); |
74 | 74 | } |
75 | - } catch(PDOException $e) { |
|
75 | + } catch (PDOException $e) { |
|
76 | 76 | $dbh = null; |
77 | 77 | return "error : ".$e->getMessage(); |
78 | 78 | } |