]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #210 from tomtom84/master
authortomtom84 <63dc41d76451@ba77e90e49a6.anonbox.net>
Fri, 6 Apr 2012 11:29:01 +0000 (04:29 -0700)
committertomtom84 <63dc41d76451@ba77e90e49a6.anonbox.net>
Fri, 6 Apr 2012 11:29:01 +0000 (04:29 -0700)
fixes in diabook-derivates

boot.php
include/config.php [changed mode: 0644->0755]
update.php
view/de/messages.po
view/de/strings.php

index e1bcc078a587746010c341583a5126ac370f7235..f4f44a644769ce35cfbc6d81d18b7265f0dafdfb 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -11,7 +11,7 @@ require_once('include/cache.php');
 define ( 'FRIENDICA_PLATFORM',     'Friendica');
 define ( 'FRIENDICA_VERSION',      '2.3.1303' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
-define ( 'DB_UPDATE_VERSION',      1135      );
+define ( 'DB_UPDATE_VERSION',      1136      );
 
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
old mode 100644 (file)
new mode 100755 (executable)
index c999b76..4cff380
@@ -1,87 +1,80 @@
 <?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;
        
@@ -89,139 +82,142 @@ function set_config($family,$key,$value) {
        $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;
+}}
index ae35d2d50d7120b201b18d519b890a85afd625c0..0c8486c316e35cf824a21d4e30963af6445a3535 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-define( 'UPDATE_VERSION' , 1135 );
+define( 'UPDATE_VERSION' , 1136 );
 
 /**
  *
@@ -1143,16 +1143,21 @@ q("ALTER TABLE `mail` ADD `unknown` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `rep
 }
 
 function update_1134() {
+       // faulty update merged forward
+       // had a hardwired tablename of 'friendica' which isn't the right name on most systems
+}
+
+function update_1135() {
        //there can't be indexes with more than 1000 bytes in mysql, 
        //so change charset to be smaller
        q("ALTER TABLE `config` CHANGE `cat` `cat` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL ,
 CHANGE `k` `k` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL"); 
        //and add the index
-       q("ALTER TABLE `friendica`.`config` ADD UNIQUE `access` ( `cat` , `k` ) "); 
+       q("ALTER TABLE `config` ADD UNIQUE `access` ( `cat` , `k` ) "); 
        
        //same thing for pconfig
        q("ALTER TABLE `pconfig` CHANGE `cat` `cat` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL ,
        CHANGE `k` `k` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL"); 
        
-       q("ALTER TABLE `friendica`.`pconfig` ADD UNIQUE `access` ( `uid` , `cat` , `k` )"); 
-}
+       q("ALTER TABLE `pconfig` ADD UNIQUE `access` ( `uid` , `cat` , `k` )"); 
+}
\ No newline at end of file
index 0e4cb2ea78bc14054e749129bcbd69fcbe78a0e1..1036e7b7506ac3dc3d5c6832d1b3b63d8b0d461b 100644 (file)
@@ -16,8 +16,8 @@ msgid ""
 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"
@@ -411,7 +411,7 @@ msgstr "wurde getaggt in einem"
 #: ../../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"
@@ -1021,8 +1021,8 @@ msgid "This is required for message delivery to work."
 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 ""
@@ -2232,7 +2232,7 @@ msgstr "Markierte"
 
 #: ../../mod/network.php:197
 msgid "Shared Links"
-msgstr "Geteilte Internetlinks"
+msgstr "Geteilte Links"
 
 #: ../../mod/network.php:270
 #, php-format
@@ -2274,7 +2274,7 @@ msgstr "Ungültiger Kontakt."
 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"
@@ -2713,7 +2713,7 @@ msgstr "Personen Suche"
 #: ../../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"
@@ -2725,7 +2725,7 @@ msgstr "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"
@@ -3798,11 +3798,11 @@ msgstr "sichtbar für jeden"
 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 -"
 
@@ -4006,7 +4006,7 @@ msgstr "Kontaktanfrage schlug fehl oder wurde zurück gezogen."
 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"
@@ -5216,7 +5216,7 @@ msgstr "Hilfe oder @NewHere"
 #: ../../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
@@ -5850,15 +5850,15 @@ msgstr "Beitrag"
 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"
index 811fb98d0df967521f1ad1fa8b0d5255cfbf6d62..28567396bb8496da92b755abf009259d53c54ad6 100644 (file)
@@ -212,7 +212,7 @@ $a->strings["Enter full path to php executable"] = "Kompletter Pfad zum PHP-Exec
 $a->strings["Command line PHP"] = "Kommandozeilen-PHP";
 $a->strings["The command line version of PHP on your system does not have \"register_argc_argv\" enabled."] = "Die Kommandozeilenversion von PHP auf deinem System hat \"register_argc_argv\" nicht aktiviert.";
 $a->strings["This is required for message delivery to work."] = "Dies wird für die Auslieferung von Nachrichten benötigt.";
-$a->strings["PHP \"register_argc_argv\""] = "PHP \"register_argc_argv\"";
+$a->strings["PHP register_argc_argv"] = "PHP register_argc_argv";
 $a->strings["Error: the \"openssl_pkey_new\" function on this system is not able to generate encryption keys"] = "Fehler: Die Funktion \"openssl_pkey_new\" auf diesem System ist nicht in der Lage, Verschlüsselungsschlüssel zu erzeugen";
 $a->strings["If running under Windows, please see \"http://www.php.net/manual/en/openssl.installation.php\"."] = "Wenn der Server unter Windows läuft, schau dir bitte \"http://www.php.net/manual/en/openssl.installation.php\" an.";
 $a->strings["Generate encryption keys"] = "Schlüssel erzeugen";
@@ -491,7 +491,7 @@ $a->strings["Commented Order"] = "Neueste Kommentare";
 $a->strings["Posted Order"] = "Neueste Beiträge";
 $a->strings["New"] = "Neue";
 $a->strings["Starred"] = "Markierte";
-$a->strings["Shared Links"] = "Geteilte Internetlinks";
+$a->strings["Shared Links"] = "Geteilte Links";
 $a->strings["Warning: This group contains %s member from an insecure network."] = array(
        0 => "Warnung: Diese Gruppe beinhaltet %s Person aus einem unsicheren Netzwerk.",
        1 => "Warnung: Diese Gruppe beinhaltet %s Personen aus unsicheren Netzwerken.",
@@ -1158,7 +1158,7 @@ $a->strings["Similar Interests"] = "Ähnliche Interessen";
 $a->strings["Invite Friends"] = "Freunde einladen";
 $a->strings["Community Pages"] = "Foren";
 $a->strings["Help or @NewHere ?"] = "Hilfe oder @NewHere";
-$a->strings["Connect Services"] = "Mit anderen Webanwendungen verbinden";
+$a->strings["Connect Services"] = "Verbinde Dienste";
 $a->strings["PostIt to Friendica"] = "PostIt nach Friendica";
 $a->strings["Post to Friendica"] = "Bei Friendica veröffentlichen";
 $a->strings[" from anywhere by bookmarking this Link."] = " von überall her indem du diesen Link zu deinen Lesezeichen hinzufügst.";