<?php
// $Id: admin_header_min.php,v 1.4 2007/11/15 11:29:09 ohwada Exp $

// 2007-11-11 K.OHWADA
// divid from admin_header.php
// minimum to necessary 

//=========================================================
// WebLinks Module
// admin header
// 2004-10-13 K.OHWADA
//=========================================================

include '../../../include/cp_header.php';

//---------------------------------------------------------
// weblinks constant
//---------------------------------------------------------
if( !defined('WEBLINKS_DIRNAME') )
{
	define('WEBLINKS_DIRNAME', $xoopsModule->dirname() );
}

if( !defined('WEBLINKS_ROOT_PATH') )
{
	define('WEBLINKS_ROOT_PATH', XOOPS_ROOT_PATH.'/modules/'.WEBLINKS_DIRNAME );
}

if( !defined('WEBLINKS_URL') )
{
	define('WEBLINKS_URL', XOOPS_URL.'/modules/'.WEBLINKS_DIRNAME );
}

include_once WEBLINKS_ROOT_PATH.'/include/weblinks_constant.php';

//---------------------------------------------------------
// system
//---------------------------------------------------------
$XOOPS_LANGUAGE = $xoopsConfig['language'];

//include_once XOOPS_ROOT_PATH.'/class/xoopstree.php';
//include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
//include_once XOOPS_ROOT_PATH.'/class/template.php';
//include_once XOOPS_ROOT_PATH.'/class/snoopy.php';

$is_xoops_user_admin = false;

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

// admin check
if ( !$is_xoops_user_admin )
{
	redirect_header(XOOPS_URL , 1, _NOPERM);
	exit();
}

// system user.php
if (file_exists( XOOPS_ROOT_PATH.'/language/'.$XOOPS_LANGUAGE.'/user.php' )) 
{
	include_once XOOPS_ROOT_PATH.'/language/'.$XOOPS_LANGUAGE.'/user.php';
}
else
{
	include_once XOOPS_ROOT_PATH.'/language/english/user.php';
}

//---------------------------------------------------------
// happy_linux
//---------------------------------------------------------
// start execution time
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/time.php';
$happy_linux_time =& happy_linux_time::getInstance();

if ( !file_exists(XOOPS_ROOT_PATH.'/modules/happy_linux/include/version.php') ) 
{
	xoops_cp_header();
	xoops_error( 'require happy_linux module' );
	xoops_cp_footer();
	exit();
}

// start execution time
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/time.php';
$happy_linux_time =& happy_linux_time::getInstance( true );
if ( WEBLINKS_DEBUG_TIME )
{
	$happy_linux_time->print_lap_time();
}

include_once XOOPS_ROOT_PATH.'/modules/happy_linux/include/version.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/include/memory.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/include/functions.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/include/multibyte.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/include/gtickets.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/api/language.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/api/locate.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/error.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/strings.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/system.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/basic_handler.php';
include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/admin_menu.php';

//include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/object.php';
//include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/object_handler.php';
//include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/html.php';
//include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/form.php';
//include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/form_lib.php';
//include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/post.php';
//include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/highlight.php';
//include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/image_size.php';
//include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/remote_file.php';
//include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/remote_image.php';
//include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/search.php';
//include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/pagenavi.php';
//include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/page_frame.php';
//include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/manage.php';
//include_once XOOPS_ROOT_PATH.'/modules/happy_linux/class/dir.php';

//---------------------------------------------------------
// weblinks
//---------------------------------------------------------
include_once WEBLINKS_ROOT_PATH.'/include/weblinks_version.php';
include_once WEBLINKS_ROOT_PATH.'/include/functions.php';
include_once WEBLINKS_ROOT_PATH.'/class/weblinks_link_bin_handler.php';
include_once WEBLINKS_ROOT_PATH.'/class/weblinks_link_basic_handler.php';

//include_once WEBLINKS_ROOT_PATH.'/plugins/d3forum_sel.php';
//include_once WEBLINKS_ROOT_PATH.'/plugins/forum_sel.php';
//include_once WEBLINKS_ROOT_PATH.'/plugins/album_sel.php';
//include_once WEBLINKS_ROOT_PATH.'/class/weblinks_plugin.php';
//include_once WEBLINKS_ROOT_PATH.'/class/weblinks_link.php';
//include_once WEBLINKS_ROOT_PATH.'/class/weblinks_link_handler.php';
//include_once WEBLINKS_ROOT_PATH.'/class/weblinks_auth.php';
//include_once WEBLINKS_ROOT_PATH.'/class/weblinks_menu.php';
//include_once WEBLINKS_ROOT_PATH.'/class/weblinks_header.php';
//include_once WEBLINKS_ROOT_PATH.'/class/weblinks_gmap.php';
//include_once WEBLINKS_ROOT_PATH.'/class/weblinks_config2_basic_handler.php';

