Language file checker

Tools by the phpBBModders team and Community contributed tools.
Forum rules
Only post tools related to modding in here, simple.

Language file checker

Postby igorw » 05 Jun 2008, 15:57

Something that can lead to headaches is that you sometimes just recieve a blank page. One of the causes for this can be a parse error in a language file. This is because phpBB suppresses the errors for the inclusion. So it doesn't give you any errors.

I've created a script that will help you with this. It will loop through your language files and simply include them one-by-one. If there is a parse error, the script ends and the error is displayed. If everything goes fine, you get a confirmation message.

Save this file as "include_lang.php" and put it into the root of the board. Then run it by visiting the file in your webbrowser. Note: use it at your own risk!

Code: Select all
<?php
/**
*
* @package phpbbmodders
* @version $Id$
* @copyright (c) 2008 phpbbmodders.net
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

/**
 * this script will include all your language files
 * this makes it easier to discover parse errors
 */
if ($files = scandir($phpbb_root_path . 'language/'))
{
   foreach ($files as $file)
   {
      if (in_array($file, array('.', '..', '.svn'), true) || is_file($phpbb_root_path . 'language/' . $file))
      {
         continue;
      }
      
      include_lang($phpbb_root_path . 'language/' . $file . '/');
   }
}

trigger_error('All language files seem to be intact.');

/**
 * recursive function to include language files
 */
function include_lang($folder)
{
   global $phpEx;

   if ($files = scandir($folder))
   {
      foreach ($files as $file)
      {
         if (in_array($file, array('.', '..', '.svn'), true))
         {
            continue;
         }
         
         if (is_file($folder . $file) && substr(strrchr($file, '.'), 1) === $phpEx)
         {
            include($folder . $file);
         }
         else if (is_dir($folder . $file))
         {
                include_lang($folder . $file);
         }
      }
   }
}

?>
User avatar
igorw
Past Contributor
Past Contributor
 
Posts: 2321
Joined: 01 Jun 2006, 20:48
Real name: Igor

Re: Language file checker

Postby harmlessgoat22 » 05 Jun 2008, 17:01

Wow, you're just popping out awesome scripts lately!!! Looks very useful. Most of my files don't include too many language files, so I've been able to look through a couple files and find the problem when this happens to me, but this looks to be extremely helpful.

Thanks!
Image
That's like, I can't beat my neighbor in an argument, so instead I kill his dog.
-Best English Teacher Ever
harmlessgoat22
Supporter
Supporter
 
Posts: 316
Joined: 18 Sep 2007, 14:35
Real name: David

Re: Language file checker

Postby EY » 05 Jun 2008, 20:14

Nice man thank you very much for this!
Never Say Never!
User avatar
EY
Supporter
Supporter
 
Posts: 209
Joined: 05 Nov 2006, 23:13
Location: Montreal
Real name: Elias

Re: Language file checker

Postby mtotheikle » 05 Jun 2008, 20:56

This will be very nice!
mtotheikle
New member
New member
 
Posts: 25
Joined: 11 Oct 2007, 03:03
Location: Spokane, WA
Real name: Mike

Re: Language file checker

Postby EY » 06 Jun 2008, 02:55

Are there any security wholes in that file?
Never Say Never!
User avatar
EY
Supporter
Supporter
 
Posts: 209
Joined: 05 Nov 2006, 23:13
Location: Montreal
Real name: Elias

Re: Language file checker

Postby mtotheikle » 06 Jun 2008, 05:34

eviL<3 wrote:Save this file as "include_lang.php" and put it into the root of the board. Then run it by visiting the file in your webbrowser. Note: use it at your own risk!


Just use it on a localhost like all these tool scripts should be and you will be fine.
mtotheikle
New member
New member
 
Posts: 25
Joined: 11 Oct 2007, 03:03
Location: Spokane, WA
Real name: Mike

Re: Language file checker

Postby igorw » 06 Jun 2008, 08:42

There's no direct security holes, but i definately don't suggest using it on a server. It's fine if you delete it directly after using it, but i wouldn't let it sit there ;).
User avatar
igorw
Past Contributor
Past Contributor
 
Posts: 2321
Joined: 01 Jun 2006, 20:48
Real name: Igor

Re: Language file checker

Postby Neo » 09 Mar 2011, 16:48

Thx used it with success!
Neo
New member
New member
 
Posts: 3
Joined: 26 Feb 2011, 18:45

Re: Language file checker

Postby Relaxin » 17 Oct 2011, 13:33

:) Great!!! I tried the checker several months and it works perfectly!
Relaxin
New member
New member
 
Posts: 2
Joined: 17 Oct 2011, 13:25


Return to Tools for MOD authors

Who is online

Users browsing this forum: No registered users and 0 guests