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->link, $parsedobj->content);
116 $item['body'] = sprintf( t('%1$s tagged %2$s\'s %3$s with %4$s'), $author, $objauthor, $plink, $tag );
124 * "Render" a conversation or list of items for HTML display.
125 * There are two major forms of display:
126 * - Sequential or unthreaded ("New Item View" or search results)
127 * - conversation view
128 * The $mode parameter decides between the various renderings and also
129 * figures out how to determine page owner and other contextual items
130 * that are based on unique features of the calling module.
133 function conversation(&$a, $items, $mode, $update) {
135 require_once('bbcode.php');
138 $page_writeable = false;
140 if($mode === 'network') {
141 $profile_owner = local_user();
142 $page_writeable = true;
145 if($mode === 'profile') {
146 $profile_owner = $a->profile['profile_uid'];
147 $page_writeable = can_write_wall($a,$profile_owner);
150 if($mode === 'notes') {
151 $profile_owner = local_user();
152 $page_writeable = true;
155 if($mode === 'display') {
156 $profile_owner = $a->profile['uid'];
157 $page_writeable = can_write_wall($a,$profile_owner);
160 if($mode === 'community') {
162 $page_writeable = false;
166 $return_url = $_SESSION['return_url'];
168 $return_url = $_SESSION['return_url'] = $a->cmd;
170 load_contact_links(local_user());
173 $cmnt_tpl = get_markup_template('comment_item.tpl');
174 $tpl = get_markup_template('wall_item.tpl');
175 $wallwall = get_markup_template('wallwall_item.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] .= $arr['output'];
304 // Figure out how many comments each parent has
305 // (Comments all have gravity of 6)
306 // Store the result in the $comments array
309 foreach($items as $item) {
310 if((intval($item['gravity']) == 6) && ($item['id'] != $item['parent'])) {
311 if(! x($comments,$item['parent']))
312 $comments[$item['parent']] = 1;
314 $comments[$item['parent']] += 1;
318 // map all the like/dislike activities for each parent item
319 // Store these in the $alike and $dlike arrays
321 foreach($items as $item) {
322 like_puller($a,$item,$alike,'like');
323 like_puller($a,$item,$dlike,'dislike');
326 $comments_collapsed = false;
331 foreach($items as $item) {
337 $owner_url = $owner_photo = $owner_name = '';
339 // We've already parsed out like/dislike for special treatment. We can ignore them now
341 if(((activity_match($item['verb'],ACTIVITY_LIKE))
342 || (activity_match($item['verb'],ACTIVITY_DISLIKE)))
343 && ($item['id'] != $item['parent']))
346 $toplevelpost = (($item['id'] == $item['parent']) ? true : false);
347 $toplevelprivate = false;
349 // Take care of author collapsing and comment collapsing
350 // If a single author has more than 3 consecutive top-level posts, squash the remaining ones.
351 // If there are more than two comments, squash all but the last 2.
354 $toplevelprivate = (($toplevelpost && $item['private']) ? true : false);
355 $item_writeable = (($item['writable'] || $item['self']) ? true : false);
357 /*if($blowhard == $item['cid'] && (! $item['self']) && ($mode != 'profile') && ($mode != 'notes')) {
359 if($blowhard_count == 3) {
360 $o .= '<div class="icollapse-wrapper fakelink" id="icollapse-wrapper-' . $item['parent']
361 . '" onclick="openClose(' . '\'icollapse-' . $item['parent'] . '\'); $(\'#icollapse-wrapper-' . $item['parent'] . '\').hide();" >'
362 . t('See more posts like this') . '</div>' . '<div class="icollapse" id="icollapse-'
363 . $item['parent'] . '" style="display: none;" >';
367 $blowhard = $item['cid'];
368 if($blowhard_count >= 3)
374 $comments_collapsed = false;
377 $threads[$threadsid] = "";
380 // prevent private email from leaking into public conversation
381 if((! $toplevelpost) && (! toplevelprivate) && ($item['private']) && ($profile_owner != local_user()))
386 $override_comment_box = ((($page_writeable) && ($item_writeable)) ? true : false);
387 $show_comment_box = ((($page_writeable) && ($item_writeable) && ($comments_seen == $comments[$item['parent']])) ? true : false);
389 if(($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) {
390 if(! $comments_collapsed) {
391 $threads[$threadsid] .= '<div class="ccollapse-wrapper fakelink" id="ccollapse-wrapper-' . $item['parent']
392 . '" onclick="openClose(' . '\'ccollapse-' . $item['parent'] . '\'); $(\'#ccollapse-wrapper-' . $item['parent'] . '\').hide();" >'
393 . sprintf( t('See all %d comments'), $comments[$item['parent']]) . '</div>'
394 . '<div class="ccollapse" id="ccollapse-' . $item['parent'] . '" style="display: none;" >';
395 $comments_collapsed = true;
398 if(($comments[$item['parent']] > 2) && ($comments_seen == ($comments[$item['parent']] - 1))) {
399 $threads[$threadsid] .= '</div>';
402 $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
404 $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
405 || strlen($item['deny_cid']) || strlen($item['deny_gid']))))
406 ? t('Private Message')
410 // Top-level wall post not written by the wall owner (wall-to-wall)
411 // First figure out who owns it.
415 if(($toplevelpost) && (! $item['self']) && ($mode !== 'profile')) {
419 // On the network page, I am the owner. On the display page it will be the profile owner.
420 // This will have been stored in $a->page_contact by our calling page.
421 // Put this person on the left of the wall-to-wall notice.
423 $owner_url = $a->page_contact['url'];
424 $owner_photo = $a->page_contact['thumb'];
425 $owner_name = $a->page_contact['name'];
426 $template = $wallwall;
429 if((! $item['wall']) && (strlen($item['owner-link'])) && ($item['owner-link'] != $item['author-link'])) {
433 $owner_url = $item['owner-link'];
434 $owner_photo = $item['owner-avatar'];
435 $owner_name = $item['owner-name'];
436 $template = $wallwall;
438 // If it is our contact, use a friendly redirect link
439 if((link_compare($item['owner-link'],$item['url']))
440 && ($item['network'] === 'dfrn')) {
441 $owner_url = $redirect_url;
442 $osparkle = ' sparkle';
448 $shareable = ((($profile_owner == local_user()) && ($mode != 'display') && (! $item['private'])) ? true : false);
450 if($page_writeable) {
452 $likebuttons = array(
453 'like' => array( t("I like this \x28toggle\x29"), t("like")),
454 'dislike' => array( t("I don't like this \x28toggle\x29"), t("dislike")),
456 if ($shareable) $likebuttons['share'] = array( t('Share this'), t('share'));
459 if(($show_comment_box) || (($show_comment_box == false) && ($override_comment_box == false) && ($item['last-child']))) {
460 $comment = replace_macros($cmnt_tpl,array(
461 '$return_path' => '',
462 '$jsreload' => (($mode === 'display') ? $_SESSION['return_url'] : ''),
463 '$type' => (($mode === 'profile') ? 'wall-comment' : 'net-comment'),
464 '$id' => $item['item_id'],
465 '$parent' => $item['parent'],
466 '$profile_uid' => $profile_owner,
467 '$mylink' => $a->contact['url'],
468 '$mytitle' => t('This is you'),
469 '$myphoto' => $a->contact['thumb'],
470 '$comment' => t('Comment'),
471 '$submit' => t('Submit'),
472 '$ww' => (($mode === 'network') ? $commentww : '')
477 $edpost = (((($profile_owner == local_user()) && ($toplevelpost) && (intval($item['wall']) == 1)) || ($mode === 'notes'))
478 ? array($a->get_baseurl()."/editpost/".$item['id'], t("Edit"))
485 if((intval($item['contact-id']) && $item['contact-id'] == remote_user()) || ($item['uid'] == local_user()))
489 'dropping' => $dropping,
490 'select' => t('Select'),
491 'delete' => t('Delete'),
495 $isstarred = "unstarred";
496 if ($profile_owner == local_user() && $toplevelpost) {
497 $isstarred = (($item['starred']) ? "starred" : "unstarred");
500 'do' => t("add star"),
501 'undo' => t("remove star"),
502 'toggle' => t("toggle star status"),
503 'classdo' => (($item['starred']) ? "hidden" : ""),
504 'classundo' => (($item['starred']) ? "" : "hidden"),
505 'starred' => t('starred'),
506 'tagger' => t("add tag"),
513 $photo = $item['photo'];
514 $thumb = $item['thumb'];
516 // Post was remotely authored.
518 $diff_author = ((link_compare($item['url'],$item['author-link'])) ? false : true);
520 $profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
523 $profile_link = best_link_url($item,$sp);
525 $sparkle = ' sparkle';
527 if($profile_link === 'mailbox')
530 $normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
531 if(($normalised != 'mailbox') && (x($a->contacts,$normalised)))
532 $profile_avatar = $a->contacts[$normalised]['thumb'];
534 $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $thumb);
540 $like = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
541 $dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
543 $location = (($item['location']) ? '<a target="map" title="' . $item['location']
544 . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
545 $coord = (($item['coord']) ? '<a target="map" title="' . $item['coord']
546 . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
549 $location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
551 $location = '<span class="smalltext">' . $coord . '</span>';
554 $indent = (($toplevelpost) ? '' : ' comment');
556 if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
560 localize_item($item);
564 foreach(explode(',',$item['tag']) as $tag){
566 if ($tag!="") $tags[] = bbcode($tag);
572 $body = prepare_body($item,true);
575 $tmp_item = replace_macros($template,array(
576 '$type' => implode("",array_slice(split("/",$item['verb']),-1)),
578 '$body' => template_escape($body),
579 '$id' => $item['item_id'],
580 '$linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
581 '$olinktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
583 '$wall' => t('Wall-to-Wall'),
584 '$vwall' => t('via Wall-To-Wall:'),
585 '$profile_url' => $profile_link,
586 '$item_photo_menu' => item_photo_menu($item),
587 '$name' => template_escape($profile_name),
588 '$thumb' => $profile_avatar,
589 '$osparkle' => $osparkle,
590 '$sparkle' => $sparkle,
591 '$title' => template_escape($item['title']),
592 '$ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
594 '$location' => template_escape($location),
595 '$indent' => $indent,
596 '$owner_url' => $owner_url,
597 '$owner_photo' => $owner_photo,
598 '$owner_name' => template_escape($owner_name),
599 '$plink' => get_plink($item),
600 '$edpost' => $edpost,
601 '$isstarred' => $isstarred,
604 '$vote' => $likebuttons,
606 '$dislike' => $dislike,
607 '$comment' => $comment,
608 '$wait' => t('Please wait'),
613 $arr = array('item' => $item, 'output' => $tmp_item);
614 call_hooks('display_item', $arr);
616 $threads[$threadsid] .= $arr['output'];
622 // if author collapsing is in force but didn't get closed, close it off now.
624 /*if($blowhard_count >= 3)
625 $threads[$threadsid] .= '</div>';*/
627 $page_template = get_markup_template("conversation.tpl");
628 $o .= replace_macros($page_template, array(
629 '$threads' => $threads,
630 '$dropping' => ($dropping?t('Delete Selected Items'):False),
636 function best_link_url($item,&$sparkle) {
643 $clean_url = normalise_link($item['author-link']);
645 if((local_user()) && (local_user() == $item['uid'])) {
646 if(isset($a->contacts) && x($a->contacts,$clean_url)) {
647 if($a->contacts[$clean_url]['network'] === NETWORK_DFRN) {
648 $best_url = $a->get_baseurl() . '/redir/' . $a->contacts[$clean_url]['id'];
652 $best_url = $a->contacts[$clean_url]['url'];
656 if(strlen($item['author-link']))
657 $best_url = $item['author-link'];
659 $best_url = $item['url'];
666 if(! function_exists('item_photo_menu')){
667 function item_photo_menu($item){
670 if (local_user() && (! count($a->contacts)))
671 load_contact_links(local_user());
680 $profile_link = best_link_url($item,$sparkle);
681 if($profile_link === 'mailbox')
685 $cid = intval(basename($profile_link));
686 $status_link = $profile_link . "?url=status";
687 $photos_link = $profile_link . "?url=photos";
688 $profile_link = $profile_link . "?url=profile";
689 $pm_url = $a->get_baseurl() . '/message/new/' . $cid;
692 if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) {
693 $cid = $item['contact-id'];
699 if(($cid) && (! $item['self'])) {
700 $contact_url = $a->get_baseurl() . '/contacts/' . $cid;
701 $posts_link = $a->get_baseurl() . '/network/?cid=' . $cid;
705 t("View status") => $status_link,
706 t("View profile") => $profile_link,
707 t("View photos") => $photos_link,
708 t("View recent") => $posts_link,
709 t("Edit contact") => $contact_url,
710 t("Send PM") => $pm_url,
714 $args = array($item, &$menu);
716 call_hooks('item_photo_menu', $args);
719 foreach($menu as $k=>$v){
720 if ($v!="") $o .= "<li><a href='$v'>$k</a></li>\n";
725 if(! function_exists('like_puller')) {
726 function like_puller($a,$item,&$arr,$mode) {
730 $verb = (($mode === 'like') ? ACTIVITY_LIKE : ACTIVITY_DISLIKE);
732 if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) {
733 $url = $item['author-link'];
734 if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === 'dfrn') && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) {
735 $url = $a->get_baseurl() . '/redir/' . $item['contact-id'];
736 $sparkle = ' class="sparkle" ';
738 if(! ((isset($arr[$item['parent'] . '-l'])) && (is_array($arr[$item['parent'] . '-l']))))
739 $arr[$item['parent'] . '-l'] = array();
740 if(! isset($arr[$item['parent']]))
741 $arr[$item['parent']] = 1;
743 $arr[$item['parent']] ++;
744 $arr[$item['parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['author-name'] . '</a>';
749 // Format the like/dislike text for a profile item
750 // $cnt = number of people who like/dislike the item
751 // $arr = array of pre-linked names of likers/dislikers
752 // $type = one of 'like, 'dislike'
754 // returns formatted text
756 if(! function_exists('format_like')) {
757 function format_like($cnt,$arr,$type,$id) {
760 $o .= (($type === 'like') ? sprintf( t('%s likes this.'), $arr[0]) : sprintf( t('%s doesn\'t like this.'), $arr[0])) . EOL ;
762 $spanatts = 'class="fakelink" onclick="openClose(\'' . $type . 'list-' . $id . '\');"';
763 $o .= (($type === 'like') ?
764 sprintf( t('<span %1$s>%2$d people</span> like this.'), $spanatts, $cnt)
766 sprintf( t('<span %1$s>%2$d people</span> don\'t like this.'), $spanatts, $cnt) );
768 $total = count($arr);
769 if($total >= MAX_LIKERS)
770 $arr = array_slice($arr, 0, MAX_LIKERS - 1);
771 if($total < MAX_LIKERS)
772 $arr[count($arr)-1] = t('and') . ' ' . $arr[count($arr)-1];
773 $str = implode(', ', $arr);
774 if($total >= MAX_LIKERS)
775 $str .= sprintf( t(', and %d other people'), $total - MAX_LIKERS );
776 $str = (($type === 'like') ? sprintf( t('%s like this.'), $str) : sprintf( t('%s don\'t like this.'), $str));
777 $o .= "\t" . '<div id="' . $type . 'list-' . $id . '" style="display: none;" >' . $str . '</div>';
783 function status_editor($a,$x, $notes_cid = 0) {
787 $geotag = (($x['allow_location']) ? get_markup_template('jot_geotag.tpl') : '');
789 $tpl = get_markup_template('jot-header.tpl');
791 $a->page['htmlhead'] .= replace_macros($tpl, array(
792 '$newpost' => 'true',
793 '$baseurl' => $a->get_baseurl(),
794 '$geotag' => $geotag,
795 '$nickname' => $x['nickname'],
796 '$ispublic' => t('Visible to <strong>everybody</strong>'),
797 '$linkurl' => t('Please enter a link URL:'),
798 '$vidurl' => t("Please enter a video link/URL:"),
799 '$audurl' => t("Please enter an audio link/URL:"),
800 '$term' => t('Tag term:'),
801 '$whereareu' => t('Where are you right now?'),
802 '$title' => t('Enter a title for this item')
806 $tpl = get_markup_template("jot.tpl");
811 $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
813 $mail_enabled = false;
814 $pubmail_enabled = false;
816 if(($x['is_owner']) && (! $mail_disabled)) {
817 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
821 $mail_enabled = true;
822 if(intval($r[0]['pubmail']))
823 $pubmail_enabled = true;
828 $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
829 $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
830 . t("Post to Email") . '</div>';
833 call_hooks('jot_tool', $jotplugins);
834 call_hooks('jot_networks', $jotnets);
837 $jotnets .= '<input type="hidden" name="contact_allow[]" value="' . $notes_cid .'" />';
839 $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
841 $o .= replace_macros($tpl,array(
842 '$return_path' => $a->cmd,
844 '$share' => (($x['button']) ? $x['button'] : t('Share')),
845 '$upload' => t('Upload photo'),
846 '$attach' => t('Attach file'),
847 '$weblink' => t('Insert web link'),
848 '$video' => t('Insert video link'),
849 '$audio' => t('Insert audio link'),
850 '$setloc' => t('Set your location'),
851 '$noloc' => t('Clear browser location'),
852 '$title' => t('Set title'),
853 '$wait' => t('Please wait'),
854 '$permset' => t('Permission settings'),
855 '$ptyp' => (($notes_cid) ? 'note' : 'wall'),
858 '$baseurl' => $a->get_baseurl(),
859 '$defloc' => $x['default_location'],
860 '$visitor' => $x['visitor'],
861 '$pvisit' => (($notes_cid) ? 'none' : $x['visitor']),
862 '$emailcc' => t('CC: email addresses'),
863 '$public' => t('Public post'),
864 '$jotnets' => $jotnets,
865 '$emtitle' => t('Example: bob@example.com, mary@example.com'),
866 '$lockstate' => $x['lockstate'],
868 '$bang' => $x['bang'],
869 '$profile_uid' => $x['profile_uid'],