Skip to content

Commit

Permalink
fixed undefined array key warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketMan committed Dec 13, 2023
1 parent b52a1b1 commit 45927a9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions ui/AddManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class AddManager extends MenuItem {
];

private $focus;
private $emitted;
private $emitted = [];
private $albumAdded;
private $editingAlbum;
private $errorMessage;
Expand Down Expand Up @@ -131,7 +131,7 @@ public function addManagerEmitAlbums(&$records, $subaction, $static=0, $sort=0)
}

public function addManagerMain() {
switch($_REQUEST["op"]) {
switch($_REQUEST["op"] ?? '') {
case "edit":
$this->addManagerEdit();
break;
Expand Down Expand Up @@ -223,7 +223,7 @@ public function panelAddPull($validate) {

public function panelAID($validate) {
// Check to ensure AID is numeric
$aid = $_REQUEST["aid"];
$aid = $_REQUEST["aid"] ?? '';
$temp = (float)$aid;
$temp = (string)$temp;

Expand Down Expand Up @@ -251,7 +251,7 @@ public function panelAID($validate) {

public function panelTag($validate) {
// Check to ensure tag is numeric
$tag = $_REQUEST["tag"];
$tag = $_REQUEST["tag"] ?? '';
$temp = (float)$tag;
$temp = (string)$temp;

Expand Down Expand Up @@ -394,7 +394,7 @@ private function emitVars() {
$post = $_SERVER["REQUEST_METHOD"] == "POST";

foreach($post?$_POST:$_GET as $key => $value)
if(!$this->emitted[$key])
if(empty($this->emitted[$key]))
echo " <INPUT TYPE=HIDDEN NAME=$key VALUE=\"" . htmlentities(stripslashes($value)) . "\">\n";
}

Expand Down Expand Up @@ -437,7 +437,7 @@ public function panelNull($validate) {
}

public function addManagerAdd() {
$seq = $_REQUEST["seq"];
$seq = $_REQUEST["seq"] ?? '';

// We're always going to make two passes:
// Pass 1: Call step $seq to validate
Expand Down
16 changes: 8 additions & 8 deletions ui/Charts.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ public function chartWeekly() {
$station = Engine::param('station', 'KZSU');

$chartAPI = Engine::api(IChart::class);
$year = $_REQUEST["year"];
$month = $_REQUEST["month"];
$day = $_REQUEST["day"];
$year = $_REQUEST["year"] ?? 0;
$month = $_REQUEST["month"] ?? 0;
$day = $_REQUEST["day"] ?? 0;

$dateSpec = UI::getClientLocale() == 'en_US' ? 'F j, Y' : 'j F Y';

Expand Down Expand Up @@ -210,11 +210,11 @@ public function chartMonthly() {
$station = Engine::param('station', 'KZSU');

$chartAPI = Engine::api(IChart::class);
$year = $_REQUEST["year"];
$month = $_REQUEST["month"];
$day = $_REQUEST["day"];
$cyear = $_REQUEST["cyear"];
$dnum = $_REQUEST["dnum"];
$year = $_REQUEST["year"] ?? 0;
$month = $_REQUEST["month"] ?? 0;
$day = $_REQUEST["day"] ?? 0;
$cyear = $_REQUEST["cyear"] ?? 0;
$dnum = $_REQUEST["dnum"] ?? 0;

$config = Engine::param('chart');
$earliestYear = array_key_exists('earliest_chart_year', $config)?
Expand Down
8 changes: 4 additions & 4 deletions ui/Playlists.php
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ public function emitImportList() {
$this->addVar('enclosure', $enclosure);
$this->addVar('description', stripslashes($description));
$this->addVar('MAX_DESCRIPTION_LENGTH', IPlaylist::MAX_DESCRIPTION_LENGTH);
$this->addVar('airname', $airname);
$this->addVar('airname', $airname ?? '');
$this->addVar('MAX_AIRNAME_LENGTH', IDJ::MAX_AIRNAME_LENGTH);
} else if($format == "csv"){
// Create the playlist
Expand Down Expand Up @@ -911,9 +911,9 @@ private function emitViewDJAlbum(&$result, $class="", $count=0, $labelField="lab
public function emitViewDJ() {
UI::emitJS('js/zklistbox.js');

$seq = $_REQUEST["seq"];
$viewuser = $_REQUEST["viewuser"];
$playlist = $_REQUEST["playlist"];
$seq = $_REQUEST["seq"] ?? '';
$viewuser = $_REQUEST["viewuser"] ?? 0;
$playlist = $_REQUEST["playlist"] ?? 0;

settype($playlist, "integer");
settype($viewuser, "integer");
Expand Down
2 changes: 1 addition & 1 deletion ui/Reviews.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function emitViewDJMain() {
}

public function reviewsByDJ() {
$seq = $_REQUEST["seq"];
$seq = $_REQUEST["seq"] ?? '';
$viewuser = $_REQUEST["viewuser"] ?? null;
if($seq == "selUser" && $viewuser) {
$airname = null;
Expand Down

0 comments on commit 45927a9

Please sign in to comment.