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


PHP OC_Response类代码示例

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


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

示例1: output

 public function output($files, $cache_key)
 {
     header('Content-Type: ' . $this->contentType);
     OC_Response::enableCaching();
     $etag = $this->generateETag($files);
     $cache_key .= '-' . $etag;
     $gzout = false;
     $cache = OC_Cache::getGlobalCache();
     if (!OC_Request::isNoCache() && (!defined('DEBUG') || !DEBUG)) {
         OC_Response::setETagHeader($etag);
         $gzout = $cache->get($cache_key . '.gz');
     }
     if (!$gzout) {
         $out = $this->minimizeFiles($files);
         $gzout = gzencode($out);
         $cache->set($cache_key . '.gz', $gzout);
         OC_Response::setETagHeader($etag);
     }
     if ($encoding = OC_Request::acceptGZip()) {
         header('Content-Encoding: ' . $encoding);
         $out = $gzout;
     } else {
         $out = gzdecode($gzout);
     }
     header('Content-Length: ' . strlen($out));
     echo $out;
 }
开发者ID:noci2012,项目名称:owncloud,代码行数:27,代码来源:minimizer.php

示例2: sendHeaders

 /**
  * @param string $filename
  * @param string $name
  */
 private static function sendHeaders($filename, $name)
 {
     OC_Response::setContentDispositionHeader($name, 'attachment');
     header('Content-Transfer-Encoding: binary');
     OC_Response::disableCaching();
     $filesize = \OC\Files\Filesystem::filesize($filename);
     header('Content-Type: ' . \OC_Helper::getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename)));
     if ($filesize > -1) {
         OC_Response::setContentLengthHeader($filesize);
     }
 }
开发者ID:hyb148,项目名称:core,代码行数:15,代码来源:files.php

示例3: renderContent

 public function renderContent()
 {
     if ($this->isEditable()) {
         list($app, $filename) = explode('/templates/', $this->path, 2);
         $name = substr($filename, 0, -4);
         list(, $template) = $this->findTemplate($this->theme, $app, $name, '');
         \OC_Response::sendFile($template);
     } else {
         throw new SecurityException('Template not editable.', 403);
     }
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:11,代码来源:mailtemplate.php

示例4: sendHeaders

 /**
  * @param string $filename
  * @param string $name
  * @param boolean $isAttachment ; enforce download of file
  */
 private static function sendHeaders($filename, $name, $isAttachment = true)
 {
     if ($isAttachment) {
         OC_Response::setContentDispositionHeader($name, 'attachment');
     }
     header('Content-Transfer-Encoding: binary');
     OC_Response::disableCaching();
     $fileSize = \OC\Files\Filesystem::filesize($filename);
     $type = \OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename));
     header('Content-Type: ' . $type);
     if ($fileSize > -1) {
         OC_Response::setContentLengthHeader($fileSize);
     }
 }
开发者ID:0x17de,项目名称:core,代码行数:19,代码来源:files.php

