diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 32034a825..f2ea02380 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -15,6 +15,7 @@ $config->setRules([ 'array_indentation' => true, 'indentation_type' => true, 'line_ending' => true, + 'no_extra_blank_lines' => true, 'no_trailing_whitespace' => true, 'ordered_class_elements' => true, 'single_space_after_construct' => true, diff --git a/cached.php b/cached.php index cc0b9270a..4f731b705 100644 --- a/cached.php +++ b/cached.php @@ -32,7 +32,6 @@ if (isset($_GET["t"])) { $time = filemtime($abs); } - $tsstring = gmdate("D, d M Y H:i:s ", $time) . "GMT"; if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) && ($_SERVER["HTTP_IF_MODIFIED_SINCE"] == $tsstring)) { diff --git a/conferences/index.php b/conferences/index.php index 34ae0ed44..04fe03388 100644 --- a/conferences/index.php +++ b/conferences/index.php @@ -3,7 +3,6 @@ $_SERVER['BASE_PAGE'] = 'conferences/index.php'; include_once __DIR__ . '/../include/prepend.inc'; include_once __DIR__ . '/../include/pregen-news.inc'; - mirror_setcookie("LAST_NEWS", $_SERVER["REQUEST_TIME"], 60*60*24*365); site_header("PHP Conferences around the world", array( 'headtags' => '', @@ -27,7 +26,6 @@ foreach ($NEWS_ENTRIES as $entry) { } $panels = '

Want to see your conference appear here?

'; - foreach ($frontpage as $entry) { $link = preg_replace('~^(http://php.net/|https://www.php.net/)~', '', $entry["id"]); $id = parse_url($entry["id"], PHP_URL_FRAGMENT); diff --git a/error.php b/error.php index 8de0b2d59..f3bb55053 100644 --- a/error.php +++ b/error.php @@ -128,7 +128,6 @@ if (preg_match("!^get/([^/]+)$!", $URI, $what)) { } } - // ============================================================================ // Nice URLs for download files, so wget works completely well with download links if (preg_match("!^get/([^/]+)/from/([^/]+)(/mirror)?$!", $URI, $dlinfo)) { @@ -678,7 +677,6 @@ if (preg_match("!^manual/([^/]+)/([^/]+).php$!", $URI, $match) && } } - // ============================================================================ // 404 page for manual pages (eg. not built language) if (strpos($URI, "manual/") === 0) { diff --git a/images/logo.php b/images/logo.php index 394e4e973..ae4d3585c 100644 --- a/images/logo.php +++ b/images/logo.php @@ -41,7 +41,6 @@ function imgheader($filename) { header("Content-Type: $hdr"); } - function get_accepted_encodings() { if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) { $encodings = explode(',', $_SERVER['HTTP_ACCEPT_ENCODING']); @@ -52,7 +51,6 @@ function get_accepted_encodings() { return array(); } - function serve_compressed_if_available($logo): void { $encodings = get_accepted_encodings(); if (!empty($encodings)) { diff --git a/index.php b/index.php index cd1d1dce9..624862881 100644 --- a/index.php +++ b/index.php @@ -55,7 +55,6 @@ include_once 'include/version.inc'; mirror_setcookie("LAST_NEWS", $_SERVER["REQUEST_TIME"], 60*60*24*365); - $content = "
"; $frontpage = array(); foreach ($NEWS_ENTRIES as $entry) { diff --git a/js/search-index.php b/js/search-index.php index 5c16dd3cc..d0d17a23e 100644 --- a/js/search-index.php +++ b/js/search-index.php @@ -45,8 +45,6 @@ header("Last-Modified: " . $tsstring); header("Content-Type: application/javascript"); /* }}} */ - - $s = file_get_contents($indexfile); $js = json_decode($s, true); @@ -67,5 +65,4 @@ foreach ($js as $k => $item) { } } - echo json_encode($index); diff --git a/manual/spam_challenge.php b/manual/spam_challenge.php index 7466d8d84..dea89dd66 100644 --- a/manual/spam_challenge.php +++ b/manual/spam_challenge.php @@ -47,7 +47,6 @@ function gen_challenge() { return array($c[0], $an, $bn, $c[1]($c[0], $an, $bn)); } - // test an answer for validity function test_answer($name, $an, $bn, $answer) { foreach (CHALLENGES as $x) { diff --git a/manual/vote-note.php b/manual/vote-note.php index 93ddbef62..a05036387 100644 --- a/manual/vote-note.php +++ b/manual/vote-note.php @@ -14,7 +14,6 @@ $BACKid = htmlspecialchars($_REQUEST['id'] ?? ''); $link = "/{$BACKpage}#{$BACKid}"; $master_url = "https://main.php.net/entry/user-notes-vote.php"; - if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (isset($_SERVER['HTTP_X_JSON']) && $_SERVER['HTTP_X_JSON'] == 'On' && !empty($_REQUEST['id']) && !empty($_REQUEST['page']) && ($N = manual_notes_load($_REQUEST['page'])) && array_key_exists($_REQUEST['id'], $N) && !empty($_REQUEST['vote']) && ($_REQUEST['vote'] === 'up' || $_REQUEST['vote'] === 'down')) { $response = array(); diff --git a/quickref.php b/quickref.php index 940165521..cb4c757de 100644 --- a/quickref.php +++ b/quickref.php @@ -113,7 +113,6 @@ site_header("Manual Quick Reference", $head_options+array("current" => "help")); // Note: $notfound is defined (with htmlspecialchars) inside manual-lookup.php $notfound_enc = urlencode($notfound); - if ($snippet = is_known_snippet($notfound)) { echo "

Related snippet found for '{$notfound}'

"; echo "

{$snippet}

"; diff --git a/releases/index.php b/releases/index.php index 897639035..0c928974f 100644 --- a/releases/index.php +++ b/releases/index.php @@ -70,8 +70,6 @@ if (isset($_GET["serialize"]) || isset($_GET["json"])) { return; } - - // Human Readable. site_header("Releases", array( 'current' => 'downloads', diff --git a/search.php b/search.php index 6cb23045a..c7b2dce91 100644 --- a/search.php +++ b/search.php @@ -28,7 +28,6 @@ if (!empty($_FORM['pattern'])) { mirror_redirect("/manual-lookup.php?pattern={$ucp}{$langparam}&scope={$_FORM['show']}"); break; - case "manual": case "404manual": mirror_redirect($MYSITE . "results.php?q={$ucp}&p={$_FORM['show']}&l=$LANG"); diff --git a/security/index.php b/security/index.php index 5f03aa90c..b0a76835f 100644 --- a/security/index.php +++ b/security/index.php @@ -28,7 +28,6 @@ $SIDEBAR_DATA = << EOT; - site_header("PHP Security center"); echo "

PHP Security Center

\n"; diff --git a/src/News/Entry.php b/src/News/Entry.php index 69a66a4a6..c94cb0d9b 100755 --- a/src/News/Entry.php +++ b/src/News/Entry.php @@ -19,7 +19,6 @@ class Entry { public const IMAGE_PATH_REL = 'images/news/'; public const IMAGE_PATH_ABS = self::PHPWEB . self::IMAGE_PATH_REL; - protected $title = ''; protected $categories = []; diff --git a/src/UserNotes/Sorter.php b/src/UserNotes/Sorter.php index e25bfa04b..6d4fa9be6 100644 --- a/src/UserNotes/Sorter.php +++ b/src/UserNotes/Sorter.php @@ -36,12 +36,10 @@ class Sorter { uasort($notes, array($this, 'factorSort')); } - private function calcVotePriority(array $note) { return ($note['score'] - $this->minVote) * $this->voteFactor + .3; } - private function calcRatingPriority(array $note) { if ($note['total'] <= 2) { return 0.5; @@ -50,7 +48,6 @@ class Sorter { return $note['rating']; } - private function calcSortPriority(array &$notes) { foreach ($notes as &$note) { $prio = array( @@ -62,7 +59,6 @@ class Sorter { } } - /* * Not sure why, but using `$b['sort'] - $a['sort']` does not seem to * work properly. @@ -79,7 +75,6 @@ class Sorter { return -1; } - private function findMinMaxValues(array &$notes) { $count = count($notes); if ($count <= 0) {