cvs: docweb /include init.inc.php lib_general.inc.php /include/jpgraph jpg-config.inc /scripts gen_picture_info.php gen_picture_info_all_lang.php
rev.php /www error.php
| From: | Vincent Gevers | Date: | Fri, 29 Oct 2004 14:33:04 +0000 |
| Subject: | cvs: docweb /include init.inc.php lib_general.inc.php /include/jpgraph jpg-config.inc /scripts gen_picture_info.php gen_picture_info_all_lang.php rev.php /www error.php |
||
| Groups: | php.doc.web | ||
| Request: | Send a blank email to doc-web+get-359@lists.php.net to get a copy of this message | ||
vincent Fri Oct 29 10:33:04 2004 EDT
Modified files:
/docweb/include init.inc.php lib_general.inc.php
/docweb/include/jpgraph jpg-config.inc
/docweb/scripts gen_picture_info.php gen_picture_info_all_lang.php
rev.php
/docweb/www error.php
Log:
- Make cli scripts work again
- Make the rev.php script work again
- Make the image generation work again
- Print a more useful 404 error message
http://cvs.php.net/diff.php/docweb/include/init.inc.php?r1=1.2&r2=1.3&ty=u Index: docweb/include/init.inc.php diff -u docweb/include/init.inc.php:1.2 docweb/include/init.inc.php:1.3 --- docweb/include/init.inc.php:1.2 Wed Oct 27 12:43:01 2004 +++ docweb/include/init.inc.php Fri Oct 29 10:33:04 2004 @@ -18,7 +18,7 @@ | Gabor Hojtsy <goba@php.net> | | Sean Coates <sean@php.net> | +----------------------------------------------------------------------+ -$Id: init.inc.php,v 1.2 2004/10/27 16:43:01 sean Exp $ +$Id: init.inc.php,v 1.3 2004/10/29 14:33:04 vincent Exp $ */ error_reporting(E_ALL); @@ -37,39 +37,44 @@ $defaultFallbackProject = 'www'; $defaultFallbackLanguage = 'en'; -// set up constants (use defaults if necessary) -define('SITE', isset($project) ? $project : $defaultProject); -define('LANGC', isset($language) ? $language : $defaultLanguage); -define('URI', isset($uri) ? $uri : $_SERVER['REQUEST_URI']); -define('LANGD', $LANGUAGES[LANGC]); - -// set up BASE_URL -if (substr($_SERVER['REQUEST_URI'], -1, 1) == '/') { - // is a directory, use verbatim - $baseURL = $_SERVER['REQUEST_URI']; -} else { - // not a dir, use the dirname - $baseURL = dirname($_SERVER['REQUEST_URI']); -} +// Only allow $_SERVER under apache to make cli scripts work +if (!isset($inCli) OR $inCli != true) { + $inCli = false; + + // set up constants (use defaults if necessary) + define('SITE', isset($project) ? $project : $defaultProject); + define('LANGC', isset($language) ? $language : $defaultLanguage); + define('URI', isset($uri) ? $uri : $_SERVER['REQUEST_URI']); + define('LANGD', $LANGUAGES[LANGC]); + + // set up BASE_URL + if (substr($_SERVER['REQUEST_URI'], -1, 1) == '/') { + // is a directory, use verbatim + $baseURL = $_SERVER['REQUEST_URI']; + } else { + // not a dir, use the dirname + $baseURL = dirname($_SERVER['REQUEST_URI']); + } + + // this very dirty fix makes /rfc work + $baseURL = str_replace('/rfc', '', $baseURL); -// this very dirty fix makes /rfc work -$baseURL = str_replace('/rfc', '', $baseURL); + // actually define the constant (trim off any trailing slashes): + define('BASE_URL', rtrim($baseURL, '/')); -// actually define the constant (trim off any trailing slashes): -define('BASE_URL', rtrim($baseURL, '/')); +} // general support library require_once('lib_general.inc.php'); +if ($inCli != true) { + // language & template constants + define('DOCWEB_ENTITIY_PREFIX', 'docweb'); + + // language engine + require_once('docweb_language.class.php'); + $Language =& new DocWeb_Language(LANGC); -// language & template constants -define('DOCWEB_ENTITIY_PREFIX', 'docweb'); - -// language engine -require_once('docweb_language.class.php'); -$Language =& new DocWeb_Language(LANGC); - -// template engine -require_once('docweb_template.class.php'); - -?> \ No newline at end of file + // template engine + require_once('docweb_template.class.php'); +} http://cvs.php.net/diff.php/docweb/include/lib_general.inc.php?r1=1.28&r2=1.29&ty=u Index: docweb/include/lib_general.inc.php diff -u docweb/include/lib_general.inc.php:1.28 docweb/include/lib_general.inc.php:1.29 --- docweb/include/lib_general.inc.php:1.28 Wed Oct 27 12:43:01 2004 +++ docweb/include/lib_general.inc.php Fri Oct 29 10:33:04 2004 @@ -18,7 +18,7 @@ | Gabor Hojtsy <goba@php.net> | | Sean Coates <sean@php.net> | +----------------------------------------------------------------------+ -$Id: lib_general.inc.php,v 1.28 2004/10/27 16:43:01 sean Exp $ +$Id: lib_general.inc.php,v 1.29 2004/10/29 14:33:04 vincent Exp $ */ function is_translation($project, $language) @@ -34,7 +34,7 @@ function get_cvs_dir($project) { // @@@ make this return something until the function is found - return $GLOBALS['PROJECTS'][$project][1]; + return $GLOBALS['PROJECTS'][$project][1] . '/'; } function site_header($title = '', $style = array()) http://cvs.php.net/diff.php/docweb/include/jpgraph/jpg-config.inc?r1=1.2&r2=1.3&ty=u Index: docweb/include/jpgraph/jpg-config.inc diff -u docweb/include/jpgraph/jpg-config.inc:1.2 docweb/include/jpgraph/jpg-config.inc:1.3 --- docweb/include/jpgraph/jpg-config.inc:1.2 Fri Aug 6 04:05:43 2004 +++ docweb/include/jpgraph/jpg-config.inc Fri Oct 29 10:33:04 2004 @@ -4,7 +4,7 @@ // Description: Configuration file for JpGraph library // Created: 2004-03-27 // Author: Johan Persson (johanp@aditus.nu) -// Ver: $Id: jpg-config.inc,v 1.2 2004/08/06 08:05:43 vincent Exp $ +// Ver: $Id: jpg-config.inc,v 1.3 2004/10/29 14:33:04 vincent Exp $ // // License: This code is released under QPL 1.0 // Copyright (C) 2004 Johan Persson @@ -37,7 +37,7 @@ // //------------------------------------------------------------------------ // DEFINE("CACHE_DIR","/tmp/jpgraph_cache/"); -DEFINE("TTF_DIR","./fonts/"); +DEFINE("TTF_DIR","../include/jpgraph/fonts/"); //------------------------------------------------------------------------- http://cvs.php.net/diff.php/docweb/scripts/gen_picture_info.php?r1=1.4&r2=1.5&ty=u Index: docweb/scripts/gen_picture_info.php diff -u docweb/scripts/gen_picture_info.php:1.4 docweb/scripts/gen_picture_info.php:1.5 --- docweb/scripts/gen_picture_info.php:1.4 Fri Sep 24 13:32:19 2004 +++ docweb/scripts/gen_picture_info.php Fri Oct 29 10:33:04 2004 @@ -1,8 +1,11 @@ <?php +/* $Id: gen_picture_info.php,v 1.5 2004/10/29 14:33:04 vincent Exp $ */ + include '../include/jpgraph/jpgraph.php'; include '../include/jpgraph/jpgraph_pie.php'; include '../include/jpgraph/jpgraph_pie3d.php'; +$inCli = true; include '../include/init.inc.php'; include '../include/lib_revcheck.inc.php'; @@ -30,7 +33,7 @@ } else { - echo " Generate images/revcheck/info_revcheck_" . $TYPE . "_" . $lang . ".png\n"; + echo " Generated images/revcheck/info_revcheck_" . $TYPE . "_" . $lang . ".png\n"; } } http://cvs.php.net/diff.php/docweb/scripts/gen_picture_info_all_lang.php?r1=1.4&r2=1.5&ty=u Index: docweb/scripts/gen_picture_info_all_lang.php diff -u docweb/scripts/gen_picture_info_all_lang.php:1.4 docweb/scripts/gen_picture_info_all_lang.php:1.5 --- docweb/scripts/gen_picture_info_all_lang.php:1.4 Fri Sep 24 13:32:19 2004 +++ docweb/scripts/gen_picture_info_all_lang.php Fri Oct 29 10:33:04 2004 @@ -2,6 +2,7 @@ include '../include/jpgraph/jpgraph.php'; include '../include/jpgraph/jpgraph_bar.php'; +$inCli = true; include '../include/init.inc.php'; include '../include/lib_revcheck.inc.php'; @@ -48,12 +49,11 @@ $datay = array_values($datay_tmp); $legendy = array_values($legendy_tmp); - echo "Generate $type graphik for all language...\n"; + echo "Generating $type graphic for all languages..."; generation_image($type); - - echo "... finish.\n"; + echo " Done.\n"; } // end if http://cvs.php.net/diff.php/docweb/scripts/rev.php?r1=1.3&r2=1.4&ty=u Index: docweb/scripts/rev.php diff -u docweb/scripts/rev.php:1.3 docweb/scripts/rev.php:1.4 --- docweb/scripts/rev.php:1.3 Fri Sep 24 13:32:19 2004 +++ docweb/scripts/rev.php Fri Oct 29 10:33:04 2004 @@ -65,6 +65,7 @@ **/ // define some common variables +$inCli = true; include '../include/init.inc.php'; // grab the documentation type http://cvs.php.net/diff.php/docweb/www/error.php?r1=1.7&r2=1.8&ty=u Index: docweb/www/error.php diff -u docweb/www/error.php:1.7 docweb/www/error.php:1.8 --- docweb/www/error.php:1.7 Fri Sep 24 13:32:19 2004 +++ docweb/www/error.php Fri Oct 29 10:33:04 2004 @@ -1,5 +1,5 @@ <?php -/* $Id: error.php,v 1.7 2004/09/24 17:32:19 sean Exp $ */ +/* $Id: error.php,v 1.8 2004/10/29 14:33:04 vincent Exp $ */ include '../include/init.inc.php'; @@ -10,12 +10,16 @@ <h2><?php echo $title; ?></h2> <p> <?php -if( isset($_SERVER['REDIRECT_ERROR_NOTES']) ) { - echo $_SERVER['REDIRECT_ERROR_NOTES']; -} elseif( isset($_SERVER['REDIRECT_REDIRECT_ERROR_NOTES']) ) { - echo $_SERVER['REDIRECT_REDIRECT_ERROR_NOTES']; +if (isset($_SERVER['REDIRECT_ERROR_NOTES'])) { + echo $_SERVER['REDIRECT_ERROR_NOTES']; +} elseif (isset($_SERVER['REDIRECT_REDIRECT_ERROR_NOTES'])) { + echo $_SERVER['REDIRECT_REDIRECT_ERROR_NOTES']; } else { - echo 'No message available.'; + if ($red_status == 404) { + echo 'File Not Found: ' . htmlspecialchars($_SERVER['REQUEST_URI']); + } else { + echo 'No message available.'; + } }
http://cvs.php.net/diff.php/docweb/include/init.inc.php?r1=1.2&r2=1.3&ty=u Index: docweb/include/init.inc.php diff -u docweb/include/init.inc.php:1.2 docweb/include/init.inc.php:1.3 --- docweb/include/init.inc.php:1.2 Wed Oct 27 12:43:01 2004 +++ docweb/include/init.inc.php Fri Oct 29 10:33:04 2004 @@ -18,7 +18,7 @@ | Gabor Hojtsy <goba@php.net> | | Sean Coates <sean@php.net> | +----------------------------------------------------------------------+ -$Id: init.inc.php,v 1.2 2004/10/27 16:43:01 sean Exp $ +$Id: init.inc.php,v 1.3 2004/10/29 14:33:04 vincent Exp $ */ error_reporting(E_ALL); @@ -37,39 +37,44 @@ $defaultFallbackProject = 'www'; $defaultFallbackLanguage = 'en'; -// set up constants (use defaults if necessary) -define('SITE', isset($project) ? $project : $defaultProject); -define('LANGC', isset($language) ? $language : $defaultLanguage); -define('URI', isset($uri) ? $uri : $_SERVER['REQUEST_URI']); -define('LANGD', $LANGUAGES[LANGC]); - -// set up BASE_URL -if (substr($_SERVER['REQUEST_URI'], -1, 1) == '/') { - // is a directory, use verbatim - $baseURL = $_SERVER['REQUEST_URI']; -} else { - // not a dir, use the dirname - $baseURL = dirname($_SERVER['REQUEST_URI']); -} +// Only allow $_SERVER under apache to make cli scripts work +if (!isset($inCli) OR $inCli != true) { + $inCli = false; + + // set up constants (use defaults if necessary) + define('SITE', isset($project) ? $project : $defaultProject); + define('LANGC', isset($language) ? $language : $defaultLanguage); + define('URI', isset($uri) ? $uri : $_SERVER['REQUEST_URI']); + define('LANGD', $LANGUAGES[LANGC]); + + // set up BASE_URL + if (substr($_SERVER['REQUEST_URI'], -1, 1) == '/') { + // is a directory, use verbatim + $baseURL = $_SERVER['REQUEST_URI']; + } else { + // not a dir, use the dirname + $baseURL = dirname($_SERVER['REQUEST_URI']); + } + + // this very dirty fix makes /rfc work + $baseURL = str_replace('/rfc', '', $baseURL); -// this very dirty fix makes /rfc work -$baseURL = str_replace('/rfc', '', $baseURL); + // actually define the constant (trim off any trailing slashes): + define('BASE_URL', rtrim($baseURL, '/')); -// actually define the constant (trim off any trailing slashes): -define('BASE_URL', rtrim($baseURL, '/')); +} // general support library require_once('lib_general.inc.php'); +if ($inCli != true) { + // language & template constants + define('DOCWEB_ENTITIY_PREFIX', 'docweb'); + + // language engine + require_once('docweb_language.class.php'); + $Language =& new DocWeb_Language(LANGC); -// language & template constants -define('DOCWEB_ENTITIY_PREFIX', 'docweb'); - -// language engine -require_once('docweb_language.class.php'); -$Language =& new DocWeb_Language(LANGC); - -// template engine -require_once('docweb_template.class.php'); - -?> \ No newline at end of file + // template engine + require_once('docweb_template.class.php'); +} http://cvs.php.net/diff.php/docweb/include/lib_general.inc.php?r1=1.28&r2=1.29&ty=u Index: docweb/include/lib_general.inc.php diff -u docweb/include/lib_general.inc.php:1.28 docweb/include/lib_general.inc.php:1.29 --- docweb/include/lib_general.inc.php:1.28 Wed Oct 27 12:43:01 2004 +++ docweb/include/lib_general.inc.php Fri Oct 29 10:33:04 2004 @@ -18,7 +18,7 @@ | Gabor Hojtsy <goba@php.net> | | Sean Coates <sean@php.net> | +----------------------------------------------------------------------+ -$Id: lib_general.inc.php,v 1.28 2004/10/27 16:43:01 sean Exp $ +$Id: lib_general.inc.php,v 1.29 2004/10/29 14:33:04 vincent Exp $ */ function is_translation($project, $language) @@ -34,7 +34,7 @@ function get_cvs_dir($project) { // @@@ make this return something until the function is found - return $GLOBALS['PROJECTS'][$project][1]; + return $GLOBALS['PROJECTS'][$project][1] . '/'; } function site_header($title = '', $style = array()) http://cvs.php.net/diff.php/docweb/include/jpgraph/jpg-config.inc?r1=1.2&r2=1.3&ty=u Index: docweb/include/jpgraph/jpg-config.inc diff -u docweb/include/jpgraph/jpg-config.inc:1.2 docweb/include/jpgraph/jpg-config.inc:1.3 --- docweb/include/jpgraph/jpg-config.inc:1.2 Fri Aug 6 04:05:43 2004 +++ docweb/include/jpgraph/jpg-config.inc Fri Oct 29 10:33:04 2004 @@ -4,7 +4,7 @@ // Description: Configuration file for JpGraph library // Created: 2004-03-27 // Author: Johan Persson (johanp@aditus.nu) -// Ver: $Id: jpg-config.inc,v 1.2 2004/08/06 08:05:43 vincent Exp $ +// Ver: $Id: jpg-config.inc,v 1.3 2004/10/29 14:33:04 vincent Exp $ // // License: This code is released under QPL 1.0 // Copyright (C) 2004 Johan Persson @@ -37,7 +37,7 @@ // //------------------------------------------------------------------------ // DEFINE("CACHE_DIR","/tmp/jpgraph_cache/"); -DEFINE("TTF_DIR","./fonts/"); +DEFINE("TTF_DIR","../include/jpgraph/fonts/"); //------------------------------------------------------------------------- http://cvs.php.net/diff.php/docweb/scripts/gen_picture_info.php?r1=1.4&r2=1.5&ty=u Index: docweb/scripts/gen_picture_info.php diff -u docweb/scripts/gen_picture_info.php:1.4 docweb/scripts/gen_picture_info.php:1.5 --- docweb/scripts/gen_picture_info.php:1.4 Fri Sep 24 13:32:19 2004 +++ docweb/scripts/gen_picture_info.php Fri Oct 29 10:33:04 2004 @@ -1,8 +1,11 @@ <?php +/* $Id: gen_picture_info.php,v 1.5 2004/10/29 14:33:04 vincent Exp $ */ + include '../include/jpgraph/jpgraph.php'; include '../include/jpgraph/jpgraph_pie.php'; include '../include/jpgraph/jpgraph_pie3d.php'; +$inCli = true; include '../include/init.inc.php'; include '../include/lib_revcheck.inc.php'; @@ -30,7 +33,7 @@ } else { - echo " Generate images/revcheck/info_revcheck_" . $TYPE . "_" . $lang . ".png\n"; + echo " Generated images/revcheck/info_revcheck_" . $TYPE . "_" . $lang . ".png\n"; } } http://cvs.php.net/diff.php/docweb/scripts/gen_picture_info_all_lang.php?r1=1.4&r2=1.5&ty=u Index: docweb/scripts/gen_picture_info_all_lang.php diff -u docweb/scripts/gen_picture_info_all_lang.php:1.4 docweb/scripts/gen_picture_info_all_lang.php:1.5 --- docweb/scripts/gen_picture_info_all_lang.php:1.4 Fri Sep 24 13:32:19 2004 +++ docweb/scripts/gen_picture_info_all_lang.php Fri Oct 29 10:33:04 2004 @@ -2,6 +2,7 @@ include '../include/jpgraph/jpgraph.php'; include '../include/jpgraph/jpgraph_bar.php'; +$inCli = true; include '../include/init.inc.php'; include '../include/lib_revcheck.inc.php'; @@ -48,12 +49,11 @@ $datay = array_values($datay_tmp); $legendy = array_values($legendy_tmp); - echo "Generate $type graphik for all language...\n"; + echo "Generating $type graphic for all languages..."; generation_image($type); - - echo "... finish.\n"; + echo " Done.\n"; } // end if http://cvs.php.net/diff.php/docweb/scripts/rev.php?r1=1.3&r2=1.4&ty=u Index: docweb/scripts/rev.php diff -u docweb/scripts/rev.php:1.3 docweb/scripts/rev.php:1.4 --- docweb/scripts/rev.php:1.3 Fri Sep 24 13:32:19 2004 +++ docweb/scripts/rev.php Fri Oct 29 10:33:04 2004 @@ -65,6 +65,7 @@ **/ // define some common variables +$inCli = true; include '../include/init.inc.php'; // grab the documentation type http://cvs.php.net/diff.php/docweb/www/error.php?r1=1.7&r2=1.8&ty=u Index: docweb/www/error.php diff -u docweb/www/error.php:1.7 docweb/www/error.php:1.8 --- docweb/www/error.php:1.7 Fri Sep 24 13:32:19 2004 +++ docweb/www/error.php Fri Oct 29 10:33:04 2004 @@ -1,5 +1,5 @@ <?php -/* $Id: error.php,v 1.7 2004/09/24 17:32:19 sean Exp $ */ +/* $Id: error.php,v 1.8 2004/10/29 14:33:04 vincent Exp $ */ include '../include/init.inc.php'; @@ -10,12 +10,16 @@ <h2><?php echo $title; ?></h2> <p> <?php -if( isset($_SERVER['REDIRECT_ERROR_NOTES']) ) { - echo $_SERVER['REDIRECT_ERROR_NOTES']; -} elseif( isset($_SERVER['REDIRECT_REDIRECT_ERROR_NOTES']) ) { - echo $_SERVER['REDIRECT_REDIRECT_ERROR_NOTES']; +if (isset($_SERVER['REDIRECT_ERROR_NOTES'])) { + echo $_SERVER['REDIRECT_ERROR_NOTES']; +} elseif (isset($_SERVER['REDIRECT_REDIRECT_ERROR_NOTES'])) { + echo $_SERVER['REDIRECT_REDIRECT_ERROR_NOTES']; } else { - echo 'No message available.'; + if ($red_status == 404) { + echo 'File Not Found: ' . htmlspecialchars($_SERVER['REQUEST_URI']); + } else { + echo 'No message available.'; + } }