aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/elgglib.php11
-rw-r--r--engine/lib/plugins.php29
-rw-r--r--engine/start.php21
3 files changed, 48 insertions, 13 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 7a4f3df9b..cc7fbf209 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -1345,13 +1345,14 @@
$callstack = debug_backtrace();
$call_paths = array();
foreach ($callstack as $call)
- $call_paths[] = sanitise_string($call['path']);
-
+ $call_paths[] = sanitise_string($call['file']);
+
// Get privileged paths
- $paths = get_data("SELECT * from {$CONFIG->dbprefix}privileged_paths");
+ $paths = get_data("SELECT * from {$CONFIG->dbprefix}privileged_paths");
+
foreach ($paths as $p)
- {
- if (in_array($CONFIG->path . $p->path, $call_paths))
+ {
+ if (in_array( $p->path, $call_paths))
return true;
}
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index 0edf46bfb..464163f2b 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -304,6 +304,9 @@
*/
function is_plugin_enabled($plugin, $site_guid = 0)
{
+ //return execute_privileged_codeblock('__is_plugin_enabled_priv', array('plugin'=>$plugin, 'site_guid' => $site_guid));
+ // Does this need to be in privileged? Doesn't seem to...
+
global $CONFIG;
$site_guid = (int) $site_guid;
@@ -320,6 +323,32 @@
return false;
}
+
+ /**
+ * Privileged execution so code can run before user logged in.
+ *
+ * @param array $params
+ * @return bool
+ */
+ /*function __is_plugin_enabled_priv(array $params = null)
+ {
+ global $CONFIG;
+
+ $plugin = $params['plugin'];
+ $site_guid = (int) $params['site_guid'];
+ if ($site_guid == 0)
+ $site_guid = $CONFIG->site_guid;
+
+ $site = get_entity($site_guid);
+ if (!($site instanceof ElggSite))
+ throw new InvalidClassException(sprintf(elgg_echo('InvalidClassException:NotValidElggStar'), $site_guid, "ElggSite"));
+
+ $enabled = find_metadata("enabled_plugins", $plugin, "site", "", 10, 0, "", $site_guid);
+ if ($enabled)
+ return true;
+
+ return false;
+ }*/
/**
* Run once and only once.
diff --git a/engine/start.php b/engine/start.php
index bab80c2aa..ed452d78f 100644
--- a/engine/start.php
+++ b/engine/start.php
@@ -126,16 +126,8 @@
throw new InstallationException("Could not load {$file}");
}
- // Determine light mode
- $lm = strtolower(get_input('lightmode'));
- if ($lm == 'true') $lightmode = true;
-
// Set default config
set_default_config();
-
- // Load plugins, if we're not in light mode
- if (!$lightmode)
- load_plugins();
} else { // End portion for sanitised installs only
@@ -148,6 +140,19 @@
// Trigger events
trigger_elgg_event('boot', 'system');
+
+ // Load plugins
+
+ // Determine light mode
+ $lm = strtolower(get_input('lightmode'));
+ if ($lm == 'true') $lightmode = true;
+
+ // Load plugins, if we're not in light mode
+ if (!$lightmode) {
+ load_plugins();
+
+ trigger_elgg_event('plugins_boot', 'system');
+ }
// Forward if we haven't been installed
if ((!is_installed() || !is_db_installed()) && !substr_count($_SERVER["PHP_SELF"],"install.php") && !substr_count($_SERVER["PHP_SELF"],"css.php") && !substr_count($_SERVER["PHP_SELF"],"action_handler.php")) {