From 04eb20ac35ab94c79de296723c5b921bb110a0ce Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 6 May 2022 14:58:27 +0000 Subject: some cleanup after moving articles and cards to addons --- Zotlabs/Lib/ThreadItem.php | 15 +-------------- Zotlabs/Module/Display.php | 42 +----------------------------------------- Zotlabs/Module/Item.php | 31 +------------------------------ 3 files changed, 3 insertions(+), 85 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 8d20935a1..e43264c0d 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -162,24 +162,11 @@ class ThreadItem { $mode = $conv->get_mode(); - switch($item['item_type']) { - case ITEM_TYPE_CARD: - $edlink = 'card_edit'; - break; - case ITEM_TYPE_ARTICLE: - $edlink = 'article_edit'; - break; - default: - $edlink = 'editpost'; - break; - } - if(local_channel() && $observer['xchan_hash'] === $item['author_xchan']) - $edpost = array(z_root() . '/' . $edlink . '/' . $item['id'], t('Edit')); + $edpost = array(z_root() . '/editpost/' . $item['id'], t('Edit')); else $edpost = false; - if($observer && $observer['xchan_hash'] && ($observer['xchan_hash'] == $this->get_data_value('author_xchan') || $observer['xchan_hash'] == $this->get_data_value('owner_xchan') diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 02a79f854..0d29c3451 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -143,48 +143,8 @@ class Display extends \Zotlabs\Web\Controller { return ''; } } - if($target_item['item_type'] == ITEM_TYPE_ARTICLE) { - $x = q("select * from channel where channel_id = %d limit 1", - intval($target_item['uid']) - ); - $y = q("select * from iconfig left join item on iconfig.iid = item.id - where item.uid = %d and iconfig.cat = 'system' and iconfig.k = 'ARTICLE' and item.id = %d limit 1", - intval($target_item['uid']), - intval($target_item['parent']) - ); - if($x && $y) { - goaway(z_root() . '/articles/' . $x[0]['channel_address'] . '/' . $y[0]['v']); - } - else { - notice( t('Page not found.') . EOL); - return ''; - } - } - if($target_item['item_type'] == ITEM_TYPE_CARD) { - $x = q("select * from channel where channel_id = %d limit 1", - intval($target_item['uid']) - ); - - $y = q("select * from iconfig left join item on iconfig.iid = item.id - where item.uid = %d and iconfig.cat = 'system' and iconfig.k = 'CARD' and item.id = %d limit 1", - intval($target_item['uid']), - intval($target_item['parent']) - ); - - if($x && $y) { - goaway(z_root() . '/cards/' . $x[0]['channel_address'] . '/' . $y[0]['v']); - } - else { - notice( t('Page not found.') . EOL); - return ''; - } - } - if ($target_item['item_type'] == ITEM_TYPE_CUSTOM) { - call_hooks('item_custom_display',$target_item); - notice( t('Page not found.') . EOL); - return ''; - } + call_hooks('item_custom_display', $target_item); $simple_update = ''; if($update && $_SESSION['loadtime']) diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 574a90c1a..7bf8b21d5 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -1040,7 +1040,7 @@ class Item extends Controller { $parent_mid = $parent_item['mid']; - // Fallback so that we alway have a thr_parent + // Fallback so that we always have a thr_parent if (!$thr_parent) $thr_parent = $mid; @@ -1048,36 +1048,7 @@ class Item extends Controller { $item_thread_top = ((!$parent) ? 1 : 0); - - // fix permalinks for cards - - if ($webpage == ITEM_TYPE_CARD) { - $plink = z_root() . '/cards/' . $channel['channel_address'] . '/' . (($pagetitle) ? $pagetitle : $uuid); - } - if (($parent_item) && ($parent_item['item_type'] == ITEM_TYPE_CARD)) { - $r = q("select v from iconfig where iconfig.cat = 'system' and iconfig.k = 'CARD' and iconfig.iid = %d limit 1", - intval($parent_item['id']) - ); - if ($r) { - $plink = z_root() . '/cards/' . $channel['channel_address'] . '/' . $r[0]['v']; - } - } - - if ($webpage == ITEM_TYPE_ARTICLE) { - $plink = z_root() . '/articles/' . $channel['channel_address'] . '/' . (($pagetitle) ? $pagetitle : $uuid); - } - if (($parent_item) && ($parent_item['item_type'] == ITEM_TYPE_ARTICLE)) { - $r = q("select v from iconfig where iconfig.cat = 'system' and iconfig.k = 'ARTICLE' and iconfig.iid = %d limit 1", - intval($parent_item['id']) - ); - if ($r) { - $plink = z_root() . '/articles/' . $channel['channel_address'] . '/' . $r[0]['v']; - } - } - if ((!$plink) && ($item_thread_top)) { - // $plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . gen_link_id($mid); - // $plink = substr($plink,0,190); $plink = $mid; } -- cgit v1.2.3