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


PHP OC_Config::getValue方法代码示例

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


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

示例1: getServerConfigurationPrefixes

    /**
     * returns prefixes for each saved LDAP/AD server configuration.
     * @param bool $activeConfigurations optional, whether only active configuration shall be
     * retrieved, defaults to false
     * @return array with a list of the available prefixes
     *
     * Configuration prefixes are used to set up configurations for n LDAP or
     * AD servers. Since configuration is stored in the database, table
     * appconfig under appid user_ldap, the common identifiers in column
     * 'configkey' have a prefix. The prefix for the very first server
     * configuration is empty.
     * Configkey Examples:
     * Server 1: ldap_login_filter
     * Server 2: s1_ldap_login_filter
     * Server 3: s2_ldap_login_filter
     *
     * The prefix needs to be passed to the constructor of Connection class,
     * except the default (first) server shall be connected to.
     *
     */
    public function getServerConfigurationPrefixes($activeConfigurations = false)
    {
        $referenceConfigkey = 'ldap_configuration_active';
        $sql = '
			SELECT DISTINCT `configkey`
			FROM `*PREFIX*appconfig`
			WHERE `appid` = \'user_ldap\'
				AND `configkey` LIKE ?
		';
        if ($activeConfigurations) {
            if (\OC_Config::getValue('dbtype', 'sqlite') === 'oci') {
                //FIXME oracle hack: need to explicitly cast CLOB to CHAR for comparison
                $sql .= ' AND to_char(`configvalue`)=\'1\'';
            } else {
                $sql .= ' AND `configvalue` = \'1\'';
            }
        }
        $stmt = \OCP\DB::prepare($sql);
        $serverConfigs = $stmt->execute(array('%' . $referenceConfigkey))->fetchAll();
        $prefixes = array();
        foreach ($serverConfigs as $serverConfig) {
            $len = strlen($serverConfig['configkey']) - strlen($referenceConfigkey);
            $prefixes[] = substr($serverConfig['configkey'], 0, $len);
        }
        return $prefixes;
    }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:46,代码来源:helper.php

