Merge pull request #884 from annando/master
Notifications for new posts, API changes, several other things ...
This commit is contained in:
commit
91ff025333
16 changed files with 328 additions and 68 deletions
6
boot.php
6
boot.php
|
@ -14,7 +14,7 @@ require_once('include/features.php');
|
|||
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||
define ( 'FRIENDICA_VERSION', '3.2.1747' );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||
define ( 'DB_UPDATE_VERSION', 1167 );
|
||||
define ( 'DB_UPDATE_VERSION', 1169 );
|
||||
define ( 'EOL', "<br />\r\n" );
|
||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||
|
||||
|
@ -197,6 +197,7 @@ define ( 'NOTIFY_PROFILE', 0x0040 );
|
|||
define ( 'NOTIFY_TAGSELF', 0x0080 );
|
||||
define ( 'NOTIFY_TAGSHARE', 0x0100 );
|
||||
define ( 'NOTIFY_POKE', 0x0200 );
|
||||
define ( 'NOTIFY_SHARE', 0x0400 );
|
||||
|
||||
define ( 'NOTIFY_SYSTEM', 0x8000 );
|
||||
|
||||
|
@ -395,6 +396,9 @@ if(! class_exists('App')) {
|
|||
// array of instanced template engines ('name'=>'instance')
|
||||
public $template_engine_instance = array();
|
||||
|
||||
// Used for reducing load to the ostatus completion
|
||||
public $last_ostatus_conversation_url;
|
||||
|
||||
private $ldelim = array(
|
||||
'internal' => '',
|
||||
'smarty3' => '{{'
|
||||
|
|
117
include/api.php
117
include/api.php
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
/* To-Do:
|
||||
- Automatically detect if incoming data is HTML or BBCode
|
||||
- search for usernames should first search friendica, then the other open networks, then the closed ones
|
||||
*/
|
||||
require_once("include/bbcode.php");
|
||||
require_once("include/datetime.php");
|
||||
|
@ -243,6 +242,8 @@
|
|||
$url = "";
|
||||
$nick = "";
|
||||
|
||||
logger("api_get_user: Fetching user data for user ".$contact_id, LOGGER_DEBUG);
|
||||
|
||||
// Searching for contact URL
|
||||
if(!is_null($contact_id) AND (intval($contact_id) == 0)){
|
||||
$user = dbesc(normalise_link($contact_id));
|
||||
|
@ -318,6 +319,9 @@
|
|||
$user
|
||||
);
|
||||
|
||||
// Selecting the id by priority, friendica first
|
||||
api_best_nickname($uinfo);
|
||||
|
||||
// if the contact wasn't found, fetch it from the unique contacts
|
||||
if (count($uinfo)==0) {
|
||||
$r = array();
|
||||
|
@ -357,6 +361,7 @@
|
|||
'uid' => 0,
|
||||
'cid' => 0,
|
||||
'self' => 0,
|
||||
'network' => '',
|
||||
);
|
||||
|
||||
return $ret;
|
||||
|
@ -374,7 +379,7 @@
|
|||
);
|
||||
|
||||
// count public wall messages
|
||||
$r = q("SELECT COUNT(`id`) as `count` FROM `item`
|
||||
$r = q("SELECT COUNT(`id`) as `count` FROM `item` USE INDEX (uid, type)
|
||||
WHERE `uid` = %d
|
||||
AND `type`='wall'
|
||||
AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`=''",
|
||||
|
@ -466,6 +471,7 @@
|
|||
'uid' => intval($uinfo[0]['uid']),
|
||||
'cid' => intval($uinfo[0]['cid']),
|
||||
'self' => $uinfo[0]['self'],
|
||||
'network' => $uinfo[0]['network'],
|
||||
);
|
||||
|
||||
return $ret;
|
||||
|
@ -553,17 +559,24 @@
|
|||
unset($_REQUEST["user_id"]);
|
||||
unset($_GET["user_id"]);
|
||||
|
||||
unset($_REQUEST["screen_name"]);
|
||||
unset($_GET["screen_name"]);
|
||||
|
||||
$skip_status = (x($_REQUEST,'skip_status')?$_REQUEST['skip_status']:false);
|
||||
|
||||
$user_info = api_get_user($a);
|
||||
|
||||
// "verified" isn't used here in the standard
|
||||
unset($user_info["verified"]);
|
||||
|
||||
// - Adding last status
|
||||
if (!$skip_status) {
|
||||
$user_info["status"] = api_status_show($a,"raw");
|
||||
if (!count($user_info["status"]))
|
||||
unset($user_info["status"]);
|
||||
else
|
||||
unset($user_info["status"]["user"]);
|
||||
}
|
||||
|
||||
// "cid", "uid" and "self" are only needed for some internal stuff, so remove it from here
|
||||
unset($user_info["cid"]);
|
||||
|
@ -706,6 +719,7 @@
|
|||
return api_status_show($a,$type);
|
||||
}
|
||||
api_register_func('api/statuses/update','api_statuses_update', true);
|
||||
api_register_func('api/statuses/update_with_media','api_statuses_update', true);
|
||||
|
||||
|
||||
function api_status_show(&$a, $type){
|
||||
|
@ -871,6 +885,9 @@
|
|||
unset($_REQUEST["user_id"]);
|
||||
unset($_GET["user_id"]);
|
||||
|
||||
unset($_REQUEST["screen_name"]);
|
||||
unset($_GET["screen_name"]);
|
||||
|
||||
$user_info = api_get_user($a);
|
||||
// get last newtork messages
|
||||
|
||||
|
@ -1173,6 +1190,9 @@
|
|||
unset($_REQUEST["user_id"]);
|
||||
unset($_GET["user_id"]);
|
||||
|
||||
unset($_REQUEST["screen_name"]);
|
||||
unset($_GET["screen_name"]);
|
||||
|
||||
$user_info = api_get_user($a);
|
||||
// get last newtork messages
|
||||
|
||||
|
@ -1326,14 +1346,20 @@
|
|||
if ($user_info['self']==0) {
|
||||
$ret = array();
|
||||
} else {
|
||||
$sql_extra = "";
|
||||
|
||||
// params
|
||||
$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
|
||||
$max_id = (x($_REQUEST,'max_id')?$_REQUEST['max_id']:0);
|
||||
$count = (x($_GET,'count')?$_GET['count']:20);
|
||||
$page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
|
||||
if ($page<0) $page=0;
|
||||
|
||||
$start = $page*$count;
|
||||
|
||||
if ($max_id > 0)
|
||||
$sql_extra .= ' AND `item`.`id` <= '.intval($max_id);
|
||||
|
||||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
|
@ -1345,9 +1371,11 @@
|
|||
AND `contact`.`id` = `item`.`contact-id`
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
$sql_extra
|
||||
AND `item`.`id`>%d
|
||||
ORDER BY `item`.`received` DESC LIMIT %d ,%d ",
|
||||
//intval($user_info['uid']),
|
||||
intval(api_user()),
|
||||
intval($since_id),
|
||||
intval($start), intval($count)
|
||||
);
|
||||
|
||||
|
@ -1641,12 +1669,6 @@
|
|||
if (api_user()===false) return false;
|
||||
$user_info = api_get_user($a);
|
||||
|
||||
|
||||
// friends and followers only for self
|
||||
if ($user_info['self']==0){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (x($_GET,'cursor') && $_GET['cursor']=='undefined'){
|
||||
/* this is to stop Hotot to load friends multiple times
|
||||
* I'm not sure if I'm missing return something or
|
||||
|
@ -1663,13 +1685,17 @@
|
|||
if($qtype == 'followers')
|
||||
$sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(CONTACT_IS_FOLLOWER), intval(CONTACT_IS_FRIEND));
|
||||
|
||||
$r = q("SELECT id FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 $sql_extra",
|
||||
// friends and followers only for self
|
||||
if ($user_info['self'] == 0)
|
||||
$sql_extra = " AND false ";
|
||||
|
||||
$r = q("SELECT `nurl` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 $sql_extra",
|
||||
intval(api_user())
|
||||
);
|
||||
|
||||
$ret = array();
|
||||
foreach($r as $cid){
|
||||
$user = api_get_user($a, $cid['id']);
|
||||
$user = api_get_user($a, $cid['nurl']);
|
||||
// "cid", "uid" and "self" are only needed for some internal stuff, so remove it from here
|
||||
unset($user["cid"]);
|
||||
unset($user["uid"]);
|
||||
|
@ -1679,7 +1705,6 @@
|
|||
$ret[] = $user;
|
||||
}
|
||||
|
||||
|
||||
return array('$users' => $ret);
|
||||
|
||||
}
|
||||
|
@ -1756,11 +1781,17 @@
|
|||
if(! api_user())
|
||||
return false;
|
||||
|
||||
$user_info = api_get_user($a);
|
||||
|
||||
if($qtype == 'friends')
|
||||
$sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
|
||||
if($qtype == 'followers')
|
||||
$sql_extra = sprintf(" AND ( `rel` = %d OR `rel` = %d ) ", intval(CONTACT_IS_FOLLOWER), intval(CONTACT_IS_FRIEND));
|
||||
|
||||
if (!$user_info["self"])
|
||||
$sql_extra = " AND false ";
|
||||
|
||||
$stringify_ids = (x($_REQUEST,'stringify_ids')?$_REQUEST['stringify_ids']:false);
|
||||
|
||||
$r = q("SELECT unique_contacts.id FROM contact, unique_contacts WHERE contact.nurl = unique_contacts.url AND `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 $sql_extra",
|
||||
intval(api_user())
|
||||
|
@ -1779,7 +1810,12 @@
|
|||
elseif($type === 'json') {
|
||||
$ret = array();
|
||||
header("Content-type: application/json");
|
||||
foreach($r as $rr) $ret[] = $rr['id'];
|
||||
foreach($r as $rr)
|
||||
if ($stringify_ids)
|
||||
$ret[] = $rr['id'];
|
||||
else
|
||||
$ret[] = intval($rr['id']);
|
||||
|
||||
echo json_encode($ret);
|
||||
killme();
|
||||
}
|
||||
|
@ -1806,10 +1842,13 @@
|
|||
require_once("include/message.php");
|
||||
|
||||
if ($_POST['screen_name']) {
|
||||
$r = q("SELECT `id`, `nurl` FROM `contact` WHERE `uid`=%d AND `nick`='%s'",
|
||||
$r = q("SELECT `id`, `nurl`, `network` FROM `contact` WHERE `uid`=%d AND `nick`='%s'",
|
||||
intval(api_user()),
|
||||
dbesc($_POST['screen_name']));
|
||||
|
||||
// Selecting the id by priority, friendica first
|
||||
api_best_nickname($r);
|
||||
|
||||
$recipient = api_get_user($a, $r[0]['nurl']);
|
||||
} else
|
||||
$recipient = api_get_user($a, $_POST['user_id']);
|
||||
|
@ -1861,6 +1900,9 @@
|
|||
unset($_REQUEST["user_id"]);
|
||||
unset($_GET["user_id"]);
|
||||
|
||||
unset($_REQUEST["screen_name"]);
|
||||
unset($_GET["screen_name"]);
|
||||
|
||||
$user_info = api_get_user($a);
|
||||
|
||||
// params
|
||||
|
@ -1869,6 +1911,7 @@
|
|||
if ($page<0) $page=0;
|
||||
|
||||
$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
|
||||
$max_id = (x($_REQUEST,'max_id')?$_REQUEST['max_id']:0);
|
||||
|
||||
$start = $page*$count;
|
||||
|
||||
|
@ -1888,6 +1931,9 @@
|
|||
$sql_extra = "`mail`.`from-url`!='".dbesc( $profile_url )."'";
|
||||
}
|
||||
|
||||
if ($max_id > 0)
|
||||
$sql_extra .= ' AND `mail`.`id` <= '.intval($max_id);
|
||||
|
||||
$r = q("SELECT `mail`.*, `contact`.`nurl` AS `contact-url` FROM `mail`,`contact` WHERE `mail`.`contact-id` = `contact`.`id` AND `mail`.`uid`=%d AND $sql_extra AND `mail`.`id` > %d ORDER BY `mail`.`created` DESC LIMIT %d,%d",
|
||||
intval(api_user()),
|
||||
intval($since_id),
|
||||
|
@ -2025,7 +2071,7 @@ function api_share_as_retweet($a, $uid, &$item) {
|
|||
function api_get_nick($profile) {
|
||||
/* To-Do:
|
||||
- remove trailing jung from profile url
|
||||
- pump.io check has to check the websitr
|
||||
- pump.io check has to check the website
|
||||
*/
|
||||
|
||||
$nick = "";
|
||||
|
@ -2117,6 +2163,49 @@ function api_cleanup_share($shared) {
|
|||
return(trim($text));
|
||||
}
|
||||
|
||||
function api_best_nickname(&$contacts) {
|
||||
$best_contact = array();
|
||||
|
||||
if (count($contact) == 0)
|
||||
return;
|
||||
|
||||
foreach ($contacts AS $contact)
|
||||
if ($contact["network"] == "") {
|
||||
$contact["network"] = "dfrn";
|
||||
$best_contact = array($contact);
|
||||
}
|
||||
|
||||
if (sizeof($best_contact) == 0)
|
||||
foreach ($contacts AS $contact)
|
||||
if ($contact["network"] == "dfrn")
|
||||
$best_contact = array($contact);
|
||||
|
||||
if (sizeof($best_contact) == 0)
|
||||
foreach ($contacts AS $contact)
|
||||
if ($contact["network"] == "dspr")
|
||||
$best_contact = array($contact);
|
||||
|
||||
if (sizeof($best_contact) == 0)
|
||||
foreach ($contacts AS $contact)
|
||||
if ($contact["network"] == "stat")
|
||||
$best_contact = array($contact);
|
||||
|
||||
if (sizeof($best_contact) == 0)
|
||||
foreach ($contacts AS $contact)
|
||||
if ($contact["network"] == "pump")
|
||||
$best_contact = array($contact);
|
||||
|
||||
if (sizeof($best_contact) == 0)
|
||||
foreach ($contacts AS $contact)
|
||||
if ($contact["network"] == "twit")
|
||||
$best_contact = array($contact);
|
||||
|
||||
if (sizeof($best_contact) == 1)
|
||||
$contacts = $best_contact;
|
||||
else
|
||||
$contacts = array($contacts[0]);
|
||||
}
|
||||
|
||||
/*
|
||||
Not implemented by now:
|
||||
favorites
|
||||
|
|
|
@ -504,6 +504,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
$tpl = 'search_item.tpl';
|
||||
|
||||
foreach($items as $item) {
|
||||
|
||||
if($arr_blocked) {
|
||||
$blocked = false;
|
||||
foreach($arr_blocked as $b) {
|
||||
|
@ -648,6 +649,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
$tmp_item = array(
|
||||
'template' => $tpl,
|
||||
'id' => (($preview) ? 'P0' : $item['item_id']),
|
||||
'network' => $item['item_network'],
|
||||
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
|
||||
'profile_url' => $profile_link,
|
||||
'item_photo_menu' => item_photo_menu($item),
|
||||
|
@ -693,6 +695,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
call_hooks('display_item', $arr);
|
||||
|
||||
$threads[$threadsid]['id'] = $item['item_id'];
|
||||
$threads[$threadsid]['network'] = $item['item_network'];
|
||||
$threads[$threadsid]['items'] = array($arr['output']);
|
||||
|
||||
}
|
||||
|
|
|
@ -60,9 +60,10 @@ function notification($params) {
|
|||
// If so don't create a second notification
|
||||
|
||||
$p = null;
|
||||
$p = q("select id from notify where ( type = %d or type = %d ) and link = '%s' and uid = %d limit 1",
|
||||
$p = q("select id from notify where (type = %d or type = %d or type = %d) and link = '%s' and uid = %d limit 1",
|
||||
intval(NOTIFY_TAGSELF),
|
||||
intval(NOTIFY_COMMENT),
|
||||
intval(NOTIFY_SHARE),
|
||||
dbesc($params['link']),
|
||||
intval($params['uid'])
|
||||
);
|
||||
|
@ -150,6 +151,19 @@ function notification($params) {
|
|||
$itemlink = $params['link'];
|
||||
}
|
||||
|
||||
if($params['type'] == NOTIFY_SHARE) {
|
||||
$subject = sprintf( t('[Friendica:Notify] %s shared a new post') , $params['source_name']);
|
||||
$preamble = sprintf( t('%1$s shared a new post at %2$s') , $params['source_name'], $sitename);
|
||||
$epreamble = sprintf( t('%1$s [url=%2$s]shared a post[/url].') ,
|
||||
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
|
||||
$params['link']);
|
||||
|
||||
$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_POKE) {
|
||||
|
||||
$subject = sprintf( t('[Friendica:Notify] %1$s poked you') , $params['source_name']);
|
||||
|
|
|
@ -406,7 +406,7 @@ function title_is_body($title, $body) {
|
|||
|
||||
|
||||
|
||||
function get_atom_elements($feed,$item) {
|
||||
function get_atom_elements($feed, $item, $contact = array()) {
|
||||
|
||||
require_once('library/HTMLPurifier.auto.php');
|
||||
require_once('include/html2bbcode.php');
|
||||
|
@ -846,6 +846,11 @@ function get_atom_elements($feed,$item) {
|
|||
};
|
||||
}
|
||||
|
||||
if (isset($contact["network"]) AND ($contact["network"] == NETWORK_FEED) AND $contact['fetch_further_information']) {
|
||||
$res["body"] = $res["title"]."\n\n[class=type-link]".fetch_siteinfo($res['plink'])."[/class]";
|
||||
$res["title"] = "";
|
||||
}
|
||||
|
||||
$arr = array('feed' => $feed, 'item' => $item, 'result' => $res);
|
||||
|
||||
call_hooks('parse_atom', $arr);
|
||||
|
@ -860,6 +865,31 @@ function get_atom_elements($feed,$item) {
|
|||
return $res;
|
||||
}
|
||||
|
||||
function fetch_siteinfo($url) {
|
||||
require_once("mod/parse_url.php");
|
||||
|
||||
// Fetch site infos - but only from the meta data
|
||||
$data = parseurl_getsiteinfo($url, true);
|
||||
|
||||
$text = "";
|
||||
|
||||
if (!is_string($data["text"]) AND (sizeof($data["images"]) == 0) AND ($data["title"] == $url))
|
||||
return("");
|
||||
|
||||
if (is_string($data["title"]))
|
||||
$text .= "[bookmark=".$url."]".trim($data["title"])."[/bookmark]\n";
|
||||
|
||||
if (sizeof($data["images"]) > 0) {
|
||||
$imagedata = $data["images"][0];
|
||||
$text .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]' . "\n";
|
||||
}
|
||||
|
||||
if (is_string($data["text"]))
|
||||
$text .= "[quote]".$data["text"]."[/quote]";
|
||||
|
||||
return($text);
|
||||
}
|
||||
|
||||
function encode_rel_links($links) {
|
||||
$o = '';
|
||||
if(! ((is_array($links)) && (count($links))))
|
||||
|
@ -1117,6 +1147,49 @@ function item_store($arr,$force_parent = false) {
|
|||
$current_post = $r[0]['id'];
|
||||
logger('item_store: created item ' . $current_post);
|
||||
create_tags_from_item($r[0]['id']);
|
||||
|
||||
// Only check for notifications on start posts
|
||||
if ($arr['parent-uri'] === $arr['uri']) {
|
||||
logger('item_store: Check notification for contact '.$arr['contact-id'].' and post '.$current_post, LOGGER_DEBUG);
|
||||
|
||||
// Send a notification for every new post?
|
||||
$r = q("SELECT `notify_new_posts` FROM `contact` WHERE `id` = %d AND `uid` = %d AND `notify_new_posts` LIMIT 1",
|
||||
intval($arr['contact-id']),
|
||||
intval($arr['uid'])
|
||||
);
|
||||
|
||||
if(count($r)) {
|
||||
logger('item_store: Send notification for contact '.$arr['contact-id'].' and post '.$current_post, LOGGER_DEBUG);
|
||||
$u = q("SELECT * FROM user WHERE uid = %d LIMIT 1",
|
||||
intval($arr['uid']));
|
||||
|
||||
$item = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d",
|
||||
intval($current_post),
|
||||
intval($arr['uid'])
|
||||
);
|
||||
|
||||
$a = get_app();
|
||||
|
||||
require_once('include/enotify.php');
|
||||
notification(array(
|
||||
'type' => NOTIFY_SHARE,
|
||||
'notify_flags' => $u[0]['notify-flags'],
|
||||
'language' => $u[0]['language'],
|
||||
'to_name' => $u[0]['username'],
|
||||
'to_email' => $u[0]['email'],
|
||||
'uid' => $u[0]['uid'],
|
||||
'item' => $item[0],
|
||||
'link' => $a->get_baseurl().'/display/'.$u[0]['nickname'].'/'.$current_post,
|
||||
'source_name' => $item[0]['author-name'],
|
||||
'source_link' => $item[0]['author-link'],
|
||||
'source_photo' => $item[0]['author-avatar'],
|
||||
'verb' => ACTIVITY_TAG,
|
||||
'otype' => 'item'
|
||||
));
|
||||
logger('item_store: Notification sent for contact '.$arr['contact-id'].' and post '.$current_post, LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
logger('item_store: could not locate created item');
|
||||
return 0;
|
||||
|
@ -1138,7 +1211,7 @@ function item_store($arr,$force_parent = false) {
|
|||
else
|
||||
$private = $arr['private'];
|
||||
|
||||
// Set parent id - and also make sure to inherit the parent's ACL's.
|
||||
// Set parent id - and also make sure to inherit the parent's ACLs.
|
||||
|
||||
$r = q("UPDATE `item` SET `parent` = %d, `allow_cid` = '%s', `allow_gid` = '%s',
|
||||
`deny_cid` = '%s', `deny_gid` = '%s', `private` = %d, `deleted` = %d WHERE `id` = %d",
|
||||
|
@ -2023,7 +2096,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
// Have we seen it? If not, import it.
|
||||
|
||||
$item_id = $item->get_id();
|
||||
$datarray = get_atom_elements($feed,$item);
|
||||
$datarray = get_atom_elements($feed, $item, $contact);
|
||||
|
||||
if((! x($datarray,'author-name')) && ($contact['network'] != NETWORK_DFRN))
|
||||
$datarray['author-name'] = $contact['name'];
|
||||
|
@ -2164,7 +2237,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
|
||||
$item_id = $item->get_id();
|
||||
|
||||
$datarray = get_atom_elements($feed,$item);
|
||||
$datarray = get_atom_elements($feed, $item, $contact);
|
||||
|
||||
if(is_array($contact)) {
|
||||
if((! x($datarray,'author-name')) && ($contact['network'] != NETWORK_DFRN))
|
||||
|
|
|
@ -44,6 +44,11 @@ function check_conversations() {
|
|||
function complete_conversation($itemid, $conversation_url, $only_add_conversation = false) {
|
||||
global $a;
|
||||
|
||||
if ($a->last_ostatus_conversation_url == $conversation_url)
|
||||
return;
|
||||
|
||||
$a->last_ostatus_conversation_url = $conversation_url;
|
||||
|
||||
//logger('complete_conversation: completing conversation url '.$conversation_url.' for id '.$itemid);
|
||||
|
||||
$messages = q("SELECT `uid`, `parent`, `created` FROM `item` WHERE `id` = %d LIMIT 1", intval($itemid));
|
||||
|
|
|
@ -341,7 +341,7 @@ abstract class Slinky_Service {
|
|||
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 ); // Don't stress about SSL validity
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // Return the response, don't output it
|
||||
curl_setopt( $ch, CURLOPT_TIMEOUT, SLINKY_TIMEOUT ); // Limit how long we'll wait for a response
|
||||
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); // Allow following of redirections
|
||||
//curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); // Allow following of redirections
|
||||
$r = curl_exec( $ch );
|
||||
if ( curl_errno( $ch ) ) {
|
||||
return false;
|
||||
|
@ -372,7 +372,7 @@ abstract class Slinky_Service {
|
|||
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 ); // Don't stress about SSL validity
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // Return the response, don't output it
|
||||
curl_setopt( $ch, CURLOPT_TIMEOUT, SLINKY_TIMEOUT ); // Limit how long we'll wait for a response
|
||||
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); // Allow following of redirections
|
||||
//curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); // Allow following of redirections
|
||||
$r = curl_exec( $ch );
|
||||
if ( curl_errno( $ch ) ) {
|
||||
return false;
|
||||
|
|
|
@ -153,6 +153,10 @@ function contacts_post(&$a) {
|
|||
|
||||
$hidden = intval($_POST['hidden']);
|
||||
|
||||
$notify = intval($_POST['notify']);
|
||||
|
||||
$fetch_further_information = intval($_POST['fetch_further_information']);
|
||||
|
||||
$priority = intval($_POST['poll']);
|
||||
if($priority > 5 || $priority < 0)
|
||||
$priority = 0;
|
||||
|
@ -160,11 +164,13 @@ function contacts_post(&$a) {
|
|||
$info = fix_mce_lf(escape_tags(trim($_POST['info'])));
|
||||
|
||||
$r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s',
|
||||
`hidden` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
`hidden` = %d, `notify_new_posts` = %d, `fetch_further_information` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($profile_id),
|
||||
intval($priority),
|
||||
dbesc($info),
|
||||
intval($hidden),
|
||||
intval($notify),
|
||||
intval($fetch_further_information),
|
||||
intval($contact_id),
|
||||
intval(local_user())
|
||||
);
|
||||
|
@ -489,6 +495,8 @@ function contacts_content(&$a) {
|
|||
'$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''),
|
||||
'$archived' => (($contact['archive']) ? t('Currently archived') : ''),
|
||||
'$hidden' => array('hidden', t('Hide this contact from others'), ($contact['hidden'] == 1), t('Replies/likes to your public posts <strong>may</strong> still be visible')),
|
||||
'$notify' => array('notify', t('Notification for new posts'), ($contact['notify_new_posts'] == 1), t('Send a notification of every new post of this contact')),
|
||||
'$fetch_further_information' => array('fetch_further_information', t('Fetch further information for feeds'), ($contact['fetch_further_information'] == 1), t('Fetch further information for feeds')),
|
||||
'$photo' => $contact['photo'],
|
||||
'$name' => $contact['name'],
|
||||
'$dir_icon' => $dir_icon,
|
||||
|
|
|
@ -59,9 +59,9 @@ function crepair_post(&$a) {
|
|||
$poll = ((x($_POST,'poll')) ? $_POST['poll'] : '');
|
||||
$attag = ((x($_POST,'attag')) ? $_POST['attag'] : '');
|
||||
$photo = ((x($_POST,'photo')) ? $_POST['photo'] : '');
|
||||
$remote_self = ((x($_POST,'remote_self')) ? intval($_POST['remote_self']) : 0);
|
||||
$remote_self = ((x($_POST,'remote_self')) ? $_POST['remote_self'] : false);
|
||||
|
||||
$r = q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `url` = '%s', `request` = '%s', `confirm` = '%s', `notify` = '%s', `poll` = '%s', `attag` = '%s', `remote_self` = '%d'
|
||||
$r = q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `url` = '%s', `request` = '%s', `confirm` = '%s', `notify` = '%s', `poll` = '%s', `attag` = '%s' , `remote_self` = %d
|
||||
WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
dbesc($name),
|
||||
dbesc($nick),
|
||||
|
@ -71,7 +71,7 @@ function crepair_post(&$a) {
|
|||
dbesc($notify),
|
||||
dbesc($poll),
|
||||
dbesc($attag),
|
||||
$remote_self,
|
||||
intval($remote_self),
|
||||
intval($contact['id']),
|
||||
local_user()
|
||||
);
|
||||
|
|
|
@ -311,9 +311,9 @@ function parse_url_content(&$a) {
|
|||
logger('parse_url: ' . $url);
|
||||
|
||||
if($textmode)
|
||||
$template = $br . '[bookmark=%s]%s[/bookmark]%s' . $br;
|
||||
$template = '[bookmark=%s]%s[/bookmark]%s' . $br;
|
||||
else
|
||||
$template = "<br /><a class=\"bookmark\" href=\"%s\" >%s</a>%s<br />";
|
||||
$template = "<a class=\"bookmark\" href=\"%s\" >%s</a>%s<br />";
|
||||
|
||||
$arr = array('url' => $url, 'text' => '');
|
||||
|
||||
|
@ -328,9 +328,9 @@ function parse_url_content(&$a) {
|
|||
if($url && $title && $text) {
|
||||
|
||||
if($textmode)
|
||||
$text = $br . '[quote]' . trim($text) . '[/quote]' . $br;
|
||||
$text = '[quote]' . trim($text) . '[/quote]' . $br;
|
||||
else
|
||||
$text = '<br /><blockquote>' . trim($text) . '</blockquote><br />';
|
||||
$text = '<blockquote>' . trim($text) . '</blockquote><br />';
|
||||
|
||||
$title = str_replace(array("\r","\n"),array('',''),$title);
|
||||
|
||||
|
@ -344,8 +344,10 @@ function parse_url_content(&$a) {
|
|||
|
||||
$siteinfo = parseurl_getsiteinfo($url);
|
||||
|
||||
$sitedata = "";
|
||||
|
||||
if($siteinfo["title"] == "") {
|
||||
echo sprintf($template,$url,$url,'') . $str_tags;
|
||||
$sitedata .= sprintf($template,$url,$url,'') . $str_tags;
|
||||
killme();
|
||||
} else {
|
||||
$text = $siteinfo["text"];
|
||||
|
@ -377,20 +379,24 @@ function parse_url_content(&$a) {
|
|||
|
||||
if(strlen($text)) {
|
||||
if($textmode)
|
||||
$text = $br.'[quote]'.trim($text).'[/quote]'.$br ;
|
||||
$text = '[quote]'.trim($text).'[/quote]';
|
||||
else
|
||||
$text = '<br /><blockquote>'.trim($text).'</blockquote><br />';
|
||||
$text = '<blockquote>'.trim($text).'</blockquote>';
|
||||
}
|
||||
|
||||
if($image) {
|
||||
$text = $br.$br.$image.$text;
|
||||
}
|
||||
|
||||
$title = str_replace(array("\r","\n"),array('',''),$title);
|
||||
|
||||
$result = sprintf($template,$url,($title) ? $title : $url,$text) . $str_tags;
|
||||
|
||||
logger('parse_url: returns: ' . $result);
|
||||
|
||||
echo trim($result);
|
||||
$sitedata .= trim($result);
|
||||
|
||||
echo "[class=type-link]".$sitedata."[/class]";
|
||||
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
Site speed can be improved when the following indexes are set. They cannot be set through the update script because on large sites they will block the site for several minutes.
|
||||
Site speed can be improved when the following indexes are set. They
|
||||
cannot be set through the update script because on large sites they will
|
||||
block the site for several minutes.
|
||||
|
||||
CREATE INDEX `uid_commented` ON `item` (`uid`, `commented`);
|
||||
CREATE INDEX `uid_created` ON `item` (`uid`, `created`);
|
||||
CREATE INDEX `uid_unseen` ON `item` (`uid`, `unseen`);
|
||||
CREATE INDEX `resource-id` ON `item` (`resource-id`);
|
||||
CREATE INDEX `uri_received` ON item(`uri`, `received`);
|
||||
CREATE INDEX `received_uri` ON item(`received`, `uri`);
|
||||
CREATE INDEX `contact-id_created` ON item(`contact-id`, created);
|
||||
CREATE INDEX `uid_network_received` ON item(`uid`, `network`, `received`);
|
||||
CREATE INDEX `uid_parent` ON item(`uid`, `parent`);
|
||||
CREATE INDEX `uid_received` ON item(`uid`, `received`);
|
||||
CREATE INDEX `uid_network_commented` ON item(`uid`, `network`, `commented`);
|
||||
CREATE INDEX `uid_commented` ON item(`uid`, `commented`);
|
||||
CREATE INDEX `uid_title` ON item(uid, `title`);
|
||||
CREATE INDEX `created_contact-id` ON item(`created`, `contact-id`);
|
||||
|
|
18
update.php
18
update.php
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
define( 'UPDATE_VERSION' , 1167 );
|
||||
define( 'UPDATE_VERSION' , 1169 );
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -1541,3 +1541,19 @@ function update_1166() {
|
|||
|
||||
return UPDATE_SUCCESS;
|
||||
}
|
||||
|
||||
function update_1167() {
|
||||
$r = q("ALTER TABLE `contact` ADD `notify_new_posts` TINYINT(1) NOT NULL DEFAULT '0'");
|
||||
if (!$r)
|
||||
return UPDATE_FAILED;
|
||||
|
||||
return UPDATE_SUCCESS;
|
||||
}
|
||||
|
||||
function update_1168() {
|
||||
$r = q("ALTER TABLE `contact` ADD `fetch_further_information` TINYINT(1) NOT NULL DEFAULT '0'");
|
||||
if (!$r)
|
||||
return UPDATE_FAILED;
|
||||
|
||||
return UPDATE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,8 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
<div id="contact-edit-end" ></div>
|
||||
|
||||
{{include file="field_checkbox.tpl" field=$notify}}
|
||||
{{include file="field_checkbox.tpl" field=$fetch_further_information}}
|
||||
{{include file="field_checkbox.tpl" field=$hidden}}
|
||||
|
||||
<div id="contact-edit-info-wrapper">
|
||||
|
|
|
@ -291,7 +291,9 @@ blockquote.shared_content {
|
|||
body {
|
||||
font-family: 'Lato', "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
background-color: #ffffff;
|
||||
/* background-color: #ffffff; */
|
||||
background-color: #FAFAFA;
|
||||
/* background-color: rgb(252, 252, 252); */
|
||||
color: #2d2d2d;
|
||||
margin: 0px 0px 0px 0px;
|
||||
display: table;
|
||||
|
@ -1087,7 +1089,9 @@ section {
|
|||
width: 766px;
|
||||
max-width: 766px;
|
||||
padding: 10px 10px 10px 10px;
|
||||
background-color: white;
|
||||
/* background-color: white; */
|
||||
/* background-color: rgb(252, 252, 252); */
|
||||
background-color: #FAFAFA;
|
||||
border-bottom: 1px solid lightgray;
|
||||
border-right: 1px solid lightgray;
|
||||
border-left: 1px solid lightgray;
|
||||
|
@ -1410,6 +1414,31 @@ border-bottom: 1px solid #D2D2D2;
|
|||
padding-right: 12px; */
|
||||
}
|
||||
|
||||
.twit {
|
||||
background-color: #FFFAFA;
|
||||
}
|
||||
.pump {
|
||||
background-color: #FAFFFA;
|
||||
}
|
||||
.face {
|
||||
background-color: #FAFAFF;
|
||||
}
|
||||
.feed {
|
||||
background-color: #FFFFFA;
|
||||
}
|
||||
.dspr {
|
||||
background-color: #FFFAFF;
|
||||
}
|
||||
.dfrn {
|
||||
background-color: #FAFFFF;
|
||||
}
|
||||
.stat {
|
||||
background-color: #FAFAFA;
|
||||
}
|
||||
.mail {
|
||||
background-color: #FFFFF9;
|
||||
}
|
||||
|
||||
#profile-jot-form #profile-jot-text {
|
||||
height: 2.0em;
|
||||
/* width: 99%; */
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
{{foreach $threads as $thread}}
|
||||
|
||||
<div id="tread-wrapper-{{$thread.id}}" class="tread-wrapper {{if $thread.threaded}}threaded{{/if}} {{$thread.toplevel}}">
|
||||
<div id="tread-wrapper-{{$thread.id}}" class="tread-wrapper {{if $thread.threaded}}threaded{{/if}} {{$thread.toplevel}} {{$thread.network}}">
|
||||
|
||||
|
||||
{{if $thread.type == tag}}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
|
||||
</div>
|
||||
|
||||
<div class="wall-item-container {{$item.indent}} {{$item.shiny}} " id="item-{{$item.id}}">
|
||||
<div class="wall-item-container {{$item.indent}} {{$item.shiny}} {{$item.network}}" id="item-{{$item.id}}">
|
||||
<div class="wall-item-item">
|
||||
<div class="wall-item-info">
|
||||
<div class="contact-photo-wrapper mframe{{if $item.owner_url}} wwfrom{{/if}}"
|
||||
|
|
Loading…
Reference in a new issue