]> git.mxchange.org Git - friendica.git/commitdiff
support feed attachments/enclosures, and fix for bug #30
authorFriendika <info@friendika.com>
Thu, 7 Apr 2011 02:41:16 +0000 (19:41 -0700)
committerFriendika <info@friendika.com>
Thu, 7 Apr 2011 02:42:35 +0000 (19:42 -0700)
12 files changed:
boot.php
database.sql
include/items.php
mod/register.php
update.php
util/messages.po
util/strings.php
view/fr/messages.po
view/fr/strings.php
view/it/messages.po
view/it/strings.php
view/sv/strings.php

index f8a8c9f939694f9105ff540b395dbdde5a1e8b20..858eb19a8362e511fd79113b62ed51e8101bf56d 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -2,9 +2,9 @@
 
 set_time_limit(0);
 
-define ( 'FRIENDIKA_VERSION',      '2.1.940' );
+define ( 'FRIENDIKA_VERSION',      '2.1.941' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.2'  );
-define ( 'DB_UPDATE_VERSION',      1046   );
+define ( 'DB_UPDATE_VERSION',      1047   );
 
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
index 5e5d3eefaccbcd6ae40503422b596368b2e973e2..eb6eebc4a77f9c5aee316155a8a6846961775506 100644 (file)
@@ -184,6 +184,7 @@ CREATE TABLE IF NOT EXISTS `item` (
   `plink` char(255) NOT NULL, 
   `resource-id` char(255) NOT NULL,
   `tag` mediumtext NOT NULL,
+  `attach` mediumtext NOT NULL,
   `inform` mediumtext NOT NULL,
   `location` char(255) NOT NULL,
   `coord` char(255) NOT NULL,
index b17eadba283fb8f3ccb941aaf0f29e95fbffc8c2..501f2f94478717ecdd92d19aae01de43d06b0cac 100644 (file)
@@ -468,11 +468,34 @@ function get_atom_elements($feed,$item) {
                        if($scheme && $term && stristr($scheme,'X-DFRN:'))
                                $tag_arr[] = substr($scheme,7,1) . '[url=' . unxmlify(substr($scheme,9)) . ']' . unxmlify($term) . '[/url]';
                        elseif($term)
-                               $tag_arr[] = $term;
+                               $tag_arr[] = notags(trim($term));
                }
                $res['tag'] =  implode(',', $tag_arr);
        }
 
+       $attach = $item->get_enclosures();
+       if($attach) {
+               $att_arr = array();
+               foreach($attach as $att) {
+                       $len = intval($att->get_length());
+                       $link = str_replace(',','%2D', notags(trim($att->get_link())));
+                       $title = str_replace(',','%2D',notags(trim($att->get_title())));
+                       $type = notags(trim($att->get_type()));
+                       if((! $link) || (strpos($link,'http') !== 0))
+                               continue;
+
+                       if(! $title)
+                               $title = ' ';
+                       if(! $type)
+                               $type = 'application/octet-stream';
+
+                       // this isn't legal html - there is no size in an 'a' tag, remember to strip it before display
+
+                       $att_arr[] = '<a href="' . $link . '" size="' . $len . '" type="' . $type . '">' . $title . '</a>'; 
+               }
+               $res['attach'] = implode(',', $att_arr);
+       }
+
        $rawobj = $item->get_item_tags(NAMESPACE_ACTIVITY, 'object');
 
        if($rawobj) {
@@ -1526,6 +1549,8 @@ function atom_entry($item,$type,$author,$owner,$comment = false) {
                }
        }
 
+       $o .= item_getfeedattach($item);
+
        $mentioned = get_mentions($item);
        if($mentioned)
                $o .= $mentioned;
@@ -1558,6 +1583,26 @@ function item_getfeedtags($item) {
        return $ret;
 }
 
+function item_getfeedattach($item) {
+       $ret = array();
+       $arr = explode(',',$item['attach']);
+       if(count($arr)) {
+               foreach($arr as $r) {
+                       $matches = false;
+                       $cnt = preg_match('|\<a href=\"(.+?)\" size=\"(.+?)\" type=\"(.+?)\" >(.+?)</a>|',$item['attach'],$matches);
+                       if($cnt) {
+                               $ret .= '<link href="' . $matches[1] . '" type="' . $matches[3] . '" ';
+                               if(intval($matches[2]))
+                                       $ret .= 'size="' . intval($matches[2]) . '" ';
+                               if($matches[4] !== ' ')
+                                       $ret .= 'title="' . $matches[4] . '" ';
+                               $ret .= ' />' . "\r\n";
+                       }
+               }
+       }
+       return $ret;
+}
+
 
        
 function item_expire($uid,$days) {
index 06ed1e0f18fb4bb936bd3fd627f8d9077e97e7eb..ec68aaef4c86f49f1f0f3125df5cad3df87415d0 100644 (file)
@@ -86,7 +86,7 @@ function register_post(&$a) {
        
        $loose_reg = get_config('system','no_regfullname');
        if((! $loose_reg) && (! strpos($username,' ')))
-               $err .= t("That doesn\'t appear to be your full \x28First Last\x29 name.") . EOL;
+               $err .= t("That doesn't appear to be your full \x28First Last\x29 name.") . EOL;
 
        if(! allowed_email($email))
                        $err .= t('Your email domain is not among those allowed on this site.') . EOL;
index 62aea86bbb42fd13b2de40f3a73800affd73ec17..1c243e6ee685f5252fe5be4f5ede4fafe49d5875 100644 (file)
@@ -419,3 +419,7 @@ function update_1044() {
 function update_1045() {
        q("ALTER TABLE `user` ADD `language` CHAR( 16 ) NOT NULL DEFAULT 'en' AFTER `timezone` ");
 }
+
+function update_1046() {
+       q("ALTER TABLE `item` ADD `attach` MEDIUMTEXT NOT NULL AFTER `tag` ");
+}
index 223541ad8364993a2d01994f77dc198daf3429cf..c7e0a240d6dc6429531cc9f32d444be095dd4d73 100644 (file)
@@ -1180,7 +1180,7 @@ msgid "Name too short."
 msgstr ""
 
 #: ../../mod/register.php:89
-msgid "That doesn\\'t appear to be your full (First Last) name."
+msgid "That doesn't appear to be your full (First Last) name."
 msgstr ""
 
 #: ../../mod/register.php:92
index ee6ec4b1c66dcc39f012b2fef6ec333a2be2a304..d43d7c2623ceb4b60da9478f960254645c4f3717 100644 (file)
@@ -393,7 +393,7 @@ $a->strings['Invalid OpenID url'] = 'Invalid OpenID url';
 $a->strings['Please enter the required information.'] = 'Please enter the required information.';
 $a->strings['Please use a shorter name.'] = 'Please use a shorter name.';
 $a->strings['Name too short.'] = 'Name too short.';
-$a->strings["That doesn\'t appear to be your full \x28First Last\x29 name."] = "That doesn\'t appear to be your full \x28First Last\x29 name.";
+$a->strings["That doesn't appear to be your full \x28First Last\x29 name."] = "That doesn't appear to be your full \x28First Last\x29 name.";
 $a->strings['Your email domain is not among those allowed on this site.'] = 'Your email domain is not among those allowed on this site.';
 $a->strings['Not a valid email address.'] = 'Not a valid email address.';
 $a->strings['Cannot use that email.'] = 'Cannot use that email.';
index c0cb2789d0e5a810604d19bdbdbfc1b87ecd003d..573ab32aaff5a047f3472536e463fdc9e39f0353 100644 (file)
@@ -940,7 +940,7 @@ msgstr "Nom trop court."
 
 #: ../../mod/register.php:89
 #, fuzzy
-msgid "That doesn\\'t appear to be your full (First Last) name."
+msgid "That doesn't appear to be your full (First Last) name."
 msgstr "Ceci ne semble pas être votre nom complet (Prénom Nom)."
 
 #: ../../mod/register.php:92
index 5a6ae50274ea7d644fe629186f2c52e42f9e19c8..0062a24b59c05d1288b8ed79368650563fdf9c6a 100644 (file)
@@ -192,7 +192,7 @@ $a->strings["Invalid OpenID url"] = "Adresse OpenID invalide";
 $a->strings["Please enter the required information."] = "Entrez les informations requises.";
 $a->strings["Please use a shorter name."] = "Utilisez un nom plus court.";
 $a->strings["Name too short."] = "Nom trop court.";
-$a->strings["That doesn\\'t appear to be your full (First Last) name."] = "Ceci ne semble pas être votre nom complet (Prénom Nom).";
+$a->strings["That doesn't appear to be your full (First Last) name."] = "Ceci ne semble pas être votre nom complet (Prénom Nom).";
 $a->strings["Your email domain is not among those allowed on this site."] = "Votre domaine de courriel n'est pas autorisé sur ce site.";
 $a->strings["Not a valid email address."] = "Ceci n'est pas une adresse courriel valide.";
 $a->strings["Cannot use that email."] = "Impossible d'utiliser ce courriel.";
index 97dd746c7cbc3e525589b082e63ccbcd691d3a4f..4337e7965f48b61c45b8d4f6d6394d29bb67602b 100644 (file)
@@ -1107,7 +1107,7 @@ msgid "Name too short."
 msgstr "Il Nome è troppo corto."
 
 #: ../../mod/register.php:89
-msgid "That doesn\\'t appear to be your full (First Last) name."
+msgid "That doesn't appear to be your full (First Last) name."
 msgstr "Questo non sembra essere il tuo nome completo (Nome Cognome)."
 
 #: ../../mod/register.php:92
index 57dad37fe8d2c17ad6d0476a29eb55ab1c3d32df..544c815c1224b7d34cdec53d5ec8ef799b08cf73 100644 (file)
@@ -231,7 +231,7 @@ $a->strings["Invalid OpenID url"] = "Url OpenID non valido";
 $a->strings["Please enter the required information."] = "Inserisci le informazioni richieste.";
 $a->strings["Please use a shorter name."] = "Usa un nome più corto.";
 $a->strings["Name too short."] = "Il Nome è troppo corto.";
-$a->strings["That doesn\\'t appear to be your full (First Last) name."] = "Questo non sembra essere il tuo nome completo (Nome Cognome).";
+$a->strings["That doesn't appear to be your full (First Last) name."] = "Questo non sembra essere il tuo nome completo (Nome Cognome).";
 $a->strings["Your email domain is not among those allowed on this site."] = "Il dominio della tua email non è tra quelli autorizzati su questo sito.";
 $a->strings["Not a valid email address."] = "Indirizzo email invaildo.";
 $a->strings["Cannot use that email."] = "Questa email non si puo' usare.";
index df1b34465beb708ea7df7045207ee5e338e97996..c20bc3293d8642a11f84a7910bf808c482b0b0de 100644 (file)
@@ -393,7 +393,7 @@ $a->strings['Invalid OpenID url'] = 'Ogiltig OpenID-URL';
 $a->strings['Please enter the required information.'] = 'Fyll i alla obligatoriska fält.';
 $a->strings['Please use a shorter name.'] = 'Välj ett kortare namn.';
 $a->strings['Name too short.'] = 'Namnet är för kort.';
-$a->strings["That doesn\'t appear to be your full \x28First Last\x29 name."] = "Du verkar inte ha angett ditt fullständiga namn.";
+$a->strings["That doesn't appear to be your full \x28First Last\x29 name."] = "Du verkar inte ha angett ditt fullständiga namn.";
 $a->strings['Your email domain is not among those allowed on this site.'] = 'Din e-postdomän är inte tillåten på den här webbplatsen.';
 $a->strings['Not a valid email address.'] = 'Ogiltig e-postadress.';
 $a->strings['Cannot use that email.'] = 'Otillåten e-postadress.';