]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Design.php
Move hasFave() to Profile
[quix0rs-gnu-social.git] / classes / Design.php
index b53096aa289fe0c2367188dcea0aa88abdff8da9..ff44e010964042f0d6e8b18de603668c2c71d496 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
- * Laconica - the distributed open-source microblogging tool
- * Copyright (C) 2009, Control Yourself, Inc.
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2009, StatusNet, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
@@ -17,7 +17,7 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
-if (!defined('LACONICA')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
@@ -101,7 +101,7 @@ class Design extends Memcached_DataObject
         }
 
         if (0 != mb_strlen($css)) {
-            $out->element('style', array('type' => 'text/css'), $css);
+            $out->style($css);
         }
     }
 
@@ -115,7 +115,7 @@ class Design extends Memcached_DataObject
             return new WebColor($color);
         } catch (WebColorException $e) {
             // This shouldn't happen
-            common_log(LOG_ERR, "Unable to create color for design $this->id.",
+            common_log(LOG_ERR, "Unable to create web color for $color",
                 __FILE__);
             return null;
         }
@@ -155,9 +155,20 @@ class Design extends Memcached_DataObject
             $server = common_config('site', 'server');
         }
 
-        // XXX: protocol
+        $ssl = common_config('background', 'ssl');
 
-        return 'http://'.$server.$path.$filename;
+        if (is_null($ssl)) { // null -> guess
+            if (common_config('site', 'ssl') == 'always' &&
+                !common_config('background', 'server')) {
+                $ssl = true;
+            } else {
+                $ssl = false;
+            }
+        }
+
+        $protocol = ($ssl) ? 'https' : 'http';
+
+        return $protocol.'://'.$server.$path.$filename;
     }
 
     function setDisposition($on, $off, $tile)
@@ -204,7 +215,10 @@ class Design extends Memcached_DataObject
                            'disposition');
 
             foreach ($attrs as $attr) {
-                $siteDesign->$attr = common_config('design', $attr);
+                $val = common_config('design', $attr);
+                if ($val !== false) {
+                    $siteDesign->$attr = $val;
+                }
             }
         }