require_once('include/tags.php');
require_once('include/text.php');
require_once('include/email.php');
+require_once('include/ostatus_conversation.php');
function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0) {
// Search for ostatus conversation url
$links = $item->feed->data["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["feed"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["entry"][0]["child"]["http://www.w3.org/2005/Atom"]["link"];
- foreach ($links as $link) {
- $conversation = array_shift($link["attribs"]);
+ if (is_array($links)) {
+ foreach ($links as $link) {
+ $conversation = array_shift($link["attribs"]);
- if ($conversation["rel"] == "ostatus:conversation") {
- $res["ostatus_conversation"] = $conversation["href"];
- logger('get_atom_elements: found conversation url '.$res["ostatus_conversation"]);
- }
- };
+ if ($conversation["rel"] == "ostatus:conversation") {
+ $res["ostatus_conversation"] = $conversation["href"];
+ logger('get_atom_elements: found conversation url '.$res["ostatus_conversation"]);
+ }
+ };
+ }
$arr = array('feed' => $feed, 'item' => $item, 'result' => $res);
$current_post = $r[0]['id'];
logger('item_store: created item ' . $current_post);
create_tags_from_item($r[0]['id']);
- // ostatus_conversation
} else {
logger('item_store: could not locate created item');
return 0;
);
create_tags_from_item($current_post);
+ // Complete ostatus threads
+ if ($ostatus_conversation)
+ complete_conversation($current_post, $ostatus_conversation);
+
$arr['id'] = $current_post;
$arr['parent'] = $parent_id;
$arr['allow_cid'] = $allow_cid;
// Only embed locally hosted photos
$replace = false;
$i = basename($image);
- $i = str_replace(array('.jpg','.png'),array('',''),$i);
+ $i = str_replace(array('.jpg','.png','.gif'),array('','',''),$i);
$x = strpos($i,'-');
if($x) {
intval($res),
intval($uid)
);
- if(count($r)) {
+ if($r) {
// Check to see if we should replace this photo link with an embedded image
// 1. No need to do so if the photo is public
if((local_user() == $item['uid']) || ($cid) || (! $interactive)) {
+ // Check if we should do HTML-based delete confirmation
+ if($_REQUEST['confirm']) {
+ // <form> can't take arguments in its "action" parameter
+ // so add any arguments as hidden inputs
+ $query = explode_querystring($a->query_string);
+ $inputs = array();
+ foreach($query['args'] as $arg) {
+ if(strpos($arg, 'confirm=') === false) {
+ $arg_parts = explode('=', $arg);
+ $inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]);
+ }
+ }
+
+ return replace_macros(get_markup_template('confirm.tpl'), array(
+ '$method' => 'get',
+ '$message' => t('Do you really want to delete this item?'),
+ '$extra_inputs' => $inputs,
+ '$confirm' => t('Yes'),
+ '$confirm_url' => $query['base'],
+ '$confirm_name' => 'confirmed',
+ '$cancel' => t('Cancel'),
+ ));
+ }
+ // Now check how the user responded to the confirmation query
+ if($_REQUEST['canceled']) {
+ goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
+ }
+
logger('delete item: ' . $item['id'], LOGGER_DEBUG);
// delete the item