예제 #1
0
 public function initRepository()
 {
     if (is_array($this->pluginConf)) {
         $this->driverConf = $this->pluginConf;
     } else {
         $this->driverConf = array();
     }
     if (!function_exists('ssh2_connect')) {
         throw new Exception("You must have the php ssh2 extension active!");
     }
     ConfService::setConf("PROBE_REAL_SIZE", false);
     $path = $this->repository->getOption("PATH");
     $recycle = $this->repository->getOption("RECYCLE_BIN");
     $this->detectStreamWrapper(true);
     $this->urlBase = "pydio://" . $this->repository->getId();
     restore_error_handler();
     if (!file_exists($this->urlBase)) {
         if ($this->repository->getOption("CREATE")) {
             $test = @mkdir($this->urlBase);
             if (!$test) {
                 throw new AJXP_Exception("Cannot create path ({$path}) for your repository! Please check the configuration.");
             }
         } else {
             throw new AJXP_Exception("Cannot find base path ({$path}) for your repository! Please check the configuration!");
         }
     }
     if ($recycle != "") {
         RecycleBinManager::init($this->urlBase, "/" . $recycle);
     }
 }
예제 #2
0
 public function initRepository()
 {
     if (is_array($this->pluginConf)) {
         $this->driverConf = $this->pluginConf;
     } else {
         $this->driverConf = array();
     }
     if ($this->getFilteredOption("PROBE_REAL_SIZE", $this->repository->getId()) == true) {
         // PASS IT TO THE WRAPPER
         ConfService::setConf("PROBE_REAL_SIZE", $this->getFilteredOption("PROBE_REAL_SIZE", $this->repository->getId()));
     }
     $create = $this->repository->getOption("CREATE");
     $path = SystemTextEncoding::toStorageEncoding($this->repository->getOption("PATH"));
     $recycle = $this->repository->getOption("RECYCLE_BIN");
     $chmod = $this->repository->getOption("CHMOD_VALUE");
     $wrapperData = $this->detectStreamWrapper(true);
     $this->wrapperClassName = $wrapperData["classname"];
     $this->urlBase = $wrapperData["protocol"] . "://" . $this->repository->getId();
     if ($create == true) {
         if (!is_dir($path)) {
             @mkdir($path, 0755, true);
         }
         if (!is_dir($path)) {
             throw new AJXP_Exception("Cannot create root path for repository (" . $this->repository->getDisplay() . "). Please check repository configuration or that your folder is writeable!");
         }
         if ($recycle != "" && !is_dir($path . "/" . $recycle)) {
             @mkdir($path . "/" . $recycle);
             if (!is_dir($path . "/" . $recycle)) {
                 throw new AJXP_Exception("Cannot create recycle bin folder. Please check repository configuration or that your folder is writeable!");
             } elseif (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
                 AJXP_Utils::winSetHidden($path . "/" . $recycle);
             }
         }
         $dataTemplate = $this->repository->getOption("DATA_TEMPLATE");
         if (!empty($dataTemplate) && is_dir($dataTemplate) && !is_file($path . "/.ajxp_template")) {
             $errs = array();
             $succ = array();
             $repoData = array('base_url' => $this->urlBase, 'wrapper_name' => $this->wrapperClassName, 'chmod' => $chmod, 'recycle' => $recycle);
             $this->dircopy($dataTemplate, $path, $succ, $errs, false, false, $repoData, $repoData);
             touch($path . "/.ajxp_template");
         }
     } else {
         if (!is_dir($path)) {
             throw new AJXP_Exception("Cannot find base path for your repository! Please check the configuration!");
         }
     }
     if ($recycle != "") {
         RecycleBinManager::init($this->urlBase, "/" . $recycle);
     }
 }
 /**
  * initRepository
  */
 public function initRepository()
 {
     if (is_array($this->pluginConf)) {
         $this->driverConf = $this->pluginConf;
     } else {
         $this->driverConf = array();
     }
     ConfService::setConf("PROBE_REAL_SIZE", false);
     require_once $this->getBaseDir() . "/SFTPPSL_StreamWrapper.php";
     $create = $this->repository->getOption("CREATE");
     $path = $this->repository->getOption("PATH");
     $wrapperData = $this->detectStreamWrapper(true);
     $this->wrapperClassName = $wrapperData["classname"];
     $this->urlBase = $wrapperData["protocol"] . "://" . $this->repository->getId();
 }
