当前位置: 首页>>代码示例>>PHP>>正文


PHP AJXP_Utils类代码示例

本文整理汇总了PHP中AJXP_Utils的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Utils类的具体用法?PHP AJXP_Utils怎么用?PHP AJXP_Utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AJXP_Utils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initPath

 /**
  * Initialize the stream from the given path. 
  * Concretely, transform ajxp.webdav:// into webdav://
  *
  * @param string $path
  * @return mixed Real path or -1 if currentListing contains the listing : original path converted to real path
  */
 protected static function initPath($path, $streamType, $storeOpenContext = false, $skipZip = false)
 {
     $url = parse_url($path);
     $repoId = $url["host"];
     $repoObject = ConfService::getRepositoryById($repoId);
     if (!isset($repoObject)) {
         throw new Exception("Cannot find repository with id " . $repoId);
     }
     $path = $url["path"];
     $host = $repoObject->getOption("HOST");
     $host = str_replace(array("http", "https"), array("webdav", "webdavs"), $host);
     // MAKE SURE THERE ARE NO // OR PROBLEMS LIKE THAT...
     $basePath = $repoObject->getOption("PATH");
     if ($basePath[strlen($basePath) - 1] == "/") {
         $basePath = substr($basePath, 0, -1);
     }
     if ($basePath[0] != "/") {
         $basePath = "/{$basePath}";
     }
     $path = AJXP_Utils::securePath($path);
     if ($path[0] == "/") {
         $path = substr($path, 1);
     }
     // SHOULD RETURN webdav://host_server/uri/to/webdav/folder
     return $host . $basePath . "/" . $path;
 }
开发者ID:BackupTheBerlios,项目名称:ascore,代码行数:33,代码来源:class.webdavAccessWrapper.php

示例2: initFromArray

 function initFromArray($array)
 {
     if (!is_array($array)) {
         return;
     }
     if (isset($array[$this->varPrefix]) && $array[$this->varPrefix] != "") {
         $this->files[] = AJXP_Utils::securePath(SystemTextEncoding::fromPostedFileName($array[$this->varPrefix]));
         $this->isUnique = true;
         //return ;
     }
     if (isset($array[$this->varPrefix . "_0"])) {
         $index = 0;
         while (isset($array[$this->varPrefix . "_" . $index])) {
             $this->files[] = AJXP_Utils::securePath(SystemTextEncoding::fromPostedFileName($array[$this->varPrefix . "_" . $index]));
             $index++;
         }
         $this->isUnique = false;
         if (count($this->files) == 1) {
             $this->isUnique = true;
         }
         //return ;
     }
     if (isset($array[$this->dirPrefix])) {
         $this->dir = AJXP_Utils::securePath($array[$this->dirPrefix]);
         if ($test = $this->detectZip($this->dir)) {
             $this->inZip = true;
             $this->zipFile = $test[0];
             $this->localZipPath = $test[1];
         }
     }
 }
开发者ID:umbecr,项目名称:camilaframework,代码行数:31,代码来源:class.UserSelection.php

示例3: isEnabled

 function isEnabled()
 {
     if (AJXP_Utils::detectApplicationFirstRun()) {
         return false;
     }
     return parent::isEnabled();
 }
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:7,代码来源:class.SessionLoginFrontend.php

