<?php
+
/**
*
* Arbitrary configuration storage
* Note:
* Please do not store booleans - convert to 0/1 integer values
* The get_?config() functions return boolean false for keys that are unset,
- * and this could lead to subtle bugs.
+ * and this could lead to subtle bugs.
*
* There are a few places in the code (such as the admin panel) where boolean
* configurations need to be fixed as of 10/08/2011.
- *
- * @package config;
*/
-/**
- * retrieve a "family" of config variables
- * from database to cached storage
- */
+// retrieve a "family" of config variables from database to cached storage
+
if(! function_exists('load_config')) {
- function load_config($family) {
- global $a;
- $r = q("SELECT * FROM `config` WHERE `cat` = '%s'",
- dbesc($family)
- );
- if(count($r)) {
- foreach($r as $rr) {
- $k = $rr['k'];
- if ($rr['cat'] === 'config') {
- $a->config[$k] = $rr['v'];
- } else {
- $a->config[$family][$k] = $rr['v'];
- }
+function load_config($family) {
+ global $a;
+ $r = q("SELECT * FROM `config` WHERE `cat` = '%s'",
+ dbesc($family)
+ );
+ if(count($r)) {
+ foreach($r as $rr) {
+ $k = $rr['k'];
+ if ($rr['cat'] === 'config') {
+ $a->config[$k] = $rr['v'];
+ } else {
+ $a->config[$family][$k] = $rr['v'];
}
}
}
-}
+}}
-/**
- * get a particular config variable given the family name
- * and key. Returns false if not set.
- *
- * If a key is found in the DB but doesn't exist in
- * local config cache, pull it into the cache so we don't have
- *to hit the DB again for this item.
- */
-if(! function_exists('get_config')) {
- function get_config($family, $key) {
+// get a particular config variable given the family name
+// and key. Returns false if not set.
+// $instore is only used by the set_config function
+// to determine if the key already exists in the DB
+// If a key is found in the DB but doesn't exist in
+// local config cache, pull it into the cache so we don't have
+// to hit the DB again for this item.
- global $a;
+if(! function_exists('get_config')) {
+function get_config($family, $key, $instore = false) {
+ global $a;
+ if(! $instore) {
if(isset($a->config[$family][$key])) {
if($a->config[$family][$key] === '!<unset>!') {
return false;
}
return $a->config[$family][$key];
}
- $ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
- dbesc($family),
- dbesc($key)
- );
- if(count($ret)) {
- // manage array value
- $val = (preg_match("|^a:[0-9]+:{.*}$|", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
- $a->config[$family][$key] = $val;
- return $val;
- }
- else {
- $a->config[$family][$key] = '!<unset>!';
- }
- return false;
}
-}
+ $ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
+ dbesc($family),
+ dbesc($key)
+ );
+ if(count($ret)) {
+ // manage array value
+ $val = (preg_match("|^a:[0-9]+:{.*}$|", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
+ $a->config[$family][$key] = $val;
+ return $val;
+ }
+ else {
+ $a->config[$family][$key] = '!<unset>!';
+ }
+ return false;
+}}
-/**
- * Store a config value ($value) in the category ($family)
- * under the key ($key)
- *
- * Return the value, or false if the database update failed
- */
-if(! function_exists('set_config')) {
+// Store a config value ($value) in the category ($family)
+// under the key ($key)
+// Return the value, or false if the database update failed
+if(! function_exists('set_config')) {
function set_config($family,$key,$value) {
global $a;
$dbvalue = (is_array($value)?serialize($value):$value);
$dbvalue = (is_bool($value) ? intval($value) : $value);
+ if(get_config($family,$key,true) === false) {
$a->config[$family][$key] = $value;
- $ret = q("REPLACE INTO `config` ( `cat`, `k`, `v` ) VALUES ( '%s', '%s', '%s' ) ",
- dbesc($family),
- dbesc($key),
- dbesc($dbvalue)
+ $ret = q("INSERT INTO `config` ( `cat`, `k`, `v` ) VALUES ( '%s', '%s', '%s' ) ",
+ dbesc($family),
+ dbesc($key),
+ dbesc($dbvalue)
);
- if($ret) {
+ if($ret)
return $value;
- }
return $ret;
-
}
-}
+
+ $ret = q("UPDATE `config` SET `v` = '%s' WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
+ dbesc($dbvalue),
+ dbesc($family),
+ dbesc($key)
+ );
+
+ $a->config[$family][$key] = $value;
+
+ if($ret)
+ return $value;
+ return $ret;
+}}
if(! function_exists('load_pconfig')) {
- function load_pconfig($uid,$family) {
- global $a;
- $r = q("SELECT * FROM `pconfig` WHERE `cat` = '%s' AND `uid` = %d",
- dbesc($family),
- intval($uid)
- );
- if(count($r)) {
- foreach($r as $rr) {
- $k = $rr['k'];
- $a->config[$uid][$family][$k] = $rr['v'];
- }
+function load_pconfig($uid,$family) {
+ global $a;
+ $r = q("SELECT * FROM `pconfig` WHERE `cat` = '%s' AND `uid` = %d",
+ dbesc($family),
+ intval($uid)
+ );
+ if(count($r)) {
+ foreach($r as $rr) {
+ $k = $rr['k'];
+ $a->config[$uid][$family][$k] = $rr['v'];
}
}
-}
+}}
-/**\r
- * get a particular user-specific config variable given the family name,
- * the user id and key. Returns false if not set.\r
- *\r
- * If a key is found in the DB but doesn't exist in\r
- * local config cache, pull it into the cache so we don't have\r
- * to hit the DB again for this item.\r
- */
-if(! function_exists('get_pconfig')) {
- function get_pconfig($uid,$family, $key) {
- global $a;
+if(! function_exists('get_pconfig')) {
+function get_pconfig($uid,$family, $key, $instore = false) {
+ global $a;
+ if(! $instore) {
if(isset($a->config[$uid][$family][$key])) {
if($a->config[$uid][$family][$key] === '!<unset>!') {
return false;
}
return $a->config[$uid][$family][$key];
}
+ }
+ $ret = q("SELECT `v` FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1",
+ intval($uid),
+ dbesc($family),
+ dbesc($key)
+ );
- $ret = q("SELECT `v` FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1",
- intval($uid),
- dbesc($family),
- dbesc($key)
- );
-
- if(count($ret)) {
- $val = (preg_match("|^a:[0-9]+:{.*}$|", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
- $a->config[$uid][$family][$key] = $val;
- return $val;
- }
- else {
- $a->config[$uid][$family][$key] = '!<unset>!';
- }
- return false;
+ if(count($ret)) {
+ $val = (preg_match("|^a:[0-9]+:{.*}$|", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
+ $a->config[$uid][$family][$key] = $val;
+ return $val;
+ }
+ else {
+ $a->config[$uid][$family][$key] = '!<unset>!';
}
-}
+ return false;
+}}
-/**
- * Delete a value from config. This function
- * deletes both: db value and cache entry.
- */
if(! function_exists('del_config')) {
- function del_config($family,$key) {
-
- global $a;
- if(x($a->config[$family],$key))
- unset($a->config[$family][$key]);
- $ret = q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
- dbesc($family),
- dbesc($key)
- );
- return $ret;
- }
-}
+function del_config($family,$key) {
+ global $a;
+ if(x($a->config[$family],$key))
+ unset($a->config[$family][$key]);
+ $ret = q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
+ dbesc($family),
+ dbesc($key)
+ );
+ return $ret;
+}}
-/**\r
- * Store a user-specific config value ($value) for user $uid in the category ($family)\r
- * under the key ($key).
- * \r
- * Return the value, or false if the database update failed\r
- */
-if(! function_exists('set_pconfig')) {
- function set_pconfig($uid,$family,$key,$value) {
- global $a;
- // manage array value
- $dbvalue = (is_array($value)?serialize($value):$value);
- $dbvalue = (is_bool($value)?serialize($value):$value);
+// Same as above functions except these are for personal config storage and take an
+// additional $uid argument.
+
+if(! function_exists('set_pconfig')) {
+function set_pconfig($uid,$family,$key,$value) {
+
+ global $a;
+ // manage array value
+ $dbvalue = (is_array($value)?serialize($value):$value);
+ if(get_pconfig($uid,$family,$key,true) === false) {
$a->config[$uid][$family][$key] = $value;
- $ret = q("REPLACE INTO `pconfig` ( `uid`, `cat`, `k`, `v` ) VALUES ( %d, '%s', '%s', '%s' ) ",
- intval($uid),
- dbesc($family),
- dbesc($key),
- dbesc($dbvalue)
+ $ret = q("INSERT INTO `pconfig` ( `uid`, `cat`, `k`, `v` ) VALUES ( %d, '%s', '%s', '%s' ) ",
+ intval($uid),
+ dbesc($family),
+ dbesc($key),
+ dbesc($dbvalue)
);
- if($ret) {
+ if($ret)
return $value;
- }
return $ret;
-
}
-}
+ $ret = q("UPDATE `pconfig` SET `v` = '%s' WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1",
+ dbesc($dbvalue),
+ intval($uid),
+ dbesc($family),
+ dbesc($key)
+ );
+
+ $a->config[$uid][$family][$key] = $value;
+
+ if($ret)
+ return $value;
+ return $ret;
+}}
if(! function_exists('del_pconfig')) {
- function del_pconfig($uid,$family,$key) {
-
- global $a;
- if(x($a->config[$uid][$family],$key))
- unset($a->config[$uid][$family][$key]);
- $ret = q("DELETE FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1",
- intval($uid),
- dbesc($family),
- dbesc($key)
- );
- return $ret;
- }
-}
+function del_pconfig($uid,$family,$key) {
+
+ global $a;
+ if(x($a->config[$uid][$family],$key))
+ unset($a->config[$uid][$family][$key]);
+ $ret = q("DELETE FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1",
+ intval($uid),
+ dbesc($family),
+ dbesc($key)
+ );
+ return $ret;
+}}
msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: http://bugs.friendica.com/\n"
-"POT-Creation-Date: 2012-04-04 15:51-0700\n"
-"PO-Revision-Date: 2012-04-06 07:35+0000\n"
+"POT-Creation-Date: 2012-04-05 10:00-0700\n"
+"PO-Revision-Date: 2012-04-06 10:40+0000\n"
"Last-Translator: bavatar <tobias.diekershoff@gmx.net>\n"
"Language-Team: German (http://www.transifex.net/projects/p/friendica/language/de/)\n"
"MIME-Version: 1.0\n"
#: ../../view/theme/diabook-blue/theme.php:82
#: ../../view/theme/diabook/theme.php:86
#: ../../view/theme/diabook-aerith/theme.php:82 ../../include/text.php:1294
-#: ../../include/diaspora.php:1650 ../../include/conversation.php:53
+#: ../../include/diaspora.php:1654 ../../include/conversation.php:53
#: ../../include/conversation.php:126
msgid "photo"
msgstr "Foto"
msgstr "Dies wird für die Auslieferung von Nachrichten benötigt."
#: ../../mod/install.php:343
-msgid "PHP \"register_argc_argv\""
-msgstr "PHP \"register_argc_argv\""
+msgid "PHP register_argc_argv"
+msgstr "PHP register_argc_argv"
#: ../../mod/install.php:364
msgid ""
#: ../../mod/network.php:197
msgid "Shared Links"
-msgstr "Geteilte Internetlinks"
+msgstr "Geteilte Links"
#: ../../mod/network.php:270
#, php-format
msgid "Personal Notes"
msgstr "Persönliche Notizen"
-#: ../../mod/notes.php:63 ../../mod/filer.php:29
+#: ../../mod/notes.php:63 ../../mod/filer.php:30
#: ../../addon/facebook/facebook.php:673 ../../include/text.php:649
msgid "Save"
msgstr "Speichern"
#: ../../view/theme/diabook/theme.php:81 ../../view/theme/diabook/theme.php:90
#: ../../view/theme/diabook-aerith/theme.php:77
#: ../../view/theme/diabook-aerith/theme.php:86
-#: ../../include/diaspora.php:1650 ../../include/conversation.php:48
+#: ../../include/diaspora.php:1654 ../../include/conversation.php:48
#: ../../include/conversation.php:57 ../../include/conversation.php:121
#: ../../include/conversation.php:130
msgid "status"
#: ../../view/theme/diabook-blue/theme.php:91
#: ../../view/theme/diabook/theme.php:95
#: ../../view/theme/diabook-aerith/theme.php:91
-#: ../../include/diaspora.php:1666 ../../include/conversation.php:65
+#: ../../include/diaspora.php:1670 ../../include/conversation.php:65
#, php-format
msgid "%1$s likes %2$s's %3$s"
msgstr "%1$s mag %2$ss %3$s"
msgid "Edit visibility"
msgstr "Sichtbarkeit bearbeiten"
-#: ../../mod/filer.php:28 ../../include/conversation.php:918
+#: ../../mod/filer.php:29 ../../include/conversation.php:918
msgid "Save to Folder:"
msgstr "In diesen Ordner verschieben:"
-#: ../../mod/filer.php:28
+#: ../../mod/filer.php:29
msgid "- select -"
msgstr "- auswählen -"
msgid "Unable to set contact photo."
msgstr "Konnte das Bild des Kontakts nicht speichern."
-#: ../../mod/dfrn_confirm.php:477 ../../include/diaspora.php:503
+#: ../../mod/dfrn_confirm.php:477 ../../include/diaspora.php:507
#: ../../include/conversation.php:101
#, php-format
msgid "%1$s is now friends with %2$s"
#: ../../view/theme/diabook/theme.php:206
#: ../../view/theme/diabook-aerith/theme.php:201
msgid "Connect Services"
-msgstr "Mit anderen Webanwendungen verbinden"
+msgstr "Verbinde Dienste"
#: ../../view/theme/diabook-red/theme.php:207
#: ../../view/theme/diabook-blue/theme.php:207
msgid "Item filed"
msgstr "Beitrag abgelegt"
-#: ../../include/diaspora.php:578
+#: ../../include/diaspora.php:582
msgid "Sharing notification from Diaspora network"
msgstr "Freigabe-Benachrichtigung von Diaspora"
-#: ../../include/diaspora.php:1965
+#: ../../include/diaspora.php:1969
msgid "Attachments:"
msgstr "Anhänge:"
-#: ../../include/diaspora.php:2148
+#: ../../include/diaspora.php:2152
#, php-format
msgid "[Relayed] Comment authored by %s from network %s"
msgstr "[Weitergeleitet] Kommentar von %s aus dem %s Netzwerk"