Completed
Push — master ( 1eb6f5...a1a065 )
by Yannick
24:23
created
getImages.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -4,31 +4,31 @@  discard block
 block discarded – undo
4 4
 	$hex = str_replace("#", "", $hex);
5 5
 	$color = array();
6 6
 	if (strlen($hex) == 3) {
7
-	    $color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1));
8
-	    $color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1));
9
-	    $color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1));
7
+		$color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1));
8
+		$color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1));
9
+		$color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1));
10 10
 	} else if (strlen($hex) == 6) {
11
-	    $color['r'] = hexdec(substr($hex, 0, 2));
12
-	    $color['g'] = hexdec(substr($hex, 2, 2));
13
-	    $color['b'] = hexdec(substr($hex, 4, 2));
11
+		$color['r'] = hexdec(substr($hex, 0, 2));
12
+		$color['g'] = hexdec(substr($hex, 2, 2));
13
+		$color['b'] = hexdec(substr($hex, 4, 2));
14 14
 	}
15 15
 	return $color;
16 16
 }
17 17
 
18 18
 
19 19
 if (!isset($_GET['color']) || $_GET['color'] == '' || !preg_match('/^([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?\b/',$_GET['color'])) { 
20
-    exit(0);
20
+	exit(0);
21 21
 }
22 22
 $color = $_GET['color'];
23 23
 if (!isset($_GET['filename']) || !preg_match('/^[a-z0-9-_]+\.png$/', strtolower($_GET['filename']))) {
24
-    echo "Incorrect filename";
25
-    exit(0);
24
+	echo "Incorrect filename";
25
+	exit(0);
26 26
 }
27 27
 $filename = $_GET['filename'];
28 28
 if (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename) && is_readable(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename)) {
29
-    header('Content-type: image/png');
30
-    readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename);
31
-    exit(0);
29
+	header('Content-type: image/png');
30
+	readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename);
31
+	exit(0);
32 32
 }
33 33
 if (isset($_GET['tracker'])) {
34 34
 	$original = dirname(__FILE__).DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'vehicules'.DIRECTORY_SEPARATOR.'color'.DIRECTORY_SEPARATOR.$filename;
@@ -42,66 +42,66 @@  discard block
 block discarded – undo
42 42
 	$original = dirname(__FILE__).DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'aircrafts'.DIRECTORY_SEPARATOR.'new'.DIRECTORY_SEPARATOR.$filename;
43 43
 }
44 44
 if (!file_exists($original)) {
45
-    echo "File not found";
45
+	echo "File not found";
46 46
 }
47 47
 
48 48
 if (extension_loaded('gd') && function_exists('gd_info')) {
49
-    $image = imagecreatefrompng($original);
50
-    $index = imagecolorexact($image,26,49,81);
51
-    if ($index < 0) {
49
+	$image = imagecreatefrompng($original);
50
+	$index = imagecolorexact($image,26,49,81);
51
+	if ($index < 0) {
52 52
 	$index = imagecolorexact($image,25,49,79);
53
-    }
54
-    if ($index < 0) {
53
+	}
54
+	if ($index < 0) {
55 55
 	$index = imagecolorexact($image,0,0,0);
56
-    }
57
-    $c = hexToRGB($color);
58
-    imagecolorset($image,$index,$c['r'],$c['g'],$c['b']);
56
+	}
57
+	$c = hexToRGB($color);
58
+	imagecolorset($image,$index,$c['r'],$c['g'],$c['b']);
59 59
  /*
60 60
     $ig = imagecolorat($image, 0, 0);
61 61
     imagecolortransparent($image, $ig);
62 62
    */
63 63
 
64
-    header('Content-type: image/png');
65
-    if (isset($_GET['resize']) && function_exists('imagecopyresampled')) {
64
+	header('Content-type: image/png');
65
+	if (isset($_GET['resize']) && function_exists('imagecopyresampled')) {
66 66
 	$resize = filter_input(INPUT_GET,'resize',FILTER_SANITIZE_NUMBER_INT);
67 67
 	$newimg = imagecreatetruecolor($resize,$resize);
68
-        imagealphablending($newimg, false);
68
+		imagealphablending($newimg, false);
69 69
 	imagesavealpha($newimg, true);
70 70
 	imagecopyresampled($newimg,$image,0,0,0,0,15,15,imagesx($image),imagesy($image));
71 71
 	if (isset($_GET['heading'])) {
72
-    	    $heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT);
73
-    	    $rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127));
74
-    	    imagealphablending($rotation, false);
75
-	    imagesavealpha($rotation, true);
76
-    	    imagepng($rotation);
77
-    	    imagedestroy($newimg);
78
-    	    imagedestroy($image);
79
-    	    imagedestroy($rotation);
72
+			$heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT);
73
+			$rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127));
74
+			imagealphablending($rotation, false);
75
+		imagesavealpha($rotation, true);
76
+			imagepng($rotation);
77
+			imagedestroy($newimg);
78
+			imagedestroy($image);
79
+			imagedestroy($rotation);
80 80
 	
