<?php
// $Id: header.php,v 1.4 2005/10/28 11:56:02 ohwada Exp $

// 2005-09-04 K.OHWADA
// BUG 2932: dont work correctly when register_long_arrays = off

// 2005-01-20 K.OHWADA
// use snoopy.php
// add $weblinksConfig

// 2004-12-31 K.OHWADA
// $xoops_module_name

// 2004-11-28 K.OHWADA
// use file_include.php

// 2004/08/10 K.OHWADA
// use class weblinksCatlink, BaseLanguage
// enable to install this module two or more. 
// use system lang file

//================================================================
// header
// use class
// 2004/01/23 K.OHWADA
//================================================================

include "../../mainfile.php";
include_once XOOPS_ROOT_PATH."/class/module.errorhandler.php";
include_once XOOPS_ROOT_PATH."/class/xoopstree.php";
include_once XOOPS_ROOT_PATH."/class/snoopy.php";

// enable to install this module two or more. 
// dir name
$MODULE_DIRNAME = $xoopsModule->dirname();
$MODULE_ROOT    = XOOPS_ROOT_PATH."/modules/".$MODULE_DIRNAME;
$MODULE_URL     = XOOPS_URL."/modules/".$MODULE_DIRNAME;
$XOOPS_LANGUAGE = $xoopsConfig['language'];

// include file
include_once $MODULE_ROOT."/include/file_include.php";
file_include_weblinks( $MODULE_DIRNAME, $XOOPS_LANGUAGE );
file_include_system_lang( 'search.php', $XOOPS_LANGUAGE );
file_include_system_lang( 'user.php',   $XOOPS_LANGUAGE );

// config
$tbl_config     =& table_config::getInstance();
$weblinksConfig = $tbl_config->get_config();

// class
$tbl_link     =& table_link::getInstance();
$tbl_category =& table_category::getInstance();
$tbl_catlink  =& table_catlink::getInstance();
$tbl_atomfeed =& table_atomfeed::getInstance();
$lang         =& language_convert::getInstance();

$myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object

// system parameter

// BUG 2932: dont work correctly when register_long_arrays = off
$server_remote_addr = getenv("REMOTE_ADDR");

$xoops_site_url    = XOOPS_URL.'/';
$xoops_site_name   = $xoopsConfig['sitename'];
$xoops_site_email  = $xoopsConfig['adminmail'];

$xoops_user_uid      = 0;
$xoops_user_uname    = '';
$xoops_user_email    = '';
$xoops_user_groups   = '';
$is_xoops_user_admin = false;

if ( is_object($xoopsUser) )
{
	$xoops_user_uid    = $xoopsUser->getVar('uid');
	$xoops_user_uname  = $xoopsUser->getVar('uname');
	$xoops_user_email  = $xoopsUser->getVar('email');
	$xoops_user_groups = $xoopsUser->getGroups();

	if ( $xoopsUser->isAdmin( $xoopsModule->mid() )) 
	{
		$is_xoops_user_admin = true;
	}

}
else
{
	$xoops_user_groups = array( XOOPS_GROUP_ANONYMOUS );
}

$xoops_module_mid  = $xoopsModule->getVar('mid');
$xoops_module_name = $xoopsModule->getVar('name');
if ( $xoops_module_name )
{
	$MODULE_NAME = $xoops_module_name;
}
else
{
	$MODULE_NAME = WEBLINKS_NAME;
}


?>