Пример #1
0
 public function run(Request $request, Response $response, array $args)
 {
     $db = new Db();
     $db->install();
     $config = new Config();
     return new RedirectResponse($config->baseUrl());
 }
Пример #2
0
 public function save(Request $request, Response $response, array $args)
 {
     $_POST = array_filter($_POST, 'trim');
     $metadata = array('id' => filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT), 'title' => filter_input(INPUT_POST, 'title'), 'description' => filter_input(INPUT_POST, 'description'), 'date' => filter_input(INPUT_POST, 'date'), 'date_granularity' => filter_input(INPUT_POST, 'date_granularity', FILTER_SANITIZE_NUMBER_INT), 'edit_group' => filter_input(INPUT_POST, 'edit_group', FILTER_SANITIZE_NUMBER_INT), 'read_group' => filter_input(INPUT_POST, 'read_group', FILTER_SANITIZE_NUMBER_INT));
     $tags = filter_input(INPUT_POST, 'tags');
     $item = new Item(null, $this->user);
     $item->save($metadata, $tags, $_FILES['file']['tmp_name'], filter_input(INPUT_POST, 'file_contents'));
     $config = new Config();
     return new RedirectResponse($config->baseUrl() . '/' . $item->getId());
 }