seperated address and room information

moved room information to DESCRIPTION
removed double spaces from address
This commit is contained in:
Steffen Vogel 2012-07-03 18:16:13 +02:00
parent fccf834b5b
commit 88dc470cdd
2 changed files with 19 additions and 10 deletions

View file

@ -60,22 +60,31 @@ foreach ($headers as $header) {
header($key . ': ' . $value);
}
$location = '';
$lines = explode("\r\n", $body);
foreach ($lines as $line) {
if ($line) {
list($key, $value) = explode(":", $line);
if ($key == 'LOCATION') {
$room = strtok($value, " ");
switch ($key) {
case 'LOCATION':
$location = $value;
$room = strtok($location, " ");
$address = get_address($db, $room);
if ($address === false) {
$address = utf8_encode(crawl_address($room));
$address = preg_replace('/[ ]{2,}/sm', ' ', utf8_encode(crawl_address($room)));
set_address($db, $room, $address);
$crawled = true;
}
$value = $address . ' (' . $value . ')';
$value = $address . ', Aachen';
break;
case 'DESCRIPTION':
if ($value) $value .= '\n';
$value .= $location;
break;
}
echo $key . ':' . $value;
}
echo "\r\n";

Binary file not shown.