$soundcloudAttach = new Soundcloud((int) $article, (int) $track); $soundcloudAttach->delete(); $soundcloudAttach = new Soundcloud(); if (!$soundcloudAttach->create((int) $article, (int) $track, $trackData)) { jsonOutput(null, array('title' => getGS('Attach error'), 'text' => getGS('Error during create attachement'), 'type' => 'error')); exit; } else { jsonOutput(null, array(), null, array('ok' => true)); } } if ($action == 'delete') { if (!$g_user->hasPermission('plugin_soundcloud_delete')) { jsonOutput(null, array('title' => getGS('Error'), 'text' => getGS('You do not have the right to delete SoundCloud tracks.'), 'type' => 'error')); exit; } Soundcloud::deleteAllTracks($track); if (!$soundcloud->trackDelete($track)) { jsonOutput(null, array('title' => getGS('SoundCloud reports an error:'), 'text' => $soundcloud->error, 'type' => 'error')); exit; } $action = 'search'; } if ($action == 'save') { $attach = false; 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; } foreach ((array) $_POST as $key => $value) { switch ($key) { case 'article':