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


PHP OC_App::loadApps方法代码示例

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


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

示例1: setupFS

 /**
  * Can be set up
  * @param string $user
  * @return boolean
  * @description configure the initial filesystem based on the configuration
  */
 public static function setupFS($user = '')
 {
     //setting up the filesystem twice can only lead to trouble
     if (self::$fsSetup) {
         return false;
     }
     // If we are not forced to load a specific user we load the one that is logged in
     if ($user == "" && OC_User::isLoggedIn()) {
         $user = OC_User::getUser();
     }
     // load all filesystem apps before, so no setup-hook gets lost
     OC_App::loadApps(array('filesystem'));
     // the filesystem will finish when $user is not empty,
     // mark fs setup here to avoid doing the setup from loading
     // OC_Filesystem
     if ($user != '') {
         self::$fsSetup = true;
     }
     //check if we are using an object storage
     $objectStore = OC_Config::getValue('objectstore');
     if (isset($objectStore)) {
         self::initObjectStoreRootFS($objectStore);
     } else {
         self::initLocalStorageRootFS();
     }
     if ($user != '' && !OCP\User::userExists($user)) {
         return false;
     }
     //if we aren't logged in, there is no use to set up the filesystem
     if ($user != "") {
         \OC\Files\Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage) {
             // set up quota for home storages, even for other users
             // which can happen when using sharing
             /**
              * @var \OC\Files\Storage\Storage $storage
              */
             if ($storage->instanceOfStorage('\\OC\\Files\\Storage\\Home') || $storage->instanceOfStorage('\\OC\\Files\\ObjectStore\\HomeObjectStoreStorage')) {
                 if (is_object($storage->getUser())) {
                     $user = $storage->getUser()->getUID();
                     $quota = OC_Util::getUserQuota($user);
                     if ($quota !== \OC\Files\SPACE_UNLIMITED) {
                         return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota, 'root' => 'files'));
                     }
                 }
             }
             return $storage;
         });
         $userDir = '/' . $user . '/files';
         //jail the user into his "home" directory
         \OC\Files\Filesystem::init($user, $userDir);
         $fileOperationProxy = new OC_FileProxy_FileOperations();
         OC_FileProxy::register($fileOperationProxy);
         //trigger creation of user home and /files folder
         \OC::$server->getUserFolder($user);
         OC_Hook::emit('OC_Filesystem', 'setup', array('user' => $user, 'user_dir' => $userDir));
     }
     return true;
 }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:64,代码来源:util.php

示例2: removeSharedFolder

/**
 * update script for the removal of the logical "Shared" folder, we create physical "Shared" folder and
 * update the users file_target so that it doesn't make any difference for the user
 * @note parameters are just for testing, please ignore them
 */
function removeSharedFolder($mkdirs = true, $chunkSize = 99)
{
    $query = OCP\DB::prepare('SELECT * FROM `*PREFIX*share`');
    $result = $query->execute();
    $view = new \OC\Files\View('/');
    $users = array();
    $shares = array();
    //we need to set up user backends
    OC_User::useBackend(new OC_User_Database());
    OC_Group::useBackend(new OC_Group_Database());
    OC_App::loadApps(array('authentication'));
    //we need to set up user backends, otherwise creating the shares will fail with "because user does not exist"
    while ($row = $result->fetchRow()) {
        //collect all user shares
        if ((int) $row['share_type'] === 0 && ($row['item_type'] === 'file' || $row['item_type'] === 'folder')) {
            $users[] = $row['share_with'];
            $shares[$row['id']] = $row['file_target'];
        } else {
            if ((int) $row['share_type'] === 1 && ($row['item_type'] === 'file' || $row['item_type'] === 'folder')) {
                //collect all group shares
                $users = array_merge($users, \OC_group::usersInGroup($row['share_with']));
                $shares[$row['id']] = $row['file_target'];
            } else {
                if ((int) $row['share_type'] === 2) {
                    $shares[$row['id']] = $row['file_target'];
                }
            }
        }
    }
    $unique_users = array_unique($users);
    if (!empty($unique_users) && !empty($shares)) {
        // create folder Shared for each user
        if ($mkdirs) {
            foreach ($unique_users as $user) {
                \OC\Files\Filesystem::initMountPoints($user);
                if (!$view->file_exists('/' . $user . '/files/Shared')) {
                    $view->mkdir('/' . $user . '/files/Shared');
                }
            }
        }
        $chunkedShareList = array_chunk($shares, $chunkSize, true);
        $connection = \OC_DB::getConnection();
        foreach ($chunkedShareList as $subList) {
            $statement = "UPDATE `*PREFIX*share` SET `file_target` = CASE `id` ";
            //update share table
            $ids = implode(',', array_keys($subList));
            foreach ($subList as $id => $target) {
                $statement .= "WHEN " . $connection->quote($id, \PDO::PARAM_INT) . " THEN " . $connection->quote('/Shared' . $target, \PDO::PARAM_STR);
            }
            $statement .= ' END WHERE `id` IN (' . $ids . ')';
            $query = OCP\DB::prepare($statement);
            $query->execute(array());
        }
        // set config to keep the Shared folder as the default location for new shares
        \OCA\Files_Sharing\Helper::setShareFolder('/Shared');
    }
}
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:62,代码来源:update.php

