aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/usersettings.php33
-rw-r--r--languages/en.php2
-rw-r--r--settings/index.php4
-rw-r--r--settings/plugins.php26
-rw-r--r--settings/statistics.php (renamed from settings/statistics/index.php)12
-rw-r--r--settings/user.php (renamed from settings/user/index.php)16
-rw-r--r--views/default/object/plugin.php2
-rw-r--r--views/default/usersettings/plugins.php14
-rw-r--r--views/default/usersettings/plugins_opt/plugin.php18
9 files changed, 83 insertions, 44 deletions
diff --git a/engine/lib/usersettings.php b/engine/lib/usersettings.php
index 647cbdaed..6f10ebdbd 100644
--- a/engine/lib/usersettings.php
+++ b/engine/lib/usersettings.php
@@ -40,10 +40,33 @@
// Menu options
if (get_context() == "settings") {
- add_submenu_item(elgg_echo('usersettings:user:opt:linktext'),$CONFIG->wwwroot . "pg/settings/user?username=" . $_SESSION['user']->username);
- add_submenu_item(elgg_echo('profile:editicon'), $CONFIG->wwwroot . 'mod/profile/editicon.php');
- add_submenu_item(elgg_echo('usersettings:statistics:opt:linktext'),$CONFIG->wwwroot . "pg/settings/statistics?username=" . $_SESSION['user']->username);
+ add_submenu_item(elgg_echo('usersettings:user:opt:linktext'),$CONFIG->wwwroot . "pg/settings/user/{$_SESSION['user']->username}/");
+ add_submenu_item(elgg_echo('profile:editicon'), $CONFIG->wwwroot . 'mod/profile/editicon.php');
+ add_submenu_item(elgg_echo('usersettings:plugins:opt:linktext'),$CONFIG->wwwroot . "pg/settings/plugins/{$_SESSION['user']->username}/");
+ add_submenu_item(elgg_echo('usersettings:statistics:opt:linktext'),$CONFIG->wwwroot . "pg/settings/statistics/{$_SESSION['user']->username}/");
}
+ }
+
+ function usersettings_page_handler($page)
+ {
+ global $CONFIG;
+
+ $path = $CONFIG->path . "settings/index.php";
+
+ if ($page[0])
+ {
+ switch ($page[0])
+ {
+ case 'user' : $path = $CONFIG->path . "settings/user.php"; break;
+ case 'statistics' : $path = $CONFIG->path . "settings/statistics.php"; break;
+ case 'plugins' : $path = $CONFIG->path . "settings/plugins.php"; break;
+ }
+ }
+
+ if ($page[1])
+ set_input('username', $page[1]);
+
+ include($path);
}
/**
@@ -51,10 +74,12 @@
*/
function usersettings_init()
{
-
+ // Page handler
+ register_page_handler('settings','usersettings_page_handler');
}
/// Register init function
+ register_elgg_event_handler('init','system','usersettings_init');
register_elgg_event_handler('pagesetup','system','usersettings_pagesetup');
?> \ No newline at end of file
diff --git a/languages/en.php b/languages/en.php
index f088f74f8..537c6e0a2 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -544,7 +544,7 @@ To remove a widget drag it back to the <b>Widget gallery</b>.",
'usersettings:plugins' => "Tools",
'usersettings:plugins:opt:description' => "Configure settings for your active tools.",
- 'usersettings:plugins:opt:linktext' => "Configure your tools...",
+ 'usersettings:plugins:opt:linktext' => "Configure your tools",
'usersettings:plugins:description' => "This panel allows you to control and configure the personal settings for the tools installed by your system administrator.",
'usersettings:statistics:label:numentities' => "Your entities",
diff --git a/settings/index.php b/settings/index.php
index 041a06616..4aaf875bf 100644
--- a/settings/index.php
+++ b/settings/index.php
@@ -17,11 +17,11 @@
set_page_owner($_SESSION['guid']);
// Make sure we don't open a security hole ...
- if (!page_owner_entity()->canEdit()) {
+ if ((!page_owner_entity()) || (!page_owner_entity()->canEdit())) {
set_page_owner($_SESSION['guid']);
}
// Forward to the user settings
- forward('pg/settings/user?username=' . page_owner_entity()->username);
+ forward('pg/settings/user/' . page_owner_entity()->username . "/");
?> \ No newline at end of file
diff --git a/settings/plugins.php b/settings/plugins.php
new file mode 100644
index 000000000..677d18d93
--- /dev/null
+++ b/settings/plugins.php
@@ -0,0 +1,26 @@
+<?php
+ /**
+ * Elgg user settings functions.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ // Get the Elgg framework
+ require_once(dirname(dirname(__FILE__)) . "/engine/start.php");
+
+ // Make sure only valid admin users can see this
+ gatekeeper();
+
+ // Make sure we don't open a security hole ...
+ if ((!page_owner_entity()) || (!page_owner_entity()->canEdit())) {
+ set_page_owner($_SESSION['guid']);
+ }
+
+ // Display main admin menu
+ page_draw(elgg_echo("usersettings:plugins"),elgg_view_layout('two_column_left_sidebar','',elgg_view_title(elgg_echo("usersettings:plugins")) . elgg_view("usersettings/plugins", array('installed_plugins' => get_installed_plugins()))));
+?> \ No newline at end of file
diff --git a/settings/statistics/index.php b/settings/statistics.php
index c1c91371d..ba2d5f0f4 100644
--- a/settings/statistics/index.php
+++ b/settings/statistics.php
@@ -11,14 +11,14 @@
*/
// Get the Elgg framework
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ require_once(dirname(dirname(__FILE__)) . "/engine/start.php");
// Make sure only valid admin users can see this
- gatekeeper();
-
- // Make sure we don't open a security hole ...
- if (!page_owner_entity()->canEdit()) {
- set_page_owner($_SESSION['guid']);
+ gatekeeper();
+
+ // Make sure we don't open a security hole ...
+ if ((!page_owner_entity()) || (!page_owner_entity()->canEdit())) {
+ set_page_owner($_SESSION['guid']);
}
// Display main admin menu
diff --git a/settings/user/index.php b/settings/user.php
index 0e6727069..0711f4885 100644
--- a/settings/user/index.php
+++ b/settings/user.php
@@ -11,19 +11,19 @@
*/
// Get the Elgg framework
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ require_once(dirname(dirname(__FILE__)) . "/engine/start.php");
// Make sure only valid admin users can see this
gatekeeper();
-
- // Make sure we don't open a security hole ...
- if (!page_owner_entity()->canEdit()) {
- set_page_owner($_SESSION['guid']);
+
+ // Make sure we don't open a security hole ...
+ if ((!page_owner_entity()) || (!page_owner_entity()->canEdit())) {
+ set_page_owner($_SESSION['guid']);
}
// Display main admin menu
- page_draw(
- elgg_echo("usersettings:user"),
- elgg_view_layout("two_column_left_sidebar", '', elgg_view_title(elgg_echo('usersettings:user')) . elgg_view("usersettings/form"))
+ page_draw(
+ elgg_echo("usersettings:user"),
+ elgg_view_layout("two_column_left_sidebar", '', elgg_view_title(elgg_echo('usersettings:user')) . elgg_view("usersettings/form"))
);
?> \ No newline at end of file
diff --git a/views/default/object/plugin.php b/views/default/object/plugin.php
index aaa5d6681..2c70476df 100644
--- a/views/default/object/plugin.php
+++ b/views/default/object/plugin.php
@@ -14,7 +14,7 @@
$plugin = $vars['plugin'];
$prefix = $vars['prefix']; // Do we want to show admin settings (default) or user settings
- $form_body = elgg_view("{$prefix}settings/{$plugin}/edit",$vars);
+ $form_body = elgg_view("{$prefix}settings/{$plugin}/edit", $vars);
$form_body .= "<p>" . elgg_view('input/hidden', array('internalname' => 'plugin', 'value' => $plugin)) . elgg_view('input/submit', array('value' => elgg_echo('save'))) . "</p>";
diff --git a/views/default/usersettings/plugins.php b/views/default/usersettings/plugins.php
index 3daf16733..321f377ce 100644
--- a/views/default/usersettings/plugins.php
+++ b/views/default/usersettings/plugins.php
@@ -16,7 +16,6 @@
$limit = get_input('limit', 10);
$offset = get_input('offset', 0);
-
// Get the installed plugins
$installed_plugins = $vars['installed_plugins'];
$count = count($installed_plugins);
@@ -25,19 +24,10 @@
$n = 0;
foreach ($installed_plugins as $plugin => $data)
{
- if (($n>=$offset) && ($n < $offset+$limit))
+ if (is_plugin_enabled($plugin))
echo elgg_view("usersettings/plugins_opt/plugin", array('plugin' => $plugin, 'details' => $data));
- $n++;
}
- // Diplay nav
- if ($count)
- {
- echo elgg_view('navigation/pagination',array(
- 'baseurl' => $_SERVER['REQUEST_URI'],
- 'offset' => $offset,
- 'count' => $count,
- ));
- }
+
?> \ No newline at end of file
diff --git a/views/default/usersettings/plugins_opt/plugin.php b/views/default/usersettings/plugins_opt/plugin.php
index 51948b41f..1c02ff97a 100644
--- a/views/default/usersettings/plugins_opt/plugin.php
+++ b/views/default/usersettings/plugins_opt/plugin.php
@@ -22,21 +22,19 @@
$user_guid = $details['user_guid'];
if ($user_guid) $user_guid = $_SESSION['user']->guid;
+
+ if (elgg_view("usersettings/{$plugin}/edit")) {
?>
-<div id="plugin_details" class="<?php if ($active) echo "active"; else "not-active" ?>">
+<div id="user_plugin_details">
<div><h2><?php echo $plugin; ?></h2></div>
<?php if ($manifest) { ?>
<div><?php echo $manifest['description'] ?></div>
<div><?php echo elgg_echo('admin:plugins:label:author') . ": ". $manifest['author'] ?></div>
- <div><?php echo elgg_echo('admin:plugins:label:copyright') . ": ". $manifest['copyright'] ?></div>
- <div><?php echo elgg_echo('admin:plugins:label:licence') . ": ". $manifest['licence'] ?></div>
- <div><?php echo elgg_echo('admin:plugins:label:website') . ": "; ?><a href="<?php echo $manifest['website']; ?>"><?php echo $manifest['website']; ?></a></div>
<?php } ?>
- <?php if (elgg_view("usersettings/{$plugin}/edit")) { ?>
- <div id="<?php echo $plugin; ?>_settings">
- <?php echo elgg_view("object/plugin", array('plugin' => $plugin, 'entity' => find_plugin_usersettings($plugin, $user_guid), 'prefix' => 'user')) ?>
- </div>
- <?php } ?>
-</div> \ No newline at end of file
+ <div id="<?php echo $plugin; ?>_settings">
+ <?php echo elgg_view("object/plugin", array('plugin' => $plugin, 'entity' => find_plugin_usersettings($plugin, $user_guid), 'prefix' => 'user')) ?>
+ </div>
+</div>
+<?php } ?> \ No newline at end of file