Esempio n. 1
0
            $tags = $regExp->match(trim($_POST['tags']));
            $description = $regExp->match(trim($_POST['description']));
            $public = $regExp->match($_POST['public']);
            $terminate = $regExp->match($_POST['terminate']);
            $foo = new Foo();
            $foo->id = $file_id;
            $foo->tags = $tags;
            $foo->public = $public;
            $foo->description = $description;
            $foo->terminate = $terminate;
            $foomapper = new FooMapper($db);
            $foomapper->save($foo);
            $app->redirect("{$id}");
        }
    })->via('GET', 'POST')->name('FileEdit');
    $app->get('/:id/:preview', function ($id, $preview) use($app) {
        ini_set('display_errors', 'On');
        error_reporting('E_ALL');
        $db = $app->db;
        $foo = new Foo();
        $foo->token = $id;
        $mapper = new FooMapper($db);
        $files = $mapper->selectToken($foo);
        if (empty($files)) {
            $app->error();
        }
        $checkrights = new Checkrights();
        $checkrights->RenderPreview($files, $app, $preview);
        ini_set('display_errors', 'Off');
    })->name('preview');
});