Merge pull request #4286 from MrPetovan/task/fix-scrutinizer-issues
Fix undefined variables PHP Notice
This commit is contained in:
commit
64dc640565
|
@ -1145,6 +1145,7 @@ class dba {
|
||||||
|
|
||||||
$condition_string = self::buildCondition($condition);
|
$condition_string = self::buildCondition($condition);
|
||||||
|
|
||||||
|
$order_string = '';
|
||||||
if (isset($params['order'])) {
|
if (isset($params['order'])) {
|
||||||
$order_string = " ORDER BY ";
|
$order_string = " ORDER BY ";
|
||||||
foreach ($params['order'] AS $fields => $order) {
|
foreach ($params['order'] AS $fields => $order) {
|
||||||
|
@ -1157,6 +1158,7 @@ class dba {
|
||||||
$order_string = substr($order_string, 0, -2);
|
$order_string = substr($order_string, 0, -2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$limit_string = '';
|
||||||
if (isset($params['limit']) && is_int($params['limit'])) {
|
if (isset($params['limit']) && is_int($params['limit'])) {
|
||||||
$limit_string = " LIMIT " . $params['limit'];
|
$limit_string = " LIMIT " . $params['limit'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,12 @@ require_once "include/dba.php";
|
||||||
*/
|
*/
|
||||||
function get_browser_language() {
|
function get_browser_language() {
|
||||||
|
|
||||||
|
$lang_list = [];
|
||||||
if (x($_SERVER, 'HTTP_ACCEPT_LANGUAGE')) {
|
if (x($_SERVER, 'HTTP_ACCEPT_LANGUAGE')) {
|
||||||
// break up string into pieces (languages and q factors)
|
// break up string into pieces (languages and q factors)
|
||||||
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i',
|
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i',
|
||||||
$_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
|
$_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
|
||||||
|
|
||||||
$lang_list = [];
|
|
||||||
if (count($lang_parse[1])) {
|
if (count($lang_parse[1])) {
|
||||||
// go through the list of prefered languages and add a generic language
|
// go through the list of prefered languages and add a generic language
|
||||||
// for sub-linguas (e.g. de-ch will add de) if not already in array
|
// for sub-linguas (e.g. de-ch will add de) if not already in array
|
||||||
|
@ -41,8 +41,7 @@ function get_browser_language() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if we have translations for the preferred languages and pick the 1st that has
|
// check if we have translations for the preferred languages and pick the 1st that has
|
||||||
for ($i = 0; $i < count($lang_list); $i++) {
|
foreach ($lang_list as $lang) {
|
||||||
$lang = $lang_list[$i];
|
|
||||||
if ($lang === 'en' || (file_exists("view/lang/$lang") && is_dir("view/lang/$lang"))) {
|
if ($lang === 'en' || (file_exists("view/lang/$lang") && is_dir("view/lang/$lang"))) {
|
||||||
$preferred = $lang;
|
$preferred = $lang;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -135,6 +135,7 @@ function search_content(App $a) {
|
||||||
|
|
||||||
Nav::setSelected('search');
|
Nav::setSelected('search');
|
||||||
|
|
||||||
|
$search = '';
|
||||||
if (x($a->data,'search'))
|
if (x($a->data,'search'))
|
||||||
$search = notags(trim($a->data['search']));
|
$search = notags(trim($a->data['search']));
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue