From 7f79e22eb4baa44d17d34beddae48b1bfd18eaff Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 30 Nov 2011 05:48:17 -0500
Subject: [PATCH] - Set sizelimit of main search function for vlv_search to page_size.   It was requested as performance improvement, but I wasn't able to confirm this. However it doesn't break anything.

---
 program/include/rcube_html_page.php |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/program/include/rcube_html_page.php b/program/include/rcube_html_page.php
index 5b56ccc..21301e3 100644
--- a/program/include/rcube_html_page.php
+++ b/program/include/rcube_html_page.php
@@ -5,7 +5,7 @@
  | program/include/rcube_html_page.php                                   |
  |                                                                       |
  | This file is part of the Roundcube PHP suite                          |
- | Copyright (C) 2005-2009, The Roundcube Dev Team                       |
+ | Copyright (C) 2005-2011 The Roundcube Dev Team                       |
  | Licensed under the GNU GPL                                            |
  |                                                                       |
  | CONTENTS:                                                             |
@@ -33,7 +33,7 @@
     protected $charset = RCMAIL_CHARSET;
 
     protected $script_tag_file = "<script type=\"text/javascript\" src=\"%s\"></script>\n";
-    protected $script_tag  =  "<script type=\"text/javascript\">\n/* <![CDATA[ */\n%s\n/* ]]> */\n</script>";
+    protected $script_tag  =  "<script type=\"text/javascript\">\n/* <![CDATA[ */\n%s\n/* ]]> */\n</script>\n";
     protected $link_css_file = "<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" />\n";
     protected $default_template = "<html>\n<head><title></title></head>\n<body></body>\n</html>";
 
@@ -208,18 +208,23 @@
             $page_header .= $this->header;
         }
 
+        // put docready commands into page footer
+        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
@@ -241,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;
@@ -249,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;
@@ -263,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;
@@ -284,7 +289,7 @@
                 echo $hook['content'];
         }
     }
-    
+
     /**
      * Callback function for preg_replace_callback in write()
      *

--
Gitblit v1.9.1