From 85d61475aab64a08ba67cdedfcb795af4ce4850d Mon Sep 17 00:00:00 2001
From: Meitar Moscovitz <meitarm@gmail.com>
Date: Mon, 16 Mar 2009 17:42:24 -0400
Subject: [PATCH] Output code to explicitly reference favicons.

This makes favicons work when Laconica is not installed at a web
server's DOCUMENT_ROOT. I've also added the capability to override the
Laconica default favicon.ico file with a theme-specific one simply by
dropping a themed favicon.ico in the appropriate theme directory.
---
 lib/action.php | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lib/action.php b/lib/action.php
index 975c2bfcb8..285eae59ab 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -112,6 +112,7 @@ class Action extends HTMLOutputter // lawsuit
         // XXX: attributes (profile?)
         $this->elementStart('head');
         $this->showTitle();
+        $this->showShortcutIcon();
         $this->showStylesheets();
         $this->showScripts();
         $this->showOpenSearch();
@@ -147,6 +148,22 @@ class Action extends HTMLOutputter // lawsuit
         return _("Untitled page");
     }
 
+    /**
+     * Show themed shortcut icon
+     *
+     * @return nothing
+     */
+    function showShortcutIcon()
+    {
+        if (is_readable(INSTALLDIR . '/theme/' . common_config('site', 'theme') . '/favicon.ico')) {
+            $this->element('link', array('rel' => 'shortcut icon',
+                                         'href' => theme_path('favicon.ico')));
+        } else {
+            $this->element('link', array('rel' => 'shortcut icon',
+                                         'href' => common_path('favicon.ico')));
+        }
+    }
+
     /**
      * Show stylesheets
      *
-- 
2.39.5