Well, I tried the fix above and it didn't work.
Here is the new function code:
Code: Select all
function getLangFile($dir)
{
if (is_dir($dir))
{
if ($handle = opendir($dir))
{
while (FALSE !== ($file = readdir($handle)))
{
if ($file !== "." && $file != "..")
{
if (ereg('lang', $file))
{
$content = file_get_contents($dir . $file);
$lang[] .= $content;
}
}
}
closedir($handle);
return $lang;
}
}
}
Here is the lang file:
Code: Select all
<?php
//------------------------------------------------------------------------------
// File : lang.php
// Description : Contains language strings for phpSCMS.
// Author : Sphen001 (Nick Ross)
// Date Started : Jan 28, 05
// Support : http://phpscms.sourceforge.net
// Contact : Sphen001 - at - users - dot - sourceforge - dot - net
// Copyright : 2005 phpSCMS Group
// $Id: lang.php,v 1.1 2005/03/01 22:07:40 sphen001 Exp $
//------------------------------------------------------------------------------
if (empty($lang) || !is_array($lang))
{
$lang = array();
}
$lang[] += array(
'H_Nav_Links' => 'Nav Links',
'H_Nav_Login' => 'Login',
'H_Nav_Logout' => 'Logout',
'H_Nav_Administrator' => 'Administrator',
'H_Nav_UCP' => 'User Control Panel',
'H_Nav_User' => 'User Actions',
'UCP' => 'User Control Panel',
'Admin_Link' => 'Admin Panel',
'Register' => 'Register',
'Wrong_Info' => 'Your information did not match a user in the database. Please try again.',
'Logged_On' => 'You are now logged on.',
'Logged_Off' => 'You are now logged off.',
'H_UCP' => 'User Control Panel',
'H_Edit_Profile' => 'Edit Profile',
'Change_Profile' => 'Edit your profile',
'Change_Profile_Explain' => 'Edit your personal information here',
'Edit_Profile_Explain' => 'Use this form to edit your personal information',
'Profile_Updated' => 'Your profile has been updated successfully.',
'Register' => 'Register',
'Register_Explain' => 'Use this form to register. All fields are required.',
'Successfully_Registered' => 'You have been successfully registered. You can now log in.',
'Username_Already_Used' => 'The username you selected is already in use. Please select another.',
'No_Password_Match' => 'Your passwords did not match. Please try again.',
'Member_Username' => 'Member Username',
'Joined_Date' => 'Joined Date',
'Usergroup' => 'Usergroup',
'H_Viewprofile' => 'Viewing Member Profile - ',
'Welcome' => 'Welcome to phpSCMS',
'Welcome_Text' => 'This is an example page for your CMS. You don\'t need to keep this page. You can delete it, or write your own code. Details on how to use the templating system and other features can be found in the code. If you don\'t want to use this page, you can delete it. Just make sure you set a new default page in the Administration Control Panel.',
'Welcome_Users' => 'This is part of the example in the code. See the code for more details. Number of users: ',
'Categories' => 'Link Categories',
'Links' => 'Links in this category',
'Submitter' => 'Submitted by: ',
'Submit_A_Link' => 'Submit A Link',
'Submit_Link_Explain' => 'Use this form to submit a link to the database. All fields are required.',
'No_Links' => 'There are no links in this category.',
'No_Info' => 'There was not enough data passed to this page. Please contact an administrator.',
'Submit_Links' => 'Submit Links',
'Submit_News' => 'Submit News',
'Forum_Name' => 'Forum Name',
'Forum_Topics' => 'Topics',
'Forum_Posts' => 'Posts',
'Last_Post' => 'Last Post',
'No_Posts' => 'No Posts',
'Page_Time' => 'Page Time: ',
'Queries' => 'Queries: ',
'Memberlist' => 'Memberlist',
'F_Username' => 'Username: ',
'F_Password' => 'Password: ',
'F_Password_Confirm' => 'Confirm Password: ',
'F_Link_URL' => 'Link URL: ',
'F_Link_Name' => 'Link Name: ',
'F_Link_Desc' => 'Link Description: ',
'B_Submit' => 'Submit',
'B_Reset' => 'Reset',
'B_Logout' => 'Logout'
);
?>
And here is the function call:
Code: Select all
$lang = getLangFile('./language/' . $config['language'] . '/');
However, it does not work as expected.
Basically, each lang file contains a $lang array. The function is supposed to open the files and add the contents of that $lang array to the master $lang array, which is then made available in the other files. This way, the language strings in new files uploaded to that directory are automatically available.
Can anyone help me with this?
Thank You
Sphen001