Elgg  Version 1.11
update_advanced.php
Go to the documentation of this file.
1 <?php
13 if (!$site) {
14  throw new InstallationException("The system is missing an ElggSite entity!");
15 }
16 if (!($site instanceof ElggSite)) {
17  throw new InstallationException("Passing a non-ElggSite to an ElggSite constructor!");
18 }
19 
20 $site->url = rtrim(get_input('wwwroot', '', false), '/') . '/';
21 
22 datalist_set('path', sanitise_filepath(get_input('path', '', false)));
23 $dataroot = sanitise_filepath(get_input('dataroot', '', false));
24 
25 // check for relative paths
26 if (stripos(PHP_OS, 'win') === 0) {
27  if (strpos($dataroot, ':') !== 1) {
28  $msg = elgg_echo('admin:configuration:dataroot:relative_path', array($dataroot));
29  register_error($msg);
31  }
32 } else {
33  if (strpos($dataroot, '/') !== 0) {
34  $msg = elgg_echo('admin:configuration:dataroot:relative_path', array($dataroot));
35  register_error($msg);
37  }
38 }
39 
40 datalist_set('dataroot', $dataroot);
41 
42 if ('on' === get_input('simplecache_enabled')) {
44 } else {
46 }
47 
48 set_config('simplecache_minify_js', 'on' === get_input('simplecache_minify_js'), $site->getGUID());
49 set_config('simplecache_minify_css', 'on' === get_input('simplecache_minify_css'), $site->getGUID());
50 
51 if ('on' === get_input('system_cache_enabled')) {
53 } else {
55 }
56 
57 set_config('default_access', get_input('default_access', ACCESS_PRIVATE), $site->getGUID());
58 
59 $user_default_access = ('on' === get_input('allow_user_default_access'));
60 set_config('allow_user_default_access', $user_default_access, $site->getGUID());
61 
62 $debug = get_input('debug');
63 if ($debug) {
64  set_config('debug', $debug, $site->getGUID());
65 } else {
66  unset_config('debug', $site->getGUID());
67 }
68 
69 // allow new user registration?
70 $allow_registration = ('on' === get_input('allow_registration', false));
71 set_config('allow_registration', $allow_registration, $site->getGUID());
72 
73 // setup walled garden
74 $walled_garden = ('on' === get_input('walled_garden', false));
75 set_config('walled_garden', $walled_garden, $site->getGUID());
76 
77 if ('on' === get_input('https_login')) {
78  set_config('https_login', 1, $site->getGUID());
79 } else {
80  unset_config('https_login', $site->getGUID());
81 }
82 
83 $regenerate_site_secret = get_input('regenerate_site_secret', false);
85  // if you cancel this even you should present a message to the user
86  if (elgg_trigger_before_event('regenerate_site_secret', 'system')) {
89  elgg_trigger_after_event('regenerate_site_secret', 'system');
90 
91  system_message(elgg_echo('admin:site:secret_regenerated'));
92 
93  elgg_delete_admin_notice('weak_site_key');
94  }
95 }
96 
97 if ($site->save()) {
98  system_message(elgg_echo("admin:configuration:success"));
99 } else {
100  register_error(elgg_echo("admin:configuration:fail"));
101 }
102 
elgg_enable_system_cache()
Enables the system disk cache.
Definition: cache.php:62
elgg_delete_admin_notice($id)
Remove an admin notice by ID.
Definition: admin.php:94
elgg_get_site_entity($site_guid=0)
Get an entity (default is current site)
Definition: sites.php:18
elgg_reset_system_cache()
Reset the system cache by deleting the caches.
Definition: cache.php:29
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
unset_config($name, $site_guid=0)
Removes a config setting.
$allow_registration
sanitise_filepath($path, $append_slash=true)
Sanitise file paths ensuring that they begin and end with slashes etc.
Definition: elgglib.php:368
elgg_disable_system_cache()
Disables the system disk cache.
Definition: cache.php:74
init_site_secret()
Initialise the site secret (32 bytes: "z" to indicate format + 186-bit key in Base64 URL)...
Definition: actions.php:182
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
Definition: elgglib.js:419
elgg_trigger_before_event($event, $object_type, $object=null)
Trigger a "Before event" indicating a process is about to begin.
Definition: elgglib.php:591
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
const REFERER
Definition: elgglib.php:1995
datalist_set($name, $value)
Set the value for a datalist element.
const ACCESS_PRIVATE
Definition: elgglib.php:1954
$dataroot
elgg system_message
Wrapper function for system_messages.
Definition: elgglib.js:374
elgg register_error
Wrapper function for system_messages.
Definition: elgglib.js:383
elgg_disable_simplecache()
Disables the simple cache.
Definition: cache.php:186
elgg_trigger_after_event($event, $object_type, $object=null)
Trigger an "After event" indicating a process has finished.
Definition: elgglib.php:610
$user_default_access
elgg_enable_simplecache()
Enables the simple cache.
Definition: cache.php:173
$regenerate_site_secret
$walled_garden
set_config($name, $value, $site_guid=0)
Add or update a config setting.