if (preg_match('!(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)!', $track['release_date'], $aMatch)) { $track['release_year'] = $aMatch[1]; $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') {