'http://maps.google.com/maps?file=api&v=2.xx&key=ABQIAAAAss81gk3RuX0_fNvtuRmZjxTN2Bax1SwLaW8MFBwtHzDiYPkwtRTYiKh3wElxORBZ23ZNrl61U5J9Dg', 'external'=>true), array('url' =>'/scripts/guestbook.js') ); $styles = array( array('url' => '/css/root.css') ); try { $guestBook = new Guestbook(); $pendingEntry = new GuestbookEntry(); if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'){ if (isset($_POST['del']) && $_POST['del'] == 1){ if (isset($_POST['passwd']) && $_POST['passwd'] == '******'){ try { $guestBook->deleteEntriesById($_POST['entryid']); echo '1'; } catch (Exception $e){ echo '0'; } } else { echo '0'; } } else { echo '0'; } } else { if (count($_POST) > 0){ if (isset($_POST['pendingEntryId'])){ $pendingEntry = $guestBook->restorePendingEntry($_POST['pendingEntryId']); } else { $pendingEntry->setProperties($_POST); } if ($pendingEntry->validEntry()){ if (isset($_POST['confirmedAdd']) && $_POST['confirmedAdd'] == 1){ if (isset($_POST['cancel'])){ $guestBook->removePendingEntry($_POST['pendingEntryId']); } else { $guestBook->add($pendingEntry); DoRedir($_SERVER['PHP_SELF']); } } else { $pendingId = $guestBook->addPendingEntry($pendingEntry); displayTemplate('templates/header.tpl.php'); displayTemplate('templates/guestbook_confirmentry.tpl.php'); displayTemplate('templates/footer.tpl.php'); } } else { $errorNotValid = true; $bookEntries = $guestBook->getEntries(); displayTemplate('templates/header.tpl.php'); displayTemplate('templates/guestbook.tpl.php'); displayTemplate('templates/footer.tpl.php'); } } else { $bookEntries = $guestBook->getEntries(); $xmldata = ''."\n"; foreach ($bookEntries as $e){ if ($e->DontMap == false && $e->Lat !== null && $e->Lng !== null){ $xmldata .= 'Comments.' ]]>'."\n"; } } $xmldata .= ''; $xmldata = addslashes(htmlentities($xmldata)); $scripts[] = array('body'=>"var xmldata = '".str_replace(array("\r\n", "\r", "\n"), array("\n", "\n", "'+\n'"), $xmldata."';")); displayTemplate('templates/header.tpl.php'); displayTemplate('templates/guestbook.tpl.php'); displayTemplate('templates/footer.tpl.php'); } } } catch (Exception $e){ $file=__FILE__; $line=__LINE__; $ErrorMsg = 'Caught an exception while processing your request. Please try again later.'; LogError('Exception processing guestbook request.', $file, $line, $e); displayTemplate('templates/header.tpl.php'); displayTemplate('templates/generic_error.tpl.php'); displayTemplate('templates/footer.tpl.php'); } ?>