當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OC_Util::isSetLocaleWorking方法代碼示例

本文整理匯總了PHP中OC_Util::isSetLocaleWorking方法的典型用法代碼示例。如果您正苦於以下問題:PHP OC_Util::isSetLocaleWorking方法的具體用法?PHP OC_Util::isSetLocaleWorking怎麽用?PHP OC_Util::isSetLocaleWorking使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OC_Util的用法示例。


在下文中一共展示了OC_Util::isSetLocaleWorking方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: checkServer

	/**
	 * check if the current server configuration is suitable for ownCloud
	 *
	 * @param \OCP\IConfig $config
	 * @return array arrays with error messages and hints
	 */
	public static function checkServer(\OCP\IConfig $config) {
		$l = \OC::$server->getL10N('lib');
		$errors = array();
		$CONFIG_DATADIRECTORY = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data');

		if (!self::needUpgrade($config) && $config->getSystemValue('installed', false)) {
			// this check needs to be done every time
			$errors = self::checkDataDirectoryValidity($CONFIG_DATADIRECTORY);
		}

		// Assume that if checkServer() succeeded before in this session, then all is fine.
		if (\OC::$server->getSession()->exists('checkServer_succeeded') && \OC::$server->getSession()->get('checkServer_succeeded')) {
			return $errors;
		}

		$webServerRestart = false;
		$setup = new OC_Setup($config);
		$availableDatabases = $setup->getSupportedDatabases();
		if (empty($availableDatabases)) {
			$errors[] = array(
				'error' => $l->t('No database drivers (sqlite, mysql, or postgresql) installed.'),
				'hint' => '' //TODO: sane hint
			);
			$webServerRestart = true;
		}

		//common hint for all file permissions error messages
		$permissionsHint = $l->t('Permissions can usually be fixed by '
			. '%sgiving the webserver write access to the root directory%s.',
			array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>'));

		// Check if config folder is writable.
		if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) {
			$errors[] = array(
				'error' => $l->t('Cannot write into "config" directory'),
				'hint' => $l->t('This can usually be fixed by '
					. '%sgiving the webserver write access to the config directory%s.',
					array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>'))
			);
		}

		// Check if there is a writable install folder.
		if ($config->getSystemValue('appstoreenabled', true)) {
			if (OC_App::getInstallPath() === null
				|| !is_writable(OC_App::getInstallPath())
				|| !is_readable(OC_App::getInstallPath())
			) {
				$errors[] = array(
					'error' => $l->t('Cannot write into "apps" directory'),
					'hint' => $l->t('This can usually be fixed by '
						. '%sgiving the webserver write access to the apps directory%s'
						. ' or disabling the appstore in the config file.',
						array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>'))
				);
			}
		}
		// Create root dir.
		if ($config->getSystemValue('installed', false)) {
			if (!is_dir($CONFIG_DATADIRECTORY)) {
				$success = @mkdir($CONFIG_DATADIRECTORY);
				if ($success) {
					$errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
				} else {
					$errors[] = array(
						'error' => $l->t('Cannot create "data" directory (%s)', array($CONFIG_DATADIRECTORY)),
						'hint' => $l->t('This can usually be fixed by '
							. '<a href="%s" target="_blank">giving the webserver write access to the root directory</a>.',
							array(OC_Helper::linkToDocs('admin-dir_permissions')))
					);
				}
			} else if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
				$errors[] = array(
					'error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable by ownCloud',
					'hint' => $permissionsHint
				);
			} else {
				$errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
			}
		}

		if (!OC_Util::isSetLocaleWorking()) {
			$errors[] = array(
				'error' => $l->t('Setting locale to %s failed',
					array('en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/'
						. 'pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8')),
				'hint' => $l->t('Please install one of these locales on your system and restart your webserver.')
			);
		}

		// Contains the dependencies that should be checked against
		// classes = class_exists
		// functions = function_exists
		// defined = defined
		// If the dependency is not found the missing module name is shown to the EndUser
//.........這裏部分代碼省略.........
開發者ID:pombredanne,項目名稱:ArcherSys,代碼行數:101,代碼來源:util.php

示例2: checkServer

 /**
  * check if the current server configuration is suitable for ownCloud
  *
  * @return array arrays with error messages and hints
  */
 public static function checkServer()
 {
     $l = \OC::$server->getL10N('lib');
     $errors = array();
     $CONFIG_DATADIRECTORY = OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data');
     if (!self::needUpgrade() && OC_Config::getValue('installed', false)) {
         // this check needs to be done every time
         $errors = self::checkDataDirectoryValidity($CONFIG_DATADIRECTORY);
     }
     // Assume that if checkServer() succeeded before in this session, then all is fine.
     if (\OC::$server->getSession()->exists('checkServer_succeeded') && \OC::$server->getSession()->get('checkServer_succeeded')) {
         return $errors;
     }
     $webServerRestart = false;
     //check for database drivers
     if (!(is_callable('sqlite_open') or class_exists('SQLite3')) and !is_callable('mysql_connect') and !is_callable('pg_connect') and !is_callable('oci_connect')) {
         $errors[] = array('error' => $l->t('No database drivers (sqlite, mysql, or postgresql) installed.'), 'hint' => '');
         $webServerRestart = true;
     }
     //common hint for all file permissions error messages
     $permissionsHint = $l->t('Permissions can usually be fixed by ' . '%sgiving the webserver write access to the root directory%s.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>'));
     // Check if config folder is writable.
     if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) {
         $errors[] = array('error' => $l->t('Cannot write into "config" directory'), 'hint' => $l->t('This can usually be fixed by ' . '%sgiving the webserver write access to the config directory%s.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>')));
     }
     // Check if there is a writable install folder.
     if (OC_Config::getValue('appstoreenabled', true)) {
         if (OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath()) || !is_readable(OC_App::getInstallPath())) {
             $errors[] = array('error' => $l->t('Cannot write into "apps" directory'), 'hint' => $l->t('This can usually be fixed by ' . '%sgiving the webserver write access to the apps directory%s' . ' or disabling the appstore in the config file.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>')));
         }
     }
     // Create root dir.
     if (!is_dir($CONFIG_DATADIRECTORY)) {
         $success = @mkdir($CONFIG_DATADIRECTORY);
         if ($success) {
             $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
         } else {
             $errors[] = array('error' => $l->t('Cannot create "data" directory (%s)', array($CONFIG_DATADIRECTORY)), 'hint' => $l->t('This can usually be fixed by ' . '<a href="%s" target="_blank">giving the webserver write access to the root directory</a>.', array(OC_Helper::linkToDocs('admin-dir_permissions'))));
         }
     } else {
         if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
             $errors[] = array('error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable by ownCloud', 'hint' => $permissionsHint);
         } else {
             $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
         }
     }
     if (!OC_Util::isSetLocaleWorking()) {
         $errors[] = array('error' => $l->t('Setting locale to %s failed', array('en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/' . 'pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8')), 'hint' => $l->t('Please install one of these locales on your system and restart your webserver.'));
     }
     // Contains the dependencies that should be checked against
     // classes = class_exists
     // functions = function_exists
     // defined = defined
     // If the dependency is not found the missing module name is shown to the EndUser
     $dependencies = array('classes' => array('ZipArchive' => 'zip', 'DOMDocument' => 'dom'), 'functions' => array('xml_parser_create' => 'libxml', 'mb_detect_encoding' => 'mb multibyte', 'ctype_digit' => 'ctype', 'json_encode' => 'JSON', 'gd_info' => 'GD', 'gzencode' => 'zlib', 'iconv' => 'iconv', 'simplexml_load_string' => 'SimpleXML'), 'defined' => array('PDO::ATTR_DRIVER_NAME' => 'PDO'));
     $missingDependencies = array();
     $moduleHint = $l->t('Please ask your server administrator to install the module.');
     foreach ($dependencies['classes'] as $class => $module) {
         if (!class_exists($class)) {
             $missingDependencies[] = $module;
         }
     }
     foreach ($dependencies['functions'] as $function => $module) {
         if (!function_exists($function)) {
             $missingDependencies[] = $module;
         }
     }
     foreach ($dependencies['defined'] as $defined => $module) {
         if (!defined($defined)) {
             $missingDependencies[] = $module;
         }
     }
     foreach ($missingDependencies as $missingDependency) {
         $errors[] = array('error' => $l->t('PHP module %s not installed.', array($missingDependency)), 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (version_compare(phpversion(), '5.3.3', '<')) {
         $errors[] = array('error' => $l->t('PHP %s or higher is required.', '5.3.3'), 'hint' => $l->t('Please ask your server administrator to update PHP to the latest version.' . ' Your PHP version is no longer supported by ownCloud and the PHP community.'));
         $webServerRestart = true;
     }
     if (strtolower(@ini_get('safe_mode')) == 'on' || strtolower(@ini_get('safe_mode')) == 'yes' || strtolower(@ini_get('safe_mode')) == 'true' || ini_get("safe_mode") == 1) {
         $errors[] = array('error' => $l->t('PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly.'), 'hint' => $l->t('PHP Safe Mode is a deprecated and mostly useless setting that should be disabled. ' . 'Please ask your server administrator to disable it in php.ini or in your webserver config.'));
         $webServerRestart = true;
     }
     if (get_magic_quotes_gpc() == 1) {
         $errors[] = array('error' => $l->t('Magic Quotes is enabled. ownCloud requires that it is disabled to work properly.'), 'hint' => $l->t('Magic Quotes is a deprecated and mostly useless setting that should be disabled. ' . 'Please ask your server administrator to disable it in php.ini or in your webserver config.'));
         $webServerRestart = true;
     }
     if (!self::isAnnotationsWorking()) {
         $errors[] = array('error' => 'PHP is apparently setup to strip inline doc blocks. This will make several core apps inaccessible.', 'hint' => 'This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator.');
     }
     if ($webServerRestart) {
         $errors[] = array('error' => $l->t('PHP modules have been installed, but they are still listed as missing?'), 'hint' => $l->t('Please ask your server administrator to restart the web server.'));
     }
     $errors = array_merge($errors, self::checkDatabaseVersion());
//.........這裏部分代碼省略.........
開發者ID:pinoniq,項目名稱:core,代碼行數:101,代碼來源:util.php

示例3: init

 public static function init()
 {
     // calculate the root directories
     OC::$SERVERROOT = str_replace("\\", '/', substr(__DIR__, 0, -4));
     // register autoloader
     $loaderStart = microtime(true);
     require_once __DIR__ . '/autoloader.php';
     self::$loader = new \OC\Autoloader([OC::$SERVERROOT . '/lib', OC::$SERVERROOT . '/core', OC::$SERVERROOT . '/settings', OC::$SERVERROOT . '/ocs', OC::$SERVERROOT . '/ocs-provider', OC::$SERVERROOT . '/3rdparty']);
     spl_autoload_register(array(self::$loader, 'load'));
     $loaderEnd = microtime(true);
     self::$CLI = php_sapi_name() == 'cli';
     try {
         self::initPaths();
         // setup 3rdparty autoloader
         $vendorAutoLoad = OC::$THIRDPARTYROOT . '/3rdparty/autoload.php';
         if (!file_exists($vendorAutoLoad)) {
             throw new \RuntimeException('Composer autoloader not found, unable to continue. Check the folder "3rdparty". Running "git submodule update --init" will initialize the git submodule that handles the subfolder "3rdparty".');
         }
         require_once $vendorAutoLoad;
     } catch (\RuntimeException $e) {
         OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
         // we can't use the template error page here, because this needs the
         // DI container which isn't available yet
         print $e->getMessage();
         exit;
     }
     foreach (OC::$APPSROOTS as $appRoot) {
         self::$loader->addValidRoot($appRoot['path']);
     }
     // setup the basic server
     self::$server = new \OC\Server(\OC::$WEBROOT);
     \OC::$server->getEventLogger()->log('autoloader', 'Autoloader', $loaderStart, $loaderEnd);
     \OC::$server->getEventLogger()->start('boot', 'Initialize');
     // Don't display errors and log them
     error_reporting(E_ALL | E_STRICT);
     @ini_set('display_errors', 0);
     @ini_set('log_errors', 1);
     date_default_timezone_set('UTC');
     //try to configure php to enable big file uploads.
     //this doesn´t work always depending on the webserver and php configuration.
     //Let´s try to overwrite some defaults anyways
     //try to set the maximum execution time to 60min
     @set_time_limit(3600);
     @ini_set('max_execution_time', 3600);
     @ini_set('max_input_time', 3600);
     //try to set the maximum filesize to 10G
     @ini_set('upload_max_filesize', '10G');
     @ini_set('post_max_size', '10G');
     @ini_set('file_uploads', '50');
     self::setRequiredIniValues();
     self::handleAuthHeaders();
     self::registerAutoloaderCache();
     // initialize intl fallback is necessary
     \Patchwork\Utf8\Bootup::initIntl();
     OC_Util::isSetLocaleWorking();
     if (!defined('PHPUNIT_RUN')) {
         $logger = \OC::$server->getLogger();
         OC\Log\ErrorHandler::setLogger($logger);
         if (\OC::$server->getConfig()->getSystemValue('debug', false)) {
             OC\Log\ErrorHandler::register(true);
             set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
         } else {
             OC\Log\ErrorHandler::register();
         }
     }
     // register the stream wrappers
     stream_wrapper_register('fakedir', 'OC\\Files\\Stream\\Dir');
     stream_wrapper_register('static', 'OC\\Files\\Stream\\StaticStream');
     stream_wrapper_register('close', 'OC\\Files\\Stream\\Close');
     stream_wrapper_register('quota', 'OC\\Files\\Stream\\Quota');
     stream_wrapper_register('oc', 'OC\\Files\\Stream\\OC');
     \OC::$server->getEventLogger()->start('init_session', 'Initialize session');
     OC_App::loadApps(array('session'));
     if (!self::$CLI) {
         self::initSession();
     }
     \OC::$server->getEventLogger()->end('init_session');
     self::initTemplateEngine();
     self::checkConfig();
     self::checkInstalled();
     OC_Response::addSecurityHeaders();
     if (self::$server->getRequest()->getServerProtocol() === 'https') {
         ini_set('session.cookie_secure', true);
     }
     if (!defined('OC_CONSOLE')) {
         $errors = OC_Util::checkServer(\OC::$server->getConfig());
         if (count($errors) > 0) {
             if (self::$CLI) {
                 // Convert l10n string into regular string for usage in database
                 $staticErrors = [];
                 foreach ($errors as $error) {
                     echo $error['error'] . "\n";
                     echo $error['hint'] . "\n\n";
                     $staticErrors[] = ['error' => (string) $error['error'], 'hint' => (string) $error['hint']];
                 }
                 try {
                     \OC::$server->getConfig()->setAppValue('core', 'cronErrors', json_encode($staticErrors));
                 } catch (\Exception $e) {
                     echo 'Writing to database failed';
                 }
//.........這裏部分代碼省略.........
開發者ID:krsvital,項目名稱:core,代碼行數:101,代碼來源:base.php

示例4: foreach

// warn if Windows is used
$template->assign('WindowsWarning', OC_Util::runningOnWindows());
// warn if outdated version of a memcache module is used
$caches = ['apcu' => ['name' => $l->t('APCu'), 'version' => '4.0.6'], 'redis' => ['name' => $l->t('Redis'), 'version' => '2.2.5']];
$outdatedCaches = [];
foreach ($caches as $php_module => $data) {
    $isOutdated = extension_loaded($php_module) && version_compare(phpversion($php_module), $data['version'], '<');
    if ($isOutdated) {
        $outdatedCaches[$php_module] = $data;
    }
}
$template->assign('OutdatedCacheWarning', $outdatedCaches);
// add hardcoded forms from the template
$forms = OC_App::getForms('admin');
$formsAndMore = array();
if ($request->getServerProtocol() !== 'https' || !OC_Util::isAnnotationsWorking() || $suggestedOverwriteCliUrl || !OC_Util::isSetLocaleWorking() || !OC_Util::fileInfoLoaded() || $databaseOverload) {
    $formsAndMore[] = array('anchor' => 'security-warning', 'section-name' => $l->t('Security & setup warnings'));
}
$formsAndMore[] = array('anchor' => 'shareAPI', 'section-name' => $l->t('Sharing'));
$formsAndMore[] = ['anchor' => 'encryptionAPI', 'section-name' => $l->t('Server-side encryption')];
// Prioritize fileSharingSettings and files_external and move updater to the version
$fileSharingSettings = $filesExternal = $updaterAppPanel = $ocDefaultEncryptionModulePanel = '';
foreach ($forms as $index => $form) {
    if (strpos($form, 'id="fileSharingSettings"')) {
        $fileSharingSettings = $form;
        unset($forms[$index]);
        continue;
    }
    if (strpos($form, 'id="files_external"')) {
        $filesExternal = $form;
        unset($forms[$index]);
開發者ID:WeatherellTechnology,項目名稱:weatherstorm7,代碼行數:31,代碼來源:admin.php

示例5: init

	public static function init() {
		// register autoloader
		$loaderStart = microtime(true);
		require_once __DIR__ . '/autoloader.php';
		self::$loader = new \OC\Autoloader();
		spl_autoload_register(array(self::$loader, 'load'));
		$loaderEnd = microtime(true);

		self::initPaths();

		// setup 3rdparty autoloader
		$vendorAutoLoad = OC::$THIRDPARTYROOT . '/3rdparty/autoload.php';
		if (file_exists($vendorAutoLoad)) {
			require_once $vendorAutoLoad;
		} else {
			OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
			// we can't use the template error page here, because this needs the
			// DI container which isn't available yet
			print('Composer autoloader not found, unable to continue. Check the folder "3rdparty".');
			exit();
		}

		// setup the basic server
		self::$server = new \OC\Server(\OC::$WEBROOT);
		\OC::$server->getEventLogger()->log('autoloader', 'Autoloader', $loaderStart, $loaderEnd);
		\OC::$server->getEventLogger()->start('boot', 'Initialize');

		// set some stuff
		//ob_start();
		error_reporting(E_ALL | E_STRICT);
		if (defined('DEBUG') && DEBUG) {
			ini_set('display_errors', 1);
		}
		self::$CLI = (php_sapi_name() == 'cli');

		date_default_timezone_set('UTC');
		ini_set('arg_separator.output', '&amp;');

		//try to configure php to enable big file uploads.
		//this doesn´t work always depending on the webserver and php configuration.
		//Let´s try to overwrite some defaults anyways

		//try to set the maximum execution time to 60min
		@set_time_limit(3600);
		@ini_set('max_execution_time', 3600);
		@ini_set('max_input_time', 3600);

		//try to set the maximum filesize to 10G
		@ini_set('upload_max_filesize', '10G');
		@ini_set('post_max_size', '10G');
		@ini_set('file_uploads', '50');

		self::handleAuthHeaders();
		self::registerAutoloaderCache();

		// initialize intl fallback is necessary
		\Patchwork\Utf8\Bootup::initIntl();
		OC_Util::isSetLocaleWorking();

		if (!defined('PHPUNIT_RUN')) {
			OC\Log\ErrorHandler::setLogger(OC_Log::$object);
			if (defined('DEBUG') and DEBUG) {
				OC\Log\ErrorHandler::register(true);
				set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
			} else {
				OC\Log\ErrorHandler::register();
			}
		}

		// register the stream wrappers
		stream_wrapper_register('fakedir', 'OC\Files\Stream\Dir');
		stream_wrapper_register('static', 'OC\Files\Stream\StaticStream');
		stream_wrapper_register('close', 'OC\Files\Stream\Close');
		stream_wrapper_register('quota', 'OC\Files\Stream\Quota');
		stream_wrapper_register('oc', 'OC\Files\Stream\OC');

		\OC::$server->getEventLogger()->start('init_session', 'Initialize session');
		OC_App::loadApps(array('session'));
		if (!self::$CLI) {
			self::initSession();
		}
		\OC::$server->getEventLogger()->end('init_session');
		self::initTemplateEngine();
		self::checkConfig();
		self::checkInstalled();
		self::checkSSL();
		OC_Response::addSecurityHeaders();

		$errors = OC_Util::checkServer(\OC::$server->getConfig());
		if (count($errors) > 0) {
			if (self::$CLI) {
				foreach ($errors as $error) {
					echo $error['error'] . "\n";
					echo $error['hint'] . "\n\n";
				}
			} else {
				OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
				OC_Template::printGuestPage('', 'error', array('errors' => $errors));
			}
			exit;
//.........這裏部分代碼省略.........
開發者ID:BacLuc,項目名稱:newGryfiPage,代碼行數:101,代碼來源:base.php

示例6: checkServer

 /**
  * check if the current server configuration is suitable for ownCloud
  *
  * @param \OCP\IConfig $config
  * @return array arrays with error messages and hints
  */
 public static function checkServer(\OCP\IConfig $config)
 {
     $l = \OC::$server->getL10N('lib');
     $errors = array();
     $CONFIG_DATADIRECTORY = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data');
     if (!self::needUpgrade($config) && $config->getSystemValue('installed', false)) {
         // this check needs to be done every time
         $errors = self::checkDataDirectoryValidity($CONFIG_DATADIRECTORY);
     }
     // Assume that if checkServer() succeeded before in this session, then all is fine.
     if (\OC::$server->getSession()->exists('checkServer_succeeded') && \OC::$server->getSession()->get('checkServer_succeeded')) {
         return $errors;
     }
     $webServerRestart = false;
     $setup = new \OC\Setup($config, \OC::$server->getIniWrapper(), \OC::$server->getL10N('lib'), new \OC_Defaults(), \OC::$server->getLogger(), \OC::$server->getSecureRandom());
     $availableDatabases = $setup->getSupportedDatabases();
     if (empty($availableDatabases)) {
         $errors[] = array('error' => $l->t('No database drivers (sqlite, mysql, or postgresql) installed.'), 'hint' => '');
         $webServerRestart = true;
     }
     // Check if server running on Windows platform
     if (OC_Util::runningOnWindows()) {
         $errors[] = ['error' => $l->t('Microsoft Windows Platform is not supported'), 'hint' => $l->t('Running ownCloud Server on the Microsoft Windows platform is not supported. We suggest you ' . 'use a Linux server in a virtual machine if you have no option for migrating the server itself. ' . 'Find Linux packages as well as easy to deploy virtual machine images on <a href="%s">%s</a>. ' . 'For migrating existing installations to Linux you can find some tips and a migration script ' . 'in <a href="%s">our documentation</a>.', ['https://owncloud.org/install/', 'owncloud.org/install/', 'https://owncloud.org/?p=8045'])];
     }
     // Check if config folder is writable.
     if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) {
         $errors[] = array('error' => $l->t('Cannot write into "config" directory'), 'hint' => $l->t('This can usually be fixed by ' . '%sgiving the webserver write access to the config directory%s.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>')));
     }
     // Check if there is a writable install folder.
     if ($config->getSystemValue('appstoreenabled', true)) {
         if (OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath()) || !is_readable(OC_App::getInstallPath())) {
             $errors[] = array('error' => $l->t('Cannot write into "apps" directory'), 'hint' => $l->t('This can usually be fixed by ' . '%sgiving the webserver write access to the apps directory%s' . ' or disabling the appstore in the config file.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>')));
         }
     }
     // Create root dir.
     if ($config->getSystemValue('installed', false)) {
         if (!is_dir($CONFIG_DATADIRECTORY)) {
             $success = @mkdir($CONFIG_DATADIRECTORY);
             if ($success) {
                 $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
             } else {
                 $errors[] = array('error' => $l->t('Cannot create "data" directory (%s)', array($CONFIG_DATADIRECTORY)), 'hint' => $l->t('This can usually be fixed by ' . '<a href="%s" target="_blank">giving the webserver write access to the root directory</a>.', array(OC_Helper::linkToDocs('admin-dir_permissions'))));
             }
         } else {
             if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
                 //common hint for all file permissions error messages
                 $permissionsHint = $l->t('Permissions can usually be fixed by ' . '%sgiving the webserver write access to the root directory%s.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>'));
                 $errors[] = array('error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable by ownCloud', 'hint' => $permissionsHint);
             } else {
                 $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
             }
         }
     }
     if (!OC_Util::isSetLocaleWorking()) {
         $errors[] = array('error' => $l->t('Setting locale to %s failed', array('en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/' . 'pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8')), 'hint' => $l->t('Please install one of these locales on your system and restart your webserver.'));
     }
     // Contains the dependencies that should be checked against
     // classes = class_exists
     // functions = function_exists
     // defined = defined
     // ini = ini_get
     // If the dependency is not found the missing module name is shown to the EndUser
     // When adding new checks always verify that they pass on Travis as well
     // for ini settings, see https://github.com/owncloud/administration/blob/master/travis-ci/custom.ini
     $dependencies = array('classes' => array('ZipArchive' => 'zip', 'DOMDocument' => 'dom', 'XMLWriter' => 'XMLWriter'), 'functions' => ['xml_parser_create' => 'libxml', 'mb_detect_encoding' => 'mb multibyte', 'ctype_digit' => 'ctype', 'json_encode' => 'JSON', 'gd_info' => 'GD', 'gzencode' => 'zlib', 'iconv' => 'iconv', 'simplexml_load_string' => 'SimpleXML', 'hash' => 'HASH Message Digest Framework', 'curl_init' => 'cURL'], 'defined' => array('PDO::ATTR_DRIVER_NAME' => 'PDO'), 'ini' => ['default_charset' => 'UTF-8']);
     $missingDependencies = array();
     $invalidIniSettings = [];
     $moduleHint = $l->t('Please ask your server administrator to install the module.');
     /**
      * FIXME: The dependency check does not work properly on HHVM on the moment
      *        and prevents installation. Once HHVM is more compatible with our
      *        approach to check for these values we should re-enable those
      *        checks.
      */
     $iniWrapper = \OC::$server->getIniWrapper();
     if (!self::runningOnHhvm()) {
         foreach ($dependencies['classes'] as $class => $module) {
             if (!class_exists($class)) {
                 $missingDependencies[] = $module;
             }
         }
         foreach ($dependencies['functions'] as $function => $module) {
             if (!function_exists($function)) {
                 $missingDependencies[] = $module;
             }
         }
         foreach ($dependencies['defined'] as $defined => $module) {
             if (!defined($defined)) {
                 $missingDependencies[] = $module;
             }
         }
         foreach ($dependencies['ini'] as $setting => $expected) {
             if (is_bool($expected)) {
                 if ($iniWrapper->getBool($setting) !== $expected) {
//.........這裏部分代碼省略.........
開發者ID:reverserob,項目名稱:core,代碼行數:101,代碼來源:util.php

示例7: init

	public static function init() {
		// register autoloader
		require_once __DIR__ . '/autoloader.php';
		self::$loader = new \OC\Autoloader();
		self::$loader->registerPrefix('Doctrine\\Common', 'doctrine/common/lib');
		self::$loader->registerPrefix('Doctrine\\DBAL', 'doctrine/dbal/lib');
		self::$loader->registerPrefix('Symfony\\Component\\Routing', 'symfony/routing');
		self::$loader->registerPrefix('Symfony\\Component\\Console', 'symfony/console');
		self::$loader->registerPrefix('Patchwork', '3rdparty');
		self::$loader->registerPrefix('Pimple', '3rdparty/Pimple');
		spl_autoload_register(array(self::$loader, 'load'));

		// make a dummy session available as early as possible since error pages need it
		self::$session = new \OC\Session\Memory('');

		// set some stuff
		//ob_start();
		error_reporting(E_ALL | E_STRICT);
		if (defined('DEBUG') && DEBUG) {
			ini_set('display_errors', 1);
		}
		self::$CLI = (php_sapi_name() == 'cli');

		date_default_timezone_set('UTC');
		ini_set('arg_separator.output', '&amp;');

		// try to switch magic quotes off.
		if (get_magic_quotes_gpc() == 1) {
			ini_set('magic_quotes_runtime', 0);
		}

		//try to configure php to enable big file uploads.
		//this doesn´t work always depending on the webserver and php configuration.
		//Let´s try to overwrite some defaults anyways

		//try to set the maximum execution time to 60min
		@set_time_limit(3600);
		@ini_set('max_execution_time', 3600);
		@ini_set('max_input_time', 3600);

		//try to set the maximum filesize to 10G
		@ini_set('upload_max_filesize', '10G');
		@ini_set('post_max_size', '10G');
		@ini_set('file_uploads', '50');

		self::handleAuthHeaders();
		self::initPaths();
		self::registerAutoloaderCache();

		OC_Util::isSetLocaleWorking();

		// setup 3rdparty autoloader
		$vendorAutoLoad = OC::$THIRDPARTYROOT . '/3rdparty/autoload.php';
		if (file_exists($vendorAutoLoad)) {
			require_once $vendorAutoLoad;
		}

		if (!defined('PHPUNIT_RUN')) {
			OC\Log\ErrorHandler::setLogger(OC_Log::$object);
			if (defined('DEBUG') and DEBUG) {
				OC\Log\ErrorHandler::register(true);
				set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
			} else {
				OC\Log\ErrorHandler::register();
			}
		}

		// register the stream wrappers
		stream_wrapper_register('fakedir', 'OC\Files\Stream\Dir');
		stream_wrapper_register('static', 'OC\Files\Stream\StaticStream');
		stream_wrapper_register('close', 'OC\Files\Stream\Close');
		stream_wrapper_register('quota', 'OC\Files\Stream\Quota');
		stream_wrapper_register('oc', 'OC\Files\Stream\OC');

		// setup the basic server
		self::$server = new \OC\Server();

		self::initTemplateEngine();
		OC_App::loadApps(array('session'));
		if (!self::$CLI) {
			self::initSession();
		} else {
			self::$session = new \OC\Session\Memory('');
		}
		self::checkConfig();
		self::checkInstalled();
		self::checkSSL();
		OC_Response::addSecurityHeaders();

		$errors = OC_Util::checkServer(\OC::$server->getConfig());
		if (count($errors) > 0) {
			if (self::$CLI) {
				foreach ($errors as $error) {
					echo $error['error'] . "\n";
					echo $error['hint'] . "\n\n";
				}
			} else {
				OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
				OC_Template::printGuestPage('', 'error', array('errors' => $errors));
			}
//.........這裏部分代碼省略.........
開發者ID:pombredanne,項目名稱:ArcherSys,代碼行數:101,代碼來源:base.php

示例8: checkServer

 /**
  * @brief check if the current server configuration is suitable for ownCloud
  * @return array arrays with error messages and hints
  */
 public static function checkServer()
 {
     $errors = array();
     $CONFIG_DATADIRECTORY = OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data');
     if (!\OC::needUpgrade() && OC_Config::getValue('installed', false)) {
         // this check needs to be done every time
         $errors = self::checkDataDirectoryValidity($CONFIG_DATADIRECTORY);
     }
     // Assume that if checkServer() succeeded before in this session, then all is fine.
     if (\OC::$session->exists('checkServer_suceeded') && \OC::$session->get('checkServer_suceeded')) {
         return $errors;
     }
     $defaults = new \OC_Defaults();
     $webServerRestart = false;
     //check for database drivers
     if (!(is_callable('sqlite_open') or class_exists('SQLite3')) and !is_callable('mysql_connect') and !is_callable('pg_connect') and !is_callable('oci_connect')) {
         $errors[] = array('error' => 'No database drivers (sqlite, mysql, or postgresql) installed.', 'hint' => '');
         $webServerRestart = true;
     }
     //common hint for all file permissions error messages
     $permissionsHint = 'Permissions can usually be fixed by ' . '<a href="' . OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the root directory</a>.';
     // Check if config folder is writable.
     if (!is_writable(OC::$SERVERROOT . "/config/") or !is_readable(OC::$SERVERROOT . "/config/")) {
         $errors[] = array('error' => "Can't write into config directory", 'hint' => 'This can usually be fixed by ' . '<a href="' . OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the config directory</a>.');
     }
     // Check if there is a writable install folder.
     if (OC_Config::getValue('appstoreenabled', true)) {
         if (OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath()) || !is_readable(OC_App::getInstallPath())) {
             $errors[] = array('error' => "Can't write into apps directory", 'hint' => 'This can usually be fixed by ' . '<a href="' . OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the apps directory</a> ' . 'or disabling the appstore in the config file.');
         }
     }
     // Create root dir.
     if (!is_dir($CONFIG_DATADIRECTORY)) {
         $success = @mkdir($CONFIG_DATADIRECTORY);
         if ($success) {
             $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
         } else {
             $errors[] = array('error' => "Can't create data directory (" . $CONFIG_DATADIRECTORY . ")", 'hint' => 'This can usually be fixed by ' . '<a href="' . OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the root directory</a>.');
         }
     } else {
         if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
             $errors[] = array('error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable by ownCloud', 'hint' => $permissionsHint);
         } else {
             $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
         }
     }
     if (!OC_Util::isSetLocaleWorking()) {
         $errors[] = array('error' => 'Setting locale to en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8 failed', 'hint' => 'Please install one of theses locales on your system and restart your webserver.');
     }
     $moduleHint = "Please ask your server administrator to install the module.";
     // check if all required php modules are present
     if (!class_exists('ZipArchive')) {
         $errors[] = array('error' => 'PHP module zip not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!class_exists('DOMDocument')) {
         $errors[] = array('error' => 'PHP module dom not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!function_exists('xml_parser_create')) {
         $errors[] = array('error' => 'PHP module libxml not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!function_exists('mb_detect_encoding')) {
         $errors[] = array('error' => 'PHP module mb multibyte not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!function_exists('ctype_digit')) {
         $errors[] = array('error' => 'PHP module ctype is not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!function_exists('json_encode')) {
         $errors[] = array('error' => 'PHP module JSON is not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!extension_loaded('gd') || !function_exists('gd_info')) {
         $errors[] = array('error' => 'PHP module GD is not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!function_exists('gzencode')) {
         $errors[] = array('error' => 'PHP module zlib is not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!function_exists('iconv')) {
         $errors[] = array('error' => 'PHP module iconv is not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (!function_exists('simplexml_load_string')) {
         $errors[] = array('error' => 'PHP module SimpleXML is not installed.', 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (version_compare(phpversion(), '5.3.3', '<')) {
         $errors[] = array('error' => 'PHP 5.3.3 or higher is required.', 'hint' => 'Please ask your server administrator to update PHP to the latest version.' . ' Your PHP version is no longer supported by ownCloud and the PHP community.');
         $webServerRestart = true;
     }
     if (!defined('PDO::ATTR_DRIVER_NAME')) {
//.........這裏部分代碼省略.........
開發者ID:hjimmy,項目名稱:owncloud,代碼行數:101,代碼來源:util.php

示例9: explode

$tmpl->assign('loglevel', OC_Config::getValue("loglevel", 2));
$tmpl->assign('mail_domain', OC_Config::getValue("mail_domain", ''));
$tmpl->assign('mail_from_address', OC_Config::getValue("mail_from_address", ''));
$tmpl->assign('mail_smtpmode', OC_Config::getValue("mail_smtpmode", ''));
$tmpl->assign('mail_smtpsecure', OC_Config::getValue("mail_smtpsecure", ''));
$tmpl->assign('mail_smtphost', OC_Config::getValue("mail_smtphost", ''));
$tmpl->assign('mail_smtpport', OC_Config::getValue("mail_smtpport", ''));
$tmpl->assign('mail_smtpauthtype', OC_Config::getValue("mail_smtpauthtype", ''));
$tmpl->assign('mail_smtpauth', OC_Config::getValue("mail_smtpauth", false));
$tmpl->assign('mail_smtpname', OC_Config::getValue("mail_smtpname", ''));
$tmpl->assign('mail_smtppassword', OC_Config::getValue("mail_smtppassword", ''));
$tmpl->assign('entries', $entries);
$tmpl->assign('entriesremain', $entriesremain);
$tmpl->assign('htaccessworking', $htaccessworking);
$tmpl->assign('readOnlyConfigEnabled', OC_Helper::isReadOnlyConfigEnabled());
$tmpl->assign('isLocaleWorking', OC_Util::isSetLocaleWorking());
$tmpl->assign('isAnnotationsWorking', OC_Util::isAnnotationsWorking());
$tmpl->assign('has_fileinfo', OC_Util::fileInfoLoaded());
$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!
開發者ID:WYSAC,項目名稱:oregon-owncloud,代碼行數:31,代碼來源:admin.php

示例10: array

$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,
			'section-name' => $sectionName,
開發者ID:pombredanne,項目名稱:ArcherSys,代碼行數:31,代碼來源:admin.php

示例11: init

 public static function init()
 {
     // register autoloader
     require_once __DIR__ . '/autoloader.php';
     self::$loader = new \OC\Autoloader();
     self::$loader->registerPrefix('Doctrine\\Common', 'doctrine/common/lib');
     self::$loader->registerPrefix('Doctrine\\DBAL', 'doctrine/dbal/lib');
     self::$loader->registerPrefix('Symfony\\Component\\Routing', 'symfony/routing');
     self::$loader->registerPrefix('Symfony\\Component\\Console', 'symfony/console');
     self::$loader->registerPrefix('Sabre\\VObject', '3rdparty');
     self::$loader->registerPrefix('Sabre_', '3rdparty');
     self::$loader->registerPrefix('Patchwork', '3rdparty');
     spl_autoload_register(array(self::$loader, 'load'));
     // set some stuff
     //ob_start();
     error_reporting(E_ALL | E_STRICT);
     if (defined('DEBUG') && DEBUG) {
         ini_set('display_errors', 1);
     }
     self::$CLI = php_sapi_name() == 'cli';
     date_default_timezone_set('UTC');
     ini_set('arg_separator.output', '&amp;');
     // try to switch magic quotes off.
     if (get_magic_quotes_gpc() == 1) {
         ini_set('magic_quotes_runtime', 0);
     }
     //try to configure php to enable big file uploads.
     //this doesn´t work always depending on the webserver and php configuration.
     //Let´s try to overwrite some defaults anyways
     //try to set the maximum execution time to 60min
     @set_time_limit(3600);
     @ini_set('max_execution_time', 3600);
     @ini_set('max_input_time', 3600);
     //try to set the maximum filesize to 10G
     @ini_set('upload_max_filesize', '10G');
     @ini_set('post_max_size', '10G');
     @ini_set('file_uploads', '50');
     //copy http auth headers for apache+php-fcgid work around
     if (isset($_SERVER['HTTP_XAUTHORIZATION']) && !isset($_SERVER['HTTP_AUTHORIZATION'])) {
         $_SERVER['HTTP_AUTHORIZATION'] = $_SERVER['HTTP_XAUTHORIZATION'];
     }
     //set http auth headers for apache+php-cgi work around
     if (isset($_SERVER['HTTP_AUTHORIZATION']) && preg_match('/Basic\\s+(.*)$/i', $_SERVER['HTTP_AUTHORIZATION'], $matches)) {
         list($name, $password) = explode(':', base64_decode($matches[1]), 2);
         $_SERVER['PHP_AUTH_USER'] = strip_tags($name);
         $_SERVER['PHP_AUTH_PW'] = strip_tags($password);
     }
     //set http auth headers for apache+php-cgi work around if variable gets renamed by apache
     if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && preg_match('/Basic\\s+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches)) {
         list($name, $password) = explode(':', base64_decode($matches[1]), 2);
         $_SERVER['PHP_AUTH_USER'] = strip_tags($name);
         $_SERVER['PHP_AUTH_PW'] = strip_tags($password);
     }
     self::initPaths();
     if (OC_Config::getValue('instanceid', false)) {
         // \OC\Memcache\Cache has a hidden dependency on
         // OC_Util::getInstanceId() for namespacing. See #5409.
         try {
             self::$loader->setMemoryCache(\OC\Memcache\Factory::createLowLatency('Autoloader'));
         } catch (\Exception $ex) {
         }
     }
     OC_Util::isSetLocaleWorking();
     // set debug mode if an xdebug session is active
     if (!defined('DEBUG') || !DEBUG) {
         if (isset($_COOKIE['XDEBUG_SESSION'])) {
             define('DEBUG', true);
         }
     }
     if (!defined('PHPUNIT_RUN')) {
         if (defined('DEBUG') and DEBUG) {
             OC\Log\ErrorHandler::register(true);
             set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
         } else {
             OC\Log\ErrorHandler::register();
         }
         OC\Log\ErrorHandler::setLogger(OC_Log::$object);
     }
     // register the stream wrappers
     stream_wrapper_register('fakedir', 'OC\\Files\\Stream\\Dir');
     stream_wrapper_register('static', 'OC\\Files\\Stream\\StaticStream');
     stream_wrapper_register('close', 'OC\\Files\\Stream\\Close');
     stream_wrapper_register('quota', 'OC\\Files\\Stream\\Quota');
     stream_wrapper_register('oc', 'OC\\Files\\Stream\\OC');
     // setup the basic server
     self::$server = new \OC\Server();
     self::initTemplateEngine();
     OC_App::loadApps(array('session'));
     if (!self::$CLI) {
         self::initSession();
     } else {
         self::$session = new \OC\Session\Memory('');
     }
     self::checkConfig();
     self::checkInstalled();
     self::checkSSL();
     self::addSecurityHeaders();
     $errors = OC_Util::checkServer();
     if (count($errors) > 0) {
         if (self::$CLI) {
//.........這裏部分代碼省略.........
開發者ID:CDN-Sparks,項目名稱:owncloud,代碼行數:101,代碼來源:base.php

示例12: init

 public static function init()
 {
     // register autoloader
     require_once __DIR__ . '/autoloader.php';
     self::$loader = new \OC\Autoloader();
     self::$loader->registerPrefix('Doctrine\\Common', 'doctrine/common/lib');
     self::$loader->registerPrefix('Doctrine\\DBAL', 'doctrine/dbal/lib');
     self::$loader->registerPrefix('Symfony\\Component\\Routing', 'symfony/routing');
     self::$loader->registerPrefix('Symfony\\Component\\Console', 'symfony/console');
     self::$loader->registerPrefix('Patchwork', '3rdparty');
     self::$loader->registerPrefix('Pimple', '3rdparty/Pimple');
     spl_autoload_register(array(self::$loader, 'load'));
     // make a dummy session available as early as possible since error pages need it
     self::$session = new \OC\Session\Memory('');
     // set some stuff
     //ob_start();
     error_reporting(E_ALL | E_STRICT);
     if (defined('DEBUG') && DEBUG) {
         ini_set('display_errors', 1);
     }
     self::$CLI = php_sapi_name() == 'cli';
     date_default_timezone_set('UTC');
     ini_set('arg_separator.output', '&amp;');
     // try to switch magic quotes off.
     if (get_magic_quotes_gpc() == 1) {
         ini_set('magic_quotes_runtime', 0);
     }
     //try to configure php to enable big file uploads.
     //this doesn´t work always depending on the webserver and php configuration.
     //Let´s try to overwrite some defaults anyways
     //try to set the maximum execution time to 60min
     @set_time_limit(3600);
     @ini_set('max_execution_time', 3600);
     @ini_set('max_input_time', 3600);
     //try to set the maximum filesize to 10G
     @ini_set('upload_max_filesize', '10G');
     @ini_set('post_max_size', '10G');
     @ini_set('file_uploads', '50');
     //copy http auth headers for apache+php-fcgid work around
     if (isset($_SERVER['HTTP_XAUTHORIZATION']) && !isset($_SERVER['HTTP_AUTHORIZATION'])) {
         $_SERVER['HTTP_AUTHORIZATION'] = $_SERVER['HTTP_XAUTHORIZATION'];
     }
     //set http auth headers for apache+php-cgi work around
     if (isset($_SERVER['HTTP_AUTHORIZATION']) && preg_match('/Basic\\s+(.*)$/i', $_SERVER['HTTP_AUTHORIZATION'], $matches)) {
         list($name, $password) = explode(':', base64_decode($matches[1]), 2);
         $_SERVER['PHP_AUTH_USER'] = strip_tags($name);
         $_SERVER['PHP_AUTH_PW'] = strip_tags($password);
     }
     //set http auth headers for apache+php-cgi work around if variable gets renamed by apache
     if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && preg_match('/Basic\\s+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches)) {
         list($name, $password) = explode(':', base64_decode($matches[1]), 2);
         $_SERVER['PHP_AUTH_USER'] = strip_tags($name);
         $_SERVER['PHP_AUTH_PW'] = strip_tags($password);
     }
     self::initPaths();
     if (OC_Config::getValue('instanceid', false)) {
         // \OC\Memcache\Cache has a hidden dependency on
         // OC_Util::getInstanceId() for namespacing. See #5409.
         try {
             self::$loader->setMemoryCache(\OC\Memcache\Factory::createLowLatency('Autoloader'));
         } catch (\Exception $ex) {
         }
     }
     OC_Util::isSetLocaleWorking();
     // setup 3rdparty autoloader
     $vendorAutoLoad = OC::$THIRDPARTYROOT . '/3rdparty/autoload.php';
     if (file_exists($vendorAutoLoad)) {
         require_once $vendorAutoLoad;
     }
     // set debug mode if an xdebug session is active
     if (!defined('DEBUG') || !DEBUG) {
         if (isset($_COOKIE['XDEBUG_SESSION'])) {
             define('DEBUG', true);
         }
     }
     if (!defined('PHPUNIT_RUN')) {
         OC\Log\ErrorHandler::setLogger(OC_Log::$object);
         if (defined('DEBUG') and DEBUG) {
             OC\Log\ErrorHandler::register(true);
             set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
         } else {
             OC\Log\ErrorHandler::register();
         }
     }
     // register the stream wrappers
     stream_wrapper_register('fakedir', 'OC\\Files\\Stream\\Dir');
     stream_wrapper_register('static', 'OC\\Files\\Stream\\StaticStream');
     stream_wrapper_register('close', 'OC\\Files\\Stream\\Close');
     stream_wrapper_register('quota', 'OC\\Files\\Stream\\Quota');
     stream_wrapper_register('oc', 'OC\\Files\\Stream\\OC');
     // setup the basic server
     self::$server = new \OC\Server();
     self::initTemplateEngine();
     OC_App::loadApps(array('session'));
     if (!self::$CLI) {
         self::initSession();
     } else {
         self::$session = new \OC\Session\Memory('');
     }
     self::checkConfig();
//.........這裏部分代碼省略.........
開發者ID:olucao,項目名稱:owncloud-core,代碼行數:101,代碼來源:base.php

示例13: strpos

$suggestedOverwriteCliUrl = $shouldSuggestOverwriteCliUrl ? \OC::$WEBROOT : '';
$template->assign('suggestedOverwriteCliUrl', $suggestedOverwriteCliUrl);
$template->assign('allowLinks', $appConfig->getValue('core', 'shareapi_allow_links', 'yes'));
$template->assign('enforceLinkPassword', \OCP\Util::isPublicLinkPasswordRequired());
$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);
// 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() || $suggestedOverwriteWebRoot || !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, 'section-name' => $sectionName, 'form' => $form);
    }
    return array('form' => $form);
}, $forms);
$formsAndMore = array_merge($formsAndMore, $formsMap);
// add bottom hardcoded forms from the template
$formsAndMore[] = array('anchor' => 'backgroundjobs', 'section-name' => $l->t('Cron'));
開發者ID:riso,項目名稱:owncloud-core,代碼行數:31,代碼來源:admin.php

示例14: foreach

];

$outdatedCaches = [];
foreach ($caches as $php_module => $data) {
	$isOutdated = extension_loaded($php_module) && version_compare(phpversion($php_module), $data['version'], '<');
	if ($isOutdated) {
		$outdatedCaches[$php_module] = $data;
	}
}
$template->assign('OutdatedCacheWarning', $outdatedCaches);

// add hardcoded forms from the template
$forms = OC_App::getForms('admin');
$formsAndMore = array();
if ($request->getServerProtocol()  !== 'https' || !OC_Util::isAnnotationsWorking() ||
	$suggestedOverwriteCliUrl || !OC_Util::isSetLocaleWorking()  ||
	!OC_Util::fileInfoLoaded() || $databaseOverload
) {
	$formsAndMore[] = array('anchor' => 'security-warning', 'section-name' => $l->t('Security & setup warnings'));
}
$formsAndMore[] = array('anchor' => 'shareAPI', 'section-name' => $l->t('Sharing'));
$formsAndMore[] = ['anchor' => 'encryptionAPI', 'section-name' => $l->t('Server-side encryption')];

// Prioritize fileSharingSettings and files_external and move updater to the version
$fileSharingSettings = $filesExternal = $updaterAppPanel = $ocDefaultEncryptionModulePanel = '';
foreach ($forms as $index => $form) {
	if (strpos($form, 'id="fileSharingSettings"')) {
		$fileSharingSettings = $form;
		unset($forms[$index]);
		continue;
	}
開發者ID:ninjasilicon,項目名稱:core,代碼行數:31,代碼來源:admin.php

示例15: explode

$template->assign('mail_from_address', $config->getSystemValue("mail_from_address", ''));
$template->assign('mail_smtpmode', $config->getSystemValue("mail_smtpmode", ''));
$template->assign('mail_smtpsecure', $config->getSystemValue("mail_smtpsecure", ''));
$template->assign('mail_smtphost', $config->getSystemValue("mail_smtphost", ''));
$template->assign('mail_smtpport', $config->getSystemValue("mail_smtpport", ''));
$template->assign('mail_smtpauthtype', $config->getSystemValue("mail_smtpauthtype", ''));
$template->assign('mail_smtpauth', $config->getSystemValue("mail_smtpauth", false));
$template->assign('mail_smtpname', $config->getSystemValue("mail_smtpname", ''));
$template->assign('mail_smtppassword', $config->getSystemValue("mail_smtppassword", ''));
$template->assign('entries', $entries);
$template->assign('entriesremain', $entriesRemaining);
$template->assign('logFileSize', $logFileSize);
$template->assign('doesLogFileExist', $doesLogFileExist);
$template->assign('showLog', $showLog);
$template->assign('readOnlyConfigEnabled', OC_Helper::isReadOnlyConfigEnabled());
$template->assign('isLocaleWorking', OC_Util::isSetLocaleWorking());
$template->assign('isAnnotationsWorking', OC_Util::isAnnotationsWorking());
$template->assign('has_fileinfo', OC_Util::fileInfoLoaded());
$template->assign('backgroundjobs_mode', $appConfig->getValue('core', 'backgroundjobs_mode', 'ajax'));
$template->assign('cron_log', $config->getSystemValue('cron_log', true));
$template->assign('lastcron', $appConfig->getValue('core', 'lastcron', false));
$template->assign('shareAPIEnabled', $appConfig->getValue('core', 'shareapi_enabled', 'yes'));
$template->assign('shareDefaultExpireDateSet', $appConfig->getValue('core', 'shareapi_default_expire_date', 'no'));
$template->assign('shareExpireAfterNDays', $appConfig->getValue('core', 'shareapi_expire_after_n_days', '7'));
$template->assign('shareEnforceExpireDate', $appConfig->getValue('core', 'shareapi_enforce_expire_date', 'no'));
$excludeGroups = $appConfig->getValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false;
$template->assign('shareExcludeGroups', $excludeGroups);
$excludedGroupsList = $appConfig->getValue('core', 'shareapi_exclude_groups_list', '');
$excludedGroupsList = explode(',', $excludedGroupsList);
// FIXME: this should be JSON!
$template->assign('shareExcludedGroupsList', implode('|', $excludedGroupsList));
開發者ID:Kevin-ZK,項目名稱:vaneDisk,代碼行數:31,代碼來源:admin.php


注:本文中的OC_Util::isSetLocaleWorking方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。