Zainstalowalem sobie na stronie skrypt phpLang

Znaduje sie tam plik phpLang.inc
Na samym koncu jest funkcja ktora dodaje flagi jezeli plik istnieje. Problem polega na tym ze jezeli zmienie nazwe pliku w ktorym phpLang.inc jest includowany to mi sie juz nie pojawiaja flagi. O co w tym chodzi? Co powinienem zmienic?
  1. <?php
  2. /*
  3. project : phpLang
  4. location : <a href="http://www.phpheaven.net/projects/phpLang/" target="_blank">http://www.phpheaven.net/projects/phpLang/</a>
  5. version : 0.4.1
  6. date : 25/03/2001
  7. authors : Nicolas Hoizey <nhoizey@phpheaven.net>
  8. Loďc Chapeaux <lolo@phpheaven.net>
  9. file : phpLang.inc.php
  10. description : main file of phpLang, to be included at the top of your main files
  11. to activate language detection (see examples)
  12. */
  13.  
  14. // path to image files
  15. if(!defined('phpLang_images'))
  16. define('phpLang_images', './flags/');
  17.  
  18. // path to translated files
  19. if(!defined('phpLang_localDir'))
  20. define('phpLang_localDir', './localization/');
  21.  
  22. // name of a translation file that will always be included if it exists
  23. if(!defined('phpLang_globalFile'))
  24. define('phpLang_globalFile', getenv('REDIRECT_HOMEDIR').'localization/global.php');
  25.  
  26. // parameter to add in url
  27. if(!defined('phpLang_urlParam'))
  28. define('phpLang_urlParam', 'phpLang');
  29.  
  30. // indicates if it should put a cookie
  31. if(!defined('phpLang_useCookie'))
  32. define('phpLang_useCookie', true);
  33.  
  34. // how are named the xx-localized version of file 'toto.php' ?
  35. // 1 -> current_dir/toto.php.xx
  36. // 2 -> current_dir/toto.xx.php
  37. // 3 -> current_dir/xx.toto.php
  38. // 4 -> current_dir/xx/toto.php (in a directory for each language)
  39. if(!defined('phpLang_fileNameType'))
  40. define('phpLang_fileNameType', 1);
  41.  
  42. // list of available languages, order it as you need
  43. $phpLang_languages = array(
  44. "en([-_][[:alpha:]]{2})?|english" => array('en', 'english'),
  45. "fr([-_][[:alpha:]]{2})?|french" => array('fr', 'french'),
  46. "cs|czech" => array('cs', 'czech'),
  47. "da|danish" => array('da', 'danish'),
  48. "nl([-_][[:alpha:]]{2})?|dutch" => array('nl', 'dutch'),
  49. "de([-_][[:alpha:]]{2})?|german" => array('de', 'german'),
  50. "fi|finnish" => array('fi', 'finnish'),
  51. "is|icelandic" => array('is', 'icelandic'),
  52. "it|italian" => array('it', 'italian'),
  53. "no|norwegian" => array('no', 'norwegian'),
  54. "pl|polish" => array('pl', 'polish'),
  55. "ru|russian" => array('ru', 'russian'),
  56. "sk|slovak" => array('sk', 'slovak'),
  57. "es([-_][[:alpha:]]{2})?|spanish" => array('es', 'spanish'),
  58. "th|thai" => array('th', 'thai'),
  59. "pt[-_]br" => array('pt-br', 'brazilian portuguese'),
  60. "pt([-_][[:alpha:]]{2})?|portuguese" => array('pt', 'portuguese'),
  61. "uk([-_][[:alpha:]]{2})?|ukrainian" => array('ua', 'ukrainian'),
  62. "zh[-_]tw" => array('zh-tw', 'chinese_traditional'),
  63. "zh([-_][[:alpha:]]{2})?|chinese" => array('zh', 'chinese_simplified')
  64. );
  65.  
  66. // finds current file name, extension and uri
  67. if(ereg("([^/?]+)(?.*)?$", $REQUEST_URI, $regs))
  68. {
  69. define('phpLang_currentFile', $regs[1]);
  70. if(ereg("(.*)(.[^.]+)$", phpLang_currentFile, $regs2))
  71. {
  72. define('phpLang_currentFileName', $regs2[1]);
  73. define('phpLang_currentFileExtension', $regs2[2]);
  74. }
  75. else
  76. {
  77. define('phpLang_currentFileName', phpLang_currentFile);
  78. }
  79. $uri = ereg_replace("[?&]".phpLang_urlParam."=[^&]*", "", $regs[0]);
  80. $uri .= ereg("?", $uri) ? '&' : '?';
  81. define('phpLang_currentURI', $uri);
  82. }
  83. else
  84. {
  85. // it should not be possible
  86. define('phpLang_currentFile', '');
  87. define('phpLang_currentURI', '');
  88. define('phpLang_currentFileName', '');
  89. define('phpLang_currentFileExtension', '');
  90. }
  91.  
  92. $HTTP_ACCEPT_LANGUAGE = getenv('HTTP_ACCEPT_LANGUAGE');
  93. $HTTP_USER_AGENT = getenv('HTTP_USER_AGENT');
  94.  
  95. // function that gives the localized file name
  96. function phpLang_localizedFileName($lang)
  97. {
  98. switch(phpLang_fileNameType)
  99. {
  100. case 1 : $ret = phpLang_localDir.phpLang_currentFileName.phpLang_currentFileExtension.'.'.$lang;
  101. break;
  102. case 2 : $ret = phpLang_localDir.phpLang_currentFileName.'.'.$lang.phpLang_currentFileExtension;
  103. break;
  104. case 3 : $ret = phpLang_localDir.$lang.'.'.phpLang_currentFileName.phpLang_currentFileExtension;
  105. break;
  106. case 4 : $ret = phpLang_localDir.$lang.'/'.phpLang_currentFileName.phpLang_currentFileExtension;
  107. break;
  108. }
  109. return $ret;
  110. }
  111.  
  112. // language code detection
  113. function phpLang_detectLanguage($str, $from)
  114. {
  115. $ext = '';
  116. reset($GLOBALS['phpLang_languages']);
  117. while($ext == '' && list($key, $name) = each($GLOBALS['phpLang_languages']))
  118. {
  119. if (($from == 1 && eregi("^".$key."$",$str)) || ($from == 2 && eregi("((|[|;[[:space:]])".$key."(;|]|))",$str)))
  120. {
  121. $ext = $name[0];
  122. }
  123. }
  124. return $ext;
  125. }
  126.  
  127. // finds the appropriate language file
  128. if (isset($HTTP_GET_VARS[phpLang_urlParam]) && file_exists(phpLang_localizedFileName($HTTP_GET_VARS[phpLang_urlParam])))
  129. {
  130. // a language as been chosen by the user
  131. define('phpLang_current', $HTTP_GET_VARS[phpLang_urlParam]);
  132. }
  133.  
  134. if (!defined('phpLang_current') && phpLang_useCookie && isset($HTTP_COOKIE_VARS['phpLangCookie']) && file_exists(phpLang_localizedFileName($HTTP_COOKIE_VARS['phpLangCookie'])))
  135. {
  136. // a language as been found in a cookie previously set
  137. define('phpLang_current', $HTTP_COOKIE_VARS['phpLangCookie']);
  138. }
  139.  
  140. if (!defined('phpLang_current') && isset($HTTP_ACCEPT_LANGUAGE) && trim($HTTP_ACCEPT_LANGUAGE) != '')
  141. {
  142. // looks at the languages accepted by the browser
  143. $accepted = explode(',', $HTTP_ACCEPT_LANGUAGE);
  144. while(!defined('phpLang_current') && list($key, $name) = each($accepted))
  145. {
  146. $code = explode(';', $name);
  147. $ext = phpLang_detectLanguage($code[0], 1);
  148. if(file_exists(phpLang_localizedFileName($ext)))
  149. {
  150. define('phpLang_current', $ext);
  151. }
  152. }
  153. }
  154.  
  155. if (!defined('phpLang_current') && isset($HTTP_USER_AGENT) && trim($HTTP_USER_AGENT) != '')
  156. {
  157. // looks at the browser's identification
  158. $ext = phpLang_detectLanguage($HTTP_USER_AGENT, 2);
  159. if(file_exists(phpLang_localizedFileName($ext)))
  160. {
  161. define('phpLang_current', $ext);
  162. }
  163. }
  164.  
  165. if(!defined('phpLang_current'))
  166. {
  167. // if no language yet found, chose the first existing in site's list
  168. reset($phpLang_languages);
  169. while(!defined('phpLang_current') && list($key, $name) = each($phpLang_languages))
  170. {
  171. if(file_exists(phpLang_localizedFileName($name[0])))
  172. {
  173. define('phpLang_current', $name[0]);
  174. }
  175. }
  176. }
  177.  
  178. // detection done, cookie update and inclusion of localized files if any available
  179. if(defined('phpLang_current'))
  180. {
  181. if(phpLang_useCookie)
  182. {
  183. // set a cookie expiring in one year for current language
  184. setcookie('phpLangCookie', phpLang_current, time() + 60*60*24*365);
  185. }
  186.  
  187. // defines a string to add at the end of each link
  188. define('phpLang_link', phpLang_urlParam.'='.phpLang_current);
  189. }
  190. else
  191. {
  192. // no language found
  193. define('phpLang_current', '');
  194. define('phpLang_link', phpLang_urlParam.'=');
  195. }
  196.  
  197. // ###################################################################
  198. // only for backward compatibility with versions previous to 0.3.0 !!!
  199.  define('CUR_LANG', phpLang_current);
  200.  define('LANG_LINK', phpLang_link);
  201. // ###################################################################
  202.  
  203. // function that adds the flags with links for existing files
  204. // give as first parameter the HTML string to put between each flag
  205. function AddFlags($between = "", $showCurrent = false)
  206. {
  207. reset($GLOBALS["phpLang_languages"]);
  208. $temp = "";
  209. while(list($key, $name) = each($GLOBALS["phpLang_languages"]))
  210. {
  211. if(file_exists(phpLang_localizedFileName($name[0])) && ($showCurrent || $name[0] != phpLang_current))
  212. {
  213. echo($temp.'<a href="'.phpLang_currentURI.phpLang_urlParam.'='.$name[0].'">');
  214. echo('<img src="'.phpLang_images.$name[0].'.gif" border="0" align="middle" width="24" height="16" alt="'.$name[1].'" />');
  215. echo('</a>');
  216. $temp = $between;
  217. }
  218. }
  219. }
  220.  
  221. if(phpLang_current != '')
  222. {
  223. // includes global language file
  224. if(file_exists(phpLang_localDir.phpLang_globalFile.'.'.phpLang_current))
  225. {
  226. include(phpLang_localDir.phpLang_globalFile.'.'.phpLang_current);
  227. }
  228. // includes current language file
  229.  
  230. }
  231.  
  232. // then, you can use two constants in your scripts :
  233. //  phpLang_current : current language code
  234. //  phpLang_link : add this in the links after a '?' or a '&'
  235. ?>