This tips will help you to solve language problem. Be sure to leave at least lang-english.php must be exists in "language/" directory in order this hack to work (used when no specified user languages has found). This will solve common problem when you get the following error message:
Warning: main(language/lang-.php): failed to open stream: No such file or directory...
if (($mad_newlang != '') && preg_match('/^[a-zA-Z0-9_-]+$/', "$mad_newlang") && file_exists("languages/lang-".$mad_newlang.".php"))
{
@setcookie("lang", "$mad_newlang", time()+31536000);
$currentlang = $mad_newlang;
}
elseif (($mad_lang != '') && preg_match('/^[a-zA-Z0-9_-]+$/', "$mad_lang") && file_exists("languages/lang-".$mad_lang.".php"))
{
$currentlang = $mad_lang;
}
elseif (preg_match('/^[a-zA-Z0-9_-]+$/', $language) && file_exists("languages/lang-".$language.".php"))
{
@setcookie("lang", $language, time()+31536000);
$currentlang = $language;
}
elseif (file_exists("languages/lang-english.php"))
{
@setcookie("lang", "english", time()+31536000);
$currentlang = "english";
}
else
{
/* none of language files found, do not continue and show nice msg to visitors */
die('<center><br /><br /><img border="0" src="images/logo.gif" /><br /><br /><b>Language Error</b><br />Sorry we have a problem with language for this site<br />Feel free to come back later</center>');
}
}
The next tips will help you to solve admin/module language problem. Be sure to leave at least lang-english.php must be exists in both "admin/language/" and "modules/MODNAME/language/" directories in order this hack to work (used when no specified user languages has found). This will solve common problem when you get the following error message:
Warning: main(admin/language/lang-.php): failed to open stream: No such file or directory... Warning: main(modules/MODNAME/language/lang-.php): failed to open stream: No such file or directory...
Open mainfile.php and find the following code:
Code:
function get_lang($module) {
global $currentlang, $language;
if (file_exists("modules/$module/language/lang-$currentlang.php")) {
if ($module == admin) {
include_once("admin/language/lang-$currentlang.php");
} else {
include_once("modules/$module/language/lang-$currentlang.php");
}
} else {
if ($module == admin) {
include_once("admin/language/lang-$currentlang.php");
} else {
include_once("modules/$module/language/lang-$language.php");
}
}
}
Replace with:
Code:
function get_lang($module)
{
global $admin, $currentlang, $language;
if ($module == admin)
{
$madadmin = (isset($admin)) ? ((is_array($admin)) ? ((isset($admin[2])) ? $admin : array()) : ((preg_match('/^[a-z0-9\/\+\=]+$/i', "$admin")) ? explode(':', base64_decode($admin)) : array())) : array();
$langfile = 'language/admin/lang-%s.php';
$currlang = (isset($madadmin[2]))? strtolower($madadmin[2]) : strtolower($currentlang);
$language = strtolower($language);
}
else if (($module != admin) && preg_match('/^[a-z0-9_-]+$/i', $module))
{
$langfile = 'module/' . $module . '/languages/lang-%s.php';
$currlang = strtolower($currentlang);
$language = strtolower($language);
}
else
{
/* this should not be called, unless some nasty modules do some trick here */
die('<center><br /><br /><img border="0" src="images/logo.gif" /><br /><br /><b>Language Error</b><br />Sorry we have a problem with language for this site. Please come back later.</center>');
}
if (file_exists(sprintf($langfile, $currlang)))
{
require_once(sprintf($langfile, $currlang));
}
elseif (file_exists(sprintf($langfile, $language)))
{
require_once(sprintf($langfile, $language));
}
elseif (file_exists(sprintf($langfile, 'english')))
{
require_once(sprintf($langfile, 'english'));
}
else
{
/* none of language files found, do not continue and show nice msg to visitors */
die('<center><br /><br /><img border="0" src="images/logo.gif" /><br /><br /><b>Language Error</b><br />Sorry we have problem with language for this site. Please come back later.</center>');
}
}
_________________ I'm
newzgurl4christ Nuke Soldier
Joined: Aug 16, 2004
Posts: 15
Posted:
Tue Sep 21, 2004 2:28 pm
*Question*
What program do you use to open php files...? And change the code and stuf..?
madman Support Mod
Joined: Feb 15, 2004
Posts: 806
Posted:
Wed Sep 22, 2004 11:47 am
newzgurl4christ wrote:
What program do you use to open php files...?
Any text editor. For windows user, you can use notepad, wordpad (flat text mode), or ms word (flat text mode).
newzgurl4christ wrote:
And change the code and stuf..?
Search/replace function as usually provided by many text editor programs.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum