summaryrefslogtreecommitdiff
path: root/modules/gallery/models/log.php
diff options
context:
space:
mode:
authorAndy Staudacher <andy.st@gmail.com>2009-11-15 19:44:47 -0800
committerAndy Staudacher <andy.st@gmail.com>2009-11-15 19:44:47 -0800
commit0733dc37fda27a5ba35f9020edf3c66aa41a95a0 (patch)
tree6877946232f1b01b1c8709054c689f6658cef34f /modules/gallery/models/log.php
parent218493c50be9362d4abed6900a816308fee5d978 (diff)
parent9379308f91a476f790fb8d444536719535c584e4 (diff)
Merge commit 'upstream/master'
Conflicts: modules/gallery/tests/xss_data.txt
Diffstat (limited to 'modules/gallery/models/log.php')
-rw-r--r--modules/gallery/models/log.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/modules/gallery/models/log.php b/modules/gallery/models/log.php
index 6734afb8..c816a4a7 100644
--- a/modules/gallery/models/log.php
+++ b/modules/gallery/models/log.php
@@ -18,5 +18,21 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Log_Model extends ORM {
- protected $has_one = array("user");
+ /**
+ * @see ORM::__get()
+ */
+ public function __get($column) {
+ if ($column == "user") {
+ // This relationship depends on an outside module, which may not be present so handle
+ // failures gracefully.
+ try {
+ return identity::lookup_user($this->user_id);
+ } catch (Exception $e) {
+ Kohana::log("alert", "Unable to load user with id $this->user_id");
+ return null;
+ }
+ } else {
+ return parent::__get($column);
+ }
+ }
}