Here's the deal we are currently undergoing site design/migration (MAJOR HEADACHES) from a straight PHP/HTML site to a Drupal based site. we have our home people (namely me) working on things then we have the design people and they have a third party doing things as well. A few weeks ago I had used some code form our old site to create a view--view for drupal which scans a directory and lists all the stuff in the directory regarding our staff reports. I had not touched it since then and it had been working fine as have the other 6 pages done the same way. Thursday afternoon the page suddenly stopped working and would just render a blank page. I had not touched it and as near as I can tell neither did anyone else. I compared it to our other pages but I can't see anything wrong. Am I missing something? Or is this a Drupal problem?
<?php
$PHP_SELF = '/' . current_path();
$base = DRUPAL_ROOT . "/staff-reports";
$thisyear = date("Y");
# Strip out any HTML tags to eliminate cross-site scripting.
foreach ($_GET as $value) {
$value = preg_replace("/<(.*?)>/","",$value);
}
# Then grab each GET value into a variable.
foreach ($_GET as $varname => $value) {
$$varname = $value;
}
# If a year was not specified, use the current year by default.
if (!$year) {
$year = $thisyear;
}
# List the year folders in the base directory (2001, 2002, et cetera).
if ($handle = opendir($base)) {
while (false !== ($file = readdir($handle))) {
// echo $file . '<br />';
if( is_dir( $base . '/' . $file ) ){
// echo $file . 'Is a directory <br />';
if (preg_match("/\d\d\d\d/",$file)) {
$years[count($years)] = $file;
}
}
}
closedir($handle);
rsort($years);
}
# List the target year directory.
$reports = array();
$directory = $base . '/' . $year;
if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
if (preg_match("/staff-report-\d\d\d\d-\d\d-\d\d\..../",$file)) {
$reports[count($reports)] = $file;
}
}
closedir($handle);
if (count($reports)) {
sort($reports);
}
}
print "<table cellpadding=\"5\" border=\"1\" summary=\"Meetings\"><tr valign=\"top\">";
# Print the year index in the first column.
print "<td align=\"center\"><p><span class=\"bold\">Year index</span></p>\n";
for ($i = 0; $i < count($years); $i++) {
if ($years[$i] == $year) {
print "<b>";
}
print "<a href=\"$PHP_SELF?year=$years[$i]\">$years[$i]</a><br />\n";
if ($years[$i] == $year) {
print "</b>";
}
}
print "</td>";
# Print the list of issues for the specified year in the other column.
print "<td align=\"center\"><p><span class=\"bold\">$year reports</span></p>\n";
if (count($reports)) {
# print count($reports) . " issues<p>";
for ($i = 0; $i < count($reports); $i++) {
$y = substr($reports[$i],13,4);
$m = substr($reports[$i],18,2);
$d = substr($reports[$i],21,2);
# print "<a href=\"/staff-reports/$year/$reports[$i]\">$m/$d/$y</a><br />\n";
print "<a href=\"/staff-reports/$year/$reports[$i] \ "> ";
print date("F j, Y", mktime(0,0,0,$m,$d,$y));
print "</a><br />\n";
}
} else {
print "No reports";
}
print "<br />\n";
print "</td></tr></table>\n";
?>
<p>To view these documents, you need a PDF reader such as the <a
href="http://www.adobe.com/products/acrobat/readstep2.html">Adobe Reader</a>.</p>
<hr />
<?php
?>
Basic PHP: "
-quoted strings cannot have "
-quotes within them unless they're escaped:
print "<a href=\"/staff-reports/$year/$reports[$i] \ "> ";
^^
Your baskslash is escaping a space, not the "
character.