require_once('library/defuse/php-encryption-1.2.1/Crypto.php');
-function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0, $forpubsub = false) {
+function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0) {
$sitefeed = ((strlen($owner_nick)) ? false : true); // not yet implemented, need to rewrite huge chunks of following logic
else
$sort = 'ASC';
- // Include answers to status.net posts in pubsub feeds
- if($forpubsub) {
- $sql_post_table = "INNER JOIN `thread` ON `thread`.`iid` = `item`.`parent`
- LEFT JOIN `item` AS `thritem` ON `thritem`.`uri`=`item`.`thr-parent` AND `thritem`.`uid`=`item`.`uid`";
- $visibility = sprintf("AND (`item`.`parent` = `item`.`id`) OR (`item`.`network` = '%s' AND ((`thread`.`network`='%s') OR (`thritem`.`network` = '%s')))",
- dbesc(NETWORK_DFRN), dbesc(NETWORK_OSTATUS), dbesc(NETWORK_OSTATUS));
- $date_field = "`received`";
- $sql_order = "`item`.`received` DESC";
- } else {
- $date_field = "`changed`";
- $sql_order = "`item`.`parent` ".$sort.", `item`.`created` ASC";
- }
+ $date_field = "`changed`";
+ $sql_order = "`item`.`parent` ".$sort.", `item`.`created` ASC";
if(! strlen($last_update))
$last_update = 'now -30 days';
$a = get_app();
$hashtags = "\n";
foreach ($data["keywords"] AS $keyword) {
- $hashtag = str_replace(array(" ", "+", "/", ".", "#", "'"),
- array("","", "", "", "", ""), $keyword);
+ /// @todo make a positive list of allowed characters
+ $hashtag = str_replace(array(" ", "+", "/", ".", "#", "'", "’", "`", "(", ")", "„", "“"),
+ array("","", "", "", "", "", "", "", "", "", "", ""), $keyword);
$hashtags .= "#[url=".$a->get_baseurl()."/search?tag=".rawurlencode($hashtag)."]".$hashtag."[/url] ";
}
}
function query_page_info($url, $no_photos = false, $photo = "", $keywords = false, $keyword_blacklist = "") {
require_once("mod/parse_url.php");
- $data = Cache::get("parse_url:".$url);
- if (is_null($data)){
- $data = parseurl_getsiteinfo($url, true);
- Cache::set("parse_url:".$url,serialize($data), CACHE_DAY);
- } else
- $data = unserialize($data);
+ $data = parseurl_getsiteinfo_cached($url, true);
if ($photo != "")
$data["images"][0]["src"] = $photo;
logger("item_store: Set network to ".$arr["network"]." for ".$arr["uri"], LOGGER_DEBUG);
}
+ if ($arr["gcontact-id"] == 0)
+ $arr["gcontact-id"] = get_gcontact_id(array("url" => $arr['author-link'], "network" => $arr['network'],
+ "photo" => $arr['author-avatar'], "name" => $arr['author-name']));
+
if ($arr['guid'] != "") {
// Checking if there is already an item with the same guid
logger('checking for an item for user '.$arr['uid'].' on network '.$arr['network'].' with the guid '.$arr['guid'], LOGGER_DEBUG);
);
if($dsprsig) {
+
+ // Friendica servers lower than 3.4.3-2 had double encoded the signature ...
+ // We can check for this condition when we decode and encode the stuff again.
+ if (base64_encode(base64_decode(base64_decode($dsprsig->signature))) == base64_decode($dsprsig->signature)) {
+ $dsprsig->signature = base64_decode($dsprsig->signature);
+ logger("Repaired double encoded signature from handle ".$dsprsig->signer, LOGGER_DEBUG);
+ }
+
q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
intval($current_post),
dbesc($dsprsig->signed_text),
logger('consume_feed: feed item count = ' . $feed->get_item_quantity());
- // in inverse date order
+ // in inverse date order
if ($datedir)
$items = array_reverse($feed->get_items());
else