coppermine-gallery.com/forum

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: thebign on December 04, 2003, 08:59:52 AM

Title: Error link when choosing language or theme
Post by: thebign on December 04, 2003, 08:59:52 AM
Hi

When I use the the dropdown selection for language and theme I get this error:

http://thebign.dk/php/php.exe?lang=estonian

Is it a server error og script error?

This is the script:

<?php 
// ------------------------------------------------------------------------- // 
// Coppermine Photo Gallery 1.2.0                                            // 
// ------------------------------------------------------------------------- // 
// Copyright (C) 2002,2003 Gregory DEMAR <gdemar@wanadoo.fr>                 // 
// http://www.chezgreg.net/coppermine/                                       // 
// ------------------------------------------------------------------------- // 
// Updated by the Coppermine Dev Team                                        // 
// see /docs/credits.html for details                                        // 
// ------------------------------------------------------------------------- // 
// 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.                                       // 
// ------------------------------------------------------------------------- // 
starttable("100%"); ?>


<table align="center" width="100%" cellspacing="1" cellpadding="0" class="maintable">
<tr>
<td class="tableh1" colspan="2"><h2>Vælg Galleri Sprog/Language &amp; Tema/Theme</h2></td>
</tr>
<tr>
      <td class="anycontent">
            <?php print cpg_show_flags(); ?>
      </td>
</tr>
<?php endtable(); ?>

<?php 

