aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-03-15 17:51:24 -0700
committerzotlabs <mike@macgirvin.com>2018-03-15 17:51:24 -0700
commit91b710b07d5fc2b48b5d56d1801a36532008d1e9 (patch)
tree02a78ba2053a839944487a59951b5fcdaf53eb5a /include
parent34fee2a7909674ced6aea91e60f8ff77e8345e8b (diff)
downloadvolse-hubzilla-91b710b07d5fc2b48b5d56d1801a36532008d1e9.tar.gz
volse-hubzilla-91b710b07d5fc2b48b5d56d1801a36532008d1e9.tar.bz2
volse-hubzilla-91b710b07d5fc2b48b5d56d1801a36532008d1e9.zip
add auth flag to share attributes so we can make a costly determination to use zid at post submission time instead of making multiple calls to is_matrix_url() at render time
Diffstat (limited to 'include')
-rw-r--r--include/bbcode.php19
-rw-r--r--include/feedutils.php1
2 files changed, 17 insertions, 3 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index cd1a84d00..67f40dd23 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -311,6 +311,19 @@ function bb_ShareAttributes($match) {
if ($matches[1] != "")
$posted = $matches[1];
+ $auth = "";
+ preg_match("/auth='(.*?)'/ism", $attributes, $matches);
+ if ($matches[1] != "") {
+ if($matches[1] === 'true')
+ $auth = true;
+ else
+ $auth = false;
+ }
+
+ if($auth === EMPTY_STR) {
+ $auth = is_matrix_url($profile);
+ }
+
// message_id is never used, do we still need it?
$message_id = "";
preg_match("/message_id='(.*?)'/ism", $attributes, $matches);
@@ -329,7 +342,7 @@ function bb_ShareAttributes($match) {
$headline = '<div class="shared_container"> <div class="shared_header">';
if ($avatar != "")
- $headline .= '<a href="' . ((is_matrix_url($profile)) ? zid($profile) : $profile) . '" ><img src="' . $avatar . '" alt="' . $author . '" height="32" width="32" /></a>';
+ $headline .= '<a href="' . (($auth) ? zid($profile) : $profile) . '" ><img src="' . $avatar . '" alt="' . $author . '" height="32" width="32" /></a>';
if(strpos($link,'/cards/'))
$type = t('card');
@@ -341,8 +354,8 @@ function bb_ShareAttributes($match) {
// Bob Smith wrote the following post 2 hours ago
$fmt = sprintf( t('%1$s wrote the following %2$s %3$s'),
- '<a href="' . ((is_matrix_url($profile)) ? zid($profile) : $profile) . '" >' . $author . '</a>',
- '<a href="' . ((is_matrix_url($link)) ? zid($link) : $link) . '" >' . $type . '</a>',
+ '<a href="' . (($auth) ? zid($profile) : $profile) . '" >' . $author . '</a>',
+ '<a href="' . (($auth) ? zid($link) : $link) . '" >' . $type . '</a>',
$reldate
);
diff --git a/include/feedutils.php b/include/feedutils.php
index 62e1299a4..023caaad6 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -934,6 +934,7 @@ function feed_get_reshare(&$res,$item) {
"' profile='" . $share['profile'] .
"' avatar='" . $share['avatar'] .
"' link='" . $share['alternate'] .
+ "' auth='" . 'false' .
"' posted='" . $share['created'] .
"' message_id='" . $share['message_id'] . "']";