示例5: sendHeaders

 /**
  * @param string $filename
  * @param string $name
  * @param bool $zip
  */
 private static function sendHeaders($filename, $name, $zip = false)
 {
     OC_Response::setContentDispositionHeader($name, 'attachment');
     header('Content-Transfer-Encoding: binary');
     OC_Response::disableCaching();
     if ($zip) {
         header('Content-Type: application/zip');
     } else {
         $filesize = \OC\Files\Filesystem::filesize($filename);
         header('Content-Type: ' . \OC\Files\Filesystem::getMimeType($filename));
         if ($filesize > -1) {
             header("Content-Length: " . $filesize);
         }
     }
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:20,代码来源:files.php

示例6: setupFromToken

 /**
  * Sets up the filesystem and user for public sharing
  * @param string $token string share token
  * @param string $relativePath optional path relative to the share
  * @param string $password optional password
  */
 public static function setupFromToken($token, $relativePath = null, $password = null)
 {
     \OC_User::setIncognitoMode(true);
     $linkItem = \OCP\Share::getShareByToken($token, !$password);
     if ($linkItem === false || $linkItem['item_type'] !== 'file' && $linkItem['item_type'] !== 'folder') {
         \OC_Response::setStatus(404);
         \OC_Log::write('core-preview', 'Passed token parameter is not valid', \OC_Log::DEBUG);
         exit;
     }
     if (!isset($linkItem['uid_owner']) || !isset($linkItem['file_source'])) {
         \OC_Response::setStatus(500);
         \OC_Log::write('core-preview', 'Passed token seems to be valid, but it does not contain all necessary information . ("' . $token . '")', \OC_Log::WARN);
         exit;
     }
     $rootLinkItem = \OCP\Share::resolveReShare($linkItem);
     $path = null;
     if (isset($rootLinkItem['uid_owner'])) {
         \OCP\JSON::checkUserExists($rootLinkItem['uid_owner']);
         \OC_Util::tearDownFS();
         \OC_Util::setupFS($rootLinkItem['uid_owner']);
         $path = \OC\Files\Filesystem::getPath($linkItem['file_source']);
     }
     if ($path === null) {
         \OCP\Util::writeLog('share', 'could not resolve linkItem', \OCP\Util::DEBUG);
         \OC_Response::setStatus(404);
         \OCP\JSON::error(array('success' => false));
         exit;
     }
     if (!isset($linkItem['item_type'])) {
         \OCP\Util::writeLog('share', 'No item type set for share id: ' . $linkItem['id'], \OCP\Util::ERROR);
         \OC_Response::setStatus(404);
         \OCP\JSON::error(array('success' => false));
         exit;
     }
     if (isset($linkItem['share_with'])) {
         if (!self::authenticate($linkItem, $password)) {
             \OC_Response::setStatus(403);
             \OCP\JSON::error(array('success' => false));
             exit;
         }
     }
     $basePath = $path;
     if ($relativePath !== null && \OC\Files\Filesystem::isReadable($basePath . $relativePath)) {
         $path .= \OC\Files\Filesystem::normalizePath($relativePath);
     }
     return array('linkItem' => $linkItem, 'basePath' => $basePath, 'realPath' => $path);
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:53,代码来源:helper.php

示例7: handleException

/**
 * @param Exception $e
 */
function handleException(Exception $e)
{
    $request = \OC::$server->getRequest();
    // in case the request content type is text/xml - we assume it's a WebDAV request
    $isXmlContentType = strpos($request->getHeader('Content-Type'), 'text/xml');
    if ($isXmlContentType === 0) {
        // fire up a simple server to properly process the exception
        $server = new Server();
        if (!$e instanceof RemoteException) {
            // we shall not log on RemoteException
            $server->addPlugin(new ExceptionLoggerPlugin('webdav', \OC::$server->getLogger()));
        }
        $server->on('beforeMethod', function () use($e) {
            if ($e instanceof RemoteException) {
                switch ($e->getCode()) {
                    case OC_Response::STATUS_SERVICE_UNAVAILABLE:
                        throw new ServiceUnavailable($e->getMessage());
                    case OC_Response::STATUS_NOT_FOUND:
                        throw new \Sabre\DAV\Exception\NotFound($e->getMessage());
                }
            }
            $class = get_class($e);
            $msg = $e->getMessage();
            throw new ServiceUnavailable("{$class}: {$msg}");
        });
        $server->exec();
    } else {
        $statusCode = OC_Response::STATUS_INTERNAL_SERVER_ERROR;
        if ($e instanceof \OC\ServiceUnavailableException) {
            $statusCode = OC_Response::STATUS_SERVICE_UNAVAILABLE;
        }
        if ($e instanceof RemoteException) {
            // we shall not log on RemoteException
            OC_Response::setStatus($e->getCode());
            OC_Template::printErrorPage($e->getMessage());
        } else {
            \OCP\Util::writeLog('remote', $e->getMessage(), \OCP\Util::FATAL);
            OC_Response::setStatus($statusCode);
            OC_Template::printExceptionErrorPage($e);
        }
    }
}
开发者ID:rosarion,项目名称:core,代码行数:45,代码来源:remote.php

示例8: redirect

 /**
  * Send redirect response
  * @param string $location to redirect to
  */
 public static function redirect($location)
 {
     \OC_Response::redirect($location);
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:8,代码来源:response.php

示例9: save

 /**
  * @NoAdminRequired
  * @PublicPage
  * Store the document content to its origin
  */
 public function save()
 {
     try {
         $esId = $this->request->server['HTTP_WEBODF_SESSION_ID'];
         if (!$esId) {
             throw new \Exception('Session id can not be empty');
         }
         $memberId = $this->request->server['HTTP_WEBODF_MEMBER_ID'];
         $currentMember = new Db\Member();
         $currentMember->load($memberId);
         //check if member belongs to the session
         if ($esId != $currentMember->getEsId()) {
             throw new \Exception($memberId . ' does not belong to session ' . $esId);
         }
         // Extra info for future usage
         // $sessionRevision = $this->request->server['HTTP_WEBODF_SESSION_REVISION'];
         //NB ouch! New document content is passed as an input stream content
         $stream = fopen('php://input', 'r');
         if (!$stream) {
             throw new \Exception('New content missing');
         }
         $content = stream_get_contents($stream);
         $session = new Db\Session();
         $session->load($esId);
         if (!$session->getEsId()) {
             throw new \Exception('Session does not exist');
         }
         try {
             if ($currentMember->getIsGuest()) {
                 $file = File::getByShareToken($currentMember->getToken());
             } else {
                 $file = new File($session->getFileId());
             }
             list($view, $path) = $file->getOwnerViewAndPath(true);
         } catch (\Exception $e) {
             //File was deleted or unshared. We need to save content as new file anyway
             //Sorry, but for guests it would be lost :(
             if ($this->uid) {
                 $view = new View('/' . $this->uid . '/files');
                 $dir = \OCP\Config::getUserValue($this->uid, 'documents', 'save_path', '');
                 $path = Helper::getNewFileName($view, $dir . 'New Document.odt');
             } else {
                 throw $e;
             }
         }
         $member = new Db\Member();
         $members = $member->getActiveCollection($esId);
         $memberIds = array_map(function ($x) {
             return $x['member_id'];
         }, $members);
         // Active users except current user
         $memberCount = count($memberIds) - 1;
         if ($view->file_exists($path)) {
             $currentHash = sha1($view->file_get_contents($path));
             if (!Helper::isVersionsEnabled() && $currentHash !== $session->getGenesisHash()) {
                 // Original file was modified externally. Save to a new one
                 $path = Helper::getNewFileName($view, $path, '-conflict');
             }
             $mimetype = $view->getMimeType($path);
         } else {
             $mimetype = Storage::MIMETYPE_LIBREOFFICE_WORDPROCESSOR;
         }
         $data = Filter::write($content, $mimetype);
         if ($view->file_put_contents($path, $data['content'])) {
             // Not a last user
             if ($memberCount > 0) {
                 // Update genesis hash to prevent conflicts
                 $this->logger->debug('Update hash', array('app' => $this->appName));
                 $session->updateGenesisHash($esId, sha1($data['content']));
             } else {
                 // Last user. Kill session data
                 Db\Session::cleanUp($esId);
             }
             $view->touch($path);
         }
         $response = array('status' => 'success');
     } catch (\Exception $e) {
         $this->logger->warning('Saving failed. Reason:' . $e->getMessage(), array('app' => $this->appName));
         \OC_Response::setStatus(500);
         $response = array();
     }
     return $response;
 }
开发者ID:Ebimedia,项目名称:owncloud,代码行数:88,代码来源:sessioncontroller.php

示例10: handleRequest

 /**
  * @brief Handle the request
  */
 public static function handleRequest()
 {
     // load all the classpaths from the enabled apps so they are available
     // in the routing files of each app
     OC::loadAppClassPaths();
     // Check if ownCloud is installed or in maintenance (update) mode
     if (!OC_Config::getValue('installed', false)) {
         require_once 'core/setup.php';
         exit;
     }
     $request = OC_Request::getPathInfo();
     if (substr($request, -3) !== '.js') {
         // we need these files during the upgrade
         self::checkMaintenanceMode();
         self::checkUpgrade();
     }
     if (!self::$CLI) {
         try {
             if (!OC_Config::getValue('maintenance', false)) {
                 OC_App::loadApps();
             }
             OC::getRouter()->match(OC_Request::getRawPathInfo());
             return;
         } catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) {
             //header('HTTP/1.0 404 Not Found');
         } catch (Symfony\Component\Routing\Exception\MethodNotAllowedException $e) {
             OC_Response::setStatus(405);
             return;
         }
     }
     $app = OC::$REQUESTEDAPP;
     $file = OC::$REQUESTEDFILE;
     $param = array('app' => $app, 'file' => $file);
     // Handle app css files
     if (substr($file, -3) == 'css') {
         self::loadCSSFile($param);
         return;
     }
     // Handle redirect URL for logged in users
     if (isset($_REQUEST['redirect_url']) && OC_User::isLoggedIn()) {
         $location = OC_Helper::makeURLAbsolute(urldecode($_REQUEST['redirect_url']));
         // Deny the redirect if the URL contains a @
         // This prevents unvalidated redirects like ?redirect_url=:user@domain.com
         if (strpos($location, '@') === FALSE) {
             header('Location: ' . $location);
             return;
         }
     }
     // Handle WebDAV
     if ($_SERVER['REQUEST_METHOD'] == 'PROPFIND') {
         header('location: ' . OC_Helper::linkToRemote('webdav'));
         return;
     }
     // Someone is logged in :
     if (OC_User::isLoggedIn()) {
         OC_App::loadApps();
         OC_User::setupBackends();
         if (isset($_GET["logout"]) and $_GET["logout"]) {
             if (isset($_COOKIE['oc_token'])) {
                 OC_Preferences::deleteKey(OC_User::getUser(), 'login_token', $_COOKIE['oc_token']);
             }
             OC_User::logout();
             header("Location: " . OC::$WEBROOT . '/');
         } else {
             if (is_null($file)) {
                 $param['file'] = 'index.php';
             }
             $file_ext = substr($param['file'], -3);
             if ($file_ext != 'php' || !self::loadAppScriptFile($param)) {
                 header('HTTP/1.0 404 Not Found');
             }
         }
         return;
     }
     // Not handled and not logged in
     self::handleLogin();
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:80,代码来源:base.php

示例11: JSRoutes

 /**
  * Generate JSON response for routing in javascript
  */
 public static function JSRoutes()
 {
     $router = OC::getRouter();
     $etag = $router->getCacheKey();
     OC_Response::enableCaching();
     OC_Response::setETagHeader($etag);
     $root = $router->getCollection('root');
     $routes = array();
     foreach ($root->all() as $name => $route) {
         $compiled_route = $route->compile();
         $defaults = $route->getDefaults();
         unset($defaults['action']);
         $routes[$name] = array('tokens' => $compiled_route->getTokens(), 'defaults' => $defaults);
     }
     OCP\JSON::success(array('data' => $routes));
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:19,代码来源:router.php

示例12: isset

<?php

/**
 * @author Lukas Reschke
 * @copyright 2014 Lukas Reschke lukas@owncloud.com
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
// This file is just used to redirect the legacy sharing URLs (< ownCloud 8) to the new ones
$urlGenerator = new \OC\URLGenerator(\OC::$server->getConfig());
$token = isset($_GET['t']) ? $_GET['t'] : '';
$route = isset($_GET['download']) ? 'files_sharing.sharecontroller.downloadShare' : 'files_sharing.sharecontroller.showShare';
OC_Response::redirect($urlGenerator->linkToRoute($route, array('token' => $token)));
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:15,代码来源:public.php

示例13: get

 /**
  * return the content of a file or return a zip file containing multiple files
  *
  * @param string $dir
  * @param string $file ; separated list of files to download
  * @param boolean $only_header ; boolean to only send header of the request
  */
 public static function get($dir, $files, $only_header = false)
 {
     $xsendfile = false;
     if (isset($_SERVER['MOD_X_SENDFILE_ENABLED']) || isset($_SERVER['MOD_X_ACCEL_REDIRECT_ENABLED'])) {
         $xsendfile = true;
     }
     if (is_array($files) && count($files) == 1) {
         $files = $files[0];
     }
     if (is_array($files)) {
         self::validateZipDownload($dir, $files);
         $executionTime = intval(ini_get('max_execution_time'));
         set_time_limit(0);
         $zip = new ZipArchive();
         if ($xsendfile) {
             $filename = OC_Helper::tmpFileNoClean('.zip');
         } else {
             $filename = OC_Helper::tmpFile('.zip');
         }
         if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE) !== true) {
             exit("cannot open <{$filename}>\n");
         }
         foreach ($files as $file) {
             $file = $dir . '/' . $file;
             if (\OC\Files\Filesystem::is_file($file)) {
                 $tmpFile = \OC\Files\Filesystem::toTmpFile($file);
                 self::$tmpFiles[] = $tmpFile;
                 $zip->addFile($tmpFile, basename($file));
             } elseif (\OC\Files\Filesystem::is_dir($file)) {
                 self::zipAddDir($file, $zip);
             }
         }
         $zip->close();
         $basename = basename($dir);
         if ($basename) {
             $name = $basename . '.zip';
         } else {
             $name = 'owncloud.zip';
         }
         set_time_limit($executionTime);
     } elseif (\OC\Files\Filesystem::is_dir($dir . '/' . $files)) {
         self::validateZipDownload($dir, $files);
         $executionTime = intval(ini_get('max_execution_time'));
         set_time_limit(0);
         $zip = new ZipArchive();
         if ($xsendfile) {
             $filename = OC_Helper::tmpFileNoClean('.zip');
         } else {
             $filename = OC_Helper::tmpFile('.zip');
         }
         if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE) !== true) {
             exit("cannot open <{$filename}>\n");
         }
         $file = $dir . '/' . $files;
         self::zipAddDir($file, $zip);
         $zip->close();
         $name = $files . '.zip';
         set_time_limit($executionTime);
     } else {
         $zip = false;
         $filename = $dir . '/' . $files;
         $name = $files;
     }
     OC_Util::obEnd();
     if ($zip or \OC\Files\Filesystem::isReadable($filename)) {
         if (preg_match("/MSIE/", $_SERVER["HTTP_USER_AGENT"])) {
             header('Content-Disposition: attachment; filename="' . rawurlencode($name) . '"');
         } else {
             header('Content-Disposition: attachment; filename*=UTF-8\'\'' . rawurlencode($name) . '; filename="' . rawurlencode($name) . '"');
         }
         header('Content-Transfer-Encoding: binary');
         OC_Response::disableCaching();
         if ($zip) {
             ini_set('zlib.output_compression', 'off');
             header('Content-Type: application/zip');
             header('Content-Length: ' . filesize($filename));
             self::addSendfileHeader($filename);
         } else {
             header('Content-Type: ' . \OC\Files\Filesystem::getMimeType($filename));
             header("Content-Length: " . \OC\Files\Filesystem::filesize($filename));
             list($storage) = \OC\Files\Filesystem::resolvePath($filename);
             if ($storage instanceof \OC\Files\Storage\Local) {
                 self::addSendfileHeader(\OC\Files\Filesystem::getLocalFile($filename));
             }
         }
     } elseif ($zip or !\OC\Files\Filesystem::file_exists($filename)) {
         header("HTTP/1.0 404 Not Found");
         $tmpl = new OC_Template('', '404', 'guest');
         $tmpl->assign('file', $name);
         $tmpl->printPage();
     } else {
         header("HTTP/1.0 403 Forbidden");
         die('403 Forbidden');
//.........这里部分代码省略.........
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:101,代码来源:files.php

示例14: isset

if (isset($_POST['password'])) {
    $password = $_POST['password'];
}
$relativePath = null;
if (isset($_GET['dir'])) {
    $relativePath = $_GET['dir'];
}
$sortAttribute = isset($_GET['sort']) ? $_GET['sort'] : 'name';
$sortDirection = isset($_GET['sortdirection']) ? $_GET['sortdirection'] === 'desc' : false;
$data = \OCA\Files_Sharing\Helper::setupFromToken($token, $relativePath, $password);
$linkItem = $data['linkItem'];
// Load the files
$dir = $data['realPath'];
$dir = \OC\Files\Filesystem::normalizePath($dir);
if (!\OC\Files\Filesystem::is_dir($dir . '/')) {
    \OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND);
    \OCP\JSON::error(array('success' => false));
    exit;
}
$data = array();
// make filelist
$files = \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection);
$formattedFiles = array();
foreach ($files as $file) {
    $entry = \OCA\Files\Helper::formatFileInfo($file);
    unset($entry['directory']);
    // for now
    $entry['permissions'] = \OCP\PERMISSION_READ;
    $formattedFiles[] = $entry;
}
$data['directory'] = $relativePath;
开发者ID:olucao,项目名称:owncloud-core,代码行数:31,代码来源:list.php

