Skip to content

Instantly share code, notes, and snippets.

@immutef
Created November 3, 2010 10:49
Show Gist options
  • Save immutef/660960 to your computer and use it in GitHub Desktop.
Save immutef/660960 to your computer and use it in GitHub Desktop.
Developers Shame Day
Index: php/navigation.php
===================================================================
--- a/php/navigation.php
+++ b/php/navigation.php
@@ -2001,15 +2001,27 @@
}
-/********************************************************************************************
-* Function: getCountryURL *
-* Action: *
-* - gibt das Länderkürzel der aktuellen Navnode zurück, z.B. de oder alpen *
-********************************************************************************************/
-
-function getCountryURL()
-{
- return $this->url[0];
-}
-/********************************************************************************************/
+/*
+ * Returns Countryurl
+ * If $validate is true, it checks if you are in a valid country, otherwise it returns false
+ * If $validate is false, it always returns first part of the url, no matter what
+ *
+ * @param boolean $validate
+ * return string
+ */
+function getCountryURL( $validate=false )
+{
+ global $selfcountry;
+
+ if( !$validate ){
+ return $this->url[0];
+ } else {
+ if( isset( $selfcountry[ $this->url[0] ] ) ){
+ return $this->url[0];
+ } else {
+ return false;
+ }
+ }
+}
function getmod()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment