]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
make the logo be compatible with HTTPS pages, if possible
authorEvan Prodromou <evan@status.net>
Thu, 14 Oct 2010 18:22:49 +0000 (14:22 -0400)
committerEvan Prodromou <evan@status.net>
Thu, 14 Oct 2010 18:22:49 +0000 (14:22 -0400)
lib/action.php

index fcac0e0a7fdd73f15901bc64942b8b78e3877d5b..55ee83bde6d5bc9d32ed89a76e80e773f094b083 100644 (file)
@@ -426,11 +426,35 @@ class Action extends HTMLOutputter // lawsuit
             }
             $this->elementStart('a', array('class' => 'url home bookmark',
                                            'href' => $url));
-            if (common_config('site', 'logo') || file_exists(Theme::file('logo.png'))) {
+
+            if (StatusNet::isHTTPS()) {
+                $logoUrl = common_config('site', 'ssllogo');
+                if (empty($logoUrl)) {
+                    // if logo is an uploaded file, try to fall back to HTTPS file URL
+                    $httpUrl = common_config('site', 'logo');
+                    if (!empty($httpUrl)) {
+                        $f = File::staticGet('url', $httpUrl);
+                        if (!empty($f) && !empty($f->filename)) {
+                            // this will handle the HTTPS case
+                            $logoUrl = File::url($f->filename);
+                        }
+                    }
+                }
+            } else {
+                $logoUrl = common_config('site', 'logo');
+            }
+
+            if (empty($logoUrl) && file_exists(Theme::file('logo.png'))) {
+                // This should handle the HTTPS case internally
+                $logoUrl = Theme::path('logo.png');
+            }
+
+            if (!empty($logoUrl)) {
                 $this->element('img', array('class' => 'logo photo',
-                                            'src' => (common_config('site', 'logo')) ? common_config('site', 'logo') : Theme::path('logo.png'),
+                                            'src' => $logoUrl,
                                             'alt' => common_config('site', 'name')));
             }
+
             $this->text(' ');
             $this->element('span', array('class' => 'fn org'), common_config('site', 'name'));
             $this->elementEnd('a');