mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
#11001 tips correction
This commit is contained in:
parent
577428d193
commit
101ba8dad3
@ -275,14 +275,14 @@ class TipsWindow
|
|||||||
$sql .= ' ORDER BY CASE WHEN id_lang = "'.$language.'" THEN id_lang END DESC, RAND()';
|
$sql .= ' ORDER BY CASE WHEN id_lang = "'.$language.'" THEN id_lang END DESC, RAND()';
|
||||||
|
|
||||||
$tip = db_get_row_sql($sql);
|
$tip = db_get_row_sql($sql);
|
||||||
|
$check_tips = db_get_row_sql('SELECT count(*) AS tips FROM twelcome_tip WHERE id_lang = "'.$language.'"')['tips'];
|
||||||
if (empty($tip) === false) {
|
if (empty($tip) === false) {
|
||||||
$tip['files'] = $this->getFilesFromTip($tip['id']);
|
$tip['files'] = $this->getFilesFromTip($tip['id']);
|
||||||
|
|
||||||
$tip['title'] = io_safe_output($tip['title']);
|
$tip['title'] = io_safe_output($tip['title']);
|
||||||
$tip['text'] = io_safe_output($tip['text']);
|
$tip['text'] = io_safe_output($tip['text']);
|
||||||
$tip['url'] = io_safe_output($tip['url']);
|
$tip['url'] = io_safe_output($tip['url']);
|
||||||
} else {
|
} else if ($check_tips === '0') {
|
||||||
$language = 'en_GB';
|
$language = 'en_GB';
|
||||||
$sql = 'SELECT id, title, text, url
|
$sql = 'SELECT id, title, text, url
|
||||||
FROM twelcome_tip
|
FROM twelcome_tip
|
||||||
@ -325,6 +325,15 @@ class TipsWindow
|
|||||||
global $config;
|
global $config;
|
||||||
$profilesUser = users_get_user_profile($config['id_user']);
|
$profilesUser = users_get_user_profile($config['id_user']);
|
||||||
$idProfilesFilter = '0';
|
$idProfilesFilter = '0';
|
||||||
|
$userInfo = users_get_user_by_id($config['id_user']);
|
||||||
|
$language = ($userInfo['language'] !== 'default') ? $userInfo['language'] : $config['language'];
|
||||||
|
|
||||||
|
$check_tips = db_get_row_sql('SELECT count(*) AS tips FROM twelcome_tip WHERE id_lang = "'.$language.'"')['tips'];
|
||||||
|
|
||||||
|
if ($check_tips === '0') {
|
||||||
|
$language = 'en_GB';
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($profilesUser as $key => $profile) {
|
foreach ($profilesUser as $key => $profile) {
|
||||||
$idProfilesFilter .= ','.$profile['id_perfil'];
|
$idProfilesFilter .= ','.$profile['id_perfil'];
|
||||||
}
|
}
|
||||||
@ -334,10 +343,9 @@ class TipsWindow
|
|||||||
WHERE enable = "1" ';
|
WHERE enable = "1" ';
|
||||||
|
|
||||||
$sql .= sprintf(' AND id_profile IN (%s)', $idProfilesFilter);
|
$sql .= sprintf(' AND id_profile IN (%s)', $idProfilesFilter);
|
||||||
$sql .= sprintf(' AND id_lang = "%s"', $config['language']);
|
$sql .= sprintf(' AND id_lang = "%s"', $language);
|
||||||
|
|
||||||
$sql .= ' ORDER BY CASE WHEN id_lang = "'.$config['language'].'" THEN id_lang END DESC, RAND()';
|
|
||||||
|
|
||||||
|
$sql .= ' ORDER BY CASE WHEN id_lang = "'.$language.'" THEN id_lang END DESC, RAND()';
|
||||||
return db_get_sql($sql);
|
return db_get_sql($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user