Complete.Org: Mailing Lists: Archives: freeciv-i18n: October 2002:
[freeciv-i18n] changes to www.freeciv.org
Home

[freeciv-i18n] changes to www.freeciv.org

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv translation <freeciv-i18n@xxxxxxxxxxx>
Subject: [freeciv-i18n] changes to www.freeciv.org
From: Reinier Post <rp@xxxxxxxxxx>
Date: Tue, 8 Oct 2002 20:34:42 +0200

When testing with a new Apache and PHP installation, it turned out that
file_exist() no longer succeeds on relative filenames.  This broke
a couple of pages.

To repair it I have created a function my_file_exists(), defined it
in a central place, and made all the files that called file_exists()
it use my_file_exists() instead.  These files now also have to
include the file in which my_file_exists() is defined.

I also had to change include() yo include_omnly() otherwise the
function would be defined twice, causing a PHP error.

This is a change to 42 files and as usual I did not make any changes to
the translated websites.  It is not necessary to make all these changes
by hand - for example, to change all the include() calls
to include_only() calls the following command can be used:

  fgrep -l include\( `find . -name \*phtml` | xargs \
    perl -pi.includemulti -e 's/include\(/include_once\(/g'

Thanks to Paul for assistance.

The exact cvs diff is attached.

-- 
Reinier


-- Attached file included as plaintext by Ecartis --

Index: clients.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/clients.phtml,v
retrieving revision 1.5
diff -r1.5 clients.phtml
10c10
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
12,13c12,13
<   include(php_code_find("shared_variables.php"));
<   include(php_code_find("fcdb.php"));
---
>   include_once(php_code_find("shared_variables.php"));
>   include_once(php_code_find("fcdb.php"));
Index: download.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/download.phtml,v
retrieving revision 1.172
diff -r1.172 download.phtml
15c15,17
<   include("./php_code/php_code_find.php");
---
>   ini_set("include_path",
>         ini_get("include_path") . ":" . $_SERVER["DOCUMENT_ROOT"]
>   );
17,21c19,26
<   include(php_code_find("versions_file.php"));
<   include(php_code_find("shared_variables.php"));
<   include(php_code_find("get_filesize.php"));
<   include(php_code_find("auto_update_labels.php"));
<   include(php_code_find("download_page_table.php"));
---
>   include_once("php_code/php_code_find.php");
>   include_once(php_code_find("fallback_find_file.php"));
>   include_once(php_code_find("fcdb.php"));
>   include_once(php_code_find("versions_file.php"));
>   include_once(php_code_find("shared_variables.php"));
>   include_once(php_code_find("get_filesize.php"));
>   include_once(php_code_find("auto_update_labels.php"));
>   include_once(php_code_find("download_page_table.php"));
65c70
<               $ftpsite_locally = "/export/home/freeciv/ftp";
---
>               $ftpsite_locally = "/home/freeciv/ftp";
70c75
<                 if (file_exists($ftpsite_locally . "/latest/" . $snapbz)) {
---
>                 if (my_file_exists($ftpsite_locally . "/latest/" . $snapbz)) {
Index: features.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/features.phtml,v
retrieving revision 1.10
diff -r1.10 features.phtml
10d9
<   include("php_code/php_code_find.php");
12c11,13
<   include(php_code_find("fcdb.php"));
---
>   include_once("php_code/php_code_find.php");
>   include_once(php_code_find("fallback_find_file.php"));
>   include_once(php_code_find("fcdb.php"));
97c98
<                 if ( file_exists("ftp/latest/" . $row["locale"] . ".po.bz2") 
) {
---
>                 if ( my_file_exists("ftp/latest/" . $row["locale"] . 
> ".po.bz2") ) {
Index: index.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/index.phtml,v
retrieving revision 1.131
diff -r1.131 index.phtml
10c10
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
12,20c12,20
<   include(php_code_find("shared_variables.php"));
<   include(php_code_find("locale_select.php"));
<   include(php_code_find("versions_file.php"));
<   include(php_code_find("auto_update_labels.php"));
<   include(php_code_find("fcdb.php"));
<   include(php_code_find("display_news_file.php"));
<   include(php_code_find("polls.php"));
<   include(php_code_find("get_filesize.php"));
<   include(php_code_find("download_page_table.php"));
---
>   include_once(php_code_find("shared_variables.php"));
>   include_once(php_code_find("locale_select.php"));
>   include_once(php_code_find("versions_file.php"));
>   include_once(php_code_find("auto_update_labels.php"));
>   include_once(php_code_find("fcdb.php"));
>   include_once(php_code_find("display_news_file.php"));
>   include_once(php_code_find("polls.php"));
>   include_once(php_code_find("get_filesize.php"));
>   include_once(php_code_find("download_page_table.php"));
Index: l10n.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/l10n.phtml,v
retrieving revision 1.21
diff -r1.21 l10n.phtml
16c16
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
18,21c18,21
<   include(php_code_find("shared_variables.php"));
<   include(php_code_find("get_filesize.php"));
<   include(php_code_find("auto_update_labels.php"));
<   include(php_code_find("fcdb.php"));
---
>   include_once(php_code_find("shared_variables.php"));
>   include_once(php_code_find("get_filesize.php"));
>   include_once(php_code_find("auto_update_labels.php"));
>   include_once(php_code_find("fcdb.php"));
Index: links.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/links.phtml,v
retrieving revision 1.28
diff -r1.28 links.phtml
10c10
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
12c12
<   include(php_code_find("shared_variables.php"));
---
>   include_once(php_code_find("shared_variables.php"));
Index: oldpolls.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/oldpolls.phtml,v
retrieving revision 1.10
diff -r1.10 oldpolls.phtml
10c10
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
12,14c12,14
<   include(php_code_find("shared_variables.php"));
<   include(php_code_find("fcdb.php"));
<   include(php_code_find("polls.php"));
---
>   include_once(php_code_find("shared_variables.php"));
>   include_once(php_code_find("fcdb.php"));
>   include_once(php_code_find("polls.php"));
Index: poll.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/poll.phtml,v
retrieving revision 1.10
diff -r1.10 poll.phtml
10c10
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
12,14c12,14
<   include(php_code_find("shared_variables.php"));
<   include(php_code_find("fcdb.php"));
<   include(php_code_find("polls.php"));
---
>   include_once(php_code_find("shared_variables.php"));
>   include_once(php_code_find("fcdb.php"));
>   include_once(php_code_find("polls.php"));
Index: projects.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/projects.phtml,v
retrieving revision 1.11
diff -r1.11 projects.phtml
10c10
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
12,14c12,14
<   include(php_code_find("shared_variables.php"));
<   include(php_code_find("fcdb.php"));
<   include(php_code_find("projects.php"));
---
>   include_once(php_code_find("shared_variables.php"));
>   include_once(php_code_find("fcdb.php"));
>   include_once(php_code_find("projects.php"));
Index: timeline.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/timeline.phtml,v
retrieving revision 1.23
diff -r1.23 timeline.phtml
10c10
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
12c12
<   include(php_code_find("shared_variables.php"));
---
>   include_once(php_code_find("shared_variables.php"));
Index: civworld/index.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/civworld/index.phtml,v
retrieving revision 1.4
diff -r1.4 index.phtml
10c10
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
12,20c12,20
<   include(php_code_find("shared_variables.php"));
<   include(php_code_find("locale_select.php"));
<   include(php_code_find("versions_file.php"));
<   include(php_code_find("auto_update_labels.php"));
<   include(php_code_find("fcdb.php"));
<   include(php_code_find("display_news_file.php"));
<   include(php_code_find("polls.php"));
<   include(php_code_find("get_filesize.php"));
<   include(php_code_find("download_page_table.php"));
---
>   include_once(php_code_find("shared_variables.php"));
>   include_once(php_code_find("locale_select.php"));
>   include_once(php_code_find("versions_file.php"));
>   include_once(php_code_find("auto_update_labels.php"));
>   include_once(php_code_find("fcdb.php"));
>   include_once(php_code_find("display_news_file.php"));
>   include_once(php_code_find("polls.php"));
>   include_once(php_code_find("get_filesize.php"));
>   include_once(php_code_find("download_page_table.php"));
Index: exec/update_locale.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/exec/update_locale.phtml,v
retrieving revision 1.3
diff -r1.3 update_locale.phtml
14c14
<   include("../php_code/fcdb.php");
---
>   include_once("../php_code/fcdb.php");
Index: faq/index.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/faq/index.phtml,v
retrieving revision 1.6
diff -r1.6 index.phtml
11c11
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
13c13
<   include(php_code_find("qa_display.php", ".."));
---
>   include_once(php_code_find("qa_display.php", ".."));
Index: fuadec/images/index.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/fuadec/images/index.phtml,v
retrieving revision 1.1
diff -r1.1 index.phtml
1c1
< <?php include('../../screenshots/screenshots.phtml') ?>
---
> <?php include_once('../../screenshots/screenshots.phtml') ?>
Index: graphics/index.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/graphics/index.phtml,v
retrieving revision 1.8
diff -r1.8 index.phtml
16c16
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
18,19c18,19
<   include(php_code_find("shared_variables.php", ".."));
<   include(php_code_find("auto_update_labels.php", ".."));
---
>   include_once(php_code_find("shared_variables.php", ".."));
>   include_once(php_code_find("auto_update_labels.php", ".."));
Index: manual/index.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/manual/index.phtml,v
retrieving revision 1.24
diff -r1.24 index.phtml
10c10
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
12,13c12,13
<   include(php_code_find("shared_variables.php", ".."));
<   include(php_code_find("get_filesize.php", ".."));
---
>   include_once(php_code_find("shared_variables.php", ".."));
>   include_once(php_code_find("get_filesize.php", ".."));
Index: metaserver/metaranked.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/metaserver/metaranked.phtml,v
retrieving revision 1.18
diff -r1.18 metaranked.phtml
6c6
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
8,9c8,9
<   include(php_code_find("shared_variables.php"));
<   include(php_code_find("fcdb.php"));
---
>   include_once(php_code_find("shared_variables.php"));
>   include_once(php_code_find("fcdb.php"));
Index: news/y1998/news_1998.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/news/y1998/news_1998.phtml,v
retrieving revision 1.5
diff -r1.5 news_1998.phtml
10c10
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
12c12
<   include(php_code_find("display_news_file.php", "../.."));
---
>   include_once(php_code_find("display_news_file.php", "../.."));
Index: news/y2000/news_2000.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/news/y2000/news_2000.phtml,v
retrieving revision 1.5
diff -r1.5 news_2000.phtml
10c10
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
12c12
<   include(php_code_find("display_news_file.php", "../.."));
---
>   include_once(php_code_find("display_news_file.php", "../.."));
Index: news/y2001/news_2001.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/news/y2001/news_2001.phtml,v
retrieving revision 1.3
diff -r1.3 news_2001.phtml
10c10
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
12c12
<   include(php_code_find("display_news_file.php", "../.."));
---
>   include_once(php_code_find("display_news_file.php", "../.."));
Index: news/y2002/news_2002.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/news/y2002/news_2002.phtml,v
retrieving revision 1.4
diff -r1.4 news_2002.phtml
10c10
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
12c12
<   include(php_code_find("display_news_file.php", "../.."));
---
>   include_once(php_code_find("display_news_file.php", "../.."));
Index: php_code/auto_update_labels.php
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/php_code/auto_update_labels.php,v
retrieving revision 1.14
diff -r1.14 auto_update_labels.php
2,3c2,8
< // include the file finder
< include("php_code/fallback_find_file.php");
---
> 
>   // include the php-code finder
>   ini_set("include_path",
>         ini_get("include_path") . ":" . $_SERVER["DOCUMENT_ROOT"]
>   );
>   // includes for support routines
>   include_once(php_code_find("fallback_find_file.php"));
44c49
<   if (file_exists($link) ) {
---
>   if (my_file_exists($link) ) {
Index: php_code/fallback_find_file.php
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/php_code/fallback_find_file.php,v
retrieving revision 1.1
diff -r1.1 fallback_find_file.php
16a17,44
> // let's put some additional file finding functions in here - rp
> 
> // for unknown reasons, file_exists() fails on relative paths now
> // this is the fix
> 
> function my_file_exists($filename) {
>   if (substr($filename,0.1) == '/') {
>     return file_exists($filename);
>   } else {
>     return file_exists(getcwd() . '/' . $filename);
>   }
> }
> 
> 
> // finding an executable called by a PHP script
> // ugly workaround - only used by screenshots/screenshots.phtml - rp
> 
> function find_executable($name) {
>   $candidates = preg_split('/\s+/',`PATH=:$PATH:/usr/local/bin type $name`);
>     # better to fix this at the PHP config end - rp
> 
>   if ($candidates[2] != "found" && is_executable($candidates[2])) {
>     return $candidates[2];
>   } else {
>     return $name;  // won't work, but it'll improve the error message
>   }
> }
> 
Index: php_code/get_filesize.php
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/php_code/get_filesize.php,v
retrieving revision 1.3
diff -r1.3 get_filesize.php
2a3,9
>   // include the php-code finder
>   ini_set("include_path",
>         ini_get("include_path") . ":" . $_SERVER["DOCUMENT_ROOT"]
>   );
>   // includes for support routines
>   include_once(php_code_find("fallback_find_file.php"));
> 
4c11
<   if (file_exists($file)) {
---
>   if (my_file_exists($file)) {
26c33
< ?>
\ No newline at end of file
---
> ?>
Index: php_code/php_code_find.php
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/php_code/php_code_find.php,v
retrieving revision 1.2
diff -r1.2 php_code_find.php
5a6,8
>   // includes for support routines
>   include_once("php_code/fallback_find_file.php");
> 
10c13
<   if (file_exists($file)) {
---
>   if (my_file_exists($file)) {
15c18
<   if (file_exists($file)) {
---
>   if (my_file_exists($file)) {
Index: php_code/polls.php
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/php_code/polls.php,v
retrieving revision 1.3
diff -r1.3 polls.php
4,5c4,5
<  *     include("php_code/shared_variables.php");
<  *     include("php_code/fcdb.php");
---
>  *     include_once("php_code/shared_variables.php");
>  *     include_once("php_code/fcdb.php");
Index: php_code/projects.php
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/php_code/projects.php,v
retrieving revision 1.1
diff -r1.1 projects.php
4,5c4,5
<  *     include("php_code/shared_variables.php");
<  *     include("php_code/fcdb.php");
---
>  *     include_once("php_code/shared_variables.php");
>  *     include_once("php_code/fcdb.php");
Index: php_code/qa_display.php
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/php_code/qa_display.php,v
retrieving revision 1.2
diff -r1.2 qa_display.php
3c3
< include(php_code_find("versions_file.php"));
---
> include_once(php_code_find("versions_file.php"));
Index: private/change_locales.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/private/change_locales.phtml,v
retrieving revision 1.1
diff -r1.1 change_locales.phtml
16c16
<   include("../php_code/fcdb.php");
---
>   include_once("../php_code/fcdb.php");
Index: private/change_poll.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/private/change_poll.phtml,v
retrieving revision 1.1
diff -r1.1 change_poll.phtml
76c76
<     include("../php_code/fcdb.php");   
---
>     include_once("../php_code/fcdb.php");   
Index: private/change_projects.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/private/change_projects.phtml,v
retrieving revision 1.4
diff -r1.4 change_projects.phtml
16c16
<   include("../php_code/fcdb.php");
---
>   include_once("../php_code/fcdb.php");
Index: screenshots/index.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/screenshots/index.phtml,v
retrieving revision 1.19
diff -r1.19 index.phtml
9c9
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
11,12c11,12
<   include(php_code_find("shared_variables.php", ".."));
<   include(php_code_find("auto_update_labels.php", ".."));
---
>   include_once(php_code_find("shared_variables.php", ".."));
>   include_once(php_code_find("auto_update_labels.php", ".."));
Index: screenshots/screenshots.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/screenshots/screenshots.phtml,v
retrieving revision 1.29
diff -r1.29 screenshots.phtml
15a16
> 
16a18
>   //
21a24
>   //
23a27,34
> 
>   // include the php-code finder
>   ini_set("include_path",
>         ini_get("include_path") . ":" . $_SERVER["DOCUMENT_ROOT"]
>   );
>   // includes for support routines
>   include_once("php_code/php_code_find.php");
>   include_once(php_code_find("fallback_find_file.php"));
26,46d36
< 
<   function my_file_exists($filename) {
<     // for unknown reasons, file_exists() fails on relative paths now
<     if (substr($filename,0.1) == '/') {
<       return file_exists($filename);
<     } else {
<       return file_exists(getcwd() . '/' . $filename);
<     }
<   }
< 
<   function find_executable($name) {
< 
<     $candidates = 
preg_split('/\s+/',`PATH=:$PATH:/home/rp/rpsoft/bin:/usr/local/bin type $name`);
<       # ouch - not nice. but I honestly do not *get* the $PATH - rp
< 
<     if ($candidates[2] != "found" && is_executable($candidates[2])) {
<       return $candidates[2];
<     } else {
<       return $name;  // won't work, but we'll understand the error message
<     }
<   }
Index: screenshots/1.11.5/index.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/screenshots/1.11.5/index.phtml,v
retrieving revision 1.3
diff -r1.3 index.phtml
1c1
< <?php include('../screenshots.phtml') ?>
---
> <?php include_once('../screenshots.phtml') ?>
Index: screenshots/1.12.0/index.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/screenshots/1.12.0/index.phtml,v
retrieving revision 1.3
diff -r1.3 index.phtml
1c1
< <?php include('../screenshots.phtml') ?>
---
> <?php include_once('../screenshots.phtml') ?>
Index: screenshots/1.12.1/index.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/screenshots/1.12.1/index.phtml,v
retrieving revision 1.7
diff -r1.7 index.phtml
1c1
< <?php include('../screenshots.phtml') ?>
---
> <?php include_once('../screenshots.phtml') ?>
Index: screenshots/1.13.0/index.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/screenshots/1.13.0/index.phtml,v
retrieving revision 1.1
diff -r1.1 index.phtml
1c1
< <?php include('../screenshots.phtml') ?>
---
> <?php include_once('../screenshots.phtml') ?>
Index: screenshots/1.13.0/japanese/index.phtml
===================================================================
RCS file: 
/home/freeciv/cvsroot/web_html/screenshots/1.13.0/japanese/index.phtml,v
retrieving revision 1.2
diff -r1.2 index.phtml
1c1
< <?php include('../../screenshots.phtml') ?>
---
> <?php include_once('../../screenshots.phtml') ?>
Index: screenshots/1.13.0/lexxy/index.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/screenshots/1.13.0/lexxy/index.phtml,v
retrieving revision 1.1
diff -r1.1 index.phtml
1c1
< <?php include('../../screenshots.phtml') ?>
---
> <?php include_once('../../screenshots.phtml') ?>
Index: screenshots/1.13.1/index.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/screenshots/1.13.1/index.phtml,v
retrieving revision 1.1
diff -r1.1 index.phtml
1c1
< <?php include('../screenshots.phtml') ?>
---
> <?php include_once('../screenshots.phtml') ?>
Index: tutorials/index.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/tutorials/index.phtml,v
retrieving revision 1.7
diff -r1.7 index.phtml
10c10
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
12c12
<   include(php_code_find("shared_variables.php", ".."));
---
>   include_once(php_code_find("shared_variables.php", ".."));
Index: windows/index.phtml
===================================================================
RCS file: /home/freeciv/cvsroot/web_html/windows/index.phtml,v
retrieving revision 1.5
diff -r1.5 index.phtml
10c10
<   include("php_code/php_code_find.php");
---
>   include_once("php_code/php_code_find.php");
13c13
<   include(php_code_find("qa_display.php", ".."));
---
>   include_once(php_code_find("qa_display.php", ".."));




[Prev in Thread] Current Thread [Next in Thread]