MOD REQUEST Lang flags

This forum is now closed as part of retiring phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
caspert_ghost
Registered User
Posts: 199
Joined: Thu Apr 21, 2005 1:58 pm
Location: China
Contact:

MOD REQUEST Lang flags

Post by caspert_ghost »

Hello to all of you MOD programmers.

I would like a MOD that puts 2 flags in the top creating a 3rd line under profile / login/logout (centered)

allowing users (logged in or as guest) to change the language to their language (choice of English (English flag) and Chinese (chinese flag) with the words before each English written in English and Chinese written in Chinese

I want this so when a user is redirected to this site from the coppermine gallery they can change the language (as all 3 boards are integrated to share a user database) so the user registering can register in his/her own language.
Thank you

ps. the auto language mod dont work for this situation, I need them to be able to change it manually BEFORE registering or logging in if they so choose.
As it is now the only way to change the language is in the profile settings when registering, sorry but if 50% of my users cannot read English then I will lose 50% of my user base (which is NOT acceptable.)
caspert_ghost
Registered User
Posts: 199
Joined: Thu Apr 21, 2005 1:58 pm
Location: China
Contact:

need this ASAP

Post by caspert_ghost »

Reading these boards I see several posts on thgis but NOT ONE has a reply, is there no one that can do this?

Languages choices is a dependant option I need.
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

Hi,

I have used an existing MOD, and re-coded it so that instead of a drop-down box with languages, it uses little flags to click on. I've changed other stuff as well. So below you will find the original mod, with the author details, MIXED IN with my own changes and comments.

Please note: This is not an official mod - use the instructions at your own risk, but it works fine on my board. You can see it here: www.silvercircle.org/forum and you should see a dutch and english flag at the right of the screen on the index page, so you can change the board interface language, read the registration in your own language and so on.
The flags you can find in the Flags mod that is around somewhere (search).
This mod will automatically show flags (if the picture exists) for all languages you have installed, and it will remember the setting on other pages of your board, until the user logs in, then the profile language setting takes over.

Code: Select all

Changed to 
  MOD Guest_language
  Using tiny flags instead of list box
  Put flags images in images/flags/languages/english.gif for example etc.
  Changed code so other pages apart from index will remember the language too
  Works fine on 2.0.14

############################################################## 
## MOD Title:          Select default language
## MOD Author:         Niels < ncr@db9.dk > (Niels Chr. Rød) http://mods.db9.dk
## MOD Description:    This mod will try change default lang to
##                     what ever the users browser is set to. If it
##                     can't, the user (guest only) can temporary
##                     change the default language selection.
## MOD Version:        1.3.4
## MOD Compatibility:  2.0.4->2.0.6 (prior release not tested)
## 
## Installation Level: Easy
## Installation Time:  2 Minutes (1mn by EasyMOD of Nuttzy)
## Files To Edit:      4
##      functions.php
##      index.php
##      templates/subSilver/index_body.tpl
##
## 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 mod will try change default lang to what ever the users
## browser is set to. If it can't, the user (guest only) can
## temporary change the default language selection with a drop
## down from index, only for the current browsing user any page
## can be called with the language parmeter, and the change will
## only happen to that specific computer who have made the request.
## The default language can be changed by the user at any time
## on the main index.
## 
## The default language will stay on the selected language for
## 6 hours, until then it can bee changed either by a external
## link, or by the provided "language selection" on the index
## page. After the peroid of 6 hours it goes back to the boards
## default language this is done to insure proper function on
## shared computers.
## 
## Note that only installed languages should be parsed, and if
## a user are logged in, he/she will overide this mod and have
## their own language.
## Here is a example on how to use the "external URL":
## 	mods.db9.dk?language=danish
## Any page can be called with the language extenision, e.g.
## the registration page:
## 	mods.db9.dk/register.php?agreed=TRUE&language=german
##
## 2. EasyMOD
## -----------
## This MOD is compatible and can be installed by EasyMOD
## of Nuttzy (but is not officially EasyMOD Compliant)!
## http://area51.phpbb.com/phpBB22/viewforum.php?sid=&f=15
##
## However, on alpha releases of EM and meanwhile beta or 
## final release some actions are NOT performed.
## You'll have to do them manually !
##
## 2.1 Translation are not managed
## -----------
## EM can not already manage actions for any other
## language than English (but language intructions are proceed
## to all installed languages in order to prevent errors).
## So the translations provided with this MOD must be installed
## manually if you need them.
##
## 3. Official last version link
## -----------
## Meanwhile the phpBB group validation and as the MOD is not yet
## in the phpBB MOD database, check this official link for updates...
## http://mods.db9.dk/viewtopic.php?t=9
##
############################################################## 

############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##############################################################
# 
#-----[ OPEN ]------------------------------------------------ 
# 
includes/functions.php

# 
#-----[ FIND ]------------------------------------------------ 
# 
	global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS;

#Skip possible more global variables
  
# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

	if ( $userdata['user_id'] == ANONYMOUS )
	{

    //START MOD Guest_language
    //User clicked on language flag somewhere
    $language = ( isset($HTTP_POST_VARS['language']) ) ? $HTTP_POST_VARS['language'] : $HTTP_GET_VARS['language'];     
    if ($language) 
    { 
    	$language=trim(strip_tags($language));	
    	$board_config['default_lang'] = $language; 
    	setcookie($board_config['cookie_name'].'_default_lang',$language , (time()+21600), $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); 
    } 
    //Use existing cookie
    elseif (isset($HTTP_COOKIE_VARS[$board_config['cookie_name'].'_default_lang']) ) 
    {
       $board_config['default_lang']=$HTTP_COOKIE_VARS[$board_config['cookie_name'].'_default_lang']; 
    } 
    //Select an existing language pack that is in the user browser settings
    else
    {
    	$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;
    		}
    	}
    }
    //END MOD Guest_language  
  
  }


