• Welcome to PHPVIBE Forums. Please log in.

[ Video Sharing CMS v4 ] Translation issue

Started by sevarf2,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sevarf2Topic starter

Hello, i have a problem with translations. A new language created and also the default don't save any changes and after save all fields are blank. Any idea?
  •  

Marius P.

Hi! Serialize issues probably. Turn register_globals off and let me know if that solved it (try again adding a language).

Google search: https://www.google.com/search?q=Turn+register_globals+off
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

sevarf2Topic starter

  •  

Marius P.

Then the alternative it's to replace
maybe_serialize with json_encode
maybe_unserialize with json_decode

in lib/functions.php

This are the reworked functions to replace with:

/**
 * Get language terms from the DB
 *
 */
function get_language( $lang_code, $default = false ) {
	global $cachedb;
	
		$lang_code = escape( $lang_code );
		$row = $cachedb->get_row( "SELECT `lang_terms` as tr FROM ".DB_PREFIX."languages WHERE `lang_code` = '$lang_code' LIMIT 1");
		//$cachedb->debug();
		if ($row) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values
			//echo unserialize(stripslashes($row->tr));
	return apply_filter( 'get_language_'.$lang_code,  stripslashes_deep(json_decode($row->tr , true)));
	} else { 
			return false;
		}
}

/**
 * Add an language to the DB
 *
 */
function add_language( $name, $value = '' ) {
   global $db;
   
   $safe_name = escape( $name );
   $long_name = escape($value["language-name"]);

   // Make sure the language doesn't already exist
$language = $db->get_row( "SELECT term_id FROM  ".DB_PREFIX."languages WHERE `lang_code` = '$name'" );
   if ( !$language || !$language->term_id ) {
   $_value = escape( json_encode( $value ) );
   
//var_dump(serialize( $value ));
   //do_action( 'add_language', $safe_name, $_value );

   $db->query( "INSERT INTO  ".DB_PREFIX."languages (`lang_name`, `lang_code`, `lang_terms`) VALUES ('$long_name','$name', '$_value')" );
   }
   return;
}
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

Marius P.

Can you tell me what's your server's environment (php, server, os, setts)?
This is the second time this happens, even if this it's an isolated event, I want to be able to guide on avoiding it.
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

sevarf2Topic starter

Hi, thanks this solution worked. I can send server specs via email just tell me where.
  •  

Marius P.

Send them as a mail to office@phpvibe.com with subject "To Mario" , it will be simpler.
Thank you!
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

DonGito

Hello,

have had the same issue and now saving works fine. But there is still trouble with german umlauts (character) they turn into ä = u00e4, ö = u00f6, ...

How to fix that? oO
  •  

epke12

#8
Got the same problem :(

Edit:

Its fixed with solution in this thread
  •  

Martin

Mario what is this thing caused from I wanna let my hosting know?

PHPVibe A.

Quote from: DonGito on
Hello,

have had the same issue and now saving works fine. But there is still trouble with german umlauts (character) they turn into ä = u00e4, ö = u00f6, ...

How to fix that? oO

Let me open a dev ticket with Mario for this, I don't have experience with encodings.

PHPVibe A.

Quote from: Martin on
Mario what is this thing caused from I wanna let my hosting know?

Serializing it's problematic, even if Wordpress uses it to, we are dropping it for languages, keeping it just for settings (less to serialize).
Honestly I cannot say, they are so many causes on Google, maybe Mario has a clue.

Martin

I understand but I need to fix my SITE NOW you know?

Martin

#13
The upper code provided by Mario doesn't work for me even on clean install, the same thing happens I create a Language (not existing one) brand new setup and it's not working when I click save it doesn't save anything at all.. it saves blank fields this for me is huge problem guys please fix it

PHPVibe A.

I need details, errors, to help you out. Else I cannot know what's going on there.
It works fine on both json and serialize for me (I got 3 sites with PHPVibe).

Martin

Where do I take this details from what exactly you need?

When I get on Language and I try to create new language and I change a value and I save it it's SAVED empty all the fields are EMPTY that's all the details I GOT

PHPVibe A.

This are functional details. Look in the error log , look in the database for lang tables, see if the content is there.

Martin


PHPVibe A.

CPanel has a error log, at least a global one, even if on ftp there is none.

Martin


PHPVibe A.

It should be on the first page of cpanel, ctrl+f and type "Error"

Martin

I found it but there is nothing in there

PHPVibe A.

Ok, and in the vibe_languages table in the database?

Martin

what exactly are you talking about can u be more specific?

PHPVibe A.

I can't be more specific than that, but here you go, maybe a screen helps you understand.

And back to the question: is you table having content?

Similar topics (7)