説明
指定されたクエリへのアクセス制限のSQLコードを追加します。
このコードは、特権モードで実行された場合は、空白を返すことに注意してください。
共通変数
ENTITY_SHOW_HIDDEN_OVERRIDE , CONFIG
1 sql変数をブランクで初期化
2 friends_bit変数をブランクで初期化
3 enemies_bit変数をブランクで初期化
4 table_prefixに値がある場合
4.1 table_prefixにsanitise_string(table_prefix) + “.”を代入
5 ownerがnullであった場合
5.1 owner = get_loggedin_userid()を代入
6 ownerに値がない場合(言い方が微妙だがそんなイメージ)
6.1 ownerに-1を代入
7 ignore_access = elgg_check_access_overrides(owner)を代入
アクセスシステムは無視されているかどうかを決定します。
8 access = get_access_list(owner)を代入
9 ignore_accessがtrueであった場合
9.1 sql = “ (1 = 1) “を代入
10 ownerが-1でなかった場合
10.1 table_prefix + “access_id = " + ACCESS_FRIENDS +
"AND “ + table_prefix + "owner_guid IN (" +
"SELECT guid_one FROM " + CONFIG->dbprefix + “entity_relationships"
"WHERE relationship = 'friend' AND guid_two = " + owner + ")"
上記SQL文をfriends_bitに代入
10.2 friends_bitに'(' + friends_bit + ') OR 'を代入
10.3 CONFIG->user_block_and_filter_enabledがnullでなく値が存在する場合(微妙)
10.3.1 enemies_bit = get_annotation_sql('elgg_block_list', able_prefix + "owner_guid", owner, false)を代入
注釈の制限を追加
10.3.2 enemies_bit = 下記文字列を代入
'(' + enemies_bit + ' AND ' + get_annotation_sql('elgg_filter_list', owner, table_prefix + "owner_guid", false) + ") "
11 sqlに値がない場合
11.1 friends_bit + " (" + table_prefix + "access_id IN " + access +
"OR (" + table_prefix + "owner_guid = " + owner + ")" +
"OR (" + table_prefix + "access_id = " + ACCESS_PRIVATE
"AND " + table_prefix + "owner_guid = " + owner + "))"
上記SQL文をsqlに代入
12 enemies_bitに値がない場合
12.1 sql = enemies_bit + " AND (" + sql + ")"を代入
13 ENTITY_SHOW_HIDDEN_OVERRIDEに値がない場合(falseかもしれない
13.1 sql = sql + " and " + table_prefix + "enabled='yes'"を代入
14 '(' + $sql + ')'を返す