Codice PHP:
<?php
include 'includes/pnAPI.php';
pnInit();
// Get variables
list($module,
$func,
$op,
$name,
$file,
$type) = pnVarCleanFromInput('module',
'func',
'op',
'name',
'file',
'type');
// Defaults for variables
if (isset($catid)) {
pnVarCleanFromInput('catid');
}
if (empty($op)) {
$op = "modload";
}
if (empty($name)) {
$name= pnConfigGetVar('startpage');
}
if (empty($type))
{
$type = 'user';
}
if (empty($file))
{
$file="index";
}
// Browser check
$client = $GLOBALS['client'];
if( ($client->browser_is("ie5.5+")) && ($client->property('platform') == "win") ) {
$ie_ok = 1;
} else {
$ie_ok = 0;
}
if (!empty($module))
{
$loadedmod = pnModLoad($module, $type);
if (empty($loadedmod))
{
// Failed to load the module
pnRedirect(pnModURL('Errore', 'admin', 'main', array('op' => 'noexist','modname' => $name)));
break;
}
// Inserted for Encompass
// eugeniobaldi 020826
include ("header.php");
$output = new pnHTML();
$output->StartPage();
// Run the function
$return = pnModFunc($loadedmod, $type, $func);
if (function_exists('session_write_close'))
{
session_write_close();
}
if ((empty($return)) || ($return == false))
{
pnRedirect(pnModURL($module, $type));
} elseif (strlen($return) > 1) {
// Begin expanded pnHTML for RteMulti
if ((pnModGetVar('RteMulti','RteEnable')==1)and(pnModAvailable('RteMulti'))and($ie_ok)) {
include_once( "modules/RteMulti/pnRTEHTML.php" );
$output = new pnRTEHTML();
$my_content = $output->GetOutput();
if (!pnModAPILoad('rtemulti', 'user')) {
$output->Text(_LOADFAILED);
return $output->GetOutput();
}
} else {
$output = new pnHTML();
$output->SetInputMode(_PNH_VERBATIMINPUT);
$output->Text($return);
$my_content = $output->GetOutput();
$output->SetInputMode(_PNH_PARSEINPUT);
include ("footer.php");
}
if (strcmp($func,"print") != 0) {
$output->StartPage();
}
if (class_exists('Encompass'))
{
// <apathy> Headers already started by StartPage();
// also newpnHTML was added to fix layout issues
//include ("header.php");
$output = new pnHTML();
$output->SetInputMode(_PNH_VERBATIMINPUT);
$output->Text($return);
// holder for pnHTML object for Encompass interface
$my_content = $output->GetOutput();
$output->SetInputMode(_PNH_PARSEINPUT);
//
// including for RteMulti
if ((pnModGetVar('RteMulti','RteEnable')==1)and(pnModAvailable('RteMulti'))and($ie_ok)) {
ob_start();
include ("footer.php");
$return = ob_get_contents();
ob_end_clean();
$output = new pnRTEHTML();
ob_start();
$output->ManipulatePage($return);
$output = ob_get_contents();
ob_end_clean();
print $output;
}
} else {
// <mh7> StartPage() has already been called, not needed here
// $output->StartPage();
$output->SetInputMode(_PNH_VERBATIMINPUT);
$output->Text($return);
$output->SetInputMode(_PNH_PARSEINPUT);
$output->EndPage();
// if CE call print-func, then no EndPage and no RTE-manipulation
if (strcmp($func,"print") != 0) {
$output->EndPage();
// including for RteMulti
if ((pnModGetVar('RteMulti','RteEnable')==1)and(pnModAvailable('RteMulti'))and($ie_ok)) {
$output->ManipulatePage();
}
// End including
}
// End CE-print [end part]
$output->PrintPage();
}
}
exit;
} else {
// Old stuff
// Some modifications are needed for RTE in the old stuff also (i.e. Theme: Borobudur)
switch ($op)
{
case 'modload':
define("LOADED_AS_MODULE", "1");
include_once 'includes/pnAPI.php';
if(!function_exists('pnsessionsetup')){
pnInit();
}
include_once 'includes/legacy.php';
if (!file_exists('modules/' . pnVarPrepForOS($name) . '/' . pnVarPrepForOS($file) . '.php')) {
pnRedirect(pnModURL('Errore', 'admin', 'main', array('op' => 'noexist','modname' => $name)));
break;
}
if (!pnModAvailable($name)) {
pnRedirect(pnModURL('Errore', 'admin', 'main', array('op' => 'noactive','modname' => $name)));
break;
}
// include of RTE-class, start buffer
//
if ((pnModGetVar('RteMulti','RteEnable')==1)and(pnModAvailable('RteMulti'))and($ie_ok)) {
include_once( "modules/RteMulti/pnRTEHTML.php" );
ob_start();
}
// End include
//
include 'modules/'.pnVarPrepForOS($name).'/'.pnVarPrepForOS($file).'.php';
//
//
// Begin buffering and manipulating
if ((pnModGetVar('RteMulti','RteEnable')==1)and(pnModAvailable('RteMulti'))and($ie_ok)) {
$return=ob_get_contents();
ob_end_clean();
$output = new pnRTEHTML();
if (!pnModAPILoad('rtemulti', 'user')) {
$output->Text(_LOADFAILED);
return $output->GetOutput();
}
$output->SetInputMode(_PNH_VERBATIMINPUT);
$return = pnModAPIFunc('rtemulti',
'user',
'getinfo',
array('original' => $return,
'modname' => pnVarPrepForOS($name)));
$output->TextHTML($return);
$output->SetInputMode(_PNH_PARSEINPUT);
$output->PrintPage();
} // End manipulating
// End of buffering (that's all !!)
//
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;
}
}
?>