예제 #4
0
 public function initRepository()
 {
     $wrapperData = $this->detectStreamWrapper(true);
     if (is_array($this->pluginConf)) {
         $this->driverConf = $this->pluginConf;
     } else {
         $this->driverConf = array();
     }
     $recycle = $this->repository->getOption("RECYCLE_BIN");
     ConfService::setConf("PROBE_REAL_SIZE", false);
     $this->wrapperClassName = $wrapperData["classname"];
     $this->urlBase = $wrapperData["protocol"] . "://" . $this->repository->getId();
     if ($recycle != "") {
         RecycleBinManager::init($this->urlBase, "/" . $recycle);
     }
 }
예제 #5
0
 public function initRepository()
 {
     @(include_once "HTTP/WebDAV/Client.php");
     if (is_array($this->pluginConf)) {
         $this->driverConf = $this->pluginConf;
     } else {
         $this->driverConf = array();
     }
     if (!class_exists('HTTP_WebDAV_Client_Stream')) {
         throw new Exception("You must have Pear HTTP/WebDAV/Client package installed to use this access driver!");
     }
     $create = $this->repository->getOption("CREATE");
     $path = $this->repository->getOption("PATH");
     $recycle = $this->repository->getOption("RECYCLE_BIN");
     ConfService::setConf("PROBE_REAL_SIZE", false);
     /*
     if ($create == true) {
         if(!is_dir($path)) @mkdir($path);
         if (!is_dir($path)) {
             throw new AJXP_Exception("Cannot create root path for repository (".$this->repository->getDisplay()."). Please check repository configuration or that your folder is writeable!");
         }
         if ($recycle!= "" && !is_dir($path."/".$recycle)) {
             @mkdir($path."/".$recycle);
             if (!is_dir($path."/".$recycle)) {
                 throw new AJXP_Exception("Cannot create recycle bin folder. Please check repository configuration or that your folder is writeable!");
             }
         }
     } else {
         if (!is_dir($path)) {
             throw new AJXP_Exception("Cannot find base path ($path) for your repository! Please check the configuration!");
         }
     }
     */
     $wrapperData = $this->detectStreamWrapper(true);
     $this->wrapperClassName = $wrapperData["classname"];
     $this->urlBase = $wrapperData["protocol"] . "://" . $this->repository->getId();
     if (!is_dir($this->urlBase)) {
         if (webdavAccessWrapper::$lastException) {
             throw webdavAccessWrapper::$lastException;
         }
         throw new AJXP_Exception("Cannot connect to the WebDAV server ({$path}). Please check the configuration!");
     }
     if ($recycle != "") {
         RecycleBinManager::init($this->urlBase, "/" . $recycle);
     }
 }
 function initRepository()
 {
     if (is_array($this->pluginConf)) {
         $this->driverConf = $this->pluginConf;
     } else {
         $this->driverConf = array();
     }
     if (isset($this->pluginConf["PROBE_REAL_SIZE"])) {
         // PASS IT TO THE WRAPPER
         ConfService::setConf("PROBE_REAL_SIZE", $this->pluginConf["PROBE_REAL_SIZE"]);
     }
     $create = $this->repository->getOption("CREATE");
     $path = $this->repository->getOption("PATH");
     $recycle = $this->repository->getOption("RECYCLE_BIN");
     if ($create == true) {
         if (!is_dir($path)) {
             @mkdir($path, 0755, true);
         }
         if (!is_dir($path)) {
             throw new AJXP_Exception("Cannot create root path for repository (" . $this->repository->getDisplay() . "). Please check repository configuration or that your folder is writeable!");
         }
         if ($recycle != "" && !is_dir($path . "/" . $recycle)) {
             @mkdir($path . "/" . $recycle);
             if (!is_dir($path . "/" . $recycle)) {
                 throw new AJXP_Exception("Cannot create recycle bin folder. Please check repository configuration or that your folder is writeable!");
             }
         }
         $dataTemplate = $this->repository->getOption("DATA_TEMPLATE");
         if (!empty($dataTemplate) && is_dir($dataTemplate) && !is_file($path . "/.ajxp_template")) {
             $errs = array();
             $succ = array();
             $this->dircopy($dataTemplate, $path, $succ, $errs, false, false);
             touch($path . "/.ajxp_template");
         }
     } else {
         if (!is_dir($path)) {
             throw new AJXP_Exception("Cannot find base path for your repository! Please check the configuration!");
         }
     }
     $wrapperData = $this->detectStreamWrapper(true);
     $this->wrapperClassName = $wrapperData["classname"];
     $this->urlBase = $wrapperData["protocol"] . "://" . $this->repository->getId();
     if ($recycle != "") {
         RecycleBinManager::init($this->urlBase, "/" . $recycle);
     }
 }
 public function initRepository()
 {
     if (is_array($this->pluginConf)) {
         $this->driverConf = $this->pluginConf;
     } else {
         $this->driverConf = array();
     }
     require_once $this->getBaseDir() . "/openstack-sdk-php/vendor/autoload.php";
     Bootstrap::useStreamWrappers();
     Bootstrap::setConfiguration(array('username' => $this->repository->getOption("USERNAME"), 'password' => $this->repository->getOption("PASSWORD"), 'tenantid' => $this->repository->getOption("TENANT_ID"), 'endpoint' => $this->repository->getOption("ENDPOINT"), 'openstack.swift.region' => $this->repository->getOption("REGION"), 'transport.ssl.verify' => false));
     $path = $this->repository->getOption("PATH");
     $recycle = $this->repository->getOption("RECYCLE_BIN");
     ConfService::setConf("PROBE_REAL_SIZE", false);
     $this->detectStreamWrapper(true);
     $this->urlBase = "pydio://" . $this->repository->getId();
     if ($recycle != "") {
         RecycleBinManager::init($this->urlBase, "/" . $recycle);
     }
 }
