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);
|
header($key . ': ' . $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$location = '';
|
||||||
$lines = explode("\r\n", $body);
|
$lines = explode("\r\n", $body);
|
||||||
foreach ($lines as $line) {
|
foreach ($lines as $line) {
|
||||||
|
|
||||||
if ($line) {
|
if ($line) {
|
||||||
list($key, $value) = explode(":", $line);
|
list($key, $value) = explode(":", $line);
|
||||||
if ($key == 'LOCATION') {
|
switch ($key) {
|
||||||
$room = strtok($value, " ");
|
case 'LOCATION':
|
||||||
|
$location = $value;
|
||||||
|
$room = strtok($location, " ");
|
||||||
$address = get_address($db, $room);
|
$address = get_address($db, $room);
|
||||||
|
|
||||||
if ($address === false) {
|
if ($address === false) {
|
||||||
$address = utf8_encode(crawl_address($room));
|
$address = preg_replace('/[ ]{2,}/sm', ' ', utf8_encode(crawl_address($room)));
|
||||||
set_address($db, $room, $address);
|
set_address($db, $room, $address);
|
||||||
$crawled = true;
|
$crawled = true;
|
||||||
}
|
}
|
||||||
$value = $address . ' (' . $value . ')';
|
$value = $address . ', Aachen';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'DESCRIPTION':
|
||||||
|
if ($value) $value .= '\n';
|
||||||
|
$value .= $location;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $key . ':' . $value;
|
echo $key . ':' . $value;
|
||||||
}
|
}
|
||||||
echo "\r\n";
|
echo "\r\n";
|
||||||
|
|
BIN
campus/campus.db
BIN
campus/campus.db
Binary file not shown.
Loading…
Add table
Reference in a new issue