Merge remote branch 'upstream/master'
Conflicts: update.php
This commit is contained in:
@@ -192,6 +192,7 @@ function contact_photo_menu($contact) {
|
||||
$status_link="";
|
||||
$photos_link="";
|
||||
$posts_link="";
|
||||
$poke_link="";
|
||||
|
||||
$sparkle = false;
|
||||
if($contact['network'] === NETWORK_DFRN) {
|
||||
@@ -211,10 +212,12 @@ function contact_photo_menu($contact) {
|
||||
$pm_url = $a->get_baseurl() . '/message/new/' . $contact['id'];
|
||||
}
|
||||
|
||||
$poke_link = $a->get_baseurl() . '/poke/?f=&c=' . $contact['id'];
|
||||
$contact_url = $a->get_baseurl() . '/contacts/' . $contact['id'];
|
||||
$posts_link = $a->get_baseurl() . '/network/?cid=' . $contact['id'];
|
||||
|
||||
$menu = Array(
|
||||
t("Poke") => $poke_link,
|
||||
t("View Status") => $status_link,
|
||||
t("View Profile") => $profile_link,
|
||||
t("View Photos") => $photos_link,
|
||||
|
||||
+604
-413
File diff suppressed because it is too large
Load Diff
@@ -162,6 +162,49 @@ function localize_item(&$item){
|
||||
$item['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$Bphoto;
|
||||
|
||||
}
|
||||
if (stristr($item['verb'],ACTIVITY_POKE)) {
|
||||
$verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1));
|
||||
if(! $verb)
|
||||
return;
|
||||
if ($item['object-type']=="" || $item['object-type']!== ACTIVITY_OBJ_PERSON) return;
|
||||
|
||||
$Aname = $item['author-name'];
|
||||
$Alink = $item['author-link'];
|
||||
|
||||
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
|
||||
|
||||
$obj = parse_xml_string($xmlhead.$item['object']);
|
||||
$links = parse_xml_string($xmlhead."<links>".unxmlify($obj->link)."</links>");
|
||||
|
||||
$Bname = $obj->title;
|
||||
$Blink = ""; $Bphoto = "";
|
||||
foreach ($links->link as $l){
|
||||
$atts = $l->attributes();
|
||||
switch($atts['rel']){
|
||||
case "alternate": $Blink = $atts['href'];
|
||||
case "photo": $Bphoto = $atts['href'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$A = '[url=' . zrl($Alink) . ']' . $Aname . '[/url]';
|
||||
$B = '[url=' . zrl($Blink) . ']' . $Bname . '[/url]';
|
||||
if ($Bphoto!="") $Bphoto = '[url=' . zrl($Blink) . '][img=80x80]' . $Bphoto . '[/img][/url]';
|
||||
|
||||
// we can't have a translation string with three positions but no distinguishable text
|
||||
// So here is the translate string.
|
||||
|
||||
$txt = t('%1$s poked %2$s');
|
||||
|
||||
// now translate the verb
|
||||
|
||||
$txt = str_replace( t('poked'), t($verb), $txt);
|
||||
|
||||
// then do the sprintf on the translation string
|
||||
|
||||
$item['body'] = sprintf($txt, $A, $B). "\n\n\n" . $Bphoto;
|
||||
|
||||
}
|
||||
if ($item['verb']===ACTIVITY_TAG){
|
||||
$r = q("SELECT * from `item`,`contact` WHERE
|
||||
`item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';",
|
||||
@@ -867,6 +910,7 @@ function item_photo_menu($item){
|
||||
if(! count($a->contacts))
|
||||
load_contact_links(local_user());
|
||||
}
|
||||
$poke_link="";
|
||||
$contact_url="";
|
||||
$pm_url="";
|
||||
$status_link="";
|
||||
@@ -896,6 +940,7 @@ function item_photo_menu($item){
|
||||
}
|
||||
}
|
||||
if(($cid) && (! $item['self'])) {
|
||||
$poke_link = $a->get_baseurl($ssl_state) . '/poke/?f=&c=' . $cid;
|
||||
$contact_url = $a->get_baseurl($ssl_state) . '/contacts/' . $cid;
|
||||
$posts_link = $a->get_baseurl($ssl_state) . '/network/?cid=' . $cid;
|
||||
|
||||
@@ -918,6 +963,7 @@ function item_photo_menu($item){
|
||||
t("Network Posts") => $posts_link,
|
||||
t("Edit Contact") => $contact_url,
|
||||
t("Send PM") => $pm_url,
|
||||
t("Poke") => $poke_link
|
||||
);
|
||||
|
||||
|
||||
@@ -929,7 +975,7 @@ function item_photo_menu($item){
|
||||
|
||||
$o = "";
|
||||
foreach($menu as $k=>$v){
|
||||
if ($v!="") $o .= "<li><a href='$v'>$k</a></li>\n";
|
||||
if ($v!="") $o .= "<li><a href=\"$v\">$k</a></li>\n";
|
||||
}
|
||||
return $o;
|
||||
}}
|
||||
@@ -1009,7 +1055,6 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
|
||||
$plaintext = true;
|
||||
|
||||
$tpl = get_markup_template('jot-header.tpl');
|
||||
|
||||
$a->page['htmlhead'] .= replace_macros($tpl, array(
|
||||
'$newpost' => 'true',
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
@@ -1026,6 +1071,23 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
|
||||
));
|
||||
|
||||
|
||||
$tpl = get_markup_template('jot-end.tpl');
|
||||
$a->page['end'] .= replace_macros($tpl, array(
|
||||
'$newpost' => 'true',
|
||||
'$baseurl' => $a->get_baseurl(true),
|
||||
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
|
||||
'$geotag' => $geotag,
|
||||
'$nickname' => $x['nickname'],
|
||||
'$ispublic' => t('Visible to <strong>everybody</strong>'),
|
||||
'$linkurl' => t('Please enter a link URL:'),
|
||||
'$vidurl' => t("Please enter a video link/URL:"),
|
||||
'$audurl' => t("Please enter an audio link/URL:"),
|
||||
'$term' => t('Tag term:'),
|
||||
'$fileas' => t('Save to Folder:'),
|
||||
'$whereareu' => t('Where are you right now?')
|
||||
));
|
||||
|
||||
|
||||
$tpl = get_markup_template("jot.tpl");
|
||||
|
||||
$jotplugins = '';
|
||||
@@ -1101,6 +1163,7 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
|
||||
'$bang' => $x['bang'],
|
||||
'$profile_uid' => $x['profile_uid'],
|
||||
'$preview' => t('Preview'),
|
||||
'$mobileapp' => t('Friendica mobile web'),
|
||||
));
|
||||
|
||||
|
||||
|
||||
@@ -2120,7 +2120,6 @@ function diaspora_unshare($me,$contact) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
|
||||
|
||||
$a = get_app();
|
||||
@@ -2154,8 +2153,12 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
|
||||
}
|
||||
}
|
||||
*/
|
||||
// Removal of tags
|
||||
$body = preg_replace('/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $body);
|
||||
/**
|
||||
* Transform #tags, strip off the [url] and replace spaces with underscore
|
||||
*/
|
||||
$body = preg_replace_callback('/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', create_function('$match',
|
||||
'return \'#\'. str_replace(\' \', \'_\', $match[2]);'
|
||||
), $body);
|
||||
|
||||
//if(strlen($title))
|
||||
// $body = "[b]".html_entity_decode($title)."[/b]\n\n".$body;
|
||||
|
||||
@@ -147,6 +147,24 @@ function notification($params) {
|
||||
$itemlink = $params['link'];
|
||||
}
|
||||
|
||||
if($params['type'] == NOTIFY_POKE) {
|
||||
|
||||
$subject = sprintf( t('[Friendica:Notify] %1$s poked you') , $params['source_name']);
|
||||
$preamble = sprintf( t('%1$s poked you at %2$s') , $params['source_name'], $sitename);
|
||||
$epreamble = sprintf( t('%1$s [url=%2$s]poked you[/url].') ,
|
||||
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
|
||||
$params['link']);
|
||||
|
||||
$subject = str_replace('poked', t($params['activity']), $subject);
|
||||
$preamble = str_replace('poked', t($params['activity']), $preamble);
|
||||
$epreamble = str_replace('poked', t($params['activity']), $epreamble);
|
||||
|
||||
$sitelink = t('Please visit %s to view and/or reply to the conversation.');
|
||||
$tsitelink = sprintf( $sitelink, $siteurl );
|
||||
$hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
|
||||
$itemlink = $params['link'];
|
||||
}
|
||||
|
||||
if($params['type'] == NOTIFY_TAGSHARE) {
|
||||
$subject = sprintf( t('[Friendica:Notify] %s tagged your post') , $params['source_name']);
|
||||
$preamble = sprintf( t('%1$s tagged your post at %2$s') , $params['source_name'], $sitename);
|
||||
|
||||
+163
-1
@@ -2107,6 +2107,118 @@ function local_delivery($importer,$data) {
|
||||
$feed->enable_order_by_date(false);
|
||||
$feed->init();
|
||||
|
||||
|
||||
if($feed->error())
|
||||
logger('local_delivery: Error parsing XML: ' . $feed->error());
|
||||
|
||||
|
||||
// Check at the feed level for updated contact name and/or photo
|
||||
|
||||
$name_updated = '';
|
||||
$new_name = '';
|
||||
$photo_timestamp = '';
|
||||
$photo_url = '';
|
||||
|
||||
|
||||
$rawtags = $feed->get_feed_tags( NAMESPACE_DFRN, 'owner');
|
||||
if(! $rawtags)
|
||||
$rawtags = $feed->get_feed_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
|
||||
if($rawtags) {
|
||||
$elems = $rawtags[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10];
|
||||
if($elems['name'][0]['attribs'][NAMESPACE_DFRN]['updated']) {
|
||||
$name_updated = $elems['name'][0]['attribs'][NAMESPACE_DFRN]['updated'];
|
||||
$new_name = $elems['name'][0]['data'];
|
||||
}
|
||||
if((x($elems,'link')) && ($elems['link'][0]['attribs']['']['rel'] === 'photo') && ($elems['link'][0]['attribs'][NAMESPACE_DFRN]['updated'])) {
|
||||
$photo_timestamp = datetime_convert('UTC','UTC',$elems['link'][0]['attribs'][NAMESPACE_DFRN]['updated']);
|
||||
$photo_url = $elems['link'][0]['attribs']['']['href'];
|
||||
}
|
||||
}
|
||||
|
||||
if((is_array($contact)) && ($photo_timestamp) && (strlen($photo_url)) && ($photo_timestamp > $importer['avatar-date'])) {
|
||||
logger('local_delivery: Updating photo for ' . $importer['name']);
|
||||
require_once("Photo.php");
|
||||
$photo_failure = false;
|
||||
$have_photo = false;
|
||||
|
||||
$r = q("SELECT `resource-id` FROM `photo` WHERE `contact-id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($importer['id']),
|
||||
intval($importer['importer_uid'])
|
||||
);
|
||||
if(count($r)) {
|
||||
$resource_id = $r[0]['resource-id'];
|
||||
$have_photo = true;
|
||||
}
|
||||
else {
|
||||
$resource_id = photo_new_resource();
|
||||
}
|
||||
|
||||
$img_str = fetch_url($photo_url,true);
|
||||
// guess mimetype from headers or filename
|
||||
$type = guess_image_type($photo_url,true);
|
||||
|
||||
|
||||
$img = new Photo($img_str, $type);
|
||||
if($img->is_valid()) {
|
||||
if($have_photo) {
|
||||
q("DELETE FROM `photo` WHERE `resource-id` = '%s' AND `contact-id` = %d AND `uid` = %d",
|
||||
dbesc($resource_id),
|
||||
intval($importer['id']),
|
||||
intval($importer['importer_uid'])
|
||||
);
|
||||
}
|
||||
|
||||
$img->scaleImageSquare(175);
|
||||
|
||||
$hash = $resource_id;
|
||||
$r = $img->store($importer['importer_uid'], $importer['id'], $hash, basename($photo_url), 'Contact Photos', 4);
|
||||
|
||||
$img->scaleImage(80);
|
||||
$r = $img->store($importer['importer_uid'], $importer['id'], $hash, basename($photo_url), 'Contact Photos', 5);
|
||||
|
||||
$img->scaleImage(48);
|
||||
$r = $img->store($importer['importer_uid'], $importer['id'], $hash, basename($photo_url), 'Contact Photos', 6);
|
||||
|
||||
$a = get_app();
|
||||
|
||||
q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
|
||||
WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
||||
dbesc(datetime_convert()),
|
||||
dbesc($a->get_baseurl() . '/photo/' . $hash . '-4.'.$img->getExt()),
|
||||
dbesc($a->get_baseurl() . '/photo/' . $hash . '-5.'.$img->getExt()),
|
||||
dbesc($a->get_baseurl() . '/photo/' . $hash . '-6.'.$img->getExt()),
|
||||
intval($importer['importer_uid']),
|
||||
intval($importer['id'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if((is_array($contact)) && ($name_updated) && (strlen($new_name)) && ($name_updated > $contact['name-date'])) {
|
||||
$r = q("select * from contact where uid = %d and id = %d limit 1",
|
||||
intval($importer['importer_uid']),
|
||||
intval($importer['id'])
|
||||
);
|
||||
|
||||
$x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
||||
dbesc(notags(trim($new_name))),
|
||||
dbesc(datetime_convert()),
|
||||
intval($importer['importer_uid']),
|
||||
intval($importer['id'])
|
||||
);
|
||||
|
||||
// do our best to update the name on content items
|
||||
|
||||
if(count($r)) {
|
||||
q("update item set `author-name` = '%s' where `author-name` = '%s' and `author-link` = '%s' and uid = %d",
|
||||
dbesc(notags(trim($new_name))),
|
||||
dbesc($r[0]['name']),
|
||||
dbesc($r[0]['url']),
|
||||
intval($importer['importer_uid'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// Currently unsupported - needs a lot of work
|
||||
$reloc = $feed->get_feed_tags( NAMESPACE_DFRN, 'relocate' );
|
||||
@@ -2958,7 +3070,57 @@ function local_delivery($importer,$data) {
|
||||
$datarray['owner-avatar'] = $importer['thumb'];
|
||||
}
|
||||
|
||||
$r = item_store($datarray);
|
||||
$posted_id = item_store($datarray);
|
||||
|
||||
if(stristr($datarray['verb'],ACTIVITY_POKE)) {
|
||||
$verb = urldecode(substr($datarray['verb'],strpos($datarray['verb'],'#')+1));
|
||||
if(! $verb)
|
||||
continue;
|
||||
$xo = parse_xml_string($datarray['object'],false);
|
||||
|
||||
if(($xo->type == ACTIVITY_OBJ_PERSON) && ($xo->id)) {
|
||||
|
||||
// somebody was poked/prodded. Was it me?
|
||||
|
||||
$links = parse_xml_string("<links>".unxmlify($xo->link)."</links>",false);
|
||||
|
||||
foreach($links->link as $l) {
|
||||
$atts = $l->attributes();
|
||||
switch($atts['rel']) {
|
||||
case "alternate":
|
||||
$Blink = $atts['href'];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($Blink && link_compare($Blink,$a->get_baseurl() . '/profile/' . $importer['nickname'])) {
|
||||
|
||||
// send a notification
|
||||
require_once('include/enotify.php');
|
||||
|
||||
notification(array(
|
||||
'type' => NOTIFY_POKE,
|
||||
'notify_flags' => $importer['notify-flags'],
|
||||
'language' => $importer['language'],
|
||||
'to_name' => $importer['username'],
|
||||
'to_email' => $importer['email'],
|
||||
'uid' => $importer['importer_uid'],
|
||||
'item' => $datarray,
|
||||
'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
|
||||
'source_name' => stripslashes($datarray['author-name']),
|
||||
'source_link' => $datarray['author-link'],
|
||||
'source_photo' => ((link_compare($datarray['author-link'],$importer['url']))
|
||||
? $importer['thumb'] : $datarray['author-avatar']),
|
||||
'verb' => $datarray['verb'],
|
||||
'otype' => 'person',
|
||||
'activity' => $verb,
|
||||
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-4
@@ -111,7 +111,7 @@ function reload_plugins() {
|
||||
|
||||
|
||||
if(! function_exists('register_hook')) {
|
||||
function register_hook($hook,$file,$function) {
|
||||
function register_hook($hook,$file,$function,$priority=0) {
|
||||
|
||||
$r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `function` = '%s' LIMIT 1",
|
||||
dbesc($hook),
|
||||
@@ -121,10 +121,11 @@ function register_hook($hook,$file,$function) {
|
||||
if(count($r))
|
||||
return true;
|
||||
|
||||
$r = q("INSERT INTO `hook` (`hook`, `file`, `function`) VALUES ( '%s', '%s', '%s' ) ",
|
||||
$r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`) VALUES ( '%s', '%s', '%s', '%s' ) ",
|
||||
dbesc($hook),
|
||||
dbesc($file),
|
||||
dbesc($function)
|
||||
dbesc($function),
|
||||
dbesc($priority)
|
||||
);
|
||||
return $r;
|
||||
}}
|
||||
@@ -145,7 +146,7 @@ if(! function_exists('load_hooks')) {
|
||||
function load_hooks() {
|
||||
$a = get_app();
|
||||
$a->hooks = array();
|
||||
$r = q("SELECT * FROM `hook` WHERE 1");
|
||||
$r = q("SELECT * FROM `hook` WHERE 1 ORDER BY `priority` DESC");
|
||||
if(count($r)) {
|
||||
foreach($r as $rr) {
|
||||
if(! array_key_exists($rr['hook'],$a->hooks))
|
||||
@@ -255,6 +256,7 @@ function get_theme_info($theme){
|
||||
'author' => array(),
|
||||
'maintainer' => array(),
|
||||
'version' => "",
|
||||
'credits' => "",
|
||||
'experimental' => false,
|
||||
'unsupported' => false
|
||||
);
|
||||
|
||||
+18
-2
@@ -403,7 +403,7 @@ function load_view_file($s) {
|
||||
return file_get_contents("$d/$lang/$b");
|
||||
|
||||
$theme = current_theme();
|
||||
|
||||
|
||||
if(file_exists("$d/theme/$theme/$b"))
|
||||
return file_get_contents("$d/theme/$theme/$b");
|
||||
|
||||
@@ -706,6 +706,22 @@ function linkify($s) {
|
||||
return($s);
|
||||
}}
|
||||
|
||||
function get_poke_verbs() {
|
||||
|
||||
// index is present tense verb
|
||||
// value is array containing past tense verb, translation of present, translation of past
|
||||
|
||||
$arr = array(
|
||||
'poke' => array( 'poked', t('poke'), t('poked')),
|
||||
'ping' => array( 'pinged', t('ping'), t('pinged')),
|
||||
'prod' => array( 'prodded', t('prod'), t('prodded')),
|
||||
'slap' => array( 'slapped', t('slap'), t('slapped')),
|
||||
'finger' => array( 'fingered', t('finger'), t('fingered')),
|
||||
'rebuff' => array( 'rebuffed', t('rebuff'), t('rebuffed')),
|
||||
);
|
||||
call_hooks('poke_verbs', $arr);
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -1562,7 +1578,7 @@ function undo_post_tagging($s) {
|
||||
|
||||
function fix_mce_lf($s) {
|
||||
$s = str_replace("\r\n","\n",$s);
|
||||
$s = str_replace("\n\n","\n",$s);
|
||||
// $s = str_replace("\n\n","\n",$s);
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user