fix errors reported by Facebook's scheck

This commit is contained in:
Martin Konecny 2013-05-28 17:30:48 -04:00
parent 73a908055a
commit 4ed7c4ccd3
8 changed files with 16 additions and 10 deletions

View File

@ -4,6 +4,7 @@ class Application_Model_Datatables
{ {
private static function buildWhereClauseForAdvancedSearch($dbname2searchTerm) private static function buildWhereClauseForAdvancedSearch($dbname2searchTerm)
{ {
$where = array();
$where['clause'] = array(); $where['clause'] = array();
$where['params'] = array(); $where['params'] = array();
foreach ($dbname2searchTerm as $dbname=>$term) { foreach ($dbname2searchTerm as $dbname=>$term) {

View File

@ -1075,8 +1075,7 @@ SQL;
$sql .= "END WHERE position IN ($currentPos) and playlist_id=:p1"; $sql .= "END WHERE position IN ($currentPos) and playlist_id=:p1";
Application_Common_Database::prepareAndExecute($sql, array("p1"=>$this->id)); Application_Common_Database::prepareAndExecute($sql, array("p1"=>$this->id));
$result['result'] = 0; return array('result' => 0);
return $result;
} }
public static function getAllPlaylistFiles() public static function getAllPlaylistFiles()

View File

@ -85,6 +85,9 @@ class Application_Model_Scheduler
$nowEpoch = floatval($this->nowDT->format("U.u")); $nowEpoch = floatval($this->nowDT->format("U.u"));
$schedInfo = array();
$instanceInfo = array();
for ($i = 0; $i < count($items); $i++) { for ($i = 0; $i < count($items); $i++) {
$id = $items[$i]["id"]; $id = $items[$i]["id"];
@ -103,7 +106,7 @@ class Application_Model_Scheduler
} }
$schedIds = array(); $schedIds = array();
if (isset($schedInfo)) { if (count($schedInfo) > 0) {
$schedIds = array_keys($schedInfo); $schedIds = array_keys($schedInfo);
} }
$schedItems = CcScheduleQuery::create()->findPKs($schedIds, $this->con); $schedItems = CcScheduleQuery::create()->findPKs($schedIds, $this->con);

View File

@ -388,6 +388,7 @@ class Application_Model_ShowBuilder
$outdated = false; $outdated = false;
$shows = Application_Model_Show::getShows($this->startDT, $this->endDT); $shows = Application_Model_Show::getShows($this->startDT, $this->endDT);
$include = array();
if ($this->opts["showFilter"] !== 0) { if ($this->opts["showFilter"] !== 0) {
$include[] = $this->opts["showFilter"]; $include[] = $this->opts["showFilter"];
} elseif ($this->opts["myShows"] === 1) { } elseif ($this->opts["myShows"] === 1) {

View File

@ -352,10 +352,10 @@ SQL;
); );
//only need to check overlap if show increased in size. //only need to check overlap if show increased in size.
if (strtotime($new_ends) > strtotime($ends)) { if (strtotime($now_ends) > strtotime($ends)) {
$utcStartDateTime = new DateTime($ends, new DateTimeZone("UTC")); $utcStartDateTime = new DateTime($ends, new DateTimeZone("UTC"));
$utcEndDateTime = new DateTime($new_ends, new DateTimeZone("UTC")); $utcEndDateTime = new DateTime($now_ends, new DateTimeZone("UTC"));
$overlap = Application_Model_Show::getShows($utcStartDateTime, $utcEndDateTime); $overlap = Application_Model_Show::getShows($utcStartDateTime, $utcEndDateTime);
@ -381,7 +381,7 @@ SQL;
} }
$this->setShowEnd($new_ends); $this->setShowEnd($now_ends);
Application_Model_RabbitMq::PushSchedule(); Application_Model_RabbitMq::PushSchedule();
} }

View File

@ -893,7 +893,7 @@ SQL;
$in = fopen($_FILES['file']['tmp_name'], "rb"); $in = fopen($_FILES['file']['tmp_name'], "rb");
if ($in) { if ($in) {
while ($buff = fread($in, 4096)) while (($buff = fread($in, 4096)))
fwrite($out, $buff); fwrite($out, $buff);
} else } else
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": _("Failed to open input stream.")}, "id" : "id"}'); die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": _("Failed to open input stream.")}, "id" : "id"}');
@ -912,7 +912,7 @@ SQL;
$in = fopen("php://input", "rb"); $in = fopen("php://input", "rb");
if ($in) { if ($in) {
while ($buff = fread($in, 4096)) while (($buff = fread($in, 4096)))
fwrite($out, $buff); fwrite($out, $buff);
} else } else
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": _("Failed to open input stream.")}, "id" : "id"}'); die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": _("Failed to open input stream.")}, "id" : "id"}');
@ -961,6 +961,7 @@ SQL;
// Check if we have enough space before copying // Check if we have enough space before copying
if (!self::isEnoughDiskSpaceToCopy($stor, $audio_file)) { if (!self::isEnoughDiskSpaceToCopy($stor, $audio_file)) {
$freeSpace = disk_free_space($stor); $freeSpace = disk_free_space($stor);
$fileSize = filesize($audio_file);
return array("code" => 107, return array("code" => 107,
"message" => sprintf(_("The file was not uploaded, there is " "message" => sprintf(_("The file was not uploaded, there is "

View File

@ -125,6 +125,7 @@ class Application_Model_Systemstatus
public static function GetPlatformInfo() public static function GetPlatformInfo()
{ {
$keys = array("release", "machine", "memory", "swap"); $keys = array("release", "machine", "memory", "swap");
$data = array();
foreach ($keys as $key) { foreach ($keys as $key) {
$data[$key] = "UNKNOWN"; $data[$key] = "UNKNOWN";
} }
@ -212,7 +213,7 @@ class Application_Model_Systemstatus
public static function GetDiskInfo() public static function GetDiskInfo()
{ {
$partions = array(); $partitions = array();
/* First lets get all the watched directories. Then we can group them /* First lets get all the watched directories. Then we can group them
* into the same partitions by comparing the partition sizes. */ * into the same partitions by comparing the partition sizes. */

View File

@ -226,7 +226,7 @@ class Application_Model_User
public function deleteAllFiles() public function deleteAllFiles()
{ {
$my_files = $this->getOwnedFiles(); $my_files = $this->getOwnedFiles();
foreach ($files as $file) { foreach ($my_files as $file) {
$file->delete(); $file->delete();
} }
} }