Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/bumpRelease
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ if ($_SERVER['argc'] < 1) {
exit(1);
}

$major = intval($_SERVER['argv'][1]);
$major = (int) $_SERVER['argv'][1];
isset($RELEASES[$major]) or die("Unkown major version $major");
$minor = isset($_SERVER['argv'][2]) ? intval($_SERVER['argv'][2]) : null;
$minor = isset($_SERVER['argv'][2]) ? (int) $_SERVER['argv'][2] : null;

$version = get_current_release_for_branch($major, $minor);
$info = $RELEASES[$major][$version] ?? null;
Expand Down
3 changes: 1 addition & 2 deletions bin/news2html
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ foreach($entries as $module => $items) {
echo "</ul>\n<!-- }}} --></section>\n\n";

if ($changelog) {
$contents = ob_get_contents();
ob_end_clean();
$contents = ob_get_clean();

$log = file_get_contents($changelog);
if (empty($log)) {
Expand Down
9 changes: 4 additions & 5 deletions cal.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,10 @@ function date_for_recur($recur, $day, $bom, $eom)
}

// ${recur}th to last $day of the month
else {
$eomd = date("w",$eom) + 1;
$days = (($eomd - $day + 7) % 7) + ((abs($recur) - 1) * 7);
return mktime(0,0,1, date("m",$bom)+1, -$days, date("Y",$bom));
}
$eomd = date("w",$eom) + 1;
$days = (($eomd - $day + 7) % 7) + ((abs($recur) - 1) * 7);

return mktime(0, 0, 1, date("m", $bom)+1, -$days, date("Y", $bom));
}

// Display a <div> for each of the events that are on a given day
Expand Down
5 changes: 1 addition & 4 deletions credits.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
// Put credits information to $credits
ob_start();
phpcredits();
$credits = ob_get_contents();
ob_end_clean();
$credits = ob_get_clean();

// Strip all but the body and drop styles
preg_match('!<body.*?>(.*)</body>!ims', $credits, $m);
Expand All @@ -26,5 +25,3 @@
echo $credits;
site_footer();
}

?>
3 changes: 1 addition & 2 deletions error.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@

// ============================================================================
// The trailing slash only causes problems from now on
$URI = preg_replace('!/+$!', '', $URI);
$URI = rtrim($URI, '/');

// ============================================================================
// Some nice URLs for getting something for download
Expand Down Expand Up @@ -700,4 +700,3 @@
/*
* vim: set et ts=4 sw=4 ft=php: :
*/
?>
2 changes: 1 addition & 1 deletion images/elephpants.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

