<?php

/*
 
 File: menu.php3
 $Author: rkrusty $
 $Revision: 1.47 $
 $Date: 1999/04/14 04:54:57 $
 
 IMP: Copyright 1999 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.
 
 */

function menu_item ($url, $text) { 
   echo '<br>&nbsp;&nbsp;&nbsp;<a href="' . $url . '" target="impmain">' . $text . '</a>' . "\n";
}

function manager_menu_item ($action_id, $text) {
   menu_item("manager.php3?action=$action_id", $text);
}


$need_horde_db = 0;
$db_lib_loaded = 0;
if (!defined("HORDE_LIB")) include ('../lib/horde.lib');
require( './lib/imp.lib' );           /* IMPlib is the IMP function library  */
require( './config/defaults.php3' );  /* Defaults configuration file */
require( '../config/horde.php3' );

/* Html styles configuration */
require('./config/html.php3');
/* Mailbox configuration */
require('./config/mailbox.php3');
/* include mime and language configuration */
require('./config/mime.php3');
require('./config/lang.php3');

$language = select_lang();
require( "./locale/$language/menu.lang" );
require( "./locale/local/menu.lang" );

error_reporting($default->error_level);  /* set error level from imp.lib   */

/* send headers to ensure that the page will reload correctly. */
caching_headers();

function set_menu($text) {
  if(ereg("(.*)<(.*)>(.*)", $text, $regs)) {
    $text = "<br><a href=\"" . $regs[1] . "\" target=\"_blank\"><img border=\"0\" hspace=\"2\" align=\"middle\" src=\"./graphics/" . $regs[3] . "\" width=\"18\" height=\"18\" alt=\"*\">" . $regs[2] . "</a>";
  }
  return $text;
}

$extra_menus = '';
$temp = Array();
exec( 'cat ./config/menu.txt', $temp );
for($j = 0; $j < count($temp); $j++) {
  $extra_menus .= set_menu($temp[$j]);
}


if (!isset($menu)) $menu = IMPMENU_DORMANT;
if ($menu == IMPMENU_DORMANT) $title = $lang->login_again;

$sidebar = true;
require("$default->include_dir/doctype.inc");
require("$default->include_dir/generic-header.inc");
require('./lib/js/open_compose_win.js');
require('./lib/js/open_contacts.js');
if ($menu != IMPMENU_BLANK) {
  include("$default->include_dir/menu/main.inc");
}
include("$default->include_dir/generic-footer.inc");

?>