예제 #8
0
 public function initRepository()
 {
     require_once $this->getBaseDir() . "/aS3StreamWrapper/lib/wrapper/aS3StreamWrapper.class.php";
     if (!in_array("s3", stream_get_wrappers())) {
         $wrapper = new aS3StreamWrapper();
         $wrapper->register(array('protocol' => 's3', 'acl' => AmazonS3::ACL_OWNER_FULL_CONTROL, 'key' => $this->repository->getOption("API_KEY"), 'secretKey' => $this->repository->getOption("SECRET_KEY"), 'region' => $this->repository->getOption("REGION")));
     }
     if (is_array($this->pluginConf)) {
         $this->driverConf = $this->pluginConf;
     } else {
         $this->driverConf = array();
     }
     $path = $this->repository->getOption("PATH");
     $recycle = $this->repository->getOption("RECYCLE_BIN");
     ConfService::setConf("PROBE_REAL_SIZE", false);
     $wrapperData = $this->detectStreamWrapper(true);
     $this->wrapperClassName = $wrapperData["classname"];
     $this->urlBase = $wrapperData["protocol"] . "://" . $this->repository->getId();
     if ($recycle != "") {
         RecycleBinManager::init($this->urlBase, "/" . $recycle);
     }
 }
 function initRepository()
 {
     if (is_array($this->pluginConf)) {
         $this->driverConf = $this->pluginConf;
     } else {
         $this->driverConf = array();
     }
     if (!function_exists('ssh2_connect')) {
         throw new Exception("You must have the php ssh2 extension active!");
     }
     ConfService::setConf("PROBE_REAL_SIZE", false);
     $path = $this->repository->getOption("PATH");
     $recycle = $this->repository->getOption("RECYCLE_BIN");
     $wrapperData = $this->detectStreamWrapper(true);
     $this->wrapperClassName = $wrapperData["classname"];
     $this->urlBase = $wrapperData["protocol"] . "://" . $this->repository->getId();
     if (!file_exists($this->urlBase)) {
         throw new AJXP_Exception("Cannot find base path ({$path}) for your repository! Please check the configuration!");
     }
     if ($recycle != "") {
         RecycleBinManager::init($this->urlBase, "/" . $recycle);
     }
 }
예제 #10
0
 public function initRepository()
 {
     $this->detectStreamWrapper(true);
     if (is_array($this->pluginConf)) {
         $this->driverConf = $this->pluginConf;
     } else {
         $this->driverConf = array();
     }
     $recycle = $this->repository->getOption("RECYCLE_BIN");
     ConfService::setConf("PROBE_REAL_SIZE", false);
     $this->urlBase = "pydio://" . $this->repository->getId();
     if ($recycle != "" && !is_dir($this->urlBase . "/" . $recycle . "/")) {
         @mkdir($this->urlBase . "/" . $recycle . "/", 0777, true);
         if (!is_dir($this->urlBase . "/" . $recycle . "/")) {
             throw new AJXP_Exception("Cannot create recycle bin folder. Please check repository configuration or that your folder is writeable!");
         } else {
             $this->setHiddenAttribute(new AJXP_Node($this->urlBase . "/" . $recycle . "/"));
         }
     }
     if ($recycle != "") {
         RecycleBinManager::init($this->urlBase, "/" . $recycle);
     }
 }
예제 #11
0
 /**
  * Utilitary to pass some parameters directly at startup :
  * + repository_id / folder
  * + compile & skipDebug
  * + update_i18n, extract, create
  * + external_selector_type
  * + skipIOS
  * + gui
  * @static
  * @param $parameters
  * @param $output
  * @param $session
  * @return void
  */
 public static function parseApplicationGetParameters($parameters, &$output, &$session)
 {
     $output["EXT_REP"] = "/";
     if (isset($parameters["repository_id"]) && isset($parameters["folder"]) || isset($parameters["goto"])) {
         if (isset($parameters["goto"])) {
             $explode = explode("/", ltrim($parameters["goto"], "/"));
             $repoId = array_shift($explode);
             $parameters["folder"] = str_replace($repoId, "", ltrim($parameters["goto"], "/"));
         } else {
             $repoId = $parameters["repository_id"];
         }
         $repository = ConfService::getRepositoryById($repoId);
         if ($repository == null) {
             $repository = ConfService::getRepositoryByAlias($repoId);
             if ($repository != null) {
                 $parameters["repository_id"] = $repository->getId();
             }
         } else {
             $parameters["repository_id"] = $repository->getId();
         }
         require_once AJXP_BIN_FOLDER . "/class.SystemTextEncoding.php";
         if (AuthService::usersEnabled()) {
             $loggedUser = AuthService::getLoggedUser();
             if ($loggedUser != null && $loggedUser->canSwitchTo($parameters["repository_id"])) {
                 $output["FORCE_REGISTRY_RELOAD"] = true;
                 $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"];
                 $session["PENDING_FOLDER"] = SystemTextEncoding::toUTF8(AJXP_Utils::decodeSecureMagic($parameters["folder"]));
             }
         } else {
             ConfService::switchRootDir($parameters["repository_id"]);
             $output["EXT_REP"] = SystemTextEncoding::toUTF8(urldecode($parameters["folder"]));
         }
     }
     if (isset($parameters["skipDebug"])) {
         ConfService::setConf("JS_DEBUG", false);
     }
     if (ConfService::getConf("JS_DEBUG") && isset($parameters["compile"])) {
         require_once AJXP_BIN_FOLDER . "/class.AJXP_JSPacker.php";
         AJXP_JSPacker::pack();
     }
     if (ConfService::getConf("JS_DEBUG") && isset($parameters["update_i18n"])) {
         if (isset($parameters["extract"])) {
             self::extractConfStringsFromManifests();
         }
         self::updateAllI18nLibraries(isset($parameters["create"]) ? $parameters["create"] : "");
     }
     if (ConfService::getConf("JS_DEBUG") && isset($parameters["clear_plugins_cache"])) {
         @unlink(AJXP_PLUGINS_CACHE_FILE);
         @unlink(AJXP_PLUGINS_REQUIRES_FILE);
     }
     if (AJXP_SERVER_DEBUG && isset($parameters["extract_application_hooks"])) {
         self::extractHooksToDoc();
     }
     if (isset($parameters["external_selector_type"])) {
         $output["SELECTOR_DATA"] = array("type" => $parameters["external_selector_type"], "data" => $parameters);
     }
     if (isset($parameters["skipIOS"])) {
         setcookie("SKIP_IOS", "true");
     }
     if (isset($parameters["skipANDROID"])) {
         setcookie("SKIP_ANDROID", "true");
     }
     if (isset($parameters["gui"])) {
         setcookie("AJXP_GUI", $parameters["gui"]);
         if ($parameters["gui"] == "light") {
             $session["USE_EXISTING_TOKEN_IF_EXISTS"] = true;
         }
     } else {
         if (isset($session["USE_EXISTING_TOKEN_IF_EXISTS"])) {
             unset($session["USE_EXISTING_TOKEN_IF_EXISTS"]);
         }
         setcookie("AJXP_GUI", null);
     }
     if (isset($session["OVERRIDE_GUI_START_PARAMETERS"])) {
         $output = array_merge($output, $session["OVERRIDE_GUI_START_PARAMETERS"]);
     }
 }