示例3: setupFS

 /**
  * @brief Can be set up
  * @param string $user
  * @return boolean
  * @description configure the initial filesystem based on the configuration
  */
 public static function setupFS($user = '')
 {
     //setting up the filesystem twice can only lead to trouble
     if (self::$fsSetup) {
         return false;
     }
     // If we are not forced to load a specific user we load the one that is logged in
     if ($user == "" && OC_User::isLoggedIn()) {
         $user = OC_User::getUser();
     }
     // load all filesystem apps before, so no setup-hook gets lost
     if (!isset($RUNTIME_NOAPPS) || !$RUNTIME_NOAPPS) {
         OC_App::loadApps(array('filesystem'));
     }
     // the filesystem will finish when $user is not empty,
     // mark fs setup here to avoid doing the setup from loading
     // OC_Filesystem
     if ($user != '') {
         self::$fsSetup = true;
     }
     $configDataDirectory = OC_Config::getValue("datadirectory", OC::$SERVERROOT . "/data");
     //first set up the local "root" storage
     \OC\Files\Filesystem::initMounts();
     if (!self::$rootMounted) {
         \OC\Files\Filesystem::mount('\\OC\\Files\\Storage\\Local', array('datadir' => $configDataDirectory), '/');
         self::$rootMounted = true;
     }
     //if we aren't logged in, there is no use to set up the filesystem
     if ($user != "") {
         \OC\Files\Filesystem::addStorageWrapper(function ($mountPoint, $storage) {
             // set up quota for home storages, even for other users
             // which can happen when using sharing
             if ($storage instanceof \OC\Files\Storage\Home) {
                 $user = $storage->getUser()->getUID();
                 $quota = OC_Util::getUserQuota($user);
                 if ($quota !== \OC\Files\SPACE_UNLIMITED) {
                     return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota));
                 }
             }
             return $storage;
         });
         $userDir = '/' . $user . '/files';
         $userRoot = OC_User::getHome($user);
         $userDirectory = $userRoot . '/files';
         if (!is_dir($userDirectory)) {
             mkdir($userDirectory, 0755, true);
             OC_Util::copySkeleton($userDirectory);
         }
         //jail the user into his "home" directory
         \OC\Files\Filesystem::init($user, $userDir);
         $fileOperationProxy = new OC_FileProxy_FileOperations();
         OC_FileProxy::register($fileOperationProxy);
         OC_Hook::emit('OC_Filesystem', 'setup', array('user' => $user, 'user_dir' => $userDir));
     }
     return true;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:62,代码来源:util.php

示例4: setUp

 /**
  * prepares everything for the test run. Includes loading ownCloud and
  * the LDAP backend, as well as getting information about toxiproxy.
  * Also creates an instance of the LDAP class, the testee
  *
  * @throws Exception
  */
 public function setUp()
 {
     require_once __DIR__ . '/../../../../lib/base.php';
     \OC_App::loadApps('user_ldap');
     $ch = $this->getCurl();
     $proxyInfoJson = curl_exec($ch);
     $this->checkCurlResult($ch, $proxyInfoJson);
     $proxyInfo = json_decode($proxyInfoJson, true);
     $this->originalProxyState = $proxyInfo['enabled'];
     $this->ldapHost = 'ldap://' . $proxyInfo['listen'];
     // contains port as well
     $this->ldap = new LDAP();
 }
开发者ID:kenwi,项目名称:core,代码行数:20,代码来源:exceptionOnLostConnection.php

