include 'inc/init.php'; fAuthorization::requireLoggedIn(); fRequest::overrideAction(); $action = fRequest::getValid('action', array('list', 'add', 'edit', 'delete', 'view')); $line_id = fRequest::get('line_id', 'integer'); $graph_id = fRequest::get('graph_id', 'integer'); if ('delete' == $action) { $class_name = 'Line'; try { $obj = new Line($line_id); $graph = new Graph($obj->getGraphId()); $delete_text = 'Are you sure you want to delete the line : <strong>' . $obj->getAlias() . '</strong>?'; if (fRequest::isPost()) { fRequest::validateCSRFToken(fRequest::get('token')); $obj->delete(); fMessaging::create('success', Graph::makeUrl('edit', $graph), 'The line for ' . $graph->getName() . ' was successfully deleted'); fURL::redirect(Graph::makeUrl('edit', $graph)); } } catch (fNotFoundException $e) { fMessaging::create('error', Graph::makeUrl('edit', $graph), 'The line requested could not be found'); fURL::redirect(Graph::makeUrl('edit', $graph)); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } include VIEW_PATH . '/delete.php'; // --------------------------------- // } elseif ('edit' == $action) { try { $line = new Line($line_id); $graph = new Graph($line->getGraphId());
<?php include dirname(__FILES__) . '/inc/init.php'; fAuthorization::requireLoggedIn(); fRequest::overrideAction(); $action = fRequest::getValid('action', array('list', 'add', 'edit', 'delete', 'view')); $line_id = fRequest::get('line_id'); $graph_id = fRequest::get('graph_id'); if ('delete' == $action) { try { $line = new Line($line_id); $graph = $line->createGraph(); if (fRequest::isPost()) { fRequest::validateCSRFToken(fRequest::get('token')); $line->delete(); fMessaging::create('success', Graph::makeUrl('edit', $graph), 'The line for ' . $graph->getName() . ' was successfully deleted'); fURL::redirect(Graph::makeUrl('edit', $graph)); } } catch (fNotFoundException $e) { fMessaging::create('error', Graph::makeUrl('edit', $graph), 'The line requested could not be found'); fURL::redirect(Graph::makeUrl('edit', $graph)); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } include VIEW_PATH . '/delete_line.php'; // --------------------------------- // } elseif ('edit' == $action) { try { $line = new Line($line_id); $graph = new Graph($line->getGraphId()); if (fRequest::isPost()) {