diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-11-19 19:46:12 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-11-19 19:46:12 +0000 |
commit | a7e2dcecb603734d2c47ffa506e91a2d3ae77253 (patch) | |
tree | 7847b6e2af37973f29cc96f1638f742a7b66cce0 /engine/lib/entities.php | |
parent | 131e9de561f2237fa9b5b70ac15fa4ac1c555afb (diff) | |
download | elgg-a7e2dcecb603734d2c47ffa506e91a2d3ae77253.tar.gz elgg-a7e2dcecb603734d2c47ffa506e91a2d3ae77253.tar.bz2 |
Base private setting functions, commit 1
git-svn-id: https://code.elgg.org/elgg/trunk@2465 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r-- | engine/lib/entities.php | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index fd0475d07..05f8f9dcd 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -2134,6 +2134,60 @@ return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle); + }
+
+ /**
+ * Gets a private setting for an entity.
+ *
+ * @param int $entity_guid The entity GUID
+ * @param string $name The name of the setting
+ * @return mixed The setting value, or false on failure
+ */
+ function get_private_setting($entity_guid, $name) {
+
+ global $CONFIG;
+ $entity_guid = (int) $entity_guid;
+ $name = mysql_real_escape_string($name);
+ if ($setting = get_data_row("select value from {$CONFIG->prefix}private_settings where name = '{$name}' and entity_guid = {$entity_guid}")) {
+ return $setting->value;
+ }
+ return false;
+
+ }
+
+ /**
+ * Sets a private setting for an entity.
+ *
+ * @param int $entity_guid The entity GUID
+ * @param string $name The name of the setting
+ * @param string $value The value of the setting
+ * @return mixed The setting ID, or false on failure
+ */
+ function set_private_setting($entity_guid, $name, $value) {
+
+ global $CONFIG;
+ $entity_guid = (int) $entity_guid;
+ $name = mysql_real_escape_string($name);
+ $value = mysql_real_escape_string($value);
+ return insert_data("insert into {$CONFIG->prefix}private_settings set name = '{$name}', value = '{$value}' where entity_guid = {$entity_guid}");
+
+ }
+
+ /**
+ * Deletes a private setting for an entity.
+ *
+ * @param int $entity_guid The Entity GUID
+ * @param string $name The name of the setting
+ * @return true|false depending on success
+ *
+ */
+ function remove_private_setting($entity_guid, $name) {
+
+ global $CONFIG;
+ $entity_guid = (int) $entity_guid;
+ $name = mysql_real_escape_string($name);
+ return delete_data("delete from {$CONFIG->prefix}private_settings where name = '{$name}' and entity_guid = {$entity_guid}");
+
} /** |