]> git.mxchange.org Git - friendica.git/blob - object/Item.php
e5aaecacd7a77f8027bed3668c73a20c4fffe21a
[friendica.git] / object / Item.php
1 <?php
2 if(class_exists('Item'))
3         return;
4
5 require_once('object/BaseObject.php');
6 require_once('include/text.php');
7 require_once('boot.php');
8
9 /**
10  * An item
11  */
12 class Item extends BaseObject {
13         private $data = array();
14         private $template = null;
15         private $available_templates = array(
16                 'wall' => 'wall_thread.tpl',
17                 'wall2wall' => 'wallwall_thread.tpl'
18         );
19         private $comment_box_template = 'comment_item.tpl';
20         private $toplevel = false;
21         private $writable = false;
22         private $children = array();
23         private $parent = null;
24         private $conversation = null;
25         private $redirect_url = null;
26         private $owner_url = '';
27         private $owner_photo = '';
28         private $owner_name = '';
29         private $wall_to_wall = false;
30         private $threaded = false;
31         private $visiting = false;
32
33         public function __construct($data) {
34                 $a = $this->get_app();
35                 
36                 $this->data = $data;
37                 $this->set_template('wall');
38                 $this->toplevel = ($this->get_id() == $this->get_data_value('parent'));
39
40                 if(is_array($_SESSION['remote'])) {
41                         foreach($_SESSION['remote'] as $visitor) {
42                                 if($visitor['cid'] == $this->get_data_value('contact-id')) {
43                                         $this->visiting = true;
44                                         break;
45                                 }
46                         }
47                 }
48                 
49                 $this->writable = ($this->get_data_value('writable') || $this->get_data_value('self'));
50
51                 $ssl_state = ((local_user()) ? true : false);
52                 $this->redirect_url = $a->get_baseurl($ssl_state) . '/redir/' . $this->get_data_value('cid') ;
53
54                 if(get_config('system','thread_allow') && $a->theme_thread_allow && !$this->is_toplevel())
55                         $this->threaded = true;
56
57                 // Prepare the children
58                 if(count($data['children'])) {
59                         foreach($data['children'] as $item) {
60                                 /*
61                                  * Only add will be displayed
62                                  */
63                                 if($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
64                                         continue;
65                                 }
66                                 if(! visible_activity($item)) {
67                                         continue;
68                                 }
69                                 $child = new Item($item);
70                                 $this->add_child($child);
71                         }
72                 }
73         }
74
75         /**
76          * Get data in a form usable by a conversation template
77          *
78          * Returns:
79          *      _ The data requested on success
80          *      _ false on failure
81          */
82         public function get_template_data($alike, $dlike, $thread_level=1) {
83                 $result = array();
84
85                 $a = $this->get_app();
86
87                 $item = $this->get_data();
88
89                 $commentww = '';
90                 $sparkle = '';
91                 $buttons = '';
92                 $dropping = false;
93                 $star = false;
94                 $isstarred = "unstarred";
95                 $indent = '';
96                 $shiny = '';
97                 $osparkle = '';
98                 $total_children = $this->count_descendants();
99
100                 $conv = $this->get_conversation();
101
102
103                 $lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) 
104                         || strlen($item['deny_cid']) || strlen($item['deny_gid']))))
105                         ? t('Private Message')
106                         : false);
107                 $shareable = ((($conv->get_profile_owner() == local_user()) && ($item['private'] != 1)) ? true : false);
108                 if(local_user() && link_compare($a->contact['url'],$item['author-link']))
109                         $edpost = array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit"));
110                 else
111                         $edpost = false;
112                 if(($this->get_data_value('uid') == local_user()) || $this->is_visiting())
113                         $dropping = true;
114
115                 $drop = array(
116                         'dropping' => $dropping,
117                         'pagedrop' => ((feature_enabled($conv->get_profile_owner(),'multi_delete')) ? $item['pagedrop'] : ''),
118                         'select' => t('Select'),
119                         'delete' => t('Delete'),
120                 );
121
122                 $filer = (($conv->get_profile_owner() == local_user()) ? t("save to folder") : false);
123
124                 $diff_author    = ((link_compare($item['url'],$item['author-link'])) ? false : true);
125                 $profile_name   = (((strlen($item['author-name']))   && $diff_author) ? $item['author-name']   : $item['name']);
126                 if($item['author-link'] && (! $item['author-name']))
127                         $profile_name = $item['author-link'];
128
129                 $sp = false;
130                 $profile_link = best_link_url($item,$sp);
131                 if($profile_link === 'mailbox')
132                         $profile_link = '';
133                 if($sp)
134                         $sparkle = ' sparkle';
135                 else
136                         $profile_link = zrl($profile_link);
137
138                 $normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
139                 if(($normalised != 'mailbox') && (x($a->contacts,$normalised)))
140                         $profile_avatar = $a->contacts[$normalised]['thumb'];
141                 else
142                         $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $a->get_cached_avatar_image($this->get_data_value('thumb')));
143
144                 $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
145                 call_hooks('render_location',$locate);
146                 $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_google($locate));
147
148                 $tags=array();
149                 $hashtags = array();
150                 $mentions = array();
151                 foreach(explode(',',$item['tag']) as $tag){
152                         $tag = trim($tag);
153                         if ($tag!="") {
154                                 $t = bbcode($tag);
155                                 $tags[] = $t;
156                                 if($t[0] == '#')
157                                         $hashtags[] = $t;
158                                 elseif($t[0] == '@')
159                                         $mentions[] = $t;
160                         }
161
162                 }        
163
164                 $like    = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : '');
165                 $dislike = ((x($dlike,$item['uri'])) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : '');
166
167                 /*
168                  * We should avoid doing this all the time, but it depends on the conversation mode
169                  * And the conv mode may change when we change the conv, or it changes its mode
170                  * Maybe we should establish a way to be notified about conversation changes
171                  */
172                 $this->check_wall_to_wall();
173                 
174                 if($this->is_wall_to_wall() && ($this->get_owner_url() == $this->get_redirect_url()))
175                         $osparkle = ' sparkle';
176                 
177                 if($this->is_toplevel()) {
178                         if($conv->get_profile_owner() == local_user()) {
179                                 $isstarred = (($item['starred']) ? "starred" : "unstarred");
180
181                                 $star = array(
182                                         'do' => t("add star"),
183                                         'undo' => t("remove star"),
184                                         'toggle' => t("toggle star status"),
185                                         'classdo' => (($item['starred']) ? "hidden" : ""),
186                                         'classundo' => (($item['starred']) ? "" : "hidden"),
187                                         'starred' =>  t('starred'),
188                                 );
189                                 $tagger = '';
190                                 if(feature_enabled($conv->get_profile_owner(),'commtag')) {
191                                         $tagger = array(
192                                                 'add' => t("add tag"),
193                                                 'class' => "",
194                                         );
195                                 }
196                         }
197                 } else {
198                         $indent = 'comment';
199                 }
200
201                 if($conv->is_writable()) {
202                         $buttons = array(
203                                 'like' => array( t("I like this \x28toggle\x29"), t("like")),
204                                 'dislike' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? array( t("I don't like this \x28toggle\x29"), t("dislike")) : ''),
205                         );
206                         if ($shareable) $buttons['share'] = array( t('Share this'), t('share'));
207                 }
208
209                 if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0){
210                         $shiny = 'shiny';
211                 }
212
213                 localize_item($item);
214
215                 if ($item["postopts"]) {
216                         //$langdata = explode(";", $item["postopts"]);
217                         //$langstr = substr($langdata[0], 5)." (".round($langdata[1]*100, 1)."%)";
218                         $langstr = "";
219                         if (substr($item["postopts"], 0, 5) == "lang=") {
220                                 $postopts = substr($item["postopts"], 5);
221
222                                 $languages = explode(":", $postopts);
223
224                                 if (sizeof($languages) == 1) {
225                                         $languages = array();
226                                         $languages[] = $postopts;
227                                 }
228
229                                 foreach ($languages as $language) {
230                                         $langdata = explode(";", $language);
231                                         if ($langstr != "")
232                                                 $langstr .= ", ";
233
234                                         //$langstr .= $langdata[0]." (".round($langdata[1]*100, 1)."%)";
235                                         $langstr .= round($langdata[1]*100, 1)."% ".$langdata[0];
236                                 }
237                         }
238                 }
239
240                 $body = prepare_body($item,true);
241
242                 list($categories, $folders) = get_cats_and_terms($item);
243
244                 if($a->theme['template_engine'] === 'internal') {
245                         $body_e = template_escape($body);
246                         $text_e = strip_tags(template_escape($body));
247                         $name_e = template_escape($profile_name);
248                         $title_e = template_escape($item['title']);
249                         $location_e = template_escape($location);
250                         $owner_name_e = template_escape($this->get_owner_name());
251                 }
252                 else {
253                         $body_e = $body;
254                         $text_e = strip_tags($body);
255                         $name_e = $profile_name;
256                         $title_e = $item['title'];
257                         $location_e = $location;
258                         $owner_name_e = $this->get_owner_name();
259                 }
260
261                 $tmp_item = array(
262                         'template' => $this->get_template(),
263
264                         'type' => implode("",array_slice(explode("/",$item['verb']),-1)),
265                         'tags' => $tags,
266             'hashtags' => $hashtags,
267             'mentions' => $mentions,
268                         'txt_cats' => t('Categories:'),
269                         'txt_folders' => t('Filed under:'),
270                         'has_cats' => ((count($categories)) ? 'true' : ''),
271                         'has_folders' => ((count($folders)) ? 'true' : ''),
272             'categories' => $categories,
273             'folders' => $folders,            
274                         'body' => $body_e,
275                         'text' => $text_e,
276                         'id' => $this->get_id(),
277                         'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
278                         'olinktitle' => sprintf( t('View %s\'s profile @ %s'), $this->get_owner_name(), ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
279                         'to' => t('to'),
280                         'via' => t('via'),
281                         'wall' => t('Wall-to-Wall'),
282                         'vwall' => t('via Wall-To-Wall:'),
283                         'profile_url' => $profile_link,
284                         'item_photo_menu' => item_photo_menu($item),
285                         'name' => $name_e,
286                         'thumb' => $profile_avatar,
287                         'osparkle' => $osparkle,
288                         'sparkle' => $sparkle,
289                         'title' => $title_e,
290                         'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
291                         'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
292                         'lock' => $lock,
293                         'location' => $location_e,
294                         'indent' => $indent,
295                         'shiny' => $shiny,
296                         'owner_url' => $this->get_owner_url(),
297                         'owner_photo' => $this->get_owner_photo(),
298                         'owner_name' => $owner_name_e,
299                         'plink' => get_plink($item),
300                         'edpost'    => ((feature_enabled($conv->get_profile_owner(),'edit_posts')) ? $edpost : ''),
301                         'isstarred' => $isstarred,
302                         'star'      => ((feature_enabled($conv->get_profile_owner(),'star_posts')) ? $star : ''),
303                         'tagger'        => $tagger,
304                         'filer'     => ((feature_enabled($conv->get_profile_owner(),'filing')) ? $filer : ''),
305                         'drop' => $drop,
306                         'vote' => $buttons,
307                         'like' => $like,
308                         'dislike'   => $dislike,
309                         'switchcomment' => t('Comment'),
310                         'comment' => $this->get_comment_box($indent),
311                         'previewing' => ($conv->is_preview() ? ' preview ' : ''),
312                         'wait' => t('Please wait'),
313                         'thread_level' => $thread_level,
314                         'postopts' => $langstr
315                 );
316
317                 $arr = array('item' => $item, 'output' => $tmp_item);
318                 call_hooks('display_item', $arr);
319
320                 $result = $arr['output'];
321
322                 $result['children'] = array();
323                 $children = $this->get_children();
324                 $nb_children = count($children);
325                 if($nb_children > 0) {
326                         foreach($children as $child) {
327                                 $result['children'][] = $child->get_template_data($alike, $dlike, $thread_level + 1);
328                         }
329                         // Collapse
330                         if(($nb_children > 2) || ($thread_level > 1)) {
331                                 $result['children'][0]['comment_firstcollapsed'] = true;
332                                 $result['children'][0]['num_comments'] = sprintf( tt('%d comment','%d comments',$total_children),$total_children );
333                                 $result['children'][0]['hidden_comments_num'] = $total_children;
334                                 $result['children'][0]['hidden_comments_text'] = tt('comment', 'comments', $total_children);
335                                 $result['children'][0]['hide_text'] = t('show more');
336                                 if($thread_level > 1) {
337                                         $result['children'][$nb_children - 1]['comment_lastcollapsed'] = true;
338                                 }
339                                 else {
340                                         $result['children'][$nb_children - 3]['comment_lastcollapsed'] = true;
341                                 }
342                         }
343                 }
344                 
345         if ($this->is_toplevel()) {
346             $result['total_comments_num'] = "$total_children";
347             $result['total_comments_text'] = tt('comment', 'comments', $total_children);
348         }
349         
350                 $result['private'] = $item['private'];
351                 $result['toplevel'] = ($this->is_toplevel() ? 'toplevel_item' : '');
352
353                 if($this->is_threaded()) {
354                         $result['flatten'] = false;
355                         $result['threaded'] = true;
356                 }
357                 else {
358                         $result['flatten'] = true;
359                         $result['threaded'] = false;
360                 }
361
362                 return $result;
363         }
364         
365         public function get_id() {
366                 return $this->get_data_value('id');
367         }
368
369         public function is_threaded() {
370                 return $this->threaded;
371         }
372
373         /**
374          * Add a child item
375          */
376         public function add_child($item) {
377                 $item_id = $item->get_id();
378                 if(!$item_id) {
379                         logger('[ERROR] Item::add_child : Item has no ID!!', LOGGER_DEBUG);
380                         return false;
381                 }
382                 if($this->get_child($item->get_id())) {
383                         logger('[WARN] Item::add_child : Item already exists ('. $item->get_id() .').', LOGGER_DEBUG);
384                         return false;
385                 }
386                 /*
387                  * Only add what will be displayed
388                  */
389                 if($item->get_data_value('network') === NETWORK_MAIL && local_user() != $item->get_data_value('uid')) {
390                         return false;
391                 }
392                 if(activity_match($item->get_data_value('verb'),ACTIVITY_LIKE) || activity_match($item->get_data_value('verb'),ACTIVITY_DISLIKE)) {
393                         return false;
394                 }
395                 
396                 $item->set_parent($this);
397                 $this->children[] = $item;
398                 return end($this->children);
399         }
400
401         /**
402          * Get a child by its ID
403          */
404         public function get_child($id) {
405                 foreach($this->get_children() as $child) {
406                         if($child->get_id() == $id)
407                                 return $child;
408                 }
409                 return null;
410         }
411
412         /**
413          * Get all ou children
414          */
415         public function get_children() {
416                 return $this->children;
417         }
418
419         /**
420          * Set our parent
421          */
422         protected function set_parent($item) {
423                 $parent = $this->get_parent();
424                 if($parent) {
425                         $parent->remove_child($this);
426                 }
427                 $this->parent = $item;
428                 $this->set_conversation($item->get_conversation());
429         }
430
431         /**
432          * Remove our parent
433          */
434         protected function remove_parent() {
435                 $this->parent = null;
436                 $this->conversation = null;
437         }
438
439         /**
440          * Remove a child
441          */
442         public function remove_child($item) {
443                 $id = $item->get_id();
444                 foreach($this->get_children() as $key => $child) {
445                         if($child->get_id() == $id) {
446                                 $child->remove_parent();
447                                 unset($this->children[$key]);
448                                 // Reindex the array, in order to make sure there won't be any trouble on loops using count()
449                                 $this->children = array_values($this->children);
450                                 return true;
451                         }
452                 }
453                 logger('[WARN] Item::remove_child : Item is not a child ('. $id .').', LOGGER_DEBUG);
454                 return false;
455         }
456
457         /**
458          * Get parent item
459          */
460         protected function get_parent() {
461                 return $this->parent;
462         }
463
464         /**
465          * set conversation
466          */
467         public function set_conversation($conv) {
468                 $previous_mode = ($this->conversation ? $this->conversation->get_mode() : '');
469                 
470                 $this->conversation = $conv;
471
472                 // Set it on our children too
473                 foreach($this->get_children() as $child)
474                         $child->set_conversation($conv);
475         }
476
477         /**
478          * get conversation
479          */
480         public function get_conversation() {
481                 return $this->conversation;
482         }
483
484         /**
485          * Get raw data
486          *
487          * We shouldn't need this
488          */
489         public function get_data() {
490                 return $this->data;
491         }
492
493         /**
494          * Get a data value
495          *
496          * Returns:
497          *      _ value on success
498          *      _ false on failure
499          */
500         public function get_data_value($name) {
501                 if(!isset($this->data[$name])) {
502                         logger('[ERROR] Item::get_data_value : Item has no value name "'. $name .'".', LOGGER_DEBUG);
503                         return false;
504                 }
505
506                 return $this->data[$name];
507         }
508
509         /**
510          * Set template
511          */
512         private function set_template($name) {
513                 $a = get_app();
514
515                 if(!x($this->available_templates, $name)) {
516                         logger('[ERROR] Item::set_template : Template not available ("'. $name .'").', LOGGER_DEBUG);
517                         return false;
518                 }
519
520                 if($a->theme['template_engine'] === 'smarty3') {
521                         $template_file = get_template_file($a, 'smarty3/' . $this->available_templates[$name]);
522                 }
523                 else {
524                         $template_file = $this->available_templates[$name];
525                 }
526                 $this->template = $template_file;
527         }
528
529         /**
530          * Get template
531          */
532         private function get_template() {
533                 return $this->template;
534         }
535
536         /**
537          * Check if this is a toplevel post
538          */
539         private function is_toplevel() {
540                 return $this->toplevel;
541         }
542
543         /**
544          * Check if this is writable
545          */
546         private function is_writable() {
547                 $conv = $this->get_conversation();
548
549                 if($conv) {
550                         // This will allow us to comment on wall-to-wall items owned by our friends
551                         // and community forums even if somebody else wrote the post.
552
553                         // bug #517 - this fixes for conversation owner
554                         if($conv->get_mode() == 'profile' && $conv->get_profile_owner() == local_user())
555                                 return true; 
556
557                         // this fixes for visitors
558                         return ($this->writable || ($this->is_visiting() && $conv->get_mode() == 'profile'));
559                 }
560                 return $this->writable;
561         }
562
563         /**
564          * Count the total of our descendants
565          */
566         private function count_descendants() {
567                 $children = $this->get_children();
568                 $total = count($children);
569                 if($total > 0) {
570                         foreach($children as $child) {
571                                 $total += $child->count_descendants();
572                         }
573                 }
574                 return $total;
575         }
576
577         /**
578          * Get the template for the comment box
579          */
580         private function get_comment_box_template() {
581                 return $this->comment_box_template;
582         }
583
584         /**
585          * Get the comment box
586          *
587          * Returns:
588          *      _ The comment box string (empty if no comment box)
589          *      _ false on failure
590          */
591         private function get_comment_box($indent) {
592                 $a = $this->get_app();
593                 if(!$this->is_toplevel() && !(get_config('system','thread_allow') && $a->theme_thread_allow)) {
594                         return '';
595                 }
596                 
597                 $comment_box = '';
598                 $conv = $this->get_conversation();
599                 $template = get_markup_template($this->get_comment_box_template());
600                 $ww = '';
601                 if( ($conv->get_mode() === 'network') && $this->is_wall_to_wall() )
602                         $ww = 'ww';
603
604                 if($conv->is_writable() && $this->is_writable()) {
605                         $qc = $qcomment =  null;
606
607                         /*
608                          * Hmmm, code depending on the presence of a particular plugin?
609                          * This should be better if done by a hook
610                          */
611                         if(in_array('qcomment',$a->plugins)) {
612                                 $qc = ((local_user()) ? get_pconfig(local_user(),'qcomment','words') : null);
613                                 $qcomment = (($qc) ? explode("\n",$qc) : null);
614                         }
615                         $comment_box = replace_macros($template,array(
616                                 '$return_path' => '',
617                                 '$threaded' => $this->is_threaded(),
618 //                              '$jsreload' => (($conv->get_mode() === 'display') ? $_SESSION['return_url'] : ''),
619                                 '$jsreload' => '',
620                                 '$type' => (($conv->get_mode() === 'profile') ? 'wall-comment' : 'net-comment'),
621                                 '$id' => $this->get_id(),
622                                 '$parent' => $this->get_id(),
623                                 '$qcomment' => $qcomment,
624                                 '$profile_uid' =>  $conv->get_profile_owner(),
625                                 '$mylink' => $a->contact['url'],
626                                 '$mytitle' => t('This is you'),
627                                 '$myphoto' => $a->contact['thumb'],
628                                 '$comment' => t('Comment'),
629                                 '$submit' => t('Submit'),
630                                 '$edbold' => t('Bold'),
631                                 '$editalic' => t('Italic'),
632                                 '$eduline' => t('Underline'),
633                                 '$edquote' => t('Quote'),
634                                 '$edcode' => t('Code'),
635                                 '$edimg' => t('Image'),
636                                 '$edurl' => t('Link'),
637                                 '$edvideo' => t('Video'),
638                                 '$preview' => ((feature_enabled($conv->get_profile_owner(),'preview')) ? t('Preview') : ''),
639                                 '$indent' => $indent,
640                                 '$sourceapp' => t($a->sourcename),
641                                 '$ww' => (($conv->get_mode() === 'network') ? $ww : ''),
642                                 '$rand_num' => random_digits(12)
643                         ));
644                 }
645
646                 return $comment_box;
647         }
648
649         private function get_redirect_url() {
650                 return $this->redirect_url;
651         }
652
653         /**
654          * Check if we are a wall to wall item and set the relevant properties
655          */
656         protected function check_wall_to_wall() {
657                 $a = $this->get_app();
658                 $conv = $this->get_conversation();
659                 $this->wall_to_wall = false;
660                 
661                 if($this->is_toplevel()) {
662                         if( (! $this->get_data_value('self')) && ($conv->get_mode() !== 'profile')) {
663                                 if($this->get_data_value('wall')) {
664
665                                         // On the network page, I am the owner. On the display page it will be the profile owner.
666                                         // This will have been stored in $a->page_contact by our calling page.
667                                         // Put this person as the wall owner of the wall-to-wall notice.
668
669                                         $this->owner_url = zrl($a->page_contact['url']);
670                                         $this->owner_photo = $a->page_contact['thumb'];
671                                         $this->owner_name = $a->page_contact['name'];
672                                         $this->wall_to_wall = true;
673                                 }
674                                 else if($this->get_data_value('owner-link')) {
675
676                                         $owner_linkmatch = (($this->get_data_value('owner-link')) && link_compare($this->get_data_value('owner-link'),$this->get_data_value('author-link')));
677                                         $alias_linkmatch = (($this->get_data_value('alias')) && link_compare($this->get_data_value('alias'),$this->get_data_value('author-link')));
678                                         $owner_namematch = (($this->get_data_value('owner-name')) && $this->get_data_value('owner-name') == $this->get_data_value('author-name'));
679                                         if((! $owner_linkmatch) && (! $alias_linkmatch) && (! $owner_namematch)) {
680
681                                                 // The author url doesn't match the owner (typically the contact)
682                                                 // and also doesn't match the contact alias. 
683                                                 // The name match is a hack to catch several weird cases where URLs are 
684                                                 // all over the park. It can be tricked, but this prevents you from
685                                                 // seeing "Bob Smith to Bob Smith via Wall-to-wall" and you know darn
686                                                 // well that it's the same Bob Smith. 
687
688                                                 // But it could be somebody else with the same name. It just isn't highly likely. 
689                                                 
690
691                                                 $this->owner_photo = $this->get_data_value('owner-avatar');
692                                                 $this->owner_name = $this->get_data_value('owner-name');
693                                                 $this->wall_to_wall = true;
694                                                 // If it is our contact, use a friendly redirect link
695                                                 if((link_compare($this->get_data_value('owner-link'),$this->get_data_value('url'))) 
696                                                         && ($this->get_data_value('network') === NETWORK_DFRN)) {
697                                                         $this->owner_url = $this->get_redirect_url();
698                                                 }
699                                                 else
700                                                         $this->owner_url = zrl($this->get_data_value('owner-link'));
701                                         }
702                                 }
703                         }
704                 }
705
706                 if(!$this->wall_to_wall) {
707                         $this->set_template('wall');
708                         $this->owner_url = '';
709                         $this->owner_photo = '';
710                         $this->owner_name = '';
711                 }
712         }
713
714         private function is_wall_to_wall() {
715                 return $this->wall_to_wall;
716         }
717
718         private function get_owner_url() {
719                 return $this->owner_url;
720         }
721
722         private function get_owner_photo() {
723                 return $this->owner_photo;
724         }
725
726         private function get_owner_name() {
727                 return $this->owner_name;
728         }
729
730         private function is_visiting() {
731                 return $this->visiting;
732         }
733
734
735
736
737 }
738 ?>