-
Notifications
You must be signed in to change notification settings - Fork 8
/
processViews.php
47 lines (46 loc) · 1.6 KB
/
processViews.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
require_once 'headerDB.inc.php';
ignore_user_abort(true);
$captureOutput=(isset($_REQUEST['output']) && $_REQUEST['output']==='xml');
if ($captureOutput) {
@ob_start();
}
if ($_SESSION['debug']['debug'] && !$captureOutput) {
$html=true;
include_once 'headerHtml.inc.php';
echo "</head><body><div><div>";
} else {
$html=false;
}
log_array('$_POST','$_GET');
// process REQUEST variables
$values=array();
foreach (array('uri'=>'','name'=>'from ProcessViews','sort'=>'','show'=>'','columns'=>'') as $field=>$default)
$values[$field]= (array_key_exists($field,$_REQUEST))
? ( is_array($_REQUEST[$field])
? implode(',',$_REQUEST[$field])
: $_REQUEST[$field] )
: $default;
// save perspective to database
$success=savePerspective($values);
if ($captureOutput) {
$logtext=ob_get_contents();
ob_end_clean();
$outtext=$_SESSION['message'];
$_SESSION['message']=array();
if (!headers_sent()) {
$header="Content-Type: text/xml; charset=".$_SESSION['config']['charset'];
header($header);
}
echo '<?xml version="1.0" ?','><gtdphp>' // encoding="{$_SESSION['config']['charset']}"
,'<values><success>',(true && $success),'</success></values><result>';
if (!empty($outtext)) foreach ($outtext as $line) echo "<line><![CDATA[$line]]></line>";
echo '</result>'
,"<log><![CDATA[$logtext]]></log>"
,"</gtdphp>";
exit;
} else {
nextScreen('summary.php');
if ($html) include_once 'footer.inc.php';
}
// php closing tag has been omitted deliberately, to avoid unwanted blank lines being sent to the browser