commit d33d839ce1f465578e3c0ce9f4269102d03758f1
parent 6aaa51e01db84f7a3cf3f2e03f600c5d9eb8cf28
Author: dankert <devnull@localhost>
Date: Wed, 17 Feb 2010 00:48:21 +0100
Trace für Ausgabevariablen; Ausgabe als PHP-Serialized möglich für PHP-Clients.
Diffstat:
1 file changed, 20 insertions(+), 0 deletions(-)
diff --git a/actionClasses/Action.class.php b/actionClasses/Action.class.php
@@ -332,10 +332,30 @@ class Action
$httpAccept = getenv('HTTP_ACCEPT');
$types = explode(',',$httpAccept);
+ if ( version_compare(PHP_VERSION, '4.3.0', '>=') )
+ Logger::trace('Output'."\n".print_r($this->templateVars,true));
+
// Weitere Variablen anreichern.
$this->templateVars['session'] = array('name'=>session_name(),'id'=>session_id());
$this->templateVars['version'] = OR_VERSION;
+ if ( sizeof($types)==1 && in_array('application/php-array',$types) || $this->getRequestVar('output')=='php-array' )
+ {
+ if (version_compare(PHP_VERSION, '4.3.0', '<'))
+ Http::serverError('application/php-array is only available with PHP >= 4.3');
+
+ header('Content-Type: application/php-array');
+ echo print_r($this->templateVars,true);
+ exit;
+ }
+
+ if ( sizeof($types)==1 && in_array('application/php-serialized',$types) || $this->getRequestVar('output')=='php' )
+ {
+ header('Content-Type: application/php-serialized');
+ serialize($this->templateVars);
+ exit;
+ }
+
if ( sizeof($types)==1 && in_array('application/json',$types) || $this->getRequestVar('output')=='json' )
{
require_once( OR_SERVICECLASSES_DIR."JSON.class.".PHP_EXT );