smilies.inc.php and lang files smilies.inc.php and lang files
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

smilies.inc.php and lang files

Started by PatHibulaire, August 24, 2005, 11:32:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

PatHibulaire

Hi,

I'm new here and I use Coppermine since a little time and I would like to congratulate developpers for the job they did (and they do :)).

I have a question about file "smilies.inc.php" :

I added smilies to Coppermine and, in this file, I added too a link which allows to hide/show the smilies list. However I would like to change the text of this link according to smilies being displayed or not (if smilies are displayed, link is "Hide smileys" and if smilies are hidden, link is "Show smilies"). I can put this text directly in "smilies.inc.php" and all works fine, but I would like to use the language files.

So I set 2 vars in lang files : $lang_smilies_inc_php['smiliesShow'] = "Show Smilies" and $lang_smilies_inc_php['smiliesHide'] = "Hide smilies".

I try to use these 2 vars in "smilies.inc.php" (in function "generate_smilies"), so I set "$lang_smilies_inc_php" to global in "generate_smilies" but the 2 vars stay blank when I call "displayimage.php".

So my question is how can I use a var defined in a lang file in file "smilies.inc.php" ?

PS : I have shown a thread which said to add define('SMILIES_PHP', true); in "displayimage.php", so I uncommented the line but it still doesn't work.

Thanks for your help

Nibbler

#1
Where in the lang file did you add the new variables ? Try adding them into the existing array.

PatHibulaire

It's what I did, here is part of the code :


if (defined('SMILIES_PHP')) $lang_smilies_inc_php = array(
'Interrogation' => 'Interrogation',
'Heart' => 'Heartr',
...
'smiliesShow' => 'Show smilies',
'smiliesHide' => 'Hideles smilies',
);


and in "smilies.inc.php" :


function generate_smilies($form = 'post', $field = 'message')
{
global $lang_smilies_inc_php;
...
$html .= '<a href="#" onClick="'.$jsFunc.'" id="smiliesShowHide'.$smiliesListId.'">'.$lang_smilies_inc_php["smiliesShow"].'</a>';
...

Nibbler

I just applied the changes you describe to my test install and it worked fine. Make sure you are editing the right lang file for the lang you actually use.

PatHibulaire

Well I don't understand, I reinstalled Coppermine in another folder and $lang_smilies_inc_php is blank.

Joachim Müller

When you access an include file directly in your browser, that's expected behaviour. What's the actual problem?

PatHibulaire

I deleted line which test if SMILIES_PHP is defined in lang file and all works fine now.
Array is so available everywhere.