예제 #12
0
 public static function parseApplicationGetParameters($parameters, &$output, &$session)
 {
     $output["EXT_REP"] = "/";
     if (isset($parameters["repository_id"]) && isset($parameters["folder"])) {
         require_once "server/classes/class.SystemTextEncoding.php";
         if (AuthService::usersEnabled()) {
             $loggedUser = AuthService::getLoggedUser();
             if ($loggedUser != null && $loggedUser->canSwitchTo($parameters["repository_id"])) {
                 $output["EXT_REP"] = SystemTextEncoding::toUTF8(urldecode($parameters["folder"]));
                 $loggedUser->setArrayPref("history", "last_repository", $parameters["repository_id"]);
                 $loggedUser->setPref("pending_folder", AJXP_Utils::decodeSecureMagic($parameters["folder"]));
                 $loggedUser->save();
                 AuthService::updateUser($loggedUser);
             } else {
                 $session["PENDING_REPOSITORY_ID"] = $parameters["repository_id"];
                 $session["PENDING_FOLDER"] = AJXP_Utils::decodeSecureMagic($parameters["folder"]);
             }
         } else {
             ConfService::switchRootDir($parameters["repository_id"]);
             $output["EXT_REP"] = SystemTextEncoding::toUTF8(urldecode($parameters["folder"]));
         }
     }
     if (isset($parameters["skipDebug"])) {
         ConfService::setConf("JS_DEBUG", false);
     }
     if (ConfService::getConf("JS_DEBUG") && isset($parameters["compile"])) {
         require_once SERVER_RESOURCES_FOLDER . "/class.AJXP_JSPacker.php";
         AJXP_JSPacker::pack();
     }
     if (ConfService::getConf("JS_DEBUG") && isset($parameters["update_i18n"])) {
         AJXP_Utils::updateI18nFiles(isset($parameters["plugin_path"]) ? $parameters["plugin_path"] : "");
     }
     if (isset($parameters["external_selector_type"])) {
         $output["SELECTOR_DATA"] = array("type" => $parameters["external_selector_type"], "data" => $parameters);
     }
 }