support feed attachments/enclosures, and fix for bug #30
This commit is contained in:
parent
9c77c57b74
commit
6728a11ee3
4
boot.php
4
boot.php
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
define ( 'FRIENDIKA_VERSION', '2.1.940' );
|
define ( 'FRIENDIKA_VERSION', '2.1.941' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.2' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.2' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1046 );
|
define ( 'DB_UPDATE_VERSION', 1047 );
|
||||||
|
|
||||||
define ( 'EOL', "<br />\r\n" );
|
define ( 'EOL', "<br />\r\n" );
|
||||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||||
|
|
|
@ -184,6 +184,7 @@ CREATE TABLE IF NOT EXISTS `item` (
|
||||||
`plink` char(255) NOT NULL,
|
`plink` char(255) NOT NULL,
|
||||||
`resource-id` char(255) NOT NULL,
|
`resource-id` char(255) NOT NULL,
|
||||||
`tag` mediumtext NOT NULL,
|
`tag` mediumtext NOT NULL,
|
||||||
|
`attach` mediumtext NOT NULL,
|
||||||
`inform` mediumtext NOT NULL,
|
`inform` mediumtext NOT NULL,
|
||||||
`location` char(255) NOT NULL,
|
`location` char(255) NOT NULL,
|
||||||
`coord` char(255) NOT NULL,
|
`coord` char(255) NOT NULL,
|
||||||
|
|
|
@ -468,11 +468,34 @@ function get_atom_elements($feed,$item) {
|
||||||
if($scheme && $term && stristr($scheme,'X-DFRN:'))
|
if($scheme && $term && stristr($scheme,'X-DFRN:'))
|
||||||
$tag_arr[] = substr($scheme,7,1) . '[url=' . unxmlify(substr($scheme,9)) . ']' . unxmlify($term) . '[/url]';
|
$tag_arr[] = substr($scheme,7,1) . '[url=' . unxmlify(substr($scheme,9)) . ']' . unxmlify($term) . '[/url]';
|
||||||
elseif($term)
|
elseif($term)
|
||||||
$tag_arr[] = $term;
|
$tag_arr[] = notags(trim($term));
|
||||||
}
|
}
|
||||||
$res['tag'] = implode(',', $tag_arr);
|
$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');
|
$rawobj = $item->get_item_tags(NAMESPACE_ACTIVITY, 'object');
|
||||||
|
|
||||||
if($rawobj) {
|
if($rawobj) {
|
||||||
|
@ -1526,6 +1549,8 @@ function atom_entry($item,$type,$author,$owner,$comment = false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$o .= item_getfeedattach($item);
|
||||||
|
|
||||||
$mentioned = get_mentions($item);
|
$mentioned = get_mentions($item);
|
||||||
if($mentioned)
|
if($mentioned)
|
||||||
$o .= $mentioned;
|
$o .= $mentioned;
|
||||||
|
@ -1558,6 +1583,26 @@ function item_getfeedtags($item) {
|
||||||
return $ret;
|
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) {
|
function item_expire($uid,$days) {
|
||||||
|
|
|
@ -86,7 +86,7 @@ function register_post(&$a) {
|
||||||
|
|
||||||
$loose_reg = get_config('system','no_regfullname');
|
$loose_reg = get_config('system','no_regfullname');
|
||||||
if((! $loose_reg) && (! strpos($username,' ')))
|
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))
|
if(! allowed_email($email))
|
||||||
$err .= t('Your email domain is not among those allowed on this site.') . EOL;
|
$err .= t('Your email domain is not among those allowed on this site.') . EOL;
|
||||||
|
|
|
@ -419,3 +419,7 @@ function update_1044() {
|
||||||
function update_1045() {
|
function update_1045() {
|
||||||
q("ALTER TABLE `user` ADD `language` CHAR( 16 ) NOT NULL DEFAULT 'en' AFTER `timezone` ");
|
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` ");
|
||||||
|
}
|
||||||
|
|
|
@ -1180,7 +1180,7 @@ msgid "Name too short."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../../mod/register.php:89
|
#: ../../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 ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../../mod/register.php:92
|
#: ../../mod/register.php:92
|
||||||
|
|
|
@ -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 enter the required information.'] = 'Please enter the required information.';
|
||||||
$a->strings['Please use a shorter name.'] = 'Please use a shorter name.';
|
$a->strings['Please use a shorter name.'] = 'Please use a shorter name.';
|
||||||
$a->strings['Name too short.'] = 'Name too short.';
|
$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['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['Not a valid email address.'] = 'Not a valid email address.';
|
||||||
$a->strings['Cannot use that email.'] = 'Cannot use that email.';
|
$a->strings['Cannot use that email.'] = 'Cannot use that email.';
|
||||||
|
|
|
@ -940,7 +940,7 @@ msgstr "Nom trop court."
|
||||||
|
|
||||||
#: ../../mod/register.php:89
|
#: ../../mod/register.php:89
|
||||||
#, fuzzy
|
#, 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)."
|
msgstr "Ceci ne semble pas être votre nom complet (Prénom Nom)."
|
||||||
|
|
||||||
#: ../../mod/register.php:92
|
#: ../../mod/register.php:92
|
||||||
|
|
|
@ -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 enter the required information."] = "Entrez les informations requises.";
|
||||||
$a->strings["Please use a shorter name."] = "Utilisez un nom plus court.";
|
$a->strings["Please use a shorter name."] = "Utilisez un nom plus court.";
|
||||||
$a->strings["Name too short."] = "Nom trop 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["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["Not a valid email address."] = "Ceci n'est pas une adresse courriel valide.";
|
||||||
$a->strings["Cannot use that email."] = "Impossible d'utiliser ce courriel.";
|
$a->strings["Cannot use that email."] = "Impossible d'utiliser ce courriel.";
|
||||||
|
|
|
@ -1107,7 +1107,7 @@ msgid "Name too short."
|
||||||
msgstr "Il Nome è troppo corto."
|
msgstr "Il Nome è troppo corto."
|
||||||
|
|
||||||
#: ../../mod/register.php:89
|
#: ../../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)."
|
msgstr "Questo non sembra essere il tuo nome completo (Nome Cognome)."
|
||||||
|
|
||||||
#: ../../mod/register.php:92
|
#: ../../mod/register.php:92
|
||||||
|
|
|
@ -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 enter the required information."] = "Inserisci le informazioni richieste.";
|
||||||
$a->strings["Please use a shorter name."] = "Usa un nome più corto.";
|
$a->strings["Please use a shorter name."] = "Usa un nome più corto.";
|
||||||
$a->strings["Name too short."] = "Il Nome è troppo 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["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["Not a valid email address."] = "Indirizzo email invaildo.";
|
||||||
$a->strings["Cannot use that email."] = "Questa email non si puo' usare.";
|
$a->strings["Cannot use that email."] = "Questa email non si puo' usare.";
|
||||||
|
|
|
@ -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 enter the required information.'] = 'Fyll i alla obligatoriska fält.';
|
||||||
$a->strings['Please use a shorter name.'] = 'Välj ett kortare namn.';
|
$a->strings['Please use a shorter name.'] = 'Välj ett kortare namn.';
|
||||||
$a->strings['Name too short.'] = 'Namnet är för kort.';
|
$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['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['Not a valid email address.'] = 'Ogiltig e-postadress.';
|
||||||
$a->strings['Cannot use that email.'] = 'Otillåten e-postadress.';
|
$a->strings['Cannot use that email.'] = 'Otillåten e-postadress.';
|
||||||
|
|
Loading…
Reference in a new issue