// ROTATE IMAGE
    $album->album_media_rotate($media_id, $dir);
    // SET THUMBPATH
    $thumb_path = $url->url_userdir($user->user_info[user_id]) . $media_id . "_thumb.jpg?" . rand();
    // SEND AJAX CONFIRMATION
    echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><script type='text/javascript'>";
    echo "var img = window.parent.document.getElementById('file_{$media_id}');";
    echo "img.src = '{$thumb_path}';";
    echo "</script></head><body></body></html>";
    exit;
    // UPDATE FILES IN THIS ALBUM
} elseif ($task == "doupdate") {
    // GET TOTAL FILES
    $total_files = $album->album_files($album_info[album_id]);
    // DELETE NECESSARY FILES
    $album->album_media_delete(0, $total_files, "media_id ASC", "(media_album_id='{$album_info['album_id']}')");
    // UPDATE NECESSARY FILES
    $media_array = $album->album_media_update(0, $total_files, "media_id ASC", "(media_album_id='{$album_info['album_id']}')");
    // SET ALBUM COVER AND UPDATE DATE
    $newdate = time();
    $album_info[album_cover] = $_POST['album_cover'];
    if (!in_array($album_info[album_cover], $media_array)) {
        $album_info[album_cover] = $media_array[0];
    }
    $database->database_query("UPDATE se_albums SET album_cover='{$album_info['album_cover']}', album_dateupdated='{$newdate}' WHERE album_id='{$album_info['album_id']}'");
    // UPDATE LAST UPDATE DATE (SAY THAT 10 TIMES FAST)
    $user->user_lastupdate();
    // SHOW SUCCESS MESSAGE
    $result = 1;
    // MOVE MEDIA UP
} elseif ($task == "moveup") {
Esempio n. 2
0
        exit;
    }
    $prev_info = $database->database_fetch_assoc($prev_query);
    // SWITCH ORDER
    $database->database_query("UPDATE se_media SET media_order='{$prev_info['media_order']}' WHERE media_id='{$media_info['media_id']}'");
    $database->database_query("UPDATE se_media SET media_order='{$media_info['media_order']}' WHERE media_id='{$prev_info['media_id']}'");
    // SEND AJAX CONFIRMATION
    echo json_encode(array('result' => TRUE, 'current_media_id' => $media_info['media_id'], 'previous_media_id' => $prev_info['media_id']));
    exit;
} elseif ($task == "media_cover") {
    $resource = $database->database_query("SELECT NULL FROM se_media WHERE media_album_id='{$album_id}' && media_id='{$media_id}' LIMIT 1");
    if (!$database->database_num_rows($resource)) {
        echo json_encode(array('result' => FALSE, 'err' => 8));
        exit;
    }
    // Set as cover
    $newdate = time();
    $database->database_query("UPDATE se_albums SET album_cover='{$media_id}', album_dateupdated='{$newdate}' WHERE album_id='{$album_id}' LIMIT 1");
    // Update user
    $user->user_lastupdate();
    echo json_encode(array('result' => TRUE));
    exit;
} elseif ($task == "media_delete") {
    $result = $album->album_media_delete($media_id);
    echo json_encode(array('result' => $result));
    exit;
} elseif ($task == "media_move") {
    $result = $album->album_media_move($media_id, $album_id);
    echo json_encode(array('result' => $result));
    exit;
}