81 81
 	} else {
82
-    	    imagepng($newimg);
83
-    	    imagedestroy($newimg);
84
-    	    imagedestroy($image);
85
-        }
86
-    } else {
82
+			imagepng($newimg);
83
+			imagedestroy($newimg);
84
+			imagedestroy($image);
85
+		}
86
+	} else {
87 87
 	imagealphablending($image, false);
88
-        imagesavealpha($image, true);
88
+		imagesavealpha($image, true);
89 89
 	imagepng($image);
90 90
 	imagepng($image);
91 91
 	if (is_writable(dirname(__FILE__).'/cache')) {
92
-    	    imagepng($image,dirname(__FILE__).'/cache/'.$color.'-'.$filename);
92
+			imagepng($image,dirname(__FILE__).'/cache/'.$color.'-'.$filename);
93
+	}
94
+		imagedestroy($image);
93 95
 	}
94
-        imagedestroy($image);
95
-    }
96 96
 } else {
97
-    header('Content-type: image/png');
98
-    if (isset($_GET['tracker'])) {
99
-        readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename);
100
-    } elseif (isset($_GET['marine'])) {
101
-        readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename);
102
-    } else {
103
-        if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename);
97
+	header('Content-type: image/png');
98
+	if (isset($_GET['tracker'])) {
99
+		readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename);
100
+	} elseif (isset($_GET['marine'])) {
101
+		readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename);
102
+	} else {
103
+		if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename);
104 104
 	else readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename);
105
-    }
105
+	}
106 106
 }
107 107
 ?>
108 108
\ No newline at end of file
Please login to merge, or discard this patch.
install/populate_all.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,49 +1,49 @@
 block discarded – undo
1 1
 #!/usr/bin/php
2 2
 <?php
3
-    require_once('../require/settings.php');
4
-    if ($globalInstalled) {
5
-        //echo '$globalInstalled must be set to FALSE in require/settings.php';
6
-        echo "Use install/index.php instead. You really don't want to use this.";
7
-        exit;
8
-    }
9
-    require('class.update_db.php');
10
-    echo "Populate all tables...\n";
11
-    update_db::update_all();
12
-    echo "\nInstall waypoints...(VERY slow!)";
13
-    update_db::update_waypoints();
14
-    echo "Done !\n";
15
-    echo "Install airspace...";
16
-    update_db::update_airspace();
17
-    echo "Done !\n";
18
-    echo "Install countries...";
19
-    update_db::update_countries();
20
-    echo "Done !\n";
21
-    if (isset($globalOwner) && $globalOwner) {
3
+	require_once('../require/settings.php');
4
+	if ($globalInstalled) {
5
+		//echo '$globalInstalled must be set to FALSE in require/settings.php';
6
+		echo "Use install/index.php instead. You really don't want to use this.";
7
+		exit;
8
+	}
9
+	require('class.update_db.php');
10
+	echo "Populate all tables...\n";
11
+	update_db::update_all();
12
+	echo "\nInstall waypoints...(VERY slow!)";
13
+	update_db::update_waypoints();
14
+	echo "Done !\n";
15
+	echo "Install airspace...";
16
+	update_db::update_airspace();
17
+	echo "Done !\n";
18
+	echo "Install countries...";
19
+	update_db::update_countries();
20
+	echo "Done !\n";
21
+	if (isset($globalOwner) && $globalOwner) {
22 22
 	echo "Install private owners...";
23 23
 	update_db::update_owner_fam();
24
-        echo "Done !\n";
25
-    }
26
-    /*
24
+		echo "Done !\n";
25
+	}
26
+	/*
27 27
     if (isset($globalIVAO) && $globalIVAO) {
28 28
         echo "Install IVAO airlines and logos...";
29 29
         update_db::update_IVAO();
30 30
 	echo "Done !\n";
31 31
     }
32 32
     */
33
-    if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
33
+	if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
34 34
 	echo "Install NOTAM from notaminfo.com...";
35
-        update_db:update_notam();
36
-        echo "Done !\n";
37
-    }
38
-    if (isset($globalMap3D) && $globalMap3D) {
35
+		update_db:update_notam();
36
+		echo "Done !\n";
37
+	}
38
+	if (isset($globalMap3D) && $globalMap3D) {
39 39
 	echo "Install 3D models...";
40 40
 	update_db::update_models();
41 41
 	echo "Done !\n";
42 42
 	if (isset($globalMapSatellites) && $globalMapSatellites) {
43
-	    echo "Install Space 3D models...";
44
-	    update_db::update_space_models();
45
-	    echo "Done !\n";
46
-        }
47
-    }
43
+		echo "Install Space 3D models...";
44
+		update_db::update_space_models();
45
+		echo "Done !\n";
46
+		}
47
+	}
48 48
 
