Skip to content

Commit

Permalink
Swap uses of _SERVER[DOCUMENT_ROOT] for __DIR__
Browse files Browse the repository at this point in the history
1/n - Update / and /include/ only.
  • Loading branch information
sgolemon committed May 31, 2019
1 parent 99d7ea1 commit 2735e5f
Show file tree
Hide file tree
Showing 53 changed files with 97 additions and 97 deletions.
4 changes: 2 additions & 2 deletions ChangeLog-4.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$_SERVER['BASE_PAGE'] = 'ChangeLog-4.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/changelogs.inc';
include_once __DIR__ . '/include/prepend.inc';
include_once __DIR__ . '/include/changelogs.inc';
site_header("PHP 4 ChangeLog", array("current" => "docs", "css" => array("changelog.css"), "layout_span" => 12));
?>

Expand Down
4 changes: 2 additions & 2 deletions ChangeLog-5.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$_SERVER['BASE_PAGE'] = 'ChangeLog-5.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/changelogs.inc';
include_once __DIR__ . '/include/prepend.inc';
include_once __DIR__ . '/include/changelogs.inc';
site_header("PHP 5 ChangeLog", array("current" => "docs", "css" => array("changelog.css"), "layout_span" => 12));
?>

Expand Down
4 changes: 2 additions & 2 deletions ChangeLog-7.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$_SERVER['BASE_PAGE'] = 'ChangeLog-7.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/changelogs.inc';
include_once __DIR__ . '/include/prepend.inc';
include_once __DIR__ . '/include/changelogs.inc';
site_header("PHP 7 ChangeLog", array("current" => "docs", "css" => array("changelog.css"), "layout_span" => 12));
?>
<h1>PHP 7 ChangeLog</h1>
Expand Down
2 changes: 1 addition & 1 deletion build-setup.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$_SERVER['BASE_PAGE'] = 'get-involved.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once __DIR__ . '/include/prepend.inc';

$SIDEBAR_DATA ='
<div class="panel">
Expand Down
2 changes: 1 addition & 1 deletion cal.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$_SERVER['BASE_PAGE'] = 'cal.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once __DIR__ . '/include/prepend.inc';

