diff options
Diffstat (limited to 'engine/lib/sites.php')
-rw-r--r-- | engine/lib/sites.php | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/engine/lib/sites.php b/engine/lib/sites.php index c088e2476..14cc2039d 100644 --- a/engine/lib/sites.php +++ b/engine/lib/sites.php @@ -1,16 +1,16 @@ -<?php
-
- /**
- * Elgg sites
- * Functions to manage multiple or single sites in an Elgg install
- *
- * @package Elgg
- * @subpackage Core
+<?php - * @author Curverider Ltd <info@elgg.com>
+ /** + * Elgg sites + * Functions to manage multiple or single sites in an Elgg install + * + * @package Elgg + * @subpackage Core - * @link http://elgg.org/
- */
+ * @author Curverider Ltd <info@elgg.com> + + * @link http://elgg.org/ + */ /** * ElggSite @@ -280,7 +280,7 @@ if ($row) { - // Exists and you have access to it
+ // Exists and you have access to it if ($exists = get_data_row("SELECT guid from {$CONFIG->dbprefix}sites_entity where guid = {$guid}")) { $result = update_data("UPDATE {$CONFIG->dbprefix}sites_entity set name='$name', description='$description', url='$url' where guid=$guid"); if ($result!=false) @@ -293,7 +293,7 @@ $entity->delete(); //delete_entity($guid); } - }
+ } } else { @@ -372,25 +372,25 @@ $offset = (int)$offset; return get_entities_from_relationship("member_of_site", $site_guid, true, "user", "", 0, "time_created desc", $limit, $offset); - }
-
- /**
- * Display a list of site members
- *
- * @param int $site_guid The GUID of the site
- * @param int $limit The number of members to display on a page
- * @param true|false $fullview Whether or not to display the full view (default: true)
- * @return string A displayable list of members
- */
- function list_site_members($site_guid, $limit = 10, $fullview = true) {
-
- $offset = (int) get_input('offset');
- $limit = (int) $limit;
- $count = (int) get_entities_from_relationship("member_of_site", $site_guid, true, "user", "", 0, "time_created desc", $limit, $offset, true);
- $entities = get_site_members($site_guid, $limit, $offset);
-
- return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview);
-
+ } + + /** + * Display a list of site members + * + * @param int $site_guid The GUID of the site + * @param int $limit The number of members to display on a page + * @param true|false $fullview Whether or not to display the full view (default: true) + * @return string A displayable list of members + */ + function list_site_members($site_guid, $limit = 10, $fullview = true) { + + $offset = (int) get_input('offset'); + $limit = (int) $limit; + $count = (int) get_entities_from_relationship("member_of_site", $site_guid, true, "user", "", 0, "time_created desc", $limit, $offset, true); + $entities = get_site_members($site_guid, $limit, $offset); + + return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview); + } /** @@ -439,8 +439,8 @@ $offset = (int)$offset; return get_entities_from_relationship("member_of_site", $site_guid, true, "object", $subtype, 0, "time_created desc", $limit, $offset); - }
-
+ } + /** * Add a collection to a site. * @@ -567,43 +567,43 @@ return false; } -
- /**
- * Initialise site handling
- *
- * Called at the beginning of system running, to set the ID of the current site.
- * This is 0 by default, but plugins may alter this behaviour by attaching functions
- * to the sites init event and changing $CONFIG->site_id.
- *
- * @uses $CONFIG
- * @param string $event Event API required parameter
- * @param string $object_type Event API required parameter
- * @param null $object Event API required parameter
- * @return true
- */
- function sites_init($event, $object_type, $object) {
-
- global $CONFIG;
-
+ + /** + * Initialise site handling + * + * Called at the beginning of system running, to set the ID of the current site. + * This is 0 by default, but plugins may alter this behaviour by attaching functions + * to the sites init event and changing $CONFIG->site_id. + * + * @uses $CONFIG + * @param string $event Event API required parameter + * @param string $object_type Event API required parameter + * @param null $object Event API required parameter + * @return true + */ + function sites_init($event, $object_type, $object) { + + global $CONFIG; + if (is_installed() && is_db_installed()) { -
- $site = trigger_plugin_hook("siteid","system");
- if ($site === null || $site === false) {
- $CONFIG->site_id = (int) datalist_get('default_site');
- } else {
- $CONFIG->site_id = $site;
- }
- $CONFIG->site_guid = $CONFIG->site_id;
- $CONFIG->site = get_entity($CONFIG->site_guid);
-
- return true;
+ + $site = trigger_plugin_hook("siteid","system"); + if ($site === null || $site === false) { + $CONFIG->site_id = (int) datalist_get('default_site'); + } else { + $CONFIG->site_id = $site; + } + $CONFIG->site_guid = $CONFIG->site_id; + $CONFIG->site = get_entity($CONFIG->site_guid); + + return true; } - return true;
- }
-
- // Register event handlers
-
- register_elgg_event_handler('boot','system','sites_init',2);
-
+ return true; + } + + // Register event handlers + + register_elgg_event_handler('boot','system','sites_init',2); + ?>
\ No newline at end of file |