diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 1810d5c069..11b9cf5885 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -54,6 +54,7 @@ 'constructs_preceded_by_a_single_space' => [], 'constructs_followed_by_a_single_space' => [], ], + 'statement_indentation' => true, 'strict_param' => true, 'switch_case_space' => true, 'ternary_operator_spaces' => true, diff --git a/cal.php b/cal.php index 68b5ca1331..46d1e5a765 100644 --- a/cal.php +++ b/cal.php @@ -93,8 +93,8 @@ $date = mktime(0, 0, 1, $cm, 1, $cy); if (!$begun) { - site_header("Events: " . date("F Y", $date), $site_header_config); -?> + site_header("Events: " . date("F Y", $date), $site_header_config); + ?>

If you would like to suggest an upcoming event to be listed on this @@ -139,10 +139,10 @@ $month = date('m', $lm); $monthName = date('F', $lm); return sprintf('%s, %s', - urlencode($month), - urlencode($year), - htmlentities($monthName), - htmlentities($year)); + urlencode($month), + urlencode($year), + htmlentities($monthName), + htmlentities($year)); })(); // Link to next month (but do not link to too early dates) @@ -156,21 +156,21 @@ $month = date('m', $nm); $monthName = date('F', $nm); return sprintf('%s, %s', - urlencode($month), - urlencode($year), - htmlentities($monthName), - htmlentities($year)); + urlencode($month), + urlencode($year), + htmlentities($monthName), + htmlentities($year)); })(); // Print out navigation links for previous and next month echo '
', - "\n", '', - '', - '\n
', $prev_link, '', htmlentities(date('F, Y', $bom)), '', $next_link, "
\n"; +"\n", '', $prev_link, '', +'', htmlentities(date('F, Y', $bom)), '', +'', $next_link, "\n\n"; // Begin the calendar table echo '', - "\n",'',"\n"; +"\n",'',"\n"; // Print out headers for weekdays for ($i = 0; $i < 7; $i++) { @@ -188,7 +188,7 @@ // Print out day number and all events for the day echo ''; @@ -241,13 +241,13 @@ function display_events_for_day($day, $events): void if (($event['type'] == 2 && $event['start'] <= $day && $event['end'] >= $day) || ($event['start'] == $day)) { echo '
', - ($COUNTRY == $event['country'] ? "" : ""), - '', - stripslashes(htmlentities($event['sdesc'], ENT_QUOTES | ENT_IGNORE, 'UTF-8')), - '', - ($COUNTRY == $event['country'] ? "" : ""), - '
'; + ($COUNTRY == $event['country'] ? "" : ""), + '', + stripslashes(htmlentities($event['sdesc'], ENT_QUOTES | ENT_IGNORE, 'UTF-8')), + '', + ($COUNTRY == $event['country'] ? "" : ""), + ''; } } } @@ -262,14 +262,14 @@ function load_event($id) // Read as we can, event by event while (!feof($fp)) { - $event = read_event($fp); + $event = read_event($fp); - // Return with the event, if it's ID is the one - // we search for (also close the file) - if ($event !== false && $event['id'] == $id) { - fclose($fp); - return $event; - } + // Return with the event, if it's ID is the one + // we search for (also close the file) + if ($event !== false && $event['id'] == $id) { + fclose($fp); + return $event; + } } // Close file, and return sign of failure @@ -311,25 +311,25 @@ function load_events($from, $whole_month = false) // Check if event is in our scope, depending on type switch ($event['type']) { - // Recurring event + // Recurring event case 3: $date = date_for_recur($event['recur'], $event['recur_day'], $bom, $eom); $event['start'] = date("Y-m-d", $date); // Fall through. Now it is just like a single-day event - // Single-day event + // Single-day event case 1: if ($event['start'] >= $from_date && $event['start'] <= $to_date) { $events[] = $event; } break; - // Multi-day event + // Multi-day event case 2: if (($event['start'] >= $from_date && $event['start'] <= $to_date) || ($event['end'] >= $from_date && $event['end'] <= $to_date) || ($event['start'] <= $from_date && $event['end'] >= $to_date)) { - $events[] = $event; + $events[] = $event; } break; } diff --git a/download-docs.php b/download-docs.php index 0d31fd10fa..6fee95fc42 100644 --- a/download-docs.php +++ b/download-docs.php @@ -92,7 +92,7 @@ // Go through all possible manual languages foreach ($LANGUAGES as $langcode => $language) { if (isset($INACTIVE_ONLINE_LANGUAGES[$langcode]) && $MYSITE !== 'http://docs.php.net/') { - continue; + continue; } // Go through all possible manual formats diff --git a/downloads.php b/downloads.php index eaf7452d24..c810f55c32 100644 --- a/downloads.php +++ b/downloads.php @@ -40,8 +40,8 @@ ); ?> $major_releases): /* major releases loop start */ - $releases = array_slice($major_releases, 0, $SHOW_COUNT); -?> + $releases = array_slice($major_releases, 0, $SHOW_COUNT); + ?> $a): ?> @@ -60,9 +60,9 @@ ', $rel['md5'], ''; - if (isset($rel['sha256'])) echo '', $rel['sha256'], ''; - ?> + if (isset($rel['md5'])) echo '', $rel['md5'], ''; + if (isset($rel['sha256'])) echo '', $rel['sha256'], ''; + ?>

