<?php
/*
 * $Horde: turba/index.php,v 1.15.2.5 2003/01/03 12:48:58 jan Exp $
 *
 * Turba: Copyright 2000-2003 Charles J. Hagenbuch <chuck@horde.org>
 *
 * You should have received a copy of the GNU Public
 * License along with this package; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

define('TURBA_BASE', dirname(__FILE__));
$turba_configured = (@is_readable(TURBA_BASE . '/config/conf.php') &&
                     @is_readable(TURBA_BASE . '/config/attributes.php') &&
                     @is_readable(TURBA_BASE . '/config/html.php') &&
                     @is_readable(TURBA_BASE . '/config/prefs.php') &&
                     @is_readable(TURBA_BASE . '/config/sources.php'));

if ($turba_configured) {
    include_once TURBA_BASE . '/lib/base.php';

    $uri = $prefs->getValue('initial_page');
    if (!empty($_SERVER['QUERY_STRING'])) {
        $uri .= '?' . $_SERVER['QUERY_STRING'];
    }

    header('Location: ' . Horde::applicationUrl($uri, true));
    echo "\n";
    exit;
} else {
    /* Turba isn't configured */
    include TURBA_BASE . '/templates/index/notconfigured.inc';
}
