diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-08-13 13:37:54 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-08-13 13:37:54 +0000 |
commit | 8d90e1b4719d052398b4d7c6b5618fea11399f4d (patch) | |
tree | f03b4cea134171e25393cb720319c352d10a404f | |
parent | 01dd633eee2de4bbfdba547ffc9caab8910ae7c7 (diff) | |
download | elgg-8d90e1b4719d052398b4d7c6b5618fea11399f4d.tar.gz elgg-8d90e1b4719d052398b4d7c6b5618fea11399f4d.tar.bz2 |
Refs #237, #46 and #227: Added override code.
git-svn-id: https://code.elgg.org/elgg/trunk@1902 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/access.php | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php index d83683462..b21971c09 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -98,6 +98,34 @@ return $access_array[$user_id];
}
+ + /** + * Override the default behaviour and allow results to show hidden entities as well. + * THIS IS A HACK. + * + * TODO: Replace this with query object! + */ + $ENTITY_SHOW_HIDDEN_OVERRIDE = false; + + /** + * This will be replaced. Do not use in plugins! + * + * @param bool $show + */ + function access_show_hidden_entities($show_hidden) + { + global $ENTITY_SHOW_HIDDEN_OVERRIDE; + $ENTITY_SHOW_HIDDEN_OVERRIDE = $show_hidden; + } + + /** + * This will be replaced. Do not use in plugins! + */ + function access_get_show_hidden_status() + { + global $ENTITY_SHOW_HIDDEN_OVERRIDE; + return $ENTITY_SHOW_HIDDEN_OVERRIDE; + } /**
* Add access restriction sql code to a given query.
@@ -106,11 +134,12 @@ *
* TODO: DELETE once Query classes are fully integrated
*
- * @param string $table_prefix Optional xxx. prefix for the access code. - * @param bool $active_only Option to select only active entities or include deactive ones.
+ * @param string $table_prefix Optional xxx. prefix for the access code.
*/
- function get_access_sql_suffix($table_prefix = "", $active_only = true)
- {
+ function get_access_sql_suffix($table_prefix = "")
+ { + global $ENTITY_SHOW_HIDDEN_OVERRIDE; +
$sql = "";
if ($table_prefix)
@@ -130,7 +159,7 @@ if (empty($sql))
$sql = " ({$table_prefix}access_id in {$access} or ({$table_prefix}access_id = 0 and {$table_prefix}owner_guid = $owner))";
- if ($active_only) + if (!$ENTITY_SHOW_HIDDEN_OVERRIDE) $sql .= " and {$table_prefix}enabled='yes'";
return $sql;
|