Fix wrong usage of null coalescing operator

This commit is contained in:
DariusIII
2017-03-06 14:16:52 +01:00
parent 3dea184ba3
commit 49de43355b
8 changed files with 23 additions and 22 deletions
+1
View File
@@ -1,4 +1,5 @@
2017-03-06 DariusIII
* Fix: Fix wrong usage of null coalescing operator
* Chg: Remove unused classes (Desura, Greenlight), update Logger, Logging, Menu, MiscSorter classes
2017-03-03 DariusIII
* Chg: Update ternary to PHP 7 style in start.php
+1 -1
View File
@@ -22,7 +22,7 @@ $db_name = DB_NAME;
$dbtype = DB_SYSTEM;
$tmux = $tRun->get('niceness');
$tmux_niceness = isset($tmux->niceness) ?? 2;
$tmux_niceness = $tmux->niceness ?? 2;
$runVar['constants'] = $pdo->queryOneRow($tRun->getConstantSettings());
+1 -1
View File
@@ -259,7 +259,7 @@ class Books
);
$return = $this->pdo->query($sql, true, NN_CACHE_EXPIRY_MEDIUM);
if (!empty($return)) {
$return[0]['_totalcount'] = (isset($books['total']) ?? 0);
$return[0]['_totalcount'] = $books['total'] ?? 0;
}
return $return;
}
+1 -1
View File
@@ -253,7 +253,7 @@ class Console
), true, NN_CACHE_EXPIRY_MEDIUM
);
if (!empty($return)) {
$return[0]['_totalcount'] = (isset($consoles['total']) ?? 0);
$return[0]['_totalcount'] = $consoles['total'] ?? 0;
}
return $return;
}
+1 -1
View File
@@ -359,7 +359,7 @@ class Movie
);
$return = $this->pdo->query($sql, true, NN_CACHE_EXPIRY_MEDIUM);
if (!empty($return)) {
$return[0]['_totalcount'] = (isset($movies['total']) ?? 0);
$return[0]['_totalcount'] = $movies['total'] ?? 0;
}
return $return;
}
+14 -14
View File
@@ -83,8 +83,8 @@ class Music
$this->pubkey = Settings::value('APIs..amazonpubkey');
$this->privkey = Settings::value('APIs..amazonprivkey');
$this->asstag = Settings::value('APIs..amazonassociatetag');
$this->musicqty = (Settings::value('..maxmusicprocessed') != '') ? Settings::value('..maxmusicprocessed') : 150;
$this->sleeptime = (Settings::value('..amazonsleep') != '') ? Settings::value('..amazonsleep') : 1000;
$this->musicqty = Settings::value('..maxmusicprocessed') != '' ? Settings::value('..maxmusicprocessed') : 150;
$this->sleeptime = Settings::value('..amazonsleep') != '' ? Settings::value('..amazonsleep') : 1000;
$this->imgSavePath = NN_COVERS . 'music' . DS;
$this->renamed = '';
if (Settings::value('..lookupmusic') == 2) {
@@ -101,7 +101,7 @@ class Music
*/
public function getMusicInfo($id)
{
return $this->pdo->queryOneRow(sprintf("SELECT musicinfo.*, genres.title AS genres FROM musicinfo LEFT OUTER JOIN genres ON genres.id = musicinfo.genres_id WHERE musicinfo.id = %d ", $id));
return $this->pdo->queryOneRow(sprintf('SELECT musicinfo.*, genres.title AS genres FROM musicinfo LEFT OUTER JOIN genres ON genres.id = musicinfo.genres_id WHERE musicinfo.id = %d ', $id));
}
/**
@@ -114,7 +114,7 @@ class Music
{
$pdo = $this->pdo;
$like = 'ILIKE';
if ($pdo->dbSystem() === 'mysql') {
if ($pdo->DbSystem() === 'mysql') {
$like = 'LIKE';
}
@@ -139,9 +139,9 @@ class Music
}
}
$searchwords = trim($searchwords);
$searchsql .= sprintf(" MATCH(artist, title) AGAINST(%s IN BOOLEAN MODE)", $pdo->escapeString($searchwords));
$searchsql .= sprintf(' MATCH(artist, title) AGAINST(%s IN BOOLEAN MODE)', $pdo->escapeString($searchwords));
}
return $pdo->queryOneRow(sprintf("SELECT * FROM musicinfo WHERE %s", $searchsql));
return $pdo->queryOneRow(sprintf('SELECT * FROM musicinfo WHERE %s', $searchsql));
}
/**
@@ -155,12 +155,12 @@ class Music
if ($start === false) {
$limit = "";
$limit = '';
} else {
$limit = " LIMIT " . $num . " OFFSET " . $start;
$limit = ' LIMIT ' . $num . ' OFFSET ' . $start;
}
return $this->pdo->query(" SELECT * FROM musicinfo ORDER BY createddate DESC" . $limit);
return $this->pdo->query('SELECT * FROM musicinfo ORDER BY createddate DESC' . $limit);
}
/**
@@ -169,8 +169,8 @@ class Music
public function getCount()
{
$res = $this->pdo->queryOneRow("SELECT COUNT(id) AS num FROM musicinfo");
return $res["num"];
$res = $this->pdo->queryOneRow('SELECT COUNT(id) AS num FROM musicinfo');
return $res['num'];
}
/**
@@ -191,9 +191,9 @@ class Music
$catsrch = (new Category(['Settings' => $this->pdo]))->getCategorySearch($cat);
}
$exccatlist = "";
$exccatlist = '';
if (count($excludedcats) > 0) {
$exccatlist = " AND r.categories_id NOT IN (" . implode(",", $excludedcats) . ")";
$exccatlist = ' AND r.categories_id NOT IN (' . implode(',', $excludedcats) . ')';
}
$order = $this->getMusicOrder($orderby);
@@ -269,7 +269,7 @@ class Music
);
$return = $this->pdo->query($sql, true, NN_CACHE_EXPIRY_MEDIUM);
if (!empty($return)) {
$return[0]['_totalcount'] = (isset($music['total']) ? $music['total'] : 0);
$return[0]['_totalcount'] = $music['total'] ?? 0;
}
return $return;
+2 -2
View File
@@ -292,7 +292,7 @@ class TMDB extends TV
foreach ($showAlternativeTitles['alternative_titles']['results'] AS $aka) {
$highest['alternative_titles'][] = $aka['title'];
}
$highest['network'] = (isset($show['networks'][0]['name']) ?? '');
$highest['network'] = $show['networks'][0]['name'] ?? '';
$highest['external_ids'] = $showExternalIds['external_ids'];
}
$return = $this->formatShowInfo($highest);
@@ -375,7 +375,7 @@ class TMDB extends TV
'summary' => (string)$show['overview'],
'started' => (string)$show['first_air_date'],
'publisher' => isset($show['network']) ? (string)$show['network'] : '',
'country' => (string)(isset($show['origin_country'][0]) ?? ''),
'country' => (string)$show['origin_country'][0] ?? '',
'source' => (int)parent::SOURCE_TMDB,
'imdb' => isset($imdb['imdbid']) ? (int)$imdb['imdbid'] : 0,
'tvdb' => isset($show['external_ids']['tvdb_id']) ? (int)$show['external_ids']['tvdb_id'] : 0,
+2 -2
View File
@@ -8,7 +8,7 @@ if ($page->users->isLoggedIn()) {
header('Location: ' . WWW_TOP . '/');
}
$action = isset($_REQUEST['action']) ?? 'view';
$action = $_REQUEST['action'] ?? 'view';
$captcha = new Captcha($page);
$email = $sent = $confirmed = '';
@@ -46,7 +46,7 @@ switch($action) {
case 'submit':
if ($captcha->getError() === false) {
$email = !empty($_POST['email']) ?? '';
$email = $_POST['email'] ?? '';
if (empty($email)) {
$page->smarty->assign('error', 'Missing Email');
} else {