From bf147ca9d96df6e3ab38001b34349dae0e74ed45 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 2 Jan 2015 01:43:31 +0100 Subject: [PATCH 1/4] Hashtags in attached link description now don't create misformatted text anymore. --- include/bbcode.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index 724b8e2fdd..1f635e051b 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -41,7 +41,9 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) { if ($matches[1] != "") $title = $matches[1]; - $title = htmlentities($title, ENT_QUOTES, 'UTF-8', false); + //$title = htmlentities($title, ENT_QUOTES, 'UTF-8', false); + $title = bbcode(html_entity_decode($title), false, false, true); + $title = str_replace(array("[", "]"), array("[", "]"), $title); $image = ""; if ($type != "video") { @@ -1171,6 +1173,6 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal $a->save_timestamp($stamp1, "parser"); - return $Text; + return trim($Text); } ?> From 882f9c83d671fe2c4cf6e83d57c50e85e4baa9cd Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Fri, 2 Jan 2015 08:26:08 +0100 Subject: [PATCH 2/4] FR update to the strings --- view/fr/messages.po | 22 +++++++++++----------- view/fr/strings.php | 18 +++++++++--------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/view/fr/messages.po b/view/fr/messages.po index 78fe85714d..593c174ce7 100644 --- a/view/fr/messages.po +++ b/view/fr/messages.po @@ -9,7 +9,7 @@ # Lionel Triay , 2013 # Marquis_de_Carabas , 2012 # Olivier , 2011-2012 -# Sylvain Lagacé, 2014 +# Sylvain Lagacé, 2014-2015 # tomamplius , 2014 # Tubuntu , 2013-2014 msgid "" @@ -17,7 +17,7 @@ msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2014-10-22 10:05+0200\n" -"PO-Revision-Date: 2014-12-30 15:30+0000\n" +"PO-Revision-Date: 2015-01-02 00:18+0000\n" "Last-Translator: Sylvain Lagacé\n" "Language-Team: French (http://www.transifex.com/projects/p/friendica/language/fr/)\n" "MIME-Version: 1.0\n" @@ -3194,7 +3194,7 @@ msgstr "Fichier du compte" msgid "" "To export your account, go to \"Settings->Export your personal data\" and " "select \"Export account\"" -msgstr "" +msgstr "Pour exporter votre compte, allez dans \"Paramètres> Exporter vos données personnelles\" et sélectionnez \"exportation de compte\"" #: ../../mod/subthread.php:103 #, php-format @@ -3829,11 +3829,11 @@ msgstr "" #: ../../mod/settings.php:966 msgid "User Types" -msgstr "" +msgstr "Types d'utilisateurs" #: ../../mod/settings.php:967 msgid "Community Types" -msgstr "" +msgstr "Genre de communautés" #: ../../mod/settings.php:968 msgid "Normal Account Page" @@ -4247,7 +4247,7 @@ msgstr "%1$s a mis à jour son %2$s, en modifiant %3$s." #: ../../mod/profiles.php:617 msgid "Hide contacts and friends:" -msgstr "" +msgstr "Cacher mes contacts et amis:" #: ../../mod/profiles.php:622 msgid "Hide your contact/friend list from viewers of this profile?" @@ -4279,23 +4279,23 @@ msgstr "Supprimer ce profil" #: ../../mod/profiles.php:651 msgid "Basic information" -msgstr "" +msgstr "Information de base" #: ../../mod/profiles.php:652 msgid "Profile picture" -msgstr "" +msgstr "Image de profil" #: ../../mod/profiles.php:654 msgid "Preferences" -msgstr "" +msgstr "Préférences" #: ../../mod/profiles.php:655 msgid "Status information" -msgstr "" +msgstr "Information sur le statut" #: ../../mod/profiles.php:656 msgid "Additional information" -msgstr "" +msgstr "Information additionnelle" #: ../../mod/profiles.php:659 msgid "Profile Name:" diff --git a/view/fr/strings.php b/view/fr/strings.php index 66ffd6f63f..45bd95a726 100644 --- a/view/fr/strings.php +++ b/view/fr/strings.php @@ -707,7 +707,7 @@ $a->strings["You can import an account from another Friendica server."] = "Vous $a->strings["You need to export your account from the old server and upload it here. We will recreate your old account here with all your contacts. We will try also to inform your friends that you moved here."] = "Vous devez exporter votre compte à partir de l'ancien serveur et le téléverser ici. Nous recréerons votre ancien compte ici avec tous vos contacts. Nous tenterons également d'informer vos amis que vous avez déménagé ici."; $a->strings["This feature is experimental. We can't import contacts from the OStatus network (statusnet/identi.ca) or from Diaspora"] = "Cette fonctionnalité est expérimentale. Nous ne pouvons importer les contacts des réseaux OStatus (statusnet/identi.ca) ou Diaspora"; $a->strings["Account file"] = "Fichier du compte"; -$a->strings["To export your account, go to \"Settings->Export your personal data\" and select \"Export account\""] = ""; +$a->strings["To export your account, go to \"Settings->Export your personal data\" and select \"Export account\""] = "Pour exporter votre compte, allez dans \"Paramètres> Exporter vos données personnelles\" et sélectionnez \"exportation de compte\""; $a->strings["%1\$s is following %2\$s's %3\$s"] = "%1\$s suit les %3\$s de %2\$s"; $a->strings["Friends of %s"] = "Amis de %s"; $a->strings["No friends to display."] = "Pas d'amis à afficher."; @@ -847,8 +847,8 @@ $a->strings["Don't show emoticons"] = "Ne pas afficher les émoticônes (smileys $a->strings["Don't show notices"] = "Ne plus afficher les avis"; $a->strings["Infinite scroll"] = "Défilement infini"; $a->strings["Automatic updates only at the top of the network page"] = ""; -$a->strings["User Types"] = ""; -$a->strings["Community Types"] = ""; +$a->strings["User Types"] = "Types d'utilisateurs"; +$a->strings["Community Types"] = "Genre de communautés"; $a->strings["Normal Account Page"] = "Compte normal"; $a->strings["This account is a normal personal profile"] = "Ce compte correspond à un profil normal, pour une seule personne (physique, généralement)"; $a->strings["Soapbox Page"] = "Compte \"boîte à savon\""; @@ -950,7 +950,7 @@ $a->strings["public profile"] = "profil public"; $a->strings["%1\$s changed %2\$s to “%3\$s”"] = "%1\$s a changé %2\$s en “%3\$s”"; $a->strings[" - Visit %1\$s's %2\$s"] = "Visiter le %2\$s de %1\$s"; $a->strings["%1\$s has an updated %2\$s, changing %3\$s."] = "%1\$s a mis à jour son %2\$s, en modifiant %3\$s."; -$a->strings["Hide contacts and friends:"] = ""; +$a->strings["Hide contacts and friends:"] = "Cacher mes contacts et amis:"; $a->strings["Hide your contact/friend list from viewers of this profile?"] = "Cacher ma liste d'amis/contacts des visiteurs de ce profil?"; $a->strings["Edit Profile Details"] = "Éditer les détails du profil"; $a->strings["Change Profile Photo"] = "Changer la photo du profil"; @@ -958,11 +958,11 @@ $a->strings["View this profile"] = "Voir ce profil"; $a->strings["Create a new profile using these settings"] = "Créer un nouveau profil en utilisant ces réglages"; $a->strings["Clone this profile"] = "Cloner ce profil"; $a->strings["Delete this profile"] = "Supprimer ce profil"; -$a->strings["Basic information"] = ""; -$a->strings["Profile picture"] = ""; -$a->strings["Preferences"] = ""; -$a->strings["Status information"] = ""; -$a->strings["Additional information"] = ""; +$a->strings["Basic information"] = "Information de base"; +$a->strings["Profile picture"] = "Image de profil"; +$a->strings["Preferences"] = "Préférences"; +$a->strings["Status information"] = "Information sur le statut"; +$a->strings["Additional information"] = "Information additionnelle"; $a->strings["Profile Name:"] = "Nom du profil:"; $a->strings["Your Full Name:"] = "Votre nom complet:"; $a->strings["Title/Description:"] = "Titre/Description:"; From 715629405563b28d56a187e2fbb8616f9fa02f7a Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 2 Jan 2015 12:45:09 +0100 Subject: [PATCH 3/4] Items that were stored via "remote-self" hadn't contained a valid avatar picture. --- include/items.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/items.php b/include/items.php index ed91fc7e4e..d6da0ed5a5 100644 --- a/include/items.php +++ b/include/items.php @@ -2668,14 +2668,14 @@ function item_is_remote_self($contact, &$datarray) { $datarray2 = $datarray; logger('remote-self start - Contact '.$contact['url'].' - '.$contact['remote_self'].' Item '.print_r($datarray, true), LOGGER_DEBUG); if ($contact['remote_self'] == 2) { - $r = q("SELECT `id`,`url`,`name`,`photo`,`network` FROM `contact` WHERE `uid` = %d AND `self`", + $r = q("SELECT `id`,`url`,`name`,`thumb` FROM `contact` WHERE `uid` = %d AND `self`", intval($contact['uid'])); if (count($r)) { $datarray['contact-id'] = $r[0]["id"]; $datarray['owner-name'] = $r[0]["name"]; $datarray['owner-link'] = $r[0]["url"]; - $datarray['owner-avatar'] = $r[0]["avatar"]; + $datarray['owner-avatar'] = $r[0]["thumb"]; $datarray['author-name'] = $datarray['owner-name']; $datarray['author-link'] = $datarray['owner-link']; From a86c143e24c9dcf58ad79e455285364a782903c3 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 4 Jan 2015 11:56:41 +0100 Subject: [PATCH 4/4] The "scrape" bugfix lead to partly damaged encodings. This is fixed now. --- boot.php | 2 +- include/dbstructure.php | 1 + include/lock.php | 18 ++++++++++-------- library/HTML5/Parser.php | 7 ++++++- update.php | 2 +- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/boot.php b/boot.php index 34836a97aa..7ba74c4f6f 100644 --- a/boot.php +++ b/boot.php @@ -18,7 +18,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_CODENAME', 'Ginger'); define ( 'FRIENDICA_VERSION', '3.3.2' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1175 ); +define ( 'DB_UPDATE_VERSION', 1176 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/include/dbstructure.php b/include/dbstructure.php index 66e67c0a9a..469ae10030 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -823,6 +823,7 @@ function db_definition() { "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"), "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""), "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), + "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"), ), "indexes" => array( "PRIMARY" => array("id"), diff --git a/include/lock.php b/include/lock.php index caf1f855ab..70cf4b787b 100644 --- a/include/lock.php +++ b/include/lock.php @@ -11,20 +11,22 @@ function lock_function($fn_name, $block = true, $wait_sec = 2, $timeout = 30) { $start = time(); do { - q("LOCK TABLE locks WRITE"); - $r = q("SELECT locked FROM locks WHERE name = '%s' LIMIT 1", + q("LOCK TABLE `locks` WRITE"); + $r = q("SELECT `locked`, `created` FROM `locks` WHERE `name` = '%s' LIMIT 1", dbesc($fn_name) ); - if((count($r)) && (! $r[0]['locked'])) { - q("UPDATE locks SET locked = 1 WHERE name = '%s'", + if((count($r)) AND (!$r[0]['locked'] OR (strtotime($r[0]['created']) < time() - 3600))) { + q("UPDATE `locks` SET `locked` = 1, `created` = '%s' WHERE `name` = '%s'", + dbesc(datetime_convert()), dbesc($fn_name) ); $got_lock = true; } elseif(! $r) { // the Boolean value for count($r) should be equivalent to the Boolean value of $r - q("INSERT INTO locks ( name, locked ) VALUES ( '%s', 1 )", - dbesc($fn_name) + q("INSERT INTO `locks` (`name`, `created`, `locked`) VALUES ('%s', '%s', 1)", + dbesc($fn_name), + dbesc(datetime_convert()) ); $got_lock = true; } @@ -37,7 +39,7 @@ function lock_function($fn_name, $block = true, $wait_sec = 2, $timeout = 30) { } while(($block) && (! $got_lock) && ((time() - $start) < $timeout)); logger('lock_function: function ' . $fn_name . ' with blocking = ' . $block . ' got_lock = ' . $got_lock . ' time = ' . (time() - $start), LOGGER_DEBUG); - + return $got_lock; }} @@ -65,7 +67,7 @@ function block_on_function_lock($fn_name, $wait_sec = 2, $timeout = 30) { if(! function_exists('unlock_function')) { function unlock_function($fn_name) { - $r = q("UPDATE locks SET locked = 0 WHERE name = '%s'", + $r = q("UPDATE `locks` SET `locked` = 0, `created` = '0000-00-00 00:00:00' WHERE `name` = '%s'", dbesc($fn_name) ); diff --git a/library/HTML5/Parser.php b/library/HTML5/Parser.php index c7faf875ad..e101d3e545 100644 --- a/library/HTML5/Parser.php +++ b/library/HTML5/Parser.php @@ -20,7 +20,12 @@ class HTML5_Parser // Cleanup invalid HTML $doc = new DOMDocument(); - @$doc->loadHTML($text); + + if (mb_detect_encoding($text, "UTF-8", true) == "UTF-8") + @$doc->loadHTML(''.$text); + else + @$doc->loadHTML($text); + $text = $doc->saveHTML(); $tokenizer = new HTML5_Tokenizer($text, $builder); diff --git a/update.php b/update.php index 10195c1baa..97b0bd58dc 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@