Reshares are now working
This commit is contained in:
parent
cdce9b48ab
commit
f7272be4a8
3 changed files with 20 additions and 22 deletions
|
@ -612,7 +612,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
|||
|
||||
if ($items && count($items)) {
|
||||
// Currently behind a config value. This allows the commenting and sharing of every public item.
|
||||
if (Config::get('system', 'comment_public')) {
|
||||
if (Config::get('system', 'comment_public') && local_user()) {
|
||||
$writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], array(NETWORK_OSTATUS, NETWORK_DIASPORA));
|
||||
} else {
|
||||
$writable = false;
|
||||
|
|
|
@ -348,7 +348,7 @@ function display_content(App $a, $update = false, $update_uid = 0) {
|
|||
if (DBM::is_result($r)) {
|
||||
$a->page_contact = $r;
|
||||
}
|
||||
$is_owner = (local_user() && (local_user() == $a->profile['profile_uid']) ? true : false);
|
||||
$is_owner = (local_user() && (in_array($a->profile['profile_uid'], [local_user(), 0])) ? true : false);
|
||||
|
||||
if ($a->profile['hidewall'] && !$is_owner && !$remote_contact) {
|
||||
notice(t('Access to this profile has been restricted.') . EOL);
|
||||
|
|
|
@ -4,28 +4,26 @@ use Friendica\App;
|
|||
use Friendica\Database\DBM;
|
||||
|
||||
function share_init(App $a) {
|
||||
|
||||
$post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
|
||||
if((! $post_id) || (! local_user()))
|
||||
if (!$post_id || !local_user()) {
|
||||
killme();
|
||||
}
|
||||
|
||||
$r = q("SELECT item.*, contact.network FROM `item`
|
||||
inner join contact on `item`.`contact-id` = `contact`.`id`
|
||||
WHERE `item`.`id` = %d AND `item`.`uid` = %d LIMIT 1",
|
||||
|
||||
intval($post_id),
|
||||
intval(local_user())
|
||||
INNER JOIN `contact` ON `item`.`contact-id` = `contact`.`id`
|
||||
WHERE `item`.`id` = %d LIMIT 1",
|
||||
intval($post_id)
|
||||
);
|
||||
if(! DBM::is_result($r) || ($r[0]['private'] == 1))
|
||||
if (!DBM::is_result($r) || ($r[0]['private'] == 1)) {
|
||||
killme();
|
||||
|
||||
}
|
||||
if (strpos($r[0]['body'], "[/share]") !== false) {
|
||||
$pos = strpos($r[0]['body'], "[share");
|
||||
$o = substr($r[0]['body'], $pos);
|
||||
} else {
|
||||
$o = share_header($r[0]['author-name'], $r[0]['author-link'], $r[0]['author-avatar'], $r[0]['guid'], $r[0]['created'], $r[0]['plink']);
|
||||
|
||||
if($r[0]['title'])
|
||||
if ($r[0]['title'])
|
||||
$o .= '[b]'.$r[0]['title'].'[/b]'."\n";
|
||||
$o .= $r[0]['body'];
|
||||
$o.= "[/share]";
|
||||
|
@ -36,17 +34,17 @@ function share_init(App $a) {
|
|||
}
|
||||
|
||||
function share_header($author, $profile, $avatar, $guid, $posted, $link) {
|
||||
$header = "[share author='".str_replace(array("'", "[", "]"), array("'", "[", "]"),$author).
|
||||
"' profile='".str_replace(array("'", "[", "]"), array("'", "[", "]"),$profile).
|
||||
"' avatar='".str_replace(array("'", "[", "]"), array("'", "[", "]"),$avatar);
|
||||
$header = "[share author='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $author).
|
||||
"' profile='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $profile).
|
||||
"' avatar='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $avatar);
|
||||
|
||||
if ($guid)
|
||||
$header .= "' guid='".str_replace(array("'", "[", "]"), array("'", "[", "]"),$guid);
|
||||
|
||||
if ($posted)
|
||||
$header .= "' posted='".str_replace(array("'", "[", "]"), array("'", "[", "]"),$posted);
|
||||
|
||||
$header .= "' link='".str_replace(array("'", "[", "]"), array("'", "[", "]"),$link)."']";
|
||||
if ($guid) {
|
||||
$header .= "' guid='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $guid);
|
||||
}
|
||||
if ($posted) {
|
||||
$header .= "' posted='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $posted);
|
||||
}
|
||||
$header .= "' link='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $link)."']";
|
||||
|
||||
return $header;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue