handler for ajax requests

This commit is contained in:
Ralf Becker 2006-10-02 05:13:19 +00:00
parent dc69445754
commit 91d28f8945

View File

@ -53,15 +53,10 @@
}
}
}
//error_log("xajax_doXMLHTTP('$arg0',...)");
list($appName, $className, $functionName) = explode('.',$arg0);
@list($appName, $className, $functionName, $handler) = explode('.',$arg0);
if(substr($className,0,4) != 'ajax' && $arg0 != 'etemplate.etemplate.process_exec' && substr($functionName,0,4) != 'ajax')
{
// stopped for security reasons
error_log($_SERVER['PHP_SELF']. ' stopped for security reason. '.$arg0.' is not valid. class- or function-name must start with ajax!!!');
exit;
}
$GLOBALS['egw_info'] = array(
'flags' => array(
'currentapp' => $appName,
@ -76,6 +71,32 @@
$GLOBALS['xajax']->setCharEncoding($GLOBALS['egw']->translation->charset());
define('XAJAX_DEFAULT_CHAR_ENCODING',$GLOBALS['egw']->translation->charset());
// now the header is included, we can set the charset
$GLOBALS['xajax']->setCharEncoding($GLOBALS['egw']->translation->charset());
switch($handler)
{
case '/etemplate/process_exec':
$_GET['menuaction'] = $appName.'.'.$className.'.'.$functionName;
$appName = $className = 'etemplate';
$functionName = 'process_exec';
$arg0 = 'etemplate.etemplate.process_exec';
$argList = array(
$argList[0]['etemplate_exec_id'],
$argList[0]['submit_button'],
$argList[0],
'xajaxResponse',
);
error_log("xajax_doXMLHTTP() /etemplate/process_exec handler: arg0='$arg0', menuaction='$_GET[menuaction]'");
break;
}
if(substr($className,0,4) != 'ajax' && $arg0 != 'etemplate.etemplate.process_exec' && substr($functionName,0,4) != 'ajax')
{
// stopped for security reasons
error_log($_SERVER['PHP_SELF']. ' stopped for security reason. '.$arg0.' is not valid. class- or function-name must start with ajax!!!');
exit;
}
$ajaxClass =& CreateObject($appName.'.'.$className);
$argList = $GLOBALS['egw']->translation->convert($argList, 'utf-8');