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'];
213 $profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']);
214 if($item['author-link'] && (! $item['author-name']))
215 $profile_name = $item['author-link'];
218 $profile_link = best_link_url($item,$sp);
220 $sparkle = ' sparkle';
221 if($profile_link === 'mailbox')
225 $normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
226 if(($normalised != 'mailbox') && (x($a->contacts[$normalised])))
227 $profile_avatar = $a->contacts[$normalised]['thumb'];
229 $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']);
231 $location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
232 $coord = (($item['coord']) ? '<a target="map" title="' . $item['coord'] . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
235 $location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
237 $location = '<span class="smalltext">' . $coord . '</span>';
241 localize_item($item);
242 if($mode === 'network-new')
249 'dropping' => $dropping,
250 'select' => t('Select'),
251 'delete' => t('Delete'),
255 $isstarred = "unstarred";
258 $likebuttons = false;
261 $body = prepare_body($item,true);
263 $tmp_item = replace_macros($tpl,array(
264 '$id' => $item['item_id'],
265 '$linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
266 '$profile_url' => $profile_link,
267 '$item_photo_menu' => item_photo_menu($item),
268 '$name' => template_escape($profile_name),
269 '$sparkle' => $sparkle,
271 '$thumb' => $profile_avatar,
272 '$title' => template_escape($item['title']),
273 '$body' => template_escape($body),
274 '$ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
276 '$location' => template_escape($location),
278 '$owner_name' => template_escape($owner_name),
279 '$owner_url' => $owner_url,
280 '$owner_photo' => $owner_photo,
281 '$plink' => get_plink($item),
283 '$isstarred' => $isstarred,
286 '$vote' => $likebuttons,
290 '$conv' => array('href'=> $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context')),
291 '$wait' => t('Please wait'),
294 $arr = array('item' => $item, 'output' => $tmp_item);
295 call_hooks('display_item', $arr);
297 $threads[$threadsid]['id'] = $arr[$item['item_id']];
298 $threads[$threadsid]['html'] .= $arr['output'];
308 // Figure out how many comments each parent has
309 // (Comments all have gravity of 6)
310 // Store the result in the $comments array
313 foreach($items as $item) {
314 if((intval($item['gravity']) == 6) && ($item['id'] != $item['parent'])) {
315 if(! x($comments,$item['parent']))
316 $comments[$item['parent']] = 1;
318 $comments[$item['parent']] += 1;
322 // map all the like/dislike activities for each parent item
323 // Store these in the $alike and $dlike arrays
325 foreach($items as $item) {
326 like_puller($a,$item,$alike,'like');
327 like_puller($a,$item,$dlike,'dislike');
330 $comments_collapsed = false;
335 foreach($items as $item) {
341 $owner_url = $owner_photo = $owner_name = '';
343 // We've already parsed out like/dislike for special treatment. We can ignore them now
345 if(((activity_match($item['verb'],ACTIVITY_LIKE))
346 || (activity_match($item['verb'],ACTIVITY_DISLIKE)))
347 && ($item['id'] != $item['parent']))
350 $toplevelpost = (($item['id'] == $item['parent']) ? true : false);
351 $toplevelprivate = false;
353 // Take care of author collapsing and comment collapsing
354 // If a single author has more than 3 consecutive top-level posts, squash the remaining ones.
355 // If there are more than two comments, squash all but the last 2.
358 $toplevelprivate = (($toplevelpost && $item['private']) ? true : false);
359 $item_writeable = (($item['writable'] || $item['self']) ? true : false);
361 /*if($blowhard == $item['cid'] && (! $item['self']) && ($mode != 'profile') && ($mode != 'notes')) {
363 if($blowhard_count == 3) {
364 $o .= '<div class="icollapse-wrapper fakelink" id="icollapse-wrapper-' . $item['parent']
365 . '" onclick="openClose(' . '\'icollapse-' . $item['parent'] . '\'); $(\'#icollapse-wrapper-' . $item['parent'] . '\').hide();" >'
366 . t('See more posts like this') . '</div>' . '<div class="icollapse" id="icollapse-'
367 . $item['parent'] . '" style="display: none;" >';
371 $blowhard = $item['cid'];
372 if($blowhard_count >= 3)
378 $comments_collapsed = false;
381 $threads[$threadsid]['id'] = $item['item_id'];
382 $threads[$threadsid]['html'] = "";
386 // prevent private email from leaking into public conversation
387 if((! $toplevelpost) && (! toplevelprivate) && ($item['private']) && ($profile_owner != local_user()))
392 $override_comment_box = ((($page_writeable) && ($item_writeable)) ? true : false);
393 $show_comment_box = ((($page_writeable) && ($item_writeable) && ($comments_seen == $comments[$item['parent']])) ? true : false);
396 if(($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) {
397 if(! $comments_collapsed) {
399 // IMPORTANT: the closing </div> in the hide_comments template
400 // is supplied below in code.
402 $threads[$threadsid]['html'] .= replace_macros($hide_comments_tpl,array(
403 '$id' => $item['parent'],
404 '$num_comments' => sprintf( tt('%d comment','%d comments',$comments[$item['parent']]),
405 $comments[$item['parent']]),
406 '$display' => 'none',
407 '$hide_text' => t('show more')
409 $comments_collapsed = true;
412 if(($comments[$item['parent']] > 2) && ($comments_seen == ($comments[$item['parent']] - 1))) {
413 $threads[$threadsid]['html'] .= '</div>';
416 $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
418 $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
419 || strlen($item['deny_cid']) || strlen($item['deny_gid']))))
420 ? t('Private Message')
424 // Top-level wall post not written by the wall owner (wall-to-wall)
425 // First figure out who owns it.
429 if(($toplevelpost) && (! $item['self']) && ($mode !== 'profile')) {
433 // On the network page, I am the owner. On the display page it will be the profile owner.
434 // This will have been stored in $a->page_contact by our calling page.
435 // Put this person on the left of the wall-to-wall notice.
437 $owner_url = $a->page_contact['url'];
438 $owner_photo = $a->page_contact['thumb'];
439 $owner_name = $a->page_contact['name'];
440 $template = $wallwall;
443 if((! $item['wall']) && (strlen($item['owner-link'])) && ($item['owner-link'] != $item['author-link'])) {
447 $owner_url = $item['owner-link'];
448 $owner_photo = $item['owner-avatar'];
449 $owner_name = $item['owner-name'];
450 $template = $wallwall;
452 // If it is our contact, use a friendly redirect link
453 if((link_compare($item['owner-link'],$item['url']))
454 && ($item['network'] === 'dfrn')) {
455 $owner_url = $redirect_url;
456 $osparkle = ' sparkle';
462 $shareable = ((($profile_owner == local_user()) && ($mode != 'display') && (! $item['private'])) ? true : false);
464 if($page_writeable) {
466 $likebuttons = array(
467 'like' => array( t("I like this \x28toggle\x29"), t("like")),
468 'dislike' => array( t("I don't like this \x28toggle\x29"), t("dislike")),
470 if ($shareable) $likebuttons['share'] = array( t('Share this'), t('share'));
473 if(($show_comment_box) || (($show_comment_box == false) && ($override_comment_box == false) && ($item['last-child']))) {
474 $comment = replace_macros($cmnt_tpl,array(
475 '$return_path' => '',
476 '$jsreload' => (($mode === 'display') ? $_SESSION['return_url'] : ''),
477 '$type' => (($mode === 'profile') ? 'wall-comment' : 'net-comment'),
478 '$id' => $item['item_id'],
479 '$parent' => $item['parent'],
480 '$profile_uid' => $profile_owner,
481 '$mylink' => $a->contact['url'],
482 '$mytitle' => t('This is you'),
483 '$myphoto' => $a->contact['thumb'],
484 '$comment' => t('Comment'),
485 '$submit' => t('Submit'),
486 '$ww' => (($mode === 'network') ? $commentww : '')
491 $edpost = (((($profile_owner == local_user()) && ($toplevelpost) && (intval($item['wall']) == 1)) || ($mode === 'notes'))
492 ? array($a->get_baseurl()."/editpost/".$item['id'], t("Edit"))
499 if((intval($item['contact-id']) && $item['contact-id'] == remote_user()) || ($item['uid'] == local_user()))
503 'dropping' => $dropping,
504 'select' => t('Select'),
505 'delete' => t('Delete'),
509 $isstarred = "unstarred";
510 if ($profile_owner == local_user() && $toplevelpost) {
511 $isstarred = (($item['starred']) ? "starred" : "unstarred");
514 'do' => t("add star"),
515 'undo' => t("remove star"),
516 'toggle' => t("toggle star status"),
517 'classdo' => (($item['starred']) ? "hidden" : ""),
518 'classundo' => (($item['starred']) ? "" : "hidden"),
519 'starred' => t('starred'),
520 'tagger' => t("add tag"),
527 $photo = $item['photo'];
528 $thumb = $item['thumb'];
530 // Post was remotely authored.
532 $diff_author = ((link_compare($item['url'],$item['author-link'])) ? false : true);
534 $profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
536 if($item['author-link'] && (! $item['author-name']))
537 $profile_name = $item['author-link'];
541 $profile_link = best_link_url($item,$sp);
543 $sparkle = ' sparkle';
545 if($profile_link === 'mailbox')
548 $normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
549 if(($normalised != 'mailbox') && (x($a->contacts,$normalised)))
550 $profile_avatar = $a->contacts[$normalised]['thumb'];
552 $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $thumb);
558 $like = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
559 $dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
561 $location = (($item['location']) ? '<a target="map" title="' . $item['location']
562 . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
563 $coord = (($item['coord']) ? '<a target="map" title="' . $item['coord']
564 . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
567 $location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
569 $location = '<span class="smalltext">' . $coord . '</span>';
572 $indent = (($toplevelpost) ? '' : ' comment');
574 if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
578 localize_item($item);
582 foreach(explode(',',$item['tag']) as $tag){
584 if ($tag!="") $tags[] = bbcode($tag);
590 $body = prepare_body($item,true);
593 $tmp_item = replace_macros($template,array(
594 '$type' => implode("",array_slice(split("/",$item['verb']),-1)),
596 '$body' => template_escape($body),
597 '$id' => $item['item_id'],
598 '$linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
599 '$olinktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
601 '$wall' => t('Wall-to-Wall'),
602 '$vwall' => t('via Wall-To-Wall:'),
603 '$profile_url' => $profile_link,
604 '$item_photo_menu' => item_photo_menu($item),
605 '$name' => template_escape($profile_name),
606 '$thumb' => $profile_avatar,
607 '$osparkle' => $osparkle,
608 '$sparkle' => $sparkle,
609 '$title' => template_escape($item['title']),
610 '$ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
612 '$location' => template_escape($location),
613 '$indent' => $indent,
614 '$owner_url' => $owner_url,
615 '$owner_photo' => $owner_photo,
616 '$owner_name' => template_escape($owner_name),
617 '$plink' => get_plink($item),
618 '$edpost' => $edpost,
619 '$isstarred' => $isstarred,
622 '$vote' => $likebuttons,
624 '$dislike' => $dislike,
625 '$comment' => $comment,
626 '$wait' => t('Please wait'),
631 $arr = array('item' => $item, 'output' => $tmp_item);
632 call_hooks('display_item', $arr);
634 $threads[$threadsid]['html'] .= $arr['output'];
640 $page_template = get_markup_template("conversation.tpl");
641 $o .= replace_macros($page_template, array(
642 '$threads' => $threads,
643 '$dropping' => ($dropping?t('Delete Selected Items'):False),
649 function best_link_url($item,&$sparkle) {
656 $clean_url = normalise_link($item['author-link']);
658 if((local_user()) && (local_user() == $item['uid'])) {
659 if(isset($a->contacts) && x($a->contacts,$clean_url)) {
660 if($a->contacts[$clean_url]['network'] === NETWORK_DFRN) {
661 $best_url = $a->get_baseurl() . '/redir/' . $a->contacts[$clean_url]['id'];
665 $best_url = $a->contacts[$clean_url]['url'];
669 if(strlen($item['author-link']))
670 $best_url = $item['author-link'];
672 $best_url = $item['url'];
679 if(! function_exists('item_photo_menu')){
680 function item_photo_menu($item){
683 if (local_user() && (! count($a->contacts)))
684 load_contact_links(local_user());
693 $profile_link = best_link_url($item,$sparkle);
694 if($profile_link === 'mailbox')
698 $cid = intval(basename($profile_link));
699 $status_link = $profile_link . "?url=status";
700 $photos_link = $profile_link . "?url=photos";
701 $profile_link = $profile_link . "?url=profile";
702 $pm_url = $a->get_baseurl() . '/message/new/' . $cid;
705 if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) {
706 $cid = $item['contact-id'];
712 if(($cid) && (! $item['self'])) {
713 $contact_url = $a->get_baseurl() . '/contacts/' . $cid;
714 $posts_link = $a->get_baseurl() . '/network/?cid=' . $cid;
718 t("View status") => $status_link,
719 t("View profile") => $profile_link,
720 t("View photos") => $photos_link,
721 t("View recent") => $posts_link,
722 t("Edit contact") => $contact_url,
723 t("Send PM") => $pm_url,
727 $args = array($item, &$menu);
729 call_hooks('item_photo_menu', $args);
732 foreach($menu as $k=>$v){
733 if ($v!="") $o .= "<li><a href='$v'>$k</a></li>\n";
738 if(! function_exists('like_puller')) {
739 function like_puller($a,$item,&$arr,$mode) {
743 $verb = (($mode === 'like') ? ACTIVITY_LIKE : ACTIVITY_DISLIKE);
745 if((activity_match($item['verb'],$verb)) && ($item['id'] != $item['parent'])) {
746 $url = $item['author-link'];
747 if((local_user()) && (local_user() == $item['uid']) && ($item['network'] === 'dfrn') && (! $item['self']) && (link_compare($item['author-link'],$item['url']))) {
748 $url = $a->get_baseurl() . '/redir/' . $item['contact-id'];
749 $sparkle = ' class="sparkle" ';
751 if(! ((isset($arr[$item['parent'] . '-l'])) && (is_array($arr[$item['parent'] . '-l']))))
752 $arr[$item['parent'] . '-l'] = array();
753 if(! isset($arr[$item['parent']]))
754 $arr[$item['parent']] = 1;
756 $arr[$item['parent']] ++;
757 $arr[$item['parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['author-name'] . '</a>';
762 // Format the like/dislike text for a profile item
763 // $cnt = number of people who like/dislike the item
764 // $arr = array of pre-linked names of likers/dislikers
765 // $type = one of 'like, 'dislike'
767 // returns formatted text
769 if(! function_exists('format_like')) {
770 function format_like($cnt,$arr,$type,$id) {
773 $o .= (($type === 'like') ? sprintf( t('%s likes this.'), $arr[0]) : sprintf( t('%s doesn\'t like this.'), $arr[0])) . EOL ;
775 $spanatts = 'class="fakelink" onclick="openClose(\'' . $type . 'list-' . $id . '\');"';
776 $o .= (($type === 'like') ?
777 sprintf( t('<span %1$s>%2$d people</span> like this.'), $spanatts, $cnt)
779 sprintf( t('<span %1$s>%2$d people</span> don\'t like this.'), $spanatts, $cnt) );
781 $total = count($arr);
782 if($total >= MAX_LIKERS)
783 $arr = array_slice($arr, 0, MAX_LIKERS - 1);
784 if($total < MAX_LIKERS)
785 $arr[count($arr)-1] = t('and') . ' ' . $arr[count($arr)-1];
786 $str = implode(', ', $arr);
787 if($total >= MAX_LIKERS)
788 $str .= sprintf( t(', and %d other people'), $total - MAX_LIKERS );
789 $str = (($type === 'like') ? sprintf( t('%s like this.'), $str) : sprintf( t('%s don\'t like this.'), $str));
790 $o .= "\t" . '<div id="' . $type . 'list-' . $id . '" style="display: none;" >' . $str . '</div>';
796 function status_editor($a,$x, $notes_cid = 0) {
800 $geotag = (($x['allow_location']) ? get_markup_template('jot_geotag.tpl') : '');
802 $tpl = get_markup_template('jot-header.tpl');
804 $a->page['htmlhead'] .= replace_macros($tpl, array(
805 '$newpost' => 'true',
806 '$baseurl' => $a->get_baseurl(),
807 '$geotag' => $geotag,
808 '$nickname' => $x['nickname'],
809 '$ispublic' => t('Visible to <strong>everybody</strong>'),
810 '$linkurl' => t('Please enter a link URL:'),
811 '$vidurl' => t("Please enter a video link/URL:"),
812 '$audurl' => t("Please enter an audio link/URL:"),
813 '$term' => t('Tag term:'),
814 '$whereareu' => t('Where are you right now?'),
815 '$title' => t('Enter a title for this item')
819 $tpl = get_markup_template("jot.tpl");
824 $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
826 $mail_enabled = false;
827 $pubmail_enabled = false;
829 if(($x['is_owner']) && (! $mail_disabled)) {
830 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
834 $mail_enabled = true;
835 if(intval($r[0]['pubmail']))
836 $pubmail_enabled = true;
841 $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
842 $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
843 . t("Post to Email") . '</div>';
846 call_hooks('jot_tool', $jotplugins);
847 call_hooks('jot_networks', $jotnets);
850 $jotnets .= '<input type="hidden" name="contact_allow[]" value="' . $notes_cid .'" />';
852 $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
854 $o .= replace_macros($tpl,array(
855 '$return_path' => $a->cmd,
857 '$share' => (($x['button']) ? $x['button'] : t('Share')),
858 '$upload' => t('Upload photo'),
859 '$attach' => t('Attach file'),
860 '$weblink' => t('Insert web link'),
861 '$video' => t('Insert video link'),
862 '$audio' => t('Insert audio link'),
863 '$setloc' => t('Set your location'),
864 '$noloc' => t('Clear browser location'),
865 '$title' => t('Set title'),
866 '$wait' => t('Please wait'),
867 '$permset' => t('Permission settings'),
868 '$ptyp' => (($notes_cid) ? 'note' : 'wall'),
871 '$baseurl' => $a->get_baseurl(),
872 '$defloc' => $x['default_location'],
873 '$visitor' => $x['visitor'],
874 '$pvisit' => (($notes_cid) ? 'none' : $x['visitor']),
875 '$emailcc' => t('CC: email addresses'),
876 '$public' => t('Public post'),
877 '$jotnets' => $jotnets,
878 '$emtitle' => t('Example: bob@example.com, mary@example.com'),
879 '$lockstate' => $x['lockstate'],
881 '$bang' => $x['bang'],
882 '$profile_uid' => $x['profile_uid'],