From b1f3c3bee814ee9fadd4145ade9d9542211d2ee4 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 28 Oct 2013 10:28:58 -0400
Subject: [PATCH] Fixed saving contact birthday/anniversary dates before 01-01-1970

---
 program/include/rcmail_output_html.php |   37 ++++++++++++++++++++++---------------
 1 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php
index 39f79d1..0c95fbc 100644
--- a/program/include/rcmail_output_html.php
+++ b/program/include/rcmail_output_html.php
@@ -925,16 +925,18 @@
                 else if ($object == 'logo') {
                     $attrib += array('alt' => $this->xml_command(array('', 'object', 'name="productname"')));
 
-                    if (is_array($this->config->get('skin_logo'))) {
-                       if (isset($attrib['type']) && array_key_exists($attrib['type'], $this->config->get('skin_logo'))) {
-                           $attrib['src'] = $this->config->get('skin_logo')[$attrib['type']];
-                       }
-                       elseif (array_key_exists('default', $this->config->get('skin_logo'))) {
-                           $attrib['src'] = $this->config->get('skin_logo')['default'];
-                       }
-                    }
-                    elseif ($logo = $this->config->get('skin_logo')) {
-                        $attrib['src'] = $logo;
+                    if ($logo = $this->config->get('skin_logo')) {
+                        if (is_array($logo)) {
+                            if ($template_logo = $logo[$this->template_name]) {
+                                $attrib['src'] = $template_logo;
+                            }
+                            elseif ($template_logo = $logo['*']) {
+                                $attrib['src'] = $template_logo;
+                            }
+                        }
+                        else {
+                            $attrib['src'] = $logo;
+                        }
                     }
 
                     $content = html::img($attrib);
@@ -1053,7 +1055,7 @@
         // these commands can be called directly via url
         $a_static_commands = array('compose', 'list', 'preferences', 'folders', 'identities');
 
-        if (!($attrib['command'] || $attrib['name'])) {
+        if (!($attrib['command'] || $attrib['name'] || $attrib['href'])) {
             return '';
         }
 
@@ -1182,7 +1184,7 @@
 
         // generate html code for button
         if ($btn_content) {
-            $attrib_str = html::attrib_string($attrib, $link_attrib);
+            $attrib_str = html::attrib_string($attrib, array_merge(html::$common_attrib, $link_attrib));
             $out = sprintf('<a%s>%s</a>', $attrib_str, $btn_content);
         }
 
@@ -1278,7 +1280,12 @@
      */
     public function _write($templ = '', $base_path = '')
     {
-        $output = empty($templ) ? $this->default_template : trim($templ);
+        $output = trim($templ);
+
+        if (empty($output)) {
+            $output   = $this->default_template;
+            $is_empty = true;
+        }
 
         // set default page title
         if (empty($this->pagetitle)) {
@@ -1369,8 +1376,8 @@
         }
 
         // add css files in head, before scripts, for speed up with parallel downloads
-        if (!empty($this->css_files) && 
-            (($pos = stripos($output, '<script ')) || ($pos = stripos($output, '</head>')))
+        if (!empty($this->css_files) && !$is_empty
+            && (($pos = stripos($output, '<script ')) || ($pos = stripos($output, '</head>')))
         ) {
             $css = '';
             foreach ($this->css_files as $file) {

--
Gitblit v1.9.1