Skip to content

Commit 9d5d04e

Browse files
committed
Fix: Run 'make coding-standards'
1 parent fce6385 commit 9d5d04e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1588
-1430
lines changed

ChangeLog-8.php

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

archive/2004.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ functions starting with the letters you typed in. You can browse the list
349349

350350
<hr>
351351

352-
<?php //news_image("http://www.phpconference.de/2003/index_en.php", "international_conference_2003.gif", "International PHP Conference"); ?>
352+
<?php //news_image("http://www.phpconference.de/2003/index_en.php", "international_conference_2003.gif", "International PHP Conference");?>
353353
<h1>International PHP Conference 2004</h1>
354354
<p>
355355
<span class="newsdate">[18-Jun-2004]</span>

archive/index.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<?php
2+
23
include_once __DIR__ . '/../include/prepend.inc';
34
$i = 0;
45
do {
5-
$y = date("Y")-$i;
6-
if (file_exists("./$y.php")) {
7-
mirror_redirect("/archive/$y.php");
8-
break;
9-
}
10-
} while(++$i<3);
6+
$y = date("Y")-$i;
7+
if (file_exists("./$y.php")) {
8+
mirror_redirect("/archive/$y.php");
9+
break;
10+
}
11+
} while (++$i<3);
1112

1213
include_once __DIR__ . '/../include/errors.inc';
1314
error_noservice();

backend/index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
// Simulate a /backend shortcut call (which will lead to a manual page)
34
$_SERVER['REQUEST_URI'] = '/backend';
45
include_once __DIR__ . '/../include/prepend.inc';

bin/index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
// Simulate a /bin shortcut call (which will lead to a manual page)
34
$_SERVER['REQUEST_URI'] = '/bin';
45
include_once __DIR__ . '/../include/prepend.inc';

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: 75 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
a fallback to display the actual month/year.
1919
*/
2020

21-
$begun = FALSE; $errors = array();
21+
$begun = false; $errors = array();
2222
$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
2323
$cy = isset($_GET['cy']) ? (int) $_GET['cy'] : 0;
2424
$cm = isset($_GET['cm']) ? (int) $_GET['cm'] : 0;
@@ -37,7 +37,7 @@
3737
if ($event = load_event($id)) {
3838
site_header("Event: " . stripslashes(htmlentities($event['sdesc'], ENT_QUOTES | ENT_IGNORE, 'UTF-8')), $site_header_config);
3939
display_event($event, 0);
40-
$begun = TRUE;
40+
$begun = true;
4141
}
4242
// Unable to find event, put this to the error messages' list
4343
else {
@@ -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);
@@ -63,12 +63,12 @@
6363
display_event($event, 0);
6464
echo "<br>";
6565
}
66-
$begun = TRUE;
66+
$begun = true;
6767
}
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,21 +80,24 @@
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
}
8787

8888
// Give defaults for the month and day values if they were invalid
89-
if (empty($cm)) { $cm = date("m"); }
90-
if (empty($cy)) { $cy = date("Y"); }
89+
if (empty($cm)) {
90+
$cm = date("m");
91+
}
92+
if (empty($cy)) {
93+
$cy = date("Y");
94+
}
9195

9296
// Start of the month date
9397
$date = mktime(0, 0, 1, $cm, 1, $cy);
9498

9599
if (!$begun) {
96-
site_header("Events: ".date("F Y", $date), $site_header_config);
97-
?>
100+
site_header("Events: ".date("F Y", $date), $site_header_config); ?>
98101
<div class="tip">
99102
<p>
100103
If you would like to suggest an upcoming event to be listed on this
@@ -110,10 +113,10 @@
110113
}
111114

112115
// Get events list for a whole month
113-
$events = load_events($date, TRUE);
116+
$events = load_events($date, true);
114117

115118
// If there was an error, or there are no events, this is an error
116-
if ($events === FALSE || count($events) == 0) {
119+
if ($events === false || count($events) == 0) {
117120
$errors[] = "No events found for this month";
118121
}
119122

@@ -125,11 +128,11 @@
125128
}
126129

127130
// Beginning and end of this month
128-
$bom = mktime(0, 0, 1, $cm, 1, $cy);
131+
$bom = mktime(0, 0, 1, $cm, 1, $cy);
129132
$eom = mktime(0, 0, 1, $cm+1, 0, $cy);
130133