// determine how many images to serve.
if (isset($_REQUEST['count'])) {
$count = min(intval($_REQUEST['count']), 50);
$count = min((int) $_REQUEST['count'], 50);
} else {
header('HTTP/1.1 400', true, 400);
print json_encode(array(
Expand Down
14 changes: 9 additions & 5 deletions include/branches.inc
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function get_active_branches($include_recent_eols = true) {
* must be in $RELEASES _and_ must be the full version number, not the branch:
* ie provide array('5.3.29'), not array('5.3'). */
function get_eol_branches($always_include = null) {
$always_include = $always_include ? $always_include : array();
$always_include = $always_include ?: array();
$branches = array();
$now = new DateTime;

Expand Down Expand Up @@ -329,13 +329,17 @@ function get_branch_support_state($branch) {

if ($now >= $security) {
return 'eol';
} elseif ($now >= $bug) {
}

if ($now >= $bug) {
return 'security';
} elseif ($now >= $initial) {
}

if ($now >= $initial) {
return 'stable';
} else {
return 'future';
}

return 'future';
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion include/email-validation.inc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function is_emailable_address($email)

$host = substr($email, strrpos($email, '@') + 1);
// addresses from our mailing-list servers
$host_regex = "!(lists\.php\.net|chek[^\.*]\.com)!i";
$host_regex = "!(lists\.php\.net|chek[^.*]\.com)!i";
if (preg_match($host_regex, $host)) {
return false;
}
Expand Down
1 change: 0 additions & 1 deletion include/historical_mirrors.inc
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,3 @@ $historical_mirrors = array(
array("USA", "us3.php.net", "C7 Data Centers", "https://www.c7.com/"),
array("VNM", "vn1.php.net", "DigiStar Co., Ltd", "http://www.digistar.vn/"),
);
?>
6 changes: 3 additions & 3 deletions include/ip-to-country.inc
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ function i2c_search_in_index($ip)

// Read in granularity from index file and
// convert current IP to something useful
$granularity = intval(fgets($dbidx, 64));
$granularity = (int) fgets($dbidx, 64);
if (!$granularity) {
// The file is empty (demo file)
return false;
}
$ip_chunk = intval($ip / $granularity);
$ip_chunk = (int) ($ip / $granularity);

// Loop till we can read the file
while (!feof($dbidx)) {
Expand Down Expand Up @@ -226,7 +226,7 @@ function i2c_realip()
}

// Return with the found IP or the remote address
return ($ip ? $ip : $_SERVER['REMOTE_ADDR']);
return $ip ?: $_SERVER['REMOTE_ADDR'];
}

/* vim: set et ts=4 sw=4 ft=php: : */
4 changes: 2 additions & 2 deletions include/langchooser.inc
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ function language_choose_code()
$browser_accept = explode(",", $_SERVER['HTTP_ACCEPT_LANGUAGE']);

// Go through all language preference specs
for ($i = 0; $i < count($browser_accept); $i++) {
foreach ($browser_accept as $value) {
// The language part is either a code or a code with a quality
// We cannot do anything with a * code, so it is skipped
// If the quality is missing, it is assumed to be 1 according to the RFC
if (preg_match("!([a-z-]+)(;q=([0-9\\.]+))?!", trim($browser_accept[$i]), $found)) {
if (preg_match("!([a-z-]+)(;q=([0-9\\.]+))?!", trim($value), $found)) {
$quality = (isset($found[3]) ? (float) $found[3] : 1.0);
$browser_langs[] = array($found[1], $quality);
}
Expand Down
19 changes: 9 additions & 10 deletions include/layout.inc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function highlight_php_trimmed($code, $return = false)
{
$code = "<?php\n" . $code;
$highlighted_code = highlight_php($code, true);
$highlighted_code = preg_replace("/\&lt;\?php(\<br \/\>)+/", '', $highlighted_code, 1);
$highlighted_code = preg_replace("!&lt;\?php(<br />)+!", '', $highlighted_code, 1);

if ($return) { return $highlighted_code; }
echo $highlighted_code;
Expand Down Expand Up @@ -109,7 +109,7 @@ function make_image($file, $alt = FALSE, $align = FALSE, $extras = FALSE,
return sprintf('<img src="%s/%s" alt="%s"%s%s%s>',
$webdir,
$file,
($alt ? $alt : ''),
($alt ?: ''),
$sizeparams,
$align,
($extras ? ' ' . $extras : '')
Expand Down Expand Up @@ -159,7 +159,7 @@ function make_link ($url, $linktext = FALSE, $target = FALSE, $extras = FALSE)
$url,
($target ? ' target="' . $target . '"' : ''),
($extras ? ' ' . $extras : ''),
($linktext ? $linktext : $url)
($linktext ?: $url)
);
}

Expand All @@ -175,12 +175,12 @@ function print_link($url, $linktext = FALSE, $target = FALSE, $extras = FALSE)
function make_popup_link ($url, $linktext=false, $target=false, $windowprops="", $extras=false) {
return sprintf("<a href=\"%s\" target=\"%s\" onclick=\"window.open('%s','%s','%s');return false;\"%s>%s</a>",
htmlspecialchars($url, ENT_QUOTES | ENT_IGNORE),
($target ? $target : "_new"),
($target ?: "_new"),
htmlspecialchars($url, ENT_QUOTES | ENT_IGNORE),
($target ? $target : "_new"),
($target ?: "_new"),
$windowprops,
($extras ? ' '.$extras : ''),
($linktext ? $linktext : $url)
($linktext ?: $url)
);
}

Expand Down Expand Up @@ -230,8 +230,7 @@ function download_link($file, $title)

function sect_to_file($string) {
$string = strtolower($string);
$string = str_replace(' ','-',$string);
$string = str_replace('_','-',$string);
$string = str_replace([' ', '_'], '-', $string);
$func = "function.$string.php";
$chap = "ref.$string.php";
$feat = "features.$string.php";
Expand All @@ -255,7 +254,7 @@ function clean_note($text)

// Turn urls into links
return preg_replace(
'!((mailto:|(https?|ftp|nntp|news):\/\/).*?)(\s|<|\)|"|\\\\|\'|$)!',
'!((mailto:|(https?|ftp|nntp|news)://).*?)(\s|<|\)|"|\\\\|\'|$)!',
'<a href="\1" rel="nofollow" target="_blank">\1</a>\4',
$text
);
Expand Down Expand Up @@ -397,7 +396,7 @@ function news_archive_sidebar()
function print_news($news, $dog, $max = 5, $onlyyear = null, $return = false) {
$retval = array();
$count = 0;
$news = $news ? $news : array(); // default to empty array (if no news)
$news = $news ?: array(); // default to empty array (if no news)
foreach($news as $item) {
$ok = false;

Expand Down
3 changes: 1 addition & 2 deletions include/pregen-confs.inc
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ $CONF_TEASER = array (
'http://php.net/conferences/index.php#id2015-06-19-1' => 'ZendCon 2015',
'http://php.net/conferences/index.php#id2015-06-01-1' => 'PHP Barcelona Conference 2015',
),
)
?>
);
1 change: 0 additions & 1 deletion include/results.inc
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,3 @@ EOB;
echo '</ul></div>';
endif;
}
?>
2 changes: 1 addition & 1 deletion include/shared-manual.inc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function manual_note_display($date, $name, $text, $id, $votes = array('up'=>0,'d

// Calculate note rating by up/down votes
$vote = $votes['up'] - $votes['down'];
$p = floor(($votes['up'] / (($votes['up'] + $votes['down']) ? $votes['up'] + $votes['down'] : 1)) * 100);
$p = floor(($votes['up'] / (($votes['up'] + $votes['down']) ?: 1)) * 100);
$rate = !$p && !($votes['up'] + $votes['down']) ? "no votes..." : "$p% like this...";

// Vote User Notes Div
Expand Down
21 changes: 13 additions & 8 deletions include/site.inc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ function mirror_provider($site = FALSE)

if (isset($MIRRORS[$site])) {
return $MIRRORS[$site][1];
} elseif (isset($MIRRORS[$_SERVER['SERVER_ADDR']])) {
}

if (isset($MIRRORS[$_SERVER['SERVER_ADDR']])) {
return $MIRRORS[$_SERVER['SERVER_ADDR']][1];
}

Expand All @@ -87,7 +89,9 @@ function mirror_provider_url($site = FALSE)

if (isset($MIRRORS[$site])) {
return $MIRRORS[$site][3];
} elseif (isset($MIRRORS[$_SERVER['SERVER_ADDR']])) {
}

if (isset($MIRRORS[$_SERVER['SERVER_ADDR']])) {
return $MIRRORS[$_SERVER['SERVER_ADDR']][3];
}

Expand All @@ -103,7 +107,9 @@ function mirror_type($site = FALSE)

if (isset($MIRRORS[$site])) {
return $MIRRORS[$site][4];
} elseif (isset($MIRRORS[$_SERVER['SERVER_ADDR']])) {
}

if (isset($MIRRORS[$_SERVER['SERVER_ADDR']])) {
return $MIRRORS[$_SERVER['SERVER_ADDR']][4];
}

Expand Down Expand Up @@ -138,12 +144,12 @@ function mirror_setcookie($name, $content, $exptime)
if (!headers_sent()) {
if (is_official_mirror()) {
return setcookie($name, $content, time() + $exptime, '/', '.php.net');
} else {
return setcookie($name, $content, time() + $exptime, '/');
}
} else {
return FALSE;

return setcookie($name, $content, time() + $exptime, '/');
}

return FALSE;
}

// Use this function to write out proper headers on
Expand Down Expand Up @@ -216,7 +222,6 @@ function get_shortname($page) {
if (strpos($shorturl, $section) === 0) {
// We can make it even shorter
return substr($shorturl, strlen($section), -4);
break;
}
}

Expand Down
7 changes: 3 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@
header("HTTP/1.1 304 Not Modified");
exit();
}

// Inform the user agent what is our last modification date
else {
header("Last-Modified: " . $tsstring);
}
header("Last-Modified: " . $tsstring);

$_SERVER['BASE_PAGE'] = 'index.php';
include_once 'include/prepend.inc';
Expand Down Expand Up @@ -186,7 +185,7 @@
$announcements .= ' <a href="/conferences" class="headline" title="' . $conftype[$category] . '">' . $conftype[$category] .'</a>';
$announcements .= '<div class="body"><ul>';
foreach (array_slice($entries, 0, 4) as $url => $title) {
$title = preg_replace("'([A-Za-z0-9])([\s\:\-\,]*?)call for(.*?)$'i", "$1", $title);
$title = preg_replace("'([A-Za-z0-9])([\s:\-,]*?)call for(.*?)$'i", "$1", $title);
$announcements .= "<li><a href='$url' title='$title'>$title</a></li>";
}
$announcements .= '</ul></div>';
Expand Down
2 changes: 0 additions & 2 deletions manual-lookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,3 @@
// Fall back to a quick reference search
$notfound = $function;
include __DIR__ . '/quickref.php';

?>
24 changes: 10 additions & 14 deletions manual/add-note.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@

// Convert all line-endings to unix format,
// and don't allow out-of-control blank lines
$note = str_replace("\r\n", "\n", $note);
$note = str_replace("\r", "\n", $note);
$note = str_replace(["\r\n", "\r"], "\n", $note);
$note = preg_replace("/\n{2,}/", "\n\n", $note);

// Don't pass through example username
Expand Down Expand Up @@ -135,17 +134,14 @@
}

// There was an error, or a preview is needed
else {

// If there was an error, print out
if ($error) { echo "<p class=\"formerror\">$error</p>\n"; }

// Print out preview of note
echo '<p>This is what your entry will look like, roughly:</p>';
echo '<div id="usernotes">';
manual_note_display(time(), $user, $note, FALSE);
echo '</div><br><br>';
}
// If there was an error, print out
if ($error) { echo "<p class=\"formerror\">$error</p>\n"; }

// Print out preview of note
echo '<p>This is what your entry will look like, roughly:</p>';
echo '<div id="usernotes">';
manual_note_display(time(), $user, $note, FALSE);
echo '</div><br><br>';
}

// Any needed variable was missing => display instructions
Expand Down Expand Up @@ -345,7 +341,7 @@
if (empty($_POST['user'])) { $_POST['user'] = "user@example.com"; }

// There is no section to add note to
if (!isset($_POST['sect']) || !isset($_POST['redirect'])) {
if (!isset($_POST['sect'], $_POST['redirect'])) {
echo '<p class="formerror">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!</p>';
}
Expand Down
1 change: 0 additions & 1 deletion manual/index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?php
include_once __DIR__ . '/../include/prepend.inc';
mirror_redirect("/manual/$LANG/index.php");
?>
3 changes: 0 additions & 3 deletions manual/spam_challenge.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,3 @@ function test_answer($name, $an, $bn, $answer) {

return ($nums[$c[0]($a, $b)] === $answer);
}


?>
Loading