<?php
// File: $Id: admin.php,v 1.21 2005/02/04 06:30:16 jorg Exp $
// ----------------------------------------------------------------------
// PostNuke Content Management System
// Copyright (C) 2001 by the PostNuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Francisco Burzi
// Purpose of file:
// ----------------------------------------------------------------------

// include base api
include 'includes/pnAPI.php';

// start PN
pnInit();

// Get variables
list($module,
     $func,
     $op,
     $name,
     $file,
     $type) = pnVarCleanFromInput('module',
                                  'func',
                                  'op',
                                  'name',
                                  'file',
                                  'type');

// get the module information
$modinfo = pnModGetInfo(pnModGetIDFromName($module));
if (file_exists($file='modules/' . pnVarPrepForOS($modinfo['directory']) . '/admin.php')) 
{
	/* load the legacy includes */
	include_once('modules/Admin/pnlegacy/tools.php');

	 // set a constant so we can check the corrct entry point later
	define('LOADED_AS_MODULE','1');

    $ModName = $module;
    include $file;
 
 	// each individual module admin panel loads it language - markwest
	//modules_get_language();
	modules_get_manual();
 
    if (substr($module,0,3)=='NS-') {
        $function = substr($module,3).'_admin_';
    } else {
        $function = $module.'_admin_';
    }
 
    $function_op = $function.$op;
    $function_main = $function.'main';
    $var = array_merge($_GET,$_POST);

    if (function_exists($function_op)) {
        $function_op($var);
    } elseif (function_exists($function_main)) {
        $function_main($var);
    } else {
    	pnSessionSetVar('errormsg', "error : admin_execute($file,$function_op)");
		pnRedirect(pnModURL('Admin', 'admin','adminpanel'));
    }
} else {
	pnRedirect(pnModURL('Admin', 'admin','adminpanel'));
}

?>