Permalink
Browse files

Removed checks for PHP 5.1

There were still some checks for PHP 5.1.x, nobody should be
using a PHP version that old.
  • Loading branch information...
jeroenrnl committed Oct 28, 2012
1 parent 96ca967 commit a3c772b4318ebea216c6e82b10be12ab6cc21daf
Showing with 39 additions and 47 deletions.
  1. +1 −1 php/classes/TimeZone.inc.php
  2. +36 −44 php/photo.inc.php
  3. +1 −1 php/place.inc.php
  4. +1 −1 php/track.inc.php
@@ -134,7 +134,7 @@ public static function validate($tz) {
* @return string timezone
*/
public static function guess($lat, $lon) {
- if(minimum_version("5.1.2") && class_exists("XMLReader")) {
+ if(class_exists("XMLReader")) {
$failed=false;
$xml=new XMLReader();
@$xml->open("http://ws.geonames.org/timezone?lat=" .
View
@@ -1118,52 +1118,44 @@ public function getEditArray(user $user = null) {
}
function get_time($timezone=null, $date_format=DATE_FORMAT, $time_format=TIME_FORMAT) {
- if(minimum_version("5.1.0")) {
- if(TimeZone::validate($timezone)) {
- $place_tz=new TimeZone($timezone);
- } else {
- $this->lookup_location();
- $loc=$this->location;
- if($loc && TimeZone::validate($loc->get("timezone"))) {
- $place_tz=new TimeZone($loc->get("timezone"));
- }
- }
- if(TimeZone::validate(conf::get("date.tz"))) {
- $camera_tz=new TimeZone(conf::get("date.tz"));
- }
-
- if(!isset($place_tz) && isset($camera_tz)) {
- // Camera timezone is known, place timezone is not.
- $place_tz=$camera_tz;
- } else if (isset($place_tz) && !isset($camera_tz)) {
- // Place timezone is known, camera timezone is not.
- $camera_tz=$place_tz;
- } else if (!isset($place_tz) && !isset($camera_tz)) {
- // Neither are set
- $camera_tz=new TimeZone(date_default_timezone_get());
- $place_tz=$camera_tz;
- }
-
- $camera_time=new Time(
- $this->get("date") . " " .
- $this->get("time"),
- $camera_tz);
- $place_time=$camera_time;
- $place_time->setTimezone($place_tz);
- $corr=$this->get("time_corr");
- if($corr) {
- $place_time->modify($corr . " minutes");
- }
+ if(TimeZone::validate($timezone)) {
+ $place_tz=new TimeZone($timezone);
+ } else {
+ $this->lookup_location();
+ $loc=$this->location;
+ if($loc && TimeZone::validate($loc->get("timezone"))) {
+ $place_tz=new TimeZone($loc->get("timezone"));
+ }
+ }
+ if(TimeZone::validate(conf::get("date.tz"))) {
+ $camera_tz=new TimeZone(conf::get("date.tz"));
+ }
- $date=$place_time->format($date_format);
- $time=$place_time->format($time_format);
- } else {
- // Timezone support was introduced in PHP 5.1
- // so we'll just return date and time as they are
- // stored in db.
- $date=$this->get("date");
- $time=$this->get("time");
+ if(!isset($place_tz) && isset($camera_tz)) {
+ // Camera timezone is known, place timezone is not.
+ $place_tz=$camera_tz;
+ } else if (isset($place_tz) && !isset($camera_tz)) {
+ // Place timezone is known, camera timezone is not.
+ $camera_tz=$place_tz;
+ } else if (!isset($place_tz) && !isset($camera_tz)) {
+ // Neither are set
+ $camera_tz=new TimeZone(date_default_timezone_get());
+ $place_tz=$camera_tz;
}
+
+ $camera_time=new Time(
+ $this->get("date") . " " .
+ $this->get("time"),
+ $camera_tz);
+ $place_time=$camera_time;
+ $place_time->setTimezone($place_tz);
+ $corr=$this->get("time_corr");
+ if($corr) {
+ $place_time->modify($corr . " minutes");
+ }
+
+ $date=$place_time->format($date_format);
+ $time=$place_time->format($time_format);
return array($date,$time);
}
View
@@ -471,7 +471,7 @@ function guess_tz() {
$lat=$this->get("lat");
$lon=$this->get("lon");
$timezone=$this->get("timezone");
- if((!$timezone && $lat && $lon) && minimum_version("5.1.0")) {
+ if((!$timezone && $lat && $lon)) {
$tz=TimeZone::guess($lat, $lon);
if($tz) {
$html="<span class='actionlink'>" .
View
@@ -113,7 +113,7 @@ private function insertPoints() {
*/
public static function getFromGPX($file) {
$track = new track;
- if(minimum_version("5.1.2") && class_exists("XMLReader")) {
+ if(class_exists("XMLReader")) {
$xml=new XMLReader();
$xml->open($file);

0 comments on commit a3c772b

Please sign in to comment.