示例5: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     \OC_App::loadApps('authentication');
     if ($input->getOption('all')) {
         $users = $this->userManager->search('');
     } else {
         $users = $input->getArgument('user_id');
     }
     foreach ($users as $user) {
         if (is_object($user)) {
             $user = $user->getUID();
         }
         $this->scanFiles($user, $output);
     }
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:15,代码来源:scan.php

示例6: setupFS

 public static function setupFS($user = '')
 {
     // configure the initial filesystem based on the configuration
     if (self::$fsSetup) {
         //setting up the filesystem twice can only lead to trouble
         return false;
     }
     // If we are not forced to load a specific user we load the one that is logged in
     if ($user == "" && OC_User::isLoggedIn()) {
         $user = OC_User::getUser();
     }
     // load all filesystem apps before, so no setup-hook gets lost
     if (!isset($RUNTIME_NOAPPS) || !$RUNTIME_NOAPPS) {
         OC_App::loadApps(array('filesystem'));
     }
     // the filesystem will finish when $user is not empty,
     // mark fs setup here to avoid doing the setup from loading
     // OC_Filesystem
     if ($user != '') {
         self::$fsSetup = true;
     }
     $CONFIG_DATADIRECTORY = OC_Config::getValue("datadirectory", OC::$SERVERROOT . "/data");
     //first set up the local "root" storage
     if (!self::$rootMounted) {
         OC_Filesystem::mount('OC_Filestorage_Local', array('datadir' => $CONFIG_DATADIRECTORY), '/');
         self::$rootMounted = true;
     }
     if ($user != "") {
         //if we aren't logged in, there is no use to set up the filesystem
         $user_dir = '/' . $user . '/files';
         $user_root = OC_User::getHome($user);
         $userdirectory = $user_root . '/files';
         if (!is_dir($userdirectory)) {
             mkdir($userdirectory, 0755, true);
         }
         //jail the user into his "home" directory
         OC_Filesystem::mount('OC_Filestorage_Local', array('datadir' => $user_root), $user);
         OC_Filesystem::init($user_dir, $user);
         $quotaProxy = new OC_FileProxy_Quota();
         $fileOperationProxy = new OC_FileProxy_FileOperations();
         OC_FileProxy::register($quotaProxy);
         OC_FileProxy::register($fileOperationProxy);
         // Load personal mount config
         self::loadUserMountPoints($user);
         OC_Hook::emit('OC_Filesystem', 'setup', array('user' => $user, 'user_dir' => $user_dir));
     }
 }
开发者ID:ryanshoover,项目名称:core,代码行数:47,代码来源:util.php

示例7: handleRequest

 /**
  * Handle the request
  */
 public static function handleRequest()
 {
     \OC::$server->getEventLogger()->start('handle_request', 'Handle request');
     $systemConfig = \OC::$server->getSystemConfig();
     // 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 (!$systemConfig->getValue('installed', false)) {
         \OC::$server->getSession()->clear();
         $setupHelper = new OC\Setup(\OC::$server->getConfig(), \OC::$server->getIniWrapper(), \OC::$server->getL10N('lib'), new \OC_Defaults(), \OC::$server->getLogger(), \OC::$server->getSecureRandom());
         $controller = new OC\Core\Controller\SetupController($setupHelper);
         $controller->run($_POST);
         exit;
     }
     $request = \OC::$server->getRequest();
     // Check if requested URL matches 'index.php/occ'
     $isOccControllerRequested = preg_match('|/index\\.php$|', $request->getScriptName()) === 1 && strpos($request->getPathInfo(), '/occ/') === 0;
     $requestPath = $request->getRawPathInfo();
     if (substr($requestPath, -3) !== '.js') {
         // we need these files during the upgrade
         self::checkMaintenanceMode($request);
         $needUpgrade = self::checkUpgrade(!$isOccControllerRequested);
     }
     // emergency app disabling
     if ($requestPath === '/disableapp' && $request->getMethod() === 'POST' && (string) $request->getParam('appid') !== '') {
         \OCP\JSON::callCheck();
         \OCP\JSON::checkAdminUser();
         $appId = (string) $request->getParam('appid');
         $appId = \OC_App::cleanAppId($appId);
         \OC_App::disable($appId);
         \OC_JSON::success();
         exit;
     }
     try {
         // Always load authentication apps
         OC_App::loadApps(['authentication']);
     } catch (\OC\NeedsUpdateException $e) {
         if ($isOccControllerRequested && $needUpgrade) {
             OC::$server->getRouter()->match(\OC::$server->getRequest()->getRawPathInfo());
             return;
         }
         throw $e;
     }
     // Load minimum set of apps
     if (!self::checkUpgrade(false) && !$systemConfig->getValue('maintenance', false)) {
         // For logged-in users: Load everything
         if (OC_User::isLoggedIn()) {
             OC_App::loadApps();
         } else {
             // For guests: Load only filesystem and logging
             OC_App::loadApps(array('filesystem', 'logging'));
             self::handleLogin($request);
         }
     }
     if (!self::$CLI) {
         try {
             if (!$systemConfig->getValue('maintenance', false) && !self::checkUpgrade(false)) {
                 OC_App::loadApps(array('filesystem', 'logging'));
                 OC_App::loadApps();
             }
             self::checkSingleUserMode();
             OC_Util::setupFS();
             OC::$server->getRouter()->match(\OC::$server->getRequest()->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;
         }
     }
     // 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();
         OC_Util::setupFS();
         // FIXME
         // Redirect to default application
         OC_Util::redirectToDefaultPage();
     } else {
         // Not handled and not logged in
         header('Location: ' . \OC::$server->getURLGenerator()->linkToRouteAbsolute('core.login.showLoginForm'));
     }
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:97,代码来源:base.php

