Skip to content

Commit d13a435

Browse files
committed
Fix: Run 'make coding-standards'
1 parent 0dd4966 commit d13a435

29 files changed

+348
-290
lines changed

ChangeLog-8.php

Lines changed: 111 additions & 111 deletions
Large diffs are not rendered by default.

cached.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
$abs = realpath($abs);
2323

2424
if (strncmp($abs, $pwd, strlen($pwd)) != 0) {
25-
header("Location: https://www.php.net/" . strtr($_GET["f"],array("\r"=>"", "\n"=>"")));
25+
header("Location: https://www.php.net/" . strtr($_GET["f"], array("\r"=>"", "\n"=>"")));
2626
exit;
2727
}
2828

cal.php

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
elseif ($cy && $cm && $cd) {
5050

5151
// Check if date is valid
52-
if (checkdate($cm,$cd,$cy)) {
52+
if (checkdate($cm, $cd, $cy)) {
5353

5454
// Date integer for that day
5555
$date = mktime(0, 0, 1, $cm, $cd, $cy);
@@ -68,7 +68,7 @@
6868

6969
// Unable to load events for that day
7070
else {
71-
$errors[] = "There are no events for the specified date (".date("F j, Y",$date).").";
71+
$errors[] = "There are no events for the specified date (".date("F j, Y", $date).").";
7272
}
7373
}
7474

@@ -80,7 +80,7 @@
8080
}
8181

8282
// Check if month and year is valid
83-
if ($cm && $cy && !checkdate($cm,1,$cy)) {
83+
if ($cm && $cy && !checkdate($cm, 1, $cy)) {
8484
$errors[] = "The specified year and month (".htmlentities("$cy, $cm", ENT_QUOTES | ENT_IGNORE, 'UTF-8').") are not valid.";
8585
unset($cm, $cy);
8686
}
@@ -125,7 +125,7 @@
125125
}
126126

127127
// Beginning and end of this month
128-
$bom = mktime(0, 0, 1, $cm, 1, $cy);
128+
$bom = mktime(0, 0, 1, $cm, 1, $cy);
129129
$eom = mktime(0, 0, 1, $cm+1, 0, $cy);
130130

131131
// Link to previous month (but do not link to too early dates)
@@ -138,11 +138,13 @@
138138

139139
$month = date('m', $lm);
140140
$monthName = date('F', $lm);
141-
return sprintf('<a href="/cal.php?cm=%s&amp;cy=%s">%s, %s</a>',
142-
urlencode($month),
143-
urlencode($year),
144-
htmlentities($monthName),
145-
htmlentities($year));
141+
return sprintf(
142+
'<a href="/cal.php?cm=%s&amp;cy=%s">%s, %s</a>',
143+
urlencode($month),
144+
urlencode($year),
145+
htmlentities($monthName),
146+
htmlentities($year)
147+
);
146148
})();
147149

148150
// Link to next month (but do not link to too early dates)
@@ -155,11 +157,13 @@
155157

156158
$month = date('m', $nm);
157159
$monthName = date('F', $nm);
158-
return sprintf('<a href="/cal.php?cm=%s&amp;cy=%s">%s, %s</a>',
159-
urlencode($month),
160-
urlencode($year),
161-
htmlentities($monthName),
162-
htmlentities($year));
160+
return sprintf(
161+
'<a href="/cal.php?cm=%s&amp;cy=%s">%s, %s</a>',
162+
urlencode($month),
163+
urlencode($year),
164+
htmlentities($monthName),
165+
htmlentities($year)
166+
);
163167
})();
164168

165169
// Print out navigation links for previous and next month
@@ -174,22 +178,22 @@
174178

175179
// Print out headers for weekdays
176180
for ($i = 0; $i < 7; $i++) {
177-
echo '<th width="14%">', date("l",mktime(0,0,1,4,$i+1,2001)), "</th>\n";
181+
echo '<th width="14%">', date("l", mktime(0, 0, 1, 4, $i+1, 2001)), "</th>\n";
178182
}
179183
echo "</tr>\n<tr>";
180184

181185
// Generate the requisite number of blank days to get things started
182-
for ($days = $i = date("w",$bom); $i > 0; $i--) {
186+
for ($days = $i = date("w", $bom); $i > 0; $i--) {
183187
echo '<td class="notaday">&nbsp;</td>';
184188
}
185189

186190
// Print out all the days in this month
187-
for ($i = 1; $i <= date("t",$bom); $i++) {
191+
for ($i = 1; $i <= date("t", $bom); $i++) {
188192

189193
// Print out day number and all events for the day
190194
echo '<td><a class="day" href="/cal.php', "?cm=$cm&amp;cd=$i&amp;cy=$cy",
191195
'">',$i,'</a>';
192-
display_events_for_day(date("Y-m-",$bom).sprintf("%02d",$i), $events);
196+
display_events_for_day(date("Y-m-", $bom).sprintf("%02d", $i), $events);
193197
echo '</td>';
194198

195199
// Break HTML table row if at end of week
@@ -218,11 +222,11 @@ function date_for_recur($recur, $day, $bom, $eom)
218222
if ($recur > 0) {
219223
$bomd = date("w", $bom) + 1;
220224
$days = (($day - $bomd + 7) % 7) + (($recur - 1) * 7);
221-
return mktime(0,0,1, date("m",$bom), $days + 1, date("Y",$bom));
225+
return mktime(0, 0, 1, date("m", $bom), $days + 1, date("Y", $bom));
222226
}
223227

224228
// ${recur}th to last $day of the month
225-
$eomd = date("w",$eom) + 1;
229+
$eomd = date("w", $eom) + 1;
226230
$days = (($eomd - $day + 7) % 7) + ((abs($recur) - 1) * 7);
227231

228232
return mktime(0, 0, 1, date("m", $bom)+1, -$days, date("Y", $bom));
@@ -256,7 +260,7 @@ function display_events_for_day($day, $events): void
256260
function load_event($id)
257261
{
258262
// Open events CSV file, return on error
259-
$fp = @fopen("backend/events.csv",'r');
263+
$fp = @fopen("backend/events.csv", 'r');
260264
if (!$fp) { return false; }
261265

262266
// Read as we can, event by event
@@ -283,15 +287,15 @@ function load_events($from, $whole_month = false)
283287
{
284288
// Take advantage of the equality behavior of this date format
285289
$from_date = date("Y-m-d", $from);
286-
$bom = mktime(0, 0, 1, date("m",$from), 1, date("Y",$from));
287-
$eom = mktime(0, 0, 1, date("m",$from) + 1, 0, date("Y",$from));
290+
$bom = mktime(0, 0, 1, date("m", $from), 1, date("Y", $from));
291+
$eom = mktime(0, 0, 1, date("m", $from) + 1, 0, date("Y", $from));
288292
$to_date = date("Y-m-d", $whole_month ? $eom : $from);
289293

290294
// Set arrays to their default
291295
$events = $seen = array();
292296

293297
// Try to open the events file for reading, return if unable to
294-
$fp = @fopen("backend/events.csv",'r');
298+
$fp = @fopen("backend/events.csv", 'r');
295299
if (!$fp) { return false; }
296300

297301
// For all events, read in the event and check it if fits our scope

downloads.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
<p class="panel"><a href="/releases/">Old archives</a></p>
2626
';
2727

28-
site_header("Downloads",
28+
site_header(
29+
"Downloads",
2930
array(
3031
'link' => array(
3132
array(

include/branches.inc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,16 @@ function format_interval($from, $to) {
6363
$eolPeriod = 'midnight';
6464
}
6565
if ($times) {
66-
$eolPeriod = implode(', ',
67-
array_map(
68-
function ($t) {
66+
$eolPeriod = implode(
67+
', ',
68+
array_map(
69+
function ($t) {
6970
return "$t[0] $t[1]" .
7071
($t[0] != 1 ? 's' : '');
7172
},
72-
$times
73-
)
74-
);
73+
$times
74+
)
75+
);
7576

7677
if ($diff->invert) {
7778
$eolPeriod = "$eolPeriod ago";

include/email-validation.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,6 @@ function blacklisted($email) {
103103
'@conferenceseries.com',
104104
);
105105
foreach ($mosquitoes as $m) {
106-
if (preg_match('/'.preg_quote($m, '/').'/i',$email)) return true;
106+
if (preg_match('/'.preg_quote($m, '/').'/i', $email)) return true;
107107
}
108108
}

include/gpg-keys.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ function gpg_key_show_keys(bool $activeOnly): void {
162162
foreach (gpg_key_get_branches($activeOnly) as $branch => $rms) {
163163
$keys = array_filter(
164164
array_map(function ($rm) { return gpg_key_get($rm); }, $rms),
165-
function ($key) { return $key !== null; });
165+
function ($key) { return $key !== null; }
166+
);
166167
if (empty($keys)) { continue; }
167168

168169
$branch = htmlentities($branch, ENT_QUOTES, 'UTF-8');

include/langchooser.inc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function language_choose_code()
5656
}
5757

5858
// Specified in a shortcut URL (eg. /en/echo or /pt_br/echo)
59-
if (preg_match("!^/(\\w{2}(_\\w{2})?)/!", htmlspecialchars($_SERVER['REQUEST_URI'],ENT_QUOTES, 'UTF-8'), $flang)) {
59+
if (preg_match("!^/(\\w{2}(_\\w{2})?)/!", htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES, 'UTF-8'), $flang)) {
6060

6161
// Put language into preference list
6262
$rlang = language_add($flang[1], $languages);
@@ -68,7 +68,9 @@ function language_choose_code()
6868

6969
// Drop out langauge specification from URL, as this is already handled
7070
$_SERVER['STRIPPED_URI'] = preg_replace(
71-
"!^/$flang[1]/!", "/", htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES, 'UTF-8')
71+
"!^/$flang[1]/!",
72+
"/",
73+
htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES, 'UTF-8')
7274
);
7375

7476
}

include/layout.inc

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ $_SERVER['MYSITE'] = $MYSITE;
66
ini_set('highlight.comment', 'comment');
77
ini_set('highlight.default', 'default');
88
ini_set('highlight.keyword', 'keyword');
9-
ini_set('highlight.string', 'string');
10-
ini_set('highlight.html', 'html');
9+
ini_set('highlight.string', 'string');
10+
ini_set('highlight.html', 'html');
1111

1212
// Highlight PHP code
1313
function highlight_php($code, $return = false)
@@ -69,7 +69,7 @@ function commonFooter() { site_footer(); }
6969
function resize_image($img, $width = 1, $height = 1)
7070
{
7171
// Drop width and height values from image if available
72-
$str = preg_replace('!width=\"([0-9]+?)\"!i', '', $img);
72+
$str = preg_replace('!width=\"([0-9]+?)\"!i', '', $img);
7373
$str = preg_replace('!height=\"([0-9]+?)\"!i', '', $str);
7474

7575
// Return image with new width and height added
@@ -81,8 +81,14 @@ function resize_image($img, $width = 1, $height = 1)
8181
}
8282

8383
// Return an <img> tag for a given image file available on the server
84-
function make_image($file, $alt = false, $align = false, $extras = false,
85-
$dir = '/images', $addsize = true)
84+
function make_image(
85+
$file,
86+
$alt = false,
87+
$align = false,
88+
$extras = false,
89+
$dir = '/images',
90+
$addsize = true
91+
)
8692
{
8793
// If no / was provided at the start of $dir, add it
8894
$webdir = $_SERVER['MYSITE'] . ($dir[0] == '/' ? '' : '/') . $dir;
@@ -105,7 +111,8 @@ function make_image($file, $alt = false, $align = false, $extras = false,
105111
}
106112

107113
// Return with image built up
108-
return sprintf('<img src="%s/%s" alt="%s"%s%s%s>',
114+
return sprintf(
115+
'<img src="%s/%s" alt="%s"%s%s%s>',
109116
$webdir,
110117
$file,
111118
($alt ?: ''),
@@ -116,8 +123,13 @@ function make_image($file, $alt = false, $align = false, $extras = false,
116123
}
117124

118125
// Print an <img> tag out for a given file
119-
function print_image($file, $alt = false, $align = false, $extras = false,
120-
$dir = '/images')
126+
function print_image(
127+
$file,
128+
$alt = false,
129+
$align = false,
130+
$extras = false,
131+
$dir = '/images'
132+
)
121133
{
122134
echo make_image($file, $alt, $align, $extras, $dir);
123135
}
@@ -134,8 +146,14 @@ function news_image($URL, $image, $alt, $print = true)
134146
}
135147

136148
// Return HTML code for a submit button image
137-
function make_submit($file, $alt = false, $align = false, $extras = false,
138-
$dir = '/images', $border = 0)
149+
function make_submit(
150+
$file,
151+
$alt = false,
152+
$align = false,
153+
$extras = false,
154+
$dir = '/images',
155+
$border = 0
156+
)
139157
{
140158
// Get an image without size info and convert the
141159
// border attribute to use CSS, as border="" is not
@@ -154,7 +172,8 @@ function make_submit($file, $alt = false, $align = false, $extras = false,
154172
// Return a hiperlink to something within the site
155173
function make_link ($url, $linktext = false, $target = false, $extras = false)
156174
{
157-
return sprintf("<a href=\"%s\"%s%s>%s</a>",
175+
return sprintf(
176+
"<a href=\"%s\"%s%s>%s</a>",
158177
$url,
159178
($target ? ' target="' . $target . '"' : ''),
160179
($extras ? ' ' . $extras : ''),
@@ -172,12 +191,13 @@ function print_link($url, $linktext = false, $target = false, $extras = false)
172191
// return a hyperlink to something, within the site, that pops up a new window
173192
//
174193
function make_popup_link ($url, $linktext=false, $target=false, $windowprops="", $extras=false) {
175-
return sprintf("<a href=\"%s\" target=\"%s\" onclick=\"window.open('%s','%s','%s');return false;\"%s>%s</a>",
194+
return sprintf(
195+
"<a href=\"%s\" target=\"%s\" onclick=\"window.open('%s','%s','%s');return false;\"%s>%s</a>",
176196
htmlspecialchars($url, ENT_QUOTES | ENT_IGNORE),
177197
($target ?: "_new"),
178198
htmlspecialchars($url, ENT_QUOTES | ENT_IGNORE),
179199
($target ?: "_new"),
180-
$windowprops,
200+
$windowprops,
181201
($extras ? ' '.$extras : ''),
182202
($linktext ?: $url)
183203
);
@@ -302,13 +322,13 @@ function display_event($event, $include_date = 1)
302322
);
303323

304324
if (!isset($event['start']) && isset($event['sday'])) {
305-
$sday = mktime(12,0,0,$event['smonth'],$event['sday'],$event['syear']);
325+
$sday = mktime(12, 0, 0, $event['smonth'], $event['sday'], $event['syear']);
306326
} else {
307327
$sday = (isset($event['start']) && !empty($event['start'])) ? strtotime($event['start']) : 0;
308328
}
309329

310330
if (!isset($event['end']) && isset($event['eday'])) {
311-
$eday = mktime(12,0,0,$event['emonth'],$event['eday'],$event['eyear']);
331+
$eday = mktime(12, 0, 0, $event['emonth'], $event['eday'], $event['eyear']);
312332
} else {
313333
$eday = (isset($event['end']) && !empty($event['end'])) ? strtotime($event['end']) : 0;
314334
}
@@ -334,7 +354,7 @@ function display_event($event, $include_date = 1)
334354
case 2:
335355
case 'multi':
336356
$dtend = date("Y-m-d", strtotime("+1 day", $eday));
337-
echo " (<abbr class='dtstart'>", date("Y-m-d",$sday), "</abbr> to <abbr class='dtend' title='$dtend'>", date("Y-m-d",$eday), "</abbr>)";
357+
echo " (<abbr class='dtstart'>", date("Y-m-d", $sday), "</abbr> to <abbr class='dtend' title='$dtend'>", date("Y-m-d", $eday), "</abbr>)";
338358
break;
339359
case 3:
340360
case 'recur':
@@ -363,7 +383,7 @@ function display_event($event, $include_date = 1)
363383
<?php
364384

365385
// Print long description
366-
echo preg_replace("/\r?\n\r?\n/", "<br><br>", trim(htmlentities($event['ldesc'],ENT_QUOTES | ENT_IGNORE, 'UTF-8')));
386+
echo preg_replace("/\r?\n\r?\n/", "<br><br>", trim(htmlentities($event['ldesc'], ENT_QUOTES | ENT_IGNORE, 'UTF-8')));
367387
// If we have an URL, print it out
368388
if ($event['url']) {
369389
echo '<br><br><b>URL:</b> ',

include/results.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ function search_results($res, $q, $profile='all', $per_page=10, $s=0, $l='en', $
4141
// rewrite mirrors urls (\w\w\d? or www, but not qa, doc, gtk and ~/user)
4242
$real_url = preg_replace('@^http://(?!doc|qa|gtk)\w{2,3}\.php\.net(?!/~)(.*)$@', '$1', $hit['Url']);
4343
$displayurl = preg_replace('@^http://(?:(?!doc|qa|php|gtk)\w{2,3}\.)?(.+[^/])/?$@', '$1', $hit['Url']);
44-
$type = substr($displayurl,0,strpos($displayurl,'.'));
45-
if($type=='pecl' && strstr($displayurl,"/bugs/")) $type = "peclbugs";
46-
if($type=='pear' && strstr($displayurl,"/bugs/")) $type = "pearbugs";
44+
$type = substr($displayurl, 0, strpos($displayurl, '.'));
45+
if($type=='pecl' && strstr($displayurl, "/bugs/")) $type = "peclbugs";
46+
if($type=='pear' && strstr($displayurl, "/bugs/")) $type = "pearbugs";
4747
if($type=='smarty') continue;
4848
$display_title = str_replace(array('PHP:', '&amp;'), array('', '&'), $hit['Title']);
4949

0 commit comments

Comments
 (0)