revamp of item structure

This commit is contained in:
Mike Macgirvin 2010-07-18 23:23:18 -07:00
parent 3c0c8a2dc1
commit 9b0584e593
8 changed files with 108 additions and 111 deletions

View file

@ -30,6 +30,7 @@ class App {
public $argc;
public $module;
public $pager;
private $scheme;
private $hostname;
private $path;
@ -83,6 +84,13 @@ class App {
$this->baseurl = $url;
}
function get_hostname() {
return $this->hostname;
}
function set_hostname($h) {
$this->hostname = $h;
}
function set_path($p) {
$this->path = ltrim(trim($p),'/');
@ -306,7 +314,7 @@ function goaway($s) {
if(! function_exists('xml_status')) {
function xml_status($st) {
header( "Content-type: text/xml");
header( "Content-type: text/xml" );
echo '<?xml version="1.0" encoding="UTF-8"?>'."\r\n";
echo "<result><status>$st</status></result>\r\n";
killme();

View file

@ -95,7 +95,7 @@ function get_feed_for(&$a,$dfrn_id,$owner_id,$last_update) {
foreach($items as $item) {
if($item['deleted']) {
$atom .= replace_macros($tomb_template, array(
'$id' => xmlify(((strlen($item['remote-id'])) ? $item['remote-id'] : "urn:X-dfrn:" . $a->get_baseurl() . ":{$owner['uid']}:{$item['hash']}")),
'$id' => xmlify($item['uri']),
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z'))
));
}
@ -109,7 +109,7 @@ function get_feed_for(&$a,$dfrn_id,$owner_id,$last_update) {
'$owner_name' => xmlify($item['owner-name']),
'$owner_profile_page' => xmlify($item['owner-link']),
'$owner_thumb' => xmlify($item['owner-avatar']),
'$item_id' => xmlify(((strlen($item['remote-id'])) ? $item['remote-id'] : "urn:X-dfrn:" . $a->get_baseurl() . ":{$owner['uid']}:{$item['hash']}")),
'$item_id' => xmlify($item['uri']),
'$title' => xmlify($item['name']),
'$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
@ -122,14 +122,12 @@ function get_feed_for(&$a,$dfrn_id,$owner_id,$last_update) {
'$name' => xmlify($item['name']),
'$profile_page' => xmlify($item['url']),
'$thumb' => xmlify($item['thumb']),
'$item_id' => xmlify(((strlen($item['remote-id'])) ? $item['remote-id'] : "urn:X-dfrn:" . $a->get_baseurl() . ":{$owner['uid']}:{$item['hash']}")),
'$item_id' => xmlify($item['uri']),
'$title' => xmlify($item['title']),
'$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$content' =>xmlify($item['body']),
// ......this is wrong!!!!
'$parent_id' => xmlify("urn:X-dfrn:" . $a->get_baseurl() . ":{$owner['uid']}:{$items[0]['hash']}"),
'$parent_id' => xmlify($item['parent-uri']),
'$comment_allow' => (($item['last-child']) ? 1 : 0)
));
}
@ -149,10 +147,10 @@ function get_atom_elements($item) {
$res = array();
$author = $item->get_author();
$res['remote-name'] = unxmlify($author->get_name());
$res['remote-link'] = unxmlify($author->get_link());
$res['remote-avatar'] = unxmlify($author->get_avatar());
$res['remote-id'] = unxmlify($item->get_id());
$res['author-name'] = unxmlify($author->get_name());
$res['author-link'] = unxmlify($author->get_link());
$res['author-avatar'] = unxmlify($author->get_avatar());
$res['uri'] = unxmlify($item->get_id());
$res['title'] = unxmlify($item->get_title());
$res['body'] = unxmlify($item->get_content());
@ -187,19 +185,16 @@ function get_atom_elements($item) {
function post_remote($a,$arr) {
$arr['hash'] = random_string();
if(! x($arr,'type'))
$arr['type'] = 'remote';
$arr['remote-name'] = notags(trim($arr['remote-name']));
$arr['remote-link'] = notags(trim($arr['remote-link']));
$arr['remote-avatar'] = notags(trim($arr['remote-avatar']));
$arr['uri'] = notags(trim($arr['uri']));
$arr['author-name'] = notags(trim($arr['author-name']));
$arr['author-link'] = notags(trim($arr['author-link']));
$arr['author-avatar'] = notags(trim($arr['author-avatar']));
$arr['owner-name'] = notags(trim($arr['owner-name']));
$arr['owner-link'] = notags(trim($arr['owner-link']));
$arr['owner-avatar'] = notags(trim($arr['owner-avatar']));
if(! strlen($arr['remote-avatar']))
$arr['remote-avatar'] = $a->get_baseurl() . '/images/default-profile-sm.jpg';
if(! strlen($arr['owner-avatar']))
$arr['owner-avatar'] = $a->get_baseurl() . '/images/default-profile-sm.jpg';
$arr['created'] = datetime_convert('UTC','UTC',$arr['created'],'Y-m-d H:i:s');
$arr['edited'] = datetime_convert('UTC','UTC',$arr['edited'],'Y-m-d H:i:s');
$arr['title'] = notags(trim($arr['title']));
@ -207,18 +202,7 @@ function post_remote($a,$arr) {
$arr['last-child'] = intval($arr['last-child']);
$arr['visible'] = 1;
$arr['deleted'] = 0;
$local_parent = false;
if(isset($arr['parent_hash'])) {
$local_parent = true;
$parent = $arr['parent_hash'];
unset($arr['parent_hash']);
}
else {
$parent = $arr['parent_urn'];
unset($arr['parent_urn']);
}
$arr['parent-uri'] = notags(trim($arr['parent-uri']));
$parent_id = 0;
@ -230,24 +214,19 @@ dbg(3);
. implode("', '", array_values($arr))
. "')" );
if($local_parent) {
$r = q("SELECT `id` FROM `item` WHERE `hash` = '%s' AND `uid` = %d LIMIT 1",
dbesc($parent),
intval($arr['uid'])
);
}
else {
$r = q("SELECT `id` FROM `item` WHERE `remote-id` = '%s' AND `uid` = %d LIMIT 1",
dbesc($parent),
intval($arr['uid'])
);
}
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($arr['parent-uri']),
intval($arr['uid'])
);
if(count($r))
$parent_id = $r[0]['id'];
else {
// if parent is missing, what do we do?
}
$r = q("SELECT `id` FROM `item` WHERE `remote-id` = '%s' AND `uid` = %d LIMIT 1",
$arr['remote-id'],
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
$arr['uri'],
intval($arr['uid'])
);
if(count($r))

View file

@ -12,11 +12,12 @@ $db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
require_once("session.php");
require_once("datetime.php");
dbg(3);
if($argc < 3)
exit;
$baseurl = trim(hex2bin($argv[1]));
$baseurl = $argv[1]);
$a->set_baseurl($argv[1]);
$cmd = $argv[2];
@ -65,7 +66,8 @@ if($argc < 3)
$parent = $items[0];
if((strlen($parent['remote-id'])) && ($parent['type'] == 'remote')) {
if($parent['type'] == 'remote') {
// local followup to remote post
$followup = true;
$conversant_str = dbesc($parent['contact-id']);
}
@ -94,7 +96,7 @@ if($argc < 3)
$conversant_str = dbesc(implode(', ',$conversants));
}
$r = q("SELECT * FROM `contact` WHERE `id` IN ( $conversant_str ) ");
$r = q("SELECT * FROM `contact` WHERE `id` IN ( $conversant_str ) AND `blocked` = 0 ");
if( ! count($r))
killme();
@ -111,9 +113,10 @@ if($argc < 3)
$atom .= replace_macros($feed_template, array(
'$feed_id' => xmlify($baseurl),
'$feed_id' => xmlify($a->get_baseurl()),
'$feed_title' => xmlify($owner['name']),
'$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', $updated . '+00:00' , 'Y-m-d\TH:i:s\Z')) ,
'$feed_updated' => xmlify(datetime_convert('UTC', 'UTC',
$updated . '+00:00' , 'Y-m-d\TH:i:s\Z')) ,
'$name' => xmlify($owner['name']),
'$profile_page' => xmlify($owner['url']),
'$photo' => xmlify($owner['photo'])
@ -126,12 +129,14 @@ if($argc < 3)
'$name' => xmlify($owner['name']),
'$profile_page' => xmlify($owner['url']),
'$thumb' => xmlify($owner['thumb']),
'$item_id' => xmlify("urn:X-dfrn:$baseurl:{$owner['uid']}:{$item['hash']}"),
'$item_id' => xmlify($item['uri']),
'$title' => xmlify($item['title']),
'$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$published' => xmlify(datetime_convert('UTC', 'UTC',
$item['created'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$updated' => xmlify(datetime_convert('UTC', 'UTC',
$item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$content' =>xmlify($item['body']),
'$parent_id' => xmlify("{$items[0]['remote-id']}"),
'$parent_id' => xmlify($item['parent-uri']),
'$comment_allow' => 0
));
}
@ -141,8 +146,9 @@ if($argc < 3)
foreach($items as $item) {
if($item['deleted']) {
$atom .= replace_macros($tomb_template, array(
'$id' => xmlify("urn:X-dfrn:$baseurl:{$owner['uid']}:{$item['hash']}"),
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z'))
'$id' => xmlify($item['uri']),
'$updated' => xmlify(datetime_convert('UTC', 'UTC',
$item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z'))
));
}
else {
@ -156,12 +162,14 @@ if($argc < 3)
'$owner_name' => xmlify($item['owner-name']),
'$owner_profile_page' => xmlify($item['owner-link']),
'$owner_thumb' => xmlify($item['owner-avatar']),
'$item_id' => xmlify(((strlen($item['remote-id'])) ? $item['remote-id'] : "urn:X-dfrn:$baseurl:{$owner['uid']}:{$item['hash']}")),
'$item_id' => xmlify($item['uri']),
'$title' => xmlify($contact['name']),
'$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$published' => xmlify(datetime_convert('UTC', 'UTC',
$item['created'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$updated' => xmlify(datetime_convert('UTC', 'UTC',
$item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$content' =>xmlify($item['body']),
'$comment_allow' => (($item['last-child'] && strlen($contact['dfrn-id'] && (! $contact['blocked']))) ? 1 : 0)
'$comment_allow' => (($item['last-child'] && strlen($contact['dfrn-id'])) ? 1 : 0)
));
}
else {
@ -169,12 +177,14 @@ if($argc < 3)
'$name' => xmlify($contact['name']),
'$profile_page' => xmlify($contact['url']),
'$thumb' => xmlify($contact['thumb']),
'$item_id' => xmlify(((strlen($item['remote-id'])) ? $item['remote-id'] : "urn:X-dfrn:$baseurl:{$owner['uid']}:{$item['hash']}")),
'$item_id' => xmlify($item['uri']),
'$title' => xmlify($item['title']),
'$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$published' => xmlify(datetime_convert('UTC', 'UTC',
$item['created'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$updated' => xmlify(datetime_convert('UTC', 'UTC',
$item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$content' =>xmlify($item['body']),
'$parent_id' => xmlify("urn:X-dfrn:$baseurl:{$owner['uid']}:{$items[0]['hash']}"),
'$parent_id' => xmlify($item['parent-uri']),
'$comment_allow' => (($item['last-child']) ? 1 : 0)
));
}
@ -187,7 +197,7 @@ if($argc < 3)
// create a clone of this feed but with comments disabled to send to those who can't respond.
$atom_nowrite = str_replace('<dfrn:comment-allow>1</dfrn:comment-allow>','<dfrn:comment-allow>0</dfrn:comment-allow>',$atom);
$atom_nowrite = str_replace('<dfrn:comment-allow>1','<dfrn:comment-allow>0',$atom);
if($followup)
@ -206,7 +216,6 @@ if($argc < 3)
foreach($r as $rr) {
echo "In delivery loop:";
if($rr['self'])
continue;
@ -235,11 +244,8 @@ echo "In delivery loop:";
$postvars['data'] = $atom;
else
$postvars['data'] = $atom_nowrite;
echo "URL:" . $url;
echo "POSTVARS:" . print_r($postvars);
$xml = post_url($url,$postvars);
echo "XML response:" . $xml;
$xml = post_url($rr['notify'],$postvars);
}

View file

@ -89,7 +89,7 @@ echo "Length:" . strlen($xml) . "\r\n";
$rawthread = $item->get_item_tags("http://purl.org/syndication/thread/1.0",'in-reply-to');
if(isset($rawthread[0]['attribs']['']['ref'])) {
$is_reply = true;
$parent_urn = $rawthread[0]['attribs']['']['ref'];
$parent_uri = $rawthread[0]['attribs']['']['ref'];
}
@ -99,7 +99,7 @@ echo "Length:" . strlen($xml) . "\r\n";
$item_id = $item->get_id();
$r = q("SELECT `uid`, `last-child`, `edited` FROM `item` WHERE `remote-id` = '%s' AND `uid` = %d LIMIT 1",
$r = q("SELECT `uid`, `last-child`, `edited` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($item_id),
intval($importer['uid'])
);
@ -107,7 +107,7 @@ echo "Length:" . strlen($xml) . "\r\n";
if(count($r)) {
$allow = $item->get_item_tags('http://purl.org/macgirvin/dfrn/1.0','comment-allow');
if($allow && $allow[0]['data'] != $r[0]['last-child']) {
$r = q("UPDATE `item` SET `last-child` = %d WHERE `remote-id` = '%s' AND `uid` = %d LIMIT 1",
$r = q("UPDATE `item` SET `last-child` = %d WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
intval($allow[0]['data']),
dbesc($item_id),
intval($importer['uid'])
@ -116,7 +116,7 @@ echo "Length:" . strlen($xml) . "\r\n";
continue;
}
$datarray = get_atom_elements($item);
$datarray['parent_urn'] = $parent_urn;
$datarray['parent-uri'] = $parent_uri;
$datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $importer['id'];
$r = post_remote($a,$datarray);
@ -127,14 +127,14 @@ echo "Length:" . strlen($xml) . "\r\n";
// Head post of a conversation. Have we seen it? If not, import it.
$item_id = $item->get_id();
$r = q("SELECT `uid`, `last-child`, `edited` FROM `item` WHERE `remote-id` = '%s' AND `uid` = %d LIMIT 1",
$r = q("SELECT `uid`, `last-child`, `edited` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($item_id),
intval($importer['uid'])
);
if(count($r)) {
$allow = $item->get_item_tags('http://purl.org/macgirvin/dfrn/1.0','comment-allow');
if($allow && $allow[0]['data'] != $r[0]['last-child']) {
$r = q("UPDATE `item` SET `last-child` = %d WHERE `remote-id` = '%s' AND `uid` = %d LIMIT 1",
$r = q("UPDATE `item` SET `last-child` = %d WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
intval($allow[0]['data']),
dbesc($item_id),
intval($importer['uid'])
@ -144,7 +144,7 @@ echo "Length:" . strlen($xml) . "\r\n";
}
$datarray = get_atom_elements($item);
$datarray['parent_urn'] = $item_id;
$datarray['parent-uri'] = $item_id;
$datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $importer['id'];
$r = post_remote($a,$datarray);

View file

@ -54,7 +54,7 @@ dbg(3);
$rawthread = $item->get_item_tags("http://purl.org/syndication/thread/1.0",'in-reply-to');
if(isset($rawthread[0]['attribs']['']['ref'])) {
$is_reply = true;
$parent_urn = $rawthread[0]['attribs']['']['ref'];
$parent_uri = $rawthread[0]['attribs']['']['ref'];
}
@ -64,7 +64,7 @@ dbg(3);
$datarray = get_atom_elements($item);
$urn = explode(':',$parent_urn);
$datarray['type'] = 'remote-comment';
$datarray['parent_hash'] = $urn[5];
$datarray['parent-uri'] = $parent_uri;
$datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $importer['id'];
$posted_id = post_remote($a,$datarray);
@ -84,7 +84,7 @@ dbg(3);
intval($posted_id)
);
$url = bin2hex($a->get_baseurl());
$url = $a->get_baseurl();
proc_close(proc_open("php include/notifier.php $url comment-import $posted_id > remote-notify.log &", array(),$foo));
@ -97,7 +97,7 @@ dbg(3);
$item_id = $item->get_id();
$r = q("SELECT `uid`, `last-child`, `edited` FROM `item` WHERE `remote-id` = '%s' AND `uid` = %d LIMIT 1",
$r = q("SELECT `uid`, `last-child`, `edited` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($item_id),
intval($importer['uid'])
);
@ -105,7 +105,7 @@ dbg(3);
if(count($r)) {
$allow = $item->get_item_tags('http://purl.org/macgirvin/dfrn/1.0','comment-allow');
if($allow && $allow[0]['data'] != $r[0]['last-child']) {
$r = q("UPDATE `item` SET `last-child` = %d WHERE `remote-id` = '%s' AND `uid` = %d LIMIT 1",
$r = q("UPDATE `item` SET `last-child` = %d WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
intval($allow[0]['data']),
dbesc($item_id),
intval($importer['uid'])
@ -114,7 +114,7 @@ dbg(3);
continue;
}
$datarray = get_atom_elements($item);
$datarray['parent_urn'] = $parent_urn;
$datarray['parent-uri'] = $parent_uri;
$datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $importer['id'];
$r = post_remote($a,$datarray);
@ -125,14 +125,14 @@ dbg(3);
// Head post of a conversation. Have we seen it? If not, import it.
$item_id = $item->get_id();
$r = q("SELECT `uid`, `last-child`, `edited` FROM `item` WHERE `remote-id` = '%s' AND `uid` = %d LIMIT 1",
$r = q("SELECT `uid`, `last-child`, `edited` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($item_id),
intval($importer['uid'])
);
if(count($r)) {
$allow = $item->get_item_tags('http://purl.org/macgirvin/dfrn/1.0','comment-allow');
if($allow && $allow[0]['data'] != $r[0]['last-child']) {
$r = q("UPDATE `item` SET `last-child` = %d WHERE `remote-id` = '%s' AND `uid` = %d LIMIT 1",
$r = q("UPDATE `item` SET `last-child` = %d WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
intval($allow[0]['data']),
dbesc($item_id),
intval($importer['uid'])
@ -143,7 +143,7 @@ dbg(3);
$datarray = get_atom_elements($item);
$datarray['parent_urn'] = $item_id;
$datarray['parent-uri'] = $item['uri']
$datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $importer['id'];
$r = post_remote($a,$datarray);

View file

@ -99,26 +99,28 @@ function item_post(&$a) {
do {
$dups = false;
$hash = random_string();
$r = q("SELECT `id` FROM `item` WHERE `hash` = '%s' LIMIT 1",
dbesc($hash));
$uri = "urn:X-dfrn:" . $a->get_hostname() . ':' . $profile_uid . ':' . $hash;
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
dbesc($uri));
if(count($r))
$dups = true;
} while($dups == true);
$r = q("INSERT INTO `item` (`uid`,`type`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`, `remote-id`, `created`,`edited`,`hash`,`body`,
`allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`)
VALUES( %d, '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
$r = q("INSERT INTO `item` (`uid`,`type`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`, `created`,
`edited`, `uri`, `body`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`)
VALUES( %d, '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
intval($profile_uid),
dbesc($_POST['type']),
intval($contact_id),
dbesc($contact_record['name']),
dbesc($contact_record['url']),
dbesc($contact_record['thumb']),
dbesc("urn:X-dfrn:" . $a->get_baseurl() . ':' . intval($profile_uid) . ':' . $hash),
datetime_convert(),
datetime_convert(),
dbesc($hash),
dbesc($uri),
dbesc(escape_tags(trim($_POST['body']))),
dbesc($str_contact_allow),
dbesc($str_group_allow),
@ -126,8 +128,8 @@ function item_post(&$a) {
dbesc($str_group_deny)
);
$r = q("SELECT `id` FROM `item` WHERE `hash` = '%s' LIMIT 1",
dbesc($hash));
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
dbesc($uri));
if(count($r)) {
$post_id = $r[0]['id'];
@ -154,13 +156,15 @@ function item_post(&$a) {
$parent = $post_id;
}
$r = q("UPDATE `item` SET `parent` = %d, `last-child` = 1, `visible` = 1
$r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `last-child` = 1, `visible` = 1
WHERE `id` = %d LIMIT 1",
intval($parent),
intval($post_id));
dbesc(($parent == $post_id) ? $uri : $parent_item['uri']),
intval($post_id)
);
}
$url = bin2hex($a->get_baseurl());
$url = $a->get_baseurl();
proc_close(proc_open("php include/notifier.php \"$url\" \"$notify_type\" \"$post_id\" > notify.log &",
array(),$foo));

View file

@ -92,7 +92,7 @@ function network_content(&$a) {
$template = $wallwall;
$commentww = 'ww';
}
if($item['type'] == 'remote' && ($item['owner-link'] != $item['remote-link'])) {
if($item['type'] == 'remote' && ($item['owner-link'] != $item['author-link'])) {
// Could be anybody.
$owner_url = $item['owner-link'];
$owner_photo = $item['owner-avatar'];
@ -125,18 +125,18 @@ function network_content(&$a) {
// Post was remotely authored.
$profile_name = ((strlen($item['remote-name'])) ? $item['remote-name'] : $item['name']);
$profile_avatar = ((strlen($item['remote-avatar'])) ? $item['remote-avatar'] : $thumb);
$profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']);
$profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $thumb);
$profile_link = $profile_url;
// Can we use our special contact URL for this author?
if(strlen($item['remote-link'])) {
if($item['remote-link'] == $item['url'])
if(strlen($item['author-link'])) {
if($item['author-link'] == $item['url'])
$profile_link = $redirect_url;
else
$profile_link = $item['remote-link'];
$profile_link = $item['author-link'];
}
// Build the HTML

View file

@ -141,9 +141,9 @@ function profile_content(&$a) {
}
$sql_extra = sprintf(
" AND ( `allow_cid` = '' OR `allow_cid` REGEXP '<%d>' )
AND ( `deny_cid` = '' OR NOT `deny_cid` REGEXP '<%d>' )
AND ( `allow_gid` = '' OR `allow_gid` REGEXP '%s' )
AND ( `deny_gid` = '' OR NOT `deny_gid` REGEXP '%s') ",
AND ( `deny_cid` = '' OR NOT `deny_cid` REGEXP '<%d>' )
AND ( `allow_gid` = '' OR `allow_gid` REGEXP '%s' )
AND ( `deny_gid` = '' OR NOT `deny_gid` REGEXP '%s') ",
intval($_SESSION['visitor_id']),
intval($_SESSION['visitor_id']),
@ -224,8 +224,8 @@ function profile_content(&$a) {
// known to us and is reflected in the contact-id for this item. We can use the contact url or redirect rather than
// use the link in the feed. This is different than on the network page where we may not know the author.
$profile_name = ((strlen($item['remote-name'])) ? $item['remote-name'] : $item['name']);
$profile_avatar = ((strlen($item['remote-avatar'])) ? $item['remote-avatar'] : $item['thumb']);
$profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']);
$profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']);
$profile_link = $profile_url;
$o .= replace_macros($template,array(