Exemplo n.º 1
0
            $track['release_month'] = $aMatch[2];
            $track['release_day'] = $aMatch[3];
        }
        if (!empty($_FILES['artwork_data']['name']) && empty($_FILES['artwork_data']['error'])) {
            $track['artwork_data'] = '@' . $_FILES['artwork_data']['tmp_name'];
        }
        $result = $soundcloud->trackUpdate($track);
        if (empty($result['id'])) {
            jsonOutput(null, array('title' => getGS('Save error'), 'text' => getGS('SoundCloud reports an error:') . $soundcloud->error, 'type' => 'error'), null, array(), true);
            exit;
        } else {
            if ($attach) {
                $soundcloudAttach = new Soundcloud((int) $article, (int) $track['id']);
                $soundcloudAttach->delete();
                $soundcloudAttach = new Soundcloud();
                if (!$soundcloudAttach->create((int) $article, (int) $track['id'], $result)) {
                    jsonOutput(null, array('title' => getGS('Attach error'), 'text' => getGS('Error during create attachement'), 'type' => 'error'), null, array(), true);
                    exit;
                }
                $messageTitle = getGS('Save and attach successful');
            } else {
                $messageTitle = getGS('Save successful');
            }
            jsonOutput(null, array('title' => $messageTitle, 'text' => getGS('Track has been updated on SoundCloud'), 'type' => 'success'), null, array('ok' => true), false);
        }
    }
    exit;
}
if ($action == 'search') {
    $trackListParams = array('order' => 'created_at', 'offset' => $offset, 'limit' => $limit);
    foreach ((array) $_POST['search'] as $pair) {
Exemplo n.º 2
0
            $track['release_year'] = $aMatch[1];
            $track['release_month'] = $aMatch[2];
            $track['release_day'] = $aMatch[3];
        }
        $result = $soundcloud->trackUpload($track);
        if (!$result) {
            $showMessage = array('title' => getGS('Upload error'), 'message' => getGS('SoundCloud reports an error:') . ' ' . $soundcloud->error, 'type' => 'error', 'fixed' => 'true');
        } else {
            $showMessage = array('title' => getGS('Upload successful'), 'message' => getGS('Track $1 has been uploaded to SoundCloud. Click to close', $result['id']), 'type' => 'success', 'fixed' => 'true');
            $track = array();
            if ($action == 'attach') {
                $article = Input::Get('article_id', 'string', null);
                $soundcloudAttach = new Soundcloud((int) $article, (int) $track);
                $soundcloudAttach->delete();
                $soundcloudAttach = new Soundcloud();
                if ($soundcloudAttach->create((int) $article, (int) $result['id'], $result)) {
                    $js = 'parent.$.fancybox.reload = true;';
                }
            }
        }
    }
}
$trackListParams = array('order' => 'created_at', 'offset' => 0, 'limit' => $limit);
$trackList = $soundcloud->trackSearch($trackListParams);
$attached = array();
if ($article) {
    $attachments = Soundcloud::getAssignments($article);
    foreach ($attachments as $value) {
        $attached["{$value['id']}"] = $value['id'];
    }
}