// for main.php
if (file_exists( WEBLINKS_ROOT_PATH.'/language/'.$XOOPS_LANGUAGE.'/main.php' )) 
{
	include_once WEBLINKS_ROOT_PATH.'/language/'.$XOOPS_LANGUAGE.'/main.php';
}
else
{
	include_once WEBLINKS_ROOT_PATH.'/language/english/main.php';
}

// for modinfo.php
if (file_exists( WEBLINKS_ROOT_PATH.'/language/'.$XOOPS_LANGUAGE.'/modinfo.php' )) 
{
	include_once WEBLINKS_ROOT_PATH.'/language/'.$XOOPS_LANGUAGE.'/modinfo.php';
}
else
{
	include_once WEBLINKS_ROOT_PATH.'/language/english/modinfo.php';
}

// compatible to old version
include_once WEBLINKS_ROOT_PATH.'/language/compatible.php';

include_once WEBLINKS_ROOT_PATH.'/admin/admin_functions.php';

// check happy_linux version
if ( HAPPY_LINUX_VERSION < WEBLINKS_HAPPY_LINUX_VERSION ) 
{
	$msg = 'require happy_linux module v'.WEBLINKS_HAPPY_LINUX_VERSION.' or later';
	xoops_cp_header();
	xoops_error( $msg );
	xoops_cp_footer();
	exit();
}

//---------------------------------------------------------
// config
//---------------------------------------------------------
$weblinks_config_handler =& weblinks_get_handler( 'config2_basic', WEBLINKS_DIRNAME );
$weblinks_config_handler->init();
$rss_dirname  = $weblinks_config_handler->get_conf_by_name( 'rss_dirname' );
$rss_use      = $weblinks_config_handler->get_conf_by_name( 'rss_use' );

//include_once XOOPS_ROOT_PATH.'/modules/happy_linux/api/locate.php';
//include_once WEBLINKS_ROOT_PATH.'/class/weblinks_locate.php';

//---------------------------------------------------------
// rssc
//---------------------------------------------------------
if( !defined('WEBLINKS_RSSC_DIRNAME') )
{
	define('WEBLINKS_RSSC_DIRNAME', $rss_dirname);
}

if( !defined('WEBLINKS_RSSC_ROOT_PATH') )
{
	define('WEBLINKS_RSSC_ROOT_PATH', XOOPS_ROOT_PATH.'/modules/'.WEBLINKS_RSSC_DIRNAME);
}

if( !defined('WEBLINKS_RSSC_URL') )
{
	define('WEBLINKS_RSSC_URL', XOOPS_URL.'/modules/'.WEBLINKS_RSSC_DIRNAME);
}

// rssc module install check
$module_handler =& xoops_gethandler('module');
$module =& $module_handler->getByDirname( WEBLINKS_RSSC_DIRNAME );
if ( is_object($module) )
{
// rssc module exists check, if missed to remove files
	if ( file_exists(WEBLINKS_RSSC_ROOT_PATH.'/include/rssc_version.php') ) 
	{
		include_once WEBLINKS_RSSC_ROOT_PATH.'/include/rssc_version.php';

		define('WEBLINKS_RSSC_EXIST', 1);
		if( $rss_use )
		{
			define('WEBLINKS_RSSC_USE', 1);
		}
	}
}

if( !defined('WEBLINKS_RSSC_EXIST') )
{
	define('WEBLINKS_RSSC_EXIST', 0);
}

if( !defined('WEBLINKS_RSSC_USE') )
{
	define('WEBLINKS_RSSC_USE', 0);
}

//if( WEBLINKS_RSSC_EXIST && WEBLINKS_RSSC_USE )
//{
//	include_once WEBLINKS_RSSC_ROOT_PATH.'/api/lang_main.php';
//	include_once WEBLINKS_RSSC_ROOT_PATH.'/api/view.php';
//	include_once WEBLINKS_RSSC_ROOT_PATH.'/api/refresh.php';
//	include_once WEBLINKS_RSSC_ROOT_PATH.'/api/manage.php';
//	include_once WEBLINKS_ROOT_PATH.'/class/weblinks_rssc_handler.php';
//}

?>