mirror of
https://github.com/php/web-doc.git
synced 2025-08-13 14:40:31 +00:00
split init from libraries
This commit is contained in:
60
include/init.inc.php
Normal file
60
include/init.inc.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Documentation Tools Site Source Code |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2004 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.0 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available through the world-wide-web at the following url: |
|
||||
| http://www.php.net/license/3_0.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Yannick Torres <yannick@php.net> |
|
||||
| Mehdi Achour <didou@php.net> |
|
||||
| Gabor Hojtsy <goba@php.net> |
|
||||
| Sean Coates <sean@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
$Id$
|
||||
*/
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
define('PATH_ROOT', realpath(dirname(__FILE__) . '/../'));
|
||||
define('SQLITE_DIR', PATH_ROOT . '/sqlite/');
|
||||
define('CVS_DIR', PATH_ROOT . '/cvs/');
|
||||
|
||||
// project & language config
|
||||
require_once('lib_proj_lang.inc.php');
|
||||
|
||||
// get defaults
|
||||
list($defaultProject) = array_keys($PROJECTS);
|
||||
list($defaultLanguage) = array_keys($LANGUAGES);
|
||||
|
||||
// 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);
|
||||
|
||||
// actually define the constant (trim off any trailing slashes):
|
||||
define('BASE_URL', rtrim($baseURL, '/'));
|
||||
|
||||
require_once('lib_general.inc.php');
|
||||
|
||||
?>
|
@ -21,40 +21,6 @@
|
||||
$Id$
|
||||
*/
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
define('PATH_ROOT', realpath(dirname(__FILE__) . '/../'));
|
||||
define('SQLITE_DIR', PATH_ROOT . '/sqlite/');
|
||||
define('CVS_DIR', PATH_ROOT . '/cvs/');
|
||||
|
||||
// project & language config
|
||||
require_once('lib_proj_lang.inc.php');
|
||||
|
||||
// get defaults
|
||||
list($defaultProject) = array_keys($PROJECTS);
|
||||
list($defaultLanguage) = array_keys($LANGUAGES);
|
||||
|
||||
// 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);
|
||||
|
||||
// actually define the constant (trim off any trailing slashes):
|
||||
define('BASE_URL', rtrim($baseURL, '/'));
|
||||
|
||||
function is_translation($project, $language)
|
||||
{
|
||||
return is_dir(CVS_DIR . $GLOBALS['PROJECTS'][$project] . '/' . $language);
|
||||
@ -88,7 +54,7 @@ function site_header($title = '', $style = array())
|
||||
$project = (in_array(SITE, array('www', 'livedocs')) ? 'php' : SITE);
|
||||
$locallinks = site_nav_provider();
|
||||
$extlinks = ext_nav_provider();
|
||||
|
||||
|
||||
$extra_style = '';
|
||||
// prevent errors
|
||||
$guess_style = (in_array(SITE, array('www', 'livedocs', 'pecl')) ? '' : SITE . '.css');
|
||||
@ -96,7 +62,7 @@ function site_header($title = '', $style = array())
|
||||
foreach ($styles as $style_file) {
|
||||
if (!empty($style_file)) {
|
||||
$extra_style .= '@import url(/style/'. $style_file .");\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set proper encoding with HTTP header first
|
||||
@ -114,7 +80,7 @@ function site_header($title = '', $style = array())
|
||||
<link rel="shortcut icon" href="/images/favicon/{$project}/favicon.ico" />
|
||||
<style type="text/css">@import url(/style/site.css);
|
||||
$extra_style</style>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="header">
|
||||
@ -208,8 +174,8 @@ function get_comment($idx, $section, $doc, $file)
|
||||
section=\'' . $section . '\' AND
|
||||
file=\'' . $file . '\' AND
|
||||
doc=\'' . $doc . '\'
|
||||
|
||||
ORDER BY
|
||||
|
||||
ORDER BY
|
||||
date DESC';
|
||||
$result = @sqlite_query($idx, $sql);
|
||||
|
||||
@ -252,7 +218,7 @@ function get_insite_address($project = NULL, $lang = NULL, $path = NULL)
|
||||
if (!isset($project)) { $project = SITE; }
|
||||
if (!isset($lang)) { $lang = LANGC; }
|
||||
if (!isset($path)) { $path = URI; }
|
||||
|
||||
|
||||
$ret = '/';
|
||||
if ($project != $GLOBALS['defaultProject']) {
|
||||
$ret .= "$project/";
|
||||
|
@ -32,7 +32,7 @@ $path = realpath(dirname(__FILE__));
|
||||
require_once 'DB.php';
|
||||
require_once 'DB/storage.php';
|
||||
require_once $path . '/rfc-config.php';
|
||||
require_once $path . '/../../include/lib_general.inc.php';
|
||||
require_once $path . '/../../include/init.inc.php';
|
||||
|
||||
define('PEAR_DATABASE_DSN', 'sqlite:///'.$path.'/../../sqlite/rfc.sqlite');
|
||||
|
||||
|
@ -3,7 +3,7 @@ include '../include/jpgraph/jpgraph.php';
|
||||
include '../include/jpgraph/jpgraph_pie.php';
|
||||
include '../include/jpgraph/jpgraph_pie3d.php';
|
||||
|
||||
include '../include/lib_general.inc.php';
|
||||
include '../include/init.inc.php';
|
||||
include '../include/lib_revcheck.inc.php';
|
||||
|
||||
$plop = array_shift($argv);
|
||||
|
@ -2,7 +2,7 @@
|
||||
include '../include/jpgraph/jpgraph.php';
|
||||
include '../include/jpgraph/jpgraph_bar.php';
|
||||
|
||||
include '../include/lib_general.inc.php';
|
||||
include '../include/init.inc.php';
|
||||
include '../include/lib_revcheck.inc.php';
|
||||
|
||||
|
||||
|
@ -65,7 +65,7 @@ exit(0);
|
||||
**/
|
||||
|
||||
// define some common variables
|
||||
include '../include/lib_general.inc.php';
|
||||
include '../include/init.inc.php';
|
||||
|
||||
// grab the documentation type
|
||||
$TYPE = array_shift($argv);
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
// TODO: list of all project mailing lists somewhere (not here!)
|
||||
include_once '../include/lib_general.inc.php';
|
||||
include_once '../include/init.inc.php';
|
||||
echo site_header('Contact');
|
||||
?>
|
||||
<p>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
include_once '../include/lib_general.inc.php';
|
||||
include_once '../include/init.inc.php';
|
||||
echo site_header('Copyright');
|
||||
?>
|
||||
<h2>Source Code Copyright</h2>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
include '../include/lib_general.inc.php';
|
||||
include '../include/init.inc.php';
|
||||
echo site_header('Website credits');
|
||||
?>
|
||||
<p>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
include '../include/lib_general.inc.php';
|
||||
include '../include/init.inc.php';
|
||||
|
||||
$red_status = isset($_SERVER["REDIRECT_STATUS"]) ? $_SERVER["REDIRECT_STATUS"] : '';
|
||||
$title = 'Apache :: Error ' . $red_status;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
include_once '../include/lib_general.inc.php';
|
||||
include_once '../include/init.inc.php';
|
||||
echo site_header('Welcome!');
|
||||
?>
|
||||
<h2>What is this site?</h2>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
include '../include/lib_general.inc.php';
|
||||
include '../include/init.inc.php';
|
||||
include '../include/lib_revcheck.inc.php';
|
||||
|
||||
$LANG = LANGC;
|
||||
|
Reference in New Issue
Block a user