From 35e707bfeb8d82d713acb49d78b08062374269f6 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Wed, 25 Oct 2017 15:02:52 -0400 Subject: Restyle address format and change background image --- dash/dash_functions.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'dash/dash_functions.php') diff --git a/dash/dash_functions.php b/dash/dash_functions.php index 9aaa78f..ab32e3b 100644 --- a/dash/dash_functions.php +++ b/dash/dash_functions.php @@ -26,6 +26,29 @@ function genpicstr () { function picture_format ($picstr = null) { return is_null($picstr) ? 'uimg/default.png' : htmlentities($picstr); } +function address_format ($addrstr) { + if (is_null($addrstr)) return 'No address supplied.'; + $addr = array_filter(address_split($addrstr)); + return htmlentities(implode(', ', $addr)); +} +function address_split ($addrstr) { + return array_map(trim, explode(';', $addrstr)); +} +function address_join ($addr) { + return implode(';', array_map(trim, $addr)); +} +function validate_address ($addr) { + $patterns = array( + '/^\d+\s(\w+\s)+\w+$/', + '/^.*$/', + '/^.+$/', + '/^[A-Z]{2}$/', + ); + foreach ($addr as $k => $addrpt) { + if (!preg_match($patterns[$k], $addrpt)) die($addrpt); + } + return true; +} function draw_norate_p () { ?>
@@ -113,7 +136,7 @@ function draw_app ($row) {

-

No address listed.' : htmlentities($row['address']);?>

+

No comment included.' : htmlentities($row['comment']);?>

-- cgit v1.2.3