--- a/include/common.inc.php +++ b/include/common.inc.php @@ -16,6 +16,9 @@ if (isDebug("awsotp") || php_uname('n') == "maxious.xen.prgmr.com") { $otpAPIurl = 'http://bus-main.lambdacomplex.org:8080/opentripplanner-api-webapp/'; } +if (isDebug("dotcloudotp") || php_uname('n') == "actbus-www") { + $otpAPIurl = 'http://otp.actbus.dotcloud.com/opentripplanner-api-webapp/'; +} if (isDebug("squallotp")) { $otpAPIurl = 'http://10.0.1.108:5080/opentripplanner-api-webapp/'; } @@ -23,18 +26,24 @@ $otpAPIurl = 'http://10.0.1.135:8080/opentripplanner-api-webapp/'; } if (isDebug("phperror")) error_reporting(E_ALL ^ E_NOTICE); +$labsPath = ""; +if (strstr($_SERVER['PHP_SELF'],"labs")) $labsPath = "../"; + +function isDebugServer() +{ + return !isset($_SERVER['SERVER_NAME']) || $_SERVER['SERVER_NAME'] == "10.0.1.154" || $_SERVER['SERVER_NAME'] == "10.1.0.4" || $_SERVER['SERVER_NAME'] == "localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1" ; +} include_once ("common-geo.inc.php"); include_once ("common-net.inc.php"); include_once ("common-transit.inc.php"); +include_once ("common-db.inc.php"); + +include_once ("common-request.inc.php"); include_once ("common-session.inc.php"); -include_once ("common-db.inc.php"); include_once ("common-template.inc.php"); -function isDebugServer() -{ - return $_SERVER['SERVER_NAME'] == "10.0.1.154" || $_SERVER['SERVER_NAME'] == "localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1" || !$_SERVER['SERVER_NAME']; -} + function isAnalyticsOn() { return !isDebugServer(); @@ -139,5 +148,42 @@ if ($sort_ascending) $array = array_reverse($temp_array); else $array = $temp_array; } +function sktimesort(&$array, $subkey = "id", $sort_ascending = false) +{ + if (count($array)) $temp_array[key($array) ] = array_shift($array); + foreach ($array as $key => $val) { + $offset = 0; + $found = false; + foreach ($temp_array as $tmp_key => $tmp_val) { + if (!$found and strtotime($val[$subkey]) > strtotime($tmp_val[$subkey])) { + $temp_array = array_merge((array)array_slice($temp_array, 0, $offset) , array( + $key => $val + ) , array_slice($temp_array, $offset)); + $found = true; + } + $offset++; + } + if (!$found) $temp_array = array_merge($temp_array, array( + $key => $val + )); + } + if ($sort_ascending && isset($temp_array)) $array = array_reverse($temp_array); + else $array = $temp_array; +} +function r_implode( $glue, $pieces ) +{ + foreach( $pieces as $r_pieces ) + { + if( is_array( $r_pieces ) ) + { + $retVal[] = r_implode( $glue, $r_pieces ); + } + else + { + $retVal[] = $r_pieces; + } + } + return implode( $glue, $retVal ); +} ?>