Esempio n. 1
0
    $track = json_decode(getTrack($id));
    if (!isset($track->error)) {
        Flight::render('editTRack', array('track' => $track), 'body_content');
        Flight::render('layout', array('Titre' => 'Modifier le track ' . $track[0]->title));
    } else {
        Flight::redirect($request->referrer);
    }
});
Flight::route('GET|POST /album/@id/edit', function ($id) {
    $request = Flight::request();
    if ($request->method == "GET") {
        $album = json_decode(getAlbum($id));
        if (!isset($album->error)) {
            Flight::render('editAlbum', array('album' => $album), 'body_content');
            Flight::render('layout', array('Titre' => 'Modifier un track à ' . $album[0]->title));
        } else {
            Flight::redirect($request->referrer);
        }
    } else {
        if ($request->method == "POST") {
            $album = json_encode($_POST);
            $result = json_decode(editAlbum($album));
            if (isset($result->ID)) {
                Flight::redirect($request->referrer);
            } else {
                Flight::redirect('http://localhost/php/App/playlists');
            }
        }
    }
});
Flight::start();
Esempio n. 2
0
        setImageName($image_id, $name);
        define("_SUCCESS_", "Image name has been saved");
    }
}
// Edit Album Info
if (isset($_POST['edit_album'])) {
    $album_id = $_GET['id'];
    $name = $_POST['album_name'];
    $description = $_POST['description'];
    $thumbnail1 = $_POST['thumbnail1'];
    $size1 = $_POST['size1'];
    $thumbnail2 = $_POST['thumbnail2'];
    $size2 = $_POST['size2'];
    $thumbnail3 = $_POST['thumbnail3'];
    $size3 = $_POST['size3'];
    editAlbum($album_id, $name, $description, $thumbnail1 ? $size1 : null, $thumbnail2 ? $size2 : null, $thumbnail3 ? $size3 : null);
    define("_SUCCESS_", "Album edited successfully");
}
// Save Config File
if (isset($_POST['settings_save_changes'])) {
    $admin_username = $_POST['admin_username'];
    $admin_password = $_POST['admin_password'];
    $gallery_title = $_POST['gallery_title'];
    $naming = $_POST['naming'];
    $thumbnail1size = strtolower($_POST['thumbnail1size']);
    $thumbnail2size = strtolower($_POST['thumbnail2size']);
    $thumbnail3size = strtolower($_POST['thumbnail3size']);
    if ($thumbnail1size && !preg_match("/^[0-9]+x[0-9]+\$/", $thumbnail1size)) {
        $thumbnail1size = null;
    }
    if ($thumbnail2size && !preg_match("/^[0-9]+x[0-9]+\$/", $thumbnail2size)) {