Store urls on router rather than in template
[gitphp.git] / include / Util.class.php
blob:a/include/Util.class.php -> blob:b/include/Util.class.php
--- a/include/Util.class.php
+++ b/include/Util.class.php
@@ -160,9 +160,33 @@
 			if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on'))
 				$baseurl = 'https://' . $baseurl;
 			else
-				$baserul = 'http://' . $baseurl;
+				$baseurl = 'http://' . $baseurl;
 		}
+		if (GitPHP_Util::IsWindows())
+			$baseurl = rtrim($baseurl, "\\");
 		return rtrim($baseurl, "/");
+	}
+
+	/**
+	 * Tests whether a function is allowed to be called
+	 *
+	 * @param string $function functio name
+	 * @return true if allowed
+	 */
+	public static function FunctionAllowed($function)
+	{
+		if (empty($function))
+			return false;
+
+		$disabled = @ini_get('disable_functions');
+		if (!$disabled) {
+			// no disabled functions
+			// or ini_get is disabled so we can't reliably figure this out
+			return true;
+		}
+
+		$disabledlist = explode(', ', $disabled);
+		return !in_array($function, $disabledlist);
 	}
 
 }

comments