aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/entities.php74
-rw-r--r--index.php16
-rw-r--r--views/default/welcome/logged_out.php3
3 files changed, 74 insertions, 19 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 4cbc4eccc..afc8eed3c 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -1312,9 +1312,6 @@
if ($subtype === false || $subtype === null || $subtype === 0)
return false;
-
- $type = sanitise_string($type);
- $subtype = get_subtype_id($type, $subtype);
if ($order_by == "") $order_by = "time_created desc";
$order_by = sanitise_string($order_by);
@@ -1325,11 +1322,37 @@
$site_guid = $CONFIG->site_guid;
$where = array();
-
- if ($type != "")
- $where[] = "type='$type'";
- if ($subtype!=="")
- $where[] = "subtype=$subtype";
+
+ if (is_array($type)) {
+
+ $tempwhere = "";
+ if (sizeof($type))
+ foreach($type as $typekey => $subtypearray) {
+ foreach($subtypearray as $subtypeval) {
+ $typekey = sanitise_string($typekey);
+ if (!empty($subtypeval)) {
+ $subtypeval = (int) get_subtype_id($typekey, $subtypeval);
+ } else {
+ $subtypeval = 0;
+ }
+ if (!empty($tempwhere)) $tempwhere .= " or ";
+ $tempwhere .= "(type = '{$typekey}' and subtype = {$subtypeval})";
+ }
+ }
+ if (!empty($tempwhere)) $where[] = "({$tempwhere})";
+
+ } else {
+
+ $type = sanitise_string($type);
+ $subtype = get_subtype_id($type, $subtype);
+
+ if ($type != "")
+ $where[] = "type='$type'";
+ if ($subtype!=="")
+ $where[] = "subtype=$subtype";
+
+ }
+
if ($owner_guid != "") {
if (!is_array($owner_guid)) {
$owner_array = array($owner_guid);
@@ -1370,7 +1393,6 @@
if (!$count) {
$query .= " order by $order_by";
if ($limit) $query .= " limit $offset, $limit"; // Add order and limit
-
$dt = get_data($query, "entity_row_to_elggstar");
return $dt;
} else {
@@ -1943,6 +1965,40 @@
set_input('guid',$page[0]);
@include($CONFIG->path . "entities/index.php");
}
+ }
+
+ /**
+ * Returns a viewable list of entities based on the registered types
+ *
+ * @see elgg_view_entity_list
+ *
+ * @param string $type The type of entity (eg "user", "object" etc)
+ * @param string $subtype The arbitrary subtype of the entity
+ * @param int $owner_guid The GUID of the owning user
+ * @param int $limit The number of entities to display per page (default: 10)
+ * @param true|false $fullview Whether or not to display the full view (default: true)
+ * @param true|false $viewtypetoggle Whether or not to allow gallery view
+ * @return string A viewable list of entities
+ */
+ function list_registered_entities($owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false) {
+
+ $typearray = array();
+
+ if ($object_types = get_registered_entity_types()) {
+ foreach($object_types as $object_type => $subtype_array) {
+ if (is_array($subtype_array) && sizeof($subtype_array))
+ foreach($subtype_array as $object_subtype) {
+ $typearray[$object_type][] = $object_subtype;
+ }
+ }
+ }
+
+ $offset = (int) get_input('offset');
+ $count = get_entities($typearray, '', $owner_guid, "", $limit, $offset, true);
+ $entities = get_entities($typearray, '', $owner_guid, "", $limit, $offset);
+
+ return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle);
+
}
/**
diff --git a/index.php b/index.php
index 79b59252f..7c5f21a83 100644
--- a/index.php
+++ b/index.php
@@ -22,13 +22,15 @@
/**
* Check to see if user is logged in, if not display login form
**/
- if ($_SESSION['id'] != -1){
- //Load the sample welcome page
- echo page_draw(null, elgg_view("welcome"));
- } else {
- //Load the front page
- echo page_draw(null, elgg_view("login"));
- }
+
+ if (isloggedin()) forward('pg/dashboard');
+
+ //Load the front page
+ $content = list_registered_entities();
+ global $autofeed;
+ $autofeed = false;
+ $content = elgg_view_layout('two_column_left_sidebar', '', $content, elgg_view("account/forms/login"));
+ echo page_draw(null, $content);
}
diff --git a/views/default/welcome/logged_out.php b/views/default/welcome/logged_out.php
index b218242a9..3015a9d2e 100644
--- a/views/default/welcome/logged_out.php
+++ b/views/default/welcome/logged_out.php
@@ -19,9 +19,6 @@
$area1 = "<p>" . elgg_echo("welcome_message") . "</p>";
$area1 .= elgg_view("account/forms/login");
- //send area one to the appropriate canvas layout
- $body = elgg_view_layout("one_column", $area1);
-
//draw to screen
echo $body;
?> \ No newline at end of file