# 
#-----[ OPEN ]------------------------------------------------ 
# 
includes/functions_selects.php

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

function language_select($default, $select_name = "language", $dirname="language")

# 
#-----[ REPLACE WITH ]------------------------------------------------ 
# 

//MOD Guest_language // $flags optional boolean
function language_select($default, $select_name = "language", $dirname="language", $flags = 0)


# 
#-----[ FIND ]------------------------------------------------ 
# This may be a bit different

    $lang_select = '<select style="width:200px;" name="' . $select_name . '">';
  	while ( list($displayname, $filename) = @each($lang) )
  	{
  		$selected = ( strtolower($default) == strtolower($filename) ) ? ' selected="selected"' : '';
  		$lang_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
  	}
  	$lang_select .= '</select>';
  	

# 
#-----[ REPLACE WITH ]------------------------------------------------ 
# 


  //START MOD Guest_language * Return image files with links 
	if ($flags)
	{
  	while ( list($displayname, $filename) = @each($lang) )
  	{
  		$lang_select .= '&nbsp; <a href="index.php?language=' . $filename . '">
        <img src="images/flags/languages/' . $filename . '.gif" title = "' . ucwords($displayname). '" border="none"></a>';
  	}
  }
  else
  //END MOD Guest_language * Return image files with links 
  {
    $lang_select = '<select style="width:200px;" name="' . $select_name . '">';
  	while ( list($displayname, $filename) = @each($lang) )
  	{
  		$selected = ( strtolower($default) == strtolower($filename) ) ? ' selected="selected"' : '';
  		$lang_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
  	}
  	$lang_select .= '</select>';
  }


# 
#-----[ OPEN ]------------------------------------------------ 
# 
index.php

# 
#-----[ FIND ]------------------------------------------------ 
# 
include($phpbb_root_path . 'common.'.$phpEx); 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
 
//MOD Guest_language
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx); 

# 
#-----[ FIND ]------------------------------------------------ 
# 
'FORUM_LOCKED_IMG' =>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

    //START MOD Guest_language    
    'LANGUAGE_SELECT_FLAGS' => language_select($board_config['default_lang'], 'language', 'language', 1), 
    //You can use the list box and button if you prefer, just un-rem it
    //'LANGUAGE_SELECT' => language_select($board_config['default_lang'], 'language'), 
    //'L_CHANGE_NOW' => 'OK', 
    //END MOD Guest_language

# 
#-----[ OPEN ]------------------------------------------------ 
# 
templates/subSilver/index_body.tpl

# 
#-----[ FIND ]------------------------------------------------ 
# Index title on left

  {L_INDEX}

# 
#-----[ AFTER, ADD ]----------------------------------------- 
# A cell with right-aligned a few flags

<!-- BEGIN switch_user_logged_out --> 
    <td style="text-align:right;">
      {LANGUAGE_SELECT_FLAGS}
    </td>
<!-- END switch_user_logged_out --> 

