aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2012-01-06 09:10:21 +0100
committerFabio Comuni <fabrix.xm@gmail.com>2012-01-06 09:10:21 +0100
commita9670cbb7d2cab644ee9d499aade98164f92631a (patch)
treef136b6448ecd23ec7c987bf26b8d49be25a8aca5 /mod
parent93563370c96848948d28ed39e13284ebaf7f430a (diff)
parent53878625f6ecc014283cefbd84f92b6f1294b8a3 (diff)
downloadvolse-hubzilla-a9670cbb7d2cab644ee9d499aade98164f92631a.tar.gz
volse-hubzilla-a9670cbb7d2cab644ee9d499aade98164f92631a.tar.bz2
volse-hubzilla-a9670cbb7d2cab644ee9d499aade98164f92631a.zip
Merge remote-tracking branch 'friendica/master'
Diffstat (limited to 'mod')
-rw-r--r--mod/dfrn_request.php4
-rw-r--r--mod/item.php32
-rw-r--r--mod/ping.php23
-rw-r--r--mod/settings.php6
4 files changed, 33 insertions, 32 deletions
diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php
index a96860403..aa14bc473 100644
--- a/mod/dfrn_request.php
+++ b/mod/dfrn_request.php
@@ -580,7 +580,9 @@ function dfrn_request_content(&$a) {
'link' => $a->get_baseurl() . '/notifications/intros',
'source_name' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : t('[Name Withheld]')),
'source_link' => $r[0]['url'],
- 'source_photo' => $r[0]['photo']
+ 'source_photo' => $r[0]['photo'],
+ 'verb' => ACTIVITY_REQ_FRIEND,
+ 'otype' => 'intro'
));
}
diff --git a/mod/item.php b/mod/item.php
index ece92f0f3..d4d337584 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -54,6 +54,8 @@ function item_post(&$a) {
$parid = 0;
$r = false;
+ $preview = ((x($_POST,'preview')) ? intval($_POST['preview']) : 0);
+
if($parent || $parent_uri) {
if(! x($_POST,'type'))
@@ -280,7 +282,7 @@ function item_post(&$a) {
$match = null;
- if(preg_match_all("/\[img\](.*?)\[\/img\]/",$body,$match)) {
+ if((! $preview) && preg_match_all("/\[img\](.*?)\[\/img\]/",$body,$match)) {
$images = $match[1];
if(count($images)) {
foreach($images as $image) {
@@ -323,7 +325,7 @@ function item_post(&$a) {
$match = false;
- if(preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",$body,$match)) {
+ if((! $preview) && preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",$body,$match)) {
$attaches = $match[1];
if(count($attaches)) {
foreach($attaches as $attach) {
@@ -351,13 +353,6 @@ function item_post(&$a) {
$bookmark = 0;
if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",$body,$match,PREG_SET_ORDER)) {
$bookmark = 1;
-// foreach($match as $mtch) {
-// $body = str_replace(
-// '[bookmark=' . $mtch[1] . ']' . $mtch[2] . '[/bookmark]',
-// '[url=' . $mtch[1] . ']' . $mtch[2] . '[/url]',
-// $body
-// );
-// }
}
$body = bb_translate_video($body);
@@ -588,6 +583,17 @@ function item_post(&$a) {
else
$datarray['guid'] = get_guid();
+ // preview mode - prepare the body for display and send it via json
+
+ if($preview) {
+ $b = prepare_body($datarray,true);
+ require_once('include/conversation.php');
+ $o = conversation(&$a,array(array_merge($datarray,$contact_record)),'search',false);
+ $json = array('preview' => $o);
+ echo json_encode($json);
+ killme();
+ }
+
call_hooks('post_local',$datarray);
@@ -691,7 +697,9 @@ function item_post(&$a) {
'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'],
- 'source_photo' => $datarray['author-avatar']
+ 'source_photo' => $datarray['author-avatar'],
+ 'verb' => ACTIVITY_POST,
+ 'otype' => 'item'
));
}
@@ -731,7 +739,9 @@ function item_post(&$a) {
'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'],
- 'source_photo' => $datarray['author-avatar']
+ 'source_photo' => $datarray['author-avatar'],
+ 'verb' => ACTIVITY_POST,
+ 'otype' => 'item'
));
}
}
diff --git a/mod/ping.php b/mod/ping.php
index e74ef8314..df07cb768 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -7,7 +7,6 @@ function ping_init(&$a) {
header("Content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
<result>";
-
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
if(local_user()){
@@ -18,11 +17,10 @@ function ping_init(&$a) {
$dislikes = array();
$friends = array();
$posts = array();
- $cit = array();
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
- `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`, `item`.`body`,
+ `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`,
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`
FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent`
WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND
@@ -31,8 +29,6 @@ function ping_init(&$a) {
intval(local_user())
);
-
-
$network = count($r);
foreach ($r as $it) {
switch($it['verb']){
@@ -53,11 +49,8 @@ function ping_init(&$a) {
$friends[] = $it;
break;
default:
- $reg = "|@\[url=".$a->get_baseurl()."/profile/".$a->user['nickname']."|";
if ($it['parent']!=$it['id']) {
$comments[] = $it;
- } else if(preg_match( $reg, $it['body'])){
- $cit[] = $it;
} else {
$posts[] = $it;
}
@@ -93,9 +86,6 @@ function ping_init(&$a) {
break;
default:
if ($it['parent']!=$it['id']) $comments[] = $it;
- if(preg_match("/@\[[^]]*\]".$a->user['username']."/", $it['body'])){
- $cit[] = $it;
- }
}
}
@@ -150,12 +140,12 @@ function ping_init(&$a) {
<home>$home</home>";
if ($register!=0) echo "<register>$register</register>";
- $tot = $mail+$intro+$register+count($comments)+count($likes)+count($dislikes)+count($friends)+count($posts)+count($tags)+count($cit);
+ $tot = $mail+$intro+$register+count($comments)+count($likes)+count($dislikes)+count($friends)+count($posts)+count($tags);
echo ' <notif count="'.$tot.'">';
if ($intro>0){
foreach ($intros as $i) {
- echo xmlize( $a->get_baseurl().'/notifications/intros/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend") );
+ echo xmlize( $a->get_baseurl().'/notifications/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend") );
};
}
if ($mail>0){
@@ -191,7 +181,7 @@ function ping_init(&$a) {
}
if (count($posts)){
foreach ($posts as $i) {
- echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), t("{0} posted") );
+ echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} posted") ) );
};
}
if (count($tags)){
@@ -199,11 +189,6 @@ function ping_init(&$a) {
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} tagged %s's post with #%s"), $i['pname'], $i['tname'] ) );
};
}
- if (count($cit)){
- foreach ($cit as $i) {
- echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), t("{0} mentioned you in a post") );
- };
- }
echo " </notif>";
}
diff --git a/mod/settings.php b/mod/settings.php
index 35902f831..8ca0bb7f8 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -255,6 +255,10 @@ function settings_post(&$a) {
$notify += intval($_POST['notify4']);
if(x($_POST,'notify5'))
$notify += intval($_POST['notify5']);
+ if(x($_POST,'notify6'))
+ $notify += intval($_POST['notify6']);
+ if(x($_POST,'notify7'))
+ $notify += intval($_POST['notify7']);
$email_changed = false;
@@ -807,7 +811,7 @@ function settings_content(&$a) {
'$notify3' => array('notify3', t('Someone writes on your profile wall'), ($notify & NOTIFY_WALL), NOTIFY_WALL, ''),
'$notify4' => array('notify4', t('Someone writes a followup comment'), ($notify & NOTIFY_COMMENT), NOTIFY_COMMENT, ''),
'$notify5' => array('notify5', t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''),
-
+ '$notify6' => array('notify6', t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''),
'$h_advn' => t('Advanced Page Settings'),