示例15: handleRequest

 /**
  * @brief Handle the request
  */
 public static function handleRequest()
 {
     // load all the classpaths from the enabled apps so they are available
     // in the routing files of each app
     OC::loadAppClassPaths();
     // Check if ownCloud is installed or in maintenance (update) mode
     if (!OC_Config::getValue('installed', false)) {
         require_once 'core/setup.php';
         exit;
     }
     $host = OC_Request::insecureServerHost();
     // if the host passed in headers isn't trusted
     if (!OC::$CLI && OC_Request::getOverwriteHost() === null && !OC_Request::isTrustedDomain($host)) {
         header('HTTP/1.1 400 Bad Request');
         header('Status: 400 Bad Request');
         OC_Template::printErrorPage('You are accessing the server from an untrusted domain.', 'Please contact your administrator. If you are an administrator of this instance, configure the "trusted_domain" setting in config/config.php. An example configuration is provided in config/config.sample.php.');
         return;
     }
     $request = OC_Request::getPathInfo();
     if (substr($request, -3) !== '.js') {
         // we need these files during the upgrade
         self::checkMaintenanceMode();
         self::checkUpgrade();
     }
     // Test it the user is already authenticated using Apaches AuthType Basic... very usable in combination with LDAP
     OC::tryBasicAuthLogin();
     if (!self::$CLI and (!isset($_GET["logout"]) or $_GET["logout"] !== 'true')) {
         try {
             if (!OC_Config::getValue('maintenance', false)) {
                 OC_App::loadApps();
             }
             self::checkSingleUserMode();
             OC::getRouter()->match(OC_Request::getRawPathInfo());
             return;
         } catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) {
             //header('HTTP/1.0 404 Not Found');
         } catch (Symfony\Component\Routing\Exception\MethodNotAllowedException $e) {
             OC_Response::setStatus(405);
             return;
         }
     }
     $app = OC::$REQUESTEDAPP;
     $file = OC::$REQUESTEDFILE;
     $param = array('app' => $app, 'file' => $file);
     // Handle app css files
     if (substr($file, -3) == 'css') {
         self::loadCSSFile($param);
         return;
     }
     // Handle redirect URL for logged in users
     if (isset($_REQUEST['redirect_url']) && OC_User::isLoggedIn()) {
         $location = OC_Helper::makeURLAbsolute(urldecode($_REQUEST['redirect_url']));
         // Deny the redirect if the URL contains a @
         // This prevents unvalidated redirects like ?redirect_url=:user@domain.com
         if (strpos($location, '@') === false) {
             header('Location: ' . $location);
             return;
         }
     }
     // Handle WebDAV
     if ($_SERVER['REQUEST_METHOD'] == 'PROPFIND') {
         // not allowed any more to prevent people
         // mounting this root directly.
         // Users need to mount remote.php/webdav instead.
         header('HTTP/1.1 405 Method Not Allowed');
         header('Status: 405 Method Not Allowed');
         return;
     }
     // Someone is logged in :
     if (OC_User::isLoggedIn()) {
         OC_App::loadApps();
         OC_User::setupBackends();
         if (isset($_GET["logout"]) and $_GET["logout"]) {
             if (isset($_COOKIE['oc_token'])) {
                 OC_Preferences::deleteKey(OC_User::getUser(), 'login_token', $_COOKIE['oc_token']);
             }
             OC_User::logout();
             header("Location: " . OC::$WEBROOT . '/');
         } else {
             if (is_null($file)) {
                 $param['file'] = 'index.php';
             }
             $file_ext = substr($param['file'], -3);
             if ($file_ext != 'php' || !self::loadAppScriptFile($param)) {
                 header('HTTP/1.0 404 Not Found');
             }
         }
         return;
     }
     // Not handled and not logged in
     self::handleLogin();
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:95,代码来源:base.php


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