示例4: switchActions

 public function switchActions($actionName, $httpVars, $fileVars)
 {
     switch ($actionName) {
         case "accept_invitation":
             $remoteShareId = \AJXP_Utils::sanitize($httpVars["remote_share_id"], AJXP_SANITIZE_ALPHANUM);
             $store = new SQLStore();
             $remoteShare = $store->remoteShareById($remoteShareId);
             if ($remoteShare !== null) {
                 $client = new OCSClient();
                 $client->acceptInvitation($remoteShare);
                 $remoteShare->setStatus(OCS_INVITATION_STATUS_ACCEPTED);
                 $store->storeRemoteShare($remoteShare);
             }
             break;
         case "reject_invitation":
             $remoteShareId = \AJXP_Utils::sanitize($httpVars["remote_share_id"], AJXP_SANITIZE_ALPHANUM);
             $store = new SQLStore();
             $remoteShare = $store->remoteShareById($remoteShareId);
             if ($remoteShare !== null) {
                 $client = new OCSClient();
                 $client->declineInvitation($remoteShare);
                 $store->deleteRemoteShare($remoteShare);
                 \ConfService::getInstance()->invalidateLoadedRepositories();
             }
             break;
         default:
             break;
     }
     return null;
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:30,代码来源:ActionsController.php

示例5: __construct

 /**
  * Initialize an empty mask, or from a serializedForm.
  * @param array|null $serializedForm
  */
 function __construct($serializedForm = null)
 {
     if ($serializedForm != null) {
         foreach ($serializedForm as $path => $permissionValue) {
             $path = AJXP_Utils::sanitize(AJXP_Utils::securePath($path), AJXP_SANITIZE_DIRNAME);
             if (!is_array($permissionValue) || $permissionValue["children"]) {
                 continue;
             }
             $perm = new AJXP_Permission();
             if ($permissionValue["read"]) {
                 $perm->setRead();
             }
             if ($permissionValue["write"]) {
                 $perm->setWrite();
             }
             if ($permissionValue["deny"]) {
                 $perm->setDeny();
             }
             if ($perm->isEmpty()) {
                 continue;
             }
             $this->updateBranch($path, $perm);
         }
     }
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:29,代码来源:class.AJXP_PermissionMask.php

示例6: initInst

 /**
  * Load the boostrap_* files and their configs
  * @return void
  */
 public function initInst()
 {
     include AJXP_CONF_PATH . "/bootstrap_plugins.php";
     // INIT AS GLOBAL
     $this->configs["AVAILABLE_LANG"] = self::listAvailableLanguages();
     if (isset($_SERVER["HTTPS"]) && strtolower($_SERVER["HTTPS"]) == "on") {
         $this->configs["USE_HTTPS"] = true;
     }
     if (isset($this->configs["USE_HTTPS"])) {
         AJXP_Utils::safeIniSet("session.cookie_secure", true);
     }
     $this->configs["JS_DEBUG"] = AJXP_CLIENT_DEBUG;
     $this->configs["SERVER_DEBUG"] = AJXP_SERVER_DEBUG;
     if (isset($PLUGINS)) {
         $this->configs["PLUGINS"] = $PLUGINS;
     } else {
         /* OLD SYNTAX */
         $this->configs["AUTH_DRIVER_DEF"] = $AUTH_DRIVER;
         $this->configs["LOG_DRIVER_DEF"] = $LOG_DRIVER;
         $this->configs["CONF_PLUGINNAME"] = $CONF_STORAGE["NAME"];
         $this->configs["PLUGINS"] = array("CONF_DRIVER" => $CONF_STORAGE, "AUTH_DRIVER" => $AUTH_DRIVER, "LOG_DRIVER" => $LOG_DRIVER);
     }
     if (is_file(AJXP_CONF_PATH . "/bootstrap_repositories.php")) {
         include AJXP_CONF_PATH . "/bootstrap_repositories.php";
         $this->configs["DEFAULT_REPOSITORIES"] = $REPOSITORIES;
     } else {
         $this->configs["DEFAULT_REPOSITORIES"] = array();
     }
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:33,代码来源:class.ConfService.php

示例7: postProcess

 public function postProcess($action, $httpVars, $params)
 {
     $jsonData = json_decode($params["ob_output"], true);
     if ($jsonData != false) {
         $url = $jsonData["publiclet_link"];
         $elementId = $jsonData["element_id"];
     } else {
         $url = $params["ob_output"];
         $elementId = -1;
     }
     $BITLY_USER = $this->getFilteredOption("BITLY_USER");
     $BITLY_APIKEY = $this->getFilteredOption("BITLY_APIKEY");
     if (empty($BITLY_USER) || empty($BITLY_APIKEY)) {
         print $url;
         $this->logError("Config", "Bitly Shortener : you must drop the conf.shorten.bitly.inc file inside conf.php and set the login/api key!");
         return;
     }
     $bitly_login = $BITLY_USER;
     $bitly_api = $BITLY_APIKEY;
     $format = 'json';
     $version = '2.0.1';
     $bitly = 'http://api.bit.ly/shorten?version=' . $version . '&longUrl=' . urlencode($url) . '&login=' . $bitly_login . '&apiKey=' . $bitly_api . '&format=' . $format;
     $response = AJXP_Utils::getRemoteContent($bitly);
     $json = json_decode($response, true);
     if (isset($json['results'][$url]['shortUrl'])) {
         print $json['results'][$url]['shortUrl'];
         $this->updateMetaShort($httpVars["file"], $elementId, $json['results'][$url]['shortUrl']);
     } else {
         print $url;
     }
 }
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:31,代码来源:class.BitlyShortener.php

示例8: switchAction

 public function switchAction($action, $httpVars, $filesVars)
 {
     if (!isset($this->actions[$action])) {
         return false;
     }
     $repository = ConfService::getRepository();
     if (!$repository->detectStreamWrapper(true)) {
         return false;
     }
     $streamData = $repository->streamData;
     $destStreamURL = $streamData["protocol"] . "://" . $repository->getId();
     if ($action == "post_to_server") {
         $file = base64_decode(AJXP_Utils::decodeSecureMagic($httpVars["file"]));
         $target = base64_decode($httpVars["parent_url"]) . "/plugins/editor.pixlr";
         $tmp = call_user_func(array($streamData["classname"], "getRealFSReference"), $destStreamURL . $file);
         $fData = array("tmp_name" => $tmp, "name" => urlencode(basename($file)), "type" => "image/jpg");
         $httpClient = new HttpClient("pixlr.com");
         //$httpClient->setDebug(true);
         $postData = array();
         $httpClient->setHandleRedirects(false);
         $params = array("referrer" => "AjaXplorer", "method" => "get", "loc" => ConfService::getLanguage(), "target" => $target . "/fake_save_pixlr.php", "exit" => $target . "/fake_close_pixlr.php", "title" => urlencode(basename($file)), "locktarget" => "false", "locktitle" => "true", "locktype" => "source");
         $httpClient->postFile("/editor/", $params, "image", $fData);
         $loc = $httpClient->getHeader("location");
         header("Location:{$loc}");
     } else {
         if ($action == "retrieve_pixlr_image") {
             $file = AJXP_Utils::decodeSecureMagic($httpVars["original_file"]);
             $url = $httpVars["new_url"];
             $urlParts = parse_url($url);
             $query = $urlParts["query"];
             $params = array();
             $parameters = parse_str($query, $params);
             $image = $params['image'];
             /*
             $type = $params['type'];
             $state = $params['state'];
             $filename = $params['title'];		
             */
             if (strpos($image, "pixlr.com") == 0) {
                 throw new AJXP_Exception("Invalid Referrer");
             }
             $headers = get_headers($image, 1);
             $content_type = explode("/", $headers['Content-Type']);
             if ($content_type[0] != "image") {
                 throw new AJXP_Exception("File Type");
             }
             $orig = fopen($image, "r");
             $target = fopen($destStreamURL . $file, "w");
             while (!feof($orig)) {
                 fwrite($target, fread($orig, 4096));
             }
             fclose($orig);
             fclose($target);
             header("Content-Type:text/plain");
             print $mess[115];
         }
     }
     return;
 }
开发者ID:firstcoder55,项目名称:Webkey,代码行数:59,代码来源:class.PixlrEditor.php

示例9: saveBootstrapConf

 public static function saveBootstrapConf($jsonData)
 {
     $jsonPath = self::_getBootstrapFilePath();
     if (file_exists($jsonPath)) {
         copy($jsonPath, $jsonPath . ".bak");
     }
     AJXP_Utils::saveSerialFile($jsonPath, $jsonData, true, false, "json", true);
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:8,代码来源:class.CoreConfLoader.php

示例10: tryToLogUser

 function tryToLogUser(&$httpVars, $isLast = false)
 {
     if (!isset($httpVars["get_action"]) || $httpVars["get_action"] != "login") {
         return false;
     }
     $rememberLogin = "";
     $rememberPass = "";
     $secureToken = "";
     $loggedUser = null;
     include_once AJXP_BIN_FOLDER . "/class.CaptchaProvider.php";
     if (AuthService::suspectBruteForceLogin() && (!isset($httpVars["captcha_code"]) || !CaptchaProvider::checkCaptchaResult($httpVars["captcha_code"]))) {
         $loggingResult = -4;
     } else {
         $userId = isset($httpVars["userid"]) ? AJXP_Utils::sanitize($httpVars["userid"], AJXP_SANITIZE_EMAILCHARS) : null;
         $userPass = isset($httpVars["password"]) ? trim($httpVars["password"]) : null;
         $rememberMe = isset($httpVars["remember_me"]) && $httpVars["remember_me"] == "true" ? true : false;
         $cookieLogin = isset($httpVars["cookie_login"]) ? true : false;
         $loggingResult = AuthService::logUser($userId, $userPass, false, $cookieLogin, $httpVars["login_seed"]);
         if ($rememberMe && $loggingResult == 1) {
             $rememberLogin = "notify";
             $rememberPass = "notify";
         }
         if ($loggingResult == 1) {
             session_regenerate_id(true);
             $secureToken = AuthService::generateSecureToken();
         }
         if ($loggingResult < 1 && AuthService::suspectBruteForceLogin()) {
             $loggingResult = -4;
             // Force captcha reload
         }
     }
     $loggedUser = AuthService::getLoggedUser();
     if ($loggedUser != null) {
         $force = $loggedUser->mergedRole->filterParameterValue("core.conf", "DEFAULT_START_REPOSITORY", AJXP_REPO_SCOPE_ALL, -1);
         $passId = -1;
         if (isset($httpVars["tmp_repository_id"])) {
             $passId = $httpVars["tmp_repository_id"];
         } else {
             if ($force != "" && $loggedUser->canSwitchTo($force) && !isset($httpVars["tmp_repository_id"]) && !isset($_SESSION["PENDING_REPOSITORY_ID"])) {
                 $passId = $force;
             }
         }
         $res = ConfService::switchUserToActiveRepository($loggedUser, $passId);
         if (!$res) {
             AuthService::disconnect();
             $loggingResult = -3;
         }
     }
     if ($loggedUser != null && (AuthService::hasRememberCookie() || isset($rememberMe) && $rememberMe == true)) {
         AuthService::refreshRememberCookie($loggedUser);
     }
     AJXP_XMLWriter::header();
     AJXP_XMLWriter::loggingResult($loggingResult, $rememberLogin, $rememberPass, $secureToken);
     AJXP_XMLWriter::close();
     if ($loggingResult > 0 || $isLast) {
         exit;
     }
 }
开发者ID:ad-m,项目名称:pydio-core,代码行数:58,代码来源:class.SessionLoginFrontend.php

示例11: filterData

 private function filterData(&$data)
 {
     $confMaxSize = AJXP_Utils::convertBytes($data["UPLOAD_MAX_SIZE"]);
     $UploadMaxSize = min(AJXP_Utils::convertBytes(ini_get('upload_max_filesize')), AJXP_Utils::convertBytes(ini_get('post_max_size')));
     if (intval($confMaxSize) != 0) {
         $UploadMaxSize = min($UploadMaxSize, $confMaxSize);
     }
     $data["UPLOAD_MAX_SIZE"] = $UploadMaxSize;
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:9,代码来源:class.CoreUploaderLoader.php

示例12: switchAction

 public function switchAction($action, $httpVars, $postProcessData)
 {
     if (!isset($this->actions[$action])) {
         return false;
     }
     $repository = ConfService::getRepository();
     if (!$repository->detectStreamWrapper(false)) {
         return false;
     }
     $plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
     $streamData = $plugin->detectStreamWrapper(true);
     $destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . "/";
     if ($action == "audio_proxy") {
         $file = AJXP_Utils::decodeSecureMagic(base64_decode($httpVars["file"]));
         $cType = "audio/" . array_pop(explode(".", $file));
         $localName = basename($file);
         header("Content-Type: " . $cType . "; name=\"" . $localName . "\"");
         header("Content-Length: " . filesize($destStreamURL . $file));
         $stream = fopen("php://output", "a");
         call_user_func(array($streamData["classname"], "copyFileInStream"), $destStreamURL . $file, $stream);
         fflush($stream);
         fclose($stream);
         $node = new AJXP_Node($destStreamURL . $file);
         AJXP_Controller::applyHook("node.read", array($node));
         //exit(1);
     } else {
         if ($action == "ls") {
             if (!isset($httpVars["playlist"])) {
                 // This should not happen anyway, because of the applyCondition.
                 AJXP_Controller::passProcessDataThrough($postProcessData);
                 return;
             }
             // We transform the XML into XSPF
             $xmlString = $postProcessData["ob_output"];
             $xmlDoc = new DOMDocument();
             $xmlDoc->loadXML($xmlString);
             $xElement = $xmlDoc->documentElement;
             header("Content-Type:application/xspf+xml;charset=UTF-8");
             print '<?xml version="1.0" encoding="UTF-8"?>';
             print '<playlist version="1" xmlns="http://xspf.org/ns/0/">';
             print "<trackList>";
             foreach ($xElement->childNodes as $child) {
                 $isFile = $child->getAttribute("is_file") == "true";
                 $label = $child->getAttribute("text");
                 $ar = explode(".", $label);
                 $ext = strtolower(end($ar));
                 if (!$isFile || $ext != "mp3") {
                     continue;
                 }
                 print "<track><location>" . AJXP_SERVER_ACCESS . "?secure_token=" . AuthService::getSecureToken() . "&get_action=audio_proxy&file=" . base64_encode($child->getAttribute("filename")) . "</location><title>" . $label . "</title></track>";
             }
             print "</trackList>";
             AJXP_XMLWriter::close("playlist");
         }
     }
 }
开发者ID:biggtfish,项目名称:cms,代码行数:56,代码来源:class.AudioPreviewer.php

示例13: __destruct

 public function __destruct()
 {
     if (isset($this->channels) && is_array($this->channels)) {
         foreach ($this->channels as $channelName => $data) {
             if (is_array($data)) {
                 AJXP_Utils::saveSerialFile($this->getPluginWorkDir() . "/queues/channel-{$channelName}", $data);
             }
         }
     }
 }
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:10,代码来源:class.AJXP_SqlMessageExchanger.php

示例14: performChecks

 public function performChecks()
 {
     if (AJXP_Utils::userAgentIsIOS() && !isset($_GET["skipIOS"]) && !isset($_COOKIE["SKIP_IOS"])) {
         return;
     }
     if (AJXP_Utils::userAgentIsAndroid() && !isset($_GET["skipANDROID"]) && !isset($_COOKIE["SKIP_ANDROID"])) {
         return;
     }
     throw new Exception("Active only when mobile user agent detected.");
 }
开发者ID:biggtfish,项目名称:cms,代码行数:10,代码来源:class.IOSGuiPlugin.php

示例15: processUserAccessPoint

 public function processUserAccessPoint($action, $httpVars, $fileVars)
 {
     switch ($action) {
         case "user_access_point":
             $uri = explode("/", trim($_SERVER["REQUEST_URI"], "/"));
             array_shift($uri);
             $action = array_shift($uri);
             $this->processSubAction($action, $uri);
             $_SESSION['OVERRIDE_GUI_START_PARAMETERS'] = array("REBASE" => "../../", "USER_GUI_ACTION" => $action);
             AJXP_Controller::findActionAndApply("get_boot_gui", array(), array());
             unset($_SESSION['OVERRIDE_GUI_START_PARAMETERS']);
             break;
         case "reset-password-ask":
             // This is a reset password request, generate a token and store it.
             // Find user by id
             if (AuthService::userExists($httpVars["email"])) {
                 // Send email
                 $userObject = ConfService::getConfStorageImpl()->createUserObject($httpVars["email"]);
                 $email = $userObject->personalRole->filterParameterValue("core.conf", "email", AJXP_REPO_SCOPE_ALL, "");
                 if (!empty($email)) {
                     $uuid = AJXP_Utils::generateRandomString(48);
                     ConfService::getConfStorageImpl()->saveTemporaryKey("password-reset", $uuid, AJXP_Utils::decodeSecureMagic($httpVars["email"]), array());
                     $mailer = AJXP_PluginsService::getInstance()->getUniqueActivePluginForType("mailer");
                     if ($mailer !== false) {
                         $mess = ConfService::getMessages();
                         $link = AJXP_Utils::detectServerURL() . "/user/reset-password/" . $uuid;
                         $mailer->sendMail(array($email), $mess["gui.user.1"], $mess["gui.user.7"] . "<a href=\"{$link}\">{$link}</a>");
                     } else {
                         echo 'ERROR: There is no mailer configured, please contact your administrator';
                     }
                 }
             }
             // Prune existing expired tokens
             ConfService::getConfStorageImpl()->pruneTemporaryKeys("password-reset", 20);
             echo "SUCCESS";
             break;
         case "reset-password":
             ConfService::getConfStorageImpl()->pruneTemporaryKeys("password-reset", 20);
             // This is a reset password
             if (isset($httpVars["key"]) && isset($httpVars["user_id"])) {
                 $key = ConfService::getConfStorageImpl()->loadTemporaryKey("password-reset", $httpVars["key"]);
                 if ($key != null && $key["user_id"] == $httpVars["user_id"] && AuthService::userExists($key["user_id"])) {
                     AuthService::updatePassword($key["user_id"], $httpVars["new_pass"]);
                 }
                 ConfService::getConfStorageImpl()->deleteTemporaryKey("password-reset", $httpVars["key"]);
             }
             AuthService::disconnect();
             echo 'SUCCESS';
             break;
         default:
             break;
     }
 }
开发者ID:projectesIF,项目名称:Ateneu,代码行数:53,代码来源:class.UserGuiController.php


注:本文中的AJXP_Utils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。