aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
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 /Zotlabs/Module
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 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Oep.php4
-rw-r--r--Zotlabs/Module/Rpost.php38
-rw-r--r--Zotlabs/Module/Share.php21
3 files changed, 19 insertions, 44 deletions
diff --git a/Zotlabs/Module/Oep.php b/Zotlabs/Module/Oep.php
index bb3a13b56..ec40bf9db 100644
--- a/Zotlabs/Module/Oep.php
+++ b/Zotlabs/Module/Oep.php
@@ -125,6 +125,7 @@ class Oep extends \Zotlabs\Web\Controller {
"' profile='".$p[0]['author']['xchan_url'] .
"' avatar='".$p[0]['author']['xchan_photo_s'].
"' link='".$p[0]['plink'].
+ "' auth='".(($p[0]['author']['network'] === 'zot') ? 'true' : 'false') .
"' posted='".$p[0]['created'].
"' message_id='".$p[0]['mid']."']";
if($p[0]['title'])
@@ -209,6 +210,7 @@ class Oep extends \Zotlabs\Web\Controller {
"' profile='".$p[0]['author']['xchan_url'] .
"' avatar='".$p[0]['author']['xchan_photo_s'].
"' link='".$p[0]['plink'].
+ "' auth='".(($p[0]['author']['network'] === 'zot') ? 'true' : 'false') .
"' posted='".$p[0]['created'].
"' message_id='".$p[0]['mid']."']";
if($p[0]['title'])
@@ -292,6 +294,7 @@ class Oep extends \Zotlabs\Web\Controller {
"' profile='".$p[0]['author']['xchan_url'] .
"' avatar='".$p[0]['author']['xchan_photo_s'].
"' link='".$p[0]['plink'].
+ "' auth='".(($p[0]['author']['network'] === 'zot') ? 'true' : 'false') .
"' posted='".$p[0]['created'].
"' message_id='".$p[0]['mid']."']";
if($p[0]['title'])
@@ -366,6 +369,7 @@ class Oep extends \Zotlabs\Web\Controller {
"' profile='".$p[0]['author']['xchan_url'] .
"' avatar='".$p[0]['author']['xchan_photo_s'].
"' link='".$p[0]['plink'].
+ "' auth='".(($p[0]['author']['network'] === 'zot') ? 'true' : 'false') .
"' posted='".$p[0]['created'].
"' message_id='".$p[0]['mid']."']";
if($p[0]['title'])
diff --git a/Zotlabs/Module/Rpost.php b/Zotlabs/Module/Rpost.php
index 5d2f0d7e8..e6ea52845 100644
--- a/Zotlabs/Module/Rpost.php
+++ b/Zotlabs/Module/Rpost.php
@@ -111,43 +111,7 @@ class Rpost extends \Zotlabs\Web\Controller {
}
if($_REQUEST['post_id']) {
- $r = q("SELECT * from item WHERE id = %d LIMIT 1",
- intval($_REQUEST['post_id'])
- );
- if(($r) && (! intval($r[0]['item_private']))) {
- $sql_extra = item_permissions_sql($r[0]['uid']);
-
- $r = q("select * from item where id = %d $sql_extra",
- intval($_REQUEST['post_id'])
- );
- if($r && $r[0]['mimetype'] === 'text/bbcode') {
-
- xchan_query($r);
-
- $is_photo = (($r[0]['obj_type'] === ACTIVITY_OBJ_PHOTO) ? true : false);
- if($is_photo) {
- $object = json_decode($r[0]['obj'],true);
- $photo_bb = $object['body'];
- }
-
- if (strpos($r[0]['body'], "[/share]") !== false) {
- $pos = strpos($r[0]['body'], "[share");
- $i = substr($r[0]['body'], $pos);
- } else {
- $i = "[share author='".urlencode($r[0]['author']['xchan_name']).
- "' profile='".$r[0]['author']['xchan_url'] .
- "' avatar='".$r[0]['author']['xchan_photo_s'].
- "' link='".$r[0]['plink'].
- "' posted='".$r[0]['created'].
- "' message_id='".$r[0]['mid']."']";
- if($r[0]['title'])
- $i .= '[b]'.$r[0]['title'].'[/b]'."\r\n";
- $i .= (($is_photo) ? $photo_bb . "\r\n" . $r[0]['body'] : $r[0]['body']);
- $i .= "[/share]";
- }
- }
- }
- $_REQUEST['body'] = $_REQUEST['body'] . $i;
+ $_REQUEST['body'] .= '[share=' . intval($_REQUEST['post_id']) . '][/share]';
}
$x = array(
diff --git a/Zotlabs/Module/Share.php b/Zotlabs/Module/Share.php
index 7f4d8b1eb..c6d0be051 100644
--- a/Zotlabs/Module/Share.php
+++ b/Zotlabs/Module/Share.php
@@ -14,10 +14,15 @@ class Share extends \Zotlabs\Web\Controller {
if(! $post_id)
killme();
-
echo '[share=' . $post_id . '][/share]';
killme();
+
+ /**
+ * The remaining code is deprecated and handled in Zotlabs/Lib/Share.php at post
+ * submission time.
+ */
+
if(! (local_channel() || remote_channel()))
killme();
@@ -60,12 +65,14 @@ class Share extends \Zotlabs\Web\Controller {
$pos = strpos($r[0]['body'], "[share");
$o = substr($r[0]['body'], $pos);
} else {
- $o = "[share author='".urlencode($r[0]['author']['xchan_name']).
- "' profile='".$r[0]['author']['xchan_url'] .
- "' avatar='".$r[0]['author']['xchan_photo_s'].
- "' link='".$r[0]['plink'].
- "' posted='".$r[0]['created'].
- "' message_id='".$r[0]['mid']."']";
+ $o = "[share author='" . urlencode($r[0]['author']['xchan_name']) .
+ "' profile='" . $r[0]['author']['xchan_url'] .
+ "' avatar='" . $r[0]['author']['xchan_photo_s'] .
+ "' link='" . $r[0]['plink'] .
+ "' auth='" . (($r[0]['author']['network'] === 'zot') ? 'true' : 'false') .
+ "' posted='" . $r[0]['created'] .
+ "' message_id='" . $r[0]['mid'] .
+ "']";
if($r[0]['title'])
$o .= '[b]'.$r[0]['title'].'[/b]'."\r\n";
$o .= (($is_photo) ? $photo_bb . "\r\n" . $r[0]['body'] : $r[0]['body']);