ability to open old posts without UUID
This commit is contained in:
+31
-5
@@ -7,7 +7,6 @@ use Zotlabs\Web\Controller;
|
||||
class Link extends Controller {
|
||||
|
||||
function init() {
|
||||
|
||||
}
|
||||
|
||||
function get() {
|
||||
@@ -20,7 +19,7 @@ class Link extends Controller {
|
||||
return;
|
||||
}
|
||||
|
||||
$r = q("select uuid from item where id = %d limit 1",
|
||||
$r = q("select uuid, mid from item where id = %d limit 1",
|
||||
intval($item_id)
|
||||
);
|
||||
|
||||
@@ -29,12 +28,39 @@ class Link extends Controller {
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_config('link','hideasides')) {
|
||||
goaway(z_root() . '/display/' . $r[0]['uuid'] . '?link_hideasides=1');
|
||||
$identifier = $r[0]['uuid'] ?? '';
|
||||
|
||||
if (!$identifier) {
|
||||
if ($r[0]['mid']) {
|
||||
$identifier = 'b64.' . base64url_encode($r[0]['mid']);
|
||||
}
|
||||
}
|
||||
|
||||
goaway(z_root() . '/display/' . $r[0]['uuid']);
|
||||
if (!$identifier) {
|
||||
notice( t('Item not found.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
$old_argv = \App::$argv;
|
||||
$old_argc = \App::$argc;
|
||||
|
||||
\App::$argv = ['display', $identifier];
|
||||
\App::$argc = 2;
|
||||
|
||||
$display = new Display();
|
||||
$output = $display->get();
|
||||
|
||||
\App::$argv = $old_argv;
|
||||
\App::$argc = $old_argc;
|
||||
|
||||
$separator = ' - ';
|
||||
$page_title = \App::$page['title'];
|
||||
if (substr($page_title, -strlen($separator)) === $separator) {
|
||||
$page_title = substr($page_title, 0, -strlen($separator));
|
||||
}
|
||||
\App::$page['title'] = $page_title;
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Name: Link
|
||||
* Description: Using short links on whole hub
|
||||
* Version: 0.92
|
||||
* Version: 0.94
|
||||
* Author: ivan zlax <@zlax@ussr.win>
|
||||
* Maintainer: ivan zlax <@zlax@ussr.win>
|
||||
*/
|
||||
@@ -59,7 +59,7 @@ function dropdown_link(&$extras) {
|
||||
}
|
||||
|
||||
function hideasides_header(&$b) {
|
||||
if (isset($_GET['link_hideasides'])) {
|
||||
if (get_config('link','hideasides') && isset($_SERVER['REQUEST_URI']) && str_contains($_SERVER['REQUEST_URI'], '/link/')) {
|
||||
$addScriptTag = "<style>#region_1 { display: none !important; } #region_3 { display: none !important; }</style>\r\n";
|
||||
\App::$page['htmlhead'] .= $addScriptTag;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user