Merge branch '2.5.x' into 2.5.x-installer

Conflicts:
	airtime_mvc/public/index.php
This commit is contained in:
Albert Santoni 2015-06-16 10:37:06 -04:00
commit 8c9981a155
46 changed files with 5024 additions and 996 deletions

View file

@ -1517,24 +1517,27 @@ SQL;
$i++;
}
}
// check if file exists
$qry->add("file_exists", "true", Criteria::EQUAL);
$qry->add("hidden", "false", Criteria::EQUAL);
if (isset($storedCrit['sort'])) {
$sortTracks = $storedCrit['sort']['value'];
}
if ($sortTracks == 'newest') {
$qry->addDescendingOrderByColumn('utime');
}
else if ($sortTracks == 'oldest') {
$qry->addAscendingOrderByColumn('utime');
}
else {
$qry->addAscendingOrderByColumn('random()');
}
$sortTracks = 'random';
if (isset($storedCrit['sort'])) {
$sortTracks = $storedCrit['sort']['value'];
}
if ($sortTracks == 'newest') {
$qry->addDescendingOrderByColumn('utime');
}
else if ($sortTracks == 'oldest') {
$qry->addAscendingOrderByColumn('utime');
}
else if ($sortTracks == 'random') {
$qry->addAscendingOrderByColumn('random()');
} else {
Logging::warning("Unimplemented sortTracks type in ".__FILE__);
}
}
}
// construct limit restriction
$limits = array();

View file

@ -37,8 +37,6 @@ class Application_Model_Preference
if ($isUserValue && is_null($userId))
throw new Exception("User id can't be null for a user preference {$key}.");
Application_Common_Database::prepareAndExecute("LOCK TABLE cc_pref");
//Check if key already exists
$sql = "SELECT COUNT(*) FROM cc_pref"
." WHERE keystr = :key";
@ -589,13 +587,12 @@ class Application_Model_Preference
public static function SetStationLogo($imagePath)
{
if (!empty($imagePath)) {
$image = @file_get_contents($imagePath);
$image = base64_encode($image);
self::setValue("logoImage", $image);
} else {
Logging::warn("Attempting to set imagePath to empty string");
if (empty($imagePath)) {
Logging::info("Removed station logo");
}
$image = @file_get_contents($imagePath);
$image = base64_encode($image);
self::setValue("logoImage", $image);
}
public static function GetStationLogo()

View file

@ -828,7 +828,8 @@ class Application_Model_Scheduler
"fade_in = '{$file["fadein"]}', ".
"fade_out = '{$file["fadeout"]}', ".
"clip_length = '{$file["cliplength"]}', ".
"position = {$pos} ".
"position = {$pos}, ".
"instance_id = {$instanceId} ".
"WHERE id = {$sched["id"]}";
Application_Common_Database::prepareAndExecute(

View file

@ -93,6 +93,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
if (!$isAdminOrPM) {
//Make sure the user has ownership of ALL the selected webstreams before
$leftOver = self::streamsNotOwnedByUser($p_ids, $p_userId);
if (count($leftOver) == 0) {
CcWebstreamQuery::create()->findPKs($p_ids)->delete();
@ -280,13 +281,22 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
private static function getPlsUrl($url)
{
$content = self::getUrlData($url);
$ini = parse_ini_string($content, true);
if ($ini !== false && isset($ini["playlist"]) && isset($ini["playlist"]["File1"])) {
return $ini["playlist"]["File1"];
$matches = array();
$numStreams = 0; //Number of streams explicitly listed in the PLS.
if (preg_match("/NumberOfEntries=([0-9]*)/", $content, $matches) !== FALSE) {
$numStreams = $matches[1];
}
throw new Exception(_("Could not parse PLS playlist"));
//Find all the stream URLs in the playlist
if (preg_match_all("/File[0-9]*=(.*)/", $content, $matches) !== FALSE) {
//This array contains all the streams! If we need fallback stream URLs in the future,
//they're already in this array...
return $matches[1][0];
} else {
throw new Exception(_("Could not parse PLS playlist"));
}
}
private static function getM3uUrl($url)