From: Maxious Date: Fri, 05 Oct 2012 05:08:45 +0000 Subject: fix date input again X-Git-Url: http://maxious.lambdacomplex.org/git/?p=contractdashboard.git&a=commitdiff&h=e317d948685b95716a9e05a486f2a7b7455293a4 --- fix date input again --- --- a/displayCalendar.php +++ b/displayCalendar.php @@ -5,9 +5,9 @@ if ($_REQUEST['month']) { - $monthParts = explode("-", str_replace(Array("'","/","\\",'-'), "",$_REQUEST['month'])); - $year = $monthParts[1]; - $month = $monthParts[0]; + $monthParts = explode("-", str_replace(Array("'","/","\\"), "",$_REQUEST['month'])); + $year = str_replace('-', '',$monthParts[1]); + $month = str_replace('-', '',$monthParts[0]); $monthName = date("F Y", mktime(0,0,0,$month,1,$year)); include_header($monthName); @@ -81,7 +81,7 @@ setlocale(LC_MONETARY, 'en_US'); $value = number_format(doubleval($row["val"]), 2); $month_name = date('F', mktime(0, 0, 0, $row[1])); - echo (''.$month_name.' '.$row[0].'$'.$value.'(' .$row['count'].' contracts)'); + echo (''.$month_name.' '.$row[0].'$'.$value.'(' .$row['count'].' contracts)'); } echo ""; } --- a/sitemap.xml.php +++ b/sitemap.xml.php @@ -1,14 +1,68 @@ "; - echo '' . "\n"; +$result = $conn->query('SELECT title, to_char("lastUpdated",\'YYYY-MM-DD\') as "lastUpdated" from datasets'); +foreach ($result->fetchAll() as $row) { + if ($row['title'] == "Contract Notices") { + $last_updated['agency'] = $row['lastUpdated']; + $last_updated['supplier'] = $row['lastUpdated']; + $last_updated['category'] = $row['lastUpdated']; + } +} +if (isset($_REQUEST['section']) == false) { + echo ''; + foreach ($sections as $section) { + echo " + " . local_url() . "sitemap.xml.php?section=$section + " . $last_updated[$section] . ''; + } + echo ''; +} else { + echo '' . "\n"; + if ($_REQUEST['section'] == "page") { echo " ".local_url()."index.php1.0\n"; foreach (scandir("./") as $file) { if (strpos($file,".php") !== false && $file != "index.php" && $file != "sitemap.xml.php") echo " ".local_url()."$file0.3\n"; } + } + if ($_REQUEST['section'] == "agency") { + $result = $conn->query('SELECT DISTINCT "agencyName" from contractnotice'); + foreach ($result->fetchAll() as $row) { + echo " " . local_url() . "displayAgency.php?agency=" . urlencode($row['agencyName']) . " + " . $last_updated['agency'] . "\n"; + } + } + if ($_REQUEST['section'] == "supplier") { + $result = $conn->query('SELECT DISTINCT on ("supplierID") ( + case when "supplierABN" != 0 THEN "supplierABN"::text ELSE "supplierName" END) as "supplierID", "supplierABN", "supplierName" from contractnotice'); + + foreach ($result->fetchAll() as $row) { + + $supplier = urlencode(stripslashes($row['supplierABN'] . '-' . $row['supplierName'])); + echo " " . local_url() . "displaySupplier.php?supplier=$supplier + " . $last_updated['supplier'] . "\n"; + } + } + if ($_REQUEST['section'] == "category") { + $result = $conn->query('SELECT distinct category FROM contractnotice;'); + foreach ($result->fetchAll() as $row) { + + echo " " . local_url() . "displayCategory.php?category=".urlencode($row['category'])." + " . $last_updated['category'] . "\n"; + + } + } echo ''; - +} ?>