diff options
author | Mario <mario@mariovavti.com> | 2025-05-15 18:56:30 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2025-05-15 18:56:30 +0000 |
commit | 2b38eca986ee3673023a3622b0cb4f2b828c3d5e (patch) | |
tree | 00b65f757c58601292af648ae45d001928baef7e /Zotlabs/Module | |
parent | 4ec895b891186057f13617039b6f952033c7e0e3 (diff) | |
download | volse-hubzilla-2b38eca986ee3673023a3622b0cb4f2b828c3d5e.tar.gz volse-hubzilla-2b38eca986ee3673023a3622b0cb4f2b828c3d5e.tar.bz2 volse-hubzilla-2b38eca986ee3673023a3622b0cb4f2b828c3d5e.zip |
refactor sql_extra > permission_sql
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Channel.php | 11 | ||||
-rw-r--r-- | Zotlabs/Module/Display.php | 12 |
2 files changed, 13 insertions, 10 deletions
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 2619911b3..9671cedf3 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -298,7 +298,8 @@ class Channel extends Controller { $item_normal = item_normal(); $item_normal_update = item_normal_update(); - $sql_extra = item_permissions_sql(App::$profile['profile_uid']); + $sql_extra = ''; + $permission_sql = item_permissions_sql(App::$profile['profile_uid']); $page_mode = 'client'; @@ -337,7 +338,7 @@ class Channel extends Controller { if ($mid) { $r = q("SELECT parent AS item_id from item where $identifier = '%s' and uid = %d $item_normal_update - AND item_wall = 1 $simple_update $sql_extra limit 1", + AND item_wall = 1 $simple_update $permission_sql $sql_extra limit 1", dbesc($mid), intval(App::$profile['profile_uid']) ); @@ -348,6 +349,7 @@ class Channel extends Controller { WHERE uid = %d $item_normal_update AND item_wall = 1 $simple_update AND (abook.abook_blocked = 0 or abook.abook_flags is null) + $permission_sql $sql_extra ORDER BY created DESC", intval(App::$profile['profile_uid']) @@ -385,7 +387,7 @@ class Channel extends Controller { if ($noscript_content || $load) { if ($mid) { $r = q("SELECT parent AS item_id from item where $identifier = '%s' and uid = %d $item_normal - AND item_wall = 1 $sql_extra limit 1", + AND item_wall = 1 $permission_sql $sql_extra limit 1", dbesc($mid), intval(App::$profile['profile_uid']) ); @@ -401,6 +403,7 @@ class Channel extends Controller { AND (abook.abook_blocked = 0 or abook.abook_flags is null) AND item.item_wall = 1 $item_normal + $permission_sql $sql_extra $sql_extra2 ORDER BY $ordering DESC, item_id @@ -416,7 +419,7 @@ class Channel extends Controller { if ($r) { $parents_str = ids_to_querystr($r, 'item_id'); - $r = items_by_parent_ids($parents_str, sql_extra: $sql_extra, blog_mode: $blog_mode); + $r = items_by_parent_ids($parents_str, permission_sql: $permission_sql, blog_mode: $blog_mode); xchan_query($r); $items = fetch_post_tags($r, true); diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index baa352e7f..4b5b69405 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -212,7 +212,7 @@ class Display extends Controller { $observer_hash = get_observer_hash(); $item_normal = item_normal(); $item_normal_update = item_normal_update(); - $sql_extra = ''; + $permission_sql = ''; $r = []; if($noscript_content || $load) { @@ -231,7 +231,7 @@ class Display extends Controller { } if(!$r) { - $sql_extra = item_permissions_sql(0, $observer_hash); + $permission_sql = item_permissions_sql(0, $observer_hash); $r = q("SELECT item.id AS item_id FROM item WHERE ((mid = '%s' @@ -239,7 +239,7 @@ class Display extends Controller { AND item.deny_gid = '' AND item_private = 0 ) AND uid IN ( " . stream_perms_api_uids(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " )) OR uid = %d ))) OR - (mid = '%s' $sql_extra )) + (mid = '%s' $permission_sql )) $item_normal limit 1", dbesc($target_item['parent_mid']), @@ -269,7 +269,7 @@ class Display extends Controller { } if(!$r) { - $sql_extra = item_permissions_sql(0, $observer_hash); + $permission_sql = item_permissions_sql(0, $observer_hash); $r = q("SELECT item.id as item_id from item WHERE ((parent_mid = '%s' @@ -277,7 +277,7 @@ class Display extends Controller { AND item.deny_gid = '' AND item_private = 0 ) and uid in ( " . stream_perms_api_uids(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " )) OR uid = %d ))) OR - (parent_mid = '%s' $sql_extra )) + (parent_mid = '%s' $permission_sql )) $item_normal limit 1", dbesc($target_item['parent_mid']), @@ -291,7 +291,7 @@ class Display extends Controller { $parents_str = ids_to_querystr($r,'item_id'); if($parents_str) { $thr_parents_str = stringify_array(get_recursive_thr_parents($target_item), true); - $items = items_by_parent_ids($parents_str, $thr_parents_str, $sql_extra); + $items = items_by_parent_ids($parents_str, $thr_parents_str, $permission_sql); xchan_query($items); $items = fetch_post_tags($items,true); |