aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-04-06 19:41:16 -0700
committerFriendika <info@friendika.com>2011-04-06 19:42:35 -0700
commit6728a11ee38e890a0ce9b8b6d96dba98a7238129 (patch)
tree5396ee3aabb61f9d7ca399073606f5f27b599079
parent9c77c57b74312a92eada9b84f68addece7a3a27c (diff)
downloadvolse-hubzilla-6728a11ee38e890a0ce9b8b6d96dba98a7238129.tar.gz
volse-hubzilla-6728a11ee38e890a0ce9b8b6d96dba98a7238129.tar.bz2
volse-hubzilla-6728a11ee38e890a0ce9b8b6d96dba98a7238129.zip
support feed attachments/enclosures, and fix for bug #30
-rw-r--r--boot.php4
-rw-r--r--database.sql1
-rw-r--r--include/items.php47
-rw-r--r--mod/register.php2
-rw-r--r--update.php4
-rw-r--r--util/messages.po2
-rw-r--r--util/strings.php2
-rw-r--r--view/fr/messages.po2
-rw-r--r--view/fr/strings.php2
-rw-r--r--view/it/messages.po2
-rw-r--r--view/it/strings.php2
-rw-r--r--view/sv/strings.php2
12 files changed, 61 insertions, 11 deletions
diff --git a/boot.php b/boot.php
index f8a8c9f93..858eb19a8 100644
--- 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' );
diff --git a/database.sql b/database.sql
index 5e5d3eefa..eb6eebc4a 100644
--- a/database.sql
+++ b/database.sql
@@ -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,
diff --git a/include/items.php b/include/items.php
index b17eadba2..501f2f944 100644
--- a/include/items.php
+++ b/include/items.php
@@ -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) {
diff --git a/mod/register.php b/mod/register.php
index 06ed1e0f1..ec68aaef4 100644
--- a/mod/register.php
+++ b/mod/register.php
@@ -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;
diff --git a/update.php b/update.php
index 62aea86bb..1c243e6ee 100644
--- a/update.php
+++ b/update.php
@@ -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` ");
+}
diff --git a/util/messages.po b/util/messages.po
index 223541ad8..c7e0a240d 100644
--- a/util/messages.po
+++ b/util/messages.po
@@ -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
diff --git a/util/strings.php b/util/strings.php
index ee6ec4b1c..d43d7c262 100644
--- a/util/strings.php
+++ b/util/strings.php
@@ -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.';
diff --git a/view/fr/messages.po b/view/fr/messages.po
index c0cb2789d..573ab32aa 100644
--- a/view/fr/messages.po
+++ b/view/fr/messages.po
@@ -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
diff --git a/view/fr/strings.php b/view/fr/strings.php
index 5a6ae5027..0062a24b5 100644
--- a/view/fr/strings.php
+++ b/view/fr/strings.php
@@ -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.";
diff --git a/view/it/messages.po b/view/it/messages.po
index 97dd746c7..4337e7965 100644
--- a/view/it/messages.po
+++ b/view/it/messages.po
@@ -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
diff --git a/view/it/strings.php b/view/it/strings.php
index 57dad37fe..544c815c1 100644
--- a/view/it/strings.php
+++ b/view/it/strings.php
@@ -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.";
diff --git a/view/sv/strings.php b/view/sv/strings.php
index df1b34465..c20bc3293 100644
--- a/view/sv/strings.php
+++ b/view/sv/strings.php
@@ -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.';