131134
// Link to previous month (but do not link to too early dates)
132-
$prev_link = (function() use ($cm, $cy) {
135+
$prev_link = (function () use ($cm, $cy) {
133136
$lm = mktime(0, 0, 1, $cm, 0, $cy);
134137
$year = date('Y', $lm);
135138
if (!valid_year($year)) {
@@ -138,15 +141,17 @@
138141

139142
$month = date('m', $lm);
140143
$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));
144+
return sprintf(
145+
'<a href="/cal.php?cm=%s&amp;cy=%s">%s, %s</a>',
146+
urlencode($month),
147+
urlencode($year),
148+
htmlentities($monthName),
149+
htmlentities($year)
150+
);
146151
})();
147152

148153
// Link to next month (but do not link to too early dates)
149-
$next_link = (function() use ($cm, $cy) {
154+
$next_link = (function () use ($cm, $cy) {
150155
$nm = mktime(0, 0, 1, $cm+1, 1, $cy);
151156
$year = date('Y', $nm);
152157
if (!valid_year($year)) {
@@ -155,11 +160,13 @@
155160

156161
$month = date('m', $nm);
157162
$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));
163+
return sprintf(
164+
'<a href="/cal.php?cm=%s&amp;cy=%s">%s, %s</a>',
165+
urlencode($month),
166+
urlencode($year),
167+
htmlentities($monthName),
168+
htmlentities($year)
169+
);
163170
})();
164171

165172
// Print out navigation links for previous and next month
@@ -174,26 +181,28 @@
174181

175182
// Print out headers for weekdays
176183
for ($i = 0; $i < 7; $i++) {
177-
echo '<th width="14%">', date("l",mktime(0,0,1,4,$i+1,2001)), "</th>\n";
184+
echo '<th width="14%">', date("l", mktime(0, 0, 1, 4, $i+1, 2001)), "</th>\n";
178185
}
179186
echo "</tr>\n<tr>";
180187

181188
// Generate the requisite number of blank days to get things started
182-
for ($days = $i = date("w",$bom); $i > 0; $i--) {
189+
for ($days = $i = date("w", $bom); $i > 0; $i--) {
183190
echo '<td class="notaday">&nbsp;</td>';
184191
}
185192

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

189196
// Print out day number and all events for the day
190197
echo '<td><a class="day" href="/cal.php', "?cm=$cm&amp;cd=$i&amp;cy=$cy",
191198
'">',$i,'</a>';
192-
display_events_for_day(date("Y-m-",$bom).sprintf("%02d",$i), $events);
199+
display_events_for_day(date("Y-m-", $bom).sprintf("%02d", $i), $events);
193200
echo '</td>';
194201

195202
// Break HTML table row if at end of week
196-
if (++$days % 7 == 0) echo "</tr>\n<tr>";
203+
if (++$days % 7 == 0) {
204+
echo "</tr>\n<tr>";
205+
}
197206
}
198207

199208
// Generate the requisite number of blank days to wrap things up
@@ -218,11 +227,11 @@ function date_for_recur($recur, $day, $bom, $eom)
218227
if ($recur > 0) {
219228
$bomd = date("w", $bom) + 1;
220229
$days = (($day - $bomd + 7) % 7) + (($recur - 1) * 7);
221-
return mktime(0,0,1, date("m",$bom), $days + 1, date("Y",$bom));
230+
return mktime(0, 0, 1, date("m", $bom), $days + 1, date("Y", $bom));
222231
}
223232

224233
// ${recur}th to last $day of the month
225-
$eomd = date("w",$eom) + 1;
234+
$eomd = date("w", $eom) + 1;
226235
$days = (($eomd - $day + 7) % 7) + ((abs($recur) - 1) * 7);
227236

228237
return mktime(0, 0, 1, date("m", $bom)+1, -$days, date("Y", $bom));
@@ -256,57 +265,63 @@ function display_events_for_day($day, $events): void
256265
function load_event($id)
257266
{
258267
// Open events CSV file, return on error
259-
$fp = @fopen("backend/events.csv",'r');
260-
if (!$fp) { return FALSE; }
268+
$fp = @fopen("backend/events.csv", 'r');
269+
if (!$fp) {
270+
return false;
271+
}
261272

262273
// Read as we can, event by event
263274
while (!feof($fp)) {
275+
$event = read_event($fp);
264276

265-
$event = read_event($fp);
266-
267-
// Return with the event, if it's ID is the one
268-
// we search for (also close the file)
269-
if ($event !== FALSE && $event['id'] == $id) {
270-
fclose($fp);
271-
return $event;
272-
}
277+
// Return with the event, if it's ID is the one
278+
// we search for (also close the file)
279+
if ($event !== false && $event['id'] == $id) {
280+
fclose($fp);
281+
return $event;
282+
}
273283
}
274284

275285
// Close file, and return sign of failure
276286
fclose($fp);
277-
return FALSE;
287+
return false;
278288
}
279289

280290
// Load a list of events. Either for a particular day ($from) or a whole
281291
// month (if second parameter specified with TRUE)
282-
function load_events($from, $whole_month = FALSE)
292+
function load_events($from, $whole_month = false)
283293
{
284294
// Take advantage of the equality behavior of this date format
285295
$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));
296+
$bom = mktime(0, 0, 1, date("m", $from), 1, date("Y", $from));
297+
$eom = mktime(0, 0, 1, date("m", $from) + 1, 0, date("Y", $from));
288298
$to_date = date("Y-m-d", $whole_month ? $eom : $from);
289299

290300
// Set arrays to their default
291301
$events = $seen = array();
292302

293303
// Try to open the events file for reading, return if unable to
294-
$fp = @fopen("backend/events.csv",'r');
295-
if (!$fp) { return FALSE; }
304+
$fp = @fopen("backend/events.csv", 'r');
305+
if (!$fp) {
306+
return false;
307+
}
296308

297309
// For all events, read in the event and check it if fits our scope
298310
while (!feof($fp)) {
299311

300312
// Read the event data into $event, or continue with next
301313
// line, if there was an error with this line
302-
if (($event = read_event($fp)) === FALSE) {
314+
if (($event = read_event($fp)) === false) {
303315
continue;
304316
}
305317

306318
// Keep event's seen list up to date
307319
// (for repeating events with the same ID)
308-
if (!isset($seen[$event['id']])) { $seen[$event['id']] = 1; }
309-
else { continue; }
320+
if (!isset($seen[$event['id']])) {
321+
$seen[$event['id']] = 1;
322+
} else {
323+
continue;
324+
}
310325

311326
// Check if event is in our scope, depending on type
312327
switch ($event['type']) {
@@ -318,6 +333,7 @@ function load_events($from, $whole_month = FALSE)
318333
// Fall through. Now it is just like a single-day event
319334

320335
// Single-day event
336+
// no break
321337
case 1:
322338
if ($event['start'] >= $from_date && $event['start'] <= $to_date) {
323339
$events[] = $event;
@@ -329,7 +345,7 @@ function load_events($from, $whole_month = FALSE)
329345
if (($event['start'] >= $from_date && $event['start'] <= $to_date)
330346
|| ($event['end'] >= $from_date && $event['end'] <= $to_date)
331347
|| ($event['start'] <= $from_date && $event['end'] >= $to_date)) {
332-
$events[] = $event;
348+
$events[] = $event;
333349
}
334350
break;
335351
}
@@ -345,12 +361,14 @@ function load_events($from, $whole_month = FALSE)
345361
function read_event($fp)
346362
{
347363
// We were unable to read a line from the file, return
348-
if (($linearr = fgetcsv($fp, 8192)) === FALSE) {
349-
return FALSE;
364+
if (($linearr = fgetcsv($fp, 8192)) === false) {
365+
return false;
350366
}
351367

352368
// Corrupt line in CSV file
353-
if (count($linearr) < 13) { return FALSE; }
369+
if (count($linearr) < 13) {
370+
return false;
371+
}
354372

355373
// Get components
356374
list(
@@ -386,11 +404,11 @@ function valid_year($year)
386404

387405
// We only allow this and the next year for displays
388406
if ($year != $current_year && $year != $current_year+1) {
389-
return FALSE;
407+
return false;
390408
}
391409

392410
// The year is all right
393-
return TRUE;
411+
return true;
394412
}
395413

396414
?>

conferences/index.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
$_SERVER['BASE_PAGE'] = 'conferences/index.php';
34
include_once __DIR__ . '/../include/prepend.inc';
45
include_once __DIR__ . '/../include/pregen-news.inc';
@@ -13,8 +14,8 @@
1314

1415
$content = "<div class='home-content'>";
1516
$frontpage = array();
16-
foreach($NEWS_ENTRIES as $entry) {
17-
foreach($entry["category"] as $category) {
17+
foreach ($NEWS_ENTRIES as $entry) {
18+
foreach ($entry["category"] as $category) {
1819
if ($category["term"] == "cfp") {
1920
$frontpage[] = $entry;
2021
break;
@@ -28,7 +29,7 @@
2829
$panels = '<p class="prepend"><a href="https://wiki.php.net/conferences">Want to see your conference appear here?</a></p>';
2930

3031

31-
foreach($frontpage as $entry) {
32+
foreach ($frontpage as $entry) {
3233
$link = preg_replace('~^(http://php.net/|https://www.php.net/)~', '', $entry["id"]);
3334
$id = parse_url($entry["id"], PHP_URL_FRAGMENT);
3435
$date = date_format(date_create($entry["updated"]), 'Y-m-d');

0 commit comments

Comments
 (0)