@@ -22,14 +22,14 @@ discard block |
||
| 22 | 22 | if ($this->db === null) die('Error: No DB connection. (Image)'); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Gets the images based on the aircraft registration |
|
| 27 | - * |
|
| 28 | - * @param $registration |
|
| 29 | - * @param string $aircraft_icao |
|
| 30 | - * @param string $airline_icao |
|
| 31 | - * @return array the images list |
|
| 32 | - */ |
|
| 25 | + /** |
|
| 26 | + * Gets the images based on the aircraft registration |
|
| 27 | + * |
|
| 28 | + * @param $registration |
|
| 29 | + * @param string $aircraft_icao |
|
| 30 | + * @param string $airline_icao |
|
| 31 | + * @return array the images list |
|
| 32 | + */ |
|
| 33 | 33 | public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
| 34 | 34 | { |
| 35 | 35 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -49,15 +49,15 @@ discard block |
||
| 49 | 49 | else return array(); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Gets the images based on the ship name |
|
| 54 | - * |
|
| 55 | - * @param $mmsi |
|
| 56 | - * @param string $imo |
|
| 57 | - * @param string $name |
|
| 58 | - * @param string $type_name |
|
| 59 | - * @return array the images list |
|
| 60 | - */ |
|
| 52 | + /** |
|
| 53 | + * Gets the images based on the ship name |
|
| 54 | + * |
|
| 55 | + * @param $mmsi |
|
| 56 | + * @param string $imo |
|
| 57 | + * @param string $name |
|
| 58 | + * @param string $type_name |
|
| 59 | + * @return array the images list |
|
| 60 | + */ |
|
| 61 | 61 | public function getMarineImage($mmsi,$imo = '',$name = '',$type_name = '') |
| 62 | 62 | { |
| 63 | 63 | global $globalMarineImagePics; |
@@ -94,12 +94,12 @@ discard block |
||
| 94 | 94 | return $result; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Gets the image copyright based on the Exif data |
|
| 99 | - * |
|
| 100 | - * @param $url |
|
| 101 | - * @return String image copyright |
|
| 102 | - */ |
|
| 97 | + /** |
|
| 98 | + * Gets the image copyright based on the Exif data |
|
| 99 | + * |
|
| 100 | + * @param $url |
|
| 101 | + * @return String image copyright |
|
| 102 | + */ |
|
| 103 | 103 | public function getExifCopyright($url) { |
| 104 | 104 | $exif = exif_read_data($url); |
| 105 | 105 | $copyright = ''; |
@@ -113,14 +113,14 @@ discard block |
||
| 113 | 113 | return $copyright; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - /** |
|
| 117 | - * Adds the images based on the aircraft registration |
|
| 118 | - * |
|
| 119 | - * @param $registration |
|
| 120 | - * @param string $aircraft_icao |
|
| 121 | - * @param string $airline_icao |
|
| 122 | - * @return String either success or error |
|
| 123 | - */ |
|
| 116 | + /** |
|
| 117 | + * Adds the images based on the aircraft registration |
|
| 118 | + * |
|
| 119 | + * @param $registration |
|
| 120 | + * @param string $aircraft_icao |
|
| 121 | + * @param string $airline_icao |
|
| 122 | + * @return String either success or error |
|
| 123 | + */ |
|
| 124 | 124 | public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
| 125 | 125 | { |
| 126 | 126 | global $globalDebug,$globalAircraftImageFetch, $globalOffline; |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | return "success"; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - /** |
|
| 151 | - * Adds the images based on the marine name |
|
| 152 | - * |
|
| 153 | - * @param $mmsi |
|
| 154 | - * @param string $imo |
|
| 155 | - * @param string $name |
|
| 156 | - * @return String either success or error |
|
| 157 | - */ |
|
| 150 | + /** |
|
| 151 | + * Adds the images based on the marine name |
|
| 152 | + * |
|
| 153 | + * @param $mmsi |
|
| 154 | + * @param string $imo |
|
| 155 | + * @param string $name |
|
| 156 | + * @return String either success or error |
|
| 157 | + */ |
|
| 158 | 158 | public function addMarineImage($mmsi,$imo = '',$name = '') |
| 159 | 159 | { |
| 160 | 160 | global $globalDebug,$globalMarineImageFetch, $globalOffline; |
@@ -190,14 +190,14 @@ discard block |
||
| 190 | 190 | return "success"; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - /** |
|
| 194 | - * Gets the aircraft image |
|
| 195 | - * |
|
| 196 | - * @param String $aircraft_registration the registration of the aircraft |
|
| 197 | - * @param string $aircraft_icao |
|
| 198 | - * @param string $airline_icao |
|
| 199 | - * @return array the aircraft thumbnail, orignal url and copyright |
|
| 200 | - */ |
|
| 193 | + /** |
|
| 194 | + * Gets the aircraft image |
|
| 195 | + * |
|
| 196 | + * @param String $aircraft_registration the registration of the aircraft |
|
| 197 | + * @param string $aircraft_icao |
|
| 198 | + * @param string $airline_icao |
|
| 199 | + * @return array the aircraft thumbnail, orignal url and copyright |
|
| 200 | + */ |
|
| 201 | 201 | public function findAircraftImage($aircraft_registration, $aircraft_icao = '', $airline_icao = '') |
| 202 | 202 | { |
| 203 | 203 | global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO, $globalVA; |
@@ -241,14 +241,14 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | - * Gets the vessel image |
|
| 245 | - * |
|
| 246 | - * @param String $mmsi the vessel mmsi |
|
| 247 | - * @param String $imo the vessel imo |
|
| 248 | - * @param String $name the vessel name |
|
| 249 | - * @return array the aircraft thumbnail, orignal url and copyright |
|
| 250 | - * |
|
| 251 | - */ |
|
| 244 | + * Gets the vessel image |
|
| 245 | + * |
|
| 246 | + * @param String $mmsi the vessel mmsi |
|
| 247 | + * @param String $imo the vessel imo |
|
| 248 | + * @param String $name the vessel name |
|
| 249 | + * @return array the aircraft thumbnail, orignal url and copyright |
|
| 250 | + * |
|
| 251 | + */ |
|
| 252 | 252 | public function findMarineImage($mmsi,$imo = '',$name = '') |
| 253 | 253 | { |
| 254 | 254 | global $globalMarineImageSources; |
@@ -282,13 +282,13 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /** |
| 285 | - * Gets the aircraft image from Planespotters |
|
| 286 | - * |
|
| 287 | - * @param String $aircraft_registration the registration of the aircraft |
|
| 288 | - * @param String $aircraft_name type of the aircraft |
|
| 289 | - * @return array the aircraft thumbnail, orignal url and copyright |
|
| 290 | - * |
|
| 291 | - */ |
|
| 285 | + * Gets the aircraft image from Planespotters |
|
| 286 | + * |
|
| 287 | + * @param String $aircraft_registration the registration of the aircraft |
|
| 288 | + * @param String $aircraft_name type of the aircraft |
|
| 289 | + * @return array the aircraft thumbnail, orignal url and copyright |
|
| 290 | + * |
|
| 291 | + */ |
|
| 292 | 292 | public function fromPlanespotters($type,$aircraft_registration, $aircraft_name='') { |
| 293 | 293 | $Common = new Common(); |
| 294 | 294 | // If aircraft registration is only number, also check with aircraft model |
@@ -315,14 +315,14 @@ discard block |
||
| 315 | 315 | return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - /** |
|
| 319 | - * Gets the aircraft image from Deviantart |
|
| 320 | - * |
|
| 321 | - * @param $type |
|
| 322 | - * @param String $registration the registration of the aircraft |
|
| 323 | - * @param String $name type of the aircraft |
|
| 324 | - * @return array the aircraft thumbnail, orignal url and copyright |
|
| 325 | - */ |
|
| 318 | + /** |
|
| 319 | + * Gets the aircraft image from Deviantart |
|
| 320 | + * |
|
| 321 | + * @param $type |
|
| 322 | + * @param String $registration the registration of the aircraft |
|
| 323 | + * @param String $name type of the aircraft |
|
| 324 | + * @return array the aircraft thumbnail, orignal url and copyright |
|
| 325 | + */ |
|
| 326 | 326 | public function fromDeviantart($type,$registration, $name='') { |
| 327 | 327 | $Common = new Common(); |
| 328 | 328 | if ($type == 'aircraft') { |
@@ -356,13 +356,13 @@ discard block |
||
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
| 359 | - * Gets the aircraft image from JetPhotos |
|
| 360 | - * |
|
| 361 | - * @param String $aircraft_registration the registration of the aircraft |
|
| 362 | - * @param String $aircraft_name type of the aircraft |
|
| 363 | - * @return array the aircraft thumbnail, orignal url and copyright |
|
| 364 | - * |
|
| 365 | - */ |
|
| 359 | + * Gets the aircraft image from JetPhotos |
|
| 360 | + * |
|
| 361 | + * @param String $aircraft_registration the registration of the aircraft |
|
| 362 | + * @param String $aircraft_name type of the aircraft |
|
| 363 | + * @return array the aircraft thumbnail, orignal url and copyright |
|
| 364 | + * |
|
| 365 | + */ |
|
| 366 | 366 | public function fromJetPhotos($type,$aircraft_registration, $aircraft_name='') { |
| 367 | 367 | $Common = new Common(); |
| 368 | 368 | $url= 'https://www.jetphotos.com/photo/keyword/'.$aircraft_registration; |
@@ -370,21 +370,21 @@ discard block |
||
| 370 | 370 | $dom = new DOMDocument(); |
| 371 | 371 | @$dom->loadHTML($data); |
| 372 | 372 | $all_pics = array(); |
| 373 | - foreach($dom->getElementsByTagName('img') as $image) { |
|
| 374 | - $all_pics[] = $image->getAttribute('src'); |
|
| 375 | - } |
|
| 373 | + foreach($dom->getElementsByTagName('img') as $image) { |
|
| 374 | + $all_pics[] = $image->getAttribute('src'); |
|
| 375 | + } |
|
| 376 | 376 | $all_authors = array(); |
| 377 | - foreach($dom->getElementsByTagName('span') as $author) { |
|
| 378 | - if (strpos($author->nodeValue, "By: ") !== false) { |
|
| 379 | - $all_authors[] = $author->nodeValue; |
|
| 380 | - } |
|
| 381 | - } |
|
| 377 | + foreach($dom->getElementsByTagName('span') as $author) { |
|
| 378 | + if (strpos($author->nodeValue, "By: ") !== false) { |
|
| 379 | + $all_authors[] = $author->nodeValue; |
|
| 380 | + } |
|
| 381 | + } |
|
| 382 | 382 | $all_ref = array(); |
| 383 | - foreach($dom->getElementsByTagName('a') as $link) { |
|
| 384 | - if (strpos($link->getAttribute('href'), "/photo/") !== false) { |
|
| 385 | - $all_ref[] = $link->getAttribute('href'); |
|
| 386 | - } |
|
| 387 | - } |
|
| 383 | + foreach($dom->getElementsByTagName('a') as $link) { |
|
| 384 | + if (strpos($link->getAttribute('href'), "/photo/") !== false) { |
|
| 385 | + $all_ref[] = $link->getAttribute('href'); |
|
| 386 | + } |
|
| 387 | + } |
|
| 388 | 388 | if (isset($all_pics[8])) { |
| 389 | 389 | $image_url = array(); |
| 390 | 390 | $image_url['thumbnail'] = 'http:'.$all_pics[3]; |
@@ -398,13 +398,13 @@ discard block |
||
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | /** |
| 401 | - * Gets the aircraft image from PlanePictures |
|
| 402 | - * |
|
| 403 | - * @param String $aircraft_registration the registration of the aircraft |
|
| 404 | - * @param String $aircraft_name type of the aircraft |
|
| 405 | - * @return array the aircraft thumbnail, orignal url and copyright |
|
| 406 | - * |
|
| 407 | - */ |
|
| 401 | + * Gets the aircraft image from PlanePictures |
|
| 402 | + * |
|
| 403 | + * @param String $aircraft_registration the registration of the aircraft |
|
| 404 | + * @param String $aircraft_name type of the aircraft |
|
| 405 | + * @return array the aircraft thumbnail, orignal url and copyright |
|
| 406 | + * |
|
| 407 | + */ |
|
| 408 | 408 | public function fromPlanePictures($type,$aircraft_registration, $aircraft_name='') { |
| 409 | 409 | $Common = new Common(); |
| 410 | 410 | $url= 'https://www.planepictures.net/v3/search_en.php?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
@@ -432,13 +432,13 @@ discard block |
||
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | /** |
| 435 | - * Gets the aircraft image from Flickr |
|
| 436 | - * |
|
| 437 | - * @param String $registration the registration of the aircraft |
|
| 438 | - * @param String $name type of the aircraft |
|
| 439 | - * @return array the aircraft thumbnail, orignal url and copyright |
|
| 440 | - * |
|
| 441 | - */ |
|
| 435 | + * Gets the aircraft image from Flickr |
|
| 436 | + * |
|
| 437 | + * @param String $registration the registration of the aircraft |
|
| 438 | + * @param String $name type of the aircraft |
|
| 439 | + * @return array the aircraft thumbnail, orignal url and copyright |
|
| 440 | + * |
|
| 441 | + */ |
|
| 442 | 442 | public function fromFlickr($type,$registration,$name='') { |
| 443 | 443 | $Common = new Common(); |
| 444 | 444 | if ($type == 'aircraft') { |
@@ -465,13 +465,13 @@ discard block |
||
| 465 | 465 | return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | - /** |
|
| 469 | - * @param $type |
|
| 470 | - * @param $aircraft_icao |
|
| 471 | - * @param $airline_icao |
|
| 472 | - * @return array |
|
| 473 | - */ |
|
| 474 | - public function fromIvaoMtl($type, $aircraft_icao, $airline_icao) { |
|
| 468 | + /** |
|
| 469 | + * @param $type |
|
| 470 | + * @param $aircraft_icao |
|
| 471 | + * @param $airline_icao |
|
| 472 | + * @return array |
|
| 473 | + */ |
|
| 474 | + public function fromIvaoMtl($type, $aircraft_icao, $airline_icao) { |
|
| 475 | 475 | $Common = new Common(); |
| 476 | 476 | //echo "\n".'SEARCH IMAGE : http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg'; |
| 477 | 477 | if ($Common->urlexist('http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg')) { |
@@ -487,14 +487,14 @@ discard block |
||
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | - /** |
|
| 491 | - * Gets the aircraft image from Bing |
|
| 492 | - * |
|
| 493 | - * @param $type |
|
| 494 | - * @param String $aircraft_registration the registration of the aircraft |
|
| 495 | - * @param String $aircraft_name type of the aircraft |
|
| 496 | - * @return array the aircraft thumbnail, orignal url and copyright |
|
| 497 | - */ |
|
| 490 | + /** |
|
| 491 | + * Gets the aircraft image from Bing |
|
| 492 | + * |
|
| 493 | + * @param $type |
|
| 494 | + * @param String $aircraft_registration the registration of the aircraft |
|
| 495 | + * @param String $aircraft_name type of the aircraft |
|
| 496 | + * @return array the aircraft thumbnail, orignal url and copyright |
|
| 497 | + */ |
|
| 498 | 498 | public function fromBing($type,$aircraft_registration,$aircraft_name='') { |
| 499 | 499 | global $globalImageBingKey; |
| 500 | 500 | $Common = new Common(); |
@@ -525,14 +525,14 @@ discard block |
||
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | /** |
| 528 | - * Gets the aircraft image from airport-data |
|
| 529 | - * |
|
| 530 | - * @param String $aircraft_registration the registration of the aircraft |
|
| 531 | - * @param String $aircraft_icao the icao code of the aircraft |
|
| 532 | - * @param String $aircraft_name type of the aircraft |
|
| 533 | - * @return array the aircraft thumbnail, orignal url and copyright |
|
| 534 | - * |
|
| 535 | - */ |
|
| 528 | + * Gets the aircraft image from airport-data |
|
| 529 | + * |
|
| 530 | + * @param String $aircraft_registration the registration of the aircraft |
|
| 531 | + * @param String $aircraft_icao the icao code of the aircraft |
|
| 532 | + * @param String $aircraft_name type of the aircraft |
|
| 533 | + * @return array the aircraft thumbnail, orignal url and copyright |
|
| 534 | + * |
|
| 535 | + */ |
|
| 536 | 536 | public function fromAirportData($type,$aircraft_registration,$aircraft_icao,$aircraft_name='') { |
| 537 | 537 | $Common = new Common(); |
| 538 | 538 | $url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration.'&m='.$aircraft_icao; |
@@ -551,13 +551,13 @@ discard block |
||
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | /** |
| 554 | - * Gets image from WikiMedia |
|
| 555 | - * |
|
| 556 | - * @param String $registration the registration of the aircraft/mmsi |
|
| 557 | - * @param String $name name |
|
| 558 | - * @return array the aircraft thumbnail, orignal url and copyright |
|
| 559 | - * |
|
| 560 | - */ |
|
| 554 | + * Gets image from WikiMedia |
|
| 555 | + * |
|
| 556 | + * @param String $registration the registration of the aircraft/mmsi |
|
| 557 | + * @param String $name name |
|
| 558 | + * @return array the aircraft thumbnail, orignal url and copyright |
|
| 559 | + * |
|
| 560 | + */ |
|
| 561 | 561 | public function fromWikimedia($type,$registration,$name='') { |
| 562 | 562 | $Common = new Common(); |
| 563 | 563 | if ($type == 'aircraft') { |
@@ -612,13 +612,13 @@ discard block |
||
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | /** |
| 615 | - * Gets the aircraft image from custom url |
|
| 616 | - * |
|
| 617 | - * @param String $registration the registration of the aircraft |
|
| 618 | - * @param String $name type of the aircraft |
|
| 619 | - * @return array the aircraft thumbnail, orignal url and copyright |
|
| 620 | - * |
|
| 621 | - */ |
|
| 615 | + * Gets the aircraft image from custom url |
|
| 616 | + * |
|
| 617 | + * @param String $registration the registration of the aircraft |
|
| 618 | + * @param String $name type of the aircraft |
|
| 619 | + * @return array the aircraft thumbnail, orignal url and copyright |
|
| 620 | + * |
|
| 621 | + */ |
|
| 622 | 622 | public function fromCustomSource($type,$registration,$name='') { |
| 623 | 623 | global $globalAircraftImageCustomSources, $globalMarineImageCustomSources, $globalDebug; |
| 624 | 624 | //$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true); |
@@ -30,22 +30,22 @@ discard block |
||
| 30 | 30 | * @param string $airline_icao |
| 31 | 31 | * @return array the images list |
| 32 | 32 | */ |
| 33 | - public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
|
| 33 | + public function getSpotterImage($registration, $aircraft_icao = '', $airline_icao = '') |
|
| 34 | 34 | { |
| 35 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 36 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 37 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 35 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 36 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 37 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 38 | 38 | $reg = $registration; |
| 39 | 39 | if (($reg == '' || $reg == 'NA') && $aircraft_icao != '') $reg = $aircraft_icao.$airline_icao; |
| 40 | 40 | $reg = trim($reg); |
| 41 | - $query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration |
|
| 41 | + $query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration |
|
| 42 | 42 | FROM spotter_image |
| 43 | 43 | WHERE spotter_image.registration = :registration LIMIT 1"; |
| 44 | 44 | $sth = $this->db->prepare($query); |
| 45 | 45 | $sth->execute(array(':registration' => $reg)); |
| 46 | 46 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 47 | 47 | if (!empty($result)) return $result; |
| 48 | - elseif ($registration != '' && ($aircraft_icao != '' || $airline_icao != '')) return $this->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 48 | + elseif ($registration != '' && ($aircraft_icao != '' || $airline_icao != '')) return $this->getSpotterImage('', $aircraft_icao, $airline_icao); |
|
| 49 | 49 | else return array(); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -58,34 +58,34 @@ discard block |
||
| 58 | 58 | * @param string $type_name |
| 59 | 59 | * @return array the images list |
| 60 | 60 | */ |
| 61 | - public function getMarineImage($mmsi,$imo = '',$name = '',$type_name = '') |
|
| 61 | + public function getMarineImage($mmsi, $imo = '', $name = '', $type_name = '') |
|
| 62 | 62 | { |
| 63 | 63 | global $globalMarineImagePics; |
| 64 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
| 65 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
| 66 | - $name = filter_var($name,FILTER_SANITIZE_STRING); |
|
| 67 | - $type_name = str_replace(''',"'",filter_var($type_name,FILTER_SANITIZE_STRING)); |
|
| 64 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
| 65 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
| 66 | + $name = filter_var($name, FILTER_SANITIZE_STRING); |
|
| 67 | + $type_name = str_replace(''', "'", filter_var($type_name, FILTER_SANITIZE_STRING)); |
|
| 68 | 68 | if (isset($globalMarineImagePics) && !empty($globalMarineImagePics)) { |
| 69 | 69 | if ($type_name != '' && isset($globalMarineImagePics['type'][$type_name])) { |
| 70 | 70 | if (!isset($globalMarineImagePics['type'][$type_name]['image_thumbnail'])) { |
| 71 | 71 | $globalMarineImagePics['type'][$type_name]['image_thumbnail'] = $globalMarineImagePics['type'][$type_name]['image']; |
| 72 | 72 | } |
| 73 | - return array($globalMarineImagePics['type'][$type_name]+array('image_thumbnail' => '','image' => '', 'image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 73 | + return array($globalMarineImagePics['type'][$type_name] + array('image_thumbnail' => '', 'image' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | $name = trim($name); |
| 77 | 77 | if ($mmsi == '' && $imo == '' && $name == '') return array(); |
| 78 | - $query = "SELECT marine_image.image, marine_image.image_thumbnail, marine_image.image_source, marine_image.image_source_website,marine_image.image_copyright, marine_image.mmsi, marine_image.imo, marine_image.name |
|
| 78 | + $query = "SELECT marine_image.image, marine_image.image_thumbnail, marine_image.image_source, marine_image.image_source_website,marine_image.image_copyright, marine_image.mmsi, marine_image.imo, marine_image.name |
|
| 79 | 79 | FROM marine_image |
| 80 | 80 | WHERE marine_image.mmsi = :mmsi"; |
| 81 | 81 | $query_data = array(':mmsi' => $mmsi); |
| 82 | 82 | if ($imo != '') { |
| 83 | 83 | $query .= " AND marine_image.imo = :imo"; |
| 84 | - $query_data = array_merge($query_data,array(':imo' => $imo)); |
|
| 84 | + $query_data = array_merge($query_data, array(':imo' => $imo)); |
|
| 85 | 85 | } |
| 86 | 86 | if ($name != '') { |
| 87 | 87 | $query .= " AND marine_image.name = :name"; |
| 88 | - $query_data = array_merge($query_data,array(':name' => $name)); |
|
| 88 | + $query_data = array_merge($query_data, array(':name' => $name)); |
|
| 89 | 89 | } |
| 90 | 90 | $query .= " LIMIT 1"; |
| 91 | 91 | $sth = $this->db->prepare($query); |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright']; |
| 107 | 107 | elseif (isset($exif['copyright'])) $copyright = $exif['copyright']; |
| 108 | 108 | if ($copyright != '') { |
| 109 | - $copyright = str_replace('Copyright ','',$copyright); |
|
| 110 | - $copyright = str_replace('© ','',$copyright); |
|
| 111 | - $copyright = str_replace('(c) ','',$copyright); |
|
| 109 | + $copyright = str_replace('Copyright ', '', $copyright); |
|
| 110 | + $copyright = str_replace('© ', '', $copyright); |
|
| 111 | + $copyright = str_replace('(c) ', '', $copyright); |
|
| 112 | 112 | } |
| 113 | 113 | return $copyright; |
| 114 | 114 | } |
@@ -121,25 +121,25 @@ discard block |
||
| 121 | 121 | * @param string $airline_icao |
| 122 | 122 | * @return String either success or error |
| 123 | 123 | */ |
| 124 | - public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
|
| 124 | + public function addSpotterImage($registration, $aircraft_icao = '', $airline_icao = '') |
|
| 125 | 125 | { |
| 126 | - global $globalDebug,$globalAircraftImageFetch, $globalOffline; |
|
| 126 | + global $globalDebug, $globalAircraftImageFetch, $globalOffline; |
|
| 127 | 127 | if ((isset($globalAircraftImageFetch) && $globalAircraftImageFetch === FALSE) || (isset($globalOffline) && $globalOffline === TRUE)) return ''; |
| 128 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 128 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 129 | 129 | $registration = trim($registration); |
| 130 | 130 | //getting the aircraft image |
| 131 | 131 | if ($globalDebug && $registration != '') echo 'Try to find an aircraft image for '.$registration.'...'; |
| 132 | 132 | elseif ($globalDebug && $aircraft_icao != '') echo 'Try to find an aircraft image for '.$aircraft_icao.'...'; |
| 133 | 133 | elseif ($globalDebug && $airline_icao != '') echo 'Try to find an aircraft image for '.$airline_icao.'...'; |
| 134 | - $image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao); |
|
| 134 | + $image_url = $this->findAircraftImage($registration, $aircraft_icao, $airline_icao); |
|
| 135 | 135 | if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao; |
| 136 | 136 | if ($image_url['original'] != '') { |
| 137 | 137 | if ($globalDebug) echo 'Found !'."\n"; |
| 138 | - $query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
| 138 | + $query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
| 139 | 139 | try { |
| 140 | 140 | $sth = $this->db->prepare($query); |
| 141 | - $sth->execute(array(':registration' => $registration,':image' => $image_url['original'],':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'],':source' => $image_url['source'],':source_website' => $image_url['source_website'])); |
|
| 142 | - } catch(PDOException $e) { |
|
| 141 | + $sth->execute(array(':registration' => $registration, ':image' => $image_url['original'], ':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'], ':source' => $image_url['source'], ':source_website' => $image_url['source_website'])); |
|
| 142 | + } catch (PDOException $e) { |
|
| 143 | 143 | echo $e->getMessage()."\n"; |
| 144 | 144 | return "error"; |
| 145 | 145 | } |
@@ -155,13 +155,13 @@ discard block |
||
| 155 | 155 | * @param string $name |
| 156 | 156 | * @return String either success or error |
| 157 | 157 | */ |
| 158 | - public function addMarineImage($mmsi,$imo = '',$name = '') |
|
| 158 | + public function addMarineImage($mmsi, $imo = '', $name = '') |
|
| 159 | 159 | { |
| 160 | - global $globalDebug,$globalMarineImageFetch, $globalOffline; |
|
| 160 | + global $globalDebug, $globalMarineImageFetch, $globalOffline; |
|
| 161 | 161 | if ((isset($globalMarineImageFetch) && !$globalMarineImageFetch) || (isset($globalOffline) && $globalOffline === TRUE)) return ''; |
| 162 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
| 163 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
| 164 | - $name = filter_var($name,FILTER_SANITIZE_STRING); |
|
| 162 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
| 163 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
| 164 | + $name = filter_var($name, FILTER_SANITIZE_STRING); |
|
| 165 | 165 | $name = trim($name); |
| 166 | 166 | $Marine = new Marine($this->db); |
| 167 | 167 | if ($imo == '' || $name == '') { |
@@ -175,14 +175,14 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | //getting the aircraft image |
| 177 | 177 | if ($globalDebug && $name != '') echo 'Try to find an vessel image for '.$name.'...'; |
| 178 | - $image_url = $this->findMarineImage($mmsi,$imo,$name); |
|
| 178 | + $image_url = $this->findMarineImage($mmsi, $imo, $name); |
|
| 179 | 179 | if ($image_url['original'] != '') { |
| 180 | 180 | if ($globalDebug) echo 'Found !'."\n"; |
| 181 | - $query = "INSERT INTO marine_image (mmsi,imo,name, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:mmsi,:imo,:name,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
| 181 | + $query = "INSERT INTO marine_image (mmsi,imo,name, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:mmsi,:imo,:name,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
| 182 | 182 | try { |
| 183 | 183 | $sth = $this->db->prepare($query); |
| 184 | - $sth->execute(array(':mmsi' => $mmsi,':imo' => $imo,':name' => $name,':image' => $image_url['original'],':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'],':source' => $image_url['source'],':source_website' => $image_url['source_website'])); |
|
| 185 | - } catch(PDOException $e) { |
|
| 184 | + $sth->execute(array(':mmsi' => $mmsi, ':imo' => $imo, ':name' => $name, ':image' => $image_url['original'], ':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'], ':source' => $image_url['source'], ':source_website' => $image_url['source_website'])); |
|
| 185 | + } catch (PDOException $e) { |
|
| 186 | 186 | echo $e->getMessage()."\n"; |
| 187 | 187 | return "error"; |
| 188 | 188 | } |
@@ -203,9 +203,9 @@ discard block |
||
| 203 | 203 | global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO, $globalVA; |
| 204 | 204 | $Spotter = new Spotter($this->db); |
| 205 | 205 | if (!isset($globalIVAO)) $globalIVAO = FALSE; |
| 206 | - $aircraft_registration = filter_var($aircraft_registration,FILTER_SANITIZE_STRING); |
|
| 206 | + $aircraft_registration = filter_var($aircraft_registration, FILTER_SANITIZE_STRING); |
|
| 207 | 207 | if ($aircraft_registration != '' && $aircraft_registration != 'NA' && (!isset($globalVA) || $globalVA !== TRUE)) { |
| 208 | - if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 208 | + if (strpos($aircraft_registration, '/') !== false) return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 209 | 209 | $aircraft_registration = urlencode(trim($aircraft_registration)); |
| 210 | 210 | $aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration); |
| 211 | 211 | if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name']; |
@@ -219,25 +219,25 @@ discard block |
||
| 219 | 219 | if (isset($aircraft_info[0]['type'])) $aircraft_name = $aircraft_info[0]['type']; |
| 220 | 220 | else $aircraft_name = ''; |
| 221 | 221 | $aircraft_registration = $aircraft_icao; |
| 222 | - } else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
| 222 | + } else return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 223 | 223 | unset($Spotter); |
| 224 | - if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
| 224 | + if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
| 225 | 225 | foreach ($globalAircraftImageSources as $source) { |
| 226 | 226 | $source = strtolower($source); |
| 227 | - if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl('aircraft',$aircraft_icao,$airline_icao); |
|
| 228 | - if ($source == 'planespotters' && !$globalIVAO && extension_loaded('simplexml')) $images_array = $this->fromPlanespotters('aircraft',$aircraft_registration,$aircraft_name); |
|
| 229 | - if ($source == 'flickr' && extension_loaded('simplexml')) $images_array = $this->fromFlickr('aircraft',$aircraft_registration,$aircraft_name); |
|
| 230 | - if ($source == 'bing') $images_array = $this->fromBing('aircraft',$aircraft_registration,$aircraft_name); |
|
| 231 | - if ($source == 'deviantart' && extension_loaded('simplexml')) $images_array = $this->fromDeviantart('aircraft',$aircraft_registration,$aircraft_name); |
|
| 232 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia('aircraft',$aircraft_registration,$aircraft_name); |
|
| 233 | - if ($source == 'jetphotos' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromJetPhotos('aircraft',$aircraft_registration,$aircraft_name); |
|
| 234 | - if ($source == 'planepictures' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromPlanePictures('aircraft',$aircraft_registration,$aircraft_name); |
|
| 235 | - if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_icao,$aircraft_name); |
|
| 236 | - if ($source == 'customsources') $images_array = $this->fromCustomSource('aircraft',$aircraft_registration,$aircraft_name); |
|
| 227 | + if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl('aircraft', $aircraft_icao, $airline_icao); |
|
| 228 | + if ($source == 'planespotters' && !$globalIVAO && extension_loaded('simplexml')) $images_array = $this->fromPlanespotters('aircraft', $aircraft_registration, $aircraft_name); |
|
| 229 | + if ($source == 'flickr' && extension_loaded('simplexml')) $images_array = $this->fromFlickr('aircraft', $aircraft_registration, $aircraft_name); |
|
| 230 | + if ($source == 'bing') $images_array = $this->fromBing('aircraft', $aircraft_registration, $aircraft_name); |
|
| 231 | + if ($source == 'deviantart' && extension_loaded('simplexml')) $images_array = $this->fromDeviantart('aircraft', $aircraft_registration, $aircraft_name); |
|
| 232 | + if ($source == 'wikimedia') $images_array = $this->fromWikimedia('aircraft', $aircraft_registration, $aircraft_name); |
|
| 233 | + if ($source == 'jetphotos' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromJetPhotos('aircraft', $aircraft_registration, $aircraft_name); |
|
| 234 | + if ($source == 'planepictures' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromPlanePictures('aircraft', $aircraft_registration, $aircraft_name); |
|
| 235 | + if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft', $aircraft_registration, $aircraft_icao, $aircraft_name); |
|
| 236 | + if ($source == 'customsources') $images_array = $this->fromCustomSource('aircraft', $aircraft_registration, $aircraft_name); |
|
| 237 | 237 | if (isset($images_array) && $images_array['original'] != '') return $images_array; |
| 238 | 238 | } |
| 239 | 239 | if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) return $this->findAircraftImage($aircraft_icao); |
| 240 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 240 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
@@ -249,14 +249,14 @@ discard block |
||
| 249 | 249 | * @return array the aircraft thumbnail, orignal url and copyright |
| 250 | 250 | * |
| 251 | 251 | */ |
| 252 | - public function findMarineImage($mmsi,$imo = '',$name = '') |
|
| 252 | + public function findMarineImage($mmsi, $imo = '', $name = '') |
|
| 253 | 253 | { |
| 254 | 254 | global $globalMarineImageSources; |
| 255 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
| 255 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
| 256 | 256 | //$imo = filter_var($imo,FILTER_SANITIZE_STRING); |
| 257 | - $name = filter_var($name,FILTER_SANITIZE_STRING); |
|
| 257 | + $name = filter_var($name, FILTER_SANITIZE_STRING); |
|
| 258 | 258 | $name = trim($name); |
| 259 | - if (strlen($name) < 4) return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
| 259 | + if (strlen($name) < 4) return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 260 | 260 | /* |
| 261 | 261 | $Marine = new Marine($this->db); |
| 262 | 262 | if ($imo == '' || $name == '') { |
@@ -268,17 +268,17 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | unset($Marine); |
| 270 | 270 | */ |
| 271 | - if (!isset($globalMarineImageSources)) $globalMarineImageSources = array('wikimedia','deviantart','flickr','bing'); |
|
| 271 | + if (!isset($globalMarineImageSources)) $globalMarineImageSources = array('wikimedia', 'deviantart', 'flickr', 'bing'); |
|
| 272 | 272 | foreach ($globalMarineImageSources as $source) { |
| 273 | 273 | $source = strtolower($source); |
| 274 | - if ($source == 'flickr') $images_array = $this->fromFlickr('marine',$mmsi,$name); |
|
| 275 | - if ($source == 'bing') $images_array = $this->fromBing('marine',$mmsi,$name); |
|
| 276 | - if ($source == 'deviantart') $images_array = $this->fromDeviantart('marine',$mmsi,$name); |
|
| 277 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia('marine',$mmsi,$name); |
|
| 278 | - if ($source == 'customsources') $images_array = $this->fromCustomSource('marine',$mmsi,$name); |
|
| 274 | + if ($source == 'flickr') $images_array = $this->fromFlickr('marine', $mmsi, $name); |
|
| 275 | + if ($source == 'bing') $images_array = $this->fromBing('marine', $mmsi, $name); |
|
| 276 | + if ($source == 'deviantart') $images_array = $this->fromDeviantart('marine', $mmsi, $name); |
|
| 277 | + if ($source == 'wikimedia') $images_array = $this->fromWikimedia('marine', $mmsi, $name); |
|
| 278 | + if ($source == 'customsources') $images_array = $this->fromCustomSource('marine', $mmsi, $name); |
|
| 279 | 279 | if (isset($images_array) && $images_array['original'] != '') return $images_array; |
| 280 | 280 | } |
| 281 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 281 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /** |
@@ -289,30 +289,30 @@ discard block |
||
| 289 | 289 | * @return array the aircraft thumbnail, orignal url and copyright |
| 290 | 290 | * |
| 291 | 291 | */ |
| 292 | - public function fromPlanespotters($type,$aircraft_registration, $aircraft_name='') { |
|
| 292 | + public function fromPlanespotters($type, $aircraft_registration, $aircraft_name = '') { |
|
| 293 | 293 | $Common = new Common(); |
| 294 | 294 | // If aircraft registration is only number, also check with aircraft model |
| 295 | - if (preg_match('/^[[:digit]]+$/',$aircraft_registration) && $aircraft_name != '') { |
|
| 296 | - $url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss'; |
|
| 295 | + if (preg_match('/^[[:digit]]+$/', $aircraft_registration) && $aircraft_name != '') { |
|
| 296 | + $url = 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss'; |
|
| 297 | 297 | } else { |
| 298 | 298 | //$url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$airline_aircraft_type.'&output=rss'; |
| 299 | - $url= 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss'; |
|
| 299 | + $url = 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss'; |
|
| 300 | 300 | } |
| 301 | 301 | $data = $Common->getData($url); |
| 302 | - if (substr($data, 0, 5) != "<?xml") return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 302 | + if (substr($data, 0, 5) != "<?xml") return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 303 | 303 | if ($xml = simplexml_load_string($data)) { |
| 304 | 304 | if (isset($xml->channel->item)) { |
| 305 | 305 | $image_url = array(); |
| 306 | - $thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
| 306 | + $thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
| 307 | 307 | $image_url['thumbnail'] = $thumbnail_url; |
| 308 | - $image_url['original'] = str_replace('thumbnail','original',$thumbnail_url); |
|
| 309 | - $image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright); |
|
| 310 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
| 308 | + $image_url['original'] = str_replace('thumbnail', 'original', $thumbnail_url); |
|
| 309 | + $image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright); |
|
| 310 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
| 311 | 311 | $image_url['source'] = 'planespotters'; |
| 312 | 312 | return $image_url; |
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 315 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | /** |
@@ -323,36 +323,36 @@ discard block |
||
| 323 | 323 | * @param String $name type of the aircraft |
| 324 | 324 | * @return array the aircraft thumbnail, orignal url and copyright |
| 325 | 325 | */ |
| 326 | - public function fromDeviantart($type,$registration, $name='') { |
|
| 326 | + public function fromDeviantart($type, $registration, $name = '') { |
|
| 327 | 327 | $Common = new Common(); |
| 328 | 328 | if ($type == 'aircraft') { |
| 329 | 329 | // If aircraft registration is only number, also check with aircraft model |
| 330 | - if (preg_match('/^[[:digit]]+$/',$registration) && $name != '') { |
|
| 331 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$registration.'%20'.urlencode($name); |
|
| 330 | + if (preg_match('/^[[:digit]]+$/', $registration) && $name != '') { |
|
| 331 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$registration.'%20'.urlencode($name); |
|
| 332 | 332 | } else { |
| 333 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$registration; |
|
| 333 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$registration; |
|
| 334 | 334 | } |
| 335 | 335 | } elseif ($type == 'marine') { |
| 336 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q=ship%20"'.urlencode($name).'"'; |
|
| 336 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q=ship%20"'.urlencode($name).'"'; |
|
| 337 | 337 | } else { |
| 338 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q="'.urlencode($name).'"'; |
|
| 338 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q="'.urlencode($name).'"'; |
|
| 339 | 339 | } |
| 340 | 340 | $data = $Common->getData($url); |
| 341 | - if (substr($data, 0, 5) != "<?xml") return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 341 | + if (substr($data, 0, 5) != "<?xml") return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 342 | 342 | if ($xml = simplexml_load_string($data)) { |
| 343 | 343 | if (isset($xml->channel->item->link)) { |
| 344 | 344 | $image_url = array(); |
| 345 | - $thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
| 345 | + $thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
| 346 | 346 | $image_url['thumbnail'] = $thumbnail_url; |
| 347 | - $original_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url); |
|
| 347 | + $original_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url); |
|
| 348 | 348 | $image_url['original'] = $original_url; |
| 349 | - $image_url['copyright'] = str_replace('Copyright ','',trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright)); |
|
| 350 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
| 349 | + $image_url['copyright'] = str_replace('Copyright ', '', trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright)); |
|
| 350 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
| 351 | 351 | $image_url['source'] = 'deviantart'; |
| 352 | 352 | return $image_url; |
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 355 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
@@ -363,24 +363,24 @@ discard block |
||
| 363 | 363 | * @return array the aircraft thumbnail, orignal url and copyright |
| 364 | 364 | * |
| 365 | 365 | */ |
| 366 | - public function fromJetPhotos($type,$aircraft_registration, $aircraft_name='') { |
|
| 366 | + public function fromJetPhotos($type, $aircraft_registration, $aircraft_name = '') { |
|
| 367 | 367 | $Common = new Common(); |
| 368 | - $url= 'https://www.jetphotos.com/photo/keyword/'.$aircraft_registration; |
|
| 368 | + $url = 'https://www.jetphotos.com/photo/keyword/'.$aircraft_registration; |
|
| 369 | 369 | $data = $Common->getData($url); |
| 370 | 370 | $dom = new DOMDocument(); |
| 371 | 371 | @$dom->loadHTML($data); |
| 372 | 372 | $all_pics = array(); |
| 373 | - foreach($dom->getElementsByTagName('img') as $image) { |
|
| 373 | + foreach ($dom->getElementsByTagName('img') as $image) { |
|
| 374 | 374 | $all_pics[] = $image->getAttribute('src'); |
| 375 | 375 | } |
| 376 | 376 | $all_authors = array(); |
| 377 | - foreach($dom->getElementsByTagName('span') as $author) { |
|
| 377 | + foreach ($dom->getElementsByTagName('span') as $author) { |
|
| 378 | 378 | if (strpos($author->nodeValue, "By: ") !== false) { |
| 379 | 379 | $all_authors[] = $author->nodeValue; |
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | $all_ref = array(); |
| 383 | - foreach($dom->getElementsByTagName('a') as $link) { |
|
| 383 | + foreach ($dom->getElementsByTagName('a') as $link) { |
|
| 384 | 384 | if (strpos($link->getAttribute('href'), "/photo/") !== false) { |
| 385 | 385 | $all_ref[] = $link->getAttribute('href'); |
| 386 | 386 | } |
@@ -388,13 +388,13 @@ discard block |
||
| 388 | 388 | if (isset($all_pics[8])) { |
| 389 | 389 | $image_url = array(); |
| 390 | 390 | $image_url['thumbnail'] = 'http:'.$all_pics[3]; |
| 391 | - $image_url['original'] = 'http:'.str_replace('/400/','/full/',$all_pics[3]); |
|
| 392 | - $image_url['copyright'] = str_replace('By: ','',$all_authors[0]); |
|
| 391 | + $image_url['original'] = 'http:'.str_replace('/400/', '/full/', $all_pics[3]); |
|
| 392 | + $image_url['copyright'] = str_replace('By: ', '', $all_authors[0]); |
|
| 393 | 393 | $image_url['source_website'] = 'https://jetphotos.net'.$all_ref[0]; |
| 394 | 394 | $image_url['source'] = 'JetPhotos'; |
| 395 | 395 | return $image_url; |
| 396 | 396 | } |
| 397 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 397 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | /** |
@@ -405,30 +405,30 @@ discard block |
||
| 405 | 405 | * @return array the aircraft thumbnail, orignal url and copyright |
| 406 | 406 | * |
| 407 | 407 | */ |
| 408 | - public function fromPlanePictures($type,$aircraft_registration, $aircraft_name='') { |
|
| 408 | + public function fromPlanePictures($type, $aircraft_registration, $aircraft_name = '') { |
|
| 409 | 409 | $Common = new Common(); |
| 410 | - $url= 'https://www.planepictures.net/v3/search_en.php?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
|
| 410 | + $url = 'https://www.planepictures.net/v3/search_en.php?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
|
| 411 | 411 | $data = $Common->getData($url); |
| 412 | 412 | $dom = new DOMDocument(); |
| 413 | 413 | @$dom->loadHTML($data); |
| 414 | 414 | $all_pics = array(); |
| 415 | - foreach($dom->getElementsByTagName('img') as $image) { |
|
| 415 | + foreach ($dom->getElementsByTagName('img') as $image) { |
|
| 416 | 416 | $all_pics[] = $image->getAttribute('src'); |
| 417 | 417 | } |
| 418 | 418 | $all_links = array(); |
| 419 | - foreach($dom->getElementsByTagName('a') as $link) { |
|
| 420 | - $all_links[] = array('text' => $link->textContent,'href' => $link->getAttribute('href')); |
|
| 419 | + foreach ($dom->getElementsByTagName('a') as $link) { |
|
| 420 | + $all_links[] = array('text' => $link->textContent, 'href' => $link->getAttribute('href')); |
|
| 421 | 421 | } |
| 422 | 422 | if (isset($all_pics[4])) { |
| 423 | 423 | $image_url = array(); |
| 424 | 424 | $image_url['thumbnail'] = 'http://www.planepictures.net'.$all_pics[4]; |
| 425 | - $image_url['original'] = 'http://www.planepictures.net'.str_replace('_TN','',$all_pics[4]); |
|
| 425 | + $image_url['original'] = 'http://www.planepictures.net'.str_replace('_TN', '', $all_pics[4]); |
|
| 426 | 426 | $image_url['copyright'] = $all_links[28]['text']; |
| 427 | - $image_url['source_website'] = 'https://www.planepictures.net'.str_replace('./','/',$all_links[23]['href']); |
|
| 427 | + $image_url['source_website'] = 'https://www.planepictures.net'.str_replace('./', '/', $all_links[23]['href']); |
|
| 428 | 428 | $image_url['source'] = 'PlanePictures'; |
| 429 | 429 | return $image_url; |
| 430 | 430 | } |
| 431 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 431 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | /** |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | * @return array the aircraft thumbnail, orignal url and copyright |
| 440 | 440 | * |
| 441 | 441 | */ |
| 442 | - public function fromFlickr($type,$registration,$name='') { |
|
| 442 | + public function fromFlickr($type, $registration, $name = '') { |
|
| 443 | 443 | $Common = new Common(); |
| 444 | 444 | if ($type == 'aircraft') { |
| 445 | 445 | if ($name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.','.urlencode($name); |
@@ -449,20 +449,20 @@ discard block |
||
| 449 | 449 | else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',ship'; |
| 450 | 450 | } |
| 451 | 451 | $data = $Common->getData($url); |
| 452 | - if (substr($data, 0, 5) != "<?xml") return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 452 | + if (substr($data, 0, 5) != "<?xml") return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 453 | 453 | if ($xml = simplexml_load_string($data)) { |
| 454 | 454 | if (isset($xml->channel->item)) { |
| 455 | - $original_url = trim((string)$xml->channel->item->enclosure->attributes()->url); |
|
| 455 | + $original_url = trim((string) $xml->channel->item->enclosure->attributes()->url); |
|
| 456 | 456 | $image_url = array(); |
| 457 | 457 | $image_url['thumbnail'] = $original_url; |
| 458 | 458 | $image_url['original'] = $original_url; |
| 459 | - $image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->credit); |
|
| 460 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
| 459 | + $image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->credit); |
|
| 460 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
| 461 | 461 | $image_url['source'] = 'flickr'; |
| 462 | 462 | return $image_url; |
| 463 | 463 | } |
| 464 | 464 | } |
| 465 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 465 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | /** |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | $image_url['source'] = 'ivao.aero'; |
| 484 | 484 | return $image_url; |
| 485 | 485 | } else { |
| 486 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 486 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | |
@@ -495,10 +495,10 @@ discard block |
||
| 495 | 495 | * @param String $aircraft_name type of the aircraft |
| 496 | 496 | * @return array the aircraft thumbnail, orignal url and copyright |
| 497 | 497 | */ |
| 498 | - public function fromBing($type,$aircraft_registration,$aircraft_name='') { |
|
| 498 | + public function fromBing($type, $aircraft_registration, $aircraft_name = '') { |
|
| 499 | 499 | global $globalImageBingKey; |
| 500 | 500 | $Common = new Common(); |
| 501 | - if (!isset($globalImageBingKey) || $globalImageBingKey == '') return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 501 | + if (!isset($globalImageBingKey) || $globalImageBingKey == '') return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 502 | 502 | if ($type == 'aircraft') { |
| 503 | 503 | if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27'; |
| 504 | 504 | else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27'; |
@@ -506,8 +506,8 @@ discard block |
||
| 506 | 506 | if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.urlencode($aircraft_name).'%20%2Bship%20-site:flickr.com%27'; |
| 507 | 507 | else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Bship%20-site:flickr.com%27'; |
| 508 | 508 | } |
| 509 | - $headers = array("Authorization: Basic " . base64_encode("ignored:".$globalImageBingKey)); |
|
| 510 | - $data = $Common->getData($url,'get','',$headers); |
|
| 509 | + $headers = array("Authorization: Basic ".base64_encode("ignored:".$globalImageBingKey)); |
|
| 510 | + $data = $Common->getData($url, 'get', '', $headers); |
|
| 511 | 511 | $result = json_decode($data); |
| 512 | 512 | if (isset($result->d->results[0]->MediaUrl)) { |
| 513 | 513 | $image_url = array(); |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | $image_url['source'] = 'bing'; |
| 522 | 522 | return $image_url; |
| 523 | 523 | } |
| 524 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 524 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | /** |
@@ -533,21 +533,21 @@ discard block |
||
| 533 | 533 | * @return array the aircraft thumbnail, orignal url and copyright |
| 534 | 534 | * |
| 535 | 535 | */ |
| 536 | - public function fromAirportData($type,$aircraft_registration,$aircraft_icao,$aircraft_name='') { |
|
| 536 | + public function fromAirportData($type, $aircraft_registration, $aircraft_icao, $aircraft_name = '') { |
|
| 537 | 537 | $Common = new Common(); |
| 538 | 538 | $url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration.'&m='.$aircraft_icao; |
| 539 | 539 | $data = $Common->getData($url); |
| 540 | 540 | $result = json_decode($data); |
| 541 | 541 | if (isset($result->count) && $result->count > 0) { |
| 542 | 542 | $image_url = array(); |
| 543 | - $image_url['original'] = str_replace('thumbnails','large',$result->data[0]->image); |
|
| 543 | + $image_url['original'] = str_replace('thumbnails', 'large', $result->data[0]->image); |
|
| 544 | 544 | $image_url['source_website'] = $result->data[0]->link; |
| 545 | 545 | $image_url['thumbnail'] = $result->data[0]->image; |
| 546 | 546 | $image_url['copyright'] = $result->data[0]->photographer; |
| 547 | 547 | $image_url['source'] = 'AirportData'; |
| 548 | 548 | return $image_url; |
| 549 | 549 | } |
| 550 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 550 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | /** |
@@ -558,20 +558,20 @@ discard block |
||
| 558 | 558 | * @return array the aircraft thumbnail, orignal url and copyright |
| 559 | 559 | * |
| 560 | 560 | */ |
| 561 | - public function fromWikimedia($type,$registration,$name='') { |
|
| 561 | + public function fromWikimedia($type, $registration, $name = '') { |
|
| 562 | 562 | $Common = new Common(); |
| 563 | 563 | if ($type == 'aircraft') { |
| 564 | 564 | if ($name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20'.urlencode($name); |
| 565 | 565 | else $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20aircraft'; |
| 566 | 566 | } elseif ($type == 'marine') { |
| 567 | 567 | if ($name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.urlencode($name).'%20ship"'; |
| 568 | - else return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 568 | + else return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 569 | 569 | } |
| 570 | 570 | $data = $Common->getData($url); |
| 571 | 571 | $result = json_decode($data); |
| 572 | 572 | if (isset($result->query->search[0]->title)) { |
| 573 | 573 | $fileo = $result->query->search[0]->title; |
| 574 | - if (substr($fileo,-3) == 'pdf') return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 574 | + if (substr($fileo, -3) == 'pdf') return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 575 | 575 | $file = urlencode($fileo); |
| 576 | 576 | $url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file; |
| 577 | 577 | $data2 = $Common->getData($url2); |
@@ -596,11 +596,11 @@ discard block |
||
| 596 | 596 | if (isset($result2->query->pages)) { |
| 597 | 597 | foreach ($result2->query->pages as $page) { |
| 598 | 598 | if (isset($page->imageinfo[0]->extmetadata->Artist)) { |
| 599 | - $image_url['copyright'] = preg_replace('/ from(.*)/','',strip_tags($page->imageinfo[0]->extmetadata->Artist->value)); |
|
| 599 | + $image_url['copyright'] = preg_replace('/ from(.*)/', '', strip_tags($page->imageinfo[0]->extmetadata->Artist->value)); |
|
| 600 | 600 | if (isset($page->imageinfo[0]->extmetadata->License->value)) { |
| 601 | 601 | $image_url['copyright'] = $image_url['copyright'].' (under '.$page->imageinfo[0]->extmetadata->License->value.')'; |
| 602 | 602 | } |
| 603 | - $image_url['copyright'] = trim(str_replace('\n','',$image_url['copyright'])); |
|
| 603 | + $image_url['copyright'] = trim(str_replace('\n', '', $image_url['copyright'])); |
|
| 604 | 604 | return $image_url; |
| 605 | 605 | } |
| 606 | 606 | } |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | return $image_url; |
| 609 | 609 | } |
| 610 | 610 | } |
| 611 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 611 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | /** |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | * @return array the aircraft thumbnail, orignal url and copyright |
| 620 | 620 | * |
| 621 | 621 | */ |
| 622 | - public function fromCustomSource($type,$registration,$name='') { |
|
| 622 | + public function fromCustomSource($type, $registration, $name = '') { |
|
| 623 | 623 | global $globalAircraftImageCustomSources, $globalMarineImageCustomSources, $globalDebug; |
| 624 | 624 | //$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true); |
| 625 | 625 | if (!empty($globalAircraftImageCustomSources) && $type == 'aircraft') { |
@@ -636,15 +636,15 @@ discard block |
||
| 636 | 636 | print_r($source); |
| 637 | 637 | print_r($customsources); |
| 638 | 638 | } |
| 639 | - $url = str_replace('{registration}',$registration,$source['original']); |
|
| 640 | - $url_thumbnail = str_replace('{registration}',$registration,$source['thumbnail']); |
|
| 639 | + $url = str_replace('{registration}', $registration, $source['original']); |
|
| 640 | + $url_thumbnail = str_replace('{registration}', $registration, $source['thumbnail']); |
|
| 641 | 641 | if ($Common->urlexist($url)) { |
| 642 | 642 | $image_url = array(); |
| 643 | 643 | $image_url['thumbnail'] = $url_thumbnail; |
| 644 | 644 | $image_url['original'] = $url; |
| 645 | 645 | if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
| 646 | 646 | else $exifCopyright = ''; |
| 647 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
| 647 | + if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
| 648 | 648 | elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
| 649 | 649 | else $image_url['copyright'] = $source['source_website']; |
| 650 | 650 | $image_url['source_website'] = $source['source_website']; |
@@ -652,8 +652,8 @@ discard block |
||
| 652 | 652 | return $image_url; |
| 653 | 653 | } |
| 654 | 654 | } |
| 655 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 656 | - } else return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 655 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 656 | + } else return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
| 657 | 657 | |
| 658 | 658 | if (!empty($globalMarineImageCustomSources) && $type == 'marine') { |
| 659 | 659 | $customsources = array(); |
@@ -669,19 +669,19 @@ discard block |
||
| 669 | 669 | print_r($source); |
| 670 | 670 | print_r($customsources); |
| 671 | 671 | } |
| 672 | - $url = str_replace('{registration}',$registration,$source['original']); |
|
| 673 | - $url = str_replace('{mmsi}',$registration,$url); |
|
| 674 | - $url = str_replace('{name}',$name,$url); |
|
| 675 | - $url_thumbnail = str_replace('{registration}',$registration,$source['thumbnail']); |
|
| 676 | - $url_thumbnail = str_replace('{mmsi}',$registration,$url_thumbnail); |
|
| 677 | - $url_thumbnail = str_replace('{name}',$name,$url_thumbnail); |
|
| 672 | + $url = str_replace('{registration}', $registration, $source['original']); |
|
| 673 | + $url = str_replace('{mmsi}', $registration, $url); |
|
| 674 | + $url = str_replace('{name}', $name, $url); |
|
| 675 | + $url_thumbnail = str_replace('{registration}', $registration, $source['thumbnail']); |
|
| 676 | + $url_thumbnail = str_replace('{mmsi}', $registration, $url_thumbnail); |
|
| 677 | + $url_thumbnail = str_replace('{name}', $name, $url_thumbnail); |
|
| 678 | 678 | if ($Common->urlexist($url)) { |
| 679 | 679 | $image_url = array(); |
| 680 | 680 | $image_url['thumbnail'] = $url_thumbnail; |
| 681 | 681 | $image_url['original'] = $url; |
| 682 | 682 | if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
| 683 | 683 | else $exifCopyright = ''; |
| 684 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
| 684 | + if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
| 685 | 685 | elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
| 686 | 686 | else $image_url['copyright'] = $source['source_website']; |
| 687 | 687 | $image_url['source_website'] = $source['source_website']; |