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


PHP AJXP_Utils::safeIniSet方法代码示例

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


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

示例1: 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

示例2: initInst

 /**
  * Load the boostrap_* files and their configs
  * @return void
  */
 public function initInst()
 {
     // 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 (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:rcmarotz,项目名称:pydio-core,代码行数:23,代码来源:class.ConfService.php

示例3: switchAction

 function switchAction($action, $httpVars, $fileVars)
 {
     if (!isset($this->actions[$action])) {
         return;
     }
     if (preg_match('/MSIE 7/', $_SERVER['HTTP_USER_AGENT']) || preg_match('/MSIE 8/', $_SERVER['HTTP_USER_AGENT'])) {
         // Force legacy theme for the moment
         $this->pluginConf["GUI_THEME"] = "oxygen";
     }
     if (!defined("AJXP_THEME_FOLDER")) {
         define("CLIENT_RESOURCES_FOLDER", AJXP_PLUGINS_FOLDER . "/gui.ajax/res");
         define("AJXP_THEME_FOLDER", CLIENT_RESOURCES_FOLDER . "/themes/" . $this->pluginConf["GUI_THEME"]);
     }
     foreach ($httpVars as $getName => $getValue) {
         ${$getName} = AJXP_Utils::securePath($getValue);
     }
     if (isset($dir) && $action != "upload") {
         $dir = SystemTextEncoding::fromUTF8($dir);
     }
     $mess = ConfService::getMessages();
     switch ($action) {
         //------------------------------------
         //	GET AN HTML TEMPLATE
         //------------------------------------
         case "get_template":
             HTMLWriter::charsetHeader();
             $folder = CLIENT_RESOURCES_FOLDER . "/html";
             if (isset($httpVars["pluginName"])) {
                 $folder = AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/" . AJXP_Utils::securePath($httpVars["pluginName"]);
                 if (isset($httpVars["pluginPath"])) {
                     $folder .= "/" . AJXP_Utils::securePath($httpVars["pluginPath"]);
                 }
             }
             $crtTheme = $this->pluginConf["GUI_THEME"];
             $thFolder = AJXP_THEME_FOLDER . "/html";
             if (isset($template_name)) {
                 if (is_file($thFolder . "/" . $template_name)) {
                     include $thFolder . "/" . $template_name;
                 } else {
                     if (is_file($folder . "/" . $template_name)) {
                         include $folder . "/" . $template_name;
                     }
                 }
             }
             break;
             //------------------------------------
             //	GET I18N MESSAGES
             //------------------------------------
         //------------------------------------
         //	GET I18N MESSAGES
         //------------------------------------
         case "get_i18n_messages":
             $refresh = false;
             if (isset($httpVars["lang"])) {
                 ConfService::setLanguage($httpVars["lang"]);
                 $refresh = true;
             }
             HTMLWriter::charsetHeader('text/javascript');
             HTMLWriter::writeI18nMessagesClass(ConfService::getMessages($refresh));
             break;
             //------------------------------------
             //	SEND XML REGISTRY
             //------------------------------------
         //------------------------------------
         //	SEND XML REGISTRY
         //------------------------------------
         case "get_xml_registry":
             $regDoc = AJXP_PluginsService::getXmlRegistry();
             $changes = AJXP_Controller::filterActionsRegistry($regDoc);
             if ($changes) {
                 AJXP_PluginsService::updateXmlRegistry($regDoc);
             }
             if (isset($_GET["xPath"])) {
                 $regPath = new DOMXPath($regDoc);
                 $nodes = $regPath->query($_GET["xPath"]);
                 AJXP_XMLWriter::header("ajxp_registry_part", array("xPath" => $_GET["xPath"]));
                 if ($nodes->length) {
                     print AJXP_XMLWriter::replaceAjxpXmlKeywords($regDoc->saveXML($nodes->item(0)));
                 }
                 AJXP_XMLWriter::close("ajxp_registry_part");
             } else {
                 AJXP_Utils::safeIniSet("zlib.output_compression", "4096");
                 header('Content-Type: application/xml; charset=UTF-8');
                 print AJXP_XMLWriter::replaceAjxpXmlKeywords($regDoc->saveXML());
             }
             break;
             //------------------------------------
             //	DISPLAY DOC
             //------------------------------------
         //------------------------------------
         //	DISPLAY DOC
         //------------------------------------
         case "display_doc":
             HTMLWriter::charsetHeader();
             echo HTMLWriter::getDocFile(AJXP_Utils::securePath(htmlentities($_GET["doc_file"])));
             break;
             //------------------------------------
             //	GET BOOT GUI
             //------------------------------------
         //------------------------------------
//.........这里部分代码省略.........
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:101,代码来源:class.AJXP_ClientDriver.php

示例4: switchAction

 public function switchAction($action, $httpVars, $fileVars)
 {
     if (!isset($this->actions[$action])) {
         return;
     }
     $xmlBuffer = "";
     foreach ($httpVars as $getName => $getValue) {
         ${$getName} = AJXP_Utils::securePath($getValue);
     }
     if (isset($dir) && $action != "upload") {
         $dir = SystemTextEncoding::fromUTF8($dir);
     }
     $mess = ConfService::getMessages();
     switch ($action) {
         //------------------------------------
         //	SWITCH THE ROOT REPOSITORY
         //------------------------------------
         case "switch_repository":
             if (!isset($repository_id)) {
                 break;
             }
             $dirList = ConfService::getRepositoriesList();
             /** @var $repository_id string */
             if (!isset($dirList[$repository_id])) {
                 $errorMessage = "Trying to switch to an unkown repository!";
                 break;
             }
             ConfService::switchRootDir($repository_id);
             // Load try to init the driver now, to trigger an exception
             // if it's not loading right.
             ConfService::loadRepositoryDriver();
             if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
                 $user = AuthService::getLoggedUser();
                 $activeRepId = ConfService::getCurrentRepositoryId();
                 $user->setArrayPref("history", "last_repository", $activeRepId);
                 $user->save("user");
             }
             //$logMessage = "Successfully Switched!";
             $this->logInfo("Switch Repository", array("rep. id" => $repository_id));
             break;
             //------------------------------------
             //	SEND XML REGISTRY
             //------------------------------------
         //------------------------------------
         //	SEND XML REGISTRY
         //------------------------------------
         case "get_xml_registry":
         case "state":
             $regDoc = AJXP_PluginsService::getXmlRegistry();
             $changes = AJXP_Controller::filterRegistryFromRole($regDoc);
             if ($changes) {
                 AJXP_PluginsService::updateXmlRegistry($regDoc);
             }
             $clone = $regDoc->cloneNode(true);
             $clonePath = new DOMXPath($clone);
             $serverCallbacks = $clonePath->query("//serverCallback|hooks");
             foreach ($serverCallbacks as $callback) {
                 $callback->parentNode->removeChild($callback);
             }
             $xPath = '';
             if (isset($httpVars["xPath"])) {
                 $xPath = ltrim(AJXP_Utils::securePath($httpVars["xPath"]), "/");
             }
             if (!empty($xPath)) {
                 $nodes = $clonePath->query($xPath);
                 if ($httpVars["format"] == "json") {
                     $data = AJXP_XMLWriter::xmlToArray($nodes->item(0));
                     HTMLWriter::charsetHeader("application/json");
                     echo json_encode($data);
                 } else {
                     AJXP_XMLWriter::header("ajxp_registry_part", array("xPath" => $xPath));
                     if ($nodes->length) {
                         print AJXP_XMLWriter::replaceAjxpXmlKeywords($clone->saveXML($nodes->item(0)));
                     }
                     AJXP_XMLWriter::close("ajxp_registry_part");
                 }
             } else {
                 AJXP_Utils::safeIniSet("zlib.output_compression", "4096");
                 if ($httpVars["format"] == "json") {
                     $data = AJXP_XMLWriter::xmlToArray($clone);
                     HTMLWriter::charsetHeader("application/json");
                     echo json_encode($data);
                 } else {
                     header('Content-Type: application/xml; charset=UTF-8');
                     print AJXP_XMLWriter::replaceAjxpXmlKeywords($clone->saveXML());
                 }
             }
             break;
             //------------------------------------
             //	BOOKMARK BAR
             //------------------------------------
         //------------------------------------
         //	BOOKMARK BAR
         //------------------------------------
         case "get_bookmarks":
             $bmUser = null;
             if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
                 $bmUser = AuthService::getLoggedUser();
             } else {
                 if (!AuthService::usersEnabled()) {
//.........这里部分代码省略.........
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:101,代码来源:class.AbstractConfDriver.php

示例5: extractExif

 public function extractExif($actionName, $httpVars, $fileVars)
 {
     $repo = $this->accessDriver->repository;
     $userSelection = new UserSelection($this->accessDriver->repository, $httpVars);
     $repo->detectStreamWrapper(true);
     $selectedNode = $userSelection->getUniqueNode();
     $realFile = AJXP_MetaStreamWrapper::getRealFSReference($selectedNode->getUrl());
     AJXP_Utils::safeIniSet('exif.encode_unicode', 'UTF-8');
     $exifData = @exif_read_data($realFile, 0, TRUE);
     if ($exifData === false || !is_array($exifData)) {
         return;
     }
     if ($exifData !== false && isset($exifData["GPS"])) {
         $exifData["COMPUTED_GPS"] = $this->convertGPSData($exifData);
     }
     $iptc = $this->extractIPTC($realFile);
     if (count($iptc)) {
         $exifData["IPTC"] = $iptc;
     }
     $excludeTags = array();
     // array("componentsconfiguration", "filesource", "scenetype", "makernote", "datadump");
     $format = "xml";
     if (isset($httpVars["format"]) && $httpVars["format"] == "json") {
         $format = "json";
     }
     $filteredData = array();
     foreach ($exifData as $section => $data) {
         $filteredData[$section] = array();
         foreach ($data as $key => $value) {
             if (is_array($value)) {
                 $value = implode(",", $value);
             }
             if (in_array(strtolower($key), $excludeTags)) {
                 continue;
             }
             if (strpos($key, "UndefinedTag:") === 0) {
                 continue;
             }
             $value = preg_replace('/[^[:print:]]/', '', $value);
             $filteredData[$section][$key] = SystemTextEncoding::toUTF8($value);
         }
     }
     if ($format == "xml") {
         AJXP_XMLWriter::header("metadata", array("file" => $selectedNode->getPath(), "type" => "EXIF"));
         foreach ($filteredData as $section => $data) {
             print "<exifSection name='{$section}'>";
             foreach ($data as $key => $value) {
                 print "<exifTag name=\"{$key}\">" . AJXP_Utils::xmlEntities($value) . "</exifTag>";
             }
             print "</exifSection>";
         }
         AJXP_XMLWriter::close("metadata");
     } else {
         HTMLWriter::charsetHeader("application/json");
         echo json_encode($filteredData);
     }
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:57,代码来源:class.ExifMetaManager.php

示例6: glob

        return;
    }
    $fileName = AJXP_BIN_FOLDER . "/" . "interface." . $className . ".php";
    if (file_exists($fileName)) {
        require_once $fileName;
        return;
    }
    $corePlugClass = glob(AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/core.*/class." . $className . ".php", GLOB_NOSORT);
    if ($corePlugClass !== false && count($corePlugClass)) {
        require_once $corePlugClass[0];
        return;
    }
    $corePlugInterface = glob(AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/core.*/interface." . $className . ".php", GLOB_NOSORT);
    if ($corePlugInterface !== false && count($corePlugInterface)) {
        require_once $corePlugInterface[0];
        return;
    }
}
spl_autoload_register('AjaXplorer_autoload');
AJXP_Utils::safeIniSet("session.cookie_httponly", 1);
if (is_file(AJXP_CONF_PATH . "/bootstrap_conf.php")) {
    include AJXP_CONF_PATH . "/bootstrap_conf.php";
    if (isset($AJXP_INISET)) {
        foreach ($AJXP_INISET as $key => $value) {
            AJXP_Utils::safeIniSet($key, $value);
        }
    }
    if (defined('AJXP_LOCALE')) {
        setlocale(LC_ALL, AJXP_LOCALE);
    }
}
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:31,代码来源:bootstrap_context.php

示例7: switchAction

 public function switchAction($action, $httpVars, $fileVars)
 {
     if (!isset($this->actions[$action])) {
         return;
     }
     $loggedUser = AuthService::getLoggedUser();
     if (AuthService::usersEnabled() && !$loggedUser->isAdmin()) {
         return;
     }
     require_once AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/action.updater/class.AjaXplorerUpgrader.php";
     if (!empty($this->pluginConf["PROXY_HOST"])) {
         AjaXplorerUpgrader::configureProxy($this->pluginConf["PROXY_HOST"], $this->pluginConf["PROXY_USER"], $this->pluginConf["PROXY_PASS"]);
     }
     switch ($action) {
         case "migrate_metaserial":
             $dryRun = !isset($httpVars["real_run"]);
             AjaXplorerUpgrader::migrateMetaSerialPlugin($httpVars["repository_id"], $dryRun);
             break;
         case "get_upgrade_path":
             header("Content-type: application/json");
             print AjaXplorerUpgrader::getUpgradePath($this->pluginConf["UPDATE_SITE"], "json", $this->pluginConf["UPDATE_CHANNEL"]);
             break;
         case "test_upgrade_scripts":
             if (!AJXP_SERVER_DEBUG || AuthService::getLoggedUser() == null || !AuthService::getLoggedUser()->isAdmin()) {
                 break;
             }
             $upgrader = new AjaXplorerUpgrader("", "", "");
             $upgrader->testUpgradeScripts();
             break;
         case "perform_upgrade":
             AJXP_Utils::safeIniSet("output_buffering", "Off");
             if (AJXP_PACKAGING != "zip") {
                 print "Your installation is managed directly via os packages, you should not upgrade manually.";
                 break;
             }
             $res = AjaXplorerUpgrader::getUpgradePath($this->pluginConf["UPDATE_SITE"], "php", $this->pluginConf["UPDATE_CHANNEL"]);
             if (!count($res["packages"])) {
                 print "No update is necessary!";
                 break;
             }
             include dirname(__FILE__) . "/output_head.html";
             foreach ($res["packages"] as $index => $zipPackage) {
                 print "<div class='main_step'>Applying upgrade " . basename($zipPackage) . "</div>";
                 $u = new AjaXplorerUpgrader($zipPackage, $res["hashes"][$index], $res["hash_method"], explode(",", $this->pluginConf["PRESERVE_FILES"]));
                 $errors = false;
                 while ($u->hasNextStep()) {
                     set_time_limit(180);
                     print "<div class='upgrade_step'><div class='upgrade_title'>" . $u->currentStepTitle . "</div>";
                     $u->execute();
                     if ($u->error != null) {
                         print "<div class='upgrade_result error'>- Error : " . $u->error . "</div>";
                         $errors = true;
                         break;
                     } else {
                         print "<div class='upgrade_result success'>- " . $u->result . "</div>";
                     }
                     print "</div>";
                     // FLUSH OUTPUT, SCROLL DOWN
                     print str_repeat(' ', 300);
                     print '<script type="text/javascript">doScroll();</script>';
                     flush();
                     sleep(0.5);
                 }
                 if ($errors) {
                     break;
                 }
             }
             print '<script type="text/javascript">replaceTop();</script>';
             print str_repeat(' ', 300);
             flush();
             break;
     }
 }
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:73,代码来源:class.UpdateController.php

示例8: initInst

 /**
  * Load the boostrap_* files and their configs
  * @return void
  */
 public function initInst($pluginDirPath)
 {
     // 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 (is_file(AJXP_CONF_PATH . "/bootstrap_repositories.php")) {
         $REPOSITORIES = array();
         include AJXP_CONF_PATH . "/bootstrap_repositories.php";
         $this->configs["DEFAULT_REPOSITORIES"] = $REPOSITORIES;
     } else {
         $this->configs["DEFAULT_REPOSITORIES"] = array();
     }
     // Try to load instance from cache first
     $this->cachePlugin = $this->cachePluginSoftLoad();
     if (AJXP_PluginsService::getInstance()->loadPluginsRegistryFromCache($this->cachePlugin)) {
         return;
     }
     $this->booter = AJXP_PluginsService::getInstance()->softLoad("boot.conf", array());
     $this->confPlugin = $this->confPluginSoftLoad();
     // Loading the registry
     try {
         AJXP_PluginsService::getInstance()->loadPluginsRegistry($pluginDirPath, $this->confPlugin);
     } catch (Exception $e) {
         die("Severe error while loading plugins registry : " . $e->getMessage());
     }
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:37,代码来源:class.ConfService.php

示例9: readFile

 public function readFile($filePathOrData, $headerType = "plain", $localName = "", $data = false, $gzip = null, $realfileSystem = false, $byteOffset = -1, $byteLength = -1)
 {
     if ($gzip === null) {
         $gzip = ConfService::getCoreConf("GZIP_COMPRESSION");
     }
     if (!$realfileSystem && $this->wrapperClassName == "fsAccessWrapper") {
         $originalFilePath = $filePathOrData;
         $filePathOrData = fsAccessWrapper::patchPathForBaseDir($filePathOrData);
     }
     session_write_close();
     restore_error_handler();
     restore_exception_handler();
     set_exception_handler('download_exception_handler');
     set_error_handler('download_exception_handler');
     // required for IE, otherwise Content-disposition is ignored
     if (ini_get('zlib.output_compression')) {
         AJXP_Utils::safeIniSet('zlib.output_compression', 'Off');
     }
     $isFile = !$data && !$gzip;
     if ($byteLength == -1) {
         if ($data) {
             $size = strlen($filePathOrData);
         } else {
             if ($realfileSystem) {
                 $size = sprintf("%u", filesize($filePathOrData));
             } else {
                 $size = $this->filesystemFileSize($filePathOrData);
             }
         }
     } else {
         $size = $byteLength;
     }
     if ($gzip && ($size > ConfService::getCoreConf("GZIP_LIMIT") || !function_exists("gzencode") || @strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') === FALSE)) {
         $gzip = false;
         // disable gzip
     }
     $localName = $localName == "" ? basename(isset($originalFilePath) ? $originalFilePath : $filePathOrData) : $localName;
     if ($headerType == "plain") {
         header("Content-type:text/plain");
     } else {
         if ($headerType == "image") {
             header("Content-Type: " . AJXP_Utils::getImageMimeType(basename($filePathOrData)) . "; name=\"" . $localName . "\"");
             header("Content-Length: " . $size);
             header('Cache-Control: public');
         } else {
             /*
             if (preg_match('/ MSIE /',$_SERVER['HTTP_USER_AGENT']) || preg_match('/ WebKit /',$_SERVER['HTTP_USER_AGENT'])) {
                 $localName = str_replace("+", " ", urlencode(SystemTextEncoding::toUTF8($localName)));
             }
             */
             if ($isFile) {
                 header("Accept-Ranges: 0-{$size}");
                 $this->logDebug("Sending accept range 0-{$size}");
             }
             // Check if we have a range header (we are resuming a transfer)
             if (isset($_SERVER['HTTP_RANGE']) && $isFile && $size != 0) {
                 if ($headerType == "stream_content") {
                     if (extension_loaded('fileinfo') && $this->wrapperClassName == "fsAccessWrapper") {
                         $fInfo = new fInfo(FILEINFO_MIME);
                         $realfile = call_user_func(array($this->wrapperClassName, "getRealFSReference"), $filePathOrData);
                         $mimeType = $fInfo->file($realfile);
                         $splitChar = explode(";", $mimeType);
                         $mimeType = trim($splitChar[0]);
                         $this->logDebug("Detected mime {$mimeType} for {$realfile}");
                     } else {
                         $mimeType = AJXP_Utils::getStreamingMimeType(basename($filePathOrData));
                     }
                     header('Content-type: ' . $mimeType);
                 }
                 // multiple ranges, which can become pretty complex, so ignore it for now
                 $ranges = explode('=', $_SERVER['HTTP_RANGE']);
                 $offsets = explode('-', $ranges[1]);
                 $offset = floatval($offsets[0]);
                 $length = floatval($offsets[1]) - $offset;
                 if (!$length) {
                     $length = $size - $offset;
                 }
                 if ($length + $offset > $size || $length < 0) {
                     $length = $size - $offset;
                 }
                 $this->logDebug('Content-Range: bytes ' . $offset . '-' . $length . '/' . $size);
                 header('HTTP/1.1 206 Partial Content');
                 header('Content-Range: bytes ' . $offset . '-' . ($offset + $length) . '/' . $size);
                 header("Content-Length: " . $length);
                 $file = fopen($filePathOrData, 'rb');
                 fseek($file, 0);
                 $relOffset = $offset;
                 while ($relOffset > 2000000000.0) {
                     // seek to the requested offset, this is 0 if it's not a partial content request
                     fseek($file, 2000000000, SEEK_CUR);
                     $relOffset -= 2000000000;
                     // This works because we never overcome the PHP 32 bit limit
                 }
                 fseek($file, $relOffset, SEEK_CUR);
                 while (ob_get_level()) {
                     ob_end_flush();
                 }
                 $readSize = 0.0;
                 $bufferSize = 1024 * 8;
                 while (!feof($file) && $readSize < $length && connection_status() == 0) {
//.........这里部分代码省略.........
开发者ID:biggtfish,项目名称:cms,代码行数:101,代码来源:class.fsAccessDriver.php

示例10: extractExif

 public function extractExif($actionName, $httpVars, $fileVars)
 {
     $userSelection = new UserSelection();
     $userSelection->initFromHttpVars($httpVars);
     $repo = $this->accessDriver->repository;
     $repo->detectStreamWrapper();
     $wrapperData = $repo->streamData;
     $urlBase = $wrapperData["protocol"] . "://" . $repo->getId();
     $selection = new UserSelection($repo, $httpVars);
     $decoded = $selection->getUniqueFile();
     $realFile = call_user_func(array($wrapperData["classname"], "getRealFSReference"), $urlBase . $decoded);
     AJXP_Utils::safeIniSet('exif.encode_unicode', 'UTF-8');
     $exifData = @exif_read_data($realFile, 0, TRUE);
     if ($exifData === false || !is_array($exifData)) {
         return;
     }
     if ($exifData !== false && isset($exifData["GPS"])) {
         $exifData["COMPUTED_GPS"] = $this->convertGPSData($exifData);
     }
     $iptc = $this->extractIPTC($realFile);
     if (count($iptc)) {
         $exifData["IPTC"] = $iptc;
     }
     $excludeTags = array();
     // array("componentsconfiguration", "filesource", "scenetype", "makernote", "datadump");
     AJXP_XMLWriter::header("metadata", array("file" => $decoded, "type" => "EXIF"));
     foreach ($exifData as $section => $data) {
         print "<exifSection name='{$section}'>";
         foreach ($data as $key => $value) {
             if (is_array($value)) {
                 $value = implode(",", $value);
             }
             if (in_array(strtolower($key), $excludeTags)) {
                 continue;
             }
             if (strpos($key, "UndefinedTag:") === 0) {
                 continue;
             }
             $value = preg_replace('/[^[:print:]]/', '', $value);
             print "<exifTag name=\"{$key}\">" . SystemTextEncoding::toUTF8($value) . "</exifTag>";
         }
         print "</exifSection>";
     }
     AJXP_XMLWriter::close("metadata");
 }
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:45,代码来源:class.ExifMetaManager.php

示例11: extractExif

 public function extractExif($actionName, $httpVars, $fileVars)
 {
     $userSelection = new UserSelection();
     $userSelection->initFromHttpVars($httpVars);
     $repo = ConfService::getRepository();
     $repo->detectStreamWrapper();
     $wrapperData = $repo->streamData;
     $urlBase = $wrapperData["protocol"] . "://" . $repo->getId();
     $decoded = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
     $realFile = call_user_func(array($wrapperData["classname"], "getRealFSReference"), $urlBase . $decoded);
     AJXP_Utils::safeIniSet('exif.encode_unicode', 'UTF-8');
     $exifData = @exif_read_data($realFile, 0, TRUE);
     if ($exifData === false || !is_array($exifData)) {
         return;
     }
     if ($exifData !== false && isset($exifData["GPS"])) {
         $exifData["COMPUTED_GPS"] = $this->convertGPSData($exifData);
     }
     $excludeTags = array("componentsconfiguration", "filesource", "scenetype", "makernote");
     AJXP_XMLWriter::header("metadata", array("file" => $httpVars["file"], "type" => "EXIF"));
     foreach ($exifData as $section => $data) {
         print "<exifSection name='{$section}'>";
         foreach ($data as $key => $value) {
             if (is_array($value)) {
                 $value = implode(",", $value);
             }
             if (in_array(strtolower($key), $excludeTags)) {
                 continue;
             }
             if (!is_numeric($value)) {
                 $value = $this->string_format($value);
             }
             print "<exifTag name=\"{$key}\">" . SystemTextEncoding::toUTF8($value) . "</exifTag>";
         }
         print "</exifSection>";
     }
     AJXP_XMLWriter::close("metadata");
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:38,代码来源:class.ExifMetaManager.php

示例12: readFile

 function readFile($filePathOrData, $headerType = "plain", $localName = "", $data = false, $gzip = null, $realfileSystem = false, $byteOffset = -1, $byteLength = -1)
 {
     if ($gzip === null) {
         $gzip = ConfService::getCoreConf("GZIP_COMPRESSION");
     }
     if (!$realfileSystem && $this->wrapperClassName == "fsAccessWrapper") {
         $originalFilePath = $filePathOrData;
         $filePathOrData = fsAccessWrapper::patchPathForBaseDir($filePathOrData);
     }
     session_write_close();
     restore_error_handler();
     restore_exception_handler();
     set_exception_handler('download_exception_handler');
     set_error_handler('download_exception_handler');
     // required for IE, otherwise Content-disposition is ignored
     if (ini_get('zlib.output_compression')) {
         AJXP_Utils::safeIniSet('zlib.output_compression', 'Off');
     }
     $isFile = !$data && !$gzip;
     if ($byteLength == -1) {
         if ($data) {
             $size = strlen($filePathOrData);
         } else {
             if ($realfileSystem) {
                 $size = sprintf("%u", filesize($filePathOrData));
             } else {
                 $size = $this->filesystemFileSize($filePathOrData);
             }
         }
     } else {
         $size = $byteLength;
     }
     if ($gzip && ($size > ConfService::getCoreConf("GZIP_LIMIT") || !function_exists("gzencode") || @strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') === FALSE)) {
         $gzip = false;
         // disable gzip
     }
     $localName = $localName == "" ? basename(isset($originalFilePath) ? $originalFilePath : $filePathOrData) : $localName;
     if ($headerType == "plain") {
         header("Content-type:text/plain");
     } else {
         if ($headerType == "image") {
             header("Content-Type: " . AJXP_Utils::getImageMimeType(basename($filePathOrData)) . "; name=\"" . $localName . "\"");
             header("Content-Length: " . $size);
             header('Cache-Control: public');
         } else {
             /*
             			if(preg_match('/ MSIE /',$_SERVER['HTTP_USER_AGENT']) || preg_match('/ WebKit /',$_SERVER['HTTP_USER_AGENT'])){
             				$localName = str_replace("+", " ", urlencode(SystemTextEncoding::toUTF8($localName)));
             			}
             */
             if ($isFile) {
                 header("Accept-Ranges: 0-{$size}");
                 AJXP_Logger::debug("Sending accept range 0-{$size}");
             }
             // Check if we have a range header (we are resuming a transfer)
             if (isset($_SERVER['HTTP_RANGE']) && $isFile && $size != 0) {
                 if ($headerType == "stream_content") {
                     if (extension_loaded('fileinfo') && $this->wrapperClassName == "fsAccessWrapper") {
                         $fInfo = new fInfo(FILEINFO_MIME);
                         $realfile = call_user_func(array($this->wrapperClassName, "getRealFSReference"), $filePathOrData);
                         $mimeType = $fInfo->file($realfile);
                         $splitChar = explode(";", $mimeType);
                         $mimeType = trim($splitChar[0]);
                         AJXP_Logger::debug("Detected mime {$mimeType} for {$realfile}");
                     } else {
                         $mimeType = AJXP_Utils::getStreamingMimeType(basename($filePathOrData));
                     }
                     header('Content-type: ' . $mimeType);
                 }
                 // multiple ranges, which can become pretty complex, so ignore it for now
                 $ranges = explode('=', $_SERVER['HTTP_RANGE']);
                 $offsets = explode('-', $ranges[1]);
                 $offset = floatval($offsets[0]);
                 $length = floatval($offsets[1]) - $offset;
                 if (!$length) {
                     $length = $size - $offset;
                 }
                 if ($length + $offset > $size || $length < 0) {
                     $length = $size - $offset;
                 }
                 AJXP_Logger::debug('Content-Range: bytes ' . $offset . '-' . $length . '/' . $size);
                 header('HTTP/1.1 206 Partial Content');
                 header('Content-Range: bytes ' . $offset . '-' . ($offset + $length) . '/' . $size);
                 header("Content-Length: " . $length);
                 $file = fopen($filePathOrData, 'rb');
                 fseek($file, 0);
                 $relOffset = $offset;
                 while ($relOffset > 2000000000.0) {
                     // seek to the requested offset, this is 0 if it's not a partial content request
                     fseek($file, 2000000000, SEEK_CUR);
                     $relOffset -= 2000000000;
                     // This works because we never overcome the PHP 32 bit limit
                 }
                 fseek($file, $relOffset, SEEK_CUR);
                 while (ob_get_level()) {
                     ob_end_flush();
                 }
                 $readSize = 0.0;
                 $bufferSize = 1024 * 8;
                 while (!feof($file) && $readSize < $length && connection_status() == 0) {
//.........这里部分代码省略.........
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:101,代码来源:class.fsAccessDriver.php

示例13: switchAction

 public function switchAction($action, $httpVars, $fileVars)
 {
     if (!isset($this->actions[$action])) {
         return;
     }
     if (preg_match('/MSIE 7/', $_SERVER['HTTP_USER_AGENT'])) {
         // Force legacy theme for the moment
         $this->pluginConf["GUI_THEME"] = "oxygen";
     }
     if (!defined("AJXP_THEME_FOLDER")) {
         define("CLIENT_RESOURCES_FOLDER", AJXP_PLUGINS_FOLDER . "/gui.ajax/res");
         define("AJXP_THEME_FOLDER", CLIENT_RESOURCES_FOLDER . "/themes/" . $this->pluginConf["GUI_THEME"]);
     }
     foreach ($httpVars as $getName => $getValue) {
         ${$getName} = AJXP_Utils::securePath($getValue);
     }
     if (isset($dir) && $action != "upload") {
         $dir = SystemTextEncoding::fromUTF8($dir);
     }
     $mess = ConfService::getMessages();
     switch ($action) {
         //------------------------------------
         //	GET AN HTML TEMPLATE
         //------------------------------------
         case "get_template":
             HTMLWriter::charsetHeader();
             $folder = CLIENT_RESOURCES_FOLDER . "/html";
             if (isset($httpVars["pluginName"])) {
                 $folder = AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/" . AJXP_Utils::securePath($httpVars["pluginName"]);
                 if (isset($httpVars["pluginPath"])) {
                     $folder .= "/" . AJXP_Utils::securePath($httpVars["pluginPath"]);
                 }
             }
             $crtTheme = $this->pluginConf["GUI_THEME"];
             $thFolder = AJXP_THEME_FOLDER . "/html";
             if (isset($template_name)) {
                 if (is_file($thFolder . "/" . $template_name)) {
                     include $thFolder . "/" . $template_name;
                 } else {
                     if (is_file($folder . "/" . $template_name)) {
                         include $folder . "/" . $template_name;
                     }
                 }
             }
             break;
             //------------------------------------
             //	GET I18N MESSAGES
             //------------------------------------
         //------------------------------------
         //	GET I18N MESSAGES
         //------------------------------------
         case "get_i18n_messages":
             $refresh = false;
             if (isset($httpVars["lang"])) {
                 ConfService::setLanguage($httpVars["lang"]);
                 $refresh = true;
             }
             HTMLWriter::charsetHeader('text/javascript');
             HTMLWriter::writeI18nMessagesClass(ConfService::getMessages($refresh));
             break;
             //------------------------------------
             //	SEND XML REGISTRY
             //------------------------------------
         //------------------------------------
         //	SEND XML REGISTRY
         //------------------------------------
         case "get_xml_registry":
             $regDoc = AJXP_PluginsService::getXmlRegistry();
             $changes = AJXP_Controller::filterRegistryFromRole($regDoc);
             if ($changes) {
                 AJXP_PluginsService::updateXmlRegistry($regDoc);
             }
             $clone = $regDoc->cloneNode(true);
             $clonePath = new DOMXPath($clone);
             $serverCallbacks = $clonePath->query("//serverCallback|hooks");
             foreach ($serverCallbacks as $callback) {
                 $processing = $callback->parentNode->removeChild($callback);
             }
             if (isset($_GET["xPath"])) {
                 //$regPath = new DOMXPath($regDoc);
                 $nodes = $clonePath->query($_GET["xPath"]);
                 AJXP_XMLWriter::header("ajxp_registry_part", array("xPath" => $_GET["xPath"]));
                 if ($nodes->length) {
                     print AJXP_XMLWriter::replaceAjxpXmlKeywords($clone->saveXML($nodes->item(0)));
                 }
                 AJXP_XMLWriter::close("ajxp_registry_part");
             } else {
                 AJXP_Utils::safeIniSet("zlib.output_compression", "4096");
                 header('Content-Type: application/xml; charset=UTF-8');
                 print AJXP_XMLWriter::replaceAjxpXmlKeywords($clone->saveXML());
             }
             break;
             //------------------------------------
             //	DISPLAY DOC
             //------------------------------------
         //------------------------------------
         //	DISPLAY DOC
         //------------------------------------
         case "display_doc":
             HTMLWriter::charsetHeader();
//.........这里部分代码省略.........
开发者ID:biggtfish,项目名称:cms,代码行数:101,代码来源:class.AJXP_ClientDriver.php


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