Ich hab die Methode getFrontendModule einmal für meine Zwecke umgebaut und an die Version 3.3.3 angepasst... Hoffe es ist nicht zu sehr Dirty Programming.
Funktioniert so aber bei mir...
Die Änderungen:
PHP-Code:
public static function getFrontendModule($intId, $strColumn='main')
{
if (!strlen($intId) || $intId < 1)
{
header('HTTP/1.1 412 Precondition Failed');
return 'Missing frontend module ID';
}
$objModule = \Database::getInstance()->prepare("SELECT * FROM tl_module WHERE id=?")
->limit(1)
->execute($intId);
if ($objModule->numRows < 1)
{
header('HTTP/1.1 404 Not Found');
return 'Frontend module not found';
}
// Show to guests only
if ($objModule->guests && FE_USER_LOGGED_IN && !BE_USER_LOGGED_IN && !$objModule->protected)
{
header('HTTP/1.1 403 Forbidden');
return 'Forbidden';
}
// Protected element
if (!BE_USER_LOGGED_IN && $objModule->protected)
{
if (!FE_USER_LOGGED_IN)
{
header('HTTP/1.1 403 Forbidden');
return 'Forbidden';
}
$user = \FrontendUser::getInstance();
$groups = deserialize($objModule->groups);
if (!is_array($groups) || count($groups) < 1 || count(array_intersect($groups, $user->groups)) < 1)
{
header('HTTP/1.1 403 Forbidden');
return 'Forbidden';
}
}
$strClass = \Controller::findFrontendModule($objModule->type);
// Return if the class does not exist
if (!class_exists($strClass))
{
$this->log('Module class "'.$GLOBALS['FE_MOD'][$objModule->type].'" (module "'.$objModule->type.'") does not exist', 'Ajax getFrontendModule()', TL_ERROR);
header('HTTP/1.1 404 Not Found');
return 'Frontend module class does not exist';
}
$objModule->typePrefix = 'mod_';
$objModule = new $strClass($objModule, $strColumn);
return $_GET['g'] == '1' ? $objModule->generate() : $objModule->generateAjax();
}
Und aufgerufen wir sie dann oben (Zeile 177 bei mir) anstelle von
PHP-Code:
if ($this->Input->get('action') == 'fmd')
{
$this->output($this->getFrontendModule($this->Input->get('id')));
}
mit
PHP-Code:
if ($this->Input->get('action') == 'fmd')
{
$this->output(self::getFrontendModule($this->Input->get('id')));
}
Lesezeichen