'Save' button in translation does not work

Please report bugs here!

Moderator: Thorsten

Post Reply
frphilip
Posts: 2
Joined: Sun May 14, 2017 10:42 pm

'Save' button in translation does not work

Post by frphilip »

Hi,
'Save' button in translations does not work. Translation update are not saved.
Cheked, Lang folder is 755, and file has been tested with 755 and 777 without success

Thanks for your help
Thorsten
Posts: 15559
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: 'Save' button in translation does not work

Post by Thorsten »

Hi,

which version do you use?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
frphilip
Posts: 2
Joined: Sun May 14, 2017 10:42 pm

Re: 'Save' button in translation does not work

Post by frphilip »

Hi, thanks for reply
2.9.7, last one...
Thorsten
Posts: 15559
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: 'Save' button in translation does not work

Post by Thorsten »

Hi,

I can confirm this, working on it.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
tifa_choi
Posts: 1
Joined: Tue Jun 20, 2017 2:57 am

Re: 'Save' button in translation does not work

Post by tifa_choi »

I installed 2.9.7 last week and encountered the same issue as well. After spending a few hours comparing the source codes of 2.9.7 and 2.8.29, finally I got the answer!

In the file admin > ajax.trans.php, the save process died after line 37 because $csrfToken was never set:

Code: Select all

if (!isset($_SESSION['phpmyfaq_csrf_token']) || $_SESSION['phpmyfaq_csrf_token'] !== $csrfToken) {
    exit(1);
}
So, let's get back to the file admin > trans.edit.php, add the following code after line 94:

Code: Select all

<input type="hidden" name="csrf" value="<?php echo $user->getCsrfTokenFromSession() ?>">
which is the missing line in 2.9.7 (of coz it exists in 2.8.29), and the whole thing should be like this:

Code: Select all

<form id="transDiffForm" accept-charset="utf-8">
<input type="hidden" name="csrf" value="<?php echo $user->getCsrfTokenFromSession() ?>">
<table class="table table-hover">
<tr>
<th><?php echo $PMF_LANG['msgVariable'] ?></th>
<th>en</th>
<th><?php echo $translateLang ?></th>
</tr>
Bravo! I hope this would help the others :)

Regards,
Tifa
Thorsten
Posts: 15559
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: 'Save' button in translation does not work

Post by Thorsten »

Hi,

thanks a lot, you're right, it's the fix! Will add this for 2.9.8!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply