本文整理汇总了PHP中Repository::getOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::getOption方法的具体用法?PHP Repository::getOption怎么用?PHP Repository::getOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Repository
的用法示例。
在下文中一共展示了Repository::getOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initRepository
public function initRepository()
{
if (is_array($this->pluginConf)) {
$this->driverConf = $this->pluginConf;
} else {
$this->driverConf = array();
}
$smbclientPath = $this->driverConf["SMBCLIENT"];
define('SMB4PHP_SMBCLIENT', $smbclientPath);
$smbtmpPath = $this->driverConf["SMB_PATH_TMP"];
define('SMB4PHP_SMBTMP', $smbtmpPath);
require_once $this->getBaseDir() . "/smb.php";
$create = $this->repository->getOption("CREATE");
$recycle = $this->repository->getOption("RECYCLE_BIN");
$this->detectStreamWrapper(true);
$this->urlBase = "pydio://" . $this->repository->getId();
if ($recycle != "" && !is_dir($this->urlBase . "/" . $recycle)) {
@mkdir($this->urlBase . "/" . $recycle);
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!");
}
}
if ($recycle != "") {
RecycleBinManager::init($this->urlBase, "/" . $recycle);
}
}
示例2: doRepositoryTest
/**
* Test Repository
*
* @param Repository $repo
* @return Boolean
*/
public function doRepositoryTest($repo)
{
if ($repo->accessType != 'fs') {
return -1;
}
// Check the destination path
$this->failedInfo = "";
$safePath = $repo->getOption("PATH", true);
if (strstr($safePath, "AJXP_USER") !== false) {
return TRUE;
}
// CANNOT TEST THIS CASE!
$path = $repo->getOption("PATH", false);
$createOpt = $repo->getOption("CREATE");
$create = $createOpt == "true" || $createOpt === true ? true : false;
if (!$create && !@is_dir($path)) {
$this->failedInfo .= "Selected repository path " . $path . " doesn't exist, and the CREATE option is false";
return FALSE;
}
/* else if ($create && !is_writeable($path)) {
$this->failedInfo .= "Selected repository path ".$path." isn't writeable"; return FALSE;
}*/
// Do more tests here
return TRUE;
}
示例3: initRepository
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);
}
}
示例4: initRepository
function initRepository()
{
if (is_array($this->pluginConf)) {
$this->driverConf = $this->pluginConf;
} else {
$this->driverConf = array();
}
$wrapperData = $this->detectStreamWrapper(true);
AJXP_Logger::debug("Detected wrapper data", $wrapperData);
$this->wrapperClassName = $wrapperData["classname"];
$this->urlBase = $wrapperData["protocol"] . "://" . $this->repository->getId();
$consumerKey = $this->repository->getOption("CONSUMER_KEY");
$consumerSecret = $this->repository->getOption("CONSUMER_SECRET");
$oauth = new Dropbox_OAuth_PEAR($consumerKey, $consumerSecret);
// TOKENS IN SESSION?
if (!empty($_SESSION["OAUTH_DROPBOX_TOKENS"])) {
return;
}
// TOKENS IN FILE ?
$tokens = $this->getTokens($this->repository->getId());
if (!empty($tokens)) {
$_SESSION["OAUTH_DROPBOX_TOKENS"] = $tokens;
return;
}
// OAUTH NEGOCIATION
if (isset($_SESSION['DROPBOX_NEGOCIATION_STATE'])) {
$state = $_SESSION['DROPBOX_NEGOCIATION_STATE'];
} else {
$state = 1;
}
switch ($state) {
case 1:
$tokens = $oauth->getRequestToken();
//print_r($tokens);
// Note that if you want the user to automatically redirect back, you can
// add the 'callback' argument to getAuthorizeUrl.
//echo "Step 2: You must now redirect the user to:\n";
$_SESSION['DROPBOX_NEGOCIATION_STATE'] = 2;
$_SESSION['oauth_tokens'] = $tokens;
throw new Exception("Please go to <a style=\"text-decoration:underline;\" target=\"_blank\" href=\"" . $oauth->getAuthorizeUrl() . "\">" . $oauth->getAuthorizeUrl() . "</a> to authorize the access to your dropbox. Then try again to switch to this repository.");
case 2:
$oauth->setToken($_SESSION['oauth_tokens']);
$tokens = $oauth->getAccessToken();
$_SESSION['DROPBOX_NEGOCIATION_STATE'] = 3;
$_SESSION['OAUTH_DROPBOX_TOKENS'] = $tokens;
$this->setTokens($this->repository->getId(), $tokens);
return;
}
throw new Exception("Impossible to find the tokens for accessing the dropbox repository");
}
示例5: initRepository
/**
* 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();
}
示例6: delete
public function delete($selectedFiles, &$logMessages)
{
$repoData = array('base_url' => $this->urlBase, 'chmod' => $this->repository->getOption('CHMOD_VALUE'), 'recycle' => $this->repository->getOption('RECYCLE_BIN'));
$mess = ConfService::getMessages();
foreach ($selectedFiles as $selectedFile) {
if ($selectedFile == "" || $selectedFile == DIRECTORY_SEPARATOR) {
return $mess[120];
}
$fileToDelete = $this->urlBase . $selectedFile;
if (!file_exists($fileToDelete)) {
$logMessages[] = $mess[100] . " " . SystemTextEncoding::toUTF8($selectedFile);
continue;
}
$node = new AJXP_Node($fileToDelete);
$node->setLeaf(!is_dir($fileToDelete));
$this->deldir($fileToDelete, $repoData);
if ($node->isLeaf()) {
$logMessages[] = "{$mess['38']} " . SystemTextEncoding::toUTF8($selectedFile) . " {$mess['44']}.";
} else {
$logMessages[] = "{$mess['34']} " . SystemTextEncoding::toUTF8($selectedFile) . " {$mess['44']}.";
}
AJXP_Controller::applyHook("node.change", [$node]);
}
return null;
}
示例7: deldir
function deldir($location)
{
if (is_dir($location)) {
$all = opendir($location);
while ($file = readdir($all)) {
if (is_dir("{$location}/{$file}") && $file != ".." && $file != ".") {
$this->deldir("{$location}/{$file}");
if (file_exists("{$location}/{$file}")) {
rmdir("{$location}/{$file}");
}
unset($file);
} elseif (!is_dir("{$location}/{$file}")) {
if (file_exists("{$location}/{$file}")) {
unlink("{$location}/{$file}");
}
unset($file);
}
}
closedir($all);
rmdir($location);
} else {
if (file_exists("{$location}")) {
$test = @unlink("{$location}");
if (!$test) {
throw new Exception("Cannot delete file " . $location);
}
}
}
if (basename(dirname($location)) == $this->repository->getOption("RECYCLE_BIN")) {
// DELETING FROM RECYCLE
RecycleBinManager::deleteFromRecycle($location);
}
}
示例8: initRepository
function initRepository()
{
if (is_array($this->pluginConf)) {
$this->driverConf = $this->pluginConf;
} else {
$this->driverConf = array();
}
$smbclientPath = $this->driverConf["SMBCLIENT"];
define('SMB4PHP_SMBCLIENT', $smbclientPath);
require_once $this->getBaseDir() . "/smb.php";
$create = $this->repository->getOption("CREATE");
$recycle = $this->repository->getOption("RECYCLE_BIN");
$wrapperData = $this->detectStreamWrapper(true);
$this->wrapperClassName = $wrapperData["classname"];
$this->urlBase = $wrapperData["protocol"] . "://" . $this->repository->getId();
}
示例9: initRepository
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);
}
}
示例10: initRepository
public function initRepository()
{
if (is_array($this->pluginConf)) {
$this->driverConf = $this->pluginConf;
} else {
$this->driverConf = array();
}
$this->detectStreamWrapper(true);
$this->urlBase = "pydio://" . $this->repository->getId();
if ($this->repository->getOption("MAILBOX") != "") {
//$this->urlBase .= "/INBOX";
}
/*
if (!file_exists($this->urlBase)) {
throw new AJXP_Exception("Cannot find base path for your repository! Please check the configuration!");
}
*/
}
示例11: initRepository
public function initRepository()
{
include_once "libraryLoader.php";
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);
}
}
示例12: initRepository
/**
* Repository Initialization
*
*/
public function initRepository()
{
$this->detectStreamWrapper(true);
if (is_array($this->pluginConf)) {
$this->driverConf = $this->pluginConf;
} else {
$this->driverConf = array();
}
$client = new Client(['base_url' => $this->repository->getOption("HOST")]);
// Params
$recycle = $this->repository->getOption("RECYCLE_BIN");
// Config
ConfService::setConf("PROBE_REAL_SIZE", false);
$this->urlBase = "pydio://" . $this->repository->getId();
if ($recycle != "") {
RecycleBinManager::init($this->urlBase, "/" . $recycle);
}
}
示例13: getClientForRepository
/**
* @param Repository $repoObject
* @param boolean $registerStream
* @return \AccessS3\S3Client
*/
protected static function getClientForRepository($repoObject, $registerStream = true)
{
require_once "aws.phar";
if (!isset(self::$clients[$repoObject->getId()])) {
// Get a client
$options = array('key' => $repoObject->getOption("API_KEY"), 'secret' => $repoObject->getOption("SECRET_KEY"));
$signatureVersion = $repoObject->getOption("SIGNATURE_VERSION");
if (!empty($signatureVersion)) {
$options['signature'] = $signatureVersion;
}
$baseURL = $repoObject->getOption("STORAGE_URL");
if (!empty($baseURL)) {
$options["base_url"] = $baseURL;
}
$region = $repoObject->getOption("REGION");
if (!empty($region)) {
$options["region"] = $region;
}
$proxy = $repoObject->getOption("PROXY");
if (!empty($proxy)) {
$options['request.options'] = array('proxy' => $proxy);
}
$apiVersion = $repoObject->getOption("API_VERSION");
if ($apiVersion === "") {
$apiVersion = "latest";
}
//SDK_VERSION IS A GLOBAL PARAM
ConfService::getConfStorageImpl()->_loadPluginConfig("access.s3", $globalOptions);
$sdkVersion = $globalOptions["SDK_VERSION"];
//$repoObject->driverInstance->driverConf['SDK_VERSION'];
if ($sdkVersion !== "v2" && $sdkVersion !== "v3") {
$sdkVersion = "v2";
}
if ($sdkVersion === "v3") {
require_once __DIR__ . DIRECTORY_SEPARATOR . "class.pydioS3Client.php";
$s3Client = new \AccessS3\S3Client(["version" => $apiVersion, "region" => $region, "credentials" => $options]);
$s3Client->registerStreamWrapper($repoObject->getId());
} else {
$s3Client = Aws\S3\S3Client::factory($options);
if ($repoObject->getOption("VHOST_NOT_SUPPORTED")) {
// Use virtual hosted buckets when possible
require_once "ForcePathStyleListener.php";
$s3Client->addSubscriber(new \Aws\S3\ForcePathStyleStyleListener());
}
$s3Client->registerStreamWrapper();
}
self::$clients[$repoObject->getId()] = $s3Client;
}
return self::$clients[$repoObject->getId()];
}
示例14: constructed
/** Cypher the publiclet object data and write to disk.
@param $data The publiclet data array to write
The data array must have the following keys:
- DRIVER The driver used to get the file's content
- OPTIONS The driver options to be successfully constructed (usually, the user and password)
- FILE_PATH The path to the file's content
- PASSWORD If set, the written publiclet will ask for this password before sending the content
- ACTION If set, action to perform
- USER If set, the AJXP user
- EXPIRE_TIME If set, the publiclet will deny downloading after this time, and probably self destruct.
@return the URL to the downloaded file
*/
function writePubliclet($data)
{
if (!defined('PUBLIC_DOWNLOAD_FOLDER') || !is_dir(PUBLIC_DOWNLOAD_FOLDER)) {
return "ERROR : Public URL folder does not exist!";
}
if (!function_exists("mcrypt_create_iv")) {
return "ERROR : MCrypt must be installed to use publiclets!";
}
if ($data["PASSWORD"] && !is_file(PUBLIC_DOWNLOAD_FOLDER . "/allz.css")) {
@copy(INSTALL_PATH . "/" . AJXP_THEME_FOLDER . "/css/allz.css", PUBLIC_DOWNLOAD_FOLDER . "/allz.css");
@copy(INSTALL_PATH . "/" . AJXP_THEME_FOLDER . "/images/actions/22/dialog_ok_apply.png", PUBLIC_DOWNLOAD_FOLDER . "/dialog_ok_apply.png");
@copy(INSTALL_PATH . "/" . AJXP_THEME_FOLDER . "/images/actions/16/public_url.png", PUBLIC_DOWNLOAD_FOLDER . "/public_url.png");
}
if (!is_file(PUBLIC_DOWNLOAD_FOLDER . "/index.html")) {
@copy(INSTALL_PATH . "/server/index.html", PUBLIC_DOWNLOAD_FOLDER . "/index.html");
}
$data["PLUGIN_ID"] = $this->id;
$data["BASE_DIR"] = $this->baseDir;
$data["REPOSITORY"] = $this->repository;
if (AuthService::usersEnabled()) {
$data["OWNER_ID"] = AuthService::getLoggedUser()->getId();
}
// Force expanded path in publiclet
$data["REPOSITORY"]->addOption("PATH", $this->repository->getOption("PATH"));
if ($data["ACTION"] == "") {
$data["ACTION"] = "download";
}
// Create a random key
$data["FINAL_KEY"] = md5(mt_rand() . time());
// Cypher the data with a random key
$outputData = serialize($data);
// Hash the data to make sure it wasn't modified
$hash = md5($outputData);
// The initialisation vector is only required to avoid a warning, as ECB ignore IV
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND);
// We have encoded as base64 so if we need to store the result in a database, it can be stored in text column
$outputData = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $hash, $outputData, MCRYPT_MODE_ECB, $iv));
// Okay, write the file:
$fileData = "<" . "?" . "php \n" . ' require_once("' . str_replace("\\", "/", INSTALL_PATH) . '/publicLet.inc.php"); ' . "\n" . ' $id = str_replace(".php", "", basename(__FILE__)); ' . "\n" . ' $cypheredData = base64_decode("' . $outputData . '"); ' . "\n" . ' $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND); ' . "\n" . ' $inputData = trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $id, $cypheredData, MCRYPT_MODE_ECB, $iv)); ' . "\n" . ' if (md5($inputData) != $id) { header("HTTP/1.0 401 Not allowed, script was modified"); exit(); } ' . "\n" . ' // Ok extract the data ' . "\n" . ' $data = unserialize($inputData); AbstractAccessDriver::loadPubliclet($data); ?' . '>';
if (@file_put_contents(PUBLIC_DOWNLOAD_FOLDER . "/" . $hash . ".php", $fileData) === FALSE) {
return "Can't write to PUBLIC URL";
}
require_once INSTALL_PATH . "/server/classes/class.PublicletCounter.php";
PublicletCounter::reset($hash);
if (defined('PUBLIC_DOWNLOAD_URL') && PUBLIC_DOWNLOAD_URL != "") {
return rtrim(PUBLIC_DOWNLOAD_URL, "/") . "/" . $hash . ".php";
} else {
$http_mode = !empty($_SERVER['HTTPS']) ? 'https://' : 'http://';
$fullUrl = $http_mode . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']);
return str_replace("\\", "/", $fullUrl . rtrim(str_replace(INSTALL_PATH, "", PUBLIC_DOWNLOAD_FOLDER), "/") . "/" . $hash . ".php");
}
}
示例15: getTokens
public function getTokens()
{
if ($this->repository->getOption("DROPBOX_OAUTH_TOKENS") !== null && is_array($this->repository->getOption("DROPBOX_OAUTH_TOKENS"))) {
return $this->repository->getOption("DROPBOX_OAUTH_TOKENS");
}
$repositoryId = $this->repository->getId();
if (AuthService::usersEnabled()) {
$u = AuthService::getLoggedUser();
$userId = $u->getId();
if ($u->getResolveAsParent()) {
$userId = $u->getParent();
}
} else {
$userId = "shared";
}
return AJXP_Utils::loadSerialFile(AJXP_DATA_PATH . "/plugins/access.dropbox/" . $repositoryId . "_" . $userId . "_tokens");
}