/**
  * @return AjxpWrapperProvider
  * @throws \Sabre\DAV\Exception\NotFound
  */
 public function getAccessDriver()
 {
     if (!isset($this->accessDriver)) {
         //$RID = $this->repository->getId();
         //ConfService::switchRootDir($RID);
         ConfService::getConfStorageImpl();
         $this->accessDriver = ConfService::loadDriverForRepository($this->repository);
         if (!$this->accessDriver instanceof AjxpWrapperProvider) {
             throw new Sabre\DAV\Exception\NotFound($this->repository->getId());
         }
         $this->accessDriver->detectStreamWrapper(true);
     }
     return $this->accessDriver;
 }
 public function postProcess($action, $httpVars, $postProcessData)
 {
     if (isset($httpVars["simple_uploader"]) || isset($httpVars["xhr_uploader"])) {
         return;
     }
     /* If set resumeFileId and resumePartitionIndex, cross-session resume is requested. */
     if (isset($httpVars["resumeFileId"]) && isset($httpVars["resumePartitionIndex"])) {
         header("HTTP/1.1 200 OK");
         print "fileId: " . $httpVars["resumeFileId"] . "\n";
         print "partitionIndex: " . $httpVars["resumePartitionIndex"];
         return;
     }
     /*if (self::$skipDecoding) {
     
             }*/
     if (isset($postProcessData["processor_result"]["ERROR"])) {
         if (isset($httpVars["lastPartition"]) && isset($httpVars["partitionCount"])) {
             /* we get the stream url (where all the partitions have been uploaded so far) */
             $repository = ConfService::getRepository();
             $dir = AJXP_Utils::decodeSecureMagic($httpVars["dir"]);
             $plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
             $streamData = $plugin->detectStreamWrapper(true);
             $destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . $dir . "/";
             if ($httpVars["partitionCount"] > 1) {
                 /* we fetch the information that help us to construct the temp files name */
                 $fileId = $httpVars["fileId"];
                 $fileHash = md5($httpVars["fileName"]);
                 /* deletion of all the partitions that have been uploaded */
                 for ($i = 0; $i < $httpVars["partitionCount"]; $i++) {
                     if (file_exists($destStreamURL . "{$fileHash}.{$fileId}.{$i}")) {
                         unlink($destStreamURL . "{$fileHash}.{$fileId}.{$i}");
                     }
                 }
             } else {
                 $fileName = $httpVars["fileName"];
                 unlink($destStreamURL . $fileName);
             }
         }
         echo "Error: " . $postProcessData["processor_result"]["ERROR"]["MESSAGE"];
         return;
     }
     if (!isset($httpVars["partitionRealName"]) && !isset($httpVars["lastPartition"])) {
         return;
     }
     $repository = ConfService::getRepository();
     $driver = ConfService::loadDriverForRepository($repository);
     if (!$repository->detectStreamWrapper(false)) {
         return false;
     }
     if ($httpVars["lastPartition"]) {
         $plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
         $streamData = $plugin->detectStreamWrapper(true);
         $dir = AJXP_Utils::decodeSecureMagic($httpVars["dir"]);
         $destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . $dir . "/";
         /* we check if the current file has a relative path (aka we want to upload an entire directory) */
         $this->logDebug("Now dispatching relativePath dest:", $httpVars["relativePath"]);
         $subs = explode("/", $httpVars["relativePath"]);
         $userfile_name = array_pop($subs);
         $folderForbidden = false;
         $all_in_place = true;
         $partitions_length = 0;
         $fileId = $httpVars["fileId"];
         $fileHash = md5($userfile_name);
         $partitionCount = $httpVars["partitionCount"];
         $fileLength = $_POST["fileLength"];
         /*
          *
          * Now, we supposed that access driver has already saved uploaded file in to
          * folderServer with file name is md5 relativePath value.
          * We try to copy this file to right location in recovery his name.
          *
          */
         $userfile_name = md5($httpVars["relativePath"]);
         if (self::$remote) {
             $partitions = array();
             $newPartitions = array();
             $index_first_partition = -1;
             $i = 0;
             do {
                 $currentFileName = $driver->getFileNameToCopy();
                 $partitions[] = $driver->getNextFileToCopy();
                 if ($index_first_partition < 0 && strstr($currentFileName, $fileHash) != false) {
                     $index_first_partition = $i;
                 } else {
                     if ($index_first_partition < 0) {
                         $newPartitions[] = array_pop($partitions);
                     }
                 }
             } while ($driver->hasFilesToCopy());
         }
         /* if partitionned */
         if ($partitionCount > 1) {
             if (self::$remote) {
                 for ($i = 0; $all_in_place && $i < $partitionCount; $i++) {
                     $partition_file = "{$fileHash}.{$fileId}.{$i}";
                     if (strstr($partitions[$i]["name"], $partition_file) != false) {
                         $partitions_length += filesize($partitions[$i]["tmp_name"]);
                     } else {
                         $all_in_place = false;
                     }
                 }
             } else {
                 for ($i = 0; $all_in_place && $i < $partitionCount; $i++) {
                     $partition_file = $destStreamURL . "{$fileHash}.{$fileId}.{$i}";
                     if (file_exists($partition_file)) {
                         $partitions_length += filesize($partition_file);
                     } else {
                         $all_in_place = false;
                     }
                 }
             }
         } else {
             if (self::$remote) {
                 if (strstr($newPartitions[count($newPartitions) - 1]["name"], $userfile_name) != false) {
                     $partitions_length += filesize($newPartitions[count($newPartitions) - 1]["tmp_name"]);
                 }
             } else {
                 if (file_exists($destStreamURL . $userfile_name)) {
                     $partitions_length += filesize($destStreamURL . $userfile_name);
                 }
             }
         }
         if (!$all_in_place || $partitions_length != floatval($fileLength)) {
             echo "Error: Upload validation error!";
             /* we delete all the uploaded partitions */
             if ($httpVars["partitionCount"] > 1) {
                 for ($i = 0; $i < $partitionCount; $i++) {
                     if (file_exists($destStreamURL . "{$fileHash}.{$fileId}.{$i}")) {
                         unlink($destStreamURL . "{$fileHash}.{$fileId}.{$i}");
                     }
                 }
             } else {
                 $fileName = $httpVars["partitionRealName"];
                 unlink($destStreamURL . $fileName);
             }
             return;
         }
         if (count($subs) > 0 && !self::$remote) {
             $curDir = "";
             if (substr($curDir, -1) == "/") {
                 $curDir = substr($curDir, 0, -1);
             }
             // Create the folder tree as necessary
             foreach ($subs as $key => $spath) {
                 $messtmp = "";
                 $dirname = AJXP_Utils::decodeSecureMagic($spath, AJXP_SANITIZE_FILENAME);
                 $dirname = substr($dirname, 0, ConfService::getCoreConf("NODENAME_MAX_LENGTH"));
                 //$this->filterUserSelectionToHidden(array($dirname));
                 if (AJXP_Utils::isHidden($dirname)) {
                     $folderForbidden = true;
                     break;
                 }
                 if (file_exists($destStreamURL . "{$curDir}/{$dirname}")) {
                     // if the folder exists, traverse
                     $this->logDebug("{$curDir}/{$dirname} existing, traversing for {$userfile_name} out of", $httpVars["relativePath"]);
                     $curDir .= "/" . $dirname;
                     continue;
                 }
                 $this->logDebug($destStreamURL . $curDir);
                 $dirMode = 0775;
                 $chmodValue = $repository->getOption("CHMOD_VALUE");
                 if (isset($chmodValue) && $chmodValue != "") {
                     $dirMode = octdec(ltrim($chmodValue, "0"));
                     if ($dirMode & 0400) {
                         $dirMode |= 0100;
                     }
                     // Owner is allowed to read, allow to list the directory
                     if ($dirMode & 040) {
                         $dirMode |= 010;
                     }
                     // Group is allowed to read, allow to list the directory
                     if ($dirMode & 04) {
                         $dirMode |= 01;
                     }
                     // Other are allowed to read, allow to list the directory
                 }
                 $url = $destStreamURL . $curDir . "/" . $dirname;
                 $old = umask(0);
                 mkdir($url, $dirMode);
                 umask($old);
                 AJXP_Controller::applyHook("node.change", array(null, new AJXP_Node($url), false));
                 $curDir .= "/" . $dirname;
             }
         }
         if (!$folderForbidden) {
             $fileId = $httpVars["fileId"];
             $this->logDebug("Should now rebuild file!", $httpVars);
             // Now move the final file to the right folder
             // Currently the file is at the base of the current
             $this->logDebug("PartitionRealName", $destStreamURL . $httpVars["partitionRealName"]);
             // Get file by name (md5 value)
             $relPath_md5 = AJXP_Utils::decodeSecureMagic(md5($httpVars["relativePath"]));
             // original file name
             $relPath = AJXP_Utils::decodeSecureMagic($httpVars["relativePath"]);
             $target = $destStreamURL;
             $target .= self::$remote ? basename($relPath) : $relPath;
             /*
              *   $current is uploaded file with md5 value as his name
              *   we copy to $relPath and delete md5 file
              */
             $current = $destStreamURL . basename($relPath_md5);
             if ($httpVars["partitionCount"] > 1) {
                 if (self::$remote) {
                     $test = AJXP_Utils::getAjxpTmpDir() . "/" . $httpVars["partitionRealName"];
                     $newDest = fopen(AJXP_Utils::getAjxpTmpDir() . "/" . $httpVars["partitionRealName"], "w");
                     $newFile = array();
                     $length = 0;
                     for ($i = 0, $count = count($partitions); $i < $count; $i++) {
                         $currentFile = $partitions[$i];
                         $currentFileName = $currentFile["tmp_name"];
                         $part = fopen($currentFileName, "r");
                         while (!feof($part)) {
                             $length += fwrite($newDest, fread($part, 4096));
                         }
                         fclose($part);
                         unlink($currentFileName);
                     }
                     $newFile["type"] = $partitions[0]["type"];
                     $newFile["name"] = $httpVars["partitionRealName"];
                     $newFile["error"] = 0;
                     $newFile["size"] = $length;
                     $newFile["tmp_name"] = AJXP_Utils::getAjxpTmpDir() . "/" . $httpVars["partitionRealName"];
                     $newFile["destination"] = $partitions[0]["destination"];
                     $newPartitions[] = $newFile;
                 } else {
                     $newDest = fopen($destStreamURL . $httpVars["partitionRealName"], "w");
                     $fileHash = md5($httpVars["partitionRealName"]);
                     for ($i = 0; $i < $httpVars["partitionCount"]; $i++) {
                         $part = fopen($destStreamURL . "{$fileHash}.{$fileId}.{$i}", "r");
                         while (!feof($part)) {
                             fwrite($newDest, fread($part, 4096));
                         }
                         fclose($part);
                         unlink($destStreamURL . "{$fileHash}.{$fileId}.{$i}");
                     }
                 }
                 fclose($newDest);
             }
             if (!self::$remote && (!self::$wrapperIsRemote || $relPath != $httpVars["partitionRealName"])) {
                 $err = copy($current, $target);
             } else {
                 for ($i = 0, $count = count($newPartitions); $i < $count; $i++) {
                     $driver->storeFileToCopy($newPartitions[$i]);
                 }
             }
             if ($err !== false) {
                 if (!self::$remote) {
                     unlink($current);
                 }
                 AJXP_Controller::applyHook("node.change", array(null, new AJXP_Node($target), false));
             } else {
                 if ($current == $target) {
                     AJXP_Controller::applyHook("node.change", array(null, new AJXP_Node($target), false));
                 }
             }
         } else {
             // Remove the file, as it should not have been uploaded!
             //if(!self::$remote) unlink($current);
         }
     }
 }
