2
0
Fork 0

v0.85 updated for hubzilla 5

This commit is contained in:
ivan 2020-11-07 16:02:21 +03:00
parent afb298ddd9
commit e050060484
2 changed files with 375 additions and 385 deletions

View File

@ -33,7 +33,6 @@ class Link extends \Zotlabs\Web\Controller {
} }
$observer_is_owner = false; $observer_is_owner = false;
$updateable = false;
if(local_channel() && (! $update)) { if(local_channel() && (! $update)) {
@ -82,7 +81,8 @@ class Link extends \Zotlabs\Web\Controller {
$target_item = null; $target_item = null;
$r = q("select id, uid, mid, parent_mid, thr_parent, verb, item_type, item_deleted, author_xchan, item_blocked from item where id = '%s' limit 1", $r = q("select id, uid, mid, parent, parent_mid, thr_parent, verb, item_type, item_deleted, author_xchan, item_blocked from item where id = '%s' limit 1",
dbesc($item_id . '%') dbesc($item_id . '%')
); );
@ -180,7 +180,9 @@ class Link extends \Zotlabs\Web\Controller {
$static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1); $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1);
// if the target item is not a post (eg a like) we want to address its thread parent // if the target item is not a post (eg a like) we want to address its thread parent
$mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']); // $mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']);
$mid = $target_item['mid'];
// we must encode it again before handing to javascript // we must encode it again before handing to javascript
$mid = 'b64.' . base64url_encode($mid); $mid = 'b64.' . base64url_encode($mid);
@ -202,6 +204,7 @@ class Link extends \Zotlabs\Web\Controller {
'$conv' => '0', '$conv' => '0',
'$spam' => '0', '$spam' => '0',
'$fh' => '0', '$fh' => '0',
'$dm' => '0',
'$nouveau' => '0', '$nouveau' => '0',
'$wall' => '0', '$wall' => '0',
'$static' => $static, '$static' => $static,
@ -248,9 +251,6 @@ class Link extends \Zotlabs\Web\Controller {
intval(local_channel()), intval(local_channel()),
dbesc($target_item['parent_mid']) dbesc($target_item['parent_mid'])
); );
if($r) {
$updateable = true;
}
} }
if(! $r) { if(! $r) {
@ -292,9 +292,6 @@ class Link extends \Zotlabs\Web\Controller {
intval(local_channel()), intval(local_channel()),
dbesc($target_item['parent_mid']) dbesc($target_item['parent_mid'])
); );
if($r) {
$updateable = true;
}
} }
if($r === null) { if($r === null) {
@ -405,13 +402,6 @@ class Link extends \Zotlabs\Web\Controller {
} }
if($updateable) {
$x = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 AND uid = %d and parent = %d ",
intval(local_channel()),
intval($r[0]['item_id'])
);
}
$o .= '<div id="content-complete"></div>'; $o .= '<div id="content-complete"></div>';
if((($update && $load) || $noscript_content) && (! $items)) { if((($update && $load) || $noscript_content) && (! $items)) {

View File

@ -2,7 +2,7 @@
/** /**
* Name: Link * Name: Link
* Description: Using short links on whole hub * Description: Using short links on whole hub
* Version: 0.70 * Version: 0.85
* Author: ivan zlax <@zlax@ussr.win> * Author: ivan zlax <@zlax@ussr.win>
* Maintainer: ivan zlax <@zlax@ussr.win> * Maintainer: ivan zlax <@zlax@ussr.win>
*/ */
@ -27,16 +27,16 @@ function link_unload() {
del_config('link','linkenabled'); del_config('link','linkenabled');
} }
function link_plugin_admin(&$a,&$o) { function link_plugin_admin(&$a) {
$t = get_markup_template( "admin.tpl", "addon/link/" ); $t = get_markup_template( "admin.tpl", "addon/link/" );
$o = replace_macros($t, array( $a = replace_macros($t, array(
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$hideasides' => array('hideasides', t('Hide side panels on the link page'), get_config('link', 'hideasides')), '$hideasides' => array('hideasides', t('Hide side panels on the link page'), get_config('link', 'hideasides')),
'$linkonhub' => array('linkonhub', t('Show "Link on Hub" in the dropdown menu'), get_config('link', 'linkonhub')), '$linkonhub' => array('linkonhub', t('Show "Link on Hub" in the dropdown menu'), get_config('link', 'linkonhub')),
)); ));
} }
function link_plugin_admin_post(&$a) { function link_plugin_admin_post() {
set_config('link','linkonhub',trim($_POST['linkonhub'])); set_config('link','linkonhub',trim($_POST['linkonhub']));
set_config('link','hideasides',trim($_POST['hideasides'])); set_config('link','hideasides',trim($_POST['hideasides']));
if (get_config('link','linkonhub')) if (get_config('link','linkonhub'))