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


PHP OC_Request类代码示例

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


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

示例1: put

 /**
  * Updates the data
  *
  * The data argument is a readable stream resource.
  *
  * After a succesful put operation, you may choose to return an ETag. The
  * etag must always be surrounded by double-quotes. These quotes must
  * appear in the actual string you're returning.
  *
  * Clients may use the ETag from a PUT request to later on make sure that
  * when they update the file, the contents haven't changed in the mean
  * time.
  *
  * If you don't plan to store the file byte-by-byte, and you return a
  * different object on a subsequent GET you are strongly recommended to not
  * return an ETag, and just return null.
  *
  * @param resource $data
  * @throws Sabre_DAV_Exception_Forbidden
  * @return string|null
  */
 public function put($data)
 {
     if (!\OC\Files\Filesystem::isUpdatable($this->path)) {
         throw new \Sabre_DAV_Exception_Forbidden();
     }
     // mark file as partial while uploading (ignored by the scanner)
     $partpath = $this->path . '.part';
     \OC\Files\Filesystem::file_put_contents($partpath, $data);
     //detect aborted upload
     if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
         if (isset($_SERVER['CONTENT_LENGTH'])) {
             $expected = $_SERVER['CONTENT_LENGTH'];
             $actual = \OC\Files\Filesystem::filesize($partpath);
             if ($actual != $expected) {
                 \OC\Files\Filesystem::unlink($partpath);
                 throw new Sabre_DAV_Exception_BadRequest('expected filesize ' . $expected . ' got ' . $actual);
             }
         }
     }
     // rename to correct path
     \OC\Files\Filesystem::rename($partpath, $this->path);
     //allow sync clients to send the mtime along in a header
     $mtime = OC_Request::hasModificationTime();
     if ($mtime !== false) {
         if (\OC\Files\Filesystem::touch($this->path, $mtime)) {
             header('X-OC-MTime: accepted');
         }
     }
     return OC_Connector_Sabre_Node::getETagPropertyForPath($this->path);
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:51,代码来源:file.php

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

示例3: __construct

 public function __construct()
 {
     $baseUrl = OC_Helper::linkTo('', 'index.php');
     $method = $_SERVER['REQUEST_METHOD'];
     $host = OC_Request::serverHost();
     $schema = OC_Request::serverProtocol();
     $this->context = new RequestContext($baseUrl, $method, $host, $schema);
     // TODO cache
     $this->root = $this->getCollection('root');
 }
开发者ID:ryanshoover,项目名称:core,代码行数:10,代码来源:router.php

