Select default language - fix

Kleine Codeänderungen oder Mini-MODs
Keine Anfragen!!! -- No requests!!!

Moderator: Supporter

Select default language - fix

Beitragvon AmigaLink » 12. Okt 2004 19:04

Macht den "Select default language Mod" phpBB 2.0.10 kompatible!
Code: Alles auswählen
##############################################################
## MOD Title:          Select default language - fix
## MOD Author:         Niels < ncr@db9.dk > (Niels Chr. Rød) http://mods.db9.dk
##             fix put to paper by Billy Regal <email@billyregal.de>
##
## MOD Version:        1.3.4
## MOD Compatibility:  2.0.4->2.0.6 (prior release not tested)
##
## FIX Description:    This fix sould be applied in case
##             you are getting MySQL Error in the Header,
##             mostly occuring in the Internet Explorer.
##             Mozilla seems to do just fine.
##
##
##
## Installation Level: Easy
## Installation Time:  1 Minute
## Files To Edit:      1
##      common.php
##     
##
## Included Files:     0
##
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## 1. Full MOD description
## -----------
## This fix is not my work, I picked it up in a forum,
## can't remember exactly where. Billy
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------------
#
common.php

#
#-----[ FIND ]------------------------------------------------
#

$dir = opendir($phpbb_root_path.'language');
      $lang_d = array();
      while (false !== ($file = readdir($dir)))
      {
         if ( ereg("^lang_", $file) && !is_file($dirname . "/" . $file) && !is_link($dirname . "/" . $file) )
         {
            $filename = trim(str_replace("lang_", "", $file));
            $displayname = preg_replace("/^(.*?)_(.*)$/", "\\1 [ \\2 ]", $filename);
            $displayname = preg_replace("/\[(.*?)_(.*)\]/", "[ \\1 - \\2 ]", $displayname);
            $lang_d[$displayname] = '1';
         }
      }
      closedir($dir);
      @asort($lang_d);
      @reset($lang_d);
      while ( list($displayname, $filename) = @each($lang_d) )
      {
         if (strpos($displayname,$_SERVER['HTTP_ACCEPT_LANGUAGE'])===0)
         {
            $language = $displayname;
            $board_config['default_lang'] = $language;
            break;
         }
      }

#
#-----[ REPLACE WITH ]------------------------------------------
#
# just put comment around it

/*************
      $dir = opendir($phpbb_root_path.'language');
      $lang_d = array();
      while (false !== ($file = readdir($dir)))
      {
         if ( ereg("^lang_", $file) && !is_file($dirname . "/" . $file) && !is_link($dirname . "/" . $file) )
         {
            $filename = trim(str_replace("lang_", "", $file));
            $displayname = preg_replace("/^(.*?)_(.*)$/", "\\1 [ \\2 ]", $filename);
            $displayname = preg_replace("/\[(.*?)_(.*)\]/", "[ \\1 - \\2 ]", $displayname);
            $lang_d[$displayname] = '1';
         }
      }
      closedir($dir);
      @asort($lang_d);
      @reset($lang_d);
      while ( list($displayname, $filename) = @each($lang_d) )
      {
         if (strpos($displayname,$_SERVER['HTTP_ACCEPT_LANGUAGE'])===0)
         {
            $language = $displayname;
            $board_config['default_lang'] = $language;
            break;
         }
      }
**************/

#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM
Die deutsche Sprache ist Freeware, du kannst sie benutzen, ohne dafür zu bezahlen. Sie ist aber nicht Open Source, also darfst du sie nicht verändern, wie es dir gerade passt.
Benutzeravatar
AmigaLink
Administrator
 
Beiträge: 3987
Registriert: 11. Aug 2004 01:06
Wohnort: NRW

Zurück zu phpBB2 Snippets



Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 5 Gäste

cron