$site_header_config = array(
"current" => "community",
Expand Down
2 changes: 1 addition & 1 deletion contact.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$_SERVER['BASE_PAGE'] = 'contact.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once __DIR__ . '/include/prepend.inc';
site_header("Contact", array("current" => "community"));
?>

Expand Down
2 changes: 1 addition & 1 deletion copyright.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$_SERVER['BASE_PAGE'] = 'copyright.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once __DIR__ . '/include/prepend.inc';
$SIDEBAR_DATA = '
<a name="license"></a>
<h3>PHP License</h3>
Expand Down
2 changes: 1 addition & 1 deletion credits.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$_SERVER['BASE_PAGE'] = 'credits.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once __DIR__ . '/include/prepend.inc';

// Put credits information to $credits
ob_start();
Expand Down
2 changes: 1 addition & 1 deletion docs.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$_SERVER['BASE_PAGE'] = 'docs.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once __DIR__ . '/include/prepend.inc';

site_header("Documentation", array("current" => "docs"));

Expand Down
2 changes: 1 addition & 1 deletion download-docs.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$_SERVER['BASE_PAGE'] = 'download-docs.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once __DIR__ . '/include/prepend.inc';

if (!empty($_GET['active_langs'])) {
echo serialize($ACTIVE_ONLINE_LANGUAGES);
Expand Down
2 changes: 1 addition & 1 deletion download-logos.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$_SERVER['BASE_PAGE'] = 'download-logos.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once __DIR__ . '/include/prepend.inc';
$SIDEBAR_DATA = '
<h3>More PHP artwork</h3>
<p>
Expand Down
6 changes: 3 additions & 3 deletions downloads.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php // vim: et
$_SERVER['BASE_PAGE'] = 'downloads.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/gpg-keys.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/version.inc';
include_once __DIR__ . '/include/prepend.inc';
include_once __DIR__ . '/include/gpg-keys.inc';
include_once __DIR__ . '/include/version.inc';

// Try to make this page non-cached
header_nocache();
Expand Down
2 changes: 1 addition & 1 deletion elephpant.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$_SERVER['BASE_PAGE'] = 'elephpant.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once __DIR__ . '/include/prepend.inc';
$SIDEBAR_DATA = '
<a name="license"></a>
<h3>PHP License</h3>
Expand Down
4 changes: 2 additions & 2 deletions eol.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
$_SERVER['BASE_PAGE'] = 'eol.php';

include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/branches.inc';
include_once __DIR__ . '/include/prepend.inc';
include_once __DIR__ . '/include/branches.inc';

// Notes for specific branches can be added here, and will appear in the table.
$BRANCH_NOTES = array(
Expand Down
24 changes: 12 additions & 12 deletions error.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
*/

// Ensure that our environment is set up
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/languages.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/loadavg.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/errors.inc';
include_once __DIR__ . '/include/prepend.inc';
include_once __DIR__ . '/include/languages.inc';
include_once __DIR__ . '/include/loadavg.inc';
include_once __DIR__ . '/include/errors.inc';

// Get URI for this request, strip leading slash
// See langchooser.inc for more info on STRIPPED_URI
Expand All @@ -24,13 +24,13 @@
// dependent, so the search results will show up in the sidebar)
if ($URI == 'phpnetsearch.src') {
status_header(200);
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/mozsearch.inc';
include_once __DIR__ . '/include/mozsearch.inc';
exit;
}
// FIXME: Nuke the old firefox search plugin
if ($URI == 'phpnetimprovedsearch.src') {
status_header(200);
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/mozopensearch.inc';
include_once __DIR__ . '/include/mozopensearch.inc';
exit;
}

Expand All @@ -45,7 +45,7 @@
if (preg_match("!^security/advisories/PHPSA-(\\d+)\\.php$!", $URI, $array)) {
status_header(200);
$_GET["id"] = $array[1];
include_once $_SERVER['DOCUMENT_ROOT'] . '/security/index.php';
include_once __DIR__ . '/security/index.php';
exit;
}

Expand Down Expand Up @@ -112,7 +112,7 @@
// send them to the /releases page since that is likely to be most helpful.
if (preg_match("!^distributions/.*!", $URI, $array)) {
status_header(404);
include_once $_SERVER['DOCUMENT_ROOT'] . "/releases/index.php";
include_once __DIR__ . "/releases/index.php";
}

// ============================================================================
Expand All @@ -136,7 +136,7 @@

$df = $dlinfo[1];
if(strpos($df, "7-LATEST") !== false) {
include_once $_SERVER['DOCUMENT_ROOT'] . "/include/version.inc";
include_once __DIR__ . "/include/version.inc";
$df = str_replace("7-LATEST", $PHP_7_VERSION, $df);
}

Expand Down Expand Up @@ -596,17 +596,17 @@
// will be capable of being included from anywhere
if ($URI=='mirror-info') {
status_header(200);
include_once $_SERVER['DOCUMENT_ROOT'] . "/$URI.php";
include_once __DIR__ . "/$URI.php";
exit;
}

// ============================================================================
// Try to find the page using the preferred language as a manual page
include_once $_SERVER['DOCUMENT_ROOT'] . "/include/manual-lookup.inc";
include_once __DIR__ . "/include/manual-lookup.inc";
$try = find_manual_page($LANG, $URI);
if ($try) {
status_header(200);
include_once $_SERVER['DOCUMENT_ROOT'] . $try;
include_once __DIR__ . $try;
exit;
}
// BC. The class methods are now classname.methodname
Expand Down
2 changes: 1 addition & 1 deletion get-involved.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$_SERVER['BASE_PAGE'] = 'get-involved.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once __DIR__ . '/include/prepend.inc';

site_header("Get Involved", array("current" => "community"));
?>
Expand Down
6 changes: 3 additions & 3 deletions git-php.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
$_SERVER['BASE_PAGE'] = 'git-php.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/email-validation.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/posttohost.inc';
include_once __DIR__ . '/include/prepend.inc';
include_once __DIR__ . '/include/email-validation.inc';
include_once __DIR__ . '/include/posttohost.inc';

// Force the account requests to php.net
if (!is_primary_site()) {
Expand Down
2 changes: 1 addition & 1 deletion git.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$_SERVER['BASE_PAGE'] = 'git.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once __DIR__ . '/include/prepend.inc';
$SIDEBAR_DATA = '
<h3>What is Git?</h3>
<p>
Expand Down
6 changes: 3 additions & 3 deletions gpg-keys.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php // vim: et
$_SERVER['BASE_PAGE'] = 'gpg-keys.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/gpg-keys.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/version.inc';
include_once __DIR__ . '/include/prepend.inc';
include_once __DIR__ . '/include/gpg-keys.inc';
include_once __DIR__ . '/include/version.inc';

site_header('GPG Keys');
?>
Expand Down
4 changes: 2 additions & 2 deletions include/branches.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/releases.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/version.inc';
include_once __DIR__ . '/releases.inc';
include_once __DIR__ . '/version.inc';

/* Branch overrides. For situations where we've changed the exact dates for a
* branch's active support and security fix EOLs, these can be reflected here.
Expand Down
4 changes: 2 additions & 2 deletions include/index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
// Simulate a /include shortcut call (which will lead to a manual page)
$_SERVER['REQUEST_URI'] = '/include';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/error.php';
include_once __DIR__ . '/prepend.inc';
include_once __DIR__ . '/../error.php';
2 changes: 1 addition & 1 deletion include/ip-to-country.inc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function i2c_search_in_index($ip)

// Open the index file for reading
$dbidx = fopen(
$_SERVER['DOCUMENT_ROOT'] . "/backend/ip-to-country.idx",
__DIR__ . "/../backend/ip-to-country.idx",
"r"
);
if (!$dbidx) { return FALSE; }
Expand Down
2 changes: 1 addition & 1 deletion include/manual-lookup.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php // -*- C++ -*-

// We need this for error reporting
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/errors.inc';
include_once __DIR__ . '/errors.inc';

// Try to find some variations of keyword with $prefix in the $lang manual
function tryprefix($lang, $keyword, $prefix)
Expand Down
10 changes: 5 additions & 5 deletions include/prepend.inc
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,21 @@ if (get_magic_quotes_runtime()) {
}

// Site details (mirror site information)
include $_SERVER['DOCUMENT_ROOT'] . '/include/site.inc';
include __DIR__ . '/site.inc';

// Choose language used for translated parts
include $_SERVER['DOCUMENT_ROOT'] . '/include/langchooser.inc';
include __DIR__ . '/langchooser.inc';

// Get country of the user and set it in a cookie
include $_SERVER['DOCUMENT_ROOT'] . '/include/ip-to-country.inc';
include __DIR__ . '/ip-to-country.inc';

// Common layout functions
include $_SERVER['DOCUMENT_ROOT'] . '/include/layout.inc';
include __DIR__ . '/layout.inc';

// This file is generated on rsync.php.net and propagated
// from there. It just defines $LAST_UPDATED, which is the
// mirror's last updated time.
include $_SERVER['DOCUMENT_ROOT'] . '/include/last_updated.inc';
include __DIR__ . '/last_updated.inc';

// -----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion include/shared-manual.inc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/

// Ensure that our environment is set up
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once __DIR__ . '/prepend.inc';

// Set variable defaults
$PGI = array(); $SIDEBAR_DATA = '';
Expand Down
2 changes: 1 addition & 1 deletion include/shared-stat.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php // -*- C++ -*-
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once __DIR__ . '/prepend.inc';

function commonStatHeader($title) {
site_header($title);
Expand Down
8 changes: 4 additions & 4 deletions include/site.inc
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ $MIRRORS = array(
);

// Define $COUNTRIES array
include $_SERVER['DOCUMENT_ROOT'] . '/include/countries.inc';
include __DIR__ . '/countries.inc';

// Define $COUNTRIES_ALPHA2 array
include $_SERVER['DOCUMENT_ROOT'] . '/include/countries-alpha2.inc';
include __DIR__ . '/countries-alpha2.inc';

// Define $COUNTRY_ALPHA_2_TO_3 array
include $_SERVER['DOCUMENT_ROOT'] . '/include/countries_alpha_mapping.inc';
include __DIR__ . '/countries_alpha_mapping.inc';

// Define $LANGUAGES array
include $_SERVER['DOCUMENT_ROOT'] . '/include/languages.inc';
include __DIR__ . '/languages.inc';

// Returns true if the current (or specified)
// site is the primary mirror site
Expand Down
6 changes: 3 additions & 3 deletions mailing-lists.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
$_SERVER['BASE_PAGE'] = 'mailing-lists.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/posttohost.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/email-validation.inc';
include_once __DIR__ . '/include/prepend.inc';
include_once __DIR__ . '/include/posttohost.inc';
include_once __DIR__ . '/include/email-validation.inc';

$SIDEBAR_DATA = '
<h3>Would like to unsubscribe yourself?</h3>
Expand Down
8 changes: 4 additions & 4 deletions manual-lookup.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
$_SERVER['BASE_PAGE'] = 'manual-lookup.php';
include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include $_SERVER['DOCUMENT_ROOT'] . '/include/loadavg.inc';
include $_SERVER['DOCUMENT_ROOT'] . '/include/manual-lookup.inc';
include __DIR__ . '/include/prepend.inc';
include __DIR__ . '/include/loadavg.inc';
include __DIR__ . '/include/manual-lookup.inc';

// BC code, so pattern and function can both be used as
// parameters to specify the function name
Expand Down Expand Up @@ -35,6 +35,6 @@

// Fall back to a quick reference search
$notfound = $function;
include $_SERVER['DOCUMENT_ROOT'] . '/quickref.php';
include __DIR__ . '/quickref.php';

?>
4 changes: 2 additions & 2 deletions mirror-info.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
// Define $MYSITE and $LAST_UPDATED variables
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once __DIR__ . '/include/prepend.inc';

// Define $PHP_7_3_VERSION, $PHP_7_3_SHA256 & $RELEASES variables
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/version.inc';
include_once __DIR__ . '/include/version.inc';

// Text/plain content type for better readability in browsers
header("Content-type: text/plain; charset=utf-8");
Expand Down
2 changes: 1 addition & 1 deletion mirror-stats.conf
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ PageType php

#HTMLPre <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

HTMLPre <?php $_SERVER['BASE_PAGE'] = 'stats/index.php'; include_once $_SERVER['DOCUMENT_ROOT'] . "/include/prepend.inc"; ?>
HTMLPre <?php $_SERVER['BASE_PAGE'] = 'stats/index.php'; include_once __DIR__ . "/include/prepend.inc"; ?>

# HTMLHead defines HTML code to insert within the <HEAD></HEAD>
# block, immediately after the <TITLE> line. Maximum line length
Expand Down
Loading

0 comments on commit 2735e5f

Please sign in to comment.