Beispiel #1
0
$perms[2] = $sys->permissions_test('admin.user.update');
$perms[3] = $sys->permissions_test('admin.user.delete');
$perms[4] = $sys->permissions_test('admin.picture.read');
$perms[5] = $sys->permissions_test('application.picture.upload');
//création d'un nouveau dossier
if (isset($_GET['saisie']) && isset($_GET['currentFolder'])) {
    $fullname = substr($_GET['currentFolder'], 1) . '/' . $_GET['saisie'];
    $phandler->folders_create($fullname);
} elseif (isset($_GET['current']) && isset($_GET['change']) && isset($_GET['currentFolder'])) {
    $fullname = substr($_GET['currentFolder'], 1) . '/' . $_GET['current'];
    $newname = substr($_GET['currentFolder'], 1) . '/' . $_GET['change'];
    $phandler->folders_rename($fullname, $newname);
} elseif (isset($_GET['suppFolder'])) {
    $phandler->folders_remove($_GET['suppFolder'], 1);
} elseif (isset($_GET['suppPic'])) {
    $phandler->pictures_remove($_GET['suppPic']);
}
//récupération des dossiers de l'utilisateur à la racine
$usr = $sys->current_user();
$photos = $phandler->pictures_getFolderByUserID($usr['id']);
//exploration d'un dossier
if (isset($_GET['currentFolder'])) {
    if ($_GET['currentFolder'] == "") {
        //on est à la racine
        //tableau qui stockera le pid des photos qu'il faudra afficher
        $pics = array();
        for ($i = 0; $i < count($photos); $i++) {
            if ($photos[$i]['type'] == 'picture') {
                $pics[$i]['id'] = $photos[$i]['pid'];
                $pics[$i]['title'] = $photos[$i]['title'];
            }
Beispiel #2
0
});
$app->get('/picture/:id/resize/x(:y)', function ($id, $y) use($app) {
    global $pictures;
    $response = $app->response();
    $response->header('Content-Type', 'image/jpeg');
    echo imagejpeg($pictures->pictures_resize($id, null, $y));
});
$app->get('/picture/:id/thumb/(:x)x(:y)', function ($id, $x, $y) use($app) {
    global $pictures;
    $response = $app->response();
    $response->header('Content-Type', 'image/jpeg');
    echo imagejpeg($pictures->pictures_getThumb($id, $x, $y));
});
$app->delete('/picture/:id', function ($id) {
    global $pictures;
    echo json_encode($pictures->pictures_remove($id));
});
$app->get('/user/', function () {
    global $system;
    $users = $system->user_getAll();
    echo json_encode($users);
});
$app->get('/user/:login', function ($login) {
    global $system;
    $user = $system->user_getByLogin($login);
    echo json_encode($user);
});
$app->post('/user/:login', function ($login) use($app) {
    global $system;
    echo json_encode($system->user_create($login, $app->request()->get('password')));
});