| @@ -25,8 +25,7 @@ | ||
| 25 | 25 | if (is_array($value)) | 
| 26 | 26 |  		{ | 
| 27 | 27 | Route4Me::simplePrint($value); | 
| 28 | - } | |
| 29 | - else | |
| 28 | + } else | |
| 30 | 29 |  		{ | 
| 31 | 30 | echo "$key => $value <br>"; | 
| 32 | 31 | } | 
| @@ -51,8 +51,7 @@ | ||
| 51 | 51 | if (is_string($value)) | 
| 52 | 52 |  	{ | 
| 53 | 53 | echo $key." --> ".$value."<br>"; | 
| 54 | - } | |
| 55 | - else | |
| 54 | + } else | |
| 56 | 55 |  	{ | 
| 57 | 56 | echo "************ $key ************* <br>"; | 
| 58 | 57 | Route4Me::simplePrint((array)$value); | 
| @@ -28,7 +28,9 @@ | ||
| 28 | 28 |  		foreach ($routeResults['addresses'] as $key => $address) { | 
| 29 | 29 | $araddress = (array)$address; | 
| 30 | 30 | |
| 31 | - if (isset($araddress['route_destination_id'])) echo "route_destination_id=".$araddress['route_destination_id']."<br>"; | |
| 31 | +			if (isset($araddress['route_destination_id'])) { | |
| 32 | + echo "route_destination_id=".$araddress['route_destination_id']."<br>"; | |
| 33 | + } | |
| 32 | 34 | |
| 33 | 35 |  			if (isset($araddress['path_to_next'])) { | 
| 34 | 36 | echo "path_to_next:<br>"; | 
| @@ -43,9 +43,10 @@ | ||
| 43 | 43 | |
| 44 | 44 | $result = $route->GetLastLocation($params); | 
| 45 | 45 |  	//var_dump($result);die(""); | 
| 46 | - if (isset($result->tracking_history)) | |
| 47 | -	foreach ($result->tracking_history as $history) { | |
| 46 | +	if (isset($result->tracking_history)) { | |
| 47 | +		foreach ($result->tracking_history as $history) { | |
| 48 | 48 | echo "Speed --> ".$history['s']."<br>"; | 
| 49 | + } | |
| 49 | 50 | echo "course --> ".$history['d']."<br>"; | 
| 50 | 51 | echo "Timestamp --> ".$history['ts_friendly']."<br>"; | 
| 51 | 52 | echo "Latitude --> ".$history['lt']."<br>"; | 
| @@ -155,7 +155,9 @@ discard block | ||
| 155 | 155 | |
| 156 | 156 | $optimizations = array(); | 
| 157 | 157 |              foreach($json as $optimization) { | 
| 158 | - if (gettype($optimization)!="array") continue; | |
| 158 | +				if (gettype($optimization)!="array") { | |
| 159 | + continue; | |
| 160 | + } | |
| 159 | 161 |  				foreach ($optimization as $otp1) { | 
| 160 | 162 | $optimizations[] = $otp1; | 
| 161 | 163 | } | 
| @@ -169,7 +171,9 @@ discard block | ||
| 169 | 171 | |
| 170 | 172 | public function getAddresses($opt_id) | 
| 171 | 173 |  	{ | 
| 172 | - if ($opt_id==null) return null; | |
| 174 | +		if ($opt_id==null) { | |
| 175 | + return null; | |
| 176 | + } | |
| 173 | 177 | |
| 174 | 178 | $params = array( "optimization_problem_id" => $opt_id ); | 
| 175 | 179 | |
| @@ -249,8 +249,9 @@ | ||
| 249 | 249 | if (is_array($rRoute)) | 
| 250 | 250 |  			{ | 
| 251 | 251 | return $rRoute["route_id"]; | 
| 252 | +			} else { | |
| 253 | + return null; | |
| 252 | 254 | } | 
| 253 | - else return null; | |
| 254 | 255 | } | 
| 255 | 256 | |
| 256 | 257 | public function update() | 
| @@ -118,8 +118,7 @@ discard block | ||
| 118 | 118 | echo "Error message: " .curl_error($this->ch)."\n"; | 
| 119 | 119 | } | 
| 120 | 120 | return false; | 
| 121 | - } | |
| 122 | - else | |
| 121 | + } else | |
| 123 | 122 |          { | 
| 124 | 123 | return $result; | 
| 125 | 124 | } | 
| @@ -164,8 +163,7 @@ discard block | ||
| 164 | 163 | echo "Error message: " .curl_error($this->ch)."\n"; | 
| 165 | 164 | } | 
| 166 | 165 | return false; | 
| 167 | - } | |
| 168 | - else | |
| 166 | + } else | |
| 169 | 167 |  		{ | 
| 170 | 168 | return $result; | 
| 171 | 169 | } | 
| @@ -210,8 +208,7 @@ discard block | ||
| 210 | 208 | echo "Error message: " .curl_error($this->ch)."\n"; | 
| 211 | 209 | } | 
| 212 | 210 | return false; | 
| 213 | - } | |
| 214 | - else | |
| 211 | + } else | |
| 215 | 212 |  		{ | 
| 216 | 213 | return true; | 
| 217 | 214 | } | 
| @@ -278,7 +275,10 @@ discard block | ||
| 278 | 275 |  		{ | 
| 279 | 276 | foreach($file_field_array as $var_name => $var_value) | 
| 280 | 277 |  			{ | 
| 281 | -				if(strpos(PHP_OS, "WIN") !== false) $var_value = str_replace("/", "\\", $var_value); // win hack | |
| 278 | +				if(strpos(PHP_OS, "WIN") !== false) { | |
| 279 | +					$var_value = str_replace("/", "\\", $var_value); | |
| 280 | + } | |
| 281 | + // win hack | |
| 282 | 282 | $file_field_array[$var_name] = "@".$var_value; | 
| 283 | 283 | } | 
| 284 | 284 | } | 
| @@ -296,8 +296,7 @@ discard block | ||
| 296 | 296 | echo "Error message: " .curl_error($this->ch)."\n"; | 
| 297 | 297 | } | 
| 298 | 298 | return false; | 
| 299 | - } | |
| 300 | - else | |
| 299 | + } else | |
| 301 | 300 |  		{ | 
| 302 | 301 | return $result; | 
| 303 | 302 | } | 
| @@ -406,12 +405,15 @@ discard block | ||
| 406 | 405 | return $data; | 
| 407 | 406 | } | 
| 408 | 407 | $last_url = parse_url(curl_getinfo($ch, CURLINFO_EFFECTIVE_URL)); | 
| 409 | - if (empty($url['scheme'])) | |
| 410 | - $url['scheme'] = $last_url['scheme']; | |
| 411 | - if (empty($url['host'])) | |
| 412 | - $url['host'] = $last_url['host']; | |
| 413 | - if (empty($url['path'])) | |
| 414 | - $url['path'] = $last_url['path']; | |
| 408 | +        if (empty($url['scheme'])) { | |
| 409 | + $url['scheme'] = $last_url['scheme']; | |
| 410 | + } | |
| 411 | +        if (empty($url['host'])) { | |
| 412 | + $url['host'] = $last_url['host']; | |
| 413 | + } | |
| 414 | +        if (empty($url['path'])) { | |
| 415 | + $url['path'] = $last_url['path']; | |
| 416 | + } | |
| 415 | 417 | $new_url = $url['scheme'] . '://' . $url['host'] . $url['path'] . (!empty($url['query'])?'?'.$url['query']:''); | 
| 416 | 418 | //echo "Being redirected to $new_url\n"; | 
| 417 | 419 | curl_setopt($ch, CURLOPT_URL, $new_url); | 
| @@ -167,16 +167,16 @@ | ||
| 167 | 167 | $this->_deviceId = $device->MyQDeviceId; | 
| 168 | 168 |              foreach ($device->Attributes as $attr) { | 
| 169 | 169 |                  switch ($attr->AttributeDisplayName) { | 
| 170 | - case 'desc': | |
| 171 | - $this->_doorName = $attr->Value; | |
| 172 | - break; | |
| 173 | - case 'doorstate': | |
| 174 | - $this->_doorState = $attr->Value; | |
| 175 | - // UpdatedTime is a timestamp in ms, so we truncate | |
| 176 | - $this->_doorStateTime = (int)$attr->UpdatedTime / 1000; | |
| 177 | - break; | |
| 178 | - default: | |
| 179 | - continue; | |
| 170 | + case 'desc': | |
| 171 | + $this->_doorName = $attr->Value; | |
| 172 | + break; | |
| 173 | + case 'doorstate': | |
| 174 | + $this->_doorState = $attr->Value; | |
| 175 | + // UpdatedTime is a timestamp in ms, so we truncate | |
| 176 | + $this->_doorStateTime = (int)$attr->UpdatedTime / 1000; | |
| 177 | + break; | |
| 178 | + default: | |
| 179 | + continue; | |
| 180 | 180 | } | 
| 181 | 181 | } | 
| 182 | 182 | } | 
| @@ -51,8 +51,7 @@ | ||
| 51 | 51 | if (is_string($value)) | 
| 52 | 52 |  	{ | 
| 53 | 53 | echo $key." --> ".$value."<br>"; | 
| 54 | - } | |
| 55 | - else | |
| 54 | + } else | |
| 56 | 55 |  	{ | 
| 57 | 56 | echo "************ $key ************* <br>"; | 
| 58 | 57 | Route4Me::simplePrint((array)$value); |