# 
#-----[ ALTERNATIVELY, ADD ]----------------------------------------- 
# Somewhere in your layout, a little form with selection box and OK button
# Un-rem the variables after LANGUAGE_SELECT_FLAGS in index.php in that case

  <!-- BEGIN switch_user_logged_out --> 
	<form method="post" action="{U_INDEX}"><span class="forumlink" style="margin-left: 2px; font-size: 11px">{L_SELECT_LANG}: </span>{LANGUAGE_SELECT}&nbsp;&nbsp;&nbsp;
		<input type="submit" class="mainoption" name="changenow" value="{L_CHANGE_NOW}" />
	</form>
  <!-- END switch_user_logged_out --> 


# 
#-----[ SAVE/CLOSE ALL FILES ]-------------------------------- 
# 
# EoM
caspert_ghost
Registered User
Posts: 199
Joined: Thu Apr 21, 2005 1:58 pm
Location: China
Contact:

This is really getting annoying

Post by caspert_ghost »

Hello again, ok I have tried everything and now need serious assistance.
the above mod looks nice and works well on your page it is EXACTLY what I want and need; HOWEVER in the very first modification:

#-----[ OPEN ]------------------------------------------------
#
includes/functions.php

#
#-----[ FIND ]------------------------------------------------
#
global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS;

#Skip possible more global variables

this [find] does not exist.... so I was unable to install this feature.
I then went and completly dropped my borads databsae, removed the bords, deleted the entire package of phpbb and re uploaded it (most current version 2.15) re installed it as a new board, on a new database installed easy mod and installed the "only mod actually certified to work" and IT DONT WORK.
if you go to my website www.mjsutton.com/engbbs (my boards) this is a fresh install NO MODS (other than easy mod and language flags installed) and you cxan see it dont work.
I absolutly MUST have the abilty for usewrs to choose their language at ANYTIME whter loggied in or not, my user base is Englis/Chinese and both parts users cannot read the other (I cannot read Chinese many of my users cannot read English) so this is highly imperitive for our business to maintain.

PLEASE help someone. thank you
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: This is really getting annoying

Post by Merlin Sythove »

caspert_ghost wrote: #-----[ OPEN ]------------------------------------------------
#
includes/functions.php

#
#-----[ FIND ]------------------------------------------------
#
global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS;

#Skip possible more global variables

this [find] does not exist.... so I was unable to install this feature.


General MOD installation tip: If something cannot be found, it helps if you look at the code that you are supposed to find, see if a shorter section of the code can be found etc.

The above reads:
#
#-----[ FIND ]------------------------------------------------
#
global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS;

