本文整理汇总了PHP中AJXP_Utils::decypherStandardFormPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Utils::decypherStandardFormPassword方法的具体用法?PHP AJXP_Utils::decypherStandardFormPassword怎么用?PHP AJXP_Utils::decypherStandardFormPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_Utils
的用法示例。
在下文中一共展示了AJXP_Utils::decypherStandardFormPassword方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseUrl
protected function parseUrl($url)
{
// URL MAY BE ajxp.ftp://username:password@host/path
$urlParts = parse_url($url);
$this->repositoryId = $urlParts["host"];
$repository = ConfService::getRepositoryById($this->repositoryId);
// Get USER/PASS
// 1. Try from URL
if (isset($urlParts["user"]) && isset($urlParts["pass"])) {
$this->user = $urlParts["user"];
$this->password = $urlParts["pass"];
}
// 2. Try from user wallet
if (!isset($this->user) || $this->user == "") {
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null) {
$wallet = $loggedUser->getPref("AJXP_WALLET");
if (is_array($wallet) && isset($wallet[$this->repositoryId]["AUTH_USER"])) {
$this->user = $wallet[$this->repositoryId]["AUTH_USER"];
$this->password = AJXP_Utils::decypherStandardFormPassword($loggedUser->getId(), $wallet[$this->repositoryId]["AUTH_PASS"]);
}
}
}
// 3. Try from repository config
if (!isset($this->user) || $this->user == "") {
$this->user = $repository->getOption("AUTH_USER");
$this->password = $repository->getOption("AUTH_PASS");
}
if (!isset($this->user) || $this->user == "") {
throw new AJXP_Exception("Cannot find user/pass for Http access!");
}
$this->host = $repository->getOption("HOST");
$this->path = $repository->getOption("URI");
$this->auth_path = $repository->getOption("AUTH_URI");
$this->use_auth = $repository->getOption("USE_AUTH");
$urlParts["path"] = urlencode($urlParts["path"]);
return $urlParts;
}
示例2: tryLoadingCredentialsFromSources
/**
* Will try to get the credentials for a given repository as follow :
* + Try to get the credentials from the url parsing
* + Try to get them from the user "Wallet" (personal data)
* + Try to get them from the repository configuration
* + Try to get them from the AJXP_Safe.
*
* @param array $parsedUrl
* @param Repository $repository
* @return array
*/
public static function tryLoadingCredentialsFromSources($parsedUrl, $repository)
{
$user = $password = "";
$optionsPrefix = "";
if ($repository->getAccessType() == "ftp") {
$optionsPrefix = "FTP_";
}
// Get USER/PASS
// 1. Try from URL
if (isset($parsedUrl["user"]) && isset($parsedUrl["pass"])) {
$user = rawurldecode($parsedUrl["user"]);
$password = rawurldecode($parsedUrl["pass"]);
}
// 2. Try from user wallet
if ($user == "") {
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null) {
$wallet = $loggedUser->getPref("AJXP_WALLET");
if (is_array($wallet) && isset($wallet[$repository->getId()][$optionsPrefix . "USER"])) {
$user = $wallet[$repository->getId()][$optionsPrefix . "USER"];
$password = AJXP_Utils::decypherStandardFormPassword($loggedUser->getId(), $wallet[$repository->getId()][$optionsPrefix . "PASS"]);
}
}
}
// 2bis. Wallet is now a custom parameter
if ($user == "") {
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null) {
$u = $loggedUser->mergedRole->filterParameterValue("access." . $repository->getAccessType(), $optionsPrefix . "USER", $repository->getId(), "");
$p = $loggedUser->mergedRole->filterParameterValue("access." . $repository->getAccessType(), $optionsPrefix . "PASS", $repository->getId(), "");
if (!empty($u) && !empty($p)) {
$user = $u;
$password = AJXP_Utils::decypherStandardFormPassword($loggedUser->getId(), $p);
}
}
}
// 3. Try from repository config
if ($user == "") {
$user = $repository->getOption($optionsPrefix . "USER");
$password = $repository->getOption($optionsPrefix . "PASS");
}
// 4. Test if there are encoded credentials available
if ($user == "" && $repository->getOption("ENCODED_CREDENTIALS") != "") {
list($user, $password) = AJXP_Safe::getCredentialsFromEncodedString($repository->getOption("ENCODED_CREDENTIALS"));
}
// 5. Try from session
$storeCreds = false;
if ($repository->getOption("META_SOURCES")) {
$options["META_SOURCES"] = $repository->getOption("META_SOURCES");
foreach ($options["META_SOURCES"] as $metaSource) {
if (isset($metaSource["USE_SESSION_CREDENTIALS"]) && $metaSource["USE_SESSION_CREDENTIALS"] === true) {
$storeCreds = true;
break;
}
}
}
if ($user == "" && ($repository->getOption("USE_SESSION_CREDENTIALS") || $storeCreds || self::getInstance()->forceSessionCredentials)) {
$safeCred = AJXP_Safe::loadCredentials();
if ($safeCred !== false) {
$user = $safeCred["user"];
$password = $safeCred["password"];
}
}
return array("user" => $user, "password" => $password);
}