check_permission('feature_sheet'); if ( ! ( is_numeric($_GET['w']) && is_numeric($_GET['h']) && is_numeric($_GET['s']) && $_GET['s'] <= 500 && $_GET['s'] > 0 && is_numeric($_GET['min']) && is_numeric($_GET['max']) && is_array($_GET['f']) && $_GET['min'] < $_GET['max'] && $_GET['w'] >= 100 && $_GET['h'] >= 100 ) ) { die; } switch ($_GET['t']) { case 'png': $renderer = new GD_GRenderer($_GET['w'], $_GET['h']); break; case 'pdf': $renderer = new PDFLib_GRenderer($_GET['p'], $_GET['o']); break; default: die; } $graph = new MultilineGraphic(); $graph->setTitle($_GET['title']); $size = ($_GET['max'] - $_GET['min']) / $_GET['s']; $data = []; foreach (array_values($_GET['f']) as $key => $formula) { $formula = convert_formula($formula); $data['x'] = []; $data['y' . $key] = []; for ($x = $_GET['min']; $_GET['max'] > $x; $x += $size) { $data['x'][] = $x; $data['y' . $key][] = $formula($x); } } $graph->setData($data); $graph->draw($renderer); $renderer->httpOutput("graph.{$_GET['t']}");