And after that follows a MOD FILE comment (recogniseable by the #) to skip further lines with "global......." just in case there are any. The problem with MODS in general is that a board may already be modded and have lines where you don't expect them, and in some cases those lines MUST be in a particular position. So that is what this instruction tries to accomplish.

Succes!
caspert_ghost
Registered User
Posts: 199
Joined: Thu Apr 21, 2005 1:58 pm
Location: China
Contact:

Heres what I have

Post by caspert_ghost »

removed for space sake....


[edited]
Last edited by caspert_ghost on Wed May 11, 2005 1:17 pm, edited 2 times in total.
caspert_ghost
Registered User
Posts: 199
Joined: Thu Apr 21, 2005 1:58 pm
Location: China
Contact:

FINALY

Post by caspert_ghost »

Ok after I removed my entire database and deleted entire phpbb folder from server. I re loaded phpbb folder and reinstaklled it.
I installed easymod and ran country flags (it gives an option to have a flag in your profile)
I installed Select default language and FINALLY got the drop down box BUT this is only half of what I need as 75% of my members cant read English so wont know to change lang there. the flags above will work.
If it is easier to add chinese/english to the drop menu then they can see it.
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

Yeah right, so the problem is that if you have to search for just a single line, and there is an error, you have no clue what to do. I've checked with the original 2.0.11 functions.php and this is the updated MOD:

Code: Select all

Changed to 
  MOD Guest_language
  Using tiny flags instead of list box
  Put flags images in images/flags/languages/english.gif for example etc.
  Changed code so other pages apart from index will remember the language too
  Works fine on 2.0.14

############################################################## 
## MOD Title:          Select default language
## MOD Author:         Niels < ncr@db9.dk > (Niels Chr. Rød) http://mods.db9.dk
## MOD Description:    This mod will try change default lang to
##                     what ever the users browser is set to. If it
##                     can't, the user (guest only) can temporary
##                     change the default language selection.
## MOD Version:        1.3.4
## MOD Compatibility:  2.0.4->2.0.6 (prior release not tested)
## 
## Installation Level: Easy
## Installation Time:  2 Minutes (1mn by EasyMOD of Nuttzy)
## Files To Edit:      4
##      functions.php
##      index.php
##      templates/subSilver/index_body.tpl
##
## 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 mod will try change default lang to what ever the users
## browser is set to. If it can't, the user (guest only) can
## temporary change the default language selection with a drop
## down from index, only for the current browsing user any page
## can be called with the language parmeter, and the change will
## only happen to that specific computer who have made the request.
## The default language can be changed by the user at any time
## on the main index.
## 
## The default language will stay on the selected language for
## 6 hours, until then it can bee changed either by a external
## link, or by the provided "language selection" on the index
## page. After the peroid of 6 hours it goes back to the boards
## default language this is done to insure proper function on
## shared computers.
## 
## Note that only installed languages should be parsed, and if
## a user are logged in, he/she will overide this mod and have
## their own language.
## Here is a example on how to use the "external URL":
## 	mods.db9.dk?language=danish
## Any page can be called with the language extenision, e.g.
## the registration page:
## 	mods.db9.dk/register.php?agreed=TRUE&language=german
##
## 2. EasyMOD
## -----------
## This MOD is compatible and can be installed by EasyMOD
## of Nuttzy (but is not officially EasyMOD Compliant)!
## http://area51.phpbb.com/phpBB22/viewforum.php?sid=&f=15
##
## However, on alpha releases of EM and meanwhile beta or 
## final release some actions are NOT performed.
## You'll have to do them manually !
##
## 2.1 Translation are not managed
## -----------
## EM can not already manage actions for any other
## language than English (but language intructions are proceed
## to all installed languages in order to prevent errors).
## So the translations provided with this MOD must be installed
## manually if you need them.
##
## 3. Official last version link
## -----------
## Meanwhile the phpBB group validation and as the MOD is not yet
## in the phpBB MOD database, check this official link for updates...
## http://mods.db9.dk/viewtopic.php?t=9
##
############################################################## 

############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##############################################################
# 
#-----[ OPEN ]------------------------------------------------ 
# 
includes/functions.php

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

function init_userprefs($userdata)
{
	global $board_config, $theme, $images;
	global $template, $lang, $phpEx, $phpbb_root_path;
	global $nav_links;
  
# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

    global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS;
	if ( $userdata['user_id'] == ANONYMOUS )
	{

    //START MOD Guest_language
    //User clicked on language flag somewhere
    $language = ( isset($HTTP_POST_VARS['language']) ) ? $HTTP_POST_VARS['language'] : $HTTP_GET_VARS['language'];     
    if ($language) 
    { 
    	$language=trim(strip_tags($language));	
    	$board_config['default_lang'] = $language; 
    	setcookie($board_config['cookie_name'].'_default_lang',$language , (time()+21600), $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); 
    } 
    //Use existing cookie
    elseif (isset($HTTP_COOKIE_VARS[$board_config['cookie_name'].'_default_lang']) ) 
    {
       $board_config['default_lang']=$HTTP_COOKIE_VARS[$board_config['cookie_name'].'_default_lang']; 
    } 
    //Select an existing language pack that is in the user browser settings
    else
    {
    	$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;
    		}
    	}
    }
    //END MOD Guest_language  
  
  }


# 
#-----[ OPEN ]------------------------------------------------ 
# 
includes/functions_selects.php

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

function language_select($default, $select_name = "language", $dirname="language")

# 
#-----[ REPLACE WITH ]------------------------------------------------ 
# 

//MOD Guest_language // $flags optional boolean
function language_select($default, $select_name = "language", $dirname="language", $flags = 0)


# 
#-----[ FIND ]------------------------------------------------ 
# This may be a bit different

    $lang_select = '<select style="width:200px;" name="' . $select_name . '">';
  	while ( list($displayname, $filename) = @each($lang) )
  	{
  		$selected = ( strtolower($default) == strtolower($filename) ) ? ' selected="selected"' : '';
  		$lang_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
  	}
  	$lang_select .= '</select>';
  	

# 
#-----[ REPLACE WITH ]------------------------------------------------ 
# 


  //START MOD Guest_language * Return image files with links 
	if ($flags)
	{
  	while ( list($displayname, $filename) = @each($lang) )
  	{
  		$lang_select .= '&nbsp; <a href="index.php?language=' . $filename . '">
        <img src="images/flags/languages/' . $filename . '.gif" title = "' . ucwords($displayname). '" border="none"></a>';
  	}
  }
  else
  //END MOD Guest_language * Return image files with links 
  {
    $lang_select = '<select style="width:200px;" name="' . $select_name . '">';
  	while ( list($displayname, $filename) = @each($lang) )
  	{
  		$selected = ( strtolower($default) == strtolower($filename) ) ? ' selected="selected"' : '';
  		$lang_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
  	}
  	$lang_select .= '</select>';
  }


