Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This fix broken language selection in admin -> settings. #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nielsrune
Copy link
Contributor

What are the changes about?

This fix broken language selection in admin -> settings.

Together with new function get_root() it is ensure, that the cookie 'languageId' is set across the entire app folder, not individual subfolders, i.e. index/ and admin/

Also minor correction and highlighted questions.

Have you checked the following?

@@ -119,11 +123,14 @@

$q = db_select("select * from brugere where brugernavn = '$brugernavn'",__FILE__ . " linje " . __LINE__);
$r = db_fetch_array($q);
if ($brugerId=$r['id']) {
/** The following test is always false as this is the only occurence of $brugerId in the entire codebase.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable bruger_id exsists, however the variables that get created don't seem to be called anywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I have misread the if statement as a comparison. But now I see it is an assignment to $brugerId.

In this case, a more readable code would be just isset($r['id'] as it is doing nothing more. And $brugerId is not used anywhere else

@@ -100,10 +101,13 @@
}
update_settings_value("nyhed", "dashboard", $newssnippet, "The news snippet showen to all admin accounts on this system");
db_modify($qtxt,__FILE__ . " linje " . __LINE__);
$qtxt="update settings set var_value='$languageId' where var_name='languageId'";
$qtxt="update settings set var_value='$languageId' where var_name='language_id'";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the logic behind changing languageId to language_id?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic being that language_id is the value set in the table field var_name :-)
See here:

saldi/index/install.php

Lines 272 to 273 in 377e1dc

$qtxt = "insert into settings(var_name,var_grp,var_value,var_description,user_id) values ";
$qtxt.= "('language_id','globals','0','Active systemlanguage','0')";

@logicguy1 logicguy1 added the bug label Jan 28, 2025
@nielsrune nielsrune force-pushed the fix_admin_settings_language branch 2 times, most recently from 0074ec9 to c0b6cb0 Compare January 28, 2025 16:56
@logicguy1
Copy link
Contributor

I just need to run this though Peter before we can pull the PR

@nielsrune
Copy link
Contributor Author

This shouldn't be merged before #26, see comment just now.
I don't recall why the javascript code in index.php was not handled in this one :-(

@nielsrune nielsrune force-pushed the fix_admin_settings_language branch from c0b6cb0 to 6a6b5d6 Compare January 29, 2025 21:15
Together with new function get_root() it is ensure, that the cookie 'languageId' is set across the entire app folder, not individual subfolders, i.e. index/ and admin/

Also minor correction and highlighted questions.
@nielsrune nielsrune force-pushed the fix_admin_settings_language branch from 6a6b5d6 to 6d4d3f2 Compare February 10, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants