<?php // File: $Id: modules.php,v 1.14.2.3 2002/05/16 12:03:34 eugeniobaldi 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 'includes/pnAPI.php';
        pnInit();
        include '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;
}
?>