|
|
@@ -2,8 +2,7 @@ |
|
|
|
namespace OCA\Memento\Controller; |
|
|
|
|
|
|
|
require_once __DIR__ . '/findMementos.php'; |
|
|
|
|
|
|
|
use DateTime; |
|
|
|
require_once __DIR__ . '/datetimeConversion.php'; |
|
|
|
|
|
|
|
use OCP\IRequest; |
|
|
|
use OCP\IServerContainer; |
|
|
@@ -43,8 +42,9 @@ class TimeMapController extends Controller { |
|
|
|
$timeMapUrl = $this->URLGenerator->getAbsoluteUrl("/apps/memento/timemap/$url"); |
|
|
|
$timeGateUrl = $this->URLGenerator->getAbsoluteUrl("/apps/memento/timegate/$url"); |
|
|
|
if (count($matchingMementos) > 0) { |
|
|
|
$firstDatetime = formatDatetime($matchingMementos[0]['datetime']); |
|
|
|
$lastDatetime = formatDatetime($matchingMementos[count($matchingMementos)-1]['datetime']); |
|
|
|
$firstDatetime = datetimeTimestampToString($matchingMementos[0]['datetime']); |
|
|
|
$lastMemento = $matchingMementos[count($matchingMementos)-1]; |
|
|
|
$lastDatetime = datetimeTimestampToString($lastMemento['datetime']); |
|
|
|
} |
|
|
|
$links = [ |
|
|
|
// FIXME Our $url param has its duplicate slashes removed, so it looks like 'http:/abc'. |
|
|
@@ -54,7 +54,7 @@ class TimeMapController extends Controller { |
|
|
|
($firstDatetime && $lastDatetime ? ";from=\"$firstDatetime\";until=\"$lastDatetime\"" : "") |
|
|
|
]; |
|
|
|
foreach ($matchingMementos as $index => $memento) { |
|
|
|
$datetime = formatDatetime($memento['datetime']); |
|
|
|
$datetime = datetimeTimestampToString($memento['datetime']); |
|
|
|
$maybeFirst = $index === 0 ? 'first ' : ''; |
|
|
|
$maybeLast = $index === count($matchingMementos)-1 ? 'last ' : ''; |
|
|
|
// Make absolute, as the spec says URLs are to be interpreted relative to the *original* url! |
|
|
@@ -73,9 +73,3 @@ class TimeMapController extends Controller { |
|
|
|
return $response; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function formatDatetime($datetime) { |
|
|
|
$datetime = new DateTime("@$datetime"); |
|
|
|
$s = $datetime->format("D, d M Y H:i:s") . " GMT"; |
|
|
|
return $s; |
|
|
|
} |