seperated address and room information
moved room information to DESCRIPTION removed double spaces from address
This commit is contained in:
parent
fccf834b5b
commit
88dc470cdd
2 changed files with 19 additions and 10 deletions
|
@ -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, " ");
|
||||
$address = get_address($db, $room);
|
||||
switch ($key) {
|
||||
case 'LOCATION':
|
||||
$location = $value;
|
||||
$room = strtok($location, " ");
|
||||
$address = get_address($db, $room);
|
||||
|
||||
if ($address === false) {
|
||||
$address = utf8_encode(crawl_address($room));
|
||||
set_address($db, $room, $address);
|
||||
$crawled = true;
|
||||
}
|
||||
$value = $address . ' (' . $value . ')';
|
||||
if ($address === false) {
|
||||
$address = preg_replace('/[ ]{2,}/sm', ' ', utf8_encode(crawl_address($room)));
|
||||
set_address($db, $room, $address);
|
||||
$crawled = true;
|
||||
}
|
||||
$value = $address . ', Aachen';
|
||||
break;
|
||||
|
||||
case 'DESCRIPTION':
|
||||
if ($value) $value .= '\n';
|
||||
$value .= $location;
|
||||
break;
|
||||
}
|
||||
|
||||
echo $key . ':' . $value;
|
||||
}
|
||||
echo "\r\n";
|
||||
|
|
BIN
campus/campus.db
BIN
campus/campus.db
Binary file not shown.
Loading…
Add table
Reference in a new issue