-1" : "WHERE created < now() AND public=1";
$sql = "SELECT CONCAT('Memo ',memo_number,': ',title) as title, body FROM memos $sql_where ORDER BY created DESC LIMIT 1";
$result = mysql_query($sql, $db);
$memo = mysql_fetch_assoc($result);
// generate the dynamic menu
function getMenu() {
global $db;
$catalog = array();
$sql = "SELECT memo_number, SUBSTRING(created,1,10) AS created, CONCAT('#',memo_number,': ',title) as title FROM memos WHERE public=1 ORDER BY created";
$result = mysql_query($sql, $db);
while ($row = mysql_fetch_assoc($result)) {
$temp = explode('-',$row['created']);
$catalog[$temp[0]][$temp[1]][]=array('title'=>$row['title'],'link'=>"id={$row['memo_number']}");
}
$menu = "Memo Archive:";
$monthNum= array ( 'january'=>'01','february'=>'02','march'=>'03','april'=>'04','may'=>'05','june'=>'06','july'=>'07',
'august'=>'08','september'=>'09','october'=>'10','november'=>'11','december'=>'12');
foreach ($catalog as $year=>$months) {
ksort($months);
$menu.= "\n\n";
}
$menu .="
";
return $menu;
}
// generate "all memo" page
if ($a == 2) {
$memos_contractor = "";
$memos_inspector = "";
$sql = "SELECT memo_number,CONCAT('Memo ',memo_number,': ',title) as title FROM memos WHERE public=1 ORDER BY created DESC,memo_number DESC";
$result = mysql_query($sql,$db);
while ($row = mysql_fetch_assoc($result)) {
if ($row['memo_number'] <= 5000)
$memos_contractor .= "{$row['title']}
\n";
else
$memos_inspector .= "{$row['title']}
\n";
}
$memo['body'] = <<
CONTRACTOR MEMOS:
{$memos_contractor}
INSPECTOR MEMOS:
{$memos_inspector}
EOF;
}
if ($a == 3) { // return memo years as XML
header("Content-Type:text/xml;charset=utf-8");
echo "<"."?xml version=\"1.0\"?".">\n";
echo "\n";
$sql = "SELECT DISTINCT(SUBSTRING(created,1,4)) AS created FROM memos ORDER BY created ASC";
$result = mysql_query($sql,$db);
while ($row = mysql_fetch_assoc($result)) {
echo " \n";
}
echo "";
exit;
}
if ($a == 4) { // return memos for selected year
$months = array("January","February","March","April","May","June","July","August","September","October","November","December");
header("Content-Type:text/xml;charset=utf-8");
echo "<"."?xml version=\"1.0\"?".">\n";
echo "\n";
$sql = "SELECT memo_number,title,SUBSTRING(created,1,4) AS year, SUBSTRING(created,6,2) AS month,DATE_FORMAT(created,'%m/%d/%Y') AS memo_date FROM memos WHERE public=1 ORDER BY created ASC";
$result = mysql_query($sql,$db);
$prev_year = ""; $prev_month = "";
while ($row = mysql_fetch_assoc($result)) {
$row['title'] = str_replace("<","<",$row['title']);
$row['title'] = str_replace(">",">",$row['title']);
$row['title'] = str_replace("\"",""",$row['title']);
$row['title'] = str_replace("'","'",$row['title']);
$row['title'] = str_replace("&","&",$row['title']);
if ($prev_year == "") {
echo " \n";
echo " \n";
} else if ($row['year'] != $prev_year) {
echo " \n";
echo " \n";
echo " \n";
echo " \n";
} else if ($row['month'] != $prev_month) {
echo " \n";
echo " \n";
}
echo " \n";
$prev_year = $row['year']; $prev_month = $row['month'];
}
echo " \n";
echo " \n";
echo "\n";
exit;
}
if ($a == 0 || $a == 2) {
?>
Safeguard Contractor Memos
|
|
 |
These memos are posted to ensure that our contractors are getting up-to-date information on significant issues. We welcome any comments or questions regarding the memo feature.
Click here for all contractor memos.
|
These memos are posted to ensure that our contractors are getting up-to-date information on significant issues. We welcome any comments or questions regarding the memo feature.
Click
here for all contractor memos.
{$memo['title']}";
$tmp = preg_replace("/<[aA] /","