示例8: tryFormLogin

 /**
  * Tries to login a user using the formbased authentication
  * @return bool|void
  */
 protected static function tryFormLogin()
 {
     if (!isset($_POST["user"]) || !isset($_POST['password'])) {
         return false;
     }
     OC_JSON::callCheck();
     OC_App::loadApps();
     //setup extra user backends
     OC_User::setupBackends();
     if (OC_User::login($_POST["user"], $_POST["password"])) {
         // setting up the time zone
         if (isset($_POST['timezone-offset'])) {
             self::$server->getSession()->set('timezone', $_POST['timezone-offset']);
         }
         $userid = OC_User::getUser();
         self::cleanupLoginTokens($userid);
         if (!empty($_POST["remember_login"])) {
             if (defined("DEBUG") && DEBUG) {
                 OC_Log::write('core', 'Setting remember login to cookie', OC_Log::DEBUG);
             }
             $token = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(32);
             OC_Preferences::setValue($userid, 'login_token', $token, time());
             OC_User::setMagicInCookie($userid, $token);
         } else {
             OC_User::unsetMagicInCookie();
         }
         OC_Util::redirectToDefaultPage();
         exit;
     }
     return true;
 }
开发者ID:pinoniq,项目名称:core,代码行数:35,代码来源:base.php

示例9: init