# 
#-----[ OPEN ]------------------------------------------------ 
# 
index.php

# 
#-----[ FIND ]------------------------------------------------ 
# 
include($phpbb_root_path . 'common.'.$phpEx); 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
 
//MOD Guest_language
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx); 

# 
#-----[ FIND ]------------------------------------------------ 
# 
'FORUM_LOCKED_IMG' => $images['forum_locked'],

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

    //START MOD Guest_language    
    'LANGUAGE_SELECT_FLAGS' => language_select($board_config['default_lang'], 'language', 'language', 1), 
    //You can use the list box and button if you prefer, just un-rem it
    //'LANGUAGE_SELECT' => language_select($board_config['default_lang'], 'language'), 
    //'L_CHANGE_NOW' => 'OK', 
    //END MOD Guest_language

# 
#-----[ OPEN ]------------------------------------------------ 
# 
templates/subSilver/index_body.tpl

# 
#-----[ FIND (partial line) ]------------------------------------------------ 
# 

  <a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td> 


# 
#-----[ CHANGE TO ]----------------------------------------- 
# 
  <a href="{U_INDEX}" class="nav">{L_INDEX}</a></span> 
<!-- BEGIN switch_user_logged_out --> 
      {LANGUAGE_SELECT_FLAGS} 
<!-- END switch_user_logged_out --> 
  </td> 

# 
#-----[ ALTERNATIVELY, ADD ]----------------------------------------- 
# Somewhere in your layout, a little form with selection box and OK button
# Un-rem the variables after LANGUAGE_SELECT_FLAGS in index.php in that case

  <!-- BEGIN switch_user_logged_out --> 
	<form method="post" action="{U_INDEX}"><span class="forumlink" style="margin-left: 2px; font-size: 11px">{L_SELECT_LANG}: </span>{LANGUAGE_SELECT}&nbsp;&nbsp;&nbsp;
		<input type="submit" class="mainoption" name="changenow" value="{L_CHANGE_NOW}" />
	</form>
  <!-- END switch_user_logged_out --> 


# 
#-----[ SAVE/CLOSE ALL FILES ]-------------------------------- 
# 
# EoM
Last edited by Merlin Sythove on Wed May 11, 2005 10:56 am, edited 2 times in total.
caspert_ghost
Registered User
Posts: 199
Joined: Thu Apr 21, 2005 1:58 pm
Location: China
Contact:

so far so good

Post by caspert_ghost »

REMOVED FOR SPACE SAKE


[edited]
Last edited by caspert_ghost on Wed May 11, 2005 1:21 pm, edited 1 time in total.
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: so far so good

Post by Merlin Sythove »

caspert_ghost wrote: the very last find:
Index title on left

{L_INDEX}

Code: Select all

# 
#-----[ FIND (partial line) ]------------------------------------------------ 
# 

  <a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td>


# 
#-----[ CHANGE TO ]----------------------------------------- 
# 
  <a href="{U_INDEX}" class="nav">{L_INDEX}</a></span>
<!-- BEGIN switch_user_logged_out --> 
      {LANGUAGE_SELECT_FLAGS}
<!-- END switch_user_logged_out --> 
  </td>
caspert_ghost
Registered User
Posts: 199
Joined: Thu Apr 21, 2005 1:58 pm
Location: China
Contact:

Post by caspert_ghost »

Parse error: parse error, unexpected T_DOUBLE_ARROW, expecting ')' in /var/www/html/bbs/index.php on line 296

'FORUM_LOCKED_IMG' => //START MOD Guest_language
'LANGUAGE_SELECT_FLAGS' => language_select($board_config['default_lang'], 'language', 'language', 1),
//You can use the list box and button if you prefer, just un-rem it
'LANGUAGE_SELECT' => language_select($board_config['default_lang'], 'language'),
'L_CHANGE_NOW' => 'OK',
//END MOD Guest_language
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

Find this:
'FORUM_LOCKED_IMG' => $images['forum_locked'],
After, add...
Text above amended

