Add more URL tokens
authorTim Otten <totten@civicrm.org>
Sat, 30 Mar 2013 00:49:30 +0000 (20:49 -0400)
committerTim Otten <totten@civicrm.org>
Sat, 30 Mar 2013 00:49:30 +0000 (20:49 -0400)
CRM/Utils/System.php

index dda43997ba2674e9546f816b666d12ee0a6033d1..13d73224253d040e0c937399684236c9ffdb9df6 100644 (file)
@@ -1513,13 +1513,12 @@ class CRM_Utils_System {
   }
 
   /**
-   * Determine the URL which provides a feed of available extensions
+   * Evaluate any tokens in a URL
    *
    * @param string|FALSE $url
    * @return string|FALSE
    */
   public static function evalUrl($url) {
-    // boolean false means don't try to check extensions
     if ($url === FALSE) {
       return FALSE;
     }
@@ -1529,7 +1528,14 @@ class CRM_Utils_System {
         '{ver}' => CRM_Utils_System::version(),
         '{uf}' => $config->userFramework,
         '{php}' => phpversion(),
+        '{sid}' => md5('sid_' . (defined('CIVICRM_SITE_KEY') ? CIVICRM_SITE_KEY : '') . '_' . $config->userFrameworkBaseURL),
+        '{baseUrl}' => $config->userFrameworkBaseURL,
+        '{lang}' => $config->lcMessages,
+        '{co}' => $config->defaultContactCountry,
       );
+      foreach (array_keys($vars) as $k) {
+        $vars[$k] = urlencode($vars[$k]);
+      }
       return strtr($url, $vars);
     }
   }