示例4: createFile

 /**
  * Creates a new file in the directory
  *
  * Data will either be supplied as a stream resource, or in certain cases
  * as a string. Keep in mind that you may have to support either.
  *
  * After succesful creation of the file, you may choose to return the ETag
  * of the new file here.
  *
  * The returned ETag must be surrounded by double-quotes (The quotes should
  * be part of the actual string).
  *
  * If you cannot accurately determine the ETag, you should not return it.
  * If you don't store the file exactly as-is (you're transforming it
  * somehow) you should also not return an ETag.
  *
  * This means that if a subsequent GET to this new file does not exactly
  * return the same contents of what was submitted here, you are strongly
  * recommended to omit the ETag.
  *
  * @param string $name Name of the file
  * @param resource|string $data Initial payload
  * @throws Sabre_DAV_Exception_Forbidden
  * @return null|string
  */
 public function createFile($name, $data = null)
 {
     if (!\OC\Files\Filesystem::isCreatable($this->path)) {
         throw new \Sabre_DAV_Exception_Forbidden();
     }
     if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
         $info = OC_FileChunking::decodeName($name);
         if (empty($info)) {
             throw new Sabre_DAV_Exception_NotImplemented();
         }
         $chunk_handler = new OC_FileChunking($info);
         $chunk_handler->store($info['index'], $data);
         if ($chunk_handler->isComplete()) {
             $newPath = $this->path . '/' . $info['name'];
             $chunk_handler->file_assemble($newPath);
             return OC_Connector_Sabre_Node::getETagPropertyForPath($newPath);
         }
     } else {
         $newPath = $this->path . '/' . $name;
         // mark file as partial while uploading (ignored by the scanner)
         $partpath = $newPath . '.part';
         \OC\Files\Filesystem::file_put_contents($partpath, $data);
         //detect aborted upload
         if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
             if (isset($_SERVER['CONTENT_LENGTH'])) {
                 $expected = $_SERVER['CONTENT_LENGTH'];
                 $actual = \OC\Files\Filesystem::filesize($partpath);
                 if ($actual != $expected) {
                     \OC\Files\Filesystem::unlink($partpath);
                     throw new Sabre_DAV_Exception_BadRequest('expected filesize ' . $expected . ' got ' . $actual);
                 }
             }
         }
         // rename to correct path
         \OC\Files\Filesystem::rename($partpath, $newPath);
         // allow sync clients to send the mtime along in a header
         $mtime = OC_Request::hasModificationTime();
         if ($mtime !== false) {
             if (\OC\Files\Filesystem::touch($newPath, $mtime)) {
                 header('X-OC-MTime: accepted');
             }
         }
         return OC_Connector_Sabre_Node::getETagPropertyForPath($newPath);
     }
     return null;
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:71,代码来源:directory.php

示例5: 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) {
         // default to ISO8601
         $format = OC_Config::getValue('logdateformat', 'c');
         $logtimezone = OC_Config::getValue("logtimezone", 'UTC');
         try {
             $timezone = new DateTimeZone($logtimezone);
         } catch (Exception $e) {
             $timezone = new DateTimeZone('UTC');
         }
         $time = new DateTime(null, $timezone);
         $reqId = \OC_Request::getRequestID();
         $remoteAddr = \OC_Request::getRemoteAddress();
         // remove username/passwords from URLs before writing the to the log file
         $time = $time->format($format);
         if ($minLevel == OC_Log::DEBUG) {
             $url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '--';
             $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : '--';
             $entry = compact('reqId', 'remoteAddr', 'app', 'message', 'level', 'time', 'method', 'url');
         } else {
             $entry = compact('reqId', 'remoteAddr', 'app', 'message', 'level', 'time');
         }
         $entry = json_encode($entry);
         $handle = @fopen(self::$logFile, 'a');
         @chmod(self::$logFile, 0640);
         if ($handle) {
             fwrite($handle, $entry . "\n");
             fclose($handle);
         } else {
             // Fall back to error_log
             error_log($entry);
         }
     }
 }
开发者ID:Romua1d,项目名称:core,代码行数:42,代码来源:owncloud.php

示例6: catch

* ownCloud
*
* @author Frank Karlitschek
* @copyright 2012 Frank Karlitschek frank@owncloud.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
*
*/
require_once '../lib/base.php';
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
try {
    OC::getRouter()->match('/ocs' . OC_Request::getRawPathInfo());
} catch (ResourceNotFoundException $e) {
    OC_API::setContentType();
    OC_OCS::notFound();
} catch (MethodNotAllowedException $e) {
    OC_API::setContentType();
    OC_Response::setStatus(405);
}
开发者ID:hjimmy,项目名称:owncloud,代码行数:31,代码来源:v1.php

示例7: strlen

<?php

try {
    require_once 'lib/base.php';
    if (\OCP\Util::needUpgrade()) {
        // since the behavior of apps or remotes are unpredictable during
        // an upgrade, return a 503 directly
        OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
        OC_Template::printErrorPage('Service unavailable');
        exit;
    }
    $path_info = OC_Request::getPathInfo();
    if ($path_info === false || $path_info === '') {
        OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
        exit;
    }
    if (!($pos = strpos($path_info, '/', 1))) {
        $pos = strlen($path_info);
    }
    $service = substr($path_info, 1, $pos - 1);
    $file = \OC::$server->getAppConfig()->getValue('core', 'remote_' . $service);
    if (is_null($file)) {
        OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
        exit;
    }
    $file = ltrim($file, '/');
    $parts = explode('/', $file, 2);
    $app = $parts[0];
    // Load all required applications
    \OC::$REQUESTEDAPP = $app;
    OC_App::loadApps(array('authentication'));
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:31,代码来源:remote.php

示例8: refresh

 /**
  * Refreshs the roundcube HTTP session
  * @return boolean true if refresh was successfull, otherwise false
  */
 public static function refresh()
 {
     try {
         OCP\Util::writeLog('roundcube', 'OC_RoundCube_AuthHelper.class.php->refresh(): Preparing refresh for roundcube', OCP\Util::DEBUG);
         $maildir = OCP\Config::getAppValue('roundcube', 'maildir', '');
         $rc_host = OCP\Config::getAppValue('roundcube', 'rcHost', '');
         if ($rc_host == '') {
             $rc_host = OC_Request::serverHost();
         }
         $rc_port = OCP\Config::getAppValue('roundcube', 'rcPort', '');
         OC_RoundCube_App::refresh($rc_host, $rc_port, $maildir);
         OCP\Util::writeLog('roundcube', 'OC_RoundCube_AuthHelper.class.php->refresh(): Finished refresh for roundcube', OCP\Util::DEBUG);
         return true;
     } catch (Exception $e) {
         // We got an exception during login/refresh
         OCP\Util::writeLog('roundcube', 'OC_RoundCube_AuthHelper.class.php: ' . 'Login error during refresh.' . $e, OCP\Util::DEBUG);
         return false;
     }
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:23,代码来源:RoundCubeAuthHelper.class.php

示例9: install

 public static function install($options)
 {
     $l = self::getTrans();
     $error = array();
     $dbtype = $options['dbtype'];
     if (empty($options['adminlogin'])) {
         $error[] = $l->t('Set an admin username.');
     }
     if (empty($options['adminpass'])) {
         $error[] = $l->t('Set an admin password.');
     }
     if (empty($options['directory'])) {
         $options['directory'] = OC::$SERVERROOT . "/data";
     }
     if (!isset(self::$dbSetupClasses[$dbtype])) {
         $dbtype = 'sqlite';
     }
     $class = self::$dbSetupClasses[$dbtype];
     $dbSetup = new $class(self::getTrans(), 'db_structure.xml');
     $error = array_merge($error, $dbSetup->validate($options));
     if (count($error) != 0) {
         return $error;
     }
     //no errors, good
     $username = htmlspecialchars_decode($options['adminlogin']);
     $password = htmlspecialchars_decode($options['adminpass']);
     $datadir = htmlspecialchars_decode($options['directory']);
     if (isset($options['trusted_domains']) && is_array($options['trusted_domains'])) {
         $trustedDomains = $options['trusted_domains'];
     } else {
         $trustedDomains = array(OC_Request::serverHost());
     }
     if (OC_Util::runningOnWindows()) {
         $datadir = rtrim(realpath($datadir), '\\');
     }
     //use sqlite3 when available, otherise sqlite2 will be used.
     if ($dbtype == 'sqlite' and class_exists('SQLite3')) {
         $dbtype = 'sqlite3';
     }
     //generate a random salt that is used to salt the local user passwords
     $salt = OC_Util::generateRandomBytes(30);
     OC_Config::setValue('passwordsalt', $salt);
     //write the config file
     OC_Config::setValue('trusted_domains', $trustedDomains);
     OC_Config::setValue('datadirectory', $datadir);
     OC_Config::setValue('dbtype', $dbtype);
     OC_Config::setValue('version', implode('.', OC_Util::getVersion()));
     try {
         $dbSetup->initialize($options);
         $dbSetup->setupDatabase($username);
     } catch (DatabaseSetupException $e) {
         $error[] = array('error' => $e->getMessage(), 'hint' => $e->getHint());
         return $error;
     } catch (Exception $e) {
         $error[] = array('error' => 'Error while trying to create admin user: ' . $e->getMessage(), 'hint' => '');
         return $error;
     }
     //create the user and group
     try {
         OC_User::createUser($username, $password);
     } catch (Exception $exception) {
         $error[] = $exception->getMessage();
     }
     if (count($error) == 0) {
         OC_Appconfig::setValue('core', 'installedat', microtime(true));
         OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true));
         OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php');
         OC_AppConfig::setValue('core', 'remote_core.js', '/core/minimizer.php');
         OC_Group::createGroup('admin');
         OC_Group::addToGroup($username, 'admin');
         OC_User::login($username, $password);
         //guess what this does
         OC_Installer::installShippedApps();
         // create empty file in data dir, so we can later find
         // out that this is indeed an ownCloud data directory
         file_put_contents(OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data') . '/.ocdata', '');
         //create htaccess files for apache hosts
         if (isset($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache')) {
             self::createHtaccess();
         }
         //and we are done
         OC_Config::setValue('installed', true);
     }
     return $error;
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:85,代码来源:setup.php

示例10: setContentDispositionHeader

 /**
  * Sets the content disposition header (with possible workarounds)
  * @param string $filename file name
  * @param string $type disposition type, either 'attachment' or 'inline'
  */
 public static function setContentDispositionHeader($filename, $type = 'attachment')
 {
     if (OC_Request::isUserAgent(array(OC_Request::USER_AGENT_IE, OC_Request::USER_AGENT_ANDROID_MOBILE_CHROME, OC_Request::USER_AGENT_FREEBOX))) {
         header('Content-Disposition: ' . rawurlencode($type) . '; filename="' . rawurlencode($filename) . '"');
     } else {
         header('Content-Disposition: ' . rawurlencode($type) . '; filename*=UTF-8\'\'' . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"');
     }
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:13,代码来源:response.php

示例11: testServerHost

 public function testServerHost()
 {
     OC_Config::deleteKey('overwritecondaddr');
     OC_Config::setValue('overwritehost', 'overwritten.host:8080');
     OC_Config::setValue('trusted_domains', array('trusted.host:8080', 'second.trusted.host:8080'));
     $_SERVER['HTTP_HOST'] = 'trusted.host:8080';
     // CLI always gives localhost
     $oldCLI = OC::$CLI;
     OC::$CLI = true;
     $host = OC_Request::serverHost();
     $this->assertEquals('localhost', $host);
     OC::$CLI = false;
     // overwritehost overrides trusted domain
     $host = OC_Request::serverHost();
     $this->assertEquals('overwritten.host:8080', $host);
     // trusted domain returned when used
     OC_Config::deleteKey('overwritehost');
     $host = OC_Request::serverHost();
     $this->assertEquals('trusted.host:8080', $host);
     // trusted domain returned when untrusted one in header
     $_SERVER['HTTP_HOST'] = 'untrusted.host:8080';
     OC_Config::deleteKey('overwritehost');
     $host = OC_Request::serverHost();
     $this->assertEquals('trusted.host:8080', $host);
     // clean up
     OC_Config::deleteKey('overwritecondaddr');
     OC_Config::deleteKey('overwritehost');
     unset($_SERVER['HTTP_HOST']);
     OC::$CLI = $oldCLI;
 }
开发者ID:Romua1d,项目名称:core,代码行数:30,代码来源:request.php

示例12: doUpgrade

 /**
  * runs the update actions in maintenance mode, does not upgrade the source files
  * except the main .htaccess file
  *
  * @param string $currentVersion current version to upgrade to
  * @param string $installedVersion previous version from which to upgrade from
  *
  * @throws \Exception
  * @return bool true if the operation succeeded, false otherwise
  */
 private function doUpgrade($currentVersion, $installedVersion)
 {
     // Stop update if the update is over several major versions
     if (!self::isUpgradePossible($installedVersion, $currentVersion)) {
         throw new \Exception('Updates between multiple major versions are unsupported.');
     }
     // Update htaccess files for apache hosts
     if (isset($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache')) {
         \OC_Setup::updateHtaccess();
     }
     // 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.90.1', '<')) {
         // 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
      */
     // pre-upgrade repairs
     $repair = new \OC\Repair(\OC\Repair::getBeforeUpgradeRepairSteps());
     $repair->run();
     // simulate DB upgrade
     if ($this->simulateStepEnabled) {
         $this->checkCoreUpgrade();
         // simulate apps DB upgrade
         $this->checkAppUpgrade($currentVersion);
     }
     // upgrade from OC6 to OC7
     // TODO removed it again for OC8
     $sharePolicy = \OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global');
     if ($sharePolicy === 'groups_only') {
         \OC_Appconfig::setValue('core', 'shareapi_only_share_with_group_members', 'yes');
     }
     if ($this->updateStepEnabled) {
         $this->doCoreUpgrade();
         $disabledApps = \OC_App::checkAppsRequirements();
         if (!empty($disabledApps)) {
             $this->emit('\\OC\\Updater', 'disabledApps', array($disabledApps));
         }
         $this->doAppUpgrade();
         // post-upgrade repairs
         $repair = new \OC\Repair(\OC\Repair::getRepairSteps());
         $repair->run();
         //Invalidate update feed
         \OC_Appconfig::setValue('core', 'lastupdatedat', 0);
         // only set the final version if everything went well
         \OC_Config::setValue('version', implode('.', \OC_Util::getVersion()));
     }
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:66,代码来源:updater.php

示例13: OC_L10N

<?php

// Init owncloud
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('roundcube');
// CSRF checks
OCP\JSON::callCheck();
$l = new OC_L10N('roundcube');
if (isset($_POST['appname']) && $_POST['appname'] == "roundcube") {
    $ocUser = OCP\User::getUser();
    $result = OC_RoundCube_App::cryptEmailIdentity($ocUser, $_POST['rc_mail_username'], $_POST['rc_mail_password']);
    if ($result) {
        // update login credentials
        $maildir = OCP\Config::getAppValue('roundcube', 'maildir', '');
        $rc_host = OCP\Config::getAppValue('roundcube', 'rcHost', '');
        if ($rc_host == '') {
            $rc_host = OC_Request::serverHost();
        }
        $rc_port = OCP\Config::getAppValue('roundcube', 'rcPort', null);
        OC_RoundCube_App::login($rc_host, $rc_port, $maildir, $_POST['rc_mail_username'], $_POST['rc_mail_password']);
    } else {
        OC_JSON::error(array("data" => array("message" => $l->t("Unable to store email credentials in the data-base."))));
        return false;
    }
} else {
    OC_JSON::error(array("data" => array("message" => $l->t("Not submitted for us."))));
    return false;
}
OCP\JSON::success(array('data' => array('message' => $l->t('Email-user credentials successfully stored.'))));
return true;
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:31,代码来源:userSettings.php

示例14: array

$template->assign('allowPublicUpload', $appConfig->getValue('core', 'shareapi_allow_public_upload', 'yes'));
$template->assign('allowResharing', $appConfig->getValue('core', 'shareapi_allow_resharing', 'yes'));
$template->assign('allowPublicMailNotification', $appConfig->getValue('core', 'shareapi_allow_public_notification', 'no'));
$template->assign('allowMailNotification', $appConfig->getValue('core', 'shareapi_allow_mail_notification', 'no'));
$template->assign('onlyShareWithGroupMembers', \OC\Share\Share::shareWithGroupMembersOnly());
$databaseOverload = (strpos(\OCP\Config::getSystemValue('dbtype'), 'sqlite') !== false);
$template->assign('databaseOverload', $databaseOverload);

// warn if Windows is used
$template->assign('WindowsWarning', OC_Util::runningOnWindows());

// add hardcoded forms from the template
$forms = OC_App::getForms('admin');
$l = OC_L10N::get('settings');
$formsAndMore = array();
if (OC_Request::serverProtocol() !== 'https' || !OC_Util::isAnnotationsWorking() ||
	$suggestedOverwriteCliUrl || !OC_Util::isSetLocaleWorking() || !OC_Util::isPhpCharSetUtf8() ||
	!OC_Util::fileInfoLoaded() || $databaseOverload
) {
	$formsAndMore[] = array('anchor' => 'security-warning', 'section-name' => $l->t('Security & Setup Warnings'));
}

$formsMap = array_map(function ($form) {
	if (preg_match('%(<h2[^>]*>.*?</h2>)%i', $form, $regs)) {
		$sectionName = str_replace('<h2>', '', $regs[0]);
		$sectionName = str_replace('</h2>', '', $sectionName);
		$anchor = strtolower($sectionName);
		$anchor = str_replace(' ', '-', $anchor);

		return array(
			'anchor' => 'goto-' . $anchor,
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:31,代码来源:admin.php

示例15: explode

$tmpl->assign('old_php', OC_Util::isPHPoutdated());
$tmpl->assign('backgroundjobs_mode', OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax'));
$tmpl->assign('cron_log', OC_Config::getValue('cron_log', true));
$tmpl->assign('lastcron', OC_Appconfig::getValue('core', 'lastcron', false));
$tmpl->assign('shareAPIEnabled', OC_Appconfig::getValue('core', 'shareapi_enabled', 'yes'));
$tmpl->assign('shareDefaultExpireDateSet', OC_Appconfig::getValue('core', 'shareapi_default_expire_date', 'no'));
$tmpl->assign('shareExpireAfterNDays', OC_Appconfig::getValue('core', 'shareapi_expire_after_n_days', '7'));
$tmpl->assign('shareEnforceExpireDate', OC_Appconfig::getValue('core', 'shareapi_enforce_expire_date', 'no'));
$excludeGroups = OC_Appconfig::getValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false;
$tmpl->assign('shareExcludeGroups', $excludeGroups);
$excludedGroupsList = OC_Appconfig::getValue('core', 'shareapi_exclude_groups_list', '');
$excludedGroupsList = explode(',', $excludedGroupsList);
// FIXME: this should be JSON!
$tmpl->assign('shareExcludedGroupsList', implode('|', $excludedGroupsList));
// Check if connected using HTTPS
$tmpl->assign('isConnectedViaHTTPS', OC_Request::serverProtocol() === 'https');
$tmpl->assign('enforceHTTPSEnabled', OC_Config::getValue("forcessl", false));
// If the current webroot is non-empty but the webroot from the config is,
// and system cron is used, the URL generator fails to build valid URLs.
$shouldSuggestOverwriteWebroot = $config->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'cron' && \OC::$WEBROOT && \OC::$WEBROOT !== '/' && !$config->getSystemValue('overwritewebroot', '');
$tmpl->assign('suggestedOverwriteWebroot', $shouldSuggestOverwriteWebroot ? \OC::$WEBROOT : '');
$tmpl->assign('allowLinks', OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes'));
$tmpl->assign('enforceLinkPassword', \OCP\Util::isPublicLinkPasswordRequired());
$tmpl->assign('allowPublicUpload', OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes'));
$tmpl->assign('allowResharing', OC_Appconfig::getValue('core', 'shareapi_allow_resharing', 'yes'));
$tmpl->assign('allowMailNotification', OC_Appconfig::getValue('core', 'shareapi_allow_mail_notification', 'no'));
$tmpl->assign('onlyShareWithGroupMembers', \OC\Share\Share::shareWithGroupMembersOnly());
$tmpl->assign('forms', array());
foreach ($forms as $form) {
    $tmpl->append('forms', $form);
}
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:31,代码来源:admin.php


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