]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/htmloutputter.php
Fix logic that determines if a URL is relative or absolute in script() and cssLink()
[quix0rs-gnu-social.git] / lib / htmloutputter.php
index 9d3244625607740799ec2f792d20a5ecc48091e0..6045971161d5e933437d5c1be6d02e61e870f802 100644 (file)
@@ -350,7 +350,7 @@ class HTMLOutputter extends XMLOutputter
     function script($src, $type='text/javascript')
     {
         $url = parse_url($src);
-        if(! ($url->scheme || $url->host || $url->query || $url->fragment))
+        if( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($url->fragment))
         {
             $src = common_path($src) . '?version=' . LACONICA_VERSION;
         }
@@ -368,15 +368,16 @@ class HTMLOutputter extends XMLOutputter
      *
      * @return void
      */
-    function cssLink($src,$theme,$media)
+    function cssLink($src,$theme=null,$media=null)
     {
-        if (!$theme) {
-            $theme = common_config('site', 'theme');
-        }
         $url = parse_url($src);
-        if(! ($url->scheme || $url->host || $url->query || $url->fragment))
+        if( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($url->fragment))
         {
-            $src = theme_path($src) . '?version=' . LACONICA_VERSION;
+            if(file_exists(theme_file($src,$theme))){
+               $src = theme_path($src, $theme) . '?version=' . LACONICA_VERSION;
+            }else{
+               $src = common_path($src);
+            }
         }
         $this->element('link', array('rel' => 'stylesheet',
                                 'type' => 'text/css',