]> git.mxchange.org Git - friendica.git/blob - include/config.php
8f36dbdc825cecdbbf4d58ffbc15baf1b8fdc7d5
[friendica.git] / include / config.php
1 <?php
2
3 require_once("include/PConfig.php");
4 require_once("include/Config.php");
5
6 /**
7  * @file include/config.php
8  * 
9  *  @brief (Deprecated) Arbitrary configuration storage
10  * Note:
11  * Please do not store booleans - convert to 0/1 integer values
12  * The get_?config() functions return boolean false for keys that are unset,
13  * and this could lead to subtle bugs.
14  *
15  * There are a few places in the code (such as the admin panel) where boolean
16  * configurations need to be fixed as of 10/08/2011.
17  */
18
19 /**
20  * @brief (Deprecated) Loads all configuration values of family into a cached storage.
21  *
22  * Note: This function is deprecated. Use Config::load() instead.
23  *
24  * @param string $family
25  *  The category of the configuration value
26  * @return void
27  */
28 function load_config($family) {
29         return Config::load($family);
30 }
31
32 /**
33  * @brief (Deprecated) Get a particular user's config variable given the category name
34  * ($family) and a key.
35  *
36  * Note: This function is deprecated. Use Config::get() instead.
37  *
38  * @param string $family
39  *  The category of the configuration value
40  * @param string $key
41  *  The configuration key to query
42  * @param boolean $refresh
43  *  If true the config is loaded from the db and not from the cache
44  * @return mixed Stored value or false if it does not exist
45  */
46 function get_config($family, $key, $refresh = false) {
47         $v = Config::get($family, $key, $refresh);
48         if(is_null($v))
49                 $v = false;
50
51         return $v;
52 }
53
54 /**
55  * @brief (Deprecated) Sets a configuration value for system config
56  *
57  * Note: This function is deprecated. Use Config::set() instead.
58  *
59  * @param string $family
60  *  The category of the configuration value
61  * @param string $key
62  *  The configuration key to set
63  * @param string $value
64  *  The value to store
65  * @return mixed Stored $value or false if the database update failed
66  */
67 function set_config($family,$key,$value) {
68         return Config::set($family, $key, $value);
69 }
70
71 /**
72  * @brief (Deprecated) Deletes the given key from the system configuration.
73  *
74  * Note: This function is deprecated. Use Config::delete() instead.
75  *
76  * @param string $family
77  *  The category of the configuration value
78  * @param string $key
79  *  The configuration key to delete
80  * @return mixed
81  */
82 function del_config($family,$key) {
83         return Config::delete($family, $key);
84 }
85
86 /**
87  * @brief (Deprecated) Loads all configuration values of a user's config family into a cached storage.
88  *
89  * Note: This function is deprecated. Use PConfig::load() instead.
90  *
91  * @param string $uid
92  *  The user_id
93  * @param string $family
94  *  The category of the configuration value
95  * @return void
96  */
97 function load_pconfig($uid,$family) {
98         return PConfig::load($uid, $family);
99 }
100
101 /**
102  * @brief (Deprecated) Get a particular user's config variable given the category name
103  * ($family) and a key.
104  *
105  * Note: This function is deprecated. Use PConfig::get() instead.
106  *
107  * @param string $uid
108  *  The user_id
109  * @param string $family
110  *  The category of the configuration value
111  * @param string $key
112  *  The configuration key to query
113  * @param boolean $refresh
114  *  If true the config is loaded from the db and not from the cache
115  * @return mixed Stored value or false if it does not exist
116  */
117 function get_pconfig($uid, $family, $key, $refresh = false) {
118         $v = PConfig::get($uid, $family, $key, $refresh);
119         if(is_null($v))
120                 $v = false;
121
122         return $v;
123 }
124
125 /**
126  * @brief (Deprecated) Sets a configuration value for a user
127  *
128  * Note: This function is deprecated. Use PConfig::set() instead.
129  *
130  * @param string $uid
131  *  The user_id
132  * @param string $family
133  *  The category of the configuration value
134  * @param string $key
135  *  The configuration key to set
136  * @param string $value
137  *  The value to store
138  * @return mixed Stored $value or false
139  */
140 function set_pconfig($uid,$family,$key,$value) {
141         return PConfig::set($uid, $family, $key, $value);
142 }
143
144 /**
145  * @brief (Deprecated) Deletes the given key from the users's configuration.
146  *
147  * Note: This function is deprecated. Use PConfig::delete() instead.
148  *
149  * @param string $uid The user_id
150  * @param string $family
151  *  The category of the configuration value
152  * @param string $key
153  *  The configuration key to delete
154  * @return mixed
155  */
156 function del_pconfig($uid,$family,$key) {
157         return PConfig::delete($uid, $family, $key);
158 }