|
|
@@ -24,7 +24,7 @@ trait MementoFinder { |
|
|
|
// If logged in, and asking for one's own mementos, get private mementos too. |
|
|
|
if ($this->loggedInUserId === $userId) { |
|
|
|
$userFolder = $this->serverContainer->getUserFolder($this->loggedInUserId); |
|
|
|
$moreMementos = findPrivateMementos($userFolder); |
|
|
|
$moreMementos = findPrivateMementos($userFolder, $this->loggedInUserId); |
|
|
|
$foundMementos = array_merge($foundMementos, $moreMementos); |
|
|
|
} |
|
|
|
|
|
|
@@ -48,7 +48,7 @@ trait MementoFinder { |
|
|
|
// If logged in, get current user's private mementos too. |
|
|
|
if ($this->loggedInUserId) { |
|
|
|
$userFolder = $this->serverContainer->getUserFolder($this->loggedInUserId); |
|
|
|
$moreMementos = findPrivateMementos($userFolder); |
|
|
|
$moreMementos = findPrivateMementos($userFolder, $this->loggedInUserId); |
|
|
|
$foundMementos = array_merge($foundMementos, $moreMementos); |
|
|
|
} |
|
|
|
|
|
|
@@ -56,16 +56,16 @@ trait MementoFinder { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function findPrivateMementos($folder) { |
|
|
|
$urlForFile = function ($file) use ($folder) { |
|
|
|
function findPrivateMementos($userFolder, $userId) { |
|
|
|
$urlForFile = function ($file) use ($userFolder, $userId) { |
|
|
|
$absoluteFilePath = $file->getPath(); |
|
|
|
$relativeFilePath = $folder->getRelativePath($absoluteFilePath); |
|
|
|
$rawFileUrl = joinPaths("/apps/raw/files", $relativeFilePath); // XXX hardcoded dependency |
|
|
|
$relativeFilePath = $userFolder->getRelativePath($absoluteFilePath); |
|
|
|
$rawFileUrl = joinPaths("/apps/raw/u/$userId", $relativeFilePath); // XXX hardcoded dependency |
|
|
|
return $rawFileUrl; |
|
|
|
}; |
|
|
|
|
|
|
|
// Peek into each HTML file the user owns, and return those that are mementos. |
|
|
|
$files = $folder->searchByMime('text/html'); |
|
|
|
$files = $userFolder->searchByMime('text/html'); |
|
|
|
$foundMementos = []; |
|
|
|
foreach ($files as $file) { |
|
|
|
$mementoInfo = extractMementoInfo($file); |
|
|
|