Beispiel #1
0
$id = $_REQUEST['id'];
$secret = $_REQUEST['secret'];
$share = new Share($id);
if (empty($action) && $share->id) {
    if ($share->allow_stream) {
        $action = 'stream';
    } elseif ($share->allow_download) {
        $action = 'download';
    }
}
if (!$share->is_valid($secret, $action)) {
    UI::access_denied();
    exit;
}
$share->format();
$share->save_access();
if ($action == 'download') {
    if ($share->object_type == 'song' || $share->object_type == 'video') {
        $_REQUEST['action'] = 'download';
        $_REQUEST['type'] = $share->object_type;
        $_REQUEST[$share->object_type . '_id'] = $share->object_id;
        require AmpConfig::get('prefix') . '/stream.php';
    } else {
        $_REQUEST['action'] = $share->object_type;
        $_REQUEST['id'] = $share->object_id;
        require AmpConfig::get('prefix') . '/batch.php';
    }
} elseif ($action == 'stream') {
    require AmpConfig::get('prefix') . '/templates/show_share.inc.php';
} else {
    debug_event('UI::access_denied', 'Access Denied: unknown action.', '3');