Example #3
0
if ($loggedUser != null && $loggedUser->getPref("lang") != "") {
    ConfService::setLanguage($loggedUser->getPref("lang"));
} else {
    if (isset($_COOKIE["AJXP_lang"])) {
        ConfService::setLanguage($_COOKIE["AJXP_lang"]);
    }
}
$mess = ConfService::getMessages();
// THIS FIRST DRIVERS DO NOT NEED ID CHECK
//$ajxpDriver = AJXP_PluginsService::findPlugin("gui", "ajax");
$authDriver = ConfService::getAuthDriverImpl();
// DRIVERS BELOW NEED IDENTIFICATION CHECK
if (!AuthService::usersEnabled() || ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth") || AuthService::getLoggedUser() != null) {
    $confDriver = ConfService::getConfStorageImpl();
    $loadRepo = ConfService::getRepository();
    $Driver = ConfService::loadDriverForRepository($loadRepo);
}
AJXP_PluginsService::getInstance()->initActivePlugins();
require_once AJXP_BIN_FOLDER . "/class.AJXP_Controller.php";
$xmlResult = AJXP_Controller::findActionAndApply($optAction, $optArgs, array());
if ($xmlResult !== false && $xmlResult != "") {
    AJXP_XMLWriter::header();
    print $xmlResult;
    AJXP_XMLWriter::close();
} else {
    if (isset($requireAuth) && AJXP_Controller::$lastActionNeedsAuth) {
        AJXP_XMLWriter::header();
        AJXP_XMLWriter::requireAuth();
        AJXP_XMLWriter::close();
    }
}
Example #4
0
 /**
  * Find all expired legacy publiclets and remove them.
  * @param $elementId
  * @param $data
  * @throws Exception
  */
 private function deleteExpiredPubliclet($elementId, $data)
 {
     if (AuthService::getLoggedUser() == null || AuthService::getLoggedUser()->getId() != $data["OWNER_ID"]) {
         AuthService::logUser($data["OWNER_ID"], "", true);
     }
     $repoObject = $data["REPOSITORY"];
     if (!is_a($repoObject, "Repository")) {
         $repoObject = ConfService::getRepositoryById($data["REPOSITORY"]);
     }
     $repoLoaded = false;
     if (!empty($repoObject)) {
         try {
             ConfService::loadDriverForRepository($repoObject)->detectStreamWrapper(true);
             $repoLoaded = true;
         } catch (Exception $e) {
             // Cannot load this repository anymore.
         }
     }
     if ($repoLoaded && isset($data["FILE_PATH"])) {
         AJXP_Controller::registryReset();
         $ajxpNode = new AJXP_Node("pydio://" . $repoObject->getId() . $data["FILE_PATH"]);
     }
     $this->deleteShare($data['SHARE_TYPE'], $elementId, false, true);
     if (isset($ajxpNode)) {
         try {
             $this->getMetaManager()->removeShareFromMeta($ajxpNode, $elementId);
         } catch (Exception $e) {
         }
         gc_collect_cycles();
     }
 }
 public function unifyChunks($action, &$httpVars, &$fileVars)
 {
     $filename = AJXP_Utils::decodeSecureMagic($httpVars["name"]);
     $tmpName = $fileVars["file"]["tmp_name"];
     $chunk = $httpVars["chunk"];
     $chunks = $httpVars["chunks"];
     //error_log("currentChunk:".$chunk."  chunks: ".$chunks);
     $repository = ConfService::getRepository();
     if (!$repository->detectStreamWrapper(false)) {
         return false;
     }
     $plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
     $streamData = $plugin->detectStreamWrapper(true);
     $wrapperName = $streamData["classname"];
     $dir = AJXP_Utils::securePath($httpVars["dir"]);
     $destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . $dir . "/";
     $driver = ConfService::loadDriverForRepository($repository);
     $remote = false;
     if (method_exists($driver, "storeFileToCopy")) {
         $remote = true;
         $destCopy = AJXP_XMLWriter::replaceAjxpXmlKeywords($repository->getOption("TMP_UPLOAD"));
         // Make tmp folder a bit more unique using secure_token
         $tmpFolder = $destCopy . "/" . $httpVars["secure_token"];
         if (!is_dir($tmpFolder)) {
             @mkdir($tmpFolder, 0700, true);
         }
         $target = $tmpFolder . '/' . $filename;
         $fileVars["file"]["destination"] = base64_encode($dir);
     } else {
         if (call_user_func(array($wrapperName, "isRemote"))) {
             $remote = true;
             $tmpFolder = AJXP_Utils::getAjxpTmpDir() . "/" . $httpVars["secure_token"];
             if (!is_dir($tmpFolder)) {
                 @mkdir($tmpFolder, 0700, true);
             }
             $target = $tmpFolder . '/' . $filename;
         } else {
             $target = $destStreamURL . $filename;
         }
     }
     //error_log("Directory: ".$dir);
     // Clean the fileName for security reasons
     //$filename = preg_replace('/[^\w\._]+/', '', $filename);
     // Look for the content type header
     if (isset($_SERVER["HTTP_CONTENT_TYPE"])) {
         $contentType = $_SERVER["HTTP_CONTENT_TYPE"];
     }
     if (isset($_SERVER["CONTENT_TYPE"])) {
         $contentType = $_SERVER["CONTENT_TYPE"];
     }
     // Handle non multipart uploads older WebKit versions didn't support multipart in HTML5
     if (strpos($contentType, "multipart") !== false) {
         if (isset($tmpName) && is_uploaded_file($tmpName)) {
             //error_log("tmpName: ".$tmpName);
             // Open temp file
             $out = fopen($target, $chunk == 0 ? "wb" : "ab");
             if ($out) {
                 // Read binary input stream and append it to temp file
                 $in = fopen($tmpName, "rb");
                 if ($in) {
                     while ($buff = fread($in, 4096)) {
                         fwrite($out, $buff);
                     }
                 } else {
                     die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
                 }
                 fclose($in);
                 fclose($out);
                 @unlink($tmpName);
             } else {
                 die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
             }
         } else {
             die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
         }
     } else {
         // Open temp file
         $out = fopen($target, $chunk == 0 ? "wb" : "ab");
         if ($out) {
             // Read binary input stream and append it to temp file
             $in = fopen("php://input", "rb");
             if ($in) {
                 while ($buff = fread($in, 4096)) {
                     fwrite($out, $buff);
                 }
             } else {
                 die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
             }
             fclose($in);
             fclose($out);
         } else {
             die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
         }
     }
     /* we apply the hook if we are uploading the last chunk */
     if ($chunk == $chunks - 1) {
         if (!$remote) {
             AJXP_Controller::applyHook("node.change", array(null, new AJXP_Node($destStreamURL . $filename), false));
         } else {
             if (method_exists($driver, "storeFileToCopy")) {
                 $fileVars["file"]["tmp_name"] = $target;
                 $fileVars["file"]["name"] = $filename;
                 $driver->storeFileToCopy($fileVars["file"]);
                 AJXP_Controller::findActionAndApply("next_to_remote", array(), array());
             } else {
                 // Remote Driver case: copy temp file to destination
                 $node = new AJXP_Node($destStreamURL . $filename);
                 AJXP_Controller::applyHook("node.before_create", array($node, filesize($target)));
                 AJXP_Controller::applyHook("node.before_change", array(new AJXP_Node($destStreamURL)));
                 $res = copy($target, $destStreamURL . $filename);
                 if ($res) {
                     @unlink($target);
                 }
                 AJXP_Controller::applyHook("node.change", array(null, $node, false));
             }
         }
     }
     // Return JSON-RPC response
     die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
 }
