From 4daaf297478aa66eb359e2989d729d98c3f45793 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 16 Sep 2011 07:37:44 -0400
Subject: [PATCH] - Fix default folders settings  (according to namespaces) for new users too

---
 program/include/rcube_html_page.php |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/program/include/rcube_html_page.php b/program/include/rcube_html_page.php
index 0cceb89..21301e3 100644
--- a/program/include/rcube_html_page.php
+++ b/program/include/rcube_html_page.php
@@ -212,19 +212,19 @@
         if (!empty($this->scripts['docready'])) {
             $this->add_script('$(document).ready(function(){ ' . $this->scripts['docready'] . "\n});", 'foot');
         }
-        
+
         if (is_array($this->script_files['foot'])) {
             foreach ($this->script_files['foot'] as $file) {
                 $page_footer .= sprintf($this->script_tag_file, $file);
             }
         }
 
-        if (!empty($this->scripts['foot'])) {
-            $page_footer .= sprintf($this->script_tag, $this->scripts['foot']);
+        if (!empty($this->footer)) {
+            $page_footer .= $this->footer . "\n";
         }
 
-        if (!empty($this->footer)) {
-            $page_footer .= $this->footer;
+        if (!empty($this->scripts['foot'])) {
+            $page_footer .= sprintf($this->script_tag, $this->scripts['foot']);
         }
 
         // find page header
@@ -246,7 +246,7 @@
 
         // add page hader
         if ($hpos) {
-            $output = substr($output,0,$hpos) . $page_header . substr($output,$hpos,strlen($output));
+            $output = substr_replace($output, $page_header, $hpos, 0);
         }
         else {
             $output = $page_header . $output;
@@ -254,7 +254,7 @@
 
         // add page footer
         if (($fpos = strripos($output, '</body>')) || ($fpos = strripos($output, '</html>'))) {
-            $output = substr($output, 0, $fpos) . "$page_footer\n" . substr($output, $fpos);
+            $output = substr_replace($output, $page_footer."\n", $fpos, 0);
         }
         else {
             $output .= "\n".$page_footer;
@@ -268,7 +268,7 @@
             foreach ($this->css_files as $file) {
                 $css .= sprintf($this->link_css_file, $file);
             }
-            $output = substr($output, 0, $pos) . $css . substr($output, $pos);
+            $output = substr_replace($output, $css, $pos, 0);
         }
 
         $this->base_path = $base_path;
@@ -289,7 +289,7 @@
                 echo $hook['content'];
         }
     }
-    
+
     /**
      * Callback function for preg_replace_callback in write()
      *

--
Gitblit v1.9.1