@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | $html = RAWDATA . 'cmpages/'; |
16 | 16 | $xml = RAWDATA . 'scrapedxml/'; |
17 | 17 | $dir = array('debates', 'wrans', 'wms', 'westminhall', 'lordspages', 'ni'); |
18 | -$majors = array(1,3,4,2,101,5); |
|
18 | +$majors = array(1, 3, 4, 2, 101, 5); |
|
19 | 19 | |
20 | 20 | $hdates = array(); |
21 | 21 | $db = new ParlDB; |
22 | 22 | $q = $db->query('SELECT DISTINCT(hdate) AS hdate, major FROM hansard'); |
23 | -for ($i=0; $i<$q->rows(); $i++) { |
|
23 | +for ($i = 0; $i < $q->rows(); $i++) { |
|
24 | 24 | $hdates[$q->field($i, 'hdate')][$q->field($i, 'major')] = true; |
25 | 25 | } |
26 | 26 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $out = array(); |
37 | 37 | $dh = opendir("$html$bit/"); |
38 | 38 | while (false !== ($filename = readdir($dh))) { |
39 | - if (substr($filename, -5)!='.html' || substr($filename, -8, 3)=='tmp') continue; |
|
39 | + if (substr($filename, -5) != '.html' || substr($filename, -8, 3) == 'tmp') continue; |
|
40 | 40 | #if ($bit=='lordspages' && substr($filename,7,4)!='2005') continue; |
41 | 41 | preg_match('#^(.*?)(\d\d\d\d-\d\d-\d\d)(.*?)\.#', $filename, $m); |
42 | 42 | $part = ucfirst($m[1]); $date = $m[2]; $version = $m[3]; |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | $stat = stat("$html$bit/$filename"); |
45 | 45 | $base = substr($filename, 0, -5); |
46 | 46 | if (!is_file("$xml$bit/$base.xml")) { |
47 | - if ($date>'2001-05-11') |
|
48 | - $out[$date][] = "<li>$date : $part version $version, size $stat[7] bytes, last modified ".date('Y-m-d H:i:s', $stat[9])."</li>\n"; |
|
47 | + if ($date > '2001-05-11') |
|
48 | + $out[$date][] = "<li>$date : $part version $version, size $stat[7] bytes, last modified " . date('Y-m-d H:i:s', $stat[9]) . "</li>\n"; |
|
49 | 49 | } else { |
50 | 50 | if (!array_key_exists($date, $hdates) || !array_key_exists($majors[$k], $hdates[$date])) { |
51 | 51 | $notloaded .= "<li>$date : $part version $version</li>\n"; |
@@ -36,16 +36,21 @@ discard block |
||
36 | 36 | $out = array(); |
37 | 37 | $dh = opendir("$html$bit/"); |
38 | 38 | while (false !== ($filename = readdir($dh))) { |
39 | - if (substr($filename, -5)!='.html' || substr($filename, -8, 3)=='tmp') continue; |
|
39 | + if (substr($filename, -5)!='.html' || substr($filename, -8, 3)=='tmp') { |
|
40 | + continue; |
|
41 | + } |
|
40 | 42 | #if ($bit=='lordspages' && substr($filename,7,4)!='2005') continue; |
41 | 43 | preg_match('#^(.*?)(\d\d\d\d-\d\d-\d\d)(.*?)\.#', $filename, $m); |
42 | 44 | $part = ucfirst($m[1]); $date = $m[2]; $version = $m[3]; |
43 | - if (!isset($out[$date])) $out[$date] = array(); |
|
45 | + if (!isset($out[$date])) { |
|
46 | + $out[$date] = array(); |
|
47 | + } |
|
44 | 48 | $stat = stat("$html$bit/$filename"); |
45 | 49 | $base = substr($filename, 0, -5); |
46 | 50 | if (!is_file("$xml$bit/$base.xml")) { |
47 | - if ($date>'2001-05-11') |
|
48 | - $out[$date][] = "<li>$date : $part version $version, size $stat[7] bytes, last modified ".date('Y-m-d H:i:s', $stat[9])."</li>\n"; |
|
51 | + if ($date>'2001-05-11') { |
|
52 | + $out[$date][] = "<li>$date : $part version $version, size $stat[7] bytes, last modified ".date('Y-m-d H:i:s', $stat[9])."</li>\n"; |
|
53 | + } |
|
49 | 54 | } else { |
50 | 55 | if (!array_key_exists($date, $hdates) || !array_key_exists($majors[$k], $hdates[$date])) { |
51 | 56 | $notloaded .= "<li>$date : $part version $version</li>\n"; |
@@ -66,7 +71,9 @@ discard block |
||
66 | 71 | <p>Note this currently only works for new data - ie. if there's any data at all |
67 | 72 | in the database for the date, it won't appear hear</p> |
68 | 73 | <?php |
69 | -if ($notloaded) print "<ul>$notloaded</ul>"; |
|
74 | +if ($notloaded) { |
|
75 | + print "<ul>$notloaded</ul>"; |
|
76 | +} |
|
70 | 77 | |
71 | 78 | $PAGE->stripe_end(); |
72 | 79 | $PAGE->page_end(); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $URL->update(["gl" => $GLOSSARY->next_term['glossary_id']]); |
77 | 77 | $next_link = $URL->generate('url'); |
78 | 78 | |
79 | - $nextprev = [ |
|
79 | + $nextprev = [ |
|
80 | 80 | 'next' => [ |
81 | 81 | 'url' => $next_link, |
82 | 82 | 'title' => 'Next term', |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | $URL = new \MySociety\TheyWorkForYou\Url('glossary_addterm'); |
119 | 119 | $add_url = $URL->generate(); |
120 | -print "<p>Think you know a phrase that should be here? Help us improve the site by <a href=\"".$add_url."\">adding it</a>.</p>"; |
|
120 | +print "<p>Think you know a phrase that should be here? Help us improve the site by <a href=\"" . $add_url . "\">adding it</a>.</p>"; |
|
121 | 121 | |
122 | 122 | $PAGE->stripe_end([ |
123 | 123 | [ |