Elgg  Version 1.9
update_advanced.php
Go to the documentation of this file.
1 <?php
12 if ($site = elgg_get_site_entity()) {
13  if (!($site instanceof ElggSite)) {
14  throw new InstallationException("Passing a non-ElggSite to an ElggSite constructor!");
15  }
16 
17  $site->url = rtrim(get_input('wwwroot', '', false), '/') . '/';
18 
19  datalist_set('path', sanitise_filepath(get_input('path', '', false)));
20  $dataroot = sanitise_filepath(get_input('dataroot', '', false));
21 
22  // check for relative paths
23  if (stripos(PHP_OS, 'win') === 0) {
24  if (strpos($dataroot, ':') !== 1) {
25  $msg = elgg_echo('admin:configuration:dataroot:relative_path', array($dataroot));
26  register_error($msg);
28  }
29  } else {
30  if (strpos($dataroot, '/') !== 0) {
31  $msg = elgg_echo('admin:configuration:dataroot:relative_path', array($dataroot));
32  register_error($msg);
34  }
35  }
36 
37  datalist_set('dataroot', $dataroot);
38 
39  if ('on' === get_input('simplecache_enabled')) {
41  } else {
43  }
44 
45  set_config('simplecache_minify_js', 'on' === get_input('simplecache_minify_js'), $site->getGUID());
46  set_config('simplecache_minify_css', 'on' === get_input('simplecache_minify_css'), $site->getGUID());
47 
48  if ('on' === get_input('system_cache_enabled')) {
50  } else {
52  }
53 
54  set_config('default_access', get_input('default_access', ACCESS_PRIVATE), $site->getGUID());
55 
56  $user_default_access = ('on' === get_input('allow_user_default_access'));
57  set_config('allow_user_default_access', $user_default_access, $site->getGUID());
58 
59  $debug = get_input('debug');
60  if ($debug) {
61  set_config('debug', $debug, $site->getGUID());
62  } else {
63  unset_config('debug', $site->getGUID());
64  }
65 
66  // allow new user registration?
67  $allow_registration = ('on' === get_input('allow_registration', false));
68  set_config('allow_registration', $allow_registration, $site->getGUID());
69 
70  // setup walled garden
71  $walled_garden = ('on' === get_input('walled_garden', false));
72  set_config('walled_garden', $walled_garden, $site->getGUID());
73 
74  if ('on' === get_input('https_login')) {
75  set_config('https_login', 1, $site->getGUID());
76  } else {
77  unset_config('https_login', $site->getGUID());
78  }
79 
80  $regenerate_site_secret = get_input('regenerate_site_secret', false);
81  if ($regenerate_site_secret) {
84 
85  system_message(elgg_echo('admin:site:secret_regenerated'));
86 
87  elgg_delete_admin_notice('weak_site_key');
88  }
89 
90  if ($site->save()) {
91  system_message(elgg_echo("admin:configuration:success"));
92  } else {
93  register_error(elgg_echo("admin:configuration:fail"));
94  }
95 
97 }
elgg_enable_system_cache()
Enables the system disk cache.
Definition: cache.php:92
elgg_delete_admin_notice($id)
Remove an admin notice by ID.
Definition: admin.php:116
elgg_get_site_entity($site_guid=0)
Get an ElggSite entity (default is current site)
Definition: sites.php:18
elgg_reset_system_cache()
Reset the system cache by deleting the caches.
Definition: cache.php:40
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.
sanitise_filepath($path, $append_slash=true)
Sanitise file paths ensuring that they begin and end with slashes etc.
Definition: elgglib.php:484
elgg_disable_system_cache()
Disables the system disk cache.
Definition: cache.php:108
init_site_secret()
Initialise the site secret (32 bytes: "z" to indicate format + 186-bit key in Base64 URL)...
Definition: actions.php:171
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
Definition: elgglib.js:419
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:2162
datalist_set($name, $value)
Set the value for a datalist element.
const ACCESS_PRIVATE
Definition: elgglib.php:2121
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:240
elgg_enable_simplecache()
Enables the simple cache.
Definition: cache.php:225
A Site entity.
Definition: ElggSite.php:28
set_config($name, $value, $site_guid=0)
Add or update a config setting.