diff options
author | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-11 17:11:56 +0000 |
---|---|---|
committer | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-11 17:11:56 +0000 |
commit | 11f2942c65c038eda3fb65c40877d1081c0637e8 (patch) | |
tree | 64893c9630e2b49b7adf42d37074b29e47b2764e | |
parent | d608c770c56ec35092221b296a83dd617d58dae6 (diff) | |
download | elgg-11f2942c65c038eda3fb65c40877d1081c0637e8.tar.gz elgg-11f2942c65c038eda3fb65c40877d1081c0637e8.tar.bz2 |
Marcus Povey <marcus@dushka.co.uk>
* Basic site admin
git-svn-id: https://code.elgg.org/elgg/trunk@871 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | actions/admin/site/update_basic.php | 41 | ||||
-rw-r--r-- | engine/lib/admin.php | 4 | ||||
-rw-r--r-- | engine/lib/entities.php | 6 | ||||
-rw-r--r-- | engine/lib/sites.php | 2 | ||||
-rw-r--r-- | languages/en.php | 5 | ||||
-rw-r--r-- | views/default/admin/site.php | 6 |
6 files changed, 58 insertions, 6 deletions
diff --git a/actions/admin/site/update_basic.php b/actions/admin/site/update_basic.php new file mode 100644 index 000000000..726fe8eac --- /dev/null +++ b/actions/admin/site/update_basic.php @@ -0,0 +1,41 @@ +<?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
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Marcus Povey
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+ + global $CONFIG; +
+ 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->name = get_input('sitename');
+ $site->url = get_input('wwwroot'); +
+ datalist_set('path',get_input('path'));
+ datalist_set('dataroot',get_input('dataroot'));
+
+ system_message(elgg_echo("admin:configuration:success"));
+
+ header("Location: {$CONFIG->wwwroot}admin/site/");
+ exit;
+
+ }
+
+ }
+
+?>
\ No newline at end of file diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 2434ab62c..e9b3e6684 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -45,6 +45,10 @@ extend_elgg_admin_page('admin/main_opt/site', 'admin/main'); extend_elgg_admin_page('admin/main_opt/user', 'admin/main'); extend_elgg_admin_page('admin/main_opt/plugins', 'admin/main', 999); // Always last + + + // Register some actions + register_action('admin/site/update_basic', false, "", true); // Register basic site admin action } /// Register init function diff --git a/engine/lib/entities.php b/engine/lib/entities.php index f96a0a6f3..7735b651b 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -881,6 +881,7 @@ $entity = get_entity($guid); if ($entity->canEdit()) { + if (trigger_elgg_event('update',$entity->type,$entity)) { $ret = update_data("UPDATE {$CONFIG->dbprefix}entities set owner_guid='$owner_guid', access_id='$access_id', time_updated='$time' WHERE guid=$guid"); @@ -1225,7 +1226,7 @@ * @return true|false Whether the specified user can edit the specified entity. */ function can_edit_entity($entity_guid, $user_guid = 0) { - + global $CONFIG; if ($user_guid == 0) { if (isset($_SESSION['user'])) { @@ -1238,9 +1239,10 @@ } if (($entity = get_entity($entity_guid)) && (!is_null($user))) { + if ($entity->getOwner() == $user->getGUID()) return true; if ($entity->type == "user" && $entity->getGUID() == $user->getGUID()) return true; - + return trigger_plugin_hook('permissions_check',$entity->type,array('entity' => $entity, 'user' => $user),false); } else { diff --git a/engine/lib/sites.php b/engine/lib/sites.php index 5f496a58d..4d3de2794 100644 --- a/engine/lib/sites.php +++ b/engine/lib/sites.php @@ -142,7 +142,7 @@ // Save generic stuff if (!parent::save()) return false; - + // Now save specific stuff return create_site_entity($this->get('guid'), $this->get('name'), $this->get('description'), $this->get('url')); } diff --git a/languages/en.php b/languages/en.php index f3efede30..cd714143a 100644 --- a/languages/en.php +++ b/languages/en.php @@ -209,7 +209,10 @@ /**
* Administration
- */
+ */ + + 'admin:configuration:success' => "Your settings have been saved.", + 'admin:configuration:fail' => "Your settings could not be saved.",
'admin' => "Administration",
'admin:description' => "The admin panel allows you to control all aspects of the system, from user management to how plugins behave. Choose an option below to get started.", diff --git a/views/default/admin/site.php b/views/default/admin/site.php index 30fa901fd..f64c9b994 100644 --- a/views/default/admin/site.php +++ b/views/default/admin/site.php @@ -9,10 +9,12 @@ * @author Curverider Ltd * @copyright Curverider Ltd 2008 * @link http://elgg.org/ - **/ + */ + global $CONFIG; + // Description of what's going on echo "<p>" . nl2br(elgg_echo("admin:site:description")) . "</p>"; - + echo elgg_view("settings/system",array("action" => $CONFIG->wwwroot."action/admin/site/update_basic")); ?>
\ No newline at end of file |