Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Suspected bugs in settings_languages.php

User locale update
CodeDownload  

//Sanitize users languages
for ($i = 0; $i < sizeof($enabled_languages); $i++) {
   $result = dbquery("UPDATE ".DB_USERS." SET user_language = '".$settings['locale']."' WHERE user_language !='".$enabled_languages[$i]."'");
}



I'd say that this changes every user language to the default - not just the ones that are disabled. Take for example "Danish" and "English" with default language "Danish":

1) update user_language to Danish, if not Danish (All rows are updated to Danish)
2) update user_language to Danish, if not English (No effect - no rows are English anymore)

Panel locale update
CodeDownload  

//Sanitize and update panel languages
for ($i = 0; $i < sizeof($enabled_languages); $i++) {
   $panel_langs .= $settings['enabled_languages'].($i < (sizeof($settings['enabled_languages']) - 1) ? "." : "");
}
if (sizeof($enabled_languages) > 1) {
 $result = dbquery("UPDATE ".DB_PANELS." SET panel_languages='".$panel_langs."'");
} else {
 $result = dbquery("UPDATE ".DB_PANELS." SET panel_languages='".$settings['locale']."'");
}


This snippet copies every enabled into panel_languages for as many times as there are languages:
i.imgur.com/zuvAhkb.png

Performance issue in translations
CodeDownload  

//Sanitize news_cat_languages
for ($i = 0; $i < sizeof($enabled_languages); $i++) {
 $result = dbquery("DELETE FROM ".DB_NEWS_CATS." WHERE news_cat_language !='".$enabled_languages[$i]."' AND news_cat_language !='".$settings['locale']."'");
 }
//Sanitize site links_languages
for ($i = 0; $i < sizeof($enabled_languages); $i++) {
 $result = dbquery("DELETE FROM ".DB_SITE_LINKS." WHERE link_language !='".$enabled_languages[$i]."' AND link_language !='".$settings['locale']."'");
}
//Sanitize the email templates languages
for ($i = 0; $i < sizeof($enabled_languages); $i++) {
 $result = dbquery("DELETE FROM ".DB_EMAIL_TEMPLATES." WHERE template_language !='".$enabled_languages[$i]."' AND template_language !='".$settings['locale']."'");
}
//Sanitize forum rank languages
for ($i = 0; $i < sizeof($enabled_languages); $i++) {
 $result = dbquery("DELETE FROM ".DB_FORUM_RANKS." WHERE rank_language !='".$enabled_languages[$i]."' AND rank_language !='".$settings['locale']."'");
}


this deletes every translation that is not the default locale because it takes them one at a time. Take an example with "Danish" and "English", default being "Danish":
1) Delete every translation that is non-danish and non-danish (Delete all English entries)
2) Delete every translation that is non-english and non-danish (No effect)

That said, this (~112 - ~192) nullifies the previous error, as every translation missing is just re-inserted. As such, it's mostly a performance bug, but here it is.

Overwriting every translation with default locale
CodeDownload  

if (($localeset != $old_localeset) && !$error) {
....
}


In an earlier snippet, a translation for each enabled language is inserted into the database. In this one, every translation that is not the default is replaced with the default, creating doubles of one language and eliminating the rest.

i.imgur.com/HrHErXU.png
Yes, we know about errors and we are working on fixes
Thread Information
Author
Replies
2 posts
Views
309 times
Last Post
Last updated on 8 months ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Mickelvlm, RobiNN