Hallo Bernbacher,
du kannst z. B. eine ajax.php im Mandantenverzeichnis ablegen, mit minimalster Initialisierung von CONTENIDO und des Frontends:
Code: Alles auswählen
<?php
if (!defined('CON_FRAMEWORK')) {
define('CON_FRAMEWORK', true);
}
global $contenido_path, $cfg;
// Set path to current frontend
$frontend_path = str_replace('\\', '/', realpath(dirname(__FILE__) . '/')) . '/';
/**
* Do not edit this value!
*
* If you want to set a different enviroment value please define it in your .htaccess file
* or in the server configuration.
*
* SetEnv CON_ENVIRONMENT development
*/
if (!defined('CON_ENVIRONMENT')) {
if (getenv('CONTENIDO_ENVIRONMENT')) {
$sEnvironment = getenv('CONTENIDO_ENVIRONMENT');
} elseif (getenv('CON_ENVIRONMENT')) {
$sEnvironment = getenv('CON_ENVIRONMENT');
} else {
// @TODO: provide a possibility to set the environment value via file
$sEnvironment = 'production';
}
define('CON_ENVIRONMENT', $sEnvironment);
}
// Include the config file of the frontend to initialize client and language id
include_once($frontend_path . 'data/config/' . CON_ENVIRONMENT . '/config.php');
// CONTENIDO startup process
if (!is_file($contenido_path . 'includes/startup.php')) {
die("<h1>Fatal Error</h1><br>Couldn't include CONTENIDO startup.");
}
include_once($contenido_path . 'includes/startup.php');
// Clients local configuration
if (file_exists($frontend_path . 'data/config/config.local.php')) {
@include ($frontend_path . 'data/config/config.local.php');
}
cRegistry::bootstrap(array(
'sess' => 'cFrontendSession',
'auth' => 'cAuthHandlerFrontend',
'perm' => 'cPermission'
));
###############################################################################
// hier deine ajax logik und ausgabe...
###############################################################################
// Configuration settings after the site is displayed.
if (file_exists($cfgClient[$client]['config']['path'] . 'config.after.php')) {
@include ($cfgClient[$client]['config']['path'] . 'config.after.php');
}
cRegistry::shutdown();
Das sollte soweit funktionieren, damit hast du Zugriff auf alle wichtigen Bereiche im CONTENIDO Frontend. Bedenke aber, dass das Beispiel keine vollständige Initialisierung bietet, manche Funktionen, wie das Ausführen von CEC-Hooks, initiales Setzen von Mandant und Sprache, Wechseln von Mandant und Sprache gehen hier dann nicht. Normalerweise wird Mandant und Sprache beim Aufruf der Seite gesetzt, danach beim AJAX-Request wäre das nicht nötig.
Jegliche Sicherheitsaspekte, wie z. B. das Ausgeben von Inhalten geschlossener Bereiche nur für authentifizierte User, würde dann bei dir liegen.
Gruß
xmurrix