aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/system_log.php
diff options
context:
space:
mode:
authoricewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-05-23 16:31:53 +0000
committericewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-05-23 16:31:53 +0000
commitd98c0d4c6c56d015958bdc88baa00d6ca6bcb70d (patch)
tree3aa101d7d1364ec717e22225313dd0663018a433 /engine/lib/system_log.php
parente231b7079e97f4c4a7d48670a63176f3b62158b9 (diff)
downloadelgg-d98c0d4c6c56d015958bdc88baa00d6ca6bcb70d.tar.gz
elgg-d98c0d4c6c56d015958bdc88baa00d6ca6bcb70d.tar.bz2
Marcus Povey <marcus@dushka.co.uk>
* Support for river entries git-svn-id: https://code.elgg.org/elgg/trunk@701 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/system_log.php')
-rw-r--r--engine/lib/system_log.php45
1 files changed, 43 insertions, 2 deletions
diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php
index e47475287..f7a44fb7d 100644
--- a/engine/lib/system_log.php
+++ b/engine/lib/system_log.php
@@ -27,9 +27,50 @@
public function getSystemLogID();
/**
- * Return the class name of the object. Added as a function because get_class causes errors for some reason.
+ * Return the class name of the object.
+ * Added as a function because get_class causes errors for some reason.
*/
public function getClassName();
+
+ /**
+ * For a given ID, return the object associated with it.
+ * This is used by the river functionality primarily.
+ * This is useful for checking access permissions etc on objects.
+ */
+ public function getObjectFromID($id);
+ }
+
+ /**
+ * Retrieve the system log based on a number of parameters.
+ *
+ * @param string $event The event you are searching on.
+ * @param string $class The class of object it effects.
+ * @param int $limit
+ * @param int $offset
+ */
+ function get_system_log($event = "", $class = "", $limit = 10, $offset = 0)
+ {
+ global $CONFIG;
+
+ $event = sanitise_string($event);
+ $class = sanitise_string($class);
+ $limit = (int)$limit;
+ $offset = (int)$offset;
+
+ $access = get_access_list();
+
+ $where = array();
+
+ if ($event != "")
+ $where[] = "event='$event'";
+ if ($class!=="")
+ $where[] = "object_class='$class'";
+
+ $query = "SELECT * from {$CONFIG->dbprefix}system_log where 1 ";
+ foreach ($where as $w)
+ $query .= " and $w";
+
+ return get_data($query);
}
/**
@@ -51,7 +92,7 @@
$time = time();
// Create log
- return insert_data("INSERT into {$CONFIG->dbprefix}system_log (object_id, object_class, event, time_created) VALUES ('$object_id','$object_class','$event','$time')");
+ return insert_data("INSERT into {$CONFIG->dbprefix}system_log (object_id, object_class, event, time_created) VALUES ('$object_id','$object_class','$event', '$time')");
}
}