Note: diff --git a/git-php.php b/git-php.php index bf6a980658..32803b60e4 100644 --- a/git-php.php +++ b/git-php.php @@ -99,7 +99,7 @@ echo "

$error

"; } else { -?> + ?>

Thank you. Your request has been sent. You should hear something within the next week or so. If you haven't heard anything by around @@ -152,7 +152,7 @@

EOT; } -?> + ?>

@@ -399,8 +399,8 @@ class="max" value=" $name) { - $selected = (isset($_POST["group"]) && $_POST["group"] == $group) ? ' selected="selected"' : ''; - echo "\n"; + $selected = (isset($_POST["group"]) && $_POST["group"] == $group) ? ' selected="selected"' : ''; + echo "\n"; } ?> diff --git a/images/supported-versions.php b/images/supported-versions.php index 76b8147f20..6822f575ba 100644 --- a/images/supported-versions.php +++ b/images/supported-versions.php @@ -135,9 +135,9 @@ function date_horiz_coord(DateTime $date) { $version): ?> + $x_bug = date_horiz_coord(get_branch_bug_eol_date($branch)); + $x_eol = date_horiz_coord(get_branch_security_eol_date($branch)); + ?> @@ -157,8 +157,8 @@ function date_horiz_coord(DateTime $date) { +$x = date_horiz_coord($now); +?> format('j M Y') ?> diff --git a/include/branches.inc b/include/branches.inc index 0cd6b6480c..86c653c6c6 100644 --- a/include/branches.inc +++ b/include/branches.inc @@ -52,7 +52,7 @@ function format_interval($from, DateTime $to) { if ($diff->y) { $times[] = [$diff->y, 'year']; if ($diff->m) { - $times[] = [$diff->m, 'month']; + $times[] = [$diff->m, 'month']; } } elseif ($diff->m) { $times[] = [$diff->m, 'month']; @@ -63,14 +63,14 @@ function format_interval($from, DateTime $to) { } if ($times) { $eolPeriod = implode(', ', - array_map( - function ($t) { - return "$t[0] $t[1]" . - ($t[0] != 1 ? 's' : ''); - }, - $times, - ), - ); + array_map( + function ($t) { + return "$t[0] $t[1]" . + ($t[0] != 1 ? 's' : ''); + }, + $times, + ), + ); if ($diff->invert) { $eolPeriod = "$eolPeriod ago"; diff --git a/include/footer.inc b/include/footer.inc index 6386a9aa24..6ef4f40c08 100644 --- a/include/footer.inc +++ b/include/footer.inc @@ -22,7 +22,7 @@ + ?>

  • @@ -88,11 +88,11 @@ ' . "\n"; - } -?> + foreach ($jsfiles as $filename) { + $path = dirname(__DIR__) . '/js/' . $filename; + echo '' . "\n"; + } + ?> To Top diff --git a/include/get-download.inc b/include/get-download.inc index 2aeb1aa896..5c1f06b255 100644 --- a/include/get-download.inc +++ b/include/get-download.inc @@ -31,7 +31,7 @@ echo '
    '; $size = 0; // No downloadable file found if ($file === false) { - $info = "

    + $info = "

    The file you requested (" . htmlspecialchars($df, ENT_QUOTES, "UTF-8") . ") is not found on this server ({$MYSITE}).

    "; diff --git a/include/header.inc b/include/header.inc index 26a13846f0..93cb17a732 100644 --- a/include/header.inc +++ b/include/header.inc @@ -148,13 +148,13 @@ if (!isset($config["languages"])) {
    diff --git a/include/ip-to-country.inc b/include/ip-to-country.inc index b348a00991..dd617e348f 100644 --- a/include/ip-to-country.inc +++ b/include/ip-to-country.inc @@ -52,8 +52,8 @@ function i2c_go() // User already has a country detected with this IP stored if (!empty($_COOKIE['COUNTRY']) && strpos($_COOKIE['COUNTRY'], ',') !== false) { - list($COUNTRY, $storedip) = explode(",", $_COOKIE['COUNTRY']); - if ($storedip == $ipnum) { return true; } + list($COUNTRY, $storedip) = explode(",", $_COOKIE['COUNTRY']); + if ($storedip == $ipnum) { return true; } } // Convert the IP number to some useable form for searching diff --git a/include/langchooser.inc b/include/langchooser.inc index f86ef8e83f..df38c597ee 100644 --- a/include/langchooser.inc +++ b/include/langchooser.inc @@ -157,14 +157,14 @@ function language_choose_code() // As most of the language dependant operations involve manual // page display (lookup, search, shortcuts), we will check for // the index file of manuals. -/* - foreach ($languages as $language) { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/manual/$language/index.php")) { - $selected = $language; - break; + /* + foreach ($languages as $language) { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/manual/$language/index.php")) { + $selected = $language; + break; + } } - } -*/ + */ $selected = $languages[0]; // Return with all found data diff --git a/include/layout.inc b/include/layout.inc index 73f9e20ecf..22c751d1f1 100644 --- a/include/layout.inc +++ b/include/layout.inc @@ -70,7 +70,7 @@ function resize_image($img, $width = 1, $height = 1) // Return an tag for a given image file available on the server function make_image($file, $alt = false, $align = false, $extras = false, - $dir = '/images', $addsize = true) + $dir = '/images', $addsize = true) { // If no / was provided at the start of $dir, add it $webdir = $_SERVER['MYSITE'] . ($dir[0] == '/' ? '' : '/') . $dir; @@ -105,7 +105,7 @@ function make_image($file, $alt = false, $align = false, $extras = false, // Print an tag out for a given file function print_image($file, $alt = false, $align = false, $extras = false, - $dir = '/images'): void + $dir = '/images'): void { echo make_image($file, $alt, $align, $extras, $dir); } @@ -123,7 +123,7 @@ function news_image($URL, $image, $alt, $print = true) // Return HTML code for a submit button image function make_submit($file, $alt = false, $align = false, $extras = false, - $dir = '/images', $border = 0) + $dir = '/images', $border = 0) { // Get an image without size info and convert the // border attribute to use CSS, as border="" is not @@ -154,7 +154,7 @@ function make_popup_link($url, $linktext = false, $target = false, $windowprops ($target ?: "_new"), htmlspecialchars($url, ENT_QUOTES | ENT_IGNORE), ($target ?: "_new"), - $windowprops, + $windowprops, ($extras ? ' ' . $extras : ''), ($linktext ?: $url), ); @@ -219,7 +219,7 @@ function sect_to_file($string) { } function clean($var) { - return htmlspecialchars($var, ENT_QUOTES); + return htmlspecialchars($var, ENT_QUOTES); } // Clean out the content of one user note for printing to HTML @@ -289,20 +289,20 @@ function display_event($event, $include_date = 1): void } else { $eday = (isset($event['end']) && !empty($event['end'])) ? strtotime($event['end']) : 0; } -?> + ?>
    ',$i,''; + '">',$i,''; display_events_for_day(date("Y-m-",$bom) . sprintf("%02d",$i), $events); echo '
    ", date("F j, Y", $sday), "\n"; - } + // Print out date if needed + if ($include_date && (isset($event['start']))) { + echo "", date("F j, Y", $sday), "\n"; + } - // Print link in case we have one - if ($event['url']) { echo ''; } - // Print event description - echo "", stripslashes(htmlentities($event['sdesc'], ENT_QUOTES | ENT_IGNORE, 'UTF-8')), ""; + // Print link in case we have one + if ($event['url']) { echo ''; } + // Print event description + echo "", stripslashes(htmlentities($event['sdesc'], ENT_QUOTES | ENT_IGNORE, 'UTF-8')), ""; // End link if ($event['url']) { echo ""; } @@ -334,20 +334,20 @@ function display_event($event, $include_date = 1): void // Print out country information echo ' (' , $COUNTRIES[$event['country']] , ')'; -?> + ?>

    ", trim(htmlentities($event['ldesc'],ENT_QUOTES | ENT_IGNORE, 'UTF-8'))); + // Print long description + echo preg_replace("/\r?\n\r?\n/", "

    ", trim(htmlentities($event['ldesc'],ENT_QUOTES | ENT_IGNORE, 'UTF-8'))); // If we have an URL, print it out if ($event['url']) { echo '

    URL: ', - '', - htmlentities($event['url'], ENT_QUOTES | ENT_IGNORE, 'UTF-8'), ''; + '', + htmlentities($event['url'], ENT_QUOTES | ENT_IGNORE, 'UTF-8'), ''; } -?> + ?>
    prepare($SQL); if (!$stm) { - return find_manual_page_slow($lang, $keyword); + return find_manual_page_slow($lang, $keyword); } $stm->execute([$lang, "/manual/{$lang}/{$_keyword}", $keyword]); diff --git a/include/prepend.inc b/include/prepend.inc index 338982710d..365f6210ee 100644 --- a/include/prepend.inc +++ b/include/prepend.inc @@ -184,7 +184,7 @@ function myphpnet_save(): void } function google_cse(): void { -?> + ?>

    Results Page:

    '; + printf('
  • %d
  • ', $class, urlencode($q), $start, $profile, urlencode($l), $z); + $start += $per_page; + } + echo ''; endif; } diff --git a/include/site.inc b/include/site.inc index dd147e22f8..500b463c71 100644 --- a/include/site.inc +++ b/include/site.inc @@ -76,11 +76,11 @@ function mirror_provider($site = false) if (!$site) { $site = $MYSITE; } if (isset($MIRRORS[$site])) { - return $MIRRORS[$site][1]; + return $MIRRORS[$site][1]; } if (isset($MIRRORS[$_SERVER['SERVER_ADDR']])) { - return $MIRRORS[$_SERVER['SERVER_ADDR']][1]; + return $MIRRORS[$_SERVER['SERVER_ADDR']][1]; } return false; diff --git a/mailing-lists.php b/mailing-lists.php index 9ecb0522cc..b6ade39d97 100644 --- a/mailing-lists.php +++ b/mailing-lists.php @@ -93,7 +93,7 @@ if (!empty($error)) { echo "

    $error

    "; } else { -?> + ?>

    A request has been entered into the mailing list processing queue. You should receive an email at shortly describing @@ -237,71 +237,71 @@ ]; - // array of lists (list, name, short desc., moderated, archive, digest, newsgroup) - $internals_mailing_lists = [ - - 'PHP and Zend Engine internals lists', - [ - 'internals', 'Internals list', - 'A medium volume list for those who want to help out with the development of PHP', - false, 'php-internals', true, "php.internals", - ], - [ - 'internals-win', 'Windows Internals list', - 'A low volume list for those who want to help out with the development of PHP on Windows', - false, false, true, "php.internals.win", - ], - [ - 'php-cvs', 'Git commit list', - 'All commits to internals (php-src) and the Zend Engine are posted to this list automatically', - true, true, false, "php.cvs", - ], - [ - 'git-pulls', 'Git pull requests', - 'Pull requests from Github', - false, false, false, "php.git-pulls", - ], - [ - 'php-qa', 'Quality Assurance list', - 'List for the members of the PHP-QA Team', - false, true, false, "php.qa", - ], - [ - 'php-bugs', 'General bugs', - 'General bug activity are posted here', - false, false, false, "php.bugs", - ], - [ - 'standards', 'PHP Standardization and interoperability list', - 'Development of language standards', - false, false, false, "php.standards", - ], - - 'PHP internal website mailing lists', - [ - 'php-webmaster', 'PHP php.net internal infrastructure discussion', - 'List for discussing and maintaining the php.net web infrastructure.
    +// array of lists (list, name, short desc., moderated, archive, digest, newsgroup) +$internals_mailing_lists = [ + + 'PHP and Zend Engine internals lists', + [ + 'internals', 'Internals list', + 'A medium volume list for those who want to help out with the development of PHP', + false, 'php-internals', true, "php.internals", + ], + [ + 'internals-win', 'Windows Internals list', + 'A low volume list for those who want to help out with the development of PHP on Windows', + false, false, true, "php.internals.win", + ], + [ + 'php-cvs', 'Git commit list', + 'All commits to internals (php-src) and the Zend Engine are posted to this list automatically', + true, true, false, "php.cvs", + ], + [ + 'git-pulls', 'Git pull requests', + 'Pull requests from Github', + false, false, false, "php.git-pulls", + ], + [ + 'php-qa', 'Quality Assurance list', + 'List for the members of the PHP-QA Team', + false, true, false, "php.qa", + ], + [ + 'php-bugs', 'General bugs', + 'General bug activity are posted here', + false, false, false, "php.bugs", + ], + [ + 'standards', 'PHP Standardization and interoperability list', + 'Development of language standards', + false, false, false, "php.standards", + ], + + 'PHP internal website mailing lists', + [ + 'php-webmaster', 'PHP php.net internal infrastructure discussion', + 'List for discussing and maintaining the php.net web infrastructure.
    For general PHP support questions, see "General Mailing Lists" or the support page', - false, false, false, "php.webmaster", - ], - - 'PHP documentation mailing lists', - [ - 'phpdoc', 'Documentation discussion', - 'List for discussing the PHP documentation', - false, true, false, "php.doc", - ], - [ - 'doc-cvs', 'Documentation changes and commits', - 'Changes to the documentation are posted here', - true, "php-doc-cvs", false, "php.doc.cvs", - ], - [ - 'doc-bugs', 'Documentation bugs', - 'Documentation bug activity (translations, sources, and build system) are posted here', - true, 'php-doc-bugs', false, "php.doc.bugs", - ], - ]; + false, false, false, "php.webmaster", + ], + + 'PHP documentation mailing lists', + [ + 'phpdoc', 'Documentation discussion', + 'List for discussing the PHP documentation', + false, true, false, "php.doc", + ], + [ + 'doc-cvs', 'Documentation changes and commits', + 'Changes to the documentation are posted here', + true, "php-doc-cvs", false, "php.doc.cvs", + ], + [ + 'doc-bugs', 'Documentation bugs', + 'Documentation bug activity (translations, sources, and build system) are posted here', + true, 'php-doc-bugs', false, "php.doc.bugs", + ], +]; // Print out a table for a given list array function output_lists_table($mailing_lists): void diff --git a/manual/add-note.php b/manual/add-note.php index 1398e5d006..5f8388c243 100644 --- a/manual/add-note.php +++ b/manual/add-note.php @@ -125,8 +125,8 @@ // There was no error returned else { echo '

    Your submission was successful -- thanks for contributing! Note ', - 'that it will not show up for up to a few hours, ', - 'but it will eventually find its way.

    '; + 'that it will not show up for up to a few hours, ', + 'but it will eventually find its way.

    '; } // Print out common footer, and end page @@ -147,7 +147,7 @@ // Any needed variable was missing => display instructions else { -?> + ?>

    Adding a note to the manual

    @@ -332,7 +332,7 @@ // There is no section to add note to if (!isset($_POST['sect'], $_POST['redirect'])) { echo '

    To add a note, you must click on the "Add Note" button (the plus sign) ', - 'on the bottom of a manual page so we know where to add the note!

    '; + 'on the bottom of a manual page so we know where to add the note!

    '; } // Everything is in place, so we can display the form diff --git a/manual/vote-note.php b/manual/vote-note.php index fa8de7c7e2..de495c4790 100644 --- a/manual/vote-note.php +++ b/manual/vote-note.php @@ -15,95 +15,95 @@ $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 = []; - $hash = substr(md5($_REQUEST['page']), 0, 16); - $notes_file = $_SERVER['DOCUMENT_ROOT'] . "/backend/notes/" . substr($hash, 0, 2) . "/$hash"; - if (!file_exists($notes_file)) { - $response["success"] = false; - $response["msg"] = "Invalid request."; - } - else { - $data = [ - "noteid" => $_REQUEST['id'], - "sect" => $_REQUEST['page'], - "vote" => $_REQUEST['vote'], - "ip" => $_SERVER['REMOTE_ADDR'], - ]; - if (($r = posttohost($master_url, $data)) === null || strpos($r,"failed to open socket to") !== false) { - $response["success"] = false; - $response["msg"] = "Could not process your request at this time. Please try again later..."; - } - else { - $r = json_decode($r); - if (isset($r->status, $r->votes) && $r->status) { - $response["success"] = true; - $response["update"] = (int)$r->votes; - } elseif (isset($r->status, $r->message) && !$r->status) { - $response["success"] = false; - $response["msg"] = $r->message; - } else { - $response["success"] = false; - $response["msg"] = "The server did not respond properly. Please try again later..."; - } - } - } - echo json_encode($response); - exit; - } - if (!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')) { - if (!empty($_POST['challenge']) && !empty($_POST['func']) || empty($_POST['arga']) || empty($_POST['argb'])) { - if (!test_answer($_POST['func'], $_POST['arga'], $_POST['argb'], $_POST['challenge'])) { - $error = "Incorrect answer! Please try again."; - } - else { - if ($_REQUEST['vote'] === 'up') { - $N[$_REQUEST['id']]->upvotes++; - } - elseif ($_REQUEST['vote'] === 'down') { - $N[$_REQUEST['id']]->downvotes++; - } + 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 = []; $hash = substr(md5($_REQUEST['page']), 0, 16); $notes_file = $_SERVER['DOCUMENT_ROOT'] . "/backend/notes/" . substr($hash, 0, 2) . "/$hash"; - if (file_exists($notes_file)) { - $data = [ - "noteid" => $_REQUEST['id'], - "sect" => $_REQUEST['page'], - "vote" => $_REQUEST['vote'], - "ip" => $_SERVER['REMOTE_ADDR'], - ]; - if (($r = posttohost($master_url, $data)) !== null && strpos($r,"failed to open socket to") === false) { - $r = json_decode($r); - if (isset($r->status, $r->votes) && $r->status) { - $thankyou = true; - } else { - $error = "Invalid request."; + if (!file_exists($notes_file)) { + $response["success"] = false; + $response["msg"] = "Invalid request."; + } + else { + $data = [ + "noteid" => $_REQUEST['id'], + "sect" => $_REQUEST['page'], + "vote" => $_REQUEST['vote'], + "ip" => $_SERVER['REMOTE_ADDR'], + ]; + if (($r = posttohost($master_url, $data)) === null || strpos($r,"failed to open socket to") !== false) { + $response["success"] = false; + $response["msg"] = "Could not process your request at this time. Please try again later..."; + } + else { + $r = json_decode($r); + if (isset($r->status, $r->votes) && $r->status) { + $response["success"] = true; + $response["update"] = (int)$r->votes; + } elseif (isset($r->status, $r->message) && !$r->status) { + $response["success"] = false; + $response["msg"] = $r->message; + } else { + $response["success"] = false; + $response["msg"] = "The server did not respond properly. Please try again later..."; + } + } + } + echo json_encode($response); + exit; + } + if (!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')) { + if (!empty($_POST['challenge']) && !empty($_POST['func']) || empty($_POST['arga']) || empty($_POST['argb'])) { + if (!test_answer($_POST['func'], $_POST['arga'], $_POST['argb'], $_POST['challenge'])) { + $error = "Incorrect answer! Please try again."; + } + else { + if ($_REQUEST['vote'] === 'up') { + $N[$_REQUEST['id']]->upvotes++; + } + elseif ($_REQUEST['vote'] === 'down') { + $N[$_REQUEST['id']]->downvotes++; + } + $hash = substr(md5($_REQUEST['page']), 0, 16); + $notes_file = $_SERVER['DOCUMENT_ROOT'] . "/backend/notes/" . substr($hash, 0, 2) . "/$hash"; + if (file_exists($notes_file)) { + $data = [ + "noteid" => $_REQUEST['id'], + "sect" => $_REQUEST['page'], + "vote" => $_REQUEST['vote'], + "ip" => $_SERVER['REMOTE_ADDR'], + ]; + if (($r = posttohost($master_url, $data)) !== null && strpos($r,"failed to open socket to") === false) { + $r = json_decode($r); + if (isset($r->status, $r->votes) && $r->status) { + $thankyou = true; + } else { + $error = "Invalid request."; + } + } + else { + $error = "Invalid request."; + } + } + else { + $error = "Invalid request."; + } } - } - else { - $error = "Invalid request."; - } } else { - $error = "Invalid request."; + $error = "You did not answer the spam challenge question."; } - } } else { - $error = "You did not answer the spam challenge question."; + $error = "Invalid request."; } - } - else { - $error = "Invalid request."; - } } else { - // Site header - site_header("Vote On User Notes"); - $headerset = true; + // Site header + site_header("Vote On User Notes"); + $headerset = true; - if (!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')) { -?> + if (!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')) { + ?>

    Voting

    @@ -122,17 +122,17 @@

    The Note You're Voting On

    + $backID = htmlspecialchars($_REQUEST['id']); + $backPAGE = htmlspecialchars($_REQUEST['page']); + manual_note_display($N[$_REQUEST['id']], false); + ?>

    "><< Back to user notes page

    EOL; -if (!$headerset) { - site_header("Error - Voting"); - $headerset = true; -} -?> + if (!$headerset) { + site_header("Error - Voting"); + $headerset = true; + } + ?>

    Voting

    @@ -170,24 +170,24 @@
    + if ($error != "Invalid request.") { + ?>

    The Note You're Voting On

    + $backID = htmlspecialchars($_REQUEST['id']); + $backPAGE = htmlspecialchars($_REQUEST['page']); + manual_note_display($N[$_REQUEST['id']], false); + ?>

    "><< Back to user notes page

    + site_header("Thank you for voting!"); + $headerset = true; + ?>

    Thanks for voting!

    To go back to the user notes page click here.

    diff --git a/quickref.php b/quickref.php index 8fd1479bfa..94644cbcfb 100644 --- a/quickref.php +++ b/quickref.php @@ -131,7 +131,7 @@ function quickref_table($functions, $sort = true): void '

    Full website search', -]); + site_footer([ + "sidebar" => '

    Full website search', + ]); } diff --git a/releases/5_3_3.php b/releases/5_3_3.php index 516ddd3762..06a0025791 100644 --- a/releases/5_3_3.php +++ b/releases/5_3_3.php @@ -31,7 +31,7 @@ public function Bar() { } } ?>'); - ?>

    +?>

    There is no impact on migration from 5.2.x because namespaces were only introduced in PHP 5.3.

    diff --git a/releases/8.0/index.php b/releases/8.0/index.php index 08a72b721c..01da505548 100644 --- a/releases/8.0/index.php +++ b/releases/8.0/index.php @@ -1,5 +1,5 @@ PHP 8.1

    RFC + 'documentation', + $lang, + ) ?>
    @@ -98,9 +98,9 @@ PHP RFC + 'documentation', + $lang, + ) ?>
    @@ -248,9 +248,9 @@ PHP RFC + 'documentation', + $lang, + ) ?>
    @@ -286,9 +286,9 @@ PHP RFC + 'documentation', + $lang, + ) ?>
    diff --git a/releases/8.3/index.php b/releases/8.3/index.php index 3035c038b6..510973e0b3 100644 --- a/releases/8.3/index.php +++ b/releases/8.3/index.php @@ -1,5 +1,5 @@ \n

    %1\$s

    \n
      \n
    • Released: %s
    • \n
    • Announcement: ", - ($pos = strpos($ver, " ")) ? substr($ver, 0, $pos) : $ver, - $date); + ($pos = strpos($ver, " ")) ? substr($ver, 0, $pos) : $ver, + $date); if ($announcement) { if (is_array($announcement)) { @@ -237,11 +237,11 @@ function mk_rel(int $major, continue; } printf('
    • %s
    • ', - $major, $src["filename"], $src["name"]); + $major, $src["filename"], $src["name"]); } foreach ($windows as $src) { printf('
    • %s
    • ', - ($major == 5 ? "php5" : "win32"), $src["filename"], $src["name"]); + ($major == 5 ? "php5" : "win32"), $src["filename"], $src["name"]); } } diff --git a/search.php b/search.php index fb963474c4..c665e66f84 100644 --- a/search.php +++ b/search.php @@ -33,7 +33,7 @@ mirror_redirect($MYSITE . "results.php?q={$ucp}&p={$_FORM['show']}&l=$LANG"); break; - // Covers the rest + // Covers the rest default: $p = urlencode($_FORM['show']); mirror_redirect($MYSITE . "results.php?q={$ucp}&l=$LANG&p=$p"); diff --git a/submit-event.php b/submit-event.php index 55b51ce8a0..fecf895a85 100644 --- a/submit-event.php +++ b/submit-event.php @@ -82,7 +82,7 @@ } if (!checkdate($_POST['smonth'], $_POST['sday'], $_POST['syear'])) { - $errors[] = "You must specify a valid start date."; + $errors[] = "You must specify a valid start date."; } else { $sdate = mktime(0, 0, 1, $_POST['smonth'], $_POST['sday'], $_POST['syear']); @@ -231,7 +231,7 @@ @@ -269,8 +269,8 @@ function display_options($options, $current): void { foreach ($options as $k => $v) { echo '\n"; + ($k == $current ? ' selected="selected"' : ''), + '>', htmlentities($v, ENT_QUOTES | ENT_IGNORE, 'UTF-8'), "\n"; } } diff --git a/supported-versions.php b/supported-versions.php index a6c6ffe9e7..8fa6130036 100644 --- a/supported-versions.php +++ b/supported-versions.php @@ -51,11 +51,11 @@ $release): ?> + $initial = get_branch_release_date($branch); + $until = get_branch_bug_eol_date($branch); + $eol = get_branch_security_eol_date($branch); + $now = new DateTime('now'); + ?> diff --git a/thanks.php b/thanks.php index d1919665b3..2649527db0 100644 --- a/thanks.php +++ b/thanks.php @@ -267,12 +267,12 @@
        +foreach ($historical_mirrors as $m) { + ?>
      • :
      • +} +?>

      PHP.net is very grateful for all their support.