/** * @package Newscoop * @subpackage Soundcloud plugin * @copyright 2011 Sourcefabric o.p.s. * @license http://www.gnu.org/licenses/gpl-3.0.txt */ function smarty_function_assign_soundcloud_tracks($p_params, &$p_smarty) { $gimme = $p_smarty->get_template_vars('gimme'); $article = empty($p_params['article']) ? $gimme->article->number : $p_params['article']; $length = empty($p_params['length']) ? 0 : (int) $p_params['length']; $order = empty($p_params['order']) ? 'asc' : $p_params['order']; $start = empty($p_params['start']) ? 0 : $p_params['start']; $current = empty($p_params['current']) ? 0 : $p_params['current']; $search = empty($p_params['search']) ? null : $p_params['search']; $api = empty($p_params['api']) ? false : true; $set = empty($p_params['set']) ? null : $p_params['set']; if (!$api) { $tracks = Soundcloud::getAssignments($article, $order, $start, $length); } else { require_once CS_PATH_PLUGINS . DIR_SEP . 'soundcloud' . DIR_SEP . 'classes' . DIR_SEP . 'soundcloud.api.php'; $soundcloudAPI = new SoundcloudAPI(); if ($set) { if ($set = $soundcloudAPI->setLoad($set)) { $tracks = $set['tracks']; if ($order == 'desc') { $tracks = array_reverse($tracks); } for ($i = 0; $i < $start; $i++) { array_shift($tracks); } if ($length) { for ($i = sizeof($tracks); $i > $length; $i--) { array_pop($tracks); } } } } else { $tracks = $soundcloudAPI->trackSearch(array('order' => 'created_at', 'limit' => $length, 'offest' => $start, 'q' => $search)); } } if (!empty($tracks)) { $soundcloud = new stdClass(); $soundcloud->list = false; $soundcloud->track = empty($tracks[$current]) ? $tracks[0] : $tracks[$current]; $soundcloud->total = sizeof($tracks); $soundcloud->tracks = $tracks; $p_smarty->assign('soundcloud', $soundcloud); } else { $p_smarty->assign('soundcloud', null); } return null; }
*/ include 'data.php'; require_once CS_PATH_PLUGINS . DIR_SEP . 'soundcloud' . DIR_SEP . 'classes' . DIR_SEP . 'soundcloud.api.php'; camp_load_translation_strings('plugin_soundcloud'); if (!$g_user->hasPermission('plugin_soundcloud_browser')) { jsonOutput(null, array('title' => getGS('Error'), 'text' => getGS('You do not have the right to manage SoundCloud tracks.'), 'type' => 'error')); exit; } $limit = 5; $offset = 0; $paging = null; $message = array(); $js = null; $content = null; $otherParams = array(); $soundcloud = new SoundcloudAPI(); $action = Input::Get('action', 'string', null); $article = Input::Get('article', 'string', null); $attachement = Input::Get('attachement', 'string', null) ? true : false; $track = Input::Get('track', 'string', null); if ($action == 'addtoset') { if (!$g_user->hasPermission('plugin_soundcloud_update')) { jsonOutput(null, array('title' => getGS('Error'), 'text' => getGS('You do not have the right to update SoundCloud tracks.'), 'type' => 'error'), null, array(), true); exit; } $set = Input::Get('set', 'string', null); if ($setTracks = $soundcloud->setLoad($set)) { $tracks = $setTracks['tracks']; $tracks[]['id'] = $track; $setTracks = array(); $setTracks['id'] = $set;
<?php /** * @package Newscoop * @subpackage SoundCloud plugin * @copyright 2011 Sourcefabric o.p.s. * @license http://www.gnu.org/licenses/gpl-3.0.txt */ include 'data.php'; require_once CS_PATH_PLUGINS . DIR_SEP . 'soundcloud' . DIR_SEP . 'classes' . DIR_SEP . 'soundcloud.api.php'; camp_load_translation_strings('plugin_soundcloud'); if (!$g_user->hasPermission('plugin_soundcloud_browser')) { camp_html_display_error(getGS('You do not have the right to manage SoundCloud tracks.')); exit; } $soundcloud = new SoundcloudAPI(); $limit = 5; $offset = 0; $showMessage = array(); $track = array(); $js = null; $article = Input::Get('article_id', 'string', null); $action = Input::Get('action', 'string', null); $track = array('title' => Input::Get('title', 'string', null), 'description' => Input::Get('description', 'string', null), 'track_type' => Input::Get('track_type', 'string', null), 'genre' => Input::Get('genre', 'string', null), 'license' => Input::Get('license', 'string', null), 'tag_list' => Input::Get('tag_list', 'string', null), 'label_name' => Input::Get('label_name', 'string', null), 'release' => Input::Get('release', 'string', null), 'isrc' => Input::Get('isrc', 'string', null), 'bpm' => Input::Get('bpm', 'float', null), 'key_signature' => Input::Get('key_signature', 'string', null), 'purchase_url' => Input::Get('purchase_url', 'string', null), 'video_url' => Input::Get('video_url', 'string', null), 'sharing' => Input::Get('sharing', 'string', 'public'), 'downloadable' => Input::Get('downloadable', 'string', null) == "0" ? false : true, 'streamable' => Input::Get('streamable', 'string', null) == "0" ? false : true, 'sharing_note' => Input::Get('sharing_note', 'string', null), 'release_date' => Input::Get('release_date', 'string', null)); if ($action) { if (!$g_user->hasPermission('plugin_soundcloud_upload')) { camp_html_display_error(getGS('You do not have the right to upload SoundCloud tracks.')); exit; } if (!empty($_FILES['asset_data']['error'])) { $showMessage = array('title' => getGS('Upload error'), 'message' => getGS('Please check php settings for file uploading'), 'type' => 'error', 'fixed' => 'false');
<?php namespace php_active_record; /* connector for Soundcloud estimated execution time: 10 minutes */ $timestart = microtime(1); include_once dirname(__FILE__) . "/../../config/environment.php"; require_library('connectors/SoundcloudAPI'); $resource_id = 511; $func = new SoundcloudAPI(); $taxa = $func->get_all_taxa(); $xml = \SchemaDocument::get_taxon_xml($taxa); $resource_path = CONTENT_RESOURCE_LOCAL_PATH . $resource_id . ".xml"; if (!($OUT = fopen($resource_path, "w"))) { debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $resource_path); return; } fwrite($OUT, $xml); fclose($OUT); if (filesize($resource_path) > 1000) { Functions::set_resource_status_to_force_harvest($resource_id); $command_line = "gzip -c " . CONTENT_RESOURCE_LOCAL_PATH . $resource_id . ".xml >" . CONTENT_RESOURCE_LOCAL_PATH . $resource_id . ".xml.gz"; $output = shell_exec($command_line); } $elapsed_time_sec = microtime(1) - $timestart; echo "\n"; echo "elapsed time = {$elapsed_time_sec} seconds \n"; echo "elapsed time = " . $elapsed_time_sec / 60 . " minutes \n"; echo "\n\n Done processing.";
camp_html_display_error(getGS('You do not have the right to manage SoundCloud preferences.')); exit; } if (Input::Get('save') || Input::Get('check')) { if (!SecurityToken::isValid()) { camp_html_display_error(getGS('Invalid security token!')); exit; } $f_soundcloud_client_id = Input::Get('f_soundcloud_client_id', 'string'); $f_soundcloud_client_secret = Input::Get('f_soundcloud_client_secret', 'string'); $f_soundcloud_username = Input::Get('f_soundcloud_username', 'string'); $f_soundcloud_password = Input::Get('f_soundcloud_password', 'string'); SystemPref::Set('PLUGIN_SOUNDCLOUD_CLIENT_ID', $f_soundcloud_client_id); SystemPref::Set('PLUGIN_SOUNDCLOUD_CLIENT_SECRET', $f_soundcloud_client_secret); SystemPref::Set('PLUGIN_SOUNDCLOUD_USERNAME', $f_soundcloud_username); SystemPref::Set('PLUGIN_SOUNDCLOUD_PASSWORD', $f_soundcloud_password); SystemPref::Set('PLUGIN_SOUNDCLOUD_USER_ID', ''); if (Input::Get('check')) { $soundcloud = new SoundcloudAPI(); if ($soundcloud->login()) { camp_html_add_msg(getGS('SoundCloud checked successfully.'), 'ok'); } else { camp_html_add_msg(getGS('SoundCloud reports an error:') . ' ' . $soundcloud->error, 'error'); } } else { camp_html_add_msg(getGS('SoundCloud preferences updated.'), 'ok'); } } echo camp_html_breadcrumbs(array(array(getGS('Plugins'), $Campsite['WEBSITE_URL'] . '/admin/plugins/manage.php'), array(getGS('SoundCloud'), ''), array(getGS('SoundCloud Preferences'), ''))); camp_html_display_msgs(); include 'templates/preferences.php';