Reshares are now working

This commit is contained in:
Michael 2017-12-20 18:18:25 +00:00
parent cdce9b48ab
commit f7272be4a8
3 changed files with 20 additions and 22 deletions

View File

@ -612,7 +612,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
if ($items && count($items)) { if ($items && count($items)) {
// Currently behind a config value. This allows the commenting and sharing of every public item. // 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)); $writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], array(NETWORK_OSTATUS, NETWORK_DIASPORA));
} else { } else {
$writable = false; $writable = false;

View File

@ -348,7 +348,7 @@ function display_content(App $a, $update = false, $update_uid = 0) {
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
$a->page_contact = $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) { if ($a->profile['hidewall'] && !$is_owner && !$remote_contact) {
notice(t('Access to this profile has been restricted.') . EOL); notice(t('Access to this profile has been restricted.') . EOL);

View File

@ -4,21 +4,19 @@ use Friendica\App;
use Friendica\Database\DBM; use Friendica\Database\DBM;
function share_init(App $a) { function share_init(App $a) {
$post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
if((! $post_id) || (! local_user())) if (!$post_id || !local_user()) {
killme(); killme();
}
$r = q("SELECT item.*, contact.network FROM `item` $r = q("SELECT item.*, contact.network FROM `item`
inner join contact on `item`.`contact-id` = `contact`.`id` INNER JOIN `contact` ON `item`.`contact-id` = `contact`.`id`
WHERE `item`.`id` = %d AND `item`.`uid` = %d LIMIT 1", WHERE `item`.`id` = %d LIMIT 1",
intval($post_id)
intval($post_id),
intval(local_user())
); );
if(! DBM::is_result($r) || ($r[0]['private'] == 1)) if (!DBM::is_result($r) || ($r[0]['private'] == 1)) {
killme(); killme();
}
if (strpos($r[0]['body'], "[/share]") !== false) { if (strpos($r[0]['body'], "[/share]") !== false) {
$pos = strpos($r[0]['body'], "[share"); $pos = strpos($r[0]['body'], "[share");
$o = substr($r[0]['body'], $pos); $o = substr($r[0]['body'], $pos);
@ -40,12 +38,12 @@ function share_header($author, $profile, $avatar, $guid, $posted, $link) {
"' profile='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $profile). "' profile='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $profile).
"' avatar='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $avatar); "' avatar='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $avatar);
if ($guid) if ($guid) {
$header .= "' guid='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $guid); $header .= "' guid='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $guid);
}
if ($posted) if ($posted) {
$header .= "' posted='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $posted); $header .= "' posted='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $posted);
}
$header .= "' link='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $link)."']"; $header .= "' link='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $link)."']";
return $header; return $header;