4 * Render actions localized
6 function localize_item(&$item){
7 $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
8 if ($item['verb']=== ACTIVITY_LIKE || $item['verb']=== ACTIVITY_DISLIKE){
10 $r = q("SELECT * from `item`,`contact` WHERE
11 `item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';",
12 dbesc($item['parent-uri']));
13 if(count($r)==0) return;
16 $author = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
17 $objauthor = '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]';
21 switch ($obj['object-type']){
22 case ACTIVITY_OBJ_EVENT:
23 $post_type = t('event');
26 $post_type = t('status');
30 if($obj['resource-id']){
31 $post_type = t('photo');
32 $m=array(); preg_match("/\[url=([^]]*)\]/", $obj['body'], $m);
35 $post_type = t('status');
39 $plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]';
41 switch($item['verb']){
43 $bodyverb = t('%1$s likes %2$s\'s %3$s');
45 case ACTIVITY_DISLIKE:
46 $bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s');
49 $item['body'] = sprintf($bodyverb, $author, $objauthor, $plink);
52 if ($item['verb']=== ACTIVITY_FRIEND){
54 if ($item['object-type']=="" || $item['object-type']!== ACTIVITY_OBJ_PERSON) return;
56 $Aname = $item['author-name'];
57 $Alink = $item['author-link'];
59 $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
61 $obj = parse_xml_string($xmlhead.$item['object']);
62 $links = parse_xml_string($xmlhead."<links>".unxmlify($obj->link)."</links>");
65 $Blink = ""; $Bphoto = "";
66 foreach ($links->link as $l){
67 $atts = $l->attributes();
69 case "alternate": $Blink = $atts['href'];
70 case "photo": $Bphoto = $atts['href'];
75 $A = '[url=' . $Alink . ']' . $Aname . '[/url]';
76 $B = '[url=' . $Blink . ']' . $Bname . '[/url]';
77 if ($Bphoto!="") $Bphoto = '[url=' . $Blink . '][img]' . $Bphoto . '[/img][/url]';
79 $item['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$Bphoto;
82 if ($item['verb']===ACTIVITY_TAG){
83 $r = q("SELECT * from `item`,`contact` WHERE
84 `item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';",
85 dbesc($item['parent-uri']));
86 if(count($r)==0) return;
89 $author = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
90 $objauthor = '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]';
94 switch ($obj['object-type']){
95 case ACTIVITY_OBJ_EVENT:
96 $post_type = t('event');
99 $post_type = t('status');
103 if($obj['resource-id']){
104 $post_type = t('photo');
105 $m=array(); preg_match("/\[url=([^]]*)\]/", $obj['body'], $m);
106 $rr['plink'] = $m[1];
108 $post_type = t('status');
111 $plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]';
113 $parsedobj = parse_xml_string($xmlhead.$item['object']);
115 $tag = sprintf('#[url=%s]%s[/url]', $parsedobj->id, $parsedobj->content);
116 $item['body'] = sprintf( t('%1$s tagged %2$s\'s %3$s with %4$s'), $author, $objauthor, $plink, $tag );
123 * "Render" a conversation or list of items for HTML display.
124 * There are two major forms of display:
125 * - Sequential or unthreaded ("New Item View" or search results)
126 * - conversation view
127 * The $mode parameter decides between the various renderings and also
128 * figures out how to determine page owner and other contextual items
129 * that are based on unique features of the calling module.
132 function conversation(&$a, $items, $mode, $update) {
134 require_once('bbcode.php');
137 $page_writeable = false;
139 if($mode === 'network') {
140 $profile_owner = local_user();
141 $page_writeable = true;
144 if($mode === 'profile') {
145 $profile_owner = $a->profile['profile_uid'];
146 $page_writeable = can_write_wall($a,$profile_owner);
149 if($mode === 'notes') {
150 $profile_owner = local_user();
151 $page_writeable = true;
154 if($mode === 'display') {
155 $profile_owner = $a->profile['uid'];
156 $page_writeable = can_write_wall($a,$profile_owner);
159 if($mode === 'community') {
161 $page_writeable = false;
165 $return_url = $_SESSION['return_url'];
167 $return_url = $_SESSION['return_url'] = $a->cmd;
169 load_contact_links(local_user());
172 $cmnt_tpl = get_markup_template('comment_item.tpl');
173 $tpl = get_markup_template('wall_item.tpl');
174 $wallwall = get_markup_template('wallwall_item.tpl');
175 $hide_comments_tpl = get_markup_template('hide_comments.tpl');
181 // array with html for each thread (parent+comments)
187 if($mode === 'network-new' || $mode === 'search' || $mode === 'community') {
189 // "New Item View" on network page or search page results
190 // - just loop through the items and format them minimally for display
192 $tpl = get_markup_template('search_item.tpl');
194 foreach($items as $item) {
203 if($mode === 'search' || $mode === 'community') {
204 if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE)))
205 && ($item['id'] != $item['parent']))
207 $nickname = $item['nickname'];
210 $nickname = $a->user['nickname'];
212 $profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']);
215 $profile_link = best_link_url($item,$sp);
217 $sparkle = ' sparkle';
218 if($profile_link === 'mailbox')
222 $normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
223 if(($normalised != 'mailbox') && (x($a->contacts[$normalised])))
224 $profile_avatar = $a->contacts[$normalised]['thumb'];
226 $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']);
228 $location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
229 $coord = (($item['coord']) ? '<a target="map" title="' . $item['coord'] . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
232 $location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
234 $location = '<span class="smalltext">' . $coord . '</span>';
238 localize_item($item);
239 if($mode === 'network-new')
246 'dropping' => $dropping,
247 'select' => t('Select'),
248 'delete' => t('Delete'),
252 $isstarred = "unstarred";
255 $likebuttons = false;
258 $body = prepare_body($item,true);
260 $tmp_item = replace_macros($tpl,array(
261 '$id' => $item['item_id'],
262 '$linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
263 '$profile_url' => $profile_link,
264 '$item_photo_menu' => item_photo_menu($item),
265 '$name' => template_escape($profile_name),
266 '$sparkle' => $sparkle,
268 '$thumb' => $profile_avatar,
269 '$title' => template_escape($item['title']),
270 '$body' => template_escape($body),
271 '$ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
273 '$location' => template_escape($location),
275 '$owner_name' => template_escape($owner_name),
276 '$owner_url' => $owner_url,
277 '$owner_photo' => $owner_photo,
278 '$plink' => get_plink($item),
280 '$isstarred' => $isstarred,
283 '$vote' => $likebuttons,
287 '$conv' => array('href'=> $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context')),
288 '$wait' => t('Please wait'),
291 $arr = array('item' => $item, 'output' => $tmp_item);
292 call_hooks('display_item', $arr);
294 $threads[$threadsid]['id'] = $arr[$item['item_id']];
295 $threads[$threadsid]['html'] .= $arr['output'];
305 // Figure out how many comments each parent has
306 // (Comments all have gravity of 6)
307 // Store the result in the $comments array
310 foreach($items as $item) {
311 if((intval($item['gravity']) == 6) && ($item['id'] != $item['parent'])) {
312 if(! x($comments,$item['parent']))
313 $comments[$item['parent']] = 1;
315 $comments[$item['parent']] += 1;
319 // map all the like/dislike activities for each parent item
320 // Store these in the $alike and $dlike arrays
322 foreach($items as $item) {
323 like_puller($a,$item,$alike,'like');
324 like_puller($a,$item,$dlike,'dislike');
327 $comments_collapsed = false;
332 foreach($items as $item) {
338 $owner_url = $owner_photo = $owner_name = '';
340 // We've already parsed out like/dislike for special treatment. We can ignore them now
342 if(((activity_match($item['verb'],ACTIVITY_LIKE))
343 || (activity_match($item['verb'],ACTIVITY_DISLIKE)))
344 && ($item['id'] != $item['parent']))
347 $toplevelpost = (($item['id'] == $item['parent']) ? true : false);
348 $toplevelprivate = false;
350 // Take care of author collapsing and comment collapsing
351 // If a single author has more than 3 consecutive top-level posts, squash the remaining ones.
352 // If there are more than two comments, squash all but the last 2.
355 $toplevelprivate = (($toplevelpost && $item['private']) ? true : false);
356 $item_writeable = (($item['writable'] || $item['self']) ? true : false);
358 /*if($blowhard == $item['cid'] && (! $item['self']) && ($mode != 'profile') && ($mode != 'notes')) {
360 if($blowhard_count == 3) {
361 $o .= '<div class="icollapse-wrapper fakelink" id="icollapse-wrapper-' . $item['parent']
362 . '" onclick="openClose(' . '\'icollapse-' . $item['parent'] . '\'); $(\'#icollapse-wrapper-' . $item['parent'] . '\').hide();" >'
363 . t('See more posts like this') . '</div>' . '<div class="icollapse" id="icollapse-'
364 . $item['parent'] . '" style="display: none;" >';
368 $blowhard = $item['cid'];
369 if($blowhard_count >= 3)
375 $comments_collapsed = false;
378 $threads[$threadsid]['id'] = $item['item_id'];
379 $threads[$threadsid]['html'] = "";
383 // prevent private email from leaking into public conversation
384 if((! $toplevelpost) && (! toplevelprivate) && ($item['private']) && ($profile_owner != local_user()))
389 $override_comment_box = ((($page_writeable) && ($item_writeable)) ? true : false);
390 $show_comment_box = ((($page_writeable) && ($item_writeable) && ($comments_seen == $comments[$item['parent']])) ? true : false);
393 if(($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) {
394 if(! $comments_collapsed) {
396 // IMPORTANT: the closing </div> in the hide_comments template
397 // is supplied below in code.
399 $threads[$threadsid]['html'] .= replace_macros($hide_comments_tpl,array(
400 '$id' => $item['parent'],
401 '$num_comments' => sprintf( tt('%d comment','%d comments',$comments[$item['parent']]),
402 $comments[$item['parent']]),
403 '$display' => 'none',
404 '$hide_text' => t('show more')
406 $comments_collapsed = true;
409 if(($comments[$item['parent']] > 2) && ($comments_seen == ($comments[$item['parent']] - 1))) {
410 $threads[$threadsid]['html'] .= '</div>';
413 $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
415 $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
416 || strlen($item['deny_cid']) || strlen($item['deny_gid']))))
417 ? t('Private Message')
421 // Top-level wall post not written by the wall owner (wall-to-wall)
422 // First figure out who owns it.
426 if(($toplevelpost) && (! $item['self']) && ($mode !== 'profile')) {
430 // On the network page, I am the owner. On the display page it will be the profile owner.
431 // This will have been stored in $a->page_contact by our calling page.
432 // Put this person on the left of the wall-to-wall notice.
434 $owner_url = $a->page_contact['url'];
435 $owner_photo = $a->page_contact['thumb'];
436 $owner_name = $a->page_contact['name'];
437 $template = $wallwall;
440 if((! $item['wall']) && (strlen($item['owner-link'])) && ($item['owner-link'] != $item['author-link'])) {
444 $owner_url = $item['owner-link'];
445 $owner_photo = $item['owner-avatar'];
446 $owner_name = $item['owner-name'];
447 $template = $wallwall;
449 // If it is our contact, use a friendly redirect link
450 if((link_compare($item['owner-link'],$item['url']))
451 && ($item['network'] === 'dfrn')) {
452 $owner_url = $redirect_url;
453 $osparkle = ' sparkle';
459 $shareable = ((($profile_owner == local_user()) && ($mode != 'display') && (! $item['private'])) ? true : false);
461 if($page_writeable) {
463 $likebuttons = array(
464 'like' => array( t("I like this \x28toggle\x29"), t("like")),
465 'dislike' => array( t("I don't like this \x28toggle\x29"), t("dislike")),
467 if ($shareable) $likebuttons['share'] = array( t('Share this'), t('share'));
470 if(($show_comment_box) || (($show_comment_box == false) && ($override_comment_box == false) && ($item['last-child']))) {
471 $comment = replace_macros($cmnt_tpl,array(
472 '$return_path' => '',
473 '$jsreload' => (($mode === 'display') ? $_SESSION['return_url'] : ''),
474 '$type' => (($mode === 'profile') ? 'wall-comment' : 'net-comment'),
475 '$id' => $item['item_id'],
476 '$parent' => $item['parent'],
477 '$profile_uid' => $profile_owner,
478 '$mylink' => $a->contact['url'],
479 '$mytitle' => t('This is you'),
480 '$myphoto' => $a->contact['thumb'],
481 '$comment' => t('Comment'),
482 '$submit' => t('Submit'),
483 '$ww' => (($mode === 'network') ? $commentww : '')
488 $edpost = (((($profile_owner == local_user()) && ($toplevelpost) && (intval($item['wall']) == 1)) || ($mode === 'notes'))
489 ? array($a->get_baseurl()."/editpost/".$item['id'], t("Edit"))
496 if((intval($item['contact-id']) && $item['contact-id'] == remote_user()) || ($item['uid'] == local_user()))
500 'dropping' => $dropping,
501 'select' => t('Select'),
502 'delete' => t('Delete'),
506 $isstarred = "unstarred";
507 if ($profile_owner == local_user() && $toplevelpost) {
508 $isstarred = (($item['starred']) ? "starred" : "unstarred");
511 'do' => t("add star"),
512 'undo' => t("remove star"),
513 'toggle' => t("toggle star status"),
514 'classdo' => (($item['starred']) ? "hidden" : ""),
515 'classundo' => (($item['starred']) ? "" : "hidden"),
516 'starred' => t('starred'),
517 'tagger' => t("add tag"),
524 $photo = $item['photo'];
525 $thumb = $item['thumb'];
527 // Post was remotely authored.
529 $diff_author = ((link_compare($item['url'],$item['author-link'])) ? false : true);
531 $profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
534 $profile_link = best_link_url($item,$sp);
536 $sparkle = ' sparkle';
538 if($profile_link === 'mailbox')
541 $normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
542 if(($normalised != 'mailbox') && (x($a->contacts,$normalised)))
543 $profile_avatar = $a->contacts[$normalised]['thumb'];
545 $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $thumb);
551 $like = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
552 $dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
554 $location = (($item['location']) ? '<a target="map" title="' . $item['location']
555 . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
556 $coord = (($item['coord']) ? '<a target="map" title="' . $item['coord']
557 . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
560 $location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
562 $location = '<span class="smalltext">' . $coord . '</span>';
565 $indent = (($toplevelpost) ? '' : ' comment');
567 if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
571 localize_item($item);
575 foreach(explode(',',$item['tag']) as $tag){
577 if ($tag!="") $tags[] = bbcode($tag);
583 $body = prepare_body($item,true);
586 $tmp_item = replace_macros($template,array(
587 '$type' => implode("",array_slice(split("/",$item['verb']),-1)),
589 '$body' => template_escape($body),
590 '$id' => $item['item_id'],
591 '$linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
592 '$olinktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
594 '$wall' => t('Wall-to-Wall'),
595 '$vwall' => t('via Wall-To-Wall:'),
596 '$profile_url' => $profile_link,
597 '$item_photo_menu' => item_photo_menu($item),
598 '$name' => template_escape($profile_name),
599 '$thumb' => $profile_avatar,
600 '$osparkle' => $osparkle,
601 '$sparkle' => $sparkle,
602 '$title' => template_escape($item['title']),
603 '$ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
605 '$location' => template_escape($location),
606 '$indent' => $indent,
607 '$owner_url' => $owner_url,
608 '$owner_photo' => $owner_photo,
609 '$owner_name' => template_escape($owner_name),
610 '$plink' => get_plink($item),
611 '$edpost' => $edpost,
612 '$isstarred' => $isstarred,
615 '$vote' => $likebuttons,
617 '$dislike' => $dislike,
618 '$comment' => $comment,
619 '$wait' => t('Please wait'),
624 $arr = array('item' => $item, 'output' => $tmp_item);
625 call_hooks('display_item', $arr);
627 $threads[$threadsid]['html'] .= $arr['output'];
633 $page_template = get_markup_template("conversation.tpl");
634 $o .= replace_macros($page_template, array(
635 '$threads' => $threads,
636 '$dropping' => ($dropping?t('Delete Selected Items'):False),
642 function best_link_url($item,&$sparkle) {
649 $clean_url = normalise_link($item['author-link']);
651 if((local_user()) && (local_user() == $item['uid'])) {
652 if(isset($a->contacts) && x($a->contacts,$clean_url)) {
653 if($a->contacts[$clean_url]['network'] === NETWORK_DFRN) {
654 $best_url = $a->get_baseurl() . '/redir/' . $a->contacts[$clean_url]['id'];
658 $best_url = $a->contacts[$clean_url]['url'];
662 if(strlen($item['author-link']))
663 $best_url = $item['author-link'];
665 $best_url = $item['url'];
672 if(! function_exists('item_photo_menu')){
673 function item_photo_menu($item){
676 if (local_user() && (! count($a->contacts)))
677 load_contact_links(local_user());
686 $profile_link = best_link_url($item,$sparkle);
687 if($profile_link === 'mailbox')
691 $cid = intval(basename($profile_link));
692 $status_link = $profile_link . "?url=status";
693 $photos_link = $profile_link . "?url=photos";
694 $profile_link = $profile_link . "?url=profile";
695 $pm_url = $a->get_baseurl() . '/message/new/' . $cid;
698 if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) {
699 $cid = $item['contact-id'];
705 if(($cid) && (! $item['self'])) {
706 $contact_url = $a->get_baseurl() . '/contacts/' . $cid;
707 $posts_link = $a->get_baseurl() . '/network/?cid=' . $cid;
711 t("View status") => $status_link,
712 t("View profile") => $profile_link,
713 t("View photos") => $photos_link,
714 t("View recent") => $posts_link,
715 t("Edit contact") => $contact_url,
716 t("Send PM") => $pm_url,
720 $args = array($item, &$menu);
722 call_hooks('item_photo_menu', $args);
725 foreach($menu as $k=>$v){
726 if ($v!="") $o .= "<li><a href='$v'>$k</a></li>\n";
731 if(! function_exists('like_puller')) {
732 function like_puller($a,$item,&$arr,$mode) {
736 $verb = (($mode === 'like') ? ACTIVITY_LIKE : ACTIVITY_DISLIKE);
738 if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) {
739 $url = $item['author-link'];
740 if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === 'dfrn') && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) {
741 $url = $a->get_baseurl() . '/redir/' . $item['contact-id'];
742 $sparkle = ' class="sparkle" ';
744 if(! ((isset($arr[$item['parent'] . '-l'])) && (is_array($arr[$item['parent'] . '-l']))))
745 $arr[$item['parent'] . '-l'] = array();
746 if(! isset($arr[$item['parent']]))
747 $arr[$item['parent']] = 1;
749 $arr[$item['parent']] ++;
750 $arr[$item['parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['author-name'] . '</a>';
755 // Format the like/dislike text for a profile item
756 // $cnt = number of people who like/dislike the item
757 // $arr = array of pre-linked names of likers/dislikers
758 // $type = one of 'like, 'dislike'
760 // returns formatted text
762 if(! function_exists('format_like')) {
763 function format_like($cnt,$arr,$type,$id) {
766 $o .= (($type === 'like') ? sprintf( t('%s likes this.'), $arr[0]) : sprintf( t('%s doesn\'t like this.'), $arr[0])) . EOL ;
768 $spanatts = 'class="fakelink" onclick="openClose(\'' . $type . 'list-' . $id . '\');"';
769 $o .= (($type === 'like') ?
770 sprintf( t('<span %1$s>%2$d people</span> like this.'), $spanatts, $cnt)
772 sprintf( t('<span %1$s>%2$d people</span> don\'t like this.'), $spanatts, $cnt) );
774 $total = count($arr);
775 if($total >= MAX_LIKERS)
776 $arr = array_slice($arr, 0, MAX_LIKERS - 1);
777 if($total < MAX_LIKERS)
778 $arr[count($arr)-1] = t('and') . ' ' . $arr[count($arr)-1];
779 $str = implode(', ', $arr);
780 if($total >= MAX_LIKERS)
781 $str .= sprintf( t(', and %d other people'), $total - MAX_LIKERS );
782 $str = (($type === 'like') ? sprintf( t('%s like this.'), $str) : sprintf( t('%s don\'t like this.'), $str));
783 $o .= "\t" . '<div id="' . $type . 'list-' . $id . '" style="display: none;" >' . $str . '</div>';
789 function status_editor($a,$x, $notes_cid = 0) {
793 $geotag = (($x['allow_location']) ? get_markup_template('jot_geotag.tpl') : '');
795 $tpl = get_markup_template('jot-header.tpl');
797 $a->page['htmlhead'] .= replace_macros($tpl, array(
798 '$newpost' => 'true',
799 '$baseurl' => $a->get_baseurl(),
800 '$geotag' => $geotag,
801 '$nickname' => $x['nickname'],
802 '$ispublic' => t('Visible to <strong>everybody</strong>'),
803 '$linkurl' => t('Please enter a link URL:'),
804 '$vidurl' => t("Please enter a video link/URL:"),
805 '$audurl' => t("Please enter an audio link/URL:"),
806 '$term' => t('Tag term:'),
807 '$whereareu' => t('Where are you right now?'),
808 '$title' => t('Enter a title for this item')
812 $tpl = get_markup_template("jot.tpl");
817 $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
819 $mail_enabled = false;
820 $pubmail_enabled = false;
822 if(($x['is_owner']) && (! $mail_disabled)) {
823 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
827 $mail_enabled = true;
828 if(intval($r[0]['pubmail']))
829 $pubmail_enabled = true;
834 $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
835 $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
836 . t("Post to Email") . '</div>';
839 call_hooks('jot_tool', $jotplugins);
840 call_hooks('jot_networks', $jotnets);
843 $jotnets .= '<input type="hidden" name="contact_allow[]" value="' . $notes_cid .'" />';
845 $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
847 $o .= replace_macros($tpl,array(
848 '$return_path' => $a->cmd,
850 '$share' => (($x['button']) ? $x['button'] : t('Share')),
851 '$upload' => t('Upload photo'),
852 '$attach' => t('Attach file'),
853 '$weblink' => t('Insert web link'),
854 '$video' => t('Insert video link'),
855 '$audio' => t('Insert audio link'),
856 '$setloc' => t('Set your location'),
857 '$noloc' => t('Clear browser location'),
858 '$title' => t('Set title'),
859 '$wait' => t('Please wait'),
860 '$permset' => t('Permission settings'),
861 '$ptyp' => (($notes_cid) ? 'note' : 'wall'),
864 '$baseurl' => $a->get_baseurl(),
865 '$defloc' => $x['default_location'],
866 '$visitor' => $x['visitor'],
867 '$pvisit' => (($notes_cid) ? 'none' : $x['visitor']),
868 '$emailcc' => t('CC: email addresses'),
869 '$public' => t('Public post'),
870 '$jotnets' => $jotnets,
871 '$emtitle' => t('Example: bob@example.com, mary@example.com'),
872 '$lockstate' => $x['lockstate'],
874 '$bang' => $x['bang'],
875 '$profile_uid' => $x['profile_uid'],