Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Fix repository_last_connected flag
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Mar 10, 2016
1 parent 3d96335 commit 10adbb8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
1 change: 0 additions & 1 deletion core/src/core/classes/class.AJXP_Utils.php
Expand Up @@ -401,7 +401,6 @@ public static function parseApplicationGetParameters($parameters, &$output, &$se
$output["EXT_REP"] = SystemTextEncoding::toUTF8(urldecode($parameters["folder"]));
$loggedUser->setArrayPref("history", "last_repository", $parameters["repository_id"]);
$loggedUser->setPref("pending_folder", SystemTextEncoding::toUTF8(AJXP_Utils::decodeSecureMagic($parameters["folder"])));
$loggedUser->save("user");
AuthService::updateUser($loggedUser);
} else {
$session["PENDING_REPOSITORY_ID"] = $parameters["repository_id"];
Expand Down
2 changes: 0 additions & 2 deletions core/src/core/classes/class.ConfService.php
Expand Up @@ -438,7 +438,6 @@ public static function switchUserToActiveRepository($loggedUser, $parameterId =
if (isSet($_SESSION["PENDING_REPOSITORY_ID"]) && isSet($_SESSION["PENDING_FOLDER"])) {
$loggedUser->setArrayPref("history", "last_repository", $_SESSION["PENDING_REPOSITORY_ID"]);
$loggedUser->setPref("pending_folder", $_SESSION["PENDING_FOLDER"]);
$loggedUser->save("user");
AuthService::updateUser($loggedUser);
unset($_SESSION["PENDING_REPOSITORY_ID"]);
unset($_SESSION["PENDING_FOLDER"]);
Expand Down Expand Up @@ -539,7 +538,6 @@ public function switchRootDirInst($rootDirIndex=-1, $temporary=false)
if ($rootDirIndex!=-1 && AuthService::usersEnabled() && AuthService::getLoggedUser()!=null) {
$loggedUser = AuthService::getLoggedUser();
$loggedUser->setArrayPref("history", "last_repository", $rootDirIndex);
$loggedUser->save("user");
}

}
Expand Down
14 changes: 8 additions & 6 deletions core/src/plugins/core.conf/class.AbstractAjxpUser.php
Expand Up @@ -363,17 +363,19 @@ public function setPref($prefName, $prefValue)

public function setArrayPref($prefName, $prefPath, $prefValue)
{
if(!isSet($this->prefs[$prefName])) $this->prefs[$prefName] = array();
$this->prefs[$prefName][$prefPath] = $prefValue;
if($prefName == "history" && $prefPath == "last_repository"){
$this->setArrayPref("repository_last_connected", $prefValue, time());
$data = $this->getPref($prefName);
if(!is_array($data)){
$data = array();
}
$data[$prefPath] = $prefValue;
$this->setPref($prefName, $data);
}

public function getArrayPref($prefName, $prefPath)
{
if(!isSet($this->prefs[$prefName]) || !isSet($this->prefs[$prefName][$prefPath])) return "";
return $this->prefs[$prefName][$prefPath];
$prefArray = $this->getPref($prefName);
if(empty($prefArray) || !is_array($prefArray) || !isSet($prefArray[$prefPath])) return "";
return $prefArray[$prefPath];
}

public function addBookmark($path, $title="", $repId = -1)
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.conf/class.AbstractConfDriver.php
Expand Up @@ -597,6 +597,7 @@ public function switchAction($action, $httpVars, $fileVars)
$user = AuthService::getLoggedUser();
$activeRepId = ConfService::getCurrentRepositoryId();
$user->setArrayPref("history", "last_repository", $activeRepId);
$user->setArrayPref("repository_last_connected", $activeRepId, time());
$user->save("user");
}
//$logMessage = "Successfully Switched!";
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ocs/src/Model/RemoteShare.php
Expand Up @@ -135,6 +135,7 @@ public function buildVirtualRepository(){
);
$repo = \ConfService::createRepositoryFromArray($repositoryId, $data);
$repo->setRepositoryType("remote");
$repo->setAccessStatus($this->getStatus() == OCS_INVITATION_STATUS_ACCEPTED ? "accepted":"");
$repo->setWriteable(false);
$repo->setOwnerData(null, $this->getSender()." [remote]");
if($this->isDocumentIsLeaf()){
Expand Down

0 comments on commit 10adbb8

Please sign in to comment.