From adbe126d1058ee6f2aaba5bb409adecea9b99ef6 Mon Sep 17 00:00:00 2001 From: Domovoy Date: Sat, 11 Aug 2012 17:15:19 +0200 Subject: [PATCH] Item: new method is_writeable --- object/Item.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/object/Item.php b/object/Item.php index c89fd7ad73..1a88fe36bf 100644 --- a/object/Item.php +++ b/object/Item.php @@ -20,11 +20,13 @@ class Item extends BaseObject { private $page_writeable = false; private $profile_owner = 0; private $toplevel = false; + private $writeable = false; public function __construct($data) { $this->data = $data; $this->set_template('wall'); $this->toplevel = ($this->get_id() == $this->get_parent()); + $this->writeable = ($this->get_data_value('writeable') || $this->get_data_value('self')); } /** @@ -57,8 +59,7 @@ class Item extends BaseObject { $firstcollapsed = false; $total_children += count_descendants($item); - $item_writeable = (($item['writable'] || $item['self']) ? true : false); - $show_comment_box = ((($this->is_page_writeable()) && ($item_writeable)) ? true : false); + $show_comment_box = ((($this->is_page_writeable()) && ($this->is_writeable())) ? true : false); $lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])))) ? t('Private Message') @@ -440,5 +441,12 @@ class Item extends BaseObject { private function is_toplevel() { return $this->toplevel; } + + /** + * Check if this is writeable + */ + private function is_writeable() { + return $this->writeable; + } } ?> -- 2.39.5