//.........这里部分代码省略.........
         $_SERVER['PHP_AUTH_USER'] = strip_tags($name);
         $_SERVER['PHP_AUTH_PW'] = strip_tags($password);
     }
     self::initPaths();
     // register the stream wrappers
     require_once 'streamwrappers.php';
     stream_wrapper_register("fakedir", "OC_FakeDirStream");
     stream_wrapper_register('static', 'OC_StaticStreamWrapper');
     stream_wrapper_register('close', 'OC_CloseStreamWrapper');
     self::checkInstalled();
     self::checkSSL();
     // CSRF protection
     if (isset($_SERVER['HTTP_REFERER'])) {
         $referer = $_SERVER['HTTP_REFERER'];
     } else {
         $referer = '';
     }
     $refererhost = parse_url($referer);
     if (isset($refererhost['host'])) {
         $refererhost = $refererhost['host'];
     } else {
         $refererhost = '';
     }
     $server = OC_Helper::serverHost();
     $serverhost = explode(':', $server);
     $serverhost = $serverhost['0'];
     if ($_SERVER['REQUEST_METHOD'] == 'POST' and $refererhost != $serverhost) {
         $url = OC_Helper::serverProtocol() . '://' . $server . OC::$WEBROOT . '/index.php';
         header("Location: {$url}");
         exit;
     }
     self::initSession();
     self::initTemplateEngine();
     self::checkUpgrade();
     $errors = OC_Util::checkServer();
     if (count($errors) > 0) {
         OC_Template::printGuestPage('', 'error', array('errors' => $errors));
         exit;
     }
     // TODO: we should get rid of this one, too
     // WARNING: to make everything even more confusing,
     //   DATADIRECTORY is a var that changes and DATADIRECTORY_ROOT
     //   stays the same, but is set by "datadirectory".
     //   Any questions?
     OC::$CONFIG_DATADIRECTORY = OC_Config::getValue("datadirectory", OC::$SERVERROOT . "/data");
     // User and Groups
     if (!OC_Config::getValue("installed", false)) {
         $_SESSION['user_id'] = '';
     }
     OC_User::useBackend(OC_Config::getValue("userbackend", "database"));
     OC_Group::useBackend(new OC_Group_Database());
     // Set up file system unless forbidden
     global $RUNTIME_NOSETUPFS;
     if (!$RUNTIME_NOSETUPFS) {
         OC_Util::setupFS();
     }
     // Load Apps
     // This includes plugins for users and filesystems as well
     global $RUNTIME_NOAPPS;
     global $RUNTIME_APPTYPES;
     if (!$RUNTIME_NOAPPS) {
         if ($RUNTIME_APPTYPES) {
             OC_App::loadApps($RUNTIME_APPTYPES);
         } else {
             OC_App::loadApps();
         }
     }
     // Check for blacklisted files
     OC_Hook::connect('OC_Filesystem', 'write', 'OC_Filesystem', 'isBlacklisted');
     //make sure temporary files are cleaned up
     register_shutdown_function(array('OC_Helper', 'cleanTmp'));
     //parse the given parameters
     self::$REQUESTEDAPP = isset($_GET['app']) && trim($_GET['app']) != '' && !is_null($_GET['app']) ? str_replace(array('\\0', '/', '\\', '..'), '', strip_tags($_GET['app'])) : OC_Config::getValue('defaultapp', 'files');
     if (substr_count(self::$REQUESTEDAPP, '?') != 0) {
         $app = substr(self::$REQUESTEDAPP, 0, strpos(self::$REQUESTEDAPP, '?'));
         $param = substr(self::$REQUESTEDAPP, strpos(self::$REQUESTEDAPP, '?') + 1);
         parse_str($param, $get);
         $_GET = array_merge($_GET, $get);
         self::$REQUESTEDAPP = $app;
         $_GET['app'] = $app;
     }
     self::$REQUESTEDFILE = isset($_GET['getfile']) ? $_GET['getfile'] : null;
     if (substr_count(self::$REQUESTEDFILE, '?') != 0) {
         $file = substr(self::$REQUESTEDFILE, 0, strpos(self::$REQUESTEDFILE, '?'));
         $param = substr(self::$REQUESTEDFILE, strpos(self::$REQUESTEDFILE, '?') + 1);
         parse_str($param, $get);
         $_GET = array_merge($_GET, $get);
         self::$REQUESTEDFILE = $file;
         $_GET['getfile'] = $file;
     }
     if (!is_null(self::$REQUESTEDFILE)) {
         $subdir = OC::$APPSROOT . '/apps/' . self::$REQUESTEDAPP . '/' . self::$REQUESTEDFILE;
         $parent = OC::$APPSROOT . '/apps/' . self::$REQUESTEDAPP;
         if (!OC_Helper::issubdirectory($subdir, $parent)) {
             self::$REQUESTEDFILE = null;
             header('HTTP/1.0 404 Not Found');
             exit;
         }
     }
 }
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:101,代码来源:base.php

示例10: tryFormLogin

 /**
  * Tries to login a user using the form based authentication
  * @return bool|void
  */
 protected static function tryFormLogin()
 {
     if (!isset($_POST["user"]) || !isset($_POST['password'])) {
         return false;
     }
     if (!OC_Util::isCallRegistered()) {
         return false;
     }
     OC_App::loadApps();
     //setup extra user backends
     OC_User::setupBackends();
     if (OC_User::login((string) $_POST["user"], (string) $_POST["password"])) {
         $userId = OC_User::getUser();
         // setting up the time zone
         if (isset($_POST['timezone-offset'])) {
             self::$server->getSession()->set('timezone', (string) $_POST['timezone-offset']);
             self::$server->getConfig()->setUserValue($userId, 'core', 'timezone', (string) $_POST['timezone']);
         }
         self::cleanupLoginTokens($userId);
         if (!empty($_POST["remember_login"])) {
             $config = self::$server->getConfig();
             if ($config->getSystemValue('debug', false)) {
                 self::$server->getLogger()->debug('Setting remember login to cookie', array('app' => 'core'));
             }
             $token = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(32);
             $config->setUserValue($userId, 'login_token', $token, time());
             OC_User::setMagicInCookie($userId, $token);
         } else {
             OC_User::unsetMagicInCookie();
         }
         OC_Util::redirectToDefaultPage();
         exit;
     }
     return true;
 }