function cpg_show_flags() 
{ 
// ------------------------------------------------------------------------- // 
//  ChooseLanguageByFlag.mod v1.3 for Coppermine Photo Gallery 1.1.0 (final) // 
//  by GauGau (Joachim Mueller) http://gaugau.de/                            // 
// ------------------------------------------------------------------------- // 
// ---edit below vars---                                                     // 
$choice= "list"; 
//edit this: choose between "flag" (pictures of flags), "list" (dropdown box) and "both" 

$theme_choice= "pulldown"; 
//edit this: choose between "pulldown" (dropdown box), or "links" (horisontal list of links) 


$number_of_rows=1; 
// edit this value: how many rows of flags should be shown (it makes sense to// 
// have more than 1 row if you have you coppermine navigation not on top of  // 
// the page (horizontally) but on the side of the gallery (vertically).      // 
// Usually (with most themes) this value can be set to 1                     // 

$border_flag_color = "#000000"; 
//do you want a border around your flag? Set the color here, leave blank if  // 
// you don't want a border. Use color codes that css understands, e.g.       // 
// "#FF0000" or "red".                                                       // 
// For more details on color codes, check                                    // 
// http://www.w3.org/TR/REC-CSS1#color-units/                                // 

$translate_language = "Taal/Language:&nbsp;&nbsp;"; 
$select_theme = "Thema/Theme:&nbsp;&nbsp;"; 
// edit this: translate "Sprache" to the word "language" in your country or  // 
// whatever text you want to appear in front of the flags/dropdown box       // 

// Use below arrays to specify which countries should show up. The expression// 
// in brackets must be the name of the language file (without the ".php" at  // 
// the end). The first array specifies the "realname" of the language, the   // 
// second arry must contain the country code (see the folder /images/flags)  // 
// and must correspond to the image. Example: if you want the stars and      // 
// stripes turn up instead of the union jack, use                            // 
// $language_name['english'] = 'English'; $country_code_flag['english'] = 'gb'; 

$language_name['bosnian'] = 'Bosnian';                     $country_code_flag['bosnian'] = 'ba'; 
$language_name['bulgarian'] = 'Bulgarian';                 $country_code_flag['bulgarian'] = 'bg'; 
$language_name['spanish'] = 'Castellano (Spanish)';        $country_code_flag['spanish'] = 'es'; 
$language_name['chinese_big5'] = 'Chinese (Big5)';         $country_code_flag['chinese_big5'] = 'tw'; 
$language_name['chinese_gb2312'] = 'Chinese (GB2312)';     $country_code_flag['chinese_gb2312'] = 'cn'; 
$language_name['czech-iso-8859-2'] = 'Czech';              $country_code_flag['czech-iso-8859-2'] = 'cz'; 
$language_name['danish'] = 'Danish (Dansk)';               $country_code_flag['danish'] = 'dk'; 
$language_name['german'] = 'Deutsch';                      $country_code_flag['german'] = 'de'; 
$language_name['english'] = 'English';                     $country_code_flag['english'] = 'gb'; 
$language_name['estonian'] = 'Estonian';                   $country_code_flag['estonian'] = 'ee'; 
$language_name['french'] = 'Francais (French)';            $country_code_flag['french'] = 'fr'; 
$language_name['greek'] = 'Greek';                         $country_code_flag['greek'] = 'gr'; 
$language_name['italian'] = 'Italiano';                    $country_code_flag['italian'] = 'it'; 
$language_name['japanese'] = 'Japanese';                   $country_code_flag['japanese'] = 'jp'; 
$language_name['korean'] = 'Korean';                       $country_code_flag['korean'] = 'kr'; 
$language_name['latvian'] = 'Latvian';                     $country_code_flag['latvian'] = 'lv'; 
$language_name['dutch'] = 'Nederlands (Dutch)';            $country_code_flag['dutch'] = 'nl'; 
$language_name['norwegian'] = 'Norwegian';                 $country_code_flag['norwegian'] = 'no'; 
$language_name['polish'] = 'Polish';                       $country_code_flag['polish'] = 'pl'; 
$language_name['portugues-utf-8'] = 'Portugues (Brazil)';  $country_code_flag['portugues-utf-8'] = 'br'; 
$language_name['portuguese'] = 'Portugues (Portugal)';     $country_code_flag['portuguese'] = 'pt'; 
$language_name['russian'] = 'Russian';                     $country_code_flag['russian'] = 'ru'; 
$language_name['slovenian'] = 'Slovenian';                 $country_code_flag['slovenian'] = 'si'; 
$language_name['finnish'] = 'Suomenkielinen (Finnish)';    $country_code_flag['finnish'] = 'fi'; 
$language_name['turkish'] = 'Turkish';                     $country_code_flag['turkish'] = 'tr'; 
$language_name['hungarian'] = 'Hungarian (Magyar)';       $country_code_flag['hungarian']= 'hu'; 

// -------------------------------------------------------------------------   // 
//---------don't edit below this line unless you know hat you're doing-------- // 
// -------------------------------------------------------------------------   // 
global $CONFIG,$USER; 
// get the current language 
$cpg_current_language=$CONFIG['lang']; 
if(
$USER['lang']!=""){$cpg_current_language=$USER['lang'];} 
if(
$_GET['lang']!=""){$cpg_current_language=$_GET['lang'];} 

$cpg_current_theme=$CONFIG['theme']; 
if(
$USER['theme']!=""){$cpg_current_theme=$USER['theme'];} 
if(
$_GET['theme']!=""){$cpg_current_theme=$_GET['theme'];} 

//get the url and all vars except $lang 
$cpg_current=$_SERVER["SCRIPT_NAME"]."?"; 
foreach (
$_GET as $key => $value) { 
    if (
$key!="lang"){$cpg_current.= $key . "=" . $value . "&";} 
} 
$cpg_current.="lang="; 

//get the url and all vars except $theme 
$cpg_theme=$_SERVER["SCRIPT_NAME"]."?"; 
foreach (
$_GET as $key => $value) { 
    if (
$key!="theme"){$cpg_theme.= $key . "=" . $value . "&";} 
} 
$cpg_theme.="theme="; 
//set the border 
if ($border_flag_color!="") 
{ 
$flagborder='style="border-width:1px; border-color:'.$border_flag_color.'; margin:0px;"'; 
} 

if(
$choice=="flag" || $choice=="both") 
{ 
//----------------flags start 
$cpg_flags_total=count($language_name); 
$cpg_flags_cols=ceil($cpg_flags_total/$number_of_rows); 
$cpg_flag_return='<style type="text/css"><!-- .anycontent {font-size:8px} --></style>'; 

if (
$number_of_rows!=1) $cpg_flag_return.= '<hr />'; 
$cpg_flag_return.= '<span class="anycontent">' . $translate_language .'</span>'; 
if (
$number_of_rows!=1) {$cpg_flag_return.='<br />';}else{$cpg_flag_return.='';} 
$cpg_flag_return.= ''; 
$cpg_flags_counter=1; 
foreach (
$language_name as $key => $value) 
        { 
          
$cpg_flag_return.= '<a href="' . $cpg_current . $key . '" class="anycontent"><img src="images/flags/' . $country_code_flag[$key] . '.gif" width="16" height="10" border="0" alt="" title="' . $value .'" '.$flagborder.' /></a>'; 
          if(
$cpg_flags_counter==$cpg_flags_cols){$cpg_flag_return.="</td><td class='anycontent'>";$cpg_flags_counter=0;} 
          
$cpg_flags_counter++; 
        } 
} 
//----------------flags end 

if($choice=="list" or $choice=="both") 
{ 
//----------------list start 
if ($number_of_rows==1 and $choice=="both"){$cpg_flag_return .='';} 
$cpg_flag_return.="<form name=\"choose_language\" action=\"" . $cpg_current . $key. "\" method=\"get\" style=\"margin-top:0px;margin-bottom:0px\"><span class=\"anycontent\">"; 
if (
$choice=="list") 
{ 
if (
$number_of_rows!=1) {$cpg_flag_return .= '<hr />' . $translate_language;}else{$cpg_flag_return.='';} 
} 
$cpg_flag_return.=$translate_language . "<select name=\"lang\" size=\"1\" onchange=\"if (this.options[this.selectedIndex].value) window.location.href='".$cpg_current."' + this.options[this.selectedIndex].value;\">"; 
foreach (
$language_name as $key => $value) 
{ 
  
$cpg_flag_return.='<option value="' . $key . '"'; 
  if(
$key==$cpg_current_language){$cpg_flag_return.=' selected';} 
  
$cpg_flag_return.='>' . $value . '</option>'; 
} 
$cpg_flag_return.= '</select></span></td><td class="anycontent">'; 
} 
//----------------list end 

if ($theme_choice== "links") 
{ 
// start links menu 
$cpg_flag_return.='<span class="anycontent">' .$select_theme; 
$cpg_flag_return.='<a href="'.$cpg_theme.'default">Default</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'_tableless">Tableless Beta *</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'airhead">AirHead*Lw</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'anime">Anime*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'black_widdow">Black Widdow*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'blue_tatoo">Blue Tatoo*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'boyz">BoyZ*Lw</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'caliSkinV6">CaliSkinV6*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'christmas2">Christmas II*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'cold_wire">Cold Wire*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'digital_compare">Digital Compare*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'digital_flow">Digital Flow*Lw</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'digital_fruit">Digital Fruit*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'digital_neon">Digital Neon*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'digital_purple">Digital Purple*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'digital_red">Digital Red*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'elektro">Elektro</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'eyeball">Eyeball</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'fiblack3d">FiBlack3D*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'fiblue3d">FiBlue3D*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'final_fantasie">Final Fantasie*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'floral_brown">Floral Brown*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'fruity">Fruity</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'giallo">Giallo</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'graffity">Graffity*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'graphix">Graphics*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'gray_satin">Gray Satin*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'hardwired">Hardwired</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'igames">Igames</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'inkpot">Inkpot*Lw</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'lipstik">Lipstik*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'mac_ox_x">Mac OX</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'magicwoman">Magic Woman*Lw</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'nature_beauty">Nature Beauty*Lw</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'oceandreams">Ocean Dreams*Lw</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'pinned_gray">Pinned Gray*</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'project_vii">Project VII</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'rainy_day">Rainy Day</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'royal_egypt">Royal Egypt*Lw</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'synthetic_blue">Synthetic Blue*Lw</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'water_drop">Water Drop</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'winterdreams">Winter Dreams*Lw</a> | '; 
$cpg_flag_return.='<a href="'.$cpg_theme.'xxx">Reset theme</a>'; 
$cpg_flag_return.='</span>'; 

$cpg_flag_return.="</form>"; 

} 
// end  links menu 

else { // start pul-down menu 
$cpg_flag_return.="<form name=\"choose_theme\" action=\"" . $cpg_theme."&theme=\" method=\"get\" style=\"margin-top:0px;margin-bottom:0px\"><span class=\"anycontent\">"; 
$theme_name['default'] = 'Default'; 
$theme_name['_tableless'] = 'Beta *'; 
$theme_name['airhead'] = 'AirHead *Lw'; 
$theme_name['anime'] = 'Anime *'; 
$theme_name['black_widdow'] = 'Black Widdow *'; 
$theme_name['blue_tatoo'] = 'Blue Tatoo *'; 
$theme_name['boyz'] = 'BoyZ *Lw'; 
$theme_name['caliSkinV6'] = 'CaliSkinV6 *'; 
$theme_name['christmas2'] = 'Christmas II *'; 
$theme_name['cold_wire'] = 'Cold Wire *'; 
$theme_name['digital_compare'] = 'Digital Compare *'; 
$theme_name['digital_flow'] = 'Digital Flow *Lw'; 
$theme_name['digital_fruit'] = 'Digital Fruit *'; 
$theme_name['digital_neon'] = 'Digital Neon *'; 
$theme_name['digital_purple'] = 'Digital Purple *'; 
$theme_name['digital_red'] = 'Digital Red *'; 
$theme_name['elektro'] = 'Elektro'; 
$theme_name['eyeball'] = 'Eyeball'; 
$theme_name['fiblack3d'] = 'FiBlack3D *'; 
$theme_name['fiblue3d'] = 'FiBlue3D *'; 
$theme_name['final_fantasie'] = 'Final Fantasie *'; 
$theme_name['floral_brown'] = 'Floral Brown *'; 
$theme_name['fruity'] = 'Fruity'; 
$theme_name['giallo'] = 'Giallo'; 
$theme_name['graffity'] = 'Graffity *'; 
$theme_name['graphix'] = 'Graphix *'; 
$theme_name['gray_satin'] = 'Gray Satin *'; 
$theme_name['hardwired'] = 'Hardwired'; 
$theme_name['igames'] = 'Igames'; 
$theme_name['inkpot'] = 'Inkpot *Lw'; 
$theme_name['lipstik'] = 'Lipstik *'; 
$theme_name['mac_ox_x'] = 'Mac OX'; 
$theme_name['magicwoman'] = 'Magic Woman *Lw'; 
$theme_name['nature_beauty'] = 'Nature Beauty *Lw'; 
$theme_name['oceandreams'] = 'Ocean Dreams *Lw'; 
$theme_name['pinned_gray'] = 'Pinned Gray *'; 
$theme_name['project_vii'] = 'Project VII'; 
$theme_name['rainy_day'] = 'Rainy Day'; 
$theme_name['royal_egypt'] = 'Royal Egypt *Lw'; 
$theme_name['synthetic_blue'] = 'Synthetic Blue *Lw'; 
$theme_name['water_drop'] = 'Water Drop'; 
$theme_name['winterdreams'] = 'Winterdreams *Lw'; 
$theme_name['xxx'] = 'Reset theme'; 

$cpg_flag_return.=$select_theme . "<select name=\"theme\" size=\"1\" onchange=\"if (this.options[this.selectedIndex].value) window.location.href='".$cpg_theme."' + this.options[this.selectedIndex].value;\">"; 

foreach (
$theme_name as $key => $value) 
{ 
  
$cpg_flag_return.='<option value="' . $key . '"'; 
  if(
$key==$cpg_current_theme){$cpg_flag_return.=' selected';} 
  
$cpg_flag_return.='>' . $value . '</option>'; 
} 
$cpg_flag_return.= '</select></span>'; 

} 
// end pul-down menu 

if ($number_of_rows==1){$cpg_flag_return.='<!--foo</td></tr></table>-->';} 

$cpg_flag_return.=''; 

return 
$cpg_flag_return; 
} 
//--- def function cpg_show_flags end 



