5 * This is the POST destination for most all locally posted
6 * text stuff. This function handles status, wall-to-wall status,
7 * local comments, and remote coments - that are posted on this site
8 * (as opposed to being delivered in a feed).
9 * All of these become an "item" which is our basic unit of
11 * Posts that originate externally or do not fall into the above
12 * posting categories go through item_store() instead of this function.
16 function item_post(&$a) {
18 if((! local_user()) && (! remote_user()))
21 require_once('include/security.php');
25 if(x($_POST,'dropitems')) {
26 require_once('include/items.php');
27 $arr_drop = explode(',',$_POST['dropitems']);
28 drop_items($arr_drop);
29 $json = array('success' => 1);
30 echo json_encode($json);
34 call_hooks('post_local_start', $_POST);
36 $parent = ((x($_POST,'parent')) ? intval($_POST['parent']) : 0);
39 $parent_contact = null;
42 $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1",
46 notice( t('Unable to locate original post.') . EOL);
47 if(x($_POST,'return'))
48 goaway($a->get_baseurl() . "/" . $_POST['return'] );
52 if($parent_item['contact-id'] && $uid) {
53 $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
54 intval($parent_item['contact-id']),
58 $parent_contact = $r[0];
62 $profile_uid = ((x($_POST,'profile_uid')) ? intval($_POST['profile_uid']) : 0);
63 $post_id = ((x($_POST['post_id'])) ? intval($_POST['post_id']) : 0);
64 $app = ((x($_POST['source'])) ? strip_tags($_POST['source']) : '');
66 if(! can_write_wall($a,$profile_uid)) {
67 notice( t('Permission denied.') . EOL) ;
68 if(x($_POST,'return'))
69 goaway($a->get_baseurl() . "/" . $_POST['return'] );
74 // is this an edited post?
79 $i = q("SELECT * FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1",
90 $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
97 $str_group_allow = $orig_post['allow_gid'];
98 $str_contact_allow = $orig_post['allow_cid'];
99 $str_group_deny = $orig_post['deny_gid'];
100 $str_contact_deny = $orig_post['deny_cid'];
101 $title = $orig_post['title'];
102 $location = $orig_post['location'];
103 $coord = $orig_post['coord'];
104 $verb = $orig_post['verb'];
105 $emailcc = $orig_post['emailcc'];
106 $app = $orig_post['app'];
108 $body = escape_tags(trim($_POST['body']));
109 $private = $orig_post['private'];
110 $pubmail_enable = $orig_post['pubmail'];
113 $str_group_allow = perms2str($_POST['group_allow']);
114 $str_contact_allow = perms2str($_POST['contact_allow']);
115 $str_group_deny = perms2str($_POST['group_deny']);
116 $str_contact_deny = perms2str($_POST['contact_deny']);
117 $title = notags(trim($_POST['title']));
118 $location = notags(trim($_POST['location']));
119 $coord = notags(trim($_POST['coord']));
120 $verb = notags(trim($_POST['verb']));
121 $emailcc = notags(trim($_POST['emailcc']));
123 $body = escape_tags(trim($_POST['body']));
124 $private = ((strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) ? 1 : 0);
127 (($parent_item['private'])
128 || strlen($parent_item['allow_cid'])
129 || strlen($parent_item['allow_gid'])
130 || strlen($parent_item['deny_cid'])
131 || strlen($parent_item['deny_gid'])
136 $pubmail_enable = ((x($_POST,'pubmail_enable') && intval($_POST['pubmail_enable']) && (! $private)) ? 1 : 0);
138 if(! strlen($body)) {
139 info( t('Empty post discarded.') . EOL );
140 if(x($_POST,'return'))
141 goaway($a->get_baseurl() . "/" . $_POST['return'] );
146 // get contact info for poster
151 if(($_SESSION['uid']) && ($_SESSION['uid'] == $profile_uid)) {
153 $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
154 intval($_SESSION['uid'])
158 if((x($_SESSION,'visitor_id')) && (intval($_SESSION['visitor_id']))) {
159 $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
160 intval($_SESSION['visitor_id'])
167 $contact_id = $author['id'];
170 // get contact info for owner
172 if($profile_uid == $_SESSION['uid']) {
173 $contact_record = $author;
176 $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
180 $contact_record = $r[0];
183 $post_type = notags(trim($_POST['type']));
185 if($post_type === 'net-comment') {
186 if($parent_item !== null) {
187 if($parent_item['wall'] == 1)
188 $post_type = 'wall-comment';
190 $post_type = 'remote-comment';
196 * When a photo was uploaded into the message using the (profile wall) ajax
197 * uploader, The permissions are initially set to disallow anybody but the
198 * owner from seeing it. This is because the permissions may not yet have been
199 * set for the post. If it's private, the photo permissions should be set
200 * appropriately. But we didn't know the final permissions on the post until
201 * now. So now we'll look for links of uploaded messages that are in the
202 * post and set them to the same permissions as the post itself.
208 if(preg_match_all("/\[img\](.*?)\[\/img\]/",$body,$match)) {
211 foreach($images as $image) {
212 if(! stristr($image,$a->get_baseurl() . '/photo/'))
214 $image_uri = substr($image,strrpos($image,'/') + 1);
215 $image_uri = substr($image_uri,0, strpos($image_uri,'-'));
216 if(! strlen($image_uri))
218 $srch = '<' . intval($profile_uid) . '>';
219 $r = q("SELECT `id` FROM `photo` WHERE `allow_cid` = '%s' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = ''
220 AND `resource-id` = '%s' AND `uid` = %d LIMIT 1",
229 $r = q("UPDATE `photo` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
230 WHERE `resource-id` = '%s' AND `uid` = %d AND `album` = '%s' ",
231 dbesc($str_contact_allow),
232 dbesc($str_group_allow),
233 dbesc($str_contact_deny),
234 dbesc($str_group_deny),
236 intval($profile_uid),
237 dbesc( t('Wall Photos'))
246 * Next link in any attachment references we find in the post.
251 if(preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",$body,$match)) {
252 $attaches = $match[1];
253 if(count($attaches)) {
254 foreach($attaches as $attach) {
255 $r = q("SELECT * FROM `attach` WHERE `uid` = %d AND `id` = %d LIMIT 1",
256 intval($profile_uid),
260 $r = q("UPDATE `attach` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
261 WHERE `uid` = %d AND `id` = %d LIMIT 1",
262 intval($profile_uid),
271 * Fold multi-line [code] sequences
274 $body = preg_replace('/\[\/code\]\s*\[code\]/m',"\n",$body);
277 * Look for any tags and linkify them
284 $tags = get_tags($body);
287 * add a statusnet style reply tag if the original post was from there
288 * and we are replying, and there isn't one already
291 if(($parent_contact) && ($parent_contact['network'] === 'stat')
292 && ($parent_contact['nick']) && (! in_array('@' . $parent_contact['nick'],$tags))) {
293 $body = '@' . $parent_contact['nick'] . ' ' . $body;
294 $tags[] = '@' . $parent_contact['nick'];
298 foreach($tags as $tag) {
301 if(strpos($tag,'#') === 0) {
302 if(strpos($tag,'[url='))
304 $basetag = str_replace('_',' ',substr($tag,1));
305 $body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body);
306 if(strlen($str_tags))
308 $str_tags .= '#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]';
311 if(strpos($tag,'@') === 0) {
312 if(strpos($tag,'[url='))
315 $name = substr($tag,1);
316 if((strpos($name,'@')) || (strpos($name,'http://'))) {
318 $links = @lrdd($name);
320 foreach($links as $link) {
321 if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page')
322 $profile = $link['@attributes']['href'];
323 if($link['@attributes']['rel'] === 'salmon') {
326 $inform .= 'url:' . str_replace(',','%2c',$link['@attributes']['href']);
334 if(strstr($name,'_') || strstr($name,' ')) {
335 $newname = str_replace('_',' ',$name);
336 $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
342 $r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
348 $profile = $r[0]['url'];
349 if($r[0]['network'] === 'stat') {
350 $newname = $r[0]['nick'];
353 $alias = $r[0]['alias'];
356 $newname = $r[0]['name'];
359 $inform .= 'cid:' . $r[0]['id'];
363 $body = str_replace('@' . $name, '@' . '[url=' . $profile . ']' . $newname . '[/url]', $body);
364 $profile = str_replace(',','%2c',$profile);
365 if(strlen($str_tags))
367 $str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]';
369 // Status.Net seems to require the numeric ID URL in a mention if the person isn't
370 // subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both.
373 if(strlen($str_tags))
375 $str_tags .= '@[url=' . $alias . ']' . $newname . '[/url]';
385 if(preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) {
386 foreach($match[2] as $mtch) {
387 $r = q("SELECT `id`,`filename`,`filesize`,`filetype` FROM `attach` WHERE `uid` = %d AND `id` = %d LIMIT 1",
388 intval($profile_uid),
392 if(strlen($attachments))
394 $attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['id'] . '" size="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : ' ') . '"[/attach]';
396 $body = str_replace($match[1],'',$body);
402 if($post_type === 'wall' || $post_type === 'wall-comment')
406 $verb = ACTIVITY_POST ;
408 $gravity = (($parent) ? 6 : 0 );
410 $notify_type = (($parent) ? 'comment-new' : 'wall-new' );
412 $uri = item_new_uri($a->get_hostname(),$profile_uid);
415 $datarray['uid'] = $profile_uid;
416 $datarray['type'] = $post_type;
417 $datarray['wall'] = $wall;
418 $datarray['gravity'] = $gravity;
419 $datarray['contact-id'] = $contact_id;
420 $datarray['owner-name'] = $contact_record['name'];
421 $datarray['owner-link'] = $contact_record['url'];
422 $datarray['owner-avatar'] = $contact_record['thumb'];
423 $datarray['author-name'] = $author['name'];
424 $datarray['author-link'] = $author['url'];
425 $datarray['author-avatar'] = $author['thumb'];
426 $datarray['created'] = datetime_convert();
427 $datarray['edited'] = datetime_convert();
428 $datarray['received'] = datetime_convert();
429 $datarray['changed'] = datetime_convert();
430 $datarray['uri'] = $uri;
431 $datarray['title'] = $title;
432 $datarray['body'] = $body;
433 $datarray['app'] = $app;
434 $datarray['location'] = $location;
435 $datarray['coord'] = $coord;
436 $datarray['tag'] = $str_tags;
437 $datarray['inform'] = $inform;
438 $datarray['verb'] = $verb;
439 $datarray['allow_cid'] = $str_contact_allow;
440 $datarray['allow_gid'] = $str_group_allow;
441 $datarray['deny_cid'] = $str_contact_deny;
442 $datarray['deny_gid'] = $str_group_deny;
443 $datarray['private'] = $private;
444 $datarray['pubmail'] = $pubmail_enable;
445 $datarray['attach'] = $attachments;
448 * These fields are for the convenience of plugins...
449 * 'self' if true indicates the owner is posting on their own wall
450 * If parent is 0 it is a top-level post.
453 $datarray['parent'] = $parent;
454 $datarray['self'] = $self;
455 $datarray['prvnets'] = $user['prvnets'];
458 $datarray['edit'] = true;
460 call_hooks('post_local',$datarray);
464 $r = q("UPDATE `item` SET `body` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
466 dbesc(datetime_convert()),
471 proc_run('php', "include/notifier.php", 'edit_post', "$post_id");
472 if((x($_POST,'return')) && strlen($_POST['return'])) {
473 logger('return: ' . $_POST['return']);
474 goaway($a->get_baseurl() . "/" . $_POST['return'] );
482 $r = q("INSERT INTO `item` (`uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
483 `author-name`, `author-link`, `author-avatar`, `created`, `edited`, `received`, `changed`, `uri`, `title`, `body`, `app`, `location`, `coord`,
484 `tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach` )
485 VALUES( %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s' )",
486 intval($datarray['uid']),
487 dbesc($datarray['type']),
488 intval($datarray['wall']),
489 intval($datarray['gravity']),
490 intval($datarray['contact-id']),
491 dbesc($datarray['owner-name']),
492 dbesc($datarray['owner-link']),
493 dbesc($datarray['owner-avatar']),
494 dbesc($datarray['author-name']),
495 dbesc($datarray['author-link']),
496 dbesc($datarray['author-avatar']),
497 dbesc($datarray['created']),
498 dbesc($datarray['edited']),
499 dbesc($datarray['received']),
500 dbesc($datarray['changed']),
501 dbesc($datarray['uri']),
502 dbesc($datarray['title']),
503 dbesc($datarray['body']),
504 dbesc($datarray['app']),
505 dbesc($datarray['location']),
506 dbesc($datarray['coord']),
507 dbesc($datarray['tag']),
508 dbesc($datarray['inform']),
509 dbesc($datarray['verb']),
510 dbesc($datarray['allow_cid']),
511 dbesc($datarray['allow_gid']),
512 dbesc($datarray['deny_cid']),
513 dbesc($datarray['deny_gid']),
514 intval($datarray['private']),
515 intval($datarray['pubmail']),
516 dbesc($datarray['attach'])
519 $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
520 dbesc($datarray['uri']));
522 $post_id = $r[0]['id'];
523 logger('mod_item: saved item ' . $post_id);
527 // This item is the last leaf and gets the comment box, clear any ancestors
528 $r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent` = %d ",
529 dbesc(datetime_convert()),
533 // Inherit ACL's from the parent item.
535 $r = q("UPDATE `item` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `private` = %d
536 WHERE `id` = %d LIMIT 1",
537 dbesc($parent_item['allow_cid']),
538 dbesc($parent_item['allow_gid']),
539 dbesc($parent_item['deny_cid']),
540 dbesc($parent_item['deny_gid']),
541 intval($parent_item['private']),
545 // Send a notification email to the conversation owner, unless the owner is me and I wrote this item
546 if(($user['notify-flags'] & NOTIFY_COMMENT) && ($contact_record != $author)) {
547 push_lang($user['language']);
548 require_once('bbcode.php');
549 $from = $author['name'];
551 // name of the automated email sender
552 $msg['notificationfromname'] = stripslashes($datarray['author-name']);;
553 // noreply address to send from
554 $msg['notificationfromemail'] = t('noreply') . '@' . $a->get_hostname();
557 // process the message body to display properly in text mode
559 = html_entity_decode(strip_tags(bbcode(stripslashes($datarray['body']))), ENT_QUOTES, 'UTF-8');
562 // process the message body to display properly in text mode
564 = html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r","\\n\\n" ,"\\n"), "<br />\n",$datarray['body']))));
566 // load the template for private message notifications
567 $tpl = get_intltext_template('cmnt_received_html_body_eml.tpl');
568 $email_html_body_tpl = replace_macros($tpl,array(
569 '$username' => $user['username'],
570 '$sitename' => $a->config['sitename'], // name of this site
571 '$siteurl' => $a->get_baseurl(), // descriptive url of this site
572 '$thumb' => $author['thumb'], // thumbnail url for sender icon
573 '$email' => $importer['email'], // email address to send to
574 '$url' => $author['url'], // full url for the site
575 '$from' => $from, // name of the person sending the message
576 '$body' => $msg['htmlversion'], // html version of the message
577 '$display' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
580 // load the template for private message notifications
581 $tpl = get_intltext_template('cmnt_received_text_body_eml.tpl');
582 $email_text_body_tpl = replace_macros($tpl,array(
583 '$username' => $user['username'],
584 '$sitename' => $a->config['sitename'], // name of this site
585 '$siteurl' => $a->get_baseurl(), // descriptive url of this site
586 '$thumb' => $author['thumb'], // thumbnail url for sender icon
587 '$email' => $importer['email'], // email address to send to
588 '$url' => $author['url'], // profile url for the author
589 '$from' => $from, // name of the person sending the message
590 '$body' => $msg['textversion'], // text version of the message
591 '$display' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
594 // use the EmailNotification library to send the message
595 require_once("include/EmailNotification.php");
596 EmailNotification::sendTextHtmlEmail(
597 $msg['notificationfromname'],
598 t("Administrator@") . $a->get_hostname(),
599 t("noreply") . '@' . $a->get_hostname(),
601 sprintf( t('%s commented on an item at %s'), $from , $a->config['sitename']),
602 $email_html_body_tpl,
612 // let me know if somebody did a wall-to-wall post on my profile
614 if(($user['notify-flags'] & NOTIFY_WALL) && ($contact_record != $author)) {
615 push_lang($user['language']);
616 require_once('bbcode.php');
617 $from = $author['name'];
619 // name of the automated email sender
620 $msg['notificationfromname'] = $from;
621 // noreply address to send from
622 $msg['notificationfromemail'] = t('noreply') . '@' . $a->get_hostname();
625 // process the message body to display properly in text mode
627 = html_entity_decode(strip_tags(bbcode(stripslashes($datarray['body']))), ENT_QUOTES, 'UTF-8');
630 // process the message body to display properly in text mode
632 = html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r","\\n\\n" ,"\\n"), "<br />\n",$datarray['body']))));
634 // load the template for private message notifications
635 $tpl = load_view_file('view/wall_received_html_body_eml.tpl');
636 $email_html_body_tpl = replace_macros($tpl,array(
637 '$username' => $user['username'],
638 '$sitename' => $a->config['sitename'], // name of this site
639 '$siteurl' => $a->get_baseurl(), // descriptive url of this site
640 '$thumb' => $author['thumb'], // thumbnail url for sender icon
641 '$url' => $author['url'], // full url for the site
642 '$from' => $from, // name of the person sending the message
643 '$body' => $msg['htmlversion'], // html version of the message
644 '$display' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
647 // load the template for private message notifications
648 $tpl = load_view_file('view/wall_received_text_body_eml.tpl');
649 $email_text_body_tpl = replace_macros($tpl,array(
650 '$username' => $user['username'],
651 '$sitename' => $a->config['sitename'], // name of this site
652 '$siteurl' => $a->get_baseurl(), // descriptive url of this site
653 '$thumb' => $author['thumb'], // thumbnail url for sender icon
654 '$url' => $author['url'], // full url for the site
655 '$from' => $from, // name of the person sending the message
656 '$body' => $msg['textversion'], // text version of the message
657 '$display' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
660 // use the EmailNotification library to send the message
661 require_once("include/EmailNotification.php");
662 EmailNotification::sendTextHtmlEmail(
663 $msg['notificationfromname'],
664 t("Administrator@") . $a->get_hostname(),
665 t("noreply") . '@' . $a->get_hostname(),
667 sprintf( t('%s posted to your profile wall at %s') , $from , $a->config['sitename']),
668 $email_html_body_tpl,
675 $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `plink` = '%s', `changed` = '%s', `last-child` = 1, `visible` = 1
676 WHERE `id` = %d LIMIT 1",
678 dbesc(($parent == $post_id) ? $uri : $parent_item['uri']),
679 dbesc($a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id),
680 dbesc(datetime_convert()),
684 // photo comments turn the corresponding item visible to the profile wall
685 // This way we don't see every picture in your new photo album posted to your wall at once.
686 // They will show up as people comment on them.
688 if(! $parent_item['visible']) {
689 $r = q("UPDATE `item` SET `visible` = 1 WHERE `id` = %d LIMIT 1",
690 intval($parent_item['id'])
695 logger('mod_item: unable to retrieve post that was just stored.');
696 notify( t('System error. Post not saved.'));
697 goaway($a->get_baseurl() . "/" . $_POST['return'] );
701 proc_run('php', "include/notifier.php", $notify_type, "$post_id");
703 $datarray['id'] = $post_id;
704 $datarray['plink'] = $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id;
706 call_hooks('post_local_end', $datarray);
708 if(strlen($emailcc) && $profile_uid == local_user()) {
709 $erecips = explode(',', $emailcc);
710 if(count($erecips)) {
711 foreach($erecips as $recip) {
712 $addr = trim($recip);
715 $disclaimer = '<hr />' . sprintf( t('This message was sent to you by %s, a member of the Friendika social network.'),$a->user['username'])
717 $disclaimer .= sprintf( t('You may visit them online at %s'), $a->get_baseurl() . '/profile/' . $a->user['nickname']) . EOL;
718 $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL;
720 $subject = '[Friendika]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']);
721 $headers = 'From: ' . $a->user['username'] . ' <' . $a->user['email'] . '>' . "\n";
722 $headers .= 'MIME-Version: 1.0' . "\n";
723 $headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
724 $headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n";
725 $link = '<a href="' . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . '"><img src="' . $author['thumb'] . '" alt="' . $a->user['username'] . '" /></a><br /><br />';
726 $html = prepare_body($datarray);
727 $message = '<html><body>' . $link . $html . $disclaimer . '</body></html>';
728 @mail($addr, $subject, $message, $headers);
733 logger('post_complete');
734 if((x($_POST,'return')) && strlen($_POST['return'])) {
735 logger('return: ' . $_POST['return']);
736 goaway($a->get_baseurl() . "/" . $_POST['return'] );
738 if($_POST['api_source'])
740 $json = array('success' => 1);
741 if(x($_POST,'jsreload') && strlen($_POST['jsreload']))
742 $json['reload'] = $a->get_baseurl() . '/' . $_POST['jsreload'];
744 logger('post_json: ' . print_r($json,true), LOGGER_DEBUG);
746 echo json_encode($json);
755 function item_content(&$a) {
757 if((! local_user()) && (! remote_user()))
760 require_once('include/security.php');
762 if(($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) {
763 require_once('include/items.php');
764 drop_item($a->argv[2]);