diff --git a/addon/twitter/twitter.php b/addon/twitter/twitter.php
index b2e5aa7ced..db283e1a9d 100644
--- a/addon/twitter/twitter.php
+++ b/addon/twitter/twitter.php
@@ -138,7 +138,7 @@ function twitter_settings(&$a,&$s) {
* which the user can request a PIN to connect the account to a
* account at Twitter.
*/
- require_once('addon/twitter/twitteroauth.php');
+ require_once('library/twitteroauth.php');
$connection = new TwitterOAuth($ckey, $csecret);
$request_token = $connection->getRequestToken();
$token = $request_token['oauth_token'];
diff --git a/boot.php b/boot.php
index 3cf01b4a0d..6bd78b87d5 100644
--- a/boot.php
+++ b/boot.php
@@ -3,7 +3,7 @@
set_time_limit(0);
define ( 'BUILD_ID', 1039 );
-define ( 'FRIENDIKA_VERSION', '2.10.0908' );
+define ( 'FRIENDIKA_VERSION', '2.10.0909' );
define ( 'DFRN_PROTOCOL_VERSION', '2.1' );
define ( 'EOL', "
\r\n" );
@@ -40,6 +40,8 @@ define ( 'REGISTER_OPEN', 2 );
/**
* relationship types
+ * When used in contact records, this indicates that 'uid' has
+ * this relationship with contact['name']
*/
define ( 'REL_VIP', 1);
@@ -2417,10 +2419,15 @@ function link_compare($a,$b) {
if(! function_exists('prepare_body')) {
function prepare_body($item) {
+ return prepare_text($item['body']);
+}}
+
+if(! function_exists('prepare_text')) {
+function prepare_text($text) {
require_once('include/bbcode.php');
- $s = smilies(bbcode($item['body']));
+ $s = smilies(bbcode($text));
return $s;
}}
@@ -2584,3 +2591,29 @@ function unamp($s) {
return str_replace('&', '&', $s);
}}
+if(! function_exists('extract_item_authors')) {
+function extract_item_authors($arr,$uid) {
+
+ if((! $uid) || (! is_array($arr)) || (! count($arr)))
+ return array();
+ $urls = array();
+ foreach($arr as $rr) {
+ if(! in_array("'" . dbesc($rr['author-link']) . "'",$urls))
+ $urls[] = "'" . dbesc($rr['author-link']) . "'";
+ }
+
+ // pre-quoted, don't put quotes on %s
+ if(count($urls)) {
+ $r = q("SELECT `id`,`url` FROM `contact` WHERE `uid` = %d AND `url` IN ( %s ) AND `network` = 'dfrn' AND `self` = 0 AND `blocked` = 0 ",
+ intval($uid),
+ implode(',',$urls)
+ );
+ if(count($r)) {
+ $ret = array();
+ foreach($r as $rr)
+ $ret[$rr['url']] = $rr['id'];
+ return $ret;
+ }
+ }
+ return array();
+}}
\ No newline at end of file
diff --git a/images/friendika-128.jpg b/images/friendika-128.jpg
new file mode 100644
index 0000000000..f7d86ae50d
Binary files /dev/null and b/images/friendika-128.jpg differ
diff --git a/images/friendika-128.png b/images/friendika-128.png
new file mode 100644
index 0000000000..1d1c8e3207
Binary files /dev/null and b/images/friendika-128.png differ
diff --git a/images/friendika-16.jpg b/images/friendika-16.jpg
new file mode 100644
index 0000000000..ce59a70a01
Binary files /dev/null and b/images/friendika-16.jpg differ
diff --git a/images/friendika-16.png b/images/friendika-16.png
new file mode 100644
index 0000000000..1a742ecdc1
Binary files /dev/null and b/images/friendika-16.png differ
diff --git a/images/friendika-256.jpg b/images/friendika-256.jpg
new file mode 100644
index 0000000000..182810d625
Binary files /dev/null and b/images/friendika-256.jpg differ
diff --git a/images/friendika-256.png b/images/friendika-256.png
new file mode 100644
index 0000000000..ea931c85f7
Binary files /dev/null and b/images/friendika-256.png differ
diff --git a/images/friendika-32.jpg b/images/friendika-32.jpg
new file mode 100644
index 0000000000..4e697411d6
Binary files /dev/null and b/images/friendika-32.jpg differ
diff --git a/images/friendika-32.png b/images/friendika-32.png
new file mode 100644
index 0000000000..a300b7beae
Binary files /dev/null and b/images/friendika-32.png differ
diff --git a/images/friendika-64.jpg b/images/friendika-64.jpg
new file mode 100644
index 0000000000..050830fff9
Binary files /dev/null and b/images/friendika-64.jpg differ
diff --git a/images/friendika-64.png b/images/friendika-64.png
new file mode 100644
index 0000000000..a1c0422932
Binary files /dev/null and b/images/friendika-64.png differ
diff --git a/images/friendika.svg b/images/friendika.svg
new file mode 100644
index 0000000000..2155d0b006
--- /dev/null
+++ b/images/friendika.svg
@@ -0,0 +1,240 @@
+
+
+
+
diff --git a/include/dba.php b/include/dba.php
index b05a1cabf4..d75ed560ab 100644
--- a/include/dba.php
+++ b/include/dba.php
@@ -20,12 +20,14 @@ class dba {
function __construct($server,$user,$pass,$db,$install = false) {
$this->db = @new mysqli($server,$user,$pass,$db);
- if((mysqli_connect_errno()) && (! $install)) {
- $this->db = null;
- system_unavailable();
+ if(! mysqli_connect_errno()) {
+ $this->connected = true;
+ }
+ else {
+ $this->db = null;
+ if(! $install)
+ system_unavailable();
}
- else
- $this->connected = true;
}
public function getdb() {
@@ -34,7 +36,7 @@ class dba {
public function q($sql) {
- if(! $this->db )
+ if((! $this->db) || (! $this->connected))
return false;
$result = @$this->db->query($sql);
@@ -92,7 +94,8 @@ class dba {
}
public function escape($str) {
- return @$this->db->real_escape_string($str);
+ if($this->db && $this->connected)
+ return @$this->db->real_escape_string($str);
}
function __destruct() {
diff --git a/include/nav.php b/include/nav.php
index 5e29cc3c4b..4104cf3cf3 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -124,7 +124,7 @@ function nav(&$a) {
$banner = get_config('system','banner');
if($banner === false)
- $banner .= 'Friendika';
+ $banner .= 'Friendika';
$a->page['nav'] .= ' ';
diff --git a/include/poller.php b/include/poller.php
index d54c88e053..fd02e01984 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -2,18 +2,18 @@
require_once("boot.php");
function poller_run($argv, $argc){
- global $a, $db;
+ global $a, $db;
- if(is_null($a)){
- $a = new App;
- }
+ if(is_null($a)) {
+ $a = new App;
+ }
- if(is_null($db)){
- @include(".htconfig.php");
- require_once("dba.php");
- $db = new dba($db_host, $db_user, $db_pass, $db_data);
- unset($db_host, $db_user, $db_pass, $db_data);
- };
+ if(is_null($db)) {
+ @include(".htconfig.php");
+ require_once("dba.php");
+ $db = new dba($db_host, $db_user, $db_pass, $db_data);
+ unset($db_host, $db_user, $db_pass, $db_data);
+ };
require_once('session.php');
require_once('datetime.php');
@@ -30,7 +30,7 @@ function poller_run($argv, $argc){
proc_run('php',"include/queue.php");
// clear old cache
- q("DELETE FROM `cache` WHERE `updated`<'%s'",
+ q("DELETE FROM `cache` WHERE `updated` < '%s'",
dbesc(datetime_convert('UTC','UTC',"now - 30 days")));
$manual_id = 0;
@@ -47,130 +47,214 @@ function poller_run($argv, $argc){
$sql_extra = (($manual_id) ? " AND `id` = $manual_id " : "");
- // 'stat' clause is a temporary measure until we have federation subscriptions working both directions
- $contacts = q("SELECT * FROM `contact`
- WHERE ( ( `network` = 'dfrn' AND ( `dfrn-id` != '' OR (`issued-id` != '' AND `duplex` = 1)))
- OR ( `network` IN ( 'stat', 'feed' ) AND `poll` != '' ))
+ $contacts = q("SELECT `id` FROM `contact`
+ WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != ''
$sql_extra
- AND `self` = 0 AND `blocked` = 0 AND `readonly` = 0 ORDER BY RAND()");
+ AND `self` = 0 AND `blocked` = 0 AND `readonly` = 0 ORDER BY RAND()",
+ intval(REL_FAN),
+ intval(REL_BUD)
+ );
- if(! count($contacts)){
+ if(! count($contacts)) {
return;
}
- foreach($contacts as $contact) {
+ foreach($contacts as $c) {
- if($manual_id)
- $contact['last-update'] = '0000-00-00 00:00:00';
-
- if($contact['priority'] || $contact['subhub']) {
-
- $hub_update = true;
- $update = false;
-
- $t = $contact['last-update'];
-
- // We should be getting everything via a hub. But just to be sure, let's check once a day.
- // (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately)
- // This also lets us update our subscription to the hub, and add or replace hubs in case it
- // changed. We will only update hubs once a day, regardless of 'pushpoll_frequency'.
-
-
- if($contact['subhub']) {
- $interval = get_config('system','pushpoll_frequency');
- $contact['priority'] = (($interval !== false) ? intval($interval) : 3);
- $hub_update = false;
-
- if((datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) || $force)
- $hub_update = true;
- }
-
-
- /**
- * Based on $contact['priority'], should we poll this site now? Or later?
- */
-
- switch ($contact['priority']) {
- case 5:
- if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 month"))
- $update = true;
- break;
- case 4:
- if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 week"))
- $update = true;
- break;
- case 3:
- if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day"))
- $update = true;
- break;
- case 2:
- if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 12 hour"))
- $update = true;
- break;
- case 1:
- default:
- if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 hour"))
- $update = true;
- break;
- }
- if((! $update) && (! $force))
- continue;
- }
-
- $importer_uid = $contact['uid'];
-
- $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
- intval($importer_uid)
+ $res = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
+ intval($c['id'])
);
- if(! count($r))
+
+ if(! count($res))
continue;
- $importer = $r[0];
+ foreach($res as $contact) {
+ if($manual_id)
+ $contact['last-update'] = '0000-00-00 00:00:00';
- logger("poller: poll: IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}");
+ if($contact['priority'] || $contact['subhub']) {
- $last_update = (($contact['last-update'] === '0000-00-00 00:00:00')
- ? datetime_convert('UTC','UTC','now - 30 days', ATOM_TIME)
- : datetime_convert('UTC','UTC',$contact['last-update'], ATOM_TIME)
- );
+ $hub_update = true;
+ $update = false;
- if($contact['network'] === 'dfrn') {
+ $t = $contact['last-update'];
- $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);
+ // We should be getting everything via a hub. But just to be sure, let's check once a day.
+ // (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately)
+ // This also lets us update our subscription to the hub, and add or replace hubs in case it
+ // changed. We will only update hubs once a day, regardless of 'pushpoll_frequency'.
- if(intval($contact['duplex']) && $contact['dfrn-id'])
- $idtosend = '0:' . $orig_id;
- if(intval($contact['duplex']) && $contact['issued-id'])
- $idtosend = '1:' . $orig_id;
- $url = $contact['poll'] . '?dfrn_id=' . $idtosend
- . '&dfrn_version=' . DFRN_PROTOCOL_VERSION
- . '&type=data&last_update=' . $last_update ;
+ if($contact['subhub']) {
+ $interval = get_config('system','pushpoll_frequency');
+ $contact['priority'] = (($interval !== false) ? intval($interval) : 3);
+ $hub_update = false;
- $xml = fetch_url($url);
+ if((datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) || $force)
+ $hub_update = true;
+ }
- logger('poller: handshake with url ' . $url . ' returns xml: ' . $xml, LOGGER_DATA);
+ /**
+ * Based on $contact['priority'], should we poll this site now? Or later?
+ */
-
- if(! $xml) {
- logger("poller: $url appears to be dead - marking for death ");
- // dead connection - might be a transient event, or this might
- // mean the software was uninstalled or the domain expired.
- // Will keep trying for one month.
- mark_for_death($contact);
-
- // set the last-update so we don't keep polling
-
- $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
- dbesc(datetime_convert()),
- intval($contact['id'])
- );
-
- continue;
+ switch ($contact['priority']) {
+ case 5:
+ if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 month"))
+ $update = true;
+ break;
+ case 4:
+ if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 week"))
+ $update = true;
+ break;
+ case 3:
+ if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day"))
+ $update = true;
+ break;
+ case 2:
+ if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 12 hour"))
+ $update = true;
+ break;
+ case 1:
+ default:
+ if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 hour"))
+ $update = true;
+ break;
+ }
+ if((! $update) && (! $force))
+ continue;
}
+ $importer_uid = $contact['uid'];
+
+ $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
+ intval($importer_uid)
+ );
+ if(! count($r))
+ continue;
+
+ $importer = $r[0];
+
+ logger("poller: poll: IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}");
+
+ $last_update = (($contact['last-update'] === '0000-00-00 00:00:00')
+ ? datetime_convert('UTC','UTC','now - 30 days', ATOM_TIME)
+ : datetime_convert('UTC','UTC',$contact['last-update'], ATOM_TIME)
+ );
+
+ if($contact['network'] === 'dfrn') {
+
+ $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);
+
+ if(intval($contact['duplex']) && $contact['dfrn-id'])
+ $idtosend = '0:' . $orig_id;
+ if(intval($contact['duplex']) && $contact['issued-id'])
+ $idtosend = '1:' . $orig_id;
+
+ $url = $contact['poll'] . '?dfrn_id=' . $idtosend
+ . '&dfrn_version=' . DFRN_PROTOCOL_VERSION
+ . '&type=data&last_update=' . $last_update ;
+
+ $xml = fetch_url($url);
+
+ logger('poller: handshake with url ' . $url . ' returns xml: ' . $xml, LOGGER_DATA);
+
+
+ if(! $xml) {
+ logger("poller: $url appears to be dead - marking for death ");
+ // dead connection - might be a transient event, or this might
+ // mean the software was uninstalled or the domain expired.
+ // Will keep trying for one month.
+ mark_for_death($contact);
+
+ // set the last-update so we don't keep polling
+
+ $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
+ dbesc(datetime_convert()),
+ intval($contact['id'])
+ );
+
+ continue;
+ }
+
+ if(! strstr($xml,'status) == 1) {
+ logger("poller: $url replied status 1 - marking for death ");
+
+ // we may not be friends anymore. Will keep trying for one month.
+ // set the last-update so we don't keep polling
+
+ $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
+ dbesc(datetime_convert()),
+ intval($contact['id'])
+ );
+
+ mark_for_death($contact);
+ }
+ else {
+ if($contact['term-date'] != '0000-00-00 00:00:00') {
+ logger("poller: $url back from the dead - removing mark for death");
+ unmark_for_death($contact);
+ }
+ }
+
+ if((intval($res->status) != 0) || (! strlen($res->challenge)) || (! strlen($res->dfrn_id)))
+ continue;
+
+ $postvars = array();
+
+ $sent_dfrn_id = hex2bin((string) $res->dfrn_id);
+ $challenge = hex2bin((string) $res->challenge);
+
+ $final_dfrn_id = '';
+
+ if(($contact['duplex']) && strlen($contact['prvkey'])) {
+ openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
+ openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']);
+ }
+ else {
+ openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
+ openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']);
+ }
+
+ $final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.'));
+
+ if(strpos($final_dfrn_id,':') == 1)
+ $final_dfrn_id = substr($final_dfrn_id,2);
+
+ if($final_dfrn_id != $orig_id) {
+
+ // did not decode properly - cannot trust this site
+ continue;
+ }
+
+ $postvars['dfrn_id'] = $idtosend;
+ $postvars['dfrn_version'] = DFRN_PROTOCOL_VERSION;
+
+ $xml = post_url($contact['poll'],$postvars);
+ }
+ else {
+
+ // $contact['network'] !== 'dfrn'
+
+ $xml = fetch_url($contact['poll']);
+ }
+
+ logger('poller: received xml : ' . $xml, LOGGER_DATA);
+
if(! strstr($xml,'status) == 1) {
- logger("poller: $url replied status 1 - marking for death ");
+ consume_feed($xml,$importer,$contact,$hub,1);
- // we may not be friends anymore. Will keep trying for one month.
- // set the last-update so we don't keep polling
- $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
- dbesc(datetime_convert()),
- intval($contact['id'])
- );
-
- mark_for_death($contact);
- }
- else {
- if($contact['term-date'] != '0000-00-00 00:00:00') {
- logger("poller: $url back from the dead - removing mark for death");
- unmark_for_death($contact);
+ if((strlen($hub)) && ($hub_update)
+ && (($contact['rel'] == REL_BUD) || (($contact['network'] === 'stat') && (! $contact['readonly'])))) {
+ logger('poller: subscribing to hub(s) : ' . $hub . ' contact name : ' . $contact['name'] . ' local user : ' . $importer['name']);
+ $hubs = explode(',', $hub);
+ if(count($hubs)) {
+ foreach($hubs as $h) {
+ $h = trim($h);
+ if(! strlen($h))
+ continue;
+ subscribe_to_hub($h,$importer,$contact);
+ }
}
}
- if((intval($res->status) != 0) || (! strlen($res->challenge)) || (! strlen($res->dfrn_id)))
- continue;
- $postvars = array();
+ $updated = datetime_convert();
- $sent_dfrn_id = hex2bin((string) $res->dfrn_id);
- $challenge = hex2bin((string) $res->challenge);
-
- $final_dfrn_id = '';
-
- if(($contact['duplex']) && strlen($contact['prvkey'])) {
- openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
- openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']);
- }
- else {
- openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
- openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']);
- }
-
- $final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.'));
-
- if(strpos($final_dfrn_id,':') == 1)
- $final_dfrn_id = substr($final_dfrn_id,2);
-
- if($final_dfrn_id != $orig_id) {
-
- // did not decode properly - cannot trust this site
- continue;
- }
-
- $postvars['dfrn_id'] = $idtosend;
- $postvars['dfrn_version'] = DFRN_PROTOCOL_VERSION;
-
- $xml = post_url($contact['poll'],$postvars);
- }
- else {
-
- // $contact['network'] !== 'dfrn'
-
- $xml = fetch_url($contact['poll']);
- }
-
- logger('poller: received xml : ' . $xml, LOGGER_DATA);
-
- if(! strstr($xml,'profile['uid']);
+
foreach($r as $item) {
$template = $tpl;
@@ -172,17 +174,6 @@ function display_content(&$a) {
$sparkle = '';
- $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
-
- // I think this is redundant now but too chicken to remove it unless
- // I've had six cups of coffee and tested it completely
-
- if(($item['network'] === 'dfrn') && (! $item['self'] )) {
- $profile_url = $redirect_url;
- $sparkle = ' sparkle';
- }
-
-
// Top-level wall post not written by the wall owner (wall-to-wall)
// First figure out who owns it.
@@ -223,13 +214,14 @@ function display_content(&$a) {
// Can we use our special contact URL for this author?
if(strlen($item['author-link'])) {
- if((link_compare($item['author-link'],$item['url'])) && ($item['network'] === 'dfrn') && (! $item['self'])) {
+ $profile_link = $item['author-link'];
+ if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) {
$profile_link = $redirect_url;
$sparkle = ' sparkle';
}
- else {
- $profile_link = $item['author-link'];
- $sparkle = '';
+ elseif(isset($author_contacts[$item['author-link']])) {
+ $profile_link = $a->get_baseurl() . '/redir/' . $author_contacts[$item['author-link']];
+ $sparkle = ' sparkle';
}
}
diff --git a/mod/message.php b/mod/message.php
index 466b0befa8..4821a45d26 100644
--- a/mod/message.php
+++ b/mod/message.php
@@ -165,9 +165,12 @@ function message_content(&$a) {
if(($a->argc > 1) && ($a->argv[1] === 'new')) {
$tpl = load_view_file('view/msg-header.tpl');
-
- $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl()));
+ $a->page['htmlhead'] .= replace_macros($tpl, array(
+ '$baseurl' => $a->get_baseurl(),
+ '$nickname' => $a->user['nickname']
+ ));
+
$select = contact_select('messageto','message-to-select', false, 4, true);
$tpl = load_view_file('view/prv_message.tpl');
$o .= replace_macros($tpl,array(
diff --git a/mod/network.php b/mod/network.php
index 35eb0b3257..1ef4ab3723 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -87,6 +87,17 @@ function network_content(&$a, $update = 0) {
$o .= replace_macros($tpl,array(
'$return_path' => $a->cmd,
+ '$action' => 'item',
+ '$share' => t('Share'),
+ '$upload' => t('Upload photo'),
+ '$weblink' => t('Insert web link'),
+ '$youtube' => t('Insert YouTube video'),
+ '$setloc' => t('Set your location'),
+ '$noloc' => t('Clear browser location'),
+ '$wait' => t('Please wait'),
+ '$permset' => t('Permission settings'),
+ '$content' => '',
+ '$post_id' => '',
'$baseurl' => $a->get_baseurl(),
'$defloc' => $a->user['default-location'],
'$visitor' => 'block',
@@ -196,12 +207,13 @@ function network_content(&$a, $update = 0) {
AND `item`.`parent` = `parentitem`.`id`
$sql_extra
ORDER BY `parentitem`.`created` DESC, `item`.`gravity` ASC, `item`.`created` ASC LIMIT %d ,%d ",
- intval($_SESSION['uid']),
+ intval(local_user()),
intval($a->pager['start']),
intval($a->pager['itemspage'])
);
}
+ $author_contacts = extract_item_authors($r,local_user());
$cmnt_tpl = load_view_file('view/comment_item.tpl');
$like_tpl = load_view_file('view/like.tpl');
@@ -230,10 +242,17 @@ function network_content(&$a, $update = 0) {
$profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']);
$profile_link = ((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
- if(strlen($item['author-link']) && link_compare($item['author-link'],$item['url'])
- && ($item['network'] === 'dfrn') && (! $item['self'])) {
- $profile_link = $redirect_url;
- $sparkle = ' sparkle';
+ $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
+
+ if(strlen($item['author-link'])) {
+ if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) {
+ $profile_link = $redirect_url;
+ $sparkle = ' sparkle';
+ }
+ elseif(isset($author_contacts[$item['author-link']])) {
+ $profile_link = $a->get_baseurl() . '/redir/' . $author_contacts[$item['author-link']];
+ $sparkle = ' sparkle';
+ }
}
$location = (($item['location']) ? '' . $item['location'] . '' : '');
@@ -287,15 +306,15 @@ function network_content(&$a, $update = 0) {
$comment = '';
$template = $tpl;
$commentww = '';
+ $sparkle = '';
$owner_url = $owner_photo = $owner_name = '';
- $profile_url = $item['url'];
-
- $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
-
if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent']))
continue;
+ $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
+
+
$lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
|| strlen($item['deny_cid']) || strlen($item['deny_gid']))))
@@ -331,7 +350,6 @@ function network_content(&$a, $update = 0) {
$owner_url = $redirect_url;
$osparkle = ' sparkle';
}
-
}
}
@@ -362,13 +380,6 @@ function network_content(&$a, $update = 0) {
$drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete')));
-
-
- if(($item['network'] === 'dfrn') && (! $item['self'] )) {
- $profile_url = $redirect_url;
- $sparkle = ' sparkle';
- }
-
$photo = $item['photo'];
$thumb = $item['thumb'];
@@ -379,22 +390,19 @@ function network_content(&$a, $update = 0) {
$profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
$profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $thumb);
-
- $profile_link = $profile_url;
-
- // Can we use our special contact URL for this author?
-
if(strlen($item['author-link'])) {
- if((link_compare($item['author-link'],$item['url'])) && ($item['network'] === 'dfrn') && (! $item['self'])) {
+ $profile_link = $item['author-link'];
+ if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) {
$profile_link = $redirect_url;
$sparkle = ' sparkle';
}
- else {
- $profile_link = $item['author-link'];
- $sparkle = '';
+ elseif(isset($author_contacts[$item['author-link']])) {
+ $profile_link = $a->get_baseurl() . '/redir/' . $author_contacts[$item['author-link']];
+ $sparkle = ' sparkle';
}
}
-
+ else
+ $profile_link = $item['url'];
$like = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
$dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
diff --git a/mod/profile.php b/mod/profile.php
index 827530bc8a..b23af2e663 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -147,6 +147,17 @@ function profile_content(&$a, $update = 0) {
$o .= replace_macros($tpl,array(
'$baseurl' => $a->get_baseurl(),
+ '$action' => 'item',
+ '$share' => t('Share'),
+ '$upload' => t('Upload photo'),
+ '$weblink' => t('Insert web link'),
+ '$youtube' => t('Insert YouTube video'),
+ '$setloc' => t('Set your location'),
+ '$noloc' => t('Clear browser location'),
+ '$wait' => t('Please wait'),
+ '$permset' => t('Permission settings'),
+ '$content' => '',
+ '$post_id' => '',
'$defloc' => (($is_owner) ? $a->user['default-location'] : ''),
'$return_path' => $a->cmd,
'$visitor' => (($is_owner || $commvisitor) ? 'block' : 'none'),
diff --git a/mod/profiles.php b/mod/profiles.php
index 9e19caa0b0..409999a3e8 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -226,7 +226,7 @@ function profiles_content(&$a) {
}
if(($a->argc > 2) && ($a->argv[1] === "drop") && intval($a->argv[2])) {
- $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is-default` = 0 AND `self` = 0 LIMIT 1",
+ $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is-default` = 0 LIMIT 1",
intval($a->argv[2]),
intval(local_user())
);
@@ -243,8 +243,9 @@ function profiles_content(&$a) {
intval($a->argv[2]),
intval(local_user())
);
- $r = q("DELETE FROM `profile` WHERE `id` = %d LIMIT 1",
- intval($a->argv[2])
+ $r = q("DELETE FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($a->argv[2]),
+ intval(local_user())
);
if($r)
notice( t('Profile deleted.') . EOL);
diff --git a/mod/pubsub.php b/mod/pubsub.php
index df27c6bc2b..5d8ea2ed76 100644
--- a/mod/pubsub.php
+++ b/mod/pubsub.php
@@ -55,7 +55,8 @@ function pubsub_init(&$a) {
$sql_extra = ((strlen($hub_verify)) ? sprintf(" AND `hub-verify` = '%s' ", dbesc($hub_verify)) : '');
- $r = q("SELECT * FROM `contact` WHERE `poll` = '%s' AND `id` = %d AND `uid` = %d AND `blocked` = 0 $sql_extra LIMIT 1",
+ $r = q("SELECT * FROM `contact` WHERE `poll` = '%s' AND `id` = %d AND `uid` = %d
+ AND `blocked` = 0 AND `pending` = 0 $sql_extra LIMIT 1",
dbesc($hub_topic),
intval($contact_id),
intval($owner['uid'])
@@ -101,10 +102,14 @@ function pubsub_post(&$a) {
$importer = $r[0];
- $r = q("SELECT * FROM `contact` WHERE `subhub` = 1 AND `id` = %d AND `uid` = %d AND `blocked` = 0 AND `readonly` = 0 LIMIT 1",
+ $r = q("SELECT * FROM `contact` WHERE `subhub` = 1 AND `id` = %d AND `uid` = %d
+ AND ( `rel` = %d OR `rel` = %d ) AND `blocked` = 0 AND `readonly` = 0 LIMIT 1",
intval($contact_id),
- intval($importer['uid'])
+ intval($importer['uid']),
+ intval(REL_FAN),
+ intval(REL_BUD)
);
+
if(! count($r)) {
logger('pubsub: no contact record - ignored');
hub_post_return();
diff --git a/mod/register.php b/mod/register.php
index 97038def0b..13d770fdab 100644
--- a/mod/register.php
+++ b/mod/register.php
@@ -401,6 +401,8 @@ function register_content(&$a) {
$oidlabel = t("Your OpenID \x28optional\x29: ");
}
+ $realpeople = t('Members of this network prefer to communicate with real people who use their real names.');
+
if(get_config('system','publish_all')) {
$profile_publish_reg = '';
}
@@ -423,6 +425,7 @@ function register_content(&$a) {
$o = load_view_file("view/register.tpl");
$o = replace_macros($o, array(
'$oidhtml' => $oidhtml,
+ '$realpeople' => $realpeople,
'$regtitle' => t('Registration'),
'$registertext' =>((x($a->config,'register_text'))
? '