function cpg_ascii_onoff() 
{ 
$cpg_current=$_SERVER["SCRIPT_NAME"]."?"; 
foreach (
$_GET as $key => $value) { 
    if (
$key=="ascii"){ 
                       
$ascii_exist=1; 
                       if (
$value==1){$value=0;}else{$value=1;} 
                      } 
    
$cpg_current.= $key . "=" . $value . "&"; 
} 
if(
$ascii_exist!=1){$cpg_current.="ascii=1";} 
$cpg_current = rtrim($cpg_current , "&"); 
return 
$cpg_current; 
} 
?>
Title: Error link when choosing language or theme
Post by: Joachim Müller on December 04, 2003, 09:14:15 AM
php.exe?

GauGau
Title: Error link when choosing language or theme
Post by: thebign on December 04, 2003, 09:29:37 AM
Quote from: "gaugau"php.exe?

GauGau

I found the error:

I change this line:

Original:
$cpg_current=$_SERVER["SCRIPT_NAME"]."?";

Changed to:
 (/foto is my CP folder)

$cpg_current=$_SERVER["/foto"]."?";

//get the url and all vars except $lang
$cpg_current=$_SERVER["/foto"]."?";
foreach ($_GET as $key => $value) {
    if ($key!="lang"){$cpg_current.= $key . "=" . $value . "&";}
}
$cpg_current.="lang=";

//get the url and all vars except $theme
$cpg_theme=$_SERVER["/foto"]."?";
foreach ($_GET as $key => $value) {
    if ($key!="theme"){$cpg_theme.= $key . "=" . $value . "&";}