Just a short note: like I said when I first posted it, this was not an official mod, but a mix of a mod and my own notes about what I had changed. That is why there are instructions in there that if someone who knows a bit of php or html follows them, will be no problem at all, but if someone follows everything to the letter will be a problem.
caspert_ghost
Registered User
Posts: 199
Joined: Thu Apr 21, 2005 1:58 pm
Location: China
Contact:

I know this

Post by caspert_ghost »

I know and I followed your notes, nothing you wrote was to the letter :)
Just some were so far off I had to ask.
For instance after making the change you suggested I now get a new parse error...

Parse error: parse error, unexpected $ in /var/www/html/bbs/includes/functions_selects.php on line 121


now this is confusing because line 121 is ?>

(to my understanding this closes the php file so this being an error throws me)
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: I know this

Post by Merlin Sythove »

caspert_ghost wrote: Parse error: parse error, unexpected $ in /var/www/html/bbs/includes/functions_selects.php on line 121
now this is confusing because line 121 is ?>


....meaning that earlier a bracket or comma was misplaced or omitted and when pairing things up at the end of the file the error will become obvious. You must have made an error adding the block of code in that file. Try again :D
caspert_ghost
Registered User
Posts: 199
Joined: Thu Apr 21, 2005 1:58 pm
Location: China
Contact:

I cant see it.

Post by caspert_ghost »

I cant see it (maybe blind or just dumb :) changes are in red (PS the choose default lang was already installed will this make a conflict?)

<?php
/***************************************************************************
* function_selects.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id: functions_selects.php,v 1.3.2.5 2005/05/06 20:50:11 acydburn Exp $
*
*
***************************************************************************/

/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
***************************************************************************/

//
// Pick a language, any language ...
//
//MOD Guest_language // $flags optional boolean
function language_select($default, $select_name = "language", $dirname="language", $flags = 0)

{
global $phpEx, $phpbb_root_path;

$dir = opendir($phpbb_root_path . $dirname);

$lang = array();
while ( $file = readdir($dir) )
{
if (preg_match('#^lang_#i', $file) && !is_file(@phpbb_realpath($phpbb_root_path . $dirname . '/' . $file)) && !is_link(@phpbb_realpath($phpbb_root_path . $dirname . '/' . $file)))
{
$filename = trim(str_replace("lang_", "", $file));
$displayname = preg_replace("/^(.*?)_(.*)$/", "\\1 [ \\2 ]", $filename);
$displayname = preg_replace("/\[(.*?)_(.*)\]/", "[ \\1 - \\2 ]", $displayname);
$lang[$displayname] = $filename;
}
}

closedir($dir);

@asort($lang);
@reset($lang);

//START MOD Guest_language * Return image files with links
if ($flags)
{
while ( list($displayname, $filename) = @each($lang) )
{
$lang_select .= '&nbsp; <a href="index.php?language=' . $filename . '">
<img src="images/flags/languages/' . $filename . '.gif" title = "' . ucwords($displayname). '" border="none"></a>';
}
}
else
//END MOD Guest_language * Return image files with links

{
$lang_select = '<select style="width:200px;" name="' . $select_name . '">';
while ( list($displayname, $filename) = @each($lang) )
{
$selected = ( strtolower($default) == strtolower($filename) ) ? ' selected="selected"' : '';
$lang_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
}
$lang_select .= '</select>';
}

//
// Pick a template/theme combo,
//
function style_select($default_style, $select_name = "style", $dirname = "templates")
{
global $db;

$sql = "SELECT themes_id, style_name
FROM " . THEMES_TABLE . "
ORDER BY template_name, themes_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't query themes table", "", __LINE__, __FILE__, $sql);
}

$style_select = '<select name="' . $select_name . '">';
while ( $row = $db->sql_fetchrow($result) )
{
$selected = ( $row['themes_id'] == $default_style ) ? ' selected="selected"' : '';

$style_select .= '<option value="' . $row['themes_id'] . '"' . $selected . '>' . $row['style_name'] . '</option>';
}
$style_select .= "</select>";

return $style_select;
}

//
// Pick a timezone
//
function tz_select($default, $select_name = 'timezone')
{
global $sys_timezone, $lang;

if ( !isset($default) )
{
$default == $sys_timezone;
}
$tz_select = '<select name="' . $select_name . '">';

while( list($offset, $zone) = @each($lang['tz']) )
{
$selected = ( $offset == $default ) ? ' selected="selected"' : '';
$tz_select .= '<option value="' . $offset . '"' . $selected . '>' . $zone . '</option>';
}
$tz_select .= '</select>';

return $tz_select;
}

?>
Post Reply

Return to “[2.0.x] MOD Requests”