49 49
 ?>
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
install/install_db.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,31 +1,31 @@
 block discarded – undo
1 1
 #!/usr/bin/php
2 2
 <?php
3
-    require_once('../require/settings.php');
4
-    if ($globalInstalled) {
5
-        //echo '$globalInstalled must be set to FALSE in require/settings.php';
6
-        echo "Use install/index.php instead. You really don't want to use this.";
7
-        exit;
8
-    }
9
-    require('class.create_db.php');
10
-    echo "Create and import all tables...";
11
-    create_db::import_all_db('../db/');
12
-    echo "Done !\n";
3
+	require_once('../require/settings.php');
4
+	if ($globalInstalled) {
5
+		//echo '$globalInstalled must be set to FALSE in require/settings.php';
6
+		echo "Use install/index.php instead. You really don't want to use this.";
7
+		exit;
8
+	}
9
+	require('class.create_db.php');
10
+	echo "Create and import all tables...";
11
+	create_db::import_all_db('../db/');
12
+	echo "Done !\n";
13 13
 
14
-    require('class.update_db.php');
15
-    echo "Populate all tables...\n";
16
-    update_db::update_all();
17
-    echo "\nInstall waypoints...(VERY slow!)";
18
-    update_db::update_waypoints();
19
-    echo "Done !\n";
20
-    echo "Install airspace...";
21
-    update_db::update_airspace();
22
-    echo "Done !\n";
23
-    echo 'All is now installed ! Thanks'."\n";
24
-    if ($globalSBS1) {
25
-            echo 'You need to run cron-sbs.php as a daemon. You can use init script in the install/init directory.'."\n";
26
-    }
27
-    if ($globalACARS) {
28
-            echo 'You need to run cron-acars.php as a daemon. You can use init script in the install/init directory.'."\n";
29
-    }
14
+	require('class.update_db.php');
15
+	echo "Populate all tables...\n";
16
+	update_db::update_all();
17
+	echo "\nInstall waypoints...(VERY slow!)";
18
+	update_db::update_waypoints();
19
+	echo "Done !\n";
20
+	echo "Install airspace...";
21
+	update_db::update_airspace();
22
+	echo "Done !\n";
23
+	echo 'All is now installed ! Thanks'."\n";
24
+	if ($globalSBS1) {
25
+			echo 'You need to run cron-sbs.php as a daemon. You can use init script in the install/init directory.'."\n";
26
+	}
27
+	if ($globalACARS) {
28
+			echo 'You need to run cron-acars.php as a daemon. You can use init script in the install/init directory.'."\n";
29
+	}
30 30
     
31 31
 ?>
32 32
\ No newline at end of file
Please login to merge, or discard this patch.