Commit 29ca4f80 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Detect whether json functions are available.

parent bd724f4e
......@@ -11,4 +11,5 @@ $string['configsanityexception'] = '<p>It appears that your server\'s PHP config
$string['safemodeon'] = '<p>Your server appears to be running safe mode. $projectname does not support running in safe mode. You must turn this off in either the php.ini file, or in your apache config for the site.</p><p>If you are on shared hosting, it is likely that there is little you can do to get safe_mode turned off, other than ask your hosting provider. Perhaps you could consider moving to a different host.</p>';
$string['datarootinsidedocroot'] = 'You have set up your data root to be inside your document root. This is a large security problem, as then anyone can directly request session data (in order to hijack other peoples\' sessions), or files that they are not allowed to access that other people have uploaded. Please configure the data root to be outside of the document root.';
$string['datarootnotwritable'] = 'Your defined data root directory, %s, is not writable. This means that neither session data, user files nor anything else that needs to be uploaded can be saved on your server. Please make the directory if it does not exist, or give ownership of the directory to the web server user if it does';
$string['jsonextensionnotloaded'] = 'Your server configuration does not include the JSON extension. $projectname requires this in order to send some data to and from the browser. Please make sure that it is loaded in php.ini, or install it if it is not installed.';
......@@ -167,6 +167,11 @@ function ensure_sanity() {
if (!check_dir_exists(get_config('dataroot')) || !is_writable(get_config('dataroot'))) {
throw new ConfigSanityException(get_string('datarootnotwritable', 'error', get_config('dataroot')));
// Json functions not available
if (!function_exists('json_encode') || !function_exists('json_decode')) {
throw new ConfigSanityException(get_string('jsonextensionnotloaded', 'error'));
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment