]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
try and show an SSL image for the creative commons image
authorEvan Prodromou <evan@status.net>
Thu, 14 Oct 2010 04:31:13 +0000 (00:31 -0400)
committerEvan Prodromou <evan@status.net>
Thu, 14 Oct 2010 04:31:13 +0000 (00:31 -0400)
lib/action.php

index 008f29d03e61e4ba61071e4de8ed36e0066ce3ee..b05770b152618c53c17c4498b4dece1ebb1bc3b9 100644 (file)
@@ -894,8 +894,26 @@ class Action extends HTMLOutputter // lawsuit
             case 'cc': // fall through
             default:
                 $this->elementStart('p');
+
+                $image    = common_config('license', 'image');
+                $sslimage = common_config('license', 'sslimage');
+
+                if (StatusNet::isHTTPS()) {
+                    if (!empty($sslimage)) {
+                        $url = $sslimage;
+                    } else if (preg_match('#^http://i.creativecommons.org/#', $image)) {
+                        // CC support HTTPS on their images
+                        $url = preg_replace('/^http/', 'https', $image);
+                    } else {
+                        // Better to show mixed content than no content
+                        $url = $image;
+                    }
+                } else {
+                    $url = $image;
+                }
+
                 $this->element('img', array('id' => 'license_cc',
-                                            'src' => common_config('license', 'image'),
+                                            'src' => $url,
                                             'alt' => common_config('license', 'title'),
                                             'width' => '80',
                                             'height' => '15'));