aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/admin/plugins/disable.php2
-rw-r--r--actions/admin/plugins/disableall.php2
-rw-r--r--actions/admin/plugins/enable.php6
-rw-r--r--actions/admin/plugins/enableall.php4
-rw-r--r--actions/admin/plugins/reorder.php5
-rw-r--r--actions/admin/plugins/simple_update_states.php41
-rw-r--r--actions/admin/site/update_advanced.php74
-rw-r--r--actions/admin/site/update_basic.php88
-rw-r--r--actions/login.php7
-rw-r--r--actions/plugins/settings/save.php50
-rw-r--r--actions/register.php16
-rw-r--r--actions/systemsettings/install.php28
12 files changed, 213 insertions, 110 deletions
diff --git a/actions/admin/plugins/disable.php b/actions/admin/plugins/disable.php
index d5042e2bf..ac80d46e3 100644
--- a/actions/admin/plugins/disable.php
+++ b/actions/admin/plugins/disable.php
@@ -21,6 +21,7 @@ foreach ($plugin as $p) {
// Disable
if (disable_plugin($p)) {
system_message(sprintf(elgg_echo('admin:plugins:disable:yes'), $p));
+ elgg_delete_admin_notice('first_installation_plugin_reminder');
} else {
register_error(sprintf(elgg_echo('admin:plugins:disable:no'), $p));
}
@@ -30,4 +31,3 @@ elgg_view_regenerate_simplecache();
elgg_filepath_cache_reset();
forward($_SERVER['HTTP_REFERER']);
-exit;
diff --git a/actions/admin/plugins/disableall.php b/actions/admin/plugins/disableall.php
index 70a945ee4..80553e9d1 100644
--- a/actions/admin/plugins/disableall.php
+++ b/actions/admin/plugins/disableall.php
@@ -16,6 +16,7 @@ $plugins = get_installed_plugins();
foreach ($plugins as $p => $data) {
// Disable
if (disable_plugin($p)) {
+ elgg_delete_admin_notice('first_installation_plugin_reminder');
system_message(sprintf(elgg_echo('admin:plugins:disable:yes'), $p));
} else {
register_error(sprintf(elgg_echo('admin:plugins:disable:no'), $p));
@@ -26,4 +27,3 @@ elgg_view_regenerate_simplecache();
elgg_filepath_cache_reset();
forward($_SERVER['HTTP_REFERER']);
-exit;
diff --git a/actions/admin/plugins/enable.php b/actions/admin/plugins/enable.php
index b5286336b..053fbc556 100644
--- a/actions/admin/plugins/enable.php
+++ b/actions/admin/plugins/enable.php
@@ -11,8 +11,8 @@
// block non-admin users
admin_gatekeeper();
-// Get the plugin
$plugin = get_input('plugin');
+
if (!is_array($plugin)) {
$plugin = array($plugin);
}
@@ -20,6 +20,7 @@ if (!is_array($plugin)) {
foreach ($plugin as $p) {
// Disable
if (enable_plugin($p)) {
+ elgg_delete_admin_notice('first_installation_plugin_reminder');
system_message(sprintf(elgg_echo('admin:plugins:enable:yes'), $p));
} else {
register_error(sprintf(elgg_echo('admin:plugins:enable:no'), $p));
@@ -29,5 +30,4 @@ foreach ($plugin as $p) {
elgg_view_regenerate_simplecache();
elgg_filepath_cache_reset();
-forward($_SERVER['HTTP_REFERER']);
-exit;
+forward($_SERVER['HTTP_REFERER']); \ No newline at end of file
diff --git a/actions/admin/plugins/enableall.php b/actions/admin/plugins/enableall.php
index ea4b48f95..d1758a4b3 100644
--- a/actions/admin/plugins/enableall.php
+++ b/actions/admin/plugins/enableall.php
@@ -16,6 +16,7 @@ $plugins = get_installed_plugins();
foreach ($plugins as $p => $data) {
// Enable
if (enable_plugin($p)) {
+ elgg_delete_admin_notice('first_installation_plugin_reminder');
system_message(sprintf(elgg_echo('admin:plugins:enable:yes'), $p));
} else {
register_error(sprintf(elgg_echo('admin:plugins:enable:no'), $p));
@@ -26,5 +27,4 @@ foreach ($plugins as $p => $data) {
elgg_view_regenerate_simplecache();
elgg_filepath_cache_reset();
-forward($_SERVER['HTTP_REFERER']);
-exit;
+forward($_SERVER['HTTP_REFERER']); \ No newline at end of file
diff --git a/actions/admin/plugins/reorder.php b/actions/admin/plugins/reorder.php
index 6050a585f..6423dc14c 100644
--- a/actions/admin/plugins/reorder.php
+++ b/actions/admin/plugins/reorder.php
@@ -13,8 +13,8 @@ admin_gatekeeper();
// Get the plugin
$mod = get_input('plugin');
-$mod = str_replace('.','',$mod);
-$mod = str_replace('/','',$mod);
+$mod = str_replace('.', '', $mod);
+$mod = str_replace('/', '', $mod);
// Get the new order
$order = (int) get_input('order');
@@ -35,6 +35,7 @@ if ($key = array_search($mod, $plugins)) {
// Disable
if (regenerate_plugin_list($plugins)) {
+ elgg_delete_admin_notice('first_installation_plugin_reminder');
system_message(sprintf(elgg_echo('admin:plugins:reorder:yes'), $plugin));
} else {
register_error(sprintf(elgg_echo('admin:plugins:reorder:no'), $plugin));
diff --git a/actions/admin/plugins/simple_update_states.php b/actions/admin/plugins/simple_update_states.php
new file mode 100644
index 000000000..197f183f9
--- /dev/null
+++ b/actions/admin/plugins/simple_update_states.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Elgg administration simple plugin bulk enable / disable
+ *
+ * Shows an alphabetical list of "simple" plugins.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
+
+$installed_plugins = get_installed_plugins();
+$enabled_plugins = get_input('enabled_plugins', array());
+
+$success = TRUE;
+
+foreach ($installed_plugins as $plugin => $info) {
+ // this is only for simple plugins.
+ if (!isset($info['manifest']['admin_interface']) || $info['manifest']['admin_interface'] != 'simple') {
+ continue;
+ }
+
+ $plugin_enabled = is_plugin_enabled($plugin);
+
+ // only effect changes to plugins not already in that state.
+ if ($plugin_enabled && !in_array($plugin, $enabled_plugins)) {
+ $success = $success && disable_plugin($plugin);
+ } elseif (!$plugin_enabled && in_array($plugin, $enabled_plugins)) {
+ $success = $success && enable_plugin($plugin);
+ }
+}
+
+if ($success) {
+ elgg_delete_admin_notice('first_installation_plugin_reminder');
+ system_message(elgg_echo('admin:plugins:simple_simple_success'));
+} else {
+ register_error(elgg_echo('admins:plugins:simple_simple_fail'));
+}
+
+forward($_SERVER['HTTP_REFERER']); \ No newline at end of file
diff --git a/actions/admin/site/update_advanced.php b/actions/admin/site/update_advanced.php
new file mode 100644
index 000000000..c9b78c261
--- /dev/null
+++ b/actions/admin/site/update_advanced.php
@@ -0,0 +1,74 @@
+<?php
+/**
+ * Elgg update site action
+ *
+ * This is an update version of the sitesettings/install action
+ * which is used by the admin panel to modify basic settings.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
+
+admin_gatekeeper();
+
+if (datalist_get('default_site')) {
+ $site = get_entity(datalist_get('default_site'));
+ if (!($site instanceof ElggSite)) {
+ throw new InstallationException(elgg_echo('InvalidParameterException:NonElggSite'));
+ }
+
+ $site->url = get_input('wwwroot');
+
+ datalist_set('path', sanitise_filepath(get_input('path')));
+ datalist_set('dataroot', sanitise_filepath(get_input('dataroot')));
+
+ if (get_input('simplecache_enabled')) {
+ elgg_view_enable_simplecache();
+ } else {
+ elgg_view_disable_simplecache();
+ }
+
+ if (get_input('viewpath_cache_enabled')) {
+ elgg_enable_filepath_cache();
+ } else {
+ elgg_disable_filepath_cache();
+ }
+
+ set_config('default_access', get_input('default_access', ACCESS_PRIVATE), $site->getGUID());
+
+ $user_default_access = (get_input('allow_user_default_access')) ? 1 : 0;
+ set_config('allow_user_default_access', $user_default_access, $site->getGUID());
+
+ set_config('view', get_input('view'), $site->getGUID());
+
+ $debug = get_input('debug');
+ if ($debug) {
+ set_config('debug', $debug, $site->getGUID());
+ } else {
+ unset_config('debug', $site->getGUID());
+ }
+
+ $https_login = get_input('https_login');
+ if ($https_login) {
+ set_config('https_login', 1, $site->getGUID());
+ } else {
+ unset_config('https_login', $site->getGUID());
+ }
+
+ $api = get_input('api');
+ if ($api) {
+ unset_config('disable_api', $site->getGUID());
+ } else {
+ set_config('disable_api', 'disabled', $site->getGUID());
+ }
+
+ if ($site->save()) {
+ system_message(elgg_echo("admin:configuration:success"));
+ } else {
+ register_error(elgg_echo("admin:configuration:fail"));
+ }
+
+ forward($_SERVER['HTTP_REFERER']);
+} \ No newline at end of file
diff --git a/actions/admin/site/update_basic.php b/actions/admin/site/update_basic.php
index d9fa8f367..5914ab0b5 100644
--- a/actions/admin/site/update_basic.php
+++ b/actions/admin/site/update_basic.php
@@ -11,83 +11,21 @@
* @link http://elgg.org/
*/
-global $CONFIG;
-
-// block non-admin users
admin_gatekeeper();
-if (get_input('settings') == 'go') {
- if (datalist_get('default_site')) {
- $site = get_entity(datalist_get('default_site'));
- if (!($site instanceof ElggSite)) {
- throw new InstallationException(elgg_echo('InvalidParameterException:NonElggSite'));
- }
-
- $site->description = get_input('sitedescription');
- $site->name = get_input('sitename');
- $site->email = get_input('siteemail');
- $site->url = get_input('wwwroot');
-
- datalist_set('path',sanitise_filepath(get_input('path')));
- datalist_set('dataroot',sanitise_filepath(get_input('dataroot')));
- if (get_input('simplecache_enabled')) {
- elgg_view_enable_simplecache();
- } else {
- elgg_view_disable_simplecache();
- }
- if (get_input('viewpath_cache_enabled')) {
- elgg_enable_filepath_cache();
- } else {
- elgg_disable_filepath_cache();
- }
-
- set_config('language', get_input('language'), $site->getGUID());
-
- set_config('default_access', get_input('default_access'), $site->getGUID());
-
- if (get_input('allow_user_default_access')) {
- set_config('allow_user_default_access', 1, $site->getGUID());
- } else {
- set_config('allow_user_default_access', 0, $site->getGUID());
- }
-
- set_config('view', get_input('view'), $site->getGUID());
-
- $debug = get_input('debug');
- if ($debug) {
- set_config('debug', $debug, $site->getGUID());
- } else {
- unset_config('debug', $site->getGUID());
- }
-
- $https_login = get_input('https_login');
- if ($https_login) {
- set_config('https_login', 1, $site->getGUID());
- } else {
- unset_config('https_login', $site->getGUID());
- }
-
- $usage = get_input('usage');
- if ($usage) {
- unset_config('ping_home', $site->getGUID());
- } else {
- set_config('ping_home', 'disabled', $site->getGUID());
- }
+if (datalist_get('default_site')) {
+ $site = get_entity(datalist_get('default_site'));
+ if (!($site instanceof ElggSite)) {
+ throw new InstallationException(elgg_echo('InvalidParameterException:NonElggSite'));
+ }
- $api = get_input('api');
- if ($api) {
- unset_config('disable_api', $site->getGUID());
- } else {
- set_config('disable_api', 'disabled', $site->getGUID());
- }
+ $site->description = get_input('sitedescription');
+ $site->name = get_input('sitename');
+ $site->email = get_input('siteemail');
+ $site->save();
- if ($site->save()) {
- system_message(elgg_echo("admin:configuration:success"));
- } else {
- register_error(elgg_echo("admin:configuration:fail"));
- }
+ set_config('language', get_input('language'), $site->getGUID());
- forward($_SERVER['HTTP_REFERER']);
- exit;
- }
-}
+ forward($_SERVER['HTTP_REFERER']);
+ exit;
+} \ No newline at end of file
diff --git a/actions/login.php b/actions/login.php
index fed45fbc5..ef6b0b898 100644
--- a/actions/login.php
+++ b/actions/login.php
@@ -35,12 +35,7 @@ if ($result) {
unset($_SESSION['last_forward_from']);
forward($forward_url);
} else {
- if ((isadminloggedin()) && (!datalist_get('first_admin_login'))) {
- system_message(elgg_echo('firstadminlogininstructions'));
- datalist_set('first_admin_login', time());
-
- forward('pg/admin/plugins');
- } else if (get_input('returntoreferer')) {
+ if (get_input('returntoreferer')) {
forward($_SERVER['HTTP_REFERER']);
} else {
// forward to index for front page overrides.
diff --git a/actions/plugins/settings/save.php b/actions/plugins/settings/save.php
index bbbb6a367..6aa47b60e 100644
--- a/actions/plugins/settings/save.php
+++ b/actions/plugins/settings/save.php
@@ -10,22 +10,52 @@
$params = get_input('params');
$plugin = get_input('plugin');
+if (!$plugin_info = load_plugin_manifest($plugin)) {
+ register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin));
+ forward($_SERVER['HTTP_REFERER']);
+}
+
+$plugin_name = $plugin_info['name'];
-gatekeeper();
+admin_gatekeeper();
$result = false;
-foreach ($params as $k => $v) {
- // Save
- $result = set_plugin_setting($k, $v, $plugin);
+$options = array(
+ 'plugin' => $plugin,
+ 'manifest' => $plugin_info,
+ 'settings' => $params
+);
- // Error?
- if (!$result) {
- register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin));
- forward($_SERVER['HTTP_REFERER']);
- exit;
+// allow a plugin to override the save action for their settings
+if (elgg_action_exist("settings/$plugin/save")) {
+ action("settings/$plugin/save");
+} else {
+ foreach ($params as $k => $v) {
+ if (!$result = set_plugin_setting($k, $v, $plugin)) {
+ register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin_name));
+ forward($_SERVER['HTTP_REFERER']);
+ exit;
+ }
}
}
-system_message(sprintf(elgg_echo('plugins:settings:save:ok'), $plugin));
+system_message(sprintf(elgg_echo('plugins:settings:save:ok'), $plugin_name));
forward($_SERVER['HTTP_REFERER']);
+//
+//$trigger = trigger_plugin_hook('plugin:save_settings', $plugin, $options, NULL);
+//if ($trigger === NULL) {
+// foreach ($params as $k => $v) {
+// if (!$result = set_plugin_setting($k, $v, $plugin)) {
+// register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin_name));
+// forward($_SERVER['HTTP_REFERER']);
+// exit;
+// }
+// }
+//} elseif ($trigger === FALSE) {
+// register_error(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin_name));
+// forward($_SERVER['HTTP_REFERER']);
+//}
+//
+//system_message(sprintf(elgg_echo('plugins:settings:save:ok'), $plugin_name));
+//forward($_SERVER['HTTP_REFERER']); \ No newline at end of file
diff --git a/actions/register.php b/actions/register.php
index efbc3def3..081a4e454 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -53,7 +53,21 @@ if (!$CONFIG->disable_registration) {
system_message(sprintf(elgg_echo("registerok"),$CONFIG->sitename));
// Forward on success, assume everything else is an error...
- forward();
+ // If just registered admin user, login the user in and forward to the
+ // plugins simple settings page.
+ if (!datalist_get('first_admin_login')) {
+ login($new_user);
+ // remove the "you've registered!" system_message();
+ $_SESSION['msg']['messages'] = array();
+
+ // remind users to enable / disable desired tools
+ elgg_add_admin_notice('first_installation_plugin_reminder', elgg_echo('firstadminlogininstructions'));
+
+ datalist_set('first_admin_login', time());
+ forward('pg/admin/plugins/simple');
+ } else {
+ forward();
+ }
} else {
register_error(elgg_echo("registerbad"));
}
diff --git a/actions/systemsettings/install.php b/actions/systemsettings/install.php
index 18440c62d..589e3a06c 100644
--- a/actions/systemsettings/install.php
+++ b/actions/systemsettings/install.php
@@ -10,8 +10,11 @@
* @link http://elgg.org/
*/
+global $CONFIG;
define('INSTALLING', TRUE);
-elgg_set_viewtype('failsafe'); // Set failsafe again incase we get an exception thrown
+
+// Set failsafe again in case we get an exception thrown
+elgg_set_viewtype('failsafe');
if (is_installed()) {
forward();
@@ -43,7 +46,6 @@ if (get_input('settings') == 'go') {
$site->name = get_input('sitename');
$site->url = $url;
$site->description = get_input('sitedescription');
- $site->email = get_input('siteemail');
$site->access_id = ACCESS_PUBLIC;
$guid = $site->save();
@@ -51,6 +53,12 @@ if (get_input('settings') == 'go') {
throw new InstallationException(sprintf(elgg_echo('InstallationException:CantCreateSite'), get_input('sitename'), get_input('wwwroot')));
}
+ $site->email = get_input('siteemail');
+
+ // this is needed to grab plugins
+ $CONFIG->site_guid = $guid;
+ $CONFIG->site = $site;
+
datalist_set('installed',time());
datalist_set('path', $path);
datalist_set('dataroot', $dataroot);
@@ -94,16 +102,18 @@ if (get_input('settings') == 'go') {
enable_plugin(trim($plugin), $site->getGUID());
}
} else {
- enable_plugin('profile', $site->getGUID());
- enable_plugin('logbrowser', $site->getGUID());
- enable_plugin('diagnostics', $site->getGUID());
- enable_plugin('uservalidationbyemail', $site->getGUID());
- enable_plugin('htmlawed', $site->getGUID());
- enable_plugin('search', $site->getGUID());
+ // activate plugins with manifest.xml: elgg_install_state = enabled
+ $plugins = get_plugin_list();
+ foreach ($plugins as $plugin) {
+ if ($manifest = load_plugin_manifest($plugin)) {
+ if (isset($manifest['elgg_install_state']) && $manifest['elgg_install_state'] == 'enabled') {
+ enable_plugin($plugin);
+ }
+ }
+ }
}
// reset the views path in case of installing over an old data dir.
- // @todo should this warn / error first?
$dataroot = datalist_get('dataroot');
$cache = new ElggFileCache($dataroot);
$cache->delete('view_paths');