29 if ($site_guid == 0) {
92 if (($site_guid === 0 || $site_guid ===
null || $site_guid ==
$CONFIG->site_guid) && isset(
$CONFIG->$name)) {
96 if ($site_guid ===
null) {
100 if ($site_guid == 0) {
101 $site_guid = (int)
$CONFIG->site_guid;
105 if (!isset(
$CONFIG->site_config_loaded) || $site_guid !=
$CONFIG->site_guid) {
118 if ($site_guid ==
$CONFIG->site_guid || $site_guid ===
null) {
159 if (strlen(
$name) > 255) {
160 elgg_log(
"The name length for configuration variables cannot be greater than 255",
"ERROR");
164 if ($site_guid ===
null) {
170 if ($site_guid == 0) {
171 $site_guid = (int)
$CONFIG->site_guid;
176 if ($site_guid ===
null || $site_guid ==
$CONFIG->site_guid) {
213 elgg_log(
"The name length for configuration variables cannot be greater than 255",
"ERROR");
223 static $datalist_memcache =
null;
225 $datalist_memcache =
new ElggMemcache(
'datalist_memcache');
227 if ($datalist_memcache) {
237 $result =
get_data_row(
"SELECT * FROM {$CONFIG->dbprefix}datalists WHERE name = '$escaped_name'");
242 if ($datalist_memcache) {
276 elgg_log(
"The name length for configuration variables cannot be greater than 255",
"ERROR");
281 static $datalist_memcache =
null;
283 $datalist_memcache =
new ElggMemcache(
'datalist_memcache');
286 if ($datalist_memcache) {
287 $datalist_memcache->delete(
$name);
293 .
" SET name = '$escaped_name', value = '$escaped_value'"
294 .
" ON DUPLICATE KEY UPDATE value = '$escaped_value'");
334 $lastupdated = (int) $lastupdated;
335 } elseif ($lastupdated !==
false) {
341 if (is_callable($functionname) && $lastupdated <= $timelastupdatedcheck) {
369 $site_guid = (int) $site_guid;
370 if ($site_guid == 0) {
371 $site_guid = (int)
$CONFIG->site_guid;
379 $query =
"DELETE FROM {$CONFIG->dbprefix}config WHERE name = '$escaped_name' AND site_guid = $site_guid";
415 elgg_log(
"The name length for configuration variables cannot be greater than 255",
"ERROR");
419 $site_guid = (int) $site_guid;
420 if ($site_guid == 0) {
421 $site_guid = (int)
$CONFIG->site_guid;
424 if ($site_guid ==
$CONFIG->site_guid) {
431 SET name = '$escaped_name', value = '$escaped_value', site_guid = $site_guid
432 ON DUPLICATE KEY UPDATE value = '$escaped_value'");
458 $site_guid = (int) $site_guid;
465 $new_name =
'view_path';
469 $new_name =
'plugins_path';
473 $new_name =
'site_name';
485 if ($site_guid == 0) {
486 $site_guid = (int)
$CONFIG->site_guid;
496 WHERE name = '$escaped_name' AND site_guid = $site_guid");
501 if ($site_guid ==
$CONFIG->site_guid) {
522 $site_guid = (int) $site_guid;
524 if ($site_guid == 0) {
525 $site_guid = (int)
$CONFIG->site_guid;
528 if (
$result =
get_data(
"SELECT * FROM {$CONFIG->dbprefix}config WHERE site_guid = $site_guid")) {
558 throw new InstallationException(
"Unable to handle this request. This site is not configured or the database is down.");
569 $CONFIG->site_config_loaded =
true;
589 $install_root = str_replace(
"\\",
"/", dirname(dirname(dirname(__FILE__))));
591 'path' =>
"$install_root/",
592 'view_path' =>
"$install_root/views/",
593 'plugins_path' =>
"$install_root/mod/",
597 'viewpath' =>
"$install_root/views/",
598 'pluginspath' =>
"$install_root/mod/",
608 if (!isset(
$CONFIG->cookies)) {
611 if (!isset(
$CONFIG->cookies[
'session'])) {
612 $CONFIG->cookies[
'session'] = array();
614 $session_defaults = session_get_cookie_params();
615 $session_defaults[
'name'] =
'Elgg';
616 $CONFIG->cookies[
'session'] = array_merge($session_defaults,
$CONFIG->cookies[
'session']);
617 if (!isset(
$CONFIG->cookies[
'remember_me'])) {
618 $CONFIG->cookies[
'remember_me'] = array();
620 $session_defaults[
'name'] =
'elggperm';
621 $session_defaults[
'expire'] = strtotime(
"+30 days");
622 $CONFIG->cookies[
'remember_me'] = array_merge($session_defaults,
$CONFIG->cookies[
'remember_me']);
642 if (isset(
$CONFIG->dataroot)) {
644 $CONFIG->dataroot_in_settings =
true;
647 if (!empty($dataroot)) {
650 $CONFIG->dataroot_in_settings =
false;
652 if (isset(
$CONFIG->simplecache_enabled)) {
653 $CONFIG->simplecache_enabled_in_settings =
true;
655 $simplecache_enabled =
datalist_get(
'simplecache_enabled');
656 if ($simplecache_enabled !==
false) {
657 $CONFIG->simplecache_enabled = $simplecache_enabled;
659 $CONFIG->simplecache_enabled = 1;
661 $CONFIG->simplecache_enabled_in_settings =
false;
664 $system_cache_enabled =
datalist_get(
'system_cache_enabled');
665 if ($system_cache_enabled !==
false) {
666 $CONFIG->system_cache_enabled = $system_cache_enabled;
668 $CONFIG->system_cache_enabled = 1;
677 $CONFIG->i18n_loaded_from_cache =
false;
680 $CONFIG->entity_types = array(
'group',
'object',
'site',
'user');
688 $tests[] =
"{$CONFIG->path}engine/tests/ElggCoreConfigTest.php";
if($guid==elgg_get_logged_in_user_guid()) $name
datalist_get($name)
Get the value of a datalist element.
elgg_get_plugins_path()
Get the plugin path for this installation.
global $DATALIST_CACHE
An array of key value pairs from the datalists table.
_elgg_config_test($hook, $type, $tests)
@access private
unset_config($name, $site_guid=0)
Removes a config setting.
datalist_set($name, $value)
Set the value for a datalist element.
elgg_set_config($name, $value)
Set an Elgg configuration value.
elgg_save_config($name, $value, $site_guid=0)
Save a configuration setting.
elgg_get_site_url($site_guid=0)
Get the URL for the current (or specified) site.
run_function_once($functionname, $timelastupdatedcheck=0)
Run a function one time per installation.
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
_elgg_get_all_config($site_guid=0)
Loads all configuration values from the dbprefix_config table into $CONFIG.
set_config($name, $value, $site_guid=0)
Add or update a config setting.
elgg_get_root_path()
Get the root directory path for this installation.
_elgg_load_site_config()
Loads configuration related to this site.
_elgg_load_application_config()
Loads configuration related to Elgg as an application.
get_config($name, $site_guid=0)
Gets a configuration value.
elgg_get_data_path()
Get the data directory path for this installation.
elgg_log($message, $level='NOTICE')
Display or log a message.
sanitise_filepath($path, $append_slash=true)
Sanitise file paths ensuring that they begin and end with slashes etc.
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
Register a callback as a plugin hook handler.
delete_data($query)
Remove a row from the database.
sanitize_string($string)
Sanitize a string for database use.
insert_data($query)
Insert a row into the database.
get_data_row($query, $callback="")
Retrieve a single row from the database.
get_data($query, $callback="")
Retrieve rows from the database.
get_entity($guid)
Loads and returns an entity object from a guid.
elgg_strlen()
Wrapper function for mb_strlen().
is_memcache_available()
Return true if memcache is available and configured.