/** * Removes an app * @param string $name name of the application to remove * @param array $options options * @return boolean * * This function removes an app. $options is an associative array. The * following keys are optional:ja * - keeppreferences: boolean, if true the user preferences won't be deleted * - keepappconfig: boolean, if true the config will be kept * - keeptables: boolean, if true the database will be kept * - keepfiles: boolean, if true the user files will be kept * * This function works as follows * -# including appinfo/remove.php * -# removing the files * * The function will not delete preferences, tables and the configuration, * this has to be done by the function oc_app_uninstall(). */ public static function removeApp($name, $options = array()) { if (isset($options['keeppreferences']) and $options['keeppreferences'] == false) { // todo // remove preferences } if (isset($options['keepappconfig']) and $options['keepappconfig'] == false) { // todo // remove app config } if (isset($options['keeptables']) and $options['keeptables'] == false) { // todo // remove app database tables } if (isset($options['keepfiles']) and $options['keepfiles'] == false) { // todo // remove user files } if (OC_Installer::isDownloaded($name)) { $appdir = OC_App::getInstallPath() . '/' . $name; OC_Helper::rmdirr($appdir); return true; } else { OC_Log::write('core', 'can\'t remove app ' . $name . '. It is not installed.', OC_Log::ERROR); return false; } }
/** * 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 $dependencies = array( 'classes' => array( 'ZipArchive' => 'zip', 'DOMDocument' => 'dom', 'XMLWriter' => 'XMLWriter' ), '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', 'hash' => 'HASH Message Digest Framework' ), '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.4.0', '<')) { $errors[] = array( 'error' => $l->t('PHP %s or higher is required.', '5.4.0'), '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; } /** * PHP 5.6 ships with a PHP setting which throws notices by default for a * lot of endpoints. Thus we need to ensure that the value is set to -1 * * FIXME: Due to https://github.com/owncloud/core/pull/13593#issuecomment-71178078 * this check is disabled for HHVM at the moment. This should get re-evaluated * at a later point. * * @link https://github.com/owncloud/core/issues/13592 */ if(version_compare(phpversion(), '5.6.0', '>=') && !self::runningOnHhvm() && \OC::$server->getIniWrapper()->getNumeric('always_populate_raw_post_data') !== -1) { $errors[] = array( 'error' => $l->t('PHP is configured to populate raw post data. Since PHP 5.6 this will lead to PHP throwing notices for perfectly valid code.'), 'hint' => $l->t('To fix this issue set <code>always_populate_raw_post_data</code> to <code>-1</code> in your php.ini') ); } if (!self::isAnnotationsWorking()) { $errors[] = array( 'error' => $l->t('PHP is apparently setup to strip inline doc blocks. This will make several core apps inaccessible.'), 'hint' => $l->t('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()); // Cache the result of this function \OC::$server->getSession()->set('checkServer_succeeded', count($errors) == 0); return $errors; }
/** * 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()); // Cache the result of this function \OC::$server->getSession()->set('checkServer_succeeded', count($errors) == 0); return $errors; }
/** * 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) { $invalidIniSettings[] = [$setting, $expected]; } } if (is_int($expected)) { if ($iniWrapper->getNumeric($setting) !== $expected) { $invalidIniSettings[] = [$setting, $expected]; } } if (is_string($expected)) { if (strtolower($iniWrapper->getString($setting)) !== strtolower($expected)) { $invalidIniSettings[] = [$setting, $expected]; } } } } foreach ($missingDependencies as $missingDependency) { $errors[] = array('error' => $l->t('PHP module %s not installed.', array($missingDependency)), 'hint' => $moduleHint); $webServerRestart = true; } foreach ($invalidIniSettings as $setting) { if (is_bool($setting[1])) { $setting[1] = $setting[1] ? 'on' : 'off'; } $errors[] = ['error' => $l->t('PHP setting "%s" is not set to "%s".', [$setting[0], var_export($setting[1], true)]), 'hint' => $l->t('Adjusting this setting in php.ini will make ownCloud run again')]; $webServerRestart = true; } /** * The mbstring.func_overload check can only be performed if the mbstring * module is installed as it will return null if the checking setting is * not available and thus a check on the boolean value fails. * * TODO: Should probably be implemented in the above generic dependency * check somehow in the long-term. */ if ($iniWrapper->getBool('mbstring.func_overload') !== null && $iniWrapper->getBool('mbstring.func_overload') === true) { $errors[] = array('error' => $l->t('mbstring.func_overload is set to "%s" instead of the expected value "0"', [$iniWrapper->getString('mbstring.func_overload')]), 'hint' => $l->t('To fix this issue set <code>mbstring.func_overload</code> to <code>0</code> in your php.ini')); } if (!self::isAnnotationsWorking()) { $errors[] = array('error' => $l->t('PHP is apparently set up to strip inline doc blocks. This will make several core apps inaccessible.'), 'hint' => $l->t('This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator.')); } if (!\OC::$CLI && $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()); // Cache the result of this function \OC::$server->getSession()->set('checkServer_succeeded', count($errors) == 0); return $errors; }
/** * This is a wrapper for retrieve 3rd party scripts. * * @param string $name The 3rd'party script to return. * * @return DataResponse|JSONResponse * * @NoAdminRequired * @NoCSRFRequired */ public function scriptwrapper($name) { $app_dir = \OC_App::getInstallPath() . DIRECTORY_SEPARATOR . 'secure_container' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . '3rdparty' . DIRECTORY_SEPARATOR; $content = ''; $wrapper_function = 'js_wrapper'; $wrapper_code = ''; switch (strtolower($name)) { case 'sjcl': $file = $app_dir . 'sjcl' . DIRECTORY_SEPARATOR . 'sjcl.js'; $content = file_get_contents($file); $wrapper_function = 'OC_SJCL'; $wrapper_code = 'this.sjcl = sjcl;'; break; default: $content = ''; } $response = 'function __' . $wrapper_function . '() { ' . $content . chr(10) . $wrapper_code . ' }' . chr(10); $response .= 'var ' . $wrapper_function . ' = new __' . $wrapper_function . '();'; return new ScriptResponse($response); }
/** * @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')) { $errors[] = array('error' => 'PHP PDO module is not installed.', 'hint' => $moduleHint); $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' => 'PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly.', 'hint' => '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' => 'Magic Quotes is enabled. ownCloud requires that it is disabled to work properly.', 'hint' => '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 ($webServerRestart) { $errors[] = array('error' => 'PHP modules have been installed, but they are still listed as missing?', 'hint' => 'Please ask your server administrator to restart the web server.'); } $errors = array_merge($errors, self::checkDatabaseVersion()); // Cache the result of this function \OC::$session->set('checkServer_suceeded', count($errors) == 0); return $errors; }
/** * check if the current server configuration is suitable for ownCloud * @return array arrays with error messages and hints */ public static function checkServer() { $errors = array(); $web_server_restart = false; //check for database drivers if (!(is_callable('sqlite_open') or class_exists('SQLite3')) and !is_callable('mysql_connect') and !is_callable('pg_connect')) { $errors[] = array('error' => 'No database drivers (sqlite, mysql, or postgresql) installed.<br/>', 'hint' => ''); //TODO: sane hint $web_server_restart = true; } //common hint for all file permissons error messages $permissionsHint = "Permissions can usually be fixed by giving the webserver write access to the ownCloud directory"; // 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 'config'", 'hint' => "You can usually fix this by giving the webserver user write access to the config directory in owncloud"); } // 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' => "You can usually fix this by giving the webserver user write access to the apps directory\n\t\t\t\tin owncloud or disabling the appstore in the config file."); } } $CONFIG_DATADIRECTORY = OC_Config::getValue("datadirectory", OC::$SERVERROOT . "/data"); //check for correct file permissions if (!stristr(PHP_OS, 'WIN')) { $permissionsModHint = "Please change the permissions to 0770 so that the directory cannot be listed by other users."; $prems = substr(decoct(@fileperms($CONFIG_DATADIRECTORY)), -3); if (substr($prems, -1) != '0') { OC_Helper::chmodr($CONFIG_DATADIRECTORY, 0770); clearstatcache(); $prems = substr(decoct(@fileperms($CONFIG_DATADIRECTORY)), -3); if (substr($prems, 2, 1) != '0') { $errors[] = array('error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') is readable for other users<br/>', 'hint' => $permissionsModHint); } } if (OC_Config::getValue("enablebackup", false)) { $CONFIG_BACKUPDIRECTORY = OC_Config::getValue("backupdirectory", OC::$SERVERROOT . "/backup"); $prems = substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)), -3); if (substr($prems, -1) != '0') { OC_Helper::chmodr($CONFIG_BACKUPDIRECTORY, 0770); clearstatcache(); $prems = substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)), -3); if (substr($prems, 2, 1) != '0') { $errors[] = array('error' => 'Data directory (' . $CONFIG_BACKUPDIRECTORY . ') is readable for other users<br/>', 'hint' => $permissionsModHint); } } } } else { //TODO: permissions checks for windows hosts } // Create root dir. if (!is_dir($CONFIG_DATADIRECTORY)) { $success = @mkdir($CONFIG_DATADIRECTORY); if (!$success) { $errors[] = array('error' => "Can't create data directory (" . $CONFIG_DATADIRECTORY . ")", 'hint' => "You can usually fix this by giving the webserver write access to the ownCloud directory '" . OC::$SERVERROOT . "' (in a terminal, use the command 'chown -R www-data:www-data /path/to/your/owncloud/install/data' "); } } else { if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) { $errors[] = array('error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable by ownCloud<br/>', 'hint' => $permissionsHint); } } // check if all required php modules are present if (!class_exists('ZipArchive')) { $errors[] = array('error' => 'PHP module zip not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (!function_exists('mb_detect_encoding')) { $errors[] = array('error' => 'PHP module mb multibyte not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (!function_exists('ctype_digit')) { $errors[] = array('error' => 'PHP module ctype is not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (!function_exists('json_encode')) { $errors[] = array('error' => 'PHP module JSON is not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (!function_exists('imagepng')) { $errors[] = array('error' => 'PHP module GD is not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (!function_exists('gzencode')) { $errors[] = array('error' => 'PHP module zlib is not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (!function_exists('iconv')) { $errors[] = array('error' => 'PHP module iconv is not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (!function_exists('simplexml_load_string')) { $errors[] = array('error' => 'PHP module SimpleXML is not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (floatval(phpversion()) < 5.3) { $errors[] = array('error' => 'PHP 5.3 is required.<br/>', 'hint' => 'Please ask your server administrator to update PHP to version 5.3 or higher. PHP 5.2 is no longer supported by ownCloud and the PHP community.'); $web_server_restart = false; } if (!defined('PDO::ATTR_DRIVER_NAME')) { $errors[] = array('error' => 'PHP PDO module is not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if ($web_server_restart) { $errors[] = array('error' => 'PHP modules have been installed, but they are still listed as missing?<br/>', 'hint' => 'Please ask your server administrator to restart the web server.'); } return $errors; }
/** * @brief Installs an app * @param $data array with all information * @returns integer * * This function installs an app. All information needed are passed in the * associative array $data. * The following keys are required: * - source: string, can be "path" or "http" * * One of the following keys is required: * - path: path to the file containing the app * - href: link to the downloadable file containing the app * * The following keys are optional: * - pretend: boolean, if set true the system won't do anything * - noinstall: boolean, if true appinfo/install.php won't be loaded * - inactive: boolean, if set true the appconfig/app.sample.php won't be * renamed * * This function works as follows * -# fetching the file * -# unzipping it * -# check the code * -# installing the database at appinfo/database.xml * -# including appinfo/install.php * -# setting the installed version * * It is the task of oc_app_install to create the tables and do whatever is * needed to get the app working. */ public static function installApp( $data = array()) { if(!isset($data['source'])) { OC_Log::write('core', 'No source specified when installing app', OC_Log::ERROR); return false; } //download the file if necesary if($data['source']=='http') { $path=OC_Helper::tmpFile(); if(!isset($data['href'])) { OC_Log::write('core', 'No href specified when installing app from http', OC_Log::ERROR); return false; } copy($data['href'], $path); }else{ if(!isset($data['path'])) { OC_Log::write('core', 'No path specified when installing app from local file', OC_Log::ERROR); return false; } $path=$data['path']; } //detect the archive type $mime=OC_Helper::getMimeType($path); if($mime=='application/zip') { rename($path, $path.'.zip'); $path.='.zip'; }elseif($mime=='application/x-gzip') { rename($path, $path.'.tgz'); $path.='.tgz'; }else{ OC_Log::write('core', 'Archives of type '.$mime.' are not supported', OC_Log::ERROR); return false; } //extract the archive in a temporary folder $extractDir=OC_Helper::tmpFolder(); OC_Helper::rmdirr($extractDir); mkdir($extractDir); if($archive=OC_Archive::open($path)) { $archive->extract($extractDir); } else { OC_Log::write('core', 'Failed to open archive when installing app', OC_Log::ERROR); OC_Helper::rmdirr($extractDir); if($data['source']=='http') { unlink($path); } return false; } //load the info.xml file of the app if(!is_file($extractDir.'/appinfo/info.xml')) { //try to find it in a subdir $dh=opendir($extractDir); while($folder=readdir($dh)) { if($folder[0]!='.' and is_dir($extractDir.'/'.$folder)) { if(is_file($extractDir.'/'.$folder.'/appinfo/info.xml')) { $extractDir.='/'.$folder; } } } } if(!is_file($extractDir.'/appinfo/info.xml')) { OC_Log::write('core', 'App does not provide an info.xml file', OC_Log::ERROR); OC_Helper::rmdirr($extractDir); if($data['source']=='http') { unlink($path); } return false; } $info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml', true); // check the code for not allowed calls if(!OC_Installer::checkCode($info['id'], $extractDir)) { OC_Log::write('core', 'App can\'t be installed because of not allowed code in the App', OC_Log::ERROR); OC_Helper::rmdirr($extractDir); return false; } // check if the app is compatible with this version of ownCloud $version=OC_Util::getVersion(); if(!isset($info['require']) or ($version[0]>$info['require'])) { OC_Log::write('core', 'App can\'t be installed because it is not compatible with this version of ownCloud', OC_Log::ERROR); OC_Helper::rmdirr($extractDir); return false; } //check if an app with the same id is already installed if(self::isInstalled( $info['id'] )) { OC_Log::write('core', 'App already installed', OC_Log::WARN); OC_Helper::rmdirr($extractDir); if($data['source']=='http') { unlink($path); } return false; } $basedir=OC_App::getInstallPath().'/'.$info['id']; //check if the destination directory already exists if(is_dir($basedir)) { OC_Log::write('core', 'App directory already exists', OC_Log::WARN); OC_Helper::rmdirr($extractDir); if($data['source']=='http') { unlink($path); } return false; } if(isset($data['pretent']) and $data['pretent']==true) { return false; } //copy the app to the correct place if(@!mkdir($basedir)) { OC_Log::write('core', 'Can\'t create app folder. Please fix permissions. ('.$basedir.')', OC_Log::ERROR); OC_Helper::rmdirr($extractDir); if($data['source']=='http') { unlink($path); } return false; } OC_Helper::copyr($extractDir, $basedir); //remove temporary files OC_Helper::rmdirr($extractDir); //install the database if(is_file($basedir.'/appinfo/database.xml')) { OC_DB::createDbFromStructure($basedir.'/appinfo/database.xml'); } //run appinfo/install.php if((!isset($data['noinstall']) or $data['noinstall']==false) and file_exists($basedir.'/appinfo/install.php')) { include $basedir.'/appinfo/install.php'; } //set the installed version OC_Appconfig::setValue($info['id'], 'installed_version', OC_App::getAppVersion($info['id'])); OC_Appconfig::setValue($info['id'], 'enabled', 'no'); //set remote/public handelers foreach($info['remote'] as $name=>$path) { OCP\CONFIG::setAppValue('core', 'remote_'.$name, $info['id'].'/'.$path); } foreach($info['public'] as $name=>$path) { OCP\CONFIG::setAppValue('core', 'public_'.$name, $info['id'].'/'.$path); } OC_App::setAppTypes($info['id']); return $info['id']; }
* * 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/>. */ // Set the content type to Javascript header("Content-type: text/javascript"); // Check for access and enabled app \OCP\JSON::checkLoggedIn(); if (!\OCP\App::isEnabled('secure_container')) { \OCP\JSON::error('Application "secure_container" is not enabled.'); } // Get data $app_dir = \OC_App::getInstallPath() . DIRECTORY_SEPARATOR . 'secure_container' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . '3rdparty' . DIRECTORY_SEPARATOR; $content = ''; $wrapper_function = 'js_wrapper'; $wrapper_code = ''; switch (strtolower(stripslashes($_REQUEST['app']))) { case 'sjcl': $file = $app_dir . 'sjcl' . DIRECTORY_SEPARATOR . 'sjcl.js'; $content = file_get_contents($file); $wrapper_function = 'OC_SJCL'; $wrapper_code = 'this.sjcl = sjcl;'; break; default: $content = ''; }
/** * check if the current server configuration is suitable for ownCloud * @return array arrays with error messages and hints */ public static function checkServer() { $errors = array(); $defaults = new \OC_Defaults(); $web_server_restart = 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' => ''); //TODO: sane hint $web_server_restart = true; } //common hint for all file permissons error messages $permissionsHint = 'Permissions can usually be fixed by ' . '<a href="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-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="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-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="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-permissions" target="_blank">giving the webserver write access to the apps directory</a> ' . 'or disabling the appstore in the config file.'); } } $CONFIG_DATADIRECTORY = OC_Config::getValue("datadirectory", OC::$SERVERROOT . "/data"); // 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="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-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)); } } // check if all required php modules are present if (!class_exists('ZipArchive')) { $errors[] = array('error' => 'PHP module zip not installed.', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (!class_exists('DOMDocument')) { $errors[] = array('error' => 'PHP module dom not installed.', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (!function_exists('xml_parser_create')) { $errors[] = array('error' => 'PHP module libxml not installed.', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (!function_exists('mb_detect_encoding')) { $errors[] = array('error' => 'PHP module mb multibyte not installed.', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (!function_exists('ctype_digit')) { $errors[] = array('error' => 'PHP module ctype is not installed.', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (!function_exists('json_encode')) { $errors[] = array('error' => 'PHP module JSON is not installed.', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (!function_exists('imagepng')) { $errors[] = array('error' => 'PHP module GD is not installed.', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (!function_exists('gzencode')) { $errors[] = array('error' => 'PHP module zlib is not installed.', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (!function_exists('iconv')) { $errors[] = array('error' => 'PHP module iconv is not installed.', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (!function_exists('simplexml_load_string')) { $errors[] = array('error' => 'PHP module SimpleXML is not installed.', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } if (floatval(phpversion()) < 5.3) { $errors[] = array('error' => 'PHP 5.3 is required.', 'hint' => 'Please ask your server administrator to update PHP to version 5.3 or higher.' . ' PHP 5.2 is no longer supported by ownCloud and the PHP community.'); $web_server_restart = false; } if (!defined('PDO::ATTR_DRIVER_NAME')) { $errors[] = array('error' => 'PHP PDO module is not installed.', 'hint' => 'Please ask your server administrator to install the module.'); $web_server_restart = false; } 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' => 'PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly.', 'hint' => '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.'); $web_server_restart = false; } if (get_magic_quotes_gpc() == 1) { $errors[] = array('error' => 'Magic Quotes is enabled. ownCloud requires that it is disabled to work properly.', 'hint' => '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.'); $web_server_restart = true; } if ($web_server_restart) { $errors[] = array('error' => 'PHP modules have been installed, but they are still listed as missing?', 'hint' => 'Please ask your server administrator to restart the web server.'); } return $errors; }