Example #6
0
 /**
  * @return AbstractAccessDriver
  */
 public function getDriver()
 {
     if (!isset($this->_accessDriver)) {
         $repo = $this->getRepository();
         if ($repo != null) {
             $this->_accessDriver = ConfService::loadDriverForRepository($repo);
         }
     }
     return $this->_accessDriver;
 }
 /**
  * Enter description here...
  *
  */
 public function stream_close()
 {
     if ($this->fp !== null) {
         fclose($this->fp);
         if (self::$linkNode !== null) {
             ConfService::loadDriverForRepository(self::$linkNode->getRepository());
         }
     }
 }
 public static function getNodes($checkStats = false, $touch = true)
 {
     if (isset(self::$output)) {
         return self::$output;
     }
     $mess = ConfService::getMessages();
     $repos = ConfService::getAccessibleRepositories();
     $output = array();
     $touchReposIds = array();
     foreach ($repos as $repo) {
         if (!$repo->hasOwner() || !$repo->hasContentFilter()) {
             continue;
         }
         $repoId = $repo->getId();
         if (strpos("ocs_remote_share_", $repoId) !== 0) {
             $touchReposIds[] = $repoId;
         }
         $url = "pydio://" . $repoId . "/";
         $meta = array("shared_repository_id" => $repoId, "ajxp_description" => "File shared by " . $repo->getOwner() . " " . AJXP_Utils::relativeDate($repo->getOption("CREATION_TIME"), $mess), "share_meta_type" => 1);
         $cFilter = $repo->getContentFilter();
         $filter = $cFilter instanceof ContentFilter ? array_keys($cFilter->filters)[0] : $cFilter;
         if (!is_array($filter)) {
             $label = basename($filter);
         } else {
             $label = $repo->getDisplay();
         }
         if (strpos($repoId, "ocs_remote_share") !== 0) {
             // FOR REMOTE SHARES, DO NOT APPEND THE DOCUMENTNAME, WE STAT THE ROOT DIRECTLY
             $url .= $label;
         }
         $status = null;
         $remoteShare = null;
         $name = pathinfo($label, PATHINFO_FILENAME);
         $ext = pathinfo($label, PATHINFO_EXTENSION);
         $node = new AJXP_Node($url);
         $node->setLabel($label);
         if ($checkStats) {
             $node->getRepository()->driverInstance = null;
             try {
                 ConfService::loadDriverForRepository($node->getRepository());
             } catch (Exception $e) {
                 $ext = "error";
                 $meta["ajxp_mime"] = "error";
             }
             $node->getRepository()->detectStreamWrapper(true);
             $stat = @stat($url);
             if ($stat === false) {
                 $ext = "error";
                 $meta["ajxp_mime"] = "error";
                 $meta["share_meta_type"] = 2;
             } else {
                 if (strpos($repoId, "ocs_remote_share_") === 0) {
                     // Check Status
                     $linkId = str_replace("ocs_remote_share_", "", $repoId);
                     $ocsStore = new \Pydio\OCS\Model\SQLStore();
                     $remoteShare = $ocsStore->remoteShareById($linkId);
                     $status = $remoteShare->getStatus();
                     if ($status == OCS_INVITATION_STATUS_PENDING) {
                         $stat = stat(AJXP_Utils::getAjxpTmpDir());
                         $ext = "invitation";
                         $meta["ajxp_mime"] = "invitation";
                         $meta["share_meta_type"] = 0;
                     } else {
                         $meta["remote_share_accepted"] = "true";
                     }
                     $meta["remote_share_id"] = $remoteShare->getId();
                 }
             }
             if ($ext == "invitation") {
                 $label .= " (" . $mess["inbox_driver.4"] . ")";
             } else {
                 if ($ext == "error") {
                     $label .= " (" . $mess["inbox_driver.5"] . ")";
                 }
             }
             if (is_array($stat) && AuthService::getLoggedUser() != null) {
                 $acl = AuthService::getLoggedUser()->mergedRole->getAcl($repoId);
                 if ($acl == "r") {
                     self::disableWriteInStat($stat);
                 }
             }
         }
         $index = 0;
         $suffix = "";
         while (isset($output[$name . $suffix . "." . $ext])) {
             $index++;
             $suffix = " ({$index})";
         }
         $output[$name . $suffix . "." . $ext] = ["label" => $label, "url" => $url, "remote_share" => $remoteShare, "meta" => $meta];
         if (isset($stat)) {
             $output[$name . $suffix . "." . $ext]['stat'] = $stat;
         }
     }
     ConfService::loadDriverForRepository(ConfService::getRepository());
     self::$output = $output;
     if ($touch) {
         if (count($touchReposIds) && AuthService::getLoggedUser() != null) {
             $uPref = AuthService::getLoggedUser()->getPref("repository_last_connected");
             if (empty($uPref)) {
                 $uPref = array();
             }
             foreach ($touchReposIds as $rId) {
                 $uPref[$rId] = time();
             }
             AuthService::getLoggedUser()->setPref("repository_last_connected", $uPref);
         }
     }
     return $output;
 }
