Convert to Google static maps
[busui.git] / include / common.inc.php
blob:a/include/common.inc.php -> blob:b/include/common.inc.php
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -31,7 +31,7 @@
 $cloudmadeAPIkey = "daa03470bb8740298d4b10e3f03d63e6";
 $googleMapsAPIkey = "ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q";
 $otpAPIurl = 'http://localhost:8080/opentripplanner-api-webapp/';
-if (isDebug("awsotp") || php_uname('n') == "maxious.xen.prgmr.com") {
+if (isDebug("awsotp") || php_uname('n') == "maxious.xen.prgmr.com" || strstr(php_uname('n'),"actbus")) {
     $otpAPIurl = 'http://bus-main.lambdacomplex.org:8080/opentripplanner-api-webapp/';
 }
 if (isDebug("dotcloudotp") || php_uname('n') == "actbus-www") {
@@ -49,19 +49,30 @@
 if (strstr($_SERVER['PHP_SELF'], "labs/")
         || strstr($_SERVER['PHP_SELF'], "myway/")
         || strstr($_SERVER['PHP_SELF'], "lib/")
+        || strstr($_SERVER['PHP_SELF'], "geo/")
         || strstr($_SERVER['PHP_SELF'], "include/")
-        || strstr($_SERVER['PHP_SELF'], "servicealerts/"))
+        || strstr($_SERVER['PHP_SELF'], "rtpis/")) {
     $basePath = "../";
+}
 
 function isDebugServer() {
-    return php_sapi_name() == "cli" || isset($_SERVER['SERVER_NAME']) && ( $_SERVER['SERVER_NAME'] == "azusa" || $_SERVER['SERVER_NAME'] == "vanille"
-            || $_SERVER['SERVER_NAME'] == "localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1");
+    
+    return php_sapi_name() == "cli" || strstr(php_uname('n'),"actbus") || isset($_SERVER['SERVER_NAME']) && ( $_SERVER['SERVER_NAME'] == "azusa" || $_SERVER['SERVER_NAME'] == "vanille"
+            || $_SERVER['SERVER_NAME'] == "localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1" ||  $_SERVER['SERVER_NAME'] == "192.168.1.8" || $_SERVER['SERVER_NAME'] == "192.168.178.24");
+}
+
+if (isset($_SERVER['SERVER_NAME'])  && $_SERVER['SERVER_NAME'] == "maxious.xen.prgmr.com") {
+// Set the exception handler
+require $basePath."/lib/amon-php/amon.php";
+Amon::setup_exception_handler();
 }
 
 include_once ("common-geo.inc.php");
 include_once ("common-net.inc.php");
 include_once ("common-transit.inc.php");
-include_once ("common-db.inc.php");
+if (!strstr($_SERVER['PHP_SELF'], "feedback")) {
+	include_once ("common-db.inc.php");
+}
 
 include_once ("common-request.inc.php");
 include_once ("common-session.inc.php");
@@ -70,7 +81,7 @@
 
 function isAnalyticsOn() {
     $user_agent = $_SERVER['HTTP_USER_AGENT'];
-    return!isDebugServer() && !preg_match('/cloudkick/i', $user_agent) && !preg_match('/googlebot/i', $user_agent) &&
+    return !isDebugServer() && !preg_match('/cloudkick/i', $user_agent) && !preg_match('/googlebot/i', $user_agent) &&
             !preg_match('/baidu/i', $user_agent);
 }
 
@@ -132,10 +143,6 @@
         return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)), $needle) === 0);
     }
     return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)), $needle) === 0);
-}
-
-function bracketsMeanNewLine($input) {
-    return str_replace(")", "</small>", str_replace("(", "<br><small>", $input));
 }
 
 function sksort(&$array, $subkey = "id", $sort_ascending = false) {
@@ -201,5 +208,3 @@
     return implode($glue, $retVal);
 }
 
-?>
-