'init' && !pnModAvailable($modinfo['name'])) {
// itevo, mna: set an appropriate http error message
header("HTTP/1.0 404 Not Found");
// /itevo;
include ('header.php');
echo 'Module ' . pnVarPrepForDisplay($module) . ' not available';
include ('footer.php');
if ($v4bProf) {
xdebug_dump_function_profile();
exit;
}
}
if ($modinfo['type'] == 2 || $modinfo['type'] == 3)
{
// New-new style of loading modules
if (empty($type)) {
$type = 'user';
}
if (empty($func)) {
$func = 'main';
}
if (!isset($arguments)) {
$arguments = array();
}
// we need to force the mod load if we want to call a modules interactive init
// function because the modules is not active right now
$force_modload = ($type=='init') ? true : false;
// it should be $module not $name [class007]
if (pnModLoad($modinfo['name'], $type, $force_modload)) {
// V4B RNG Start
global $v4bConfig;
if ($v4bConfig['V4B_CONFIG_USE_TRANSACTIONS'])
{
$dbConn = pnDBGetConn(true);
$dbConn->StartTrans();
}
// V4B RNG End
// Run the function
$return = pnModFunc($modinfo['name'], $type, $func, $arguments);
// V4B RNG Start
if ($v4bConfig['V4B_CONFIG_USE_TRANSACTIONS'])
{
if ($dbConn->HasFailedTrans())
$return = 'Transaction failed ... rollback!
' . $return;
$dbConn->CompleteTrans();
}
// V4B RNG End
} else {
$return = false;
}
// Sort out return of function. Can be
// true - finished
// false - display error msg
// text - return information
if ($return !== true) {
include_once('header.php');
if ($return === false) {
// Failed to load the module
// itevo, mna: set an appropriate http error message
header("HTTP/1.0 404 Not Found");
// /itevo;
echo 'Failed to load module ' . pnVarPrepForDisplay($module) .' (at function: "'. pnVarPrepForDisplay($func).'")';
} elseif (is_string($return) && strlen($return) > 1) {
// Text
echo $return;
} elseif (is_array($return)) {
$pnRender = new pnRender($modinfo['name']);
$pnRender->assign($return);
if (isset($return['template'])) {
echo $pnRender->fetch($return['template']);
} else {
$modname = strtolower($modinfo['name']);
$type = strtolower($type);
$func = strtolower($func);
echo $pnRender->fetch("{$modname}_{$type}_{$func}.htm");
}
} else {
echo 'Function ' . pnVarPrepForDisplay($func) . ' in module ' . pnVarPrepForDisplay($module) .' returned.';
}
include_once('footer.php');
}
} else {
// Old-old style of loading modules
if (empty($file)) {
$file = 'index';
}
define('LOADED_AS_MODULE', '1');
// added for the module/system seperation [class007]
if (file_exists('modules/' . pnVarPrepForOS($modinfo['directory']) . '/' . pnVarPrepForOS($file) . '.php')) {
include 'modules/' . pnVarPrepForOS($modinfo['directory']) . '/' . pnVarPrepForOS($file) . '.php';
} else {
// Failed to load the module
// itevo, mna: set an appropriate http error message
header("HTTP/1.0 404 Not Found");
// /itevo;
include ('header.php');
echo 'Failed to load module ' . pnVarPrepForDisplay($modinfo['name']) . '';
include ('footer.php');
}
}
if ($v4bProf) {
xdebug_dump_function_profile($v4bProf);
}
?>