Example #9
0
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null && $loggedUser->getPref("lang") != "") {
    ConfService::setLanguage($loggedUser->getPref("lang"));
} else {
    if (isset($_COOKIE["AJXP_lang"])) {
        ConfService::setLanguage($_COOKIE["AJXP_lang"]);
    }
}
$mess = ConfService::getMessages();
// THIS FIRST DRIVERS DO NOT NEED ID CHECK
//$ajxpDriver = AJXP_PluginsService::findPlugin("gui", "ajax");
$authDriver = ConfService::getAuthDriverImpl();
// DRIVERS BELOW NEED IDENTIFICATION CHECK
if (!AuthService::usersEnabled() || ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth") || AuthService::getLoggedUser() != null) {
    $confDriver = ConfService::getConfStorageImpl();
    $Driver = ConfService::loadDriverForRepository(ConfService::getRepository());
}
AJXP_PluginsService::getInstance()->initActivePlugins();
require_once AJXP_BIN_FOLDER . "/class.AJXP_Controller.php";
$xmlResult = AJXP_Controller::findActionAndApply($optAction, $optArgs, array());
if ($xmlResult !== false && $xmlResult != "") {
    AJXP_XMLWriter::header();
    print $xmlResult;
    AJXP_XMLWriter::close();
} else {
    if (isset($requireAuth) && AJXP_Controller::$lastActionNeedsAuth) {
        AJXP_XMLWriter::header();
        AJXP_XMLWriter::requireAuth();
        AJXP_XMLWriter::close();
    }
}