Merge pull request #109 from Robbt/fix/auto-playlist-validation

Fixing dependence upon hard-coded password in AutoPlaylist
This commit is contained in:
Lucas Bickel 2017-03-23 10:59:58 +01:00 committed by GitHub
commit 01aef516e4
3 changed files with 15 additions and 41 deletions

View file

@ -1,6 +1,6 @@
<?php
class Application_Model_Scheduler
final class Application_Model_Scheduler
{
private $con;
private $fileInfo = array(
@ -23,7 +23,7 @@ class Application_Model_Scheduler
private $checkUserPermissions = true;
public function __construct()
public function __construct($checkUserPermissions=true)
{
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
@ -40,7 +40,11 @@ class Application_Model_Scheduler
$this->nowDT = DateTime::createFromFormat("U", time(), new DateTimeZone("UTC"));
}
$this->user = Application_Model_User::getCurrentUser();
$this->setCheckUserPermissions($checkUserPermissions);
if ($this->checkUserPermissions) {
$this->user = Application_Model_User::getCurrentUser();
}
$this->crossfadeDuration = Application_Model_Preference::GetDefaultCrossfadeDuration();
}
@ -76,7 +80,7 @@ class Application_Model_Scheduler
}
/*
* make sure any incoming requests for scheduling are ligit.
* make sure any incoming requests for scheduling are legit.
*
* @param array $items, an array containing pks of cc_schedule items.
*/

View file

@ -229,7 +229,7 @@ SQL;
$ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
$id = $this->_showInstance->getDbId();
$scheduler = new Application_Model_Scheduler();
$scheduler = new Application_Model_Scheduler($checkUserPerm);
$scheduler->scheduleAfter(
array(array("id" => 0, "instance" => $id, "timestamp" => $ts)),
array(array("id" => $pl_id, "type" => "playlist"))