aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Item.php27
1 files changed, 15 insertions, 12 deletions
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index 9964192fe..8ded7c1d7 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -40,16 +40,9 @@ require_once('include/conversation.php');
*/
class Item extends Controller {
- private string $item_id;
function init() {
- $this->item_id = argv(1);
-
- if (!$this->item_id) {
- http_status_exit(404, 'Not found');
- }
-
if (Libzot::is_zot_request()) {
$this->init_zot_request();
}
@@ -58,6 +51,7 @@ class Item extends Controller {
$this->init_as_request();
}
+
if (argc() > 1 && argv(1) !== 'drop') {
$x = q("select uid, item_wall, llink, mid, uuid from item where mid = '%s' or mid = '%s' or uuid = '%s'",
dbesc(z_root() . '/item/' . argv(1)),
@@ -1500,6 +1494,11 @@ class Item extends Controller {
private function init_zot_request() {
+ $item_id = argv(1);
+
+ if (!$item_id)
+ http_status_exit(404, 'Not found');
+
$portable_id = EMPTY_STR;
$item_normal_extra = sprintf(" and not verb in ('Follow', 'Ignore', '%s', '%s') ",
@@ -1514,7 +1513,7 @@ class Item extends Controller {
// do we have the item (at all)?
$r = q("select parent_mid from item where uuid = '%s' $item_normal limit 1",
- dbesc($this->item_id)
+ dbesc($item_id)
);
if (!$r) {
@@ -1603,7 +1602,7 @@ class Item extends Controller {
dbesc($portable_id)
);
if (!$c) {
- ThreadListener::store(z_root() . '/item/' . $this->item_id, $portable_id);
+ ThreadListener::store(z_root() . '/item/' . $item_id, $portable_id);
}
}
@@ -1612,6 +1611,10 @@ class Item extends Controller {
private function init_as_request() {
+ $item_id = argv(1);
+ if (!$item_id)
+ http_status_exit(404, 'Not found');
+
$portable_id = EMPTY_STR;
$item_normal_extra = sprintf(" and not verb in ('Follow', 'Ignore', '%s', '%s') ",
@@ -1627,7 +1630,7 @@ class Item extends Controller {
// add preferential bias to item owners (item_wall = 1)
$r = q("select * from item where uuid = '%s' $item_normal order by item_wall desc limit 1",
- dbesc($this->item_id)
+ dbesc($item_id)
);
if (!$r) {
@@ -1676,7 +1679,7 @@ class Item extends Controller {
);
if ($t) {
$i = q("select id as item_id from item where uuid = '%s' and id = %d $item_normal limit 1",
- dbesc($this->item_id),
+ dbesc($item_id),
intval($t[0]['iid'])
);
}
@@ -1711,7 +1714,7 @@ class Item extends Controller {
dbesc($portable_id)
);
if (!$c) {
- ThreadListener::store(z_root() . '/item/' . $this->item_id, $portable_id);
+ ThreadListener::store(z_root() . '/item/' . $item_id, $portable_id);
}
}