开发者ID:krsvital,项目名称:core,代码行数:39,代码来源:base.php

示例11: handleApacheAuth

 /**
  * Verify with Apache whether user is authenticated.
  *
  * @return boolean|null
  *          true: authenticated
  *          false: not authenticated
  *          null: not handled / no backend available
  */
 public static function handleApacheAuth()
 {
     $backend = self::findFirstActiveUsedBackend();
     if ($backend) {
         OC_App::loadApps();
         //setup extra user backends
         self::setupBackends();
         self::unsetMagicInCookie();
         return self::loginWithApache($backend);
     }
     return null;
 }
开发者ID:TechArea,项目名称:core,代码行数:20,代码来源:user.php

示例12: countUsers

 private function countUsers()
 {
     \OC_App::loadApps(array('authentication'));
     $userManager = \OC::$server->getUserManager();
     return $userManager->countUsers();
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:6,代码来源:report.php

示例13: tryBasicAuthLogin

 protected static function tryBasicAuthLogin()
 {
     if (!isset($_SERVER["PHP_AUTH_USER"]) || !isset($_SERVER["PHP_AUTH_PW"])) {
         return false;
     }
     OC_App::loadApps(array('authentication'));
     if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) {
         //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG);
         OC_User::unsetMagicInCookie();
         $_REQUEST['redirect_url'] = OC_Request::requestUri();
         OC_Util::redirectToDefaultPage();
     }
     return true;
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:14,代码来源:base.php

示例14: upgrade

 /**
  * runs the update actions in maintenance mode, does not upgrade the source files
  */
 public function upgrade()
 {
     \OC_DB::enableCaching(false);
     \OC_Config::setValue('maintenance', true);
     $installedVersion = \OC_Config::getValue('version', '0.0.0');
     $currentVersion = implode('.', \OC_Util::getVersion());
     if ($this->log) {
         $this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core'));
     }
     $this->emit('\\OC\\Updater', 'maintenanceStart');
     // create empty file in data dir, so we can later find
     // out that this is indeed an ownCloud data directory
     // (in case it didn't exist before)
     file_put_contents(\OC_Config::getValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
     /*
      * START CONFIG CHANGES FOR OLDER VERSIONS
      */
     if (!\OC::$CLI && version_compare($installedVersion, '6.00.4', '<')) {
         // Add the trusted_domains config if it is not existant
         // This is added to prevent host header poisoning
         \OC_Config::setValue('trusted_domains', \OC_Config::getValue('trusted_domains', array(\OC_Request::serverHost())));
     }
     /*
      * STOP CONFIG CHANGES FOR OLDER VERSIONS
      */
     try {
         \OC_DB::updateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
         $this->emit('\\OC\\Updater', 'dbUpgrade');
         // do a file cache upgrade for users with files
         // this can take loooooooooooooooooooooooong
         $this->upgradeFileCache();
     } catch (\Exception $exception) {
         $this->emit('\\OC\\Updater', 'failure', array($exception->getMessage()));
     }
     \OC_Config::setValue('version', implode('.', \OC_Util::getVersion()));
     \OC_App::checkAppsRequirements();
     // load all apps to also upgrade enabled apps
     \OC_App::loadApps();
     $repair = new Repair();
     $repair->run();
     //Invalidate update feed
     \OC_Appconfig::setValue('core', 'lastupdatedat', 0);
     \OC_Config::setValue('maintenance', false);
     $this->emit('\\OC\\Updater', 'maintenanceEnd');
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:48,代码来源:updater.php

示例15: tryBasicAuthLogin

 protected static function tryBasicAuthLogin()
 {
     if (!isset($_SERVER["PHP_AUTH_USER"]) || !isset($_SERVER["PHP_AUTH_PW"])) {
         return false;
     }
     OC_App::loadApps(array('authentication'));
     if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) {
         //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG);
         OC_User::unsetMagicInCookie();
         $_SERVER['HTTP_REQUESTTOKEN'] = OC_Util::callRegister();
     }
     return true;
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:13,代码来源:base.php


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