From dc088e25c2e96969705de7424bf18390b1505354 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Sun, 25 Nov 2012 11:49:42 -0500
Subject: [PATCH] Fix installer to work with the new framework architecture

---
 /dev/null                   |   56 ----------------------------
 installer/rcube_install.php |    6 +-
 installer/test.php          |    4 +-
 installer/index.php         |   12 +++---
 4 files changed, 11 insertions(+), 67 deletions(-)

diff --git a/installer/index.php b/installer/index.php
index 5e7d318..40dabc8 100644
--- a/installer/index.php
+++ b/installer/index.php
@@ -40,8 +40,8 @@
 ini_set('display_errors', 1);
 
 define('INSTALL_PATH', realpath(dirname(__FILE__) . '/../').'/');
-define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config');
-define('RCMAIL_CHARSET', 'UTF-8');
+define('RCUBE_INSTALL_PATH', INSTALL_PATH);
+define('RCUBE_CONFIG_DIR', INSTALL_PATH . 'config');
 
 $include_path  = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR;
 $include_path .= INSTALL_PATH . 'program' . PATH_SEPARATOR;
@@ -50,10 +50,10 @@
 
 set_include_path($include_path);
 
-require_once 'utils.php';
-require_once 'rcube_shared.inc';
+require_once 'Roundcube/bootstrap.php';
+require_once 'rcube_install.php';
 // deprecated aliases (to be removed)
-require_once 'rcube_bc.inc';
+require_once 'bc.php';
 
 session_start();
 
@@ -123,7 +123,7 @@
   if ($RCI->configured && !$RCI->getprop('enable_installer') && !$_SESSION['allowinstaller']) {
     // header("HTTP/1.0 404 Not Found");
     echo '<h2 class="error">The installer is disabled!</h2>';
-    echo '<p>To enable it again, set <tt>$rcmail_config[\'enable_installer\'] = true;</tt> in RCMAIL_CONFIG_DIR/main.inc.php</p>';
+    echo '<p>To enable it again, set <tt>$rcmail_config[\'enable_installer\'] = true;</tt> in RCUBE_CONFIG_DIR/main.inc.php</p>';
     echo '</div></body></html>';
     exit;
   }
diff --git a/installer/rcube_install.php b/installer/rcube_install.php
index e120366..b3208f0 100644
--- a/installer/rcube_install.php
+++ b/installer/rcube_install.php
@@ -109,12 +109,12 @@
    */
   function _load_config($suffix)
   {
-    if (is_readable($main_inc = RCMAIL_CONFIG_DIR . '/main.inc' . $suffix)) {
+    if (is_readable($main_inc = RCUBE_CONFIG_DIR . '/main.inc' . $suffix)) {
       include($main_inc);
       if (is_array($rcmail_config))
         $this->config += $rcmail_config;
     }
-    if (is_readable($db_inc = RCMAIL_CONFIG_DIR . '/db.inc'. $suffix)) {
+    if (is_readable($db_inc = RCUBE_CONFIG_DIR . '/db.inc'. $suffix)) {
       include($db_inc);
       if (is_array($rcmail_config))
         $this->config += $rcmail_config;
@@ -149,7 +149,7 @@
    */
   function create_config($which, $force = false)
   {
-    $out = @file_get_contents(RCMAIL_CONFIG_DIR . "/{$which}.inc.php.dist");
+    $out = @file_get_contents(RCUBE_CONFIG_DIR . "/{$which}.inc.php.dist");
 
     if (!$out)
       return '[Warning: could not read the config template file]';
diff --git a/installer/test.php b/installer/test.php
index 28eb769..836ef13 100644
--- a/installer/test.php
+++ b/installer/test.php
@@ -3,8 +3,8 @@
 <h3>Check config files</h3>
 <?php
 
-$read_main = is_readable(RCMAIL_CONFIG_DIR.'/main.inc.php');
-$read_db = is_readable(RCMAIL_CONFIG_DIR.'/db.inc.php');
+$read_main = is_readable(RCUBE_CONFIG_DIR.'/main.inc.php');
+$read_db = is_readable(RCUBE_CONFIG_DIR.'/db.inc.php');
 
 if ($read_main && !empty($RCI->config)) {
   $RCI->pass('main.inc.php');
diff --git a/installer/utils.php b/installer/utils.php
deleted file mode 100644
index 0e6cfec..0000000
--- a/installer/utils.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-/*
- +-------------------------------------------------------------------------+
- | Roundcube Webmail installer utilities                                   |
- |                                                                         |
- | Copyright (C) 2005-2011, The Roundcube Dev Team                         |
- |                                                                         |
- | Licensed under the GNU General Public License version 3 or              |
- | any later version with exceptions for skins & plugins.                  |
- | See the README file for a full license statement.                       |
- |                                                                         |
- +-------------------------------------------------------------------------+
- | Author: Thomas Bruederli <roundcube@gmail.com>                          |
- +-------------------------------------------------------------------------+
-*/
-
-/**
- * Use PHP5 autoload for dynamic class loading
- * (copy from program/include/iniset.php)
- */
-function __autoload($classname)
-{
-    $filename = preg_replace(
-        array(
-            '/Mail_(.+)/',
-            '/Net_(.+)/',
-            '/Auth_(.+)/',
-            '/^html_.+/',
-            '/^utf8$/'
-        ),
-        array(
-            'Mail/\\1',
-            'Net/\\1',
-            'Auth/\\1',
-            'html',
-            'utf8.class'
-        ),
-        $classname
-    );
-    include_once $filename. '.php';
-}
-
-/**
- * Local callback function for PEAR errors
- */
-function __pear_error($err)
-{
-    rcmail::raise_error(array(
-        'code' => $err->getCode(),
-        'message' => $err->getMessage(),
-    ));
-}
-
-// set PEAR error handling (will also load the PEAR main class)
-PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, '__pear_error');

--
Gitblit v1.9.1