From eea11ecdde396ffc261c20ab930120612260d931 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Mon, 21 Apr 2014 10:39:19 -0400
Subject: [PATCH] Move rcube_installer class to include/rcmail_installer in order to remain accessible by the update script even if the installer directory was removed

---
 program/lib/Roundcube/rcube.php    |    4 ++--
 bin/update.sh                      |    3 +--
 installer/config.php               |    2 +-
 installer/check.php                |    2 +-
 program/include/rcmail_install.php |   20 ++++++++++----------
 installer/test.php                 |    2 +-
 installer/index.php                |    3 +--
 7 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/bin/update.sh b/bin/update.sh
index d35e1eb..91af641 100755
--- a/bin/update.sh
+++ b/bin/update.sh
@@ -22,7 +22,6 @@
 define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
 
 require_once INSTALL_PATH . 'program/include/clisetup.php';
-require_once INSTALL_PATH . 'installer/rcube_install.php';
 
 // get arguments
 $opts = rcube_utils::get_opt(array('v' => 'version', 'y' => 'accept'));
@@ -36,7 +35,7 @@
     $opts['version'] = RCMAIL_VERSION;
 }
 
-$RCI = rcube_install::get_instance();
+$RCI = rcmail_install::get_instance();
 $RCI->load_config();
 
 if ($RCI->configured) {
diff --git a/installer/check.php b/installer/check.php
index d4c3f66..31b4c29 100644
--- a/installer/check.php
+++ b/installer/check.php
@@ -1,6 +1,6 @@
 <?php
 
-if (!class_exists('rcube_install') || !is_object($RCI)) {
+if (!class_exists('rcmail_install', false) || !is_object($RCI)) {
     die("Not allowed! Please open installer/index.php instead.");
 }
 
diff --git a/installer/config.php b/installer/config.php
index 8b98dbe..39bf48e 100644
--- a/installer/config.php
+++ b/installer/config.php
@@ -1,6 +1,6 @@
 <?php
 
-if (!class_exists('rcube_install') || !is_object($RCI)) {
+if (!class_exists('rcmail_install', false) || !is_object($RCI)) {
     die("Not allowed! Please open installer/index.php instead.");
 }
 
diff --git a/installer/index.php b/installer/index.php
index d90c4f9..044eb3f 100644
--- a/installer/index.php
+++ b/installer/index.php
@@ -50,14 +50,13 @@
 set_include_path($include_path);
 
 require_once 'Roundcube/bootstrap.php';
-require_once 'rcube_install.php';
 // deprecated aliases (to be removed)
 require_once 'bc.php';
 
 if (function_exists('session_start'))
   session_start();
 
-$RCI = rcube_install::get_instance();
+$RCI = rcmail_install::get_instance();
 $RCI->load_config();
 
 if (isset($_GET['_getconfig'])) {
diff --git a/installer/test.php b/installer/test.php
index 5d28d5f..7a6b1b6 100644
--- a/installer/test.php
+++ b/installer/test.php
@@ -1,6 +1,6 @@
 <?php
 
-if (!class_exists('rcube_install') || !is_object($RCI)) {
+if (!class_exists('rcmail_install', false) || !is_object($RCI)) {
     die("Not allowed! Please open installer/index.php instead.");
 }
 
diff --git a/installer/rcube_install.php b/program/include/rcmail_install.php
similarity index 96%
rename from installer/rcube_install.php
rename to program/include/rcmail_install.php
index b047156..ca06f10 100644
--- a/installer/rcube_install.php
+++ b/program/include/rcmail_install.php
@@ -2,10 +2,10 @@
 
 /*
  +-----------------------------------------------------------------------+
- | rcube_install.php                                                     |
+ | rcmail_install.php                                                    |
  |                                                                       |
  | This file is part of the Roundcube Webmail package                    |
- | Copyright (C) 2008-2012, The Roundcube Dev Team                       |
+ | Copyright (C) 2008-2014, The Roundcube Dev Team                       |
  |                                                                       |
  | Licensed under the GNU General Public License version 3 or            |
  | any later version with exceptions for skins & plugins.                |
@@ -21,7 +21,7 @@
  * @package  Roundcube
  * @author Thomas Bruederli
  */
-class rcube_install
+class rcmail_install
 {
   var $step;
   var $is_post = false;
@@ -75,7 +75,7 @@
     static $inst;
 
     if (!$inst)
-      $inst = new rcube_install();
+      $inst = new rcmail_install();
 
     return $inst;
   }
@@ -162,7 +162,7 @@
     $value = $this->config[$name];
 
     if ($name == 'des_key' && !$this->configured && !isset($_REQUEST["_$name"]))
-      $value = rcube_install::random_key(24);
+      $value = self::random_key(24);
 
     return $value !== null && $value !== '' ? $value : $default;
   }
@@ -214,7 +214,7 @@
         $value = '';
       }
       else if ($prop == 'default_host' && is_array($value)) {
-        $value = rcube_install::_clean_array($value);
+        $value = self::_clean_array($value);
         if (count($value) <= 1)
           $value = $value[0];
       }
@@ -251,7 +251,7 @@
     foreach ($config as $prop => $value) {
       // copy option descriptions from existing config or defaults.inc.php
       $out .= $this->comments[$prop];
-      $out .= "\$config['$prop'] = " . rcube_install::_dump_var($value, $prop) . ";\n\n";
+      $out .= "\$config['$prop'] = " . self::_dump_var($value, $prop) . ";\n\n";
     }
 
     return $out;
@@ -451,9 +451,9 @@
   function check_mime_detection()
   {
     $files = array(
-      'installer/images/roundcube_logo.png' => 'image/png',
+      'skins/larry/images/roundcube_logo.png' => 'image/png',
       'program/resources/blank.tif' => 'image/tiff',
-      'skins/larry/images/buttons.gif' => 'image/gif',
+      'program/resources/blocked.gif' => 'image/gif',
       'skins/larry/README' => 'text/plain',
     );
 
@@ -689,7 +689,7 @@
         }
 
         if ($isnum)
-          return 'array(' . join(', ', array_map(array('rcube_install', '_dump_var'), $var)) . ')';
+          return 'array(' . join(', ', array_map(array('rcmail_install', '_dump_var'), $var)) . ')';
       }
     }
 
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
index 7d28dce..7079299 100644
--- a/program/lib/Roundcube/rcube.php
+++ b/program/lib/Roundcube/rcube.php
@@ -1207,8 +1207,8 @@
         }
 
         // installer
-        if (class_exists('rcube_install', false)) {
-            $rci = rcube_install::get_instance();
+        if (class_exists('rcmail_install', false)) {
+            $rci = rcmail_install::get_instance();
             $rci->raise_error($arg);
             return;
         }

--
Gitblit v1.9.1