示例2: __construct

 /**
  * @brief Constructor
  * @param string $app app providing the template
  * @param string $name of the template file (without suffix)
  * @param string $renderas = ""; produce a full page
  * @return OC_Template object
  *
  * This function creates an OC_Template object.
  *
  * If $renderas is set, OC_Template will try to produce a full page in the
  * according layout. For now, renderas can be set to "guest", "user" or
  * "admin".
  */
 public function __construct($app, $name, $renderas = "")
 {
     // Read the selected theme from the config file
     $theme = OC_Util::getTheme();
     // Read the detected formfactor and use the right file name.
     $fext = self::getFormFactorExtension();
     $requesttoken = OC::$session ? OC_Util::callRegister() : '';
     $parts = explode('/', $app);
     // fix translation when app is something like core/lostpassword
     $l10n = OC_L10N::get($parts[0]);
     $themeDefaults = new OC_Defaults();
     list($path, $template) = $this->findTemplate($theme, $app, $name, $fext);
     // Set the private data
     $this->renderas = $renderas;
     $this->path = $path;
     parent::__construct($template, $requesttoken, $l10n, $themeDefaults);
     // Some headers to enhance security
     header('X-XSS-Protection: 1; mode=block');
     // Enforce browser based XSS filters
     header('X-Content-Type-Options: nosniff');
     // Disable sniffing the content type for IE
     // iFrame Restriction Policy
     $xFramePolicy = OC_Config::getValue('xframe_restriction', true);
     if ($xFramePolicy) {
         header('X-Frame-Options: Sameorigin');
         // Disallow iFraming from other domains
     }
     // Content Security Policy
     // If you change the standard policy, please also change it in config.sample.php
     $policy = OC_Config::getValue('custom_csp_policy', 'default-src \'self\'; ' . 'script-src \'self\' \'unsafe-eval\'; ' . 'style-src \'self\' \'unsafe-inline\'; ' . 'frame-src *; ' . 'img-src *; ' . 'font-src \'self\' data:; ' . 'media-src *');
     header('Content-Security-Policy:' . $policy);
     // Standard
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:46,代码来源:template.php

示例3: runStep

 /**
  * Send an email to {$limit} users
  *
  * @param int $limit Number of users we want to send an email to
  * @return int Number of users we sent an email to
  */
 protected function runStep($limit)
 {
     // Get all users which should receive an email
     $affectedUsers = $this->mqHandler->getAffectedUsers($limit);
     if (empty($affectedUsers)) {
         // No users found to notify, mission abort
         return 0;
     }
     $preferences = new \OC\Preferences(\OC_DB::getConnection());
     $userLanguages = $preferences->getValueForUsers('core', 'lang', $affectedUsers);
     $userEmails = $preferences->getValueForUsers('settings', 'email', $affectedUsers);
     // Get all items for these users
     // We don't use time() but "time() - 1" here, so we don't run into
     // runtime issues and delete emails later, which were created in the
     // same second, but were not collected for the emails.
     $sendTime = time() - 1;
     $mailData = $this->mqHandler->getItemsForUsers($affectedUsers, $sendTime);
     // Send Email
     $default_lang = \OC_Config::getValue('default_language', 'en');
     foreach ($mailData as $user => $data) {
         if (!isset($userEmails[$user])) {
             // The user did not setup an email address
             // So we will not send an email :(
             continue;
         }
         $language = isset($userLanguages[$user]) ? $userLanguages[$user] : $default_lang;
         $this->mqHandler->sendEmailToUser($user, $userEmails[$user], $language, $data);
     }
     // Delete all entries we dealt with
     $this->mqHandler->deleteSentItems($affectedUsers, $sendTime);
     return sizeof($affectedUsers);
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:38,代码来源:emailnotification.php

示例4: write

 /**
  * write a message in the log
  * @param string $app
  * @param string $message
  * @param int $level
  */
 public static function write($app, $message, $level)
 {
     $minLevel = min(OC_Config::getValue("loglevel", OC_Log::WARN), OC_Log::ERROR);
     if ($level >= $minLevel) {
         error_log('[owncloud][' . $app . '] ' . $message);
     }
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:13,代码来源:errorlog.php

示例5: start

 /**
  * Start a editing session or return an existing one
  * @param string $uid of the user starting a session
  * @param \OCA\Documents\File $file - file object
  * @return array
  * @throws \Exception
  */
 public static function start($uid, $file)
 {
     // Create a directory to store genesis
     $genesis = new Genesis($file);
     list($ownerView, $path) = $file->getOwnerViewAndPath();
     $oldSession = new Db_Session();
     $oldSession->loadBy('file_id', $file->getFileId());
     //If there is no existing session we need to start a new one
     if (!$oldSession->hasData()) {
         $newSession = new Db_Session(array($genesis->getPath(), $genesis->getHash(), $file->getOwner(), $file->getFileId()));
         if (!$newSession->insert()) {
             throw new \Exception('Failed to add session into database');
         }
     }
     $sessionData = $oldSession->loadBy('file_id', $file->getFileId())->getData();
     $memberColor = Helper::getMemberColor($uid);
     $member = new Db_Member(array($sessionData['es_id'], $uid, $memberColor, time(), intval($file->isPublicShare()), $file->getToken()));
     if ($member->insert()) {
         // Do we have OC_Avatar in out disposal?
         if (!class_exists('\\OC_Avatar') || \OC_Config::getValue('enable_avatars', true) !== true) {
             $imageUrl = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAAAAACH5BAAAAAAALAAAAAABAAEAAAICTAEAOw==';
         } else {
             $imageUrl = $uid;
         }
         $displayName = $file->isPublicShare() ? $uid . ' ' . Db_Member::getGuestPostfix() : \OCP\User::getDisplayName($uid);
         $sessionData['member_id'] = (string) $member->getLastInsertId();
         $op = new Db_Op();
         $op->addMember($sessionData['es_id'], $sessionData['member_id'], $displayName, $memberColor, $imageUrl);
     } else {
         throw new \Exception('Failed to add member into database');
     }
     $sessionData['title'] = basename($path);
     $sessionData['permissions'] = $ownerView->getFilePermissions($path);
     return $sessionData;
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:42,代码来源:session.php

示例6: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->appstore = OC_Config::getValue('appstoreenabled', true);
     OC_Config::setValue('appstoreenabled', true);
     OC_Installer::removeApp(self::$appid);
 }
开发者ID:evanjt,项目名称:core,代码行数:7,代码来源:installer.php

示例7: sendEmail

 public static function sendEmail($args)
 {
     $isEncrypted = OC_App::isEnabled('files_encryption');
     if (!$isEncrypted || isset($_POST['continue'])) {
         $continue = true;
     } else {
         $continue = false;
     }
     if (OC_User::userExists($_POST['user']) && $continue) {
         $token = hash('sha256', OC_Util::generate_random_bytes(30) . OC_Config::getValue('passwordsalt', ''));
         OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', hash('sha256', $token));
         // Hash the token again to prevent timing attacks
         $email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
         if (!empty($email)) {
             $link = OC_Helper::linkToRoute('core_lostpassword_reset', array('user' => $_POST['user'], 'token' => $token));
             $link = OC_Helper::makeURLAbsolute($link);
             $tmpl = new OC_Template('core/lostpassword', 'email');
             $tmpl->assign('link', $link, false);
             $msg = $tmpl->fetchPage();
             $l = OC_L10N::get('core');
             $from = OCP\Util::getDefaultEmailAddress('lostpassword-noreply');
             try {
                 OC_Mail::send($email, $_POST['user'], $l->t('ownCloud password reset'), $msg, $from, 'ownCloud');
             } catch (Exception $e) {
                 OC_Template::printErrorPage('A problem occurs during sending the e-mail please contact your administrator.');
             }
             self::displayLostPasswordPage(false, true);
         } else {
             self::displayLostPasswordPage(true, false);
         }
     } else {
         self::displayLostPasswordPage(true, false);
     }
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:34,代码来源:controller.php

示例8: setUp

 public function setUp()
 {
     //clear all proxies and hooks so we can do clean testing
     \OC_FileProxy::clearProxies();
     \OC_Hook::clear('OC_Filesystem');
     //disabled atm
     //enable only the encryption hook if needed
     //if(OC_App::isEnabled('files_encryption')) {
     //	OC_FileProxy::register(new OC_FileProxy_Encryption());
     //}
     //set up temporary storage
     \OC\Files\Filesystem::clearMounts();
     $storage = new \OC\Files\Storage\Temporary(array());
     \OC\Files\Filesystem::mount($storage, array(), '/');
     $datadir = str_replace('local::', '', $storage->getId());
     $this->datadir = \OC_Config::getValue('cachedirectory', \OC::$SERVERROOT . '/data/cache');
     \OC_Config::setValue('cachedirectory', $datadir);
     \OC_User::clearBackends();
     \OC_User::useBackend(new \OC_User_Dummy());
     //login
     \OC_User::createUser('test', 'test');
     $this->user = \OC_User::getUser();
     \OC_User::setUserId('test');
     //set up the users dir
     $rootView = new \OC\Files\View('');
     $rootView->mkdir('/test');
     $this->instance = new \OC\Cache\File();
 }
开发者ID:Romua1d,项目名称:core,代码行数:28,代码来源:file.php

示例9: prepare

 /**
  * Prepares an SQL statement.
  *
  * @param string $statement The SQL statement to prepare.
  * @param int $limit
  * @param int $offset
  * @return \Doctrine\DBAL\Driver\Statement The prepared statement.
  */
 public function prepare($statement, $limit = null, $offset = null)
 {
     if ($limit === -1) {
         $limit = null;
     }
     if (!is_null($limit)) {
         $platform = $this->getDatabasePlatform();
         $statement = $platform->modifyLimitQuery($statement, $limit, $offset);
     } else {
         if (isset($this->preparedQueries[$statement]) && $this->cachingQueryStatementEnabled) {
             return $this->preparedQueries[$statement];
         }
         $origStatement = $statement;
     }
     $statement = $this->replaceTablePrefix($statement);
     $statement = $this->adapter->fixupStatement($statement);
     if (\OC_Config::getValue('log_query', false)) {
         \OC_Log::write('core', 'DB prepare : ' . $statement, \OC_Log::DEBUG);
     }
     $result = parent::prepare($statement);
     if (is_null($limit) && $this->cachingQueryStatementEnabled) {
         $this->preparedQueries[$origStatement] = $result;
     }
     return $result;
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:33,代码来源:connection.php

示例10: createDatabase

 /**
  * create a new database
  *
  * @param string $name    name of the database that should be created
  * @param array  $options array with charset info
  *
  * @return mixed MDB2_OK on success, a MDB2 error on failure
  * @access public
  */
 function createDatabase($name, $options = array())
 {
     $datadir = OC_Config::getValue("datadirectory", OC::$SERVERROOT . "/data");
     $db = $this->getDBInstance();
     if (PEAR::isError($db)) {
         return $db;
     }
     $database_file = $db->_getDatabaseFile($name);
     if (file_exists($database_file)) {
         return $db->raiseError(MDB2_ERROR_ALREADY_EXISTS, null, null, 'database already exists', __FUNCTION__);
     }
     $php_errormsg = '';
     $database_file = "{$datadir}/{$database_file}.db";
     $handle = new SQLite3($database_file);
     if (!$handle) {
         return $db->raiseError(MDB2_ERROR_CANNOT_CREATE, null, null, isset($php_errormsg) ? $php_errormsg : 'could not create the database file', __FUNCTION__);
     }
     //sqlite doesn't support the latin1 we use
     //         if (!empty($options['charset'])) {
     //             $query = 'PRAGMA encoding = ' . $db->quote($options['charset'], 'text');
     //             $handle->exec($query);
     //         }
     $handle->close();
     return MDB2_OK;
 }
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:34,代码来源:sqlite3.php

示例11: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $appManager = \OC::$server->getAppManager();
     self::$trashBinStatus = $appManager->isEnabledForUser('files_trashbin');
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     // clear share hooks
     \OC_Hook::clear('OCP\\Share');
     \OC::registerShareHooks();
     $application = new \OCA\Files_Sharing\AppInfo\Application();
     $application->registerMountProviders();
     $application->setupPropagation();
     //disable encryption
     \OC_App::disable('encryption');
     //configure trashbin
     self::$rememberRetentionObligation = \OC_Config::getValue('trashbin_retention_obligation', Files_Trashbin\Trashbin::DEFAULT_RETENTION_OBLIGATION);
     \OC_Config::setValue('trashbin_retention_obligation', 2);
     self::$rememberAutoExpire = \OC_Config::getValue('trashbin_auto_expire', true);
     \OC_Config::setValue('trashbin_auto_expire', true);
     // register hooks
     Files_Trashbin\Trashbin::registerHooks();
     // create test user
     self::loginHelper(self::TEST_TRASHBIN_USER2, true);
     self::loginHelper(self::TEST_TRASHBIN_USER1, true);
 }
开发者ID:brunomilet,项目名称:owncloud-core,代码行数:27,代码来源:trashbin.php

示例12: testParentOfMountPointIsGone

 /**
  * if the parent of the mount point is gone then the mount point should move up
  *
  * @medium
  */
 function testParentOfMountPointIsGone()
 {
     // share to user
     $fileinfo = $this->view->getFileInfo($this->folder);
     $result = \OCP\Share::shareItem('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31);
     $this->assertTrue($result);
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     $user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
     $this->assertTrue($user2View->file_exists($this->folder));
     // create a local folder
     $result = $user2View->mkdir('localfolder');
     $this->assertTrue($result);
     // move mount point to local folder
     $result = $user2View->rename($this->folder, '/localfolder/' . $this->folder);
     $this->assertTrue($result);
     // mount point in the root folder should no longer exist
     $this->assertFalse($user2View->is_dir($this->folder));
     // delete the local folder
     $fullPath = \OC_Config::getValue('datadirectory') . '/' . self::TEST_FILES_SHARING_API_USER2 . '/files/localfolder';
     rmdir($fullPath);
     //enforce reload of the mount points
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     //mount point should be back at the root
     $this->assertTrue($user2View->is_dir($this->folder));
     //cleanup
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     $this->view->unlink($this->folder);
 }
开发者ID:Romua1d,项目名称:core,代码行数:33,代码来源:sharedstorage.php

示例13: setUp

	protected function setUp() {
		parent::setUp();

		//clear all proxies and hooks so we can do clean testing
		\OC_Hook::clear('OC_Filesystem');

		//set up temporary storage
		$this->storage = \OC\Files\Filesystem::getStorage('/');
		\OC\Files\Filesystem::clearMounts();
		$storage = new \OC\Files\Storage\Temporary(array());
		\OC\Files\Filesystem::mount($storage,array(),'/');
		$datadir = str_replace('local::', '', $storage->getId());
		$this->datadir = \OC_Config::getValue('cachedirectory', \OC::$SERVERROOT.'/data/cache');
		\OC_Config::setValue('cachedirectory', $datadir);

		\OC_User::clearBackends();
		\OC_User::useBackend(new \OC_User_Dummy());

		//login
		\OC_User::createUser('test', 'test');

		$this->user = \OC_User::getUser();
		\OC_User::setUserId('test');

		//set up the users dir
		$this->rootView = new \OC\Files\View('');
		$this->rootView->mkdir('/test');

		$this->instance=new \OC\Cache\File();

		// forces creation of cache folder for subsequent tests
		$this->instance->set('hack', 'hack');
	}
开发者ID:ninjasilicon,项目名称:core,代码行数:33,代码来源:file.php

示例14: getEntries

 /**
  * get entries from the log in reverse chronological order
  * @param int limit
  * @param int offset
  * @return array
  */
 public static function getEntries($limit = 50, $offset = 0)
 {
     self::init();
     $minLevel = OC_Config::getValue("loglevel", OC_Log::WARN);
     $entries = array();
     $handle = @fopen(self::$logFile, 'r');
     if ($handle) {
         // Just a guess to set the file pointer to the right spot
         $maxLineLength = 150;
         fseek($handle, -($limit * $maxLineLength + $offset * $maxLineLength), SEEK_END);
         // Skip first line, because it is most likely a partial line
         fgets($handle);
         while (!feof($handle)) {
             $line = fgets($handle);
             if (!empty($line)) {
                 $entry = json_decode($line);
                 if ($entry->level >= $minLevel) {
                     $entries[] = $entry;
                 }
             }
         }
         fclose($handle);
         // Extract the needed entries and reverse the order
         $entries = array_reverse(array_slice($entries, -($limit + $offset), $limit));
     }
     return $entries;
 }
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:33,代码来源:owncloud.php

示例15: sendEmail

 public static function sendEmail($args)
 {
     if (OC_User::userExists($_POST['user'])) {
         $token = hash('sha256', OC_Util::generate_random_bytes(30) . OC_Config::getValue('passwordsalt', ''));
         OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', hash('sha256', $token));
         // Hash the token again to prevent timing attacks
         $email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
         if (!empty($email)) {
             $link = OC_Helper::linkToRoute('core_lostpassword_reset', array('user' => $_POST['user'], 'token' => $token));
             $link = OC_Helper::makeURLAbsolute($link);
             $tmpl = new OC_Template('core/lostpassword', 'email');
             $tmpl->assign('link', $link, false);
             $msg = $tmpl->fetchPage();
             $l = OC_L10N::get('core');
             $from = 'lostpassword-noreply@' . OCP\Util::getServerHost();
             OC_Mail::send($email, $_POST['user'], $l->t('ownCloud password reset'), $msg, $from, 'ownCloud');
             echo 'Mailsent';
             self::displayLostPasswordPage(false, true);
         } else {
             self::displayLostPasswordPage(true, false);
         }
     } else {
         self::displayLostPasswordPage(true, false);
     }
 }
开发者ID:ryanshoover,项目名称:core,代码行数:25,代码来源:controller.php


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