bug #3380946 [export] no uid Query result export (Suhosin limit)
[phpmyadmin/crack.git] / tbl_chart.php
blob06b1e7135456295edbcc5d28174eaec9b56f67e2
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * handles creation of the chart
6 * @package phpMyAdmin
7 */
9 /**
10 * do not import request variable into global scope
11 * @ignore
13 if (! defined('PMA_NO_VARIABLES_IMPORT')) {
14 define('PMA_NO_VARIABLES_IMPORT', true);
17 /**
20 require_once './libraries/common.inc.php';
22 $GLOBALS['js_include'][] = 'tbl_chart.js';
23 $GLOBALS['js_include'][] = 'highcharts/highcharts.js';
24 /* Files required for chart exporting */
25 $GLOBALS['js_include'][] = 'highcharts/exporting.js';
26 $GLOBALS['js_include'][] = 'canvg/canvg.js';
27 $GLOBALS['js_include'][] = 'canvg/rgbcolor.js';
29 /**
30 * Runs common work
32 if (strlen($GLOBALS['table'])) {
33 $url_params['goto'] = $cfg['DefaultTabTable'];
34 $url_params['back'] = 'tbl_sql.php';
35 require './libraries/tbl_common.php';
36 require './libraries/tbl_info.inc.php';
37 require './libraries/tbl_links.inc.php';
38 } elseif (strlen($GLOBALS['db'])) {
39 $url_params['goto'] = $cfg['DefaultTabDatabase'];
40 $url_params['back'] = 'sql.php';
41 require './libraries/db_common.inc.php';
42 require './libraries/db_info.inc.php';
43 } else {
44 $url_params['goto'] = $cfg['DefaultTabServer'];
45 $url_params['back'] = 'sql.php';
46 require './libraries/server_common.inc.php';
47 require './libraries/server_links.inc.php';
51 * Execute the query and return the result
53 $data = array();
55 $result = PMA_DBI_try_query($sql_query);
56 while ($row = PMA_DBI_fetch_assoc($result)) {
57 $data[] = $row;
60 // get settings if any posted
61 $chartSettings = array();
62 if (PMA_isValid($_REQUEST['chartSettings'], 'array')) {
63 $chartSettings = $_REQUEST['chartSettings'];
66 $url_params['db'] = $GLOBALS['db'];
67 $url_params['reload'] = 1;
69 /**
70 * Displays the page
72 // pma_token/url_query needed for chart export
74 <script type="text/javascript">
75 pma_token = '<?php echo $_SESSION[' PMA_token ']; ?>';
76 url_query = '<?php echo $url_query;?>';
77 </script>
78 <!-- Display Chart options -->
79 <div id="div_view_options">
80 <form method="post" action="tbl_chart.php">
81 <?php echo PMA_generate_common_hidden_inputs($url_params); ?>
82 <fieldset>
83 <legend><?php echo __('Display chart'); ?></legend>
84 <div style="float:left;">
85 <input type="radio" name="chartType" value="bar"><?php echo __('Bar'); ?>
86 <input type="radio" name="chartType" value="column"><?php echo __('Column'); ?>
87 <input type="radio" name="chartType" value="line" checked><?php echo __('Line'); ?>
88 <input type="radio" name="chartType" value="spline"><?php echo __('Spline'); ?>
89 <input type="radio" name="chartType" value="pie"><?php echo __('Pie'); ?>
90 <span class="barStacked" style="display:none;">
91 <input type="checkbox" name="barStacked" value="1"><?php echo __('Stacked'); ?>
92 </span>
93 <br>
94 <input type="text" name="chartTitle" value="<?php echo __('Chart title'); ?>">
95 <?php
96 $keys = array_keys($data[0]);
97 $yaxis = -1;
98 if (count($keys) > 1) {
99 echo '<br>';
100 echo __('X-Axis:'); ?> <select name="chartXAxis">
101 <?php
103 foreach ($keys as $idx => $key) {
104 if ($yaxis == -1 && (($idx == count($data[0]) - 1) || preg_match("/(date|time)/i", $key))) {
105 echo '<option value="' . htmlspecialchars($idx) . '" selected>' . htmlspecialchars($key) . '</option>';
106 $yaxis=$idx;
107 } else {
108 echo '<option value="' . htmlspecialchars($idx) . '">' . htmlspecialchars($key) . '</option>';
113 </select><br />
114 <?php echo __('Series:'); ?>
115 <select name="chartSeries">
116 <option value="columns"><?php echo __('The remaining columns'); ?></option>
117 <?php
118 foreach ($keys as $idx => $key) {
119 echo '<option>' . htmlspecialchars($key) . '</option>';
122 </select>
123 <?php
127 </div>
128 <div style="float:left; padding-left:40px;">
129 <?php echo __('X-Axis label:'); ?> <input style="margin-top:0;" type="text" name="xaxis_label"
130 value="<?php echo ($yaxis == -1) ? __('X Values') : $keys[$yaxis]; ?>"><br />
131 <?php echo __('Y-Axis label:'); ?> <input type="text" name="yaxis_label" value="<?php echo __('Y Values'); ?>">
132 </div>
133 <p style="clear:both;">&nbsp;</p>
134 <div id="resizer" style="width:600px; height:400px;">
135 <div id="inner-resizer">
136 <div id="querychart" style="display:none;">
137 <?php echo json_encode($data); ?>
138 </div>
139 </div>
140 </div>
141 </fieldset>
142 </form>
143 </div>
144 <?php
146 * Displays the footer
148 require_once './libraries/footer.inc.php';