<?php // File: $Id: modules.php,v 1.14.2.5 2002/07/19 15:29:52 miko Exp $ $Name:  $
// ----------------------------------------------------------------------
// Original Author of file: Francisco Burzi
// Purpose of file: Load the module in a safe and friendly enviornment
// ----------------------------------------------------------------------
switch ($op) {
    case 'modload':
        define("LOADED_AS_MODULE","1");
        include_once 'includes/pnAPI.php';
	if(!function_exists('pnsessionsetup')){
            pnInit();
	}
        include_once 'includes/legacy.php';
// eugenio themeover 20020413
//        pnThemeLoad();
        include 'modules/' . pnVarPrepForOS($name) . '/' . pnVarPrepForOS($file) . '.php';
        if (function_exists('session_write_close')) {
            session_write_close();
        } else {
            // Hack for old versions of PHP with bad session save
            $sessvars = '';
            foreach ($GLOBALS as $k => $v) {
                if ((preg_match('/^PNSV/', $k)) &&
                    (isset($v))) {
                    $sessvars .= "$k|" . serialize($v);
                }
            }
            pnSessionWrite(session_id(), $sessvars);
        }

        break;
    default:
        die ("Sorry, you can't access this file directly...");
        break;
}
?>