From d79ed4aa9666a1240a825400b31a8a4ca8fe46d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cornelius=20Wei=C3=9F?= Date: Wed, 29 Mar 2006 19:25:00 +0000 Subject: [PATCH] allow etemplate to use xajax --- etemplate/inc/class.uietemplate.inc.php | 20 ++++++++++++++------ xajax.php | 6 +++--- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/etemplate/inc/class.uietemplate.inc.php b/etemplate/inc/class.uietemplate.inc.php index 23ab2baf5b..8a9af816ba 100644 --- a/etemplate/inc/class.uietemplate.inc.php +++ b/etemplate/inc/class.uietemplate.inc.php @@ -78,6 +78,10 @@ { $GLOBALS['egw']->html =& CreateObject('phpgwapi.html'); } + if (!is_object($GLOBALS['egw']->template)) + { + $GLOBALS['egw']->template =& CreateObject('phpgwapi.template'); + } $this->html = &$GLOBALS['egw']->html; $this->boetemplate($name,$load_via); @@ -318,24 +322,28 @@ * * @return mixed false if no sessiondata and $this->sitemgr, else the returnvalue of exec of the method-calls */ - function process_exec() + function process_exec($etemplate_exec_id = null, $submit_button = null, $exec = null ) { + if(!$etemplate_exec_id) $etemplate_exec_id = $_POST['etemplate_exec_id']; + if(!$submit_button) $submit_button = $_POST['submit_button']; + if(!$exec) $exec = $_POST; + //echo "process_exec: _POST ="; _debug_array($_POST); - $session_data = $this->get_appsession($_POST['etemplate_exec_id']); + $session_data = $this->get_appsession($etemplate_exec_id); //echo "

process_exec: session_data ="; _debug_array($session_data); - if (!$_POST['etemplate_exec_id'] || !is_array($session_data) || count($session_data) < 10) + if (!$etemplate_exec_id || !is_array($session_data) || count($session_data) < 10) { if ($this->sitemgr) return false; //echo "uitemplate::process_exec() id='$_POST[etemplate_exec_id]' invalid session-data !!!"; _debug_array($_SESSION); // this prevents an empty screen, if the sessiondata gets lost somehow $this->location(array('menuaction' => $_GET['menuaction'])); } - if (isset($_POST['submit_button']) && !empty($_POST['submit_button'])) + if (isset($submit_button) && !empty($submit_button)) { - $this->set_array($_POST,$_POST['submit_button'],'pressed'); + $this->set_array($exec,$submit_button,'pressed'); } - $content = $_POST['exec']; + $content = $exec['exec']; if (!is_array($content)) { $content = array(); diff --git a/xajax.php b/xajax.php index 4e706abbe2..3fe0f1fd35 100644 --- a/xajax.php +++ b/xajax.php @@ -25,7 +25,7 @@ list($appName, $className, $functionName) = explode('.',$arg0); - if(substr($className,0,4) != 'ajax') + if(substr($className,0,4) != 'ajax' && $arg0 != 'etemplate.etemplate.process_exec') { // stopped for security reasons error_log($_SERVER["PHP_SELF"]. ' stopped for security reason. className '.$className.' is not valid. className must start with ajax!!!'); @@ -38,9 +38,9 @@ 'noheader' => True, 'disable_Template_class' => True, ); - + include('./header.inc.php'); - + $ajaxClass = CreateObject("$appName.$className"); $argList = $GLOBALS['egw']->translation->convert($argList, 'utf-8'); return call_user_func_array(array(&$ajaxClass, $functionName), $argList );