From a0d19ffb7241a1c7a4b85e6d0fd58fbb2f718468 Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Sun, 6 Jan 2013 14:42:51 -0700 Subject: implement Smarty3 --- include/ItemObject.php | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 45ea6860a..8ae13e0d8 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -204,13 +204,28 @@ class Item extends BaseObject { $body = prepare_body($item,true); + if($a->theme['template_engine'] === 'internal') { + $body_e = template_escape($body); + $name_e = template_escape($profile_name); + $title_e = template_escape($item['title']); + $location_e = template_escape($location); + $owner_name_e = template_escape($this->get_owner_name()); + } + else { + $body_e = $body; + $name_e = $profile_name; + $title_e = $item['title']; + $location_e = $location; + $owner_name_e = $this->get_owner_name(); + } + $tmp_item = array( 'template' => $this->get_template(), 'type' => implode("",array_slice(explode("/",$item['verb']),-1)), 'tags' => $tags, - 'body' => $body, - 'text' => strip_tags(template_escape($body)), + 'body' => $body_e, + 'text' => strip_tags($body_e), 'id' => $this->get_id(), 'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])), 'olinktitle' => sprintf( t('View %s\'s profile @ %s'), $this->get_owner_name(), ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])), @@ -219,19 +234,19 @@ class Item extends BaseObject { 'vwall' => t('via Wall-To-Wall:'), 'profile_url' => $profile_link, 'item_photo_menu' => item_photo_menu($item), - 'name' => template_escape($profile_name), + 'name' => $name_e, 'thumb' => $profile_avatar, 'osparkle' => $osparkle, 'sparkle' => $sparkle, - 'title' => template_escape($item['title']), + 'title' => $title_e, 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), 'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])), 'lock' => $lock, - 'location' => template_escape($location), + 'location' => $location_e, 'indent' => $indent, 'owner_url' => $this->get_owner_url(), 'owner_photo' => $this->get_owner_photo(), - 'owner_name' => template_escape($this->get_owner_name()), + 'owner_name' => $owner_name_e, // Item toolbar buttons 'like' => $like, -- cgit v1.2.3 From a9aa74a8074fd2eec58dd5927313fcef4fd5d930 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 6 Jan 2013 16:36:02 -0800 Subject: make dislikes work - though they need a display tweak --- include/ItemObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 45ea6860a..8091f003b 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -154,7 +154,7 @@ class Item extends BaseObject { } $showlike = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : ''); - $showdislike = ((x($dlike,$item['uri']) && feature_enabled($conv->get_profile_owner(),'dislike')) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : ''); + $showdislike = ((x($dlike,$item['uri']) && feature_enabled($conv->get_profile_owner(),'dislike')) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : ''); /* * We should avoid doing this all the time, but it depends on the conversation mode -- cgit v1.2.3 From b4a95460e65dbadaf074a414a9e3d9367e109f19 Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Sun, 6 Jan 2013 19:34:54 -0700 Subject: fix show-stopping bugs --- include/ItemObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 8ae13e0d8..cb79c180c 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -204,7 +204,7 @@ class Item extends BaseObject { $body = prepare_body($item,true); - if($a->theme['template_engine'] === 'internal') { + if($a->get_template_engine() === 'internal') { $body_e = template_escape($body); $name_e = template_escape($profile_name); $title_e = template_escape($item['title']); -- cgit v1.2.3 From b8c92a0a4285dae8d61750dc1b39c61bba6a3dda Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 22 Jan 2013 23:08:46 -0800 Subject: fix some displayed links that were wonky --- include/ItemObject.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 6f9eaa18e..b6f1e53a4 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -49,6 +49,7 @@ class Item extends BaseObject { // fixme $this->writable = ($this->get_data_value('writable') || $this->get_data_value('self')); // FIXME - base this on observer permissions + $this->writable = ((local_user() && $channel['channel_hash'] === $item['owner_xchan']) ? true : false); @@ -227,8 +228,8 @@ class Item extends BaseObject { 'body' => $body_e, 'text' => strip_tags($body_e), 'id' => $this->get_id(), - 'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])), - 'olinktitle' => sprintf( t('View %s\'s profile @ %s'), $this->get_owner_name(), ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])), + 'linktitle' => sprintf( t('View %s\'s profile - %s'), $profile_name, $item['author']['xchan_addr']), + 'olinktitle' => sprintf( t('View %s\'s profile - %s'), $this->get_owner_name(), $item['owner']['xchan_addr']), 'to' => t('to'), 'wall' => t('Wall-to-Wall'), 'vwall' => t('via Wall-To-Wall:'), -- cgit v1.2.3 From 99c40ce388fe7666e38372fd1d0006cff7f7fcc8 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 24 Jan 2013 20:05:23 -0800 Subject: check comment permissions against observer, unbold email subject links for read messages --- include/ItemObject.php | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index b6f1e53a4..37b9b4a83 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -512,29 +512,26 @@ class Item extends BaseObject { * _ false on failure */ private function get_comment_box($indent) { + if(!$this->is_toplevel() && !get_config('system','thread_allow')) { return ''; } $comment_box = ''; $conv = $this->get_conversation(); - $template = get_markup_template($this->get_comment_box_template()); - $ww = ''; - if( ($conv->get_mode() === 'network') && $this->is_wall_to_wall() ) - $ww = 'ww'; + + $observer = get_app()->get_observer(); + if(! perm_is_allowed($conv->get_profile_owner(),$observer['xchan_hash'],'post_comments')) + return ''; if($conv->is_writable() && $this->is_writable()) { + $template = get_markup_template($this->get_comment_box_template()); + $a = $this->get_app(); - $qc = $qcomment = null; - - /* - * Hmmm, code depending on the presence of a particular plugin? - * This should be better if done by a hook - */ - if(in_array('qcomment',$a->plugins)) { - $qc = ((local_user()) ? get_pconfig(local_user(),'qcomment','words') : null); - $qcomment = (($qc) ? explode("\n",$qc) : null); - } + + $qc = ((local_user()) ? get_pconfig(local_user(),'qcomment','words') : null); + $qcomment = (($qc) ? explode("\n",$qc) : null); + $comment_box = replace_macros($template,array( '$return_path' => '', '$threaded' => $this->is_threaded(), @@ -559,8 +556,7 @@ class Item extends BaseObject { '$edvideo' => t('Video'), '$preview' => ((feature_enabled($conv->get_profile_owner(),'preview')) ? t('Preview') : ''), '$indent' => $indent, - '$sourceapp' => t($a->sourcename), - '$ww' => (($conv->get_mode() === 'network') ? $ww : '') + '$sourceapp' => get_app()->sourcename )); } -- cgit v1.2.3 From 50433d857ae5b04ae5f3f381889d8450fe9699f5 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 24 Jan 2013 20:43:33 -0800 Subject: quick-n-dirty wall-to-wall detection, wasn't working at all - this may be overboard or it may still not work at all. --- include/ItemObject.php | 58 +++++++------------------------------------------- 1 file changed, 8 insertions(+), 50 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 37b9b4a83..426517b06 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -571,59 +571,17 @@ class Item extends BaseObject { * Check if we are a wall to wall item and set the relevant properties */ protected function check_wall_to_wall() { - $a = $this->get_app(); $conv = $this->get_conversation(); $this->wall_to_wall = false; + $this->owner_url = ''; + $this->owner_photo = ''; + $this->owner_name = ''; - if($this->is_toplevel()) { - if( (! $this->get_data_value('self')) && ($conv->get_mode() !== 'channel')) { - if($this->get_data_value('wall')) { - - // On the network page, I am the owner. On the display page it will be the profile owner. - // This will have been stored in $a->page_contact by our calling page. - // Put this person as the wall owner of the wall-to-wall notice. - - $this->owner_url = zid($a->page_contact['url']); - $this->owner_photo = $a->page_contact['thumb']; - $this->owner_name = $a->page_contact['name']; - $this->wall_to_wall = true; - } - else if($this->get_data_value('owner-link')) { - - $owner_linkmatch = (($this->get_data_value('owner-link')) && link_compare($this->get_data_value('owner-link'),$this->get_data_value('author-link'))); - $alias_linkmatch = (($this->get_data_value('alias')) && link_compare($this->get_data_value('alias'),$this->get_data_value('author-link'))); - $owner_namematch = (($this->get_data_value('owner-name')) && $this->get_data_value('owner-name') == $this->get_data_value('author-name')); - if((! $owner_linkmatch) && (! $alias_linkmatch) && (! $owner_namematch)) { - - // The author url doesn't match the owner (typically the contact) - // and also doesn't match the contact alias. - // The name match is a hack to catch several weird cases where URLs are - // all over the park. It can be tricked, but this prevents you from - // seeing "Bob Smith to Bob Smith via Wall-to-wall" and you know darn - // well that it's the same Bob Smith. - - // But it could be somebody else with the same name. It just isn't highly likely. - - - $this->owner_photo = $this->get_data_value('owner-avatar'); - $this->owner_name = $this->get_data_value('owner-name'); - $this->wall_to_wall = true; - // If it is our contact, use a friendly redirect link - if((link_compare($this->get_data_value('owner-link'),$this->get_data_value('url'))) - && ($this->get_data_value('network') === NETWORK_DFRN)) { - $this->owner_url = $this->get_redirect_url(); - } - else - $this->owner_url = zid($this->get_data_value('owner-link')); - } - } - } - } - - if(!$this->wall_to_wall) { - $this->owner_url = ''; - $this->owner_photo = ''; - $this->owner_name = ''; + if($this->is_toplevel() && ($this->get_data_value('author_xchan') != $this->get_data_value('owner_xchan'))) { + $this->owner_url = $this->data['owner']['xchan_url']; + $this->owner_photo = $this->data['owner']['xchan_photo_m']; + $this->owner_name = $this->data['owner']['xchan_name']; + $this->wall_to_wall = true; } } -- cgit v1.2.3 From fc8225be8d46cae3f7e647fd800c2d77661d25ce Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 24 Jan 2013 21:17:59 -0800 Subject: here's another reason the social graph isn't updating --- include/ItemObject.php | 55 ++++++++++++++++---------------------------------- 1 file changed, 17 insertions(+), 38 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 426517b06..89015749b 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -131,42 +131,33 @@ class Item extends BaseObject { $filer = (($conv->get_profile_owner() == local_user()) ? t("save to folder") : false); - $diff_author = ((link_compare($item['url'],$item['author-link'])) ? false : true); - $profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']); - - $profile_avatar = $item['author']['xchan_photo_m']; - $profile_link = $a->get_baseurl() . '/chanview/?f=&url=' . $item['author']['xchan_url']; - $profile_name = $item['author']['xchan_name']; - -// if($item['author-link'] && (! $item['author-name'])) -// $profile_name = $item['author-link']; - - $profile_avatar = $item['author']['xchan_photo_m']; + $profile_link = chanlink_url($item['author']['xchan_url']); + $profile_name = $item['author']['xchan_name']; $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => ''); call_hooks('render_location',$locate); $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_google($locate)); - $tags=array(); +// are we still using $item['tag']? Need to check... + $tags = array(); foreach(explode(',',$item['tag']) as $tag){ $tag = trim($tag); if ($tag!="") $tags[] = bbcode($tag); } $showlike = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : ''); - $showdislike = ((x($dlike,$item['uri']) && feature_enabled($conv->get_profile_owner(),'dislike')) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : ''); + $showdislike = ((x($dlike,$item['uri']) && feature_enabled($conv->get_profile_owner(),'dislike')) + ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : ''); /* * We should avoid doing this all the time, but it depends on the conversation mode * And the conv mode may change when we change the conv, or it changes its mode * Maybe we should establish a way to be notified about conversation changes */ + $this->check_wall_to_wall(); - if($this->is_wall_to_wall() && ($this->get_owner_url() == $this->get_redirect_url())) - $osparkle = ' sparkle'; - if($this->is_toplevel()) { if($conv->get_profile_owner() == local_user()) { @@ -205,28 +196,13 @@ class Item extends BaseObject { $body = prepare_body($item,true); - if($a->get_template_engine() === 'internal') { - $body_e = template_escape($body); - $name_e = template_escape($profile_name); - $title_e = template_escape($item['title']); - $location_e = template_escape($location); - $owner_name_e = template_escape($this->get_owner_name()); - } - else { - $body_e = $body; - $name_e = $profile_name; - $title_e = $item['title']; - $location_e = $location; - $owner_name_e = $this->get_owner_name(); - } - $tmp_item = array( 'template' => $this->get_template(), 'type' => implode("",array_slice(explode("/",$item['verb']),-1)), 'tags' => $tags, - 'body' => $body_e, - 'text' => strip_tags($body_e), + 'body' => $body, + 'text' => strip_tags($body), 'id' => $this->get_id(), 'linktitle' => sprintf( t('View %s\'s profile - %s'), $profile_name, $item['author']['xchan_addr']), 'olinktitle' => sprintf( t('View %s\'s profile - %s'), $this->get_owner_name(), $item['owner']['xchan_addr']), @@ -235,19 +211,19 @@ class Item extends BaseObject { 'vwall' => t('via Wall-To-Wall:'), 'profile_url' => $profile_link, 'item_photo_menu' => item_photo_menu($item), - 'name' => $name_e, + 'name' => $profile_name, 'thumb' => $profile_avatar, 'osparkle' => $osparkle, 'sparkle' => $sparkle, - 'title' => $title_e, + 'title' => $item['title'], 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), 'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])), 'lock' => $lock, - 'location' => $location_e, + 'location' => $location, 'indent' => $indent, 'owner_url' => $this->get_owner_url(), 'owner_photo' => $this->get_owner_photo(), - 'owner_name' => $owner_name_e, + 'owner_name' => $this->get_owner_name, // Item toolbar buttons 'like' => $like, @@ -576,9 +552,12 @@ class Item extends BaseObject { $this->owner_url = ''; $this->owner_photo = ''; $this->owner_name = ''; + + if($conv->get_mode() !== 'channel') + return; if($this->is_toplevel() && ($this->get_data_value('author_xchan') != $this->get_data_value('owner_xchan'))) { - $this->owner_url = $this->data['owner']['xchan_url']; + $this->owner_url = chanlink_url($this->data['owner']['xchan_url']); $this->owner_photo = $this->data['owner']['xchan_photo_m']; $this->owner_name = $this->data['owner']['xchan_name']; $this->wall_to_wall = true; -- cgit v1.2.3 From 769456305bf8ce5e2152da5e9b80fe3894cfcddc Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 24 Jan 2013 23:10:37 -0800 Subject: inverted logic on wall-wall check --- include/ItemObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 89015749b..9666cda23 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -553,7 +553,7 @@ class Item extends BaseObject { $this->owner_photo = ''; $this->owner_name = ''; - if($conv->get_mode() !== 'channel') + if($conv->get_mode() === 'channel') return; if($this->is_toplevel() && ($this->get_data_value('author_xchan') != $this->get_data_value('owner_xchan'))) { -- cgit v1.2.3 From 299507de08f96160ed3e308006aeda31879e9c9b Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 24 Jan 2013 23:49:44 -0800 Subject: fix wall-wall ownername --- include/ItemObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 9666cda23..047f8ff0b 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -223,7 +223,7 @@ class Item extends BaseObject { 'indent' => $indent, 'owner_url' => $this->get_owner_url(), 'owner_photo' => $this->get_owner_photo(), - 'owner_name' => $this->get_owner_name, + 'owner_name' => $this->get_owner_name(), // Item toolbar buttons 'like' => $like, -- cgit v1.2.3 From fb9ccf5d1b39fc060c5752d28f89daf2378610d3 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 29 Jan 2013 18:08:28 -0800 Subject: fix edit permissions --- include/ItemObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 047f8ff0b..c4f1093c6 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -105,7 +105,7 @@ class Item extends BaseObject { : false); $shareable = ((($conv->get_profile_owner() == local_user()) && ($item['private'] != 1)) ? true : false); - if(local_user() && link_compare($a->contact['url'],$item['author-link'])) + if(local_user() && $observer['xchan_hash'] === $item['author_xchan']) $edpost = array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit")); else $edpost = false; -- cgit v1.2.3 From b41106f2fbebfd0bbc2bfc70efd3421073469f44 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 2 Feb 2013 16:34:00 -0800 Subject: allow non-linkable locations, self-linked locations and get rid of google default location link --- include/ItemObject.php | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index c4f1093c6..d3d2b7283 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -135,16 +135,8 @@ class Item extends BaseObject { $profile_link = chanlink_url($item['author']['xchan_url']); $profile_name = $item['author']['xchan_name']; - $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => ''); - call_hooks('render_location',$locate); - $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_google($locate)); - -// are we still using $item['tag']? Need to check... - $tags = array(); - foreach(explode(',',$item['tag']) as $tag){ - $tag = trim($tag); - if ($tag!="") $tags[] = bbcode($tag); - } + $location = format_location($item); + $showlike = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : ''); $showdislike = ((x($dlike,$item['uri']) && feature_enabled($conv->get_profile_owner(),'dislike')) @@ -200,7 +192,7 @@ class Item extends BaseObject { 'template' => $this->get_template(), 'type' => implode("",array_slice(explode("/",$item['verb']),-1)), - 'tags' => $tags, + 'tags' => array(), 'body' => $body, 'text' => strip_tags($body), 'id' => $this->get_id(), -- cgit v1.2.3 From 6022a9e9cdf12d60a138f06300285f231d2c2976 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 9 Feb 2013 04:22:11 -0800 Subject: more profiling - cache the qcomment list so we don't have to look it up for every rendered item --- include/ItemObject.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index d3d2b7283..6ba95d9b2 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -81,6 +81,9 @@ class Item extends BaseObject { */ public function get_template_data($alike, $dlike, $thread_level=1) { + + $t1 = dba_timer(); + $result = array(); $a = $this->get_app(); @@ -184,10 +187,16 @@ class Item extends BaseObject { if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0) $indent .= ' shiny'; + $t2 = dba_timer(); + localize_item($item); + $t3 = dba_timer(); + $body = prepare_body($item,true); + $t4 = dba_timer(); + $tmp_item = array( 'template' => $this->get_template(), @@ -238,6 +247,8 @@ class Item extends BaseObject { 'thread_level' => $thread_level ); + $t5 = dba_timer(); + $arr = array('item' => $item, 'output' => $tmp_item); call_hooks('display_item', $arr); @@ -275,6 +286,14 @@ class Item extends BaseObject { $result['flatten'] = true; $result['threaded'] = false; } + $t6 = dba_timer(); + +// profiler($t1,$t2,'t2'); +// profiler($t2,$t3,'t3'); +// profiler($t3,$t4,'t4'); +// profiler($t4,$t5,'t5'); +// profiler($t5,$t6,'t6'); +// profiler($t1,$t6,'item total'); return $result; } @@ -497,7 +516,7 @@ class Item extends BaseObject { $a = $this->get_app(); - $qc = ((local_user()) ? get_pconfig(local_user(),'qcomment','words') : null); + $qc = ((local_user()) ? get_pconfig(local_user(),'system','qcomment') : null); $qcomment = (($qc) ? explode("\n",$qc) : null); $comment_box = replace_macros($template,array( -- cgit v1.2.3 From 90c1ecca244875fa915a4e5dfba3278e7c28e8d6 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 10 Feb 2013 17:03:33 -0800 Subject: taming the wild mod_display --- include/ItemObject.php | 62 ++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 30 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 6ba95d9b2..afa34abb1 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -15,6 +15,7 @@ class Item extends BaseObject { private $comment_box_template = 'comment_item.tpl'; private $toplevel = false; private $writable = false; + private $commentable = false; private $children = array(); private $parent = null; private $conversation = null; @@ -37,35 +38,31 @@ class Item extends BaseObject { $this->toplevel = ($this->get_id() == $this->get_data_value('parent')); -// if(is_array($_SESSION['remote'])) { -// foreach($_SESSION['remote'] as $visitor) { -// if($visitor['cid'] == $this->get_data_value('contact-id')) { -// $this->visiting = true; -// break; -// } -// } -// } - -// fixme - $this->writable = ($this->get_data_value('writable') || $this->get_data_value('self')); -// FIXME - base this on observer permissions - - $this->writable = ((local_user() && $channel['channel_hash'] === $item['owner_xchan']) ? true : false); + $this->writable = (((local_user()) && ($this->channel['channel_hash'] === $this->data['owner_xchan'])) ? true : false); + $this->commentable = $this->writable; + if(($this->observer) && (! $this->writable)) { + $this->commentable = perm_is_allowed($this->data['uid'],$this->observer['xchan_hash'],'post_comments'); + } - if(get_config('system','thread_allow') && $a->theme_thread_allow && !$this->is_toplevel()) - $this->threaded = true; +// logger('writable: ' . $this->writable); +// logger('commentable: ' . $this->commentable . ' uid=' . $this->data['uid'] . ' observer=' . $this->observer['xchan_hash']); +// if(get_config('system','thread_allow') && $a->theme_thread_allow && !$this->is_toplevel()) +// $this->threaded = true; // Prepare the children if(count($data['children'])) { foreach($data['children'] as $item) { + /* - * Only add will be displayed + * Only add thos that will be displayed */ + if(! visible_activity($item)) { continue; } + $child = new Item($item); $this->add_child($child); } @@ -102,11 +99,11 @@ class Item extends BaseObject { $conv = $this->get_conversation(); - $lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) + $lock = ((($item['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') : false); - $shareable = ((($conv->get_profile_owner() == local_user()) && ($item['private'] != 1)) ? true : false); + $shareable = ((($conv->get_profile_owner() == local_user()) && ($item['item_private'] != 1)) ? true : false); if(local_user() && $observer['xchan_hash'] === $item['author_xchan']) $edpost = array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit")); @@ -177,7 +174,7 @@ class Item extends BaseObject { $indent = 'comment'; } - if($conv->is_writable()) { + if($this->is_writable()) { $like = array( t("I like this \x28toggle\x29"), t("like")); $dislike = array( t("I don't like this \x28toggle\x29"), t("dislike")); if ($shareable) @@ -458,16 +455,22 @@ class Item extends BaseObject { * Check if this is writable */ private function is_writable() { - $conv = $this->get_conversation(); - return true; + return $this->writable; + +// $conv = $this->get_conversation(); + +// return true; - if($conv) { +// if($conv) { // This will allow us to comment on wall-to-wall items owned by our friends // and community forums even if somebody else wrote the post. - return ($this->writable || ($this->is_visiting() && $conv->get_mode() == 'channel')); - } - return $this->writable; +// return ($this->writable || ($this->is_visiting() && $conv->get_mode() == 'channel')); +// } + } + + private function is_commentable() { + return $this->commentable; } /** @@ -507,11 +510,10 @@ class Item extends BaseObject { $comment_box = ''; $conv = $this->get_conversation(); - $observer = get_app()->get_observer(); - if(! perm_is_allowed($conv->get_profile_owner(),$observer['xchan_hash'],'post_comments')) - return ''; + if(! $this->is_commentable()) + return; - if($conv->is_writable() && $this->is_writable()) { + if($conv->is_writable() || $this->is_writable()) { $template = get_markup_template($this->get_comment_box_template()); $a = $this->get_app(); -- cgit v1.2.3 From e724e2b0d2a81bdecbb8fb94c6d5c05e89c21803 Mon Sep 17 00:00:00 2001 From: zottel Date: Thu, 21 Feb 2013 11:27:41 +0100 Subject: bring back like/dislike and share buttons --- include/ItemObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index afa34abb1..a44784b42 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -174,7 +174,7 @@ class Item extends BaseObject { $indent = 'comment'; } - if($this->is_writable()) { + if($this->is_commentable()) { $like = array( t("I like this \x28toggle\x29"), t("like")); $dislike = array( t("I don't like this \x28toggle\x29"), t("dislike")); if ($shareable) -- cgit v1.2.3 From ea3940c4b0b8232e2de0771811b9f90ade9ee45f Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 25 Feb 2013 17:09:40 -0800 Subject: start formatting for Doxygen --- include/ItemObject.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index a44784b42..94afaaac4 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -1,4 +1,5 @@ - Date: Mon, 4 Mar 2013 20:58:39 -0800 Subject: fix timeago (again), webfinger new spec implemented, some theme work --- include/ItemObject.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 94afaaac4..66af01a81 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -215,6 +215,7 @@ class Item extends BaseObject { 'osparkle' => $osparkle, 'sparkle' => $sparkle, 'title' => $item['title'], + 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'), 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), 'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])), 'lock' => $lock, -- cgit v1.2.3 From ddf5bf8968a12501939cd37898d303967b748600 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 21 Mar 2013 18:25:41 -0700 Subject: rename 'uri' (and parent_uri) to 'mid' (and parent_mid) since these no longer remotely resemble uri's and are actually message_id's. This change is potentially destabilising because it touches a lot of code and structure. But it has to get done and there's no better time than the present. --- include/ItemObject.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 66af01a81..b3c65008d 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -139,9 +139,9 @@ class Item extends BaseObject { $location = format_location($item); - $showlike = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : ''); - $showdislike = ((x($dlike,$item['uri']) && feature_enabled($conv->get_profile_owner(),'dislike')) - ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : ''); + $showlike = ((x($alike,$item['mid'])) ? format_like($alike[$item['mid']],$alike[$item['mid'] . '-l'],'like',$item['mid']) : ''); + $showdislike = ((x($dlike,$item['mid']) && feature_enabled($conv->get_profile_owner(),'dislike')) + ? format_like($dlike[$item['mid']],$dlike[$item['mid'] . '-l'],'dislike',$item['mid']) : ''); /* * We should avoid doing this all the time, but it depends on the conversation mode -- cgit v1.2.3 From c64c79eb119726e359bb4b47d1e30340d96f983d Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 21 May 2013 20:52:18 -0700 Subject: fix app display --- include/ItemObject.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index b3c65008d..ccd192ff5 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -215,9 +215,11 @@ class Item extends BaseObject { 'osparkle' => $osparkle, 'sparkle' => $sparkle, 'title' => $item['title'], + 'ago' => relative_date($item['created']), + 'app' => $item['app'], + 'str_app' => sprintf( t(' from %s'), $item['app']), 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'), 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), - 'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])), 'lock' => $lock, 'location' => $location, 'indent' => $indent, -- cgit v1.2.3 From 28cd8594a7dcaf7d21b8b92c44ace34dc8aa6dd4 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 16 Jun 2013 20:44:29 -0700 Subject: implement 'can_comment_on_post()' which doesn't require a separate DB lookup per item. --- include/ItemObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index ccd192ff5..351f446d4 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -44,7 +44,7 @@ class Item extends BaseObject { $this->commentable = $this->writable; if(($this->observer) && (! $this->writable)) { - $this->commentable = perm_is_allowed($this->data['uid'],$this->observer['xchan_hash'],'post_comments'); + $this->commentable = can_comment_on_post($this->observer['xchan_hash'],$data); } // logger('writable: ' . $this->writable); -- cgit v1.2.3 From 82539ba2bc93a6a84ce01492d37a725291ba32d9 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 16 Jun 2013 22:56:56 -0700 Subject: override comment policy until it's working --- include/ItemObject.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 351f446d4..e5185bef6 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -45,6 +45,10 @@ class Item extends BaseObject { if(($this->observer) && (! $this->writable)) { $this->commentable = can_comment_on_post($this->observer['xchan_hash'],$data); + if(! $this->commentable) { + logger('commentable: ' . $data['comment_policy']); + $this->commentable = true; + } } // logger('writable: ' . $this->writable); -- cgit v1.2.3 From 40c8e89d8476696a2e4a57a27970f6067b803e22 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 18 Jun 2013 18:48:41 -0700 Subject: undo comment policy override - there are a handful of stored posts from the 17th-June with a broken policy (which won't have a comment box) but it seems to be working for both recent and older posts. --- include/ItemObject.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index e5185bef6..1205ae13e 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -45,10 +45,10 @@ class Item extends BaseObject { if(($this->observer) && (! $this->writable)) { $this->commentable = can_comment_on_post($this->observer['xchan_hash'],$data); - if(! $this->commentable) { - logger('commentable: ' . $data['comment_policy']); - $this->commentable = true; - } +// if(! $this->commentable) { +// logger('commentable: ' . $data['comment_policy']); +// $this->commentable = true; +// } } // logger('writable: ' . $this->writable); -- cgit v1.2.3 From 28e0665caddb84598ab2fc74abcd70267d3be7f1 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 29 Jun 2013 02:04:44 -0700 Subject: doc update, plus possible fix to "complex delivery chains" issue. Basically when the top-level post creator replies to a thread he sent to a forum via tags, it isn't getting redelivered to the forum members. --- include/ItemObject.php | 9 --------- 1 file changed, 9 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 1205ae13e..fc4db3ecf 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -45,17 +45,8 @@ class Item extends BaseObject { if(($this->observer) && (! $this->writable)) { $this->commentable = can_comment_on_post($this->observer['xchan_hash'],$data); -// if(! $this->commentable) { -// logger('commentable: ' . $data['comment_policy']); -// $this->commentable = true; -// } } -// logger('writable: ' . $this->writable); -// logger('commentable: ' . $this->commentable . ' uid=' . $this->data['uid'] . ' observer=' . $this->observer['xchan_hash']); -// if(get_config('system','thread_allow') && $a->theme_thread_allow && !$this->is_toplevel()) -// $this->threaded = true; - // Prepare the children if(count($data['children'])) { foreach($data['children'] as $item) { -- cgit v1.2.3 From 822a4a028718b81119ab51e47145b2ddf87b775c Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 30 Jun 2013 23:04:27 -0700 Subject: fix some community tagging bugs --- include/ItemObject.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index fc4db3ecf..e057936ae 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -147,6 +147,7 @@ class Item extends BaseObject { $this->check_wall_to_wall(); if($this->is_toplevel()) { + // FIXME check this permission if($conv->get_profile_owner() == local_user()) { // FIXME we don't need all this stuff, some can be done in the template @@ -161,15 +162,19 @@ class Item extends BaseObject { 'starred' => t('starred'), ); - $tagger = array( - 'tagit' => t("add tag"), - 'classtagger' => "", - ); } } else { $indent = 'comment'; } + // FIXME - check this permission + if($conv->get_profile_owner() == local_user()) { + $tagger = array( + 'tagit' => t("add tag"), + 'classtagger' => "", + ); + } + if($this->is_commentable()) { $like = array( t("I like this \x28toggle\x29"), t("like")); $dislike = array( t("I don't like this \x28toggle\x29"), t("dislike")); -- cgit v1.2.3 From 6e012839c9807ce8c3c97bafdca7a36cf5fc58a9 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 8 Jul 2013 22:01:57 -0700 Subject: more work on bug #59 - hope this doesn't hork everything. Also some tweaking of the theme for the new radius control, which produced some surprising results when expert mode was toggled. --- include/ItemObject.php | 116 +++++++++++++++++-------------------------------- 1 file changed, 40 insertions(+), 76 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index e057936ae..a56f66a01 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -11,12 +11,10 @@ require_once('boot.php'); * An item */ class Item extends BaseObject { - private $data = array(); + public $data = array(); private $template = 'conv_item.tpl'; private $comment_box_template = 'comment_item.tpl'; private $toplevel = false; - private $writable = false; - private $commentable = false; private $children = array(); private $parent = null; private $conversation = null; @@ -34,19 +32,9 @@ class Item extends BaseObject { $a = $this->get_app(); $this->data = $data; - $this->channel = $a->get_channel(); - $this->observer = $a->get_observer(); - $this->toplevel = ($this->get_id() == $this->get_data_value('parent')); - $this->writable = (((local_user()) && ($this->channel['channel_hash'] === $this->data['owner_xchan'])) ? true : false); - $this->commentable = $this->writable; - - if(($this->observer) && (! $this->writable)) { - $this->commentable = can_comment_on_post($this->observer['xchan_hash'],$data); - } - // Prepare the children if(count($data['children'])) { foreach($data['children'] as $item) { @@ -106,10 +94,9 @@ class Item extends BaseObject { else $edpost = false; -// FIXME - this is wrong. -// if(($this->get_data_value('uid') == local_user()) || $this->is_visiting()) - - if($this->get_data_value('uid') == local_user()) + if($this->observer['xchan_hash'] == $this->get_data_value('author_xchan') + || $this->observer['xchan_hash'] == $this->get_data_value('owner_xchan') + || $this->get_data_value('uid') == local_user()) $dropping = true; if($dropping) { @@ -175,7 +162,7 @@ class Item extends BaseObject { ); } - if($this->is_commentable()) { + if($conv->is_commentable()) { $like = array( t("I like this \x28toggle\x29"), t("like")); $dislike = array( t("I don't like this \x28toggle\x29"), t("dislike")); if ($shareable) @@ -455,28 +442,6 @@ class Item extends BaseObject { return $this->toplevel; } - /** - * Check if this is writable - */ - private function is_writable() { - - return $this->writable; - -// $conv = $this->get_conversation(); - -// return true; - -// if($conv) { - // This will allow us to comment on wall-to-wall items owned by our friends - // and community forums even if somebody else wrote the post. -// return ($this->writable || ($this->is_visiting() && $conv->get_mode() == 'channel')); -// } - } - - private function is_commentable() { - return $this->commentable; - } - /** * Count the total of our descendants */ @@ -514,44 +479,43 @@ class Item extends BaseObject { $comment_box = ''; $conv = $this->get_conversation(); - if(! $this->is_commentable()) + if(! $conv->is_commentable()) return; - if($conv->is_writable() || $this->is_writable()) { - $template = get_markup_template($this->get_comment_box_template()); - - $a = $this->get_app(); - - $qc = ((local_user()) ? get_pconfig(local_user(),'system','qcomment') : null); - $qcomment = (($qc) ? explode("\n",$qc) : null); - - $comment_box = replace_macros($template,array( - '$return_path' => '', - '$threaded' => $this->is_threaded(), - '$jsreload' => (($conv->get_mode() === 'display') ? $_SESSION['return_url'] : ''), - '$type' => (($conv->get_mode() === 'channel') ? 'wall-comment' : 'net-comment'), - '$id' => $this->get_id(), - '$parent' => $this->get_id(), - '$qcomment' => $qcomment, - '$profile_uid' => $conv->get_profile_owner(), - '$mylink' => $this->observer['xchan_url'], - '$mytitle' => t('This is you'), - '$myphoto' => $this->observer['xchan_photo_s'], - '$comment' => t('Comment'), - '$submit' => t('Submit'), - '$edbold' => t('Bold'), - '$editalic' => t('Italic'), - '$eduline' => t('Underline'), - '$edquote' => t('Quote'), - '$edcode' => t('Code'), - '$edimg' => t('Image'), - '$edurl' => t('Link'), - '$edvideo' => t('Video'), - '$preview' => ((feature_enabled($conv->get_profile_owner(),'preview')) ? t('Preview') : ''), - '$indent' => $indent, - '$sourceapp' => get_app()->sourcename - )); - } + $template = get_markup_template($this->get_comment_box_template()); + + $a = $this->get_app(); + $observer = $conv->get_observer(); + + $qc = ((local_user()) ? get_pconfig(local_user(),'system','qcomment') : null); + $qcomment = (($qc) ? explode("\n",$qc) : null); + + $comment_box = replace_macros($template,array( + '$return_path' => '', + '$threaded' => $this->is_threaded(), + '$jsreload' => (($conv->get_mode() === 'display') ? $_SESSION['return_url'] : ''), + '$type' => (($conv->get_mode() === 'channel') ? 'wall-comment' : 'net-comment'), + '$id' => $this->get_id(), + '$parent' => $this->get_id(), + '$qcomment' => $qcomment, + '$profile_uid' => $conv->get_profile_owner(), + '$mylink' => $observer['xchan_url'], + '$mytitle' => t('This is you'), + '$myphoto' => $observer['xchan_photo_s'], + '$comment' => t('Comment'), + '$submit' => t('Submit'), + '$edbold' => t('Bold'), + '$editalic' => t('Italic'), + '$eduline' => t('Underline'), + '$edquote' => t('Quote'), + '$edcode' => t('Code'), + '$edimg' => t('Image'), + '$edurl' => t('Link'), + '$edvideo' => t('Video'), + '$preview' => ((feature_enabled($conv->get_profile_owner(),'preview')) ? t('Preview') : ''), + '$indent' => $indent, + '$sourceapp' => get_app()->sourcename + )); return $comment_box; } -- cgit v1.2.3 From 72d737cc82f5987791c9ceba0c8b99a505886274 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 10 Jul 2013 05:14:23 -0700 Subject: fix missing edit link --- include/ItemObject.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index a56f66a01..7a9e43819 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -25,7 +25,6 @@ class Item extends BaseObject { private $wall_to_wall = false; private $threaded = false; private $visiting = false; - private $observer = null; private $channel = null; public function __construct($data) { @@ -68,7 +67,6 @@ class Item extends BaseObject { $result = array(); $a = $this->get_app(); - $observer = $this->observer; $item = $this->get_data(); $commentww = ''; @@ -82,6 +80,7 @@ class Item extends BaseObject { $total_children = $this->count_descendants(); $conv = $this->get_conversation(); + $observer = $conv->get_observer(); $lock = ((($item['item_private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])))) @@ -94,8 +93,8 @@ class Item extends BaseObject { else $edpost = false; - if($this->observer['xchan_hash'] == $this->get_data_value('author_xchan') - || $this->observer['xchan_hash'] == $this->get_data_value('owner_xchan') + if($observer['xchan_hash'] == $this->get_data_value('author_xchan') + || $observer['xchan_hash'] == $this->get_data_value('owner_xchan') || $this->get_data_value('uid') == local_user()) $dropping = true; @@ -105,7 +104,7 @@ class Item extends BaseObject { 'delete' => t('Delete'), ); } - +// FIXME if($observer_is_pageowner) { $multidrop = array( 'select' => t('Select'), -- cgit v1.2.3 From 263d1531a94bc730a96dce60afb92f1a8b7d8ef4 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 22 Jul 2013 21:01:38 -0700 Subject: itemobject location --- include/ItemObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 7a9e43819..b31e60cbc 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -3,7 +3,7 @@ if(class_exists('Item')) return; -require_once('object/BaseObject.php'); +require_once('include/BaseObject.php'); require_once('include/text.php'); require_once('boot.php'); -- cgit v1.2.3 From 222fe08420802f7eacd4a544953f507d536c3fb8 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 1 Aug 2013 18:50:36 -0700 Subject: ensure that no unencrypted content leaks through item_store which is private - we typically do this in mod/item, but some functions bypass mod/item to create private posts --- include/ItemObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index b31e60cbc..8c8c0ee2a 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -262,7 +262,7 @@ class Item extends BaseObject { } } - $result['private'] = $item['private']; + $result['private'] = $item['item_private']; $result['toplevel'] = ($this->is_toplevel() ? 'toplevel_item' : ''); if($this->is_threaded()) { -- cgit v1.2.3 From 02a36948685737afdbbb9a292a338b304bb5cc04 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 20 Aug 2013 19:51:58 -0700 Subject: fix superblock for comments --- include/ItemObject.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 8c8c0ee2a..22b191e79 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -39,10 +39,10 @@ class Item extends BaseObject { foreach($data['children'] as $item) { /* - * Only add thos that will be displayed + * Only add those that will be displayed */ - if(! visible_activity($item)) { + if((! visible_activity($item)) || array_key_exists('author_blocked',$item)) { continue; } -- cgit v1.2.3 From c6d6c01fb619b37fa47f19966421a6636155180c Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 16 Sep 2013 22:40:53 -0700 Subject: use prepare_body in api calls to properly render content, add 'mode' to conversation templates so that themes can use the module context to suppress or show comments as desired --- include/ItemObject.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 22b191e79..0256160e9 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -88,6 +88,8 @@ class Item extends BaseObject { : false); $shareable = ((($conv->get_profile_owner() == local_user()) && ($item['item_private'] != 1)) ? true : false); + $mode = $conv->get_mode(); + if(local_user() && $observer['xchan_hash'] === $item['author_xchan']) $edpost = array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit")); else @@ -183,7 +185,7 @@ class Item extends BaseObject { $tmp_item = array( 'template' => $this->get_template(), - + 'mode' => $mode, 'type' => implode("",array_slice(explode("/",$item['verb']),-1)), 'tags' => array(), 'body' => $body, -- cgit v1.2.3 From e6d93b251606e7261db3a5048cf730c2e69a28e3 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 20 Sep 2013 05:45:11 -0700 Subject: is_commentable() had some major issues when applied to the atrocity known as ConversationObject, hopefully this won't destabilise the network as it's a somewhat major permission tweak related to comments; also add any local clones to allowed_public_recips() as they should always be allowed recipients. Not sure what to do about host permissions in the event of clones. They have more than one host, and it isn't spelled out in the sent message. All of this stuff will make your head hurt. --- include/ItemObject.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 0256160e9..681757a09 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -14,6 +14,7 @@ class Item extends BaseObject { public $data = array(); private $template = 'conv_item.tpl'; private $comment_box_template = 'comment_item.tpl'; + private $commentable = false; private $toplevel = false; private $children = array(); private $parent = null; @@ -295,6 +296,15 @@ class Item extends BaseObject { return $this->threaded; } + + public function set_commentable($val) { + $this->commentable = $val; + } + + public function is_commentable() { + return $this->commentable; + } + /** * Add a child item */ @@ -480,7 +490,9 @@ class Item extends BaseObject { $comment_box = ''; $conv = $this->get_conversation(); - if(! $conv->is_commentable()) +// logger('Commentable conv: ' . $conv->is_commentable()); + + if(! $this->is_commentable()) return; $template = get_markup_template($this->get_comment_box_template()); -- cgit v1.2.3 From 35993bcfecb12b4dfb8507b1989b1ddc3c2e4182 Mon Sep 17 00:00:00 2001 From: Olaf Conradi Date: Fri, 20 Sep 2013 21:58:20 +0200 Subject: Enable likes again on posts --- include/ItemObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 681757a09..62a8c9c42 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -164,7 +164,7 @@ class Item extends BaseObject { ); } - if($conv->is_commentable()) { + if($this->is_commentable()) { $like = array( t("I like this \x28toggle\x29"), t("like")); $dislike = array( t("I don't like this \x28toggle\x29"), t("dislike")); if ($shareable) -- cgit v1.2.3 From b520f3547f3543805110bfe9d5e5828d310df208 Mon Sep 17 00:00:00 2001 From: Olaf Conradi Date: Fri, 20 Sep 2013 23:50:23 +0200 Subject: Mark child posts as commentable when parent is set to commentable --- include/ItemObject.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 62a8c9c42..6c43d4e9e 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -296,9 +296,10 @@ class Item extends BaseObject { return $this->threaded; } - public function set_commentable($val) { $this->commentable = $val; + foreach($this->get_children() as $child) + $child->set_commentable($val); } public function is_commentable() { -- cgit v1.2.3 From 78a8d176acae142cac9d20315672772eccd6c683 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 2 Oct 2013 21:04:48 -0700 Subject: post signatures --- include/ItemObject.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 6c43d4e9e..bf55b484a 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -156,6 +156,12 @@ class Item extends BaseObject { $indent = 'comment'; } + + $verified = (($item['item_flags'] & ITEM_VERIFIED) ? t('Message is verified') : ''); + $unverified = '' ; // (($this->is_wall_to_wall() && (! ($item['item_flags'] & ITEM_VERIFIED))) ? t('Message cannot be verified') : ''); + + + // FIXME - check this permission if($conv->get_profile_owner() == local_user()) { $tagger = array( @@ -210,6 +216,8 @@ class Item extends BaseObject { 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'), 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), 'lock' => $lock, + 'verified' => $verified, + 'unverified' => $unverified, 'location' => $location, 'indent' => $indent, 'owner_url' => $this->get_owner_url(), -- cgit v1.2.3 From 0e793dea9bfc21a7c1c369d1db727d7ff900c90a Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 8 Oct 2013 21:17:11 -0700 Subject: replace a bunch of graphic icons with vector icons --- include/ItemObject.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index bf55b484a..df9386232 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -75,7 +75,7 @@ class Item extends BaseObject { $buttons = ''; $dropping = false; $star = false; - $isstarred = "unstarred"; + $isstarred = "unstarred icon-star-empty"; $indent = ''; $osparkle = ''; $total_children = $this->count_descendants(); @@ -147,7 +147,7 @@ class Item extends BaseObject { 'toggle' => t("toggle star status"), 'classdo' => (($item['item_flags'] & ITEM_STARRED) ? "hidden" : ""), 'classundo' => (($item['item_flags'] & ITEM_STARRED) ? "" : "hidden"), - 'isstarred' => (($item['item_flags'] & ITEM_STARRED) ? "starred" : "unstarred"), + 'isstarred' => (($item['item_flags'] & ITEM_STARRED) ? "starred icon-star" : "unstarred icon-star-empty"), 'starred' => t('starred'), ); -- cgit v1.2.3 From d54b6099d248a2fa05bb21d7f1b822bbaa0421fa Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 19 Oct 2013 01:48:43 -0700 Subject: remove "via wall-To-Wall" text as it's soooo Facebook and is out of place in derived/sourced channels. It's now just "$author via $xyz". --- include/ItemObject.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index df9386232..fc99c50ad 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -201,6 +201,7 @@ class Item extends BaseObject { 'linktitle' => sprintf( t('View %s\'s profile - %s'), $profile_name, $item['author']['xchan_addr']), 'olinktitle' => sprintf( t('View %s\'s profile - %s'), $this->get_owner_name(), $item['owner']['xchan_addr']), 'to' => t('to'), + 'via' => t('via'), 'wall' => t('Wall-to-Wall'), 'vwall' => t('via Wall-To-Wall:'), 'profile_url' => $profile_link, -- cgit v1.2.3 From c48da79adf648370beeeb0bab18f89963babebaa Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 20 Oct 2013 20:29:52 -0700 Subject: link to source - if it's on the display page link to original source (probably on a different site). All other conversations link to 'llink' which is a local copy and may provide a richer possibility of interactions, especially if you're logged in locally and it's your own copy of the post. --- include/ItemObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index fc99c50ad..59b4538df 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -229,7 +229,7 @@ class Item extends BaseObject { 'like' => $like, 'dislike' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike : ''), 'share' => $share, - 'plink' => get_plink($item), + 'plink' => get_plink($item,$mode), 'edpost' => ((feature_enabled($conv->get_profile_owner(),'edit_posts')) ? $edpost : ''), 'star' => ((feature_enabled($conv->get_profile_owner(),'star_posts')) ? $star : ''), 'tagger' => ((feature_enabled($conv->get_profile_owner(),'commtag')) ? $tagger : ''), -- cgit v1.2.3 From a5693df07fdf6fdf31247bfe0700d4c8096d4fbf Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 30 Oct 2013 17:33:10 -0700 Subject: issue #189 - show post edited time on relative date hovertip --- include/ItemObject.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 59b4538df..818f8c0b2 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -216,6 +216,7 @@ class Item extends BaseObject { 'str_app' => sprintf( t(' from %s'), $item['app']), 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'), 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), + 'editedtime' => (($item['edited'] != $item['created']) ? sprintf( t('last edited: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['edited'], 'r')) : ''), 'lock' => $lock, 'verified' => $verified, 'unverified' => $unverified, -- cgit v1.2.3 From 592c24e162400f87075c6cdc44b795cdb94da836 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 14 Nov 2013 15:41:25 -0800 Subject: e2ee in comments and a bit of cleanup so not every theme has to define how to insert bbcode, only if they're doing something special (e.g. this is how to implement a javascript plugin :-)), and I got rid of the predefined http:// in the bbcode for urls. You're almost always pasting a url which already has that bit and it just creates an extra step. --- include/ItemObject.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 818f8c0b2..6dbb38564 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -27,6 +27,7 @@ class Item extends BaseObject { private $threaded = false; private $visiting = false; private $channel = null; + private $cipher = 'aes256'; public function __construct($data) { $a = $this->get_app(); @@ -34,6 +35,10 @@ class Item extends BaseObject { $this->data = $data; $this->toplevel = ($this->get_id() == $this->get_data_value('parent')); + $cipher = get_pconfig($x['profile_uid'],'system','default_cipher'); + if($cipher) + $this->cipher = $cipher; + // Prepare the children if(count($data['children'])) { @@ -538,7 +543,11 @@ class Item extends BaseObject { '$edvideo' => t('Video'), '$preview' => ((feature_enabled($conv->get_profile_owner(),'preview')) ? t('Preview') : ''), '$indent' => $indent, + '$feature_encrypt' => ((feature_enabled($conv->get_profile_owner(),'content_encrypt')) ? true : false), + '$encrypt' => t('Encrypt text'), + '$cipher' => $this->cipher, '$sourceapp' => get_app()->sourcename + )); return $comment_box; -- cgit v1.2.3 From 2fe6aef8bc41db07cfac094f9ede7b06a52e0ade Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 14 Nov 2013 22:54:16 -0800 Subject: fix default cipher for comments and set it at the conversation level rather than the item level. --- include/ItemObject.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 6dbb38564..6088a2c1c 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -27,7 +27,7 @@ class Item extends BaseObject { private $threaded = false; private $visiting = false; private $channel = null; - private $cipher = 'aes256'; + public function __construct($data) { $a = $this->get_app(); @@ -35,11 +35,6 @@ class Item extends BaseObject { $this->data = $data; $this->toplevel = ($this->get_id() == $this->get_data_value('parent')); - $cipher = get_pconfig($x['profile_uid'],'system','default_cipher'); - if($cipher) - $this->cipher = $cipher; - - // Prepare the children if(count($data['children'])) { foreach($data['children'] as $item) { @@ -545,7 +540,7 @@ class Item extends BaseObject { '$indent' => $indent, '$feature_encrypt' => ((feature_enabled($conv->get_profile_owner(),'content_encrypt')) ? true : false), '$encrypt' => t('Encrypt text'), - '$cipher' => $this->cipher, + '$cipher' => $conv->get_cipher(), '$sourceapp' => get_app()->sourcename )); -- cgit v1.2.3 From 84d8fab6f1a049bb502c370c39fc3b44182ef24c Mon Sep 17 00:00:00 2001 From: Christian Vogeley Date: Mon, 23 Dec 2013 22:29:35 +0100 Subject: Show expire date in post tooltip --- include/ItemObject.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 6088a2c1c..170f013a1 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -217,6 +217,7 @@ class Item extends BaseObject { 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'), 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), 'editedtime' => (($item['edited'] != $item['created']) ? sprintf( t('last edited: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['edited'], 'r')) : ''), + 'expiretime' => (($item['expires'] > 0) ? sprintf( t('Expires: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['expires'], 'r')):''), 'lock' => $lock, 'verified' => $verified, 'unverified' => $unverified, -- cgit v1.2.3 From 79102218324e794bb7096e682d61841b570fc411 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 8 Jan 2014 15:20:12 -0800 Subject: preparatory work for supporting a "list view" mode for conversations. This would be useful for forum-like channels and/or block-oriented themes. --- include/ItemObject.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 170f013a1..40f85f5ef 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -10,6 +10,7 @@ require_once('boot.php'); /** * An item */ + class Item extends BaseObject { public $data = array(); private $template = 'conv_item.tpl'; @@ -458,6 +459,11 @@ class Item extends BaseObject { return $this->template; } + + private function set_template($t) { + $this->template = $t; + } + /** * Check if this is a toplevel post */ -- cgit v1.2.3 From a78d9b973d6391e3a15f8a3ff2fe586a4bffe08c Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 9 Jan 2014 16:23:58 -0800 Subject: simplify permalink selection logic --- include/ItemObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 40f85f5ef..9a62cee4b 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -232,7 +232,7 @@ class Item extends BaseObject { 'like' => $like, 'dislike' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike : ''), 'share' => $share, - 'plink' => get_plink($item,$mode), + 'plink' => get_plink($item), 'edpost' => ((feature_enabled($conv->get_profile_owner(),'edit_posts')) ? $edpost : ''), 'star' => ((feature_enabled($conv->get_profile_owner(),'star_posts')) ? $star : ''), 'tagger' => ((feature_enabled($conv->get_profile_owner(),'commtag')) ? $tagger : ''), -- cgit v1.2.3 From f104b4dc275891785ec03abd779d8aafe5163815 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 27 Jan 2014 23:49:42 -0800 Subject: preserve expiration when editing --- include/ItemObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 9a62cee4b..e9a0b65c0 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -218,7 +218,7 @@ class Item extends BaseObject { 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'), 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), 'editedtime' => (($item['edited'] != $item['created']) ? sprintf( t('last edited: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['edited'], 'r')) : ''), - 'expiretime' => (($item['expires'] > 0) ? sprintf( t('Expires: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['expires'], 'r')):''), + 'expiretime' => (($item['expires'] !== '0000-00-00 00:00:00') ? sprintf( t('Expires: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['expires'], 'r')):''), 'lock' => $lock, 'verified' => $verified, 'unverified' => $unverified, -- cgit v1.2.3 From aede006970fb9124161b4732b9f44002a35d17ef Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 4 Feb 2014 17:12:13 -0800 Subject: bookmarks - mop up and go home --- include/ItemObject.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index e9a0b65c0..9b1a6fbcd 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -171,6 +171,15 @@ class Item extends BaseObject { ); } + $has_bookmarks = false; + if(is_array($item['term'])) { + foreach($item['term'] as $t) { + if($t['type'] == TERM_BOOKMARK) + $has_bookmarks = true; + } + } + + if($this->is_commentable()) { $like = array( t("I like this \x28toggle\x29"), t("like")); $dislike = array( t("I don't like this \x28toggle\x29"), t("dislike")); @@ -237,6 +246,7 @@ class Item extends BaseObject { 'star' => ((feature_enabled($conv->get_profile_owner(),'star_posts')) ? $star : ''), 'tagger' => ((feature_enabled($conv->get_profile_owner(),'commtag')) ? $tagger : ''), 'filer' => ((feature_enabled($conv->get_profile_owner(),'filing')) ? $filer : ''), + 'bookmark' => (($conv->get_profile_owner() == local_user() && $has_bookmarks) ? t('Bookmark Links') : ''), 'drop' => $drop, 'multidrop' => ((feature_enabled($conv->get_profile_owner(),'multi_delete')) ? $multidrop : ''), // end toolbar buttons -- cgit v1.2.3 From 3222b154856b2286a7bc28abb5f5adc7f6453835 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sat, 8 Feb 2014 17:49:09 +0000 Subject: Pass mids to conv_item template --- include/ItemObject.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 9b1a6fbcd..2922ee473 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -241,6 +241,7 @@ class Item extends BaseObject { 'like' => $like, 'dislike' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike : ''), 'share' => $share, + 'rawmid' => $item['mid'], 'plink' => get_plink($item), 'edpost' => ((feature_enabled($conv->get_profile_owner(),'edit_posts')) ? $edpost : ''), 'star' => ((feature_enabled($conv->get_profile_owner(),'star_posts')) ? $star : ''), -- cgit v1.2.3 From 8144498803a589f9179dea556acc8332381a93af Mon Sep 17 00:00:00 2001 From: marijus Date: Thu, 8 May 2014 13:44:43 +0200 Subject: like indicator rewrite --- include/ItemObject.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 2922ee473..36070335d 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -123,6 +123,14 @@ class Item extends BaseObject { $location = format_location($item); + $like_count = ((x($alike,$item['mid'])) ? $alike[$item['mid']] : ''); + $like_list = ((x($alike,$item['mid'])) ? $alike[$item['mid'] . '-l'] : ''); + $like_button_label = ((x($alike,$item['mid'])) && ($alike[$item['mid']] < 2 ) ? t('like') : t('likes')); + if (feature_enabled($conv->get_profile_owner(),'dislike')) { + $dislike_count = ((x($dlike,$item['mid'])) ? $dlike[$item['mid']] : ''); + $dislike_list = ((x($dlike,$item['mid'])) ? $dlike[$item['mid'] . '-l'] : ''); + $dislike_button_label = ((x($dlike,$item['mid'])) && ($dlike[$item['mid']] < 2) ? t('dislike') : t('dislikes')); + } $showlike = ((x($alike,$item['mid'])) ? format_like($alike[$item['mid']],$alike[$item['mid'] . '-l'],'like',$item['mid']) : ''); $showdislike = ((x($dlike,$item['mid']) && feature_enabled($conv->get_profile_owner(),'dislike')) @@ -251,7 +259,12 @@ class Item extends BaseObject { 'drop' => $drop, 'multidrop' => ((feature_enabled($conv->get_profile_owner(),'multi_delete')) ? $multidrop : ''), // end toolbar buttons - + 'like_count' => $like_count, + 'like_list' => $like_list, + 'like_button_label' => $like_button_label, + 'dislike_count' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_count : ''), + 'dislike_list' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_list : ''), + 'dislike_button_label' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_button_label : ''), 'showlike' => $showlike, 'showdislike' => $showdislike, 'comment' => $this->get_comment_box($indent), -- cgit v1.2.3 From c7a0891bbeb6a072f95668fb7d6c8fd5a0f701fc Mon Sep 17 00:00:00 2001 From: marijus Date: Mon, 12 May 2014 11:27:53 +0200 Subject: Typo --- include/ItemObject.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 36070335d..475642787 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -125,11 +125,11 @@ class Item extends BaseObject { $like_count = ((x($alike,$item['mid'])) ? $alike[$item['mid']] : ''); $like_list = ((x($alike,$item['mid'])) ? $alike[$item['mid'] . '-l'] : ''); - $like_button_label = ((x($alike,$item['mid'])) && ($alike[$item['mid']] < 2 ) ? t('like') : t('likes')); + $like_button_label = ((x($alike,$item['mid'])) && ($alike[$item['mid']] < 2 ) ? t('Like') : t('Likes')); if (feature_enabled($conv->get_profile_owner(),'dislike')) { $dislike_count = ((x($dlike,$item['mid'])) ? $dlike[$item['mid']] : ''); $dislike_list = ((x($dlike,$item['mid'])) ? $dlike[$item['mid'] . '-l'] : ''); - $dislike_button_label = ((x($dlike,$item['mid'])) && ($dlike[$item['mid']] < 2) ? t('dislike') : t('dislikes')); + $dislike_button_label = ((x($dlike,$item['mid'])) && ($dlike[$item['mid']] < 2) ? t('Dislike') : t('Dislikes')); } $showlike = ((x($alike,$item['mid'])) ? format_like($alike[$item['mid']],$alike[$item['mid'] . '-l'],'like',$item['mid']) : ''); -- cgit v1.2.3 From 89b8bc07ac7178b8ea722f8d1faa2f649faa8c1b Mon Sep 17 00:00:00 2001 From: marijus Date: Sun, 18 May 2014 09:14:21 +0200 Subject: implement modal for more then 10 likes/dislikes --- include/ItemObject.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 475642787..cdb09ecf1 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -125,11 +125,24 @@ class Item extends BaseObject { $like_count = ((x($alike,$item['mid'])) ? $alike[$item['mid']] : ''); $like_list = ((x($alike,$item['mid'])) ? $alike[$item['mid'] . '-l'] : ''); + if (count($like_list) > MAX_LIKERS) { + $like_list_part = array_slice($like_list, 0, MAX_LIKERS); + array_push($like_list_part, '' . t('View all') . ''); + } else { + $like_list_part = ''; + } $like_button_label = ((x($alike,$item['mid'])) && ($alike[$item['mid']] < 2 ) ? t('Like') : t('Likes')); + if (feature_enabled($conv->get_profile_owner(),'dislike')) { $dislike_count = ((x($dlike,$item['mid'])) ? $dlike[$item['mid']] : ''); $dislike_list = ((x($dlike,$item['mid'])) ? $dlike[$item['mid'] . '-l'] : ''); $dislike_button_label = ((x($dlike,$item['mid'])) && ($dlike[$item['mid']] < 2) ? t('Dislike') : t('Dislikes')); + if (count($dislike_list) > MAX_LIKERS) { + $dislike_list_part = array_slice($dislike_list, 0, MAX_LIKERS); + array_push($dislike_list_part, '' . t('View all') . ''); + } else { + $dislike_list_part = ''; + } } $showlike = ((x($alike,$item['mid'])) ? format_like($alike[$item['mid']],$alike[$item['mid'] . '-l'],'like',$item['mid']) : ''); @@ -261,10 +274,15 @@ class Item extends BaseObject { // end toolbar buttons 'like_count' => $like_count, 'like_list' => $like_list, + 'like_list_part' => $like_list_part, 'like_button_label' => $like_button_label, + 'like_modal_title' => t('Likes'), + 'dislike_modal_title' => t('Dislikes'), 'dislike_count' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_count : ''), 'dislike_list' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_list : ''), + 'dislike_list_part' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_list_part : ''), 'dislike_button_label' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_button_label : ''), + 'modal_dismiss' => t('Close'), 'showlike' => $showlike, 'showdislike' => $showdislike, 'comment' => $this->get_comment_box($indent), -- cgit v1.2.3 From d15e3776f3ec5476b1614f0488e8e81e0f0ebb70 Mon Sep 17 00:00:00 2001 From: Alexandre Hannud Abdo Date: Wed, 21 May 2014 05:32:46 -0300 Subject: Allow translation context with plural. Use that in Likes/Dislikes. --- include/ItemObject.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index cdb09ecf1..19283c317 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -131,12 +131,12 @@ class Item extends BaseObject { } else { $like_list_part = ''; } - $like_button_label = ((x($alike,$item['mid'])) && ($alike[$item['mid']] < 2 ) ? t('Like') : t('Likes')); + $like_button_label = tt('Like','Likes',$like_count,'noun'); if (feature_enabled($conv->get_profile_owner(),'dislike')) { $dislike_count = ((x($dlike,$item['mid'])) ? $dlike[$item['mid']] : ''); $dislike_list = ((x($dlike,$item['mid'])) ? $dlike[$item['mid'] . '-l'] : ''); - $dislike_button_label = ((x($dlike,$item['mid'])) && ($dlike[$item['mid']] < 2) ? t('Dislike') : t('Dislikes')); + $dislike_button_label = tt('Dislike','Dislikes',$dislike_count,'noun'); if (count($dislike_list) > MAX_LIKERS) { $dislike_list_part = array_slice($dislike_list, 0, MAX_LIKERS); array_push($dislike_list_part, '' . t('View all') . ''); @@ -276,8 +276,8 @@ class Item extends BaseObject { 'like_list' => $like_list, 'like_list_part' => $like_list_part, 'like_button_label' => $like_button_label, - 'like_modal_title' => t('Likes'), - 'dislike_modal_title' => t('Dislikes'), + 'like_modal_title' => t('Likes','noun'), + 'dislike_modal_title' => t('Dislikes','noun'), 'dislike_count' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_count : ''), 'dislike_list' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_list : ''), 'dislike_list_part' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_list_part : ''), -- cgit v1.2.3 From 22ed5b1d03314d2bc7ff41b4724526fe00472904 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 29 May 2014 20:09:21 -0700 Subject: newevent: front end functions --- include/ItemObject.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 19283c317..ad2692624 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -200,6 +200,9 @@ class Item extends BaseObject { } } + $has_event = false; + if(activity_compare($item['obj_type'],ACTIVITY_OBJ_EVENT) && $conv->get_profile_owner() == local_user()) + $has_event = true; if($this->is_commentable()) { $like = array( t("I like this \x28toggle\x29"), t("like")); @@ -268,7 +271,8 @@ class Item extends BaseObject { 'star' => ((feature_enabled($conv->get_profile_owner(),'star_posts')) ? $star : ''), 'tagger' => ((feature_enabled($conv->get_profile_owner(),'commtag')) ? $tagger : ''), 'filer' => ((feature_enabled($conv->get_profile_owner(),'filing')) ? $filer : ''), - 'bookmark' => (($conv->get_profile_owner() == local_user() && $has_bookmarks) ? t('Bookmark Links') : ''), + 'bookmark' => (($conv->get_profile_owner() == local_user() && $has_bookmarks) ? t('Save Bookmarks') : ''), + 'addtocal' => (($has_event) ? t('Add to Calendar') : ''), 'drop' => $drop, 'multidrop' => ((feature_enabled($conv->get_profile_owner(),'multi_delete')) ? $multidrop : ''), // end toolbar buttons -- cgit v1.2.3 From 832cbbec15ae2abbd04d775e4cfb056e797722f1 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 29 May 2014 21:25:19 -0700 Subject: testing new event code --- include/ItemObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index ad2692624..b6a9a2897 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -201,7 +201,7 @@ class Item extends BaseObject { } $has_event = false; - if(activity_compare($item['obj_type'],ACTIVITY_OBJ_EVENT) && $conv->get_profile_owner() == local_user()) + if(($item['obj_type'] === ACTIVITY_OBJ_EVENT) && $conv->get_profile_owner() == local_user()) $has_event = true; if($this->is_commentable()) { -- cgit v1.2.3 From 33cf83175d2af2bc62b694368dae7126d9bfc9bc Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 29 May 2014 21:34:08 -0700 Subject: use consistent capitalisation in the item actions menu --- include/ItemObject.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index b6a9a2897..e8a7e853c 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -115,7 +115,7 @@ class Item extends BaseObject { ); } - $filer = (($conv->get_profile_owner() == local_user()) ? t("save to folder") : false); + $filer = (($conv->get_profile_owner() == local_user()) ? t("Save to Folder") : false); $profile_avatar = $item['author']['xchan_photo_m']; $profile_link = chanlink_url($item['author']['xchan_url']); @@ -164,9 +164,9 @@ class Item extends BaseObject { // FIXME we don't need all this stuff, some can be done in the template $star = array( - 'do' => t("add star"), - 'undo' => t("remove star"), - 'toggle' => t("toggle star status"), + 'do' => t("Add Star"), + 'undo' => t("Remove Star"), + 'toggle' => t("Toggle Star Status"), 'classdo' => (($item['item_flags'] & ITEM_STARRED) ? "hidden" : ""), 'classundo' => (($item['item_flags'] & ITEM_STARRED) ? "" : "hidden"), 'isstarred' => (($item['item_flags'] & ITEM_STARRED) ? "starred icon-star" : "unstarred icon-star-empty"), @@ -187,7 +187,7 @@ class Item extends BaseObject { // FIXME - check this permission if($conv->get_profile_owner() == local_user()) { $tagger = array( - 'tagit' => t("add tag"), + 'tagit' => t("Add Tag"), 'classtagger' => "", ); } @@ -208,7 +208,7 @@ class Item extends BaseObject { $like = array( t("I like this \x28toggle\x29"), t("like")); $dislike = array( t("I don't like this \x28toggle\x29"), t("dislike")); if ($shareable) - $share = array( t('Share this'), t('share')); + $share = array( t('Share This'), t('share')); } if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0) -- cgit v1.2.3 From b4e7d7f7c048c6a4521f286bafc214f235c3c5d1 Mon Sep 17 00:00:00 2001 From: jeroenpraat Date: Tue, 3 Jun 2014 05:12:00 +0000 Subject: Updated to [+] show more, [+] show more comments, etc. See https://redmatrix.nl/channel/jeroenpraat/?f=&mid=5138fdee2ade50a7ef7a5a59e01a7dc91012c125e712d1ce483be6e31543dffe@redmatrix.nl --- include/ItemObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index e8a7e853c..72d6444f8 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -313,7 +313,7 @@ class Item extends BaseObject { if(($nb_children > 2) || ($thread_level > 1)) { $result['children'][0]['comment_firstcollapsed'] = true; $result['children'][0]['num_comments'] = sprintf( tt('%d comment','%d comments',$total_children),$total_children ); - $result['children'][0]['hide_text'] = t('show more'); + $result['children'][0]['hide_text'] = t('[+] show more comments'); if($thread_level > 1) { $result['children'][$nb_children - 1]['comment_lastcollapsed'] = true; } -- cgit v1.2.3 From ad378cbe07fa55d681601a2516399eeb8ac92a38 Mon Sep 17 00:00:00 2001 From: jeroenpraat Date: Tue, 3 Jun 2014 12:05:25 +0000 Subject: Updated strings for show entire post and show less to expand and collapse. See last few comments from me and Mario at https://redmatrix.nl/channel/jeroenpraat/?f=&mid=5138fdee2ade50a7ef7a5a59e01a7dc91012c125e712d1ce483be6e31543dffe@redmatrix.nl --- include/ItemObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ItemObject.php') diff --git a/include/ItemObject.php b/include/ItemObject.php index 72d6444f8..a5870ef91 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -313,7 +313,7 @@ class Item extends BaseObject { if(($nb_children > 2) || ($thread_level > 1)) { $result['children'][0]['comment_firstcollapsed'] = true; $result['children'][0]['num_comments'] = sprintf( tt('%d comment','%d comments',$total_children),$total_children ); - $result['children'][0]['hide_text'] = t('[+] show more comments'); + $result['children'][0]['hide_text'] = t('[+] show all'); if($thread_level > 1) { $result['children'][$nb_children - 1]['comment_lastcollapsed'] = true; } -- cgit v1.2.3