From 9f020573748af28cc09cbde18e96cfc68641ce7b Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 16 Feb 2011 02:07:11 -0800 Subject: [PATCH 1/9] provide permalink for posts, include permalinks in feeds and imported from feeds --- boot.php | 8 ++++++++ include/items.php | 5 +++-- mod/display.php | 1 + mod/item.php | 3 ++- mod/network.php | 1 + mod/profile.php | 1 + view/de/wallwall_item.tpl | 1 + view/en/wallwall_item.tpl | 1 + view/fr/wallwall_item.tpl | 1 + view/it/wallwall_item.tpl | 1 + view/theme/duepuntozero/style.css | 7 +++++++ view/theme/loozah/style.css | 7 +++++++ view/wall_item.tpl | 1 + 13 files changed, 35 insertions(+), 3 deletions(-) diff --git a/boot.php b/boot.php index 3dff39a33..dcf5b1c1a 100644 --- a/boot.php +++ b/boot.php @@ -2449,3 +2449,11 @@ function feed_salmonlinks($nick) { return $salmon; }} +if(! function_exists('get_plink')) { +function get_plink($item) { + $a = get_app(); + $plink = (((x($item,'plink')) && (! $item['private'])) ? '' : ''); + return $plink; +}} + diff --git a/include/items.php b/include/items.php index b5bdd7833..153debd7d 100644 --- a/include/items.php +++ b/include/items.php @@ -246,7 +246,7 @@ function get_atom_elements($feed,$item) { $res['uri'] = unxmlify($item->get_id()); $res['title'] = unxmlify($item->get_title()); $res['body'] = unxmlify($item->get_content()); - + $res['plink'] = unxmlify($item->get_link(0)); // look for a photo. We should check media size and find the best one, // but for now let's just find any author photo @@ -591,6 +591,7 @@ function item_store($arr,$force_parent = false) { $arr['object'] = ((x($arr,'object')) ? trim($arr['object']) : ''); $arr['target-type'] = ((x($arr,'target-type')) ? notags(trim($arr['target-type'])) : ''); $arr['target'] = ((x($arr,'target')) ? trim($arr['target']) : ''); + $arr['plink'] = ((x($arr,'plink')) ? notags(trim($arr['plink'])) : ''); $arr['allow_cid'] = ((x($arr,'allow_cid')) ? trim($arr['allow_cid']) : ''); $arr['allow_gid'] = ((x($arr,'allow_gid')) ? trim($arr['allow_gid']) : ''); $arr['deny_cid'] = ((x($arr,'deny_cid')) ? trim($arr['deny_cid']) : ''); @@ -1418,7 +1419,7 @@ function atom_entry($item,$type,$author,$owner,$comment = false) { $o .= '' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '' . "\r\n"; $o .= '' . base64url_encode($item['body'], true) . '' . "\r\n"; $o .= '' . xmlify(($type === 'html') ? bbcode($item['body']) : $item['body']) . '' . "\r\n"; - $o .= '' . "\r\n"; + $o .= '' . "\r\n"; if($comment) $o .= '' . intval($item['last-child']) . '' . "\r\n"; diff --git a/mod/display.php b/mod/display.php index b07e1aee5..03003f3c0 100644 --- a/mod/display.php +++ b/mod/display.php @@ -272,6 +272,7 @@ function display_content(&$a) { '$owner_url' => $owner_url, '$owner_photo' => $owner_photo, '$owner_name' => $owner_name, + '$plink' => get_plink($item), '$drop' => $drop, '$vote' => $likebuttons, '$like' => $like, diff --git a/mod/item.php b/mod/item.php index 2cc2b9eb2..5bb4b1b73 100644 --- a/mod/item.php +++ b/mod/item.php @@ -429,10 +429,11 @@ function item_post(&$a) { } } - $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `changed` = '%s', `last-child` = 1, `visible` = 1 + $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `plink` = '%s', `changed` = '%s', `last-child` = 1, `visible` = 1 WHERE `id` = %d LIMIT 1", intval($parent), dbesc(($parent == $post_id) ? $uri : $parent_item['uri']), + dbesc($a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id), dbesc(datetime_convert()), intval($post_id) ); diff --git a/mod/network.php b/mod/network.php index f09b302e9..3658c601e 100644 --- a/mod/network.php +++ b/mod/network.php @@ -425,6 +425,7 @@ function network_content(&$a, $update = 0) { '$owner_url' => $owner_url, '$owner_photo' => $owner_photo, '$owner_name' => $owner_name, + '$plink' => get_plink($item), '$drop' => $drop, '$vote' => $likebuttons, '$like' => $like, diff --git a/mod/profile.php b/mod/profile.php index 57abc479d..0723d64fb 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -371,6 +371,7 @@ function profile_content(&$a, $update = 0) { '$lock' => $lock, '$location' => $location, '$indent' => $indent, + '$plink' => get_plink($item), '$drop' => $drop, '$like' => $like, '$vote' => $likebuttons, diff --git a/view/de/wallwall_item.tpl b/view/de/wallwall_item.tpl index fd05a74ac..67b6006cf 100644 --- a/view/de/wallwall_item.tpl +++ b/view/de/wallwall_item.tpl @@ -21,6 +21,7 @@
$title
$body
+ $plink $drop
diff --git a/view/en/wallwall_item.tpl b/view/en/wallwall_item.tpl index f8affd1c5..9c6ad6070 100644 --- a/view/en/wallwall_item.tpl +++ b/view/en/wallwall_item.tpl @@ -21,6 +21,7 @@
$title
$body
+ $plink $drop
diff --git a/view/fr/wallwall_item.tpl b/view/fr/wallwall_item.tpl index f8affd1c5..9c6ad6070 100644 --- a/view/fr/wallwall_item.tpl +++ b/view/fr/wallwall_item.tpl @@ -21,6 +21,7 @@
$title
$body
+ $plink $drop
diff --git a/view/it/wallwall_item.tpl b/view/it/wallwall_item.tpl index bc2d3f2ec..3c7883fc8 100644 --- a/view/it/wallwall_item.tpl +++ b/view/it/wallwall_item.tpl @@ -21,6 +21,7 @@
$title
$body
+ $plink $drop
diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index ac3562d1c..e3a5fd3e7 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -833,6 +833,13 @@ input#dfrn-url { .wall-item-like-buttons img { cursor: pointer; } + +.wall-item-links-wrapper { + float: left; + margin-bottom: 5px; + margin-left: 5px; +} + .wall-item-delete-wrapper { float: right; margin-top: 5px; diff --git a/view/theme/loozah/style.css b/view/theme/loozah/style.css index a87252016..d34c81a45 100644 --- a/view/theme/loozah/style.css +++ b/view/theme/loozah/style.css @@ -962,6 +962,13 @@ input#dfrn-url { .wall-item-like-buttons img { cursor: pointer; } + +.wall-item-links-wrapper { + float: left; + margin-top: 100px; + margin-left: 10px; +} + .wall-item-delete-wrapper { float: right; margin-top: 20px; diff --git a/view/wall_item.tpl b/view/wall_item.tpl index 67fce4152..b9f27ed4a 100644 --- a/view/wall_item.tpl +++ b/view/wall_item.tpl @@ -16,6 +16,7 @@
$title
$body
+ $plink $drop
From acce5c95a373c68ac8a834396e822f6b177352ca Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 16 Feb 2011 03:14:45 -0800 Subject: [PATCH 2/9] set contact permissions on photos uploaded to private messages --- mod/message.php | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/mod/message.php b/mod/message.php index 7615f22be..c004b3d63 100644 --- a/mod/message.php +++ b/mod/message.php @@ -2,11 +2,6 @@ require_once('include/acl_selectors.php'); -function message_init(&$a) { - - -} - function message_post(&$a) { if(! local_user()) { @@ -69,6 +64,42 @@ function message_post(&$a) { if(count($r)) $post_id = $r[0]['id']; + /** + * + * When a photo was uploaded into the message using the (profile wall) ajax + * uploader, The permissions are initially set to disallow anybody but the + * owner from seeing it. This is because the permissions may not yet have been + * set for the post. If it's private, the photo permissions should be set + * appropriately. But we didn't know the final permissions on the post until + * now. So now we'll look for links of uploaded messages that are in the + * post and set them to the same permissions as the post itself. + * + */ + + $match = null; + + if(preg_match_all("/\[img\](.+?)\[\/img\]/",$body,$match)) { + $images = $match[1]; + if(count($images)) { + foreach($images as $image) { + if(! stristr($image,$a->get_baseurl() . '/photo/')) + continue; + $image_uri = substr($image,strrpos($image,'/') + 1); + $image_uri = substr($image_uri,0, strpos($image_uri,'-')); + $r = q("UPDATE `photo` SET `allow_cid` = '%s' + WHERE `resource-id` = '%s' AND `album` = '%s' ", + dbesc('<' . $recipient . '>'), + dbesc($image_uri), + dbesc( t('Wall Photos')) + ); + } + } + } + + + + + $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); if($post_id) { @@ -80,7 +111,6 @@ function message_post(&$a) { notice( t('Message could not be sent.') . EOL ); } return; - } function message_content(&$a) { From e56895123aea566cd7a3fbe3acf522bcb34bc0b2 Mon Sep 17 00:00:00 2001 From: Chris Case Date: Wed, 16 Feb 2011 05:17:40 -0800 Subject: [PATCH 3/9] changed message sending to use base64 encoding --- view/de/mail_received_eml.tpl | 48 ++++-------------------- view/de/mail_received_html_body_eml.tpl | 25 +++++++++++++ view/de/mail_received_text_body_eml.tpl | 11 ++++++ view/en/mail_received_eml.tpl | 47 ++++-------------------- view/en/mail_received_html_body_eml.tpl | 25 +++++++++++++ view/en/mail_received_text_body_eml.tpl | 10 +++++ view/fr/mail_received_eml.tpl | 47 ++++-------------------- view/fr/mail_received_html_body_eml.tpl | 25 +++++++++++++ view/fr/mail_received_text_body_eml.tpl | 10 +++++ view/it/mail_received_eml.tpl | 49 ++++--------------------- view/it/mail_received_html_body_eml.tpl | 25 +++++++++++++ view/it/mail_received_text_body_eml.tpl | 10 +++++ 12 files changed, 170 insertions(+), 162 deletions(-) create mode 100644 view/de/mail_received_html_body_eml.tpl create mode 100644 view/de/mail_received_text_body_eml.tpl create mode 100644 view/en/mail_received_html_body_eml.tpl create mode 100644 view/en/mail_received_text_body_eml.tpl create mode 100644 view/fr/mail_received_html_body_eml.tpl create mode 100644 view/fr/mail_received_text_body_eml.tpl create mode 100644 view/it/mail_received_html_body_eml.tpl create mode 100644 view/it/mail_received_text_body_eml.tpl diff --git a/view/de/mail_received_eml.tpl b/view/de/mail_received_eml.tpl index bf9bb9ca9..890b71488 100644 --- a/view/de/mail_received_eml.tpl +++ b/view/de/mail_received_eml.tpl @@ -1,47 +1,13 @@ --$mimeboundary -Content-Type: text/plain; charset=utf-8 -Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: base64 -Du hast eine neue private Nachricht von '$from' auf '$siteName' erhhalten. - -$title - -$textversion - -Bitte melde dich unter $siteurl an um deine privaten Nachrichte zu lesen und zu -beantworten. - -Viele Grüße, -$siteName Administrator +$textbody --$mimeboundary -Content-Type: text/html; charset=utf-8 -Content-Transfer-Encoding: 8bit +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: base64 + +$htmlbody - - - - Friendika Nachricht - - - - - - - - - - - - - - - - - - -
Friendika
Du hast eine neue private Nachricht von '$from' auf '$siteName' erhhalten.
$from
$title
$htmlversion
Bitte melde dich unter $siteurl an um deine privaten Nachrichte zu lesen und zu beantworten.
Viele Grüße,
$siteName Administrator
- - - --$mimeboundary-- \ No newline at end of file diff --git a/view/de/mail_received_html_body_eml.tpl b/view/de/mail_received_html_body_eml.tpl new file mode 100644 index 000000000..b2d914f24 --- /dev/null +++ b/view/de/mail_received_html_body_eml.tpl @@ -0,0 +1,25 @@ + + + + Friendika Nachricht + + + + + + + + + + + + + + + + + + +
Friendika
Du hast eine neue private Nachricht von '$from' auf '$siteName' erhhalten.
$from
$title
$htmlversion
Bitte melde dich unter $siteurl an um deine privaten Nachrichte zu lesen und zu beantworten.
Viele Grüße,
$siteName Administrator
+ + diff --git a/view/de/mail_received_text_body_eml.tpl b/view/de/mail_received_text_body_eml.tpl new file mode 100644 index 000000000..f5c90cfed --- /dev/null +++ b/view/de/mail_received_text_body_eml.tpl @@ -0,0 +1,11 @@ +Du hast eine neue private Nachricht von '$from' auf '$siteName' erhhalten. + +$title + +$textversion + +Bitte melde dich unter $siteurl an um deine privaten Nachrichte zu lesen und zu +beantworten. + +Viele Gr٤e, +$siteName Administrator diff --git a/view/en/mail_received_eml.tpl b/view/en/mail_received_eml.tpl index 802280052..4ba0757cb 100644 --- a/view/en/mail_received_eml.tpl +++ b/view/en/mail_received_eml.tpl @@ -1,47 +1,14 @@ --$mimeboundary -Content-Type: text/plain; charset=utf-8 -Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: base64 -$from sent you a new private message at $siteName. - -$title - -$textversion - -Please login at $siteurl to read and reply to your private messages. - -Thank you, -$siteName administrator +$textbody --$mimeboundary -Content-Type: text/html; charset=utf-8 -Content-Transfer-Encoding: 8bit +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: base64 + +$htmlbody - - - - Friendika Message - - - - - - - - - - - - - - - - - - -
Friendika
$from sent you a new private message at $siteName.
$from
$title
$htmlversion
Please login at $siteurl to read and reply to your private messages.
Thank You,
$siteName Administrator
- - - --$mimeboundary-- diff --git a/view/en/mail_received_html_body_eml.tpl b/view/en/mail_received_html_body_eml.tpl new file mode 100644 index 000000000..981aa46e7 --- /dev/null +++ b/view/en/mail_received_html_body_eml.tpl @@ -0,0 +1,25 @@ + + + + Friendika Message + + + + + + + + + + + + + + + + + + +
Friendika
$from sent you a new private message at $siteName.
$from
$title
$htmlversion
Please login at $siteurl to read and reply to your private messages.
Thank You,
$siteName Administrator
+ + \ No newline at end of file diff --git a/view/en/mail_received_text_body_eml.tpl b/view/en/mail_received_text_body_eml.tpl new file mode 100644 index 000000000..023867304 --- /dev/null +++ b/view/en/mail_received_text_body_eml.tpl @@ -0,0 +1,10 @@ +$from sent you a new private message at $siteName. + +$title + +$textversion + +Please login at $siteurl to read and reply to your private messages. + +Thank you, +$siteName administrator diff --git a/view/fr/mail_received_eml.tpl b/view/fr/mail_received_eml.tpl index f872a6713..890b71488 100644 --- a/view/fr/mail_received_eml.tpl +++ b/view/fr/mail_received_eml.tpl @@ -1,46 +1,13 @@ --$mimeboundary -Content-Type: text/plain; charset=utf-8 -Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: base64 -$from t'a envoyŽ un message ˆ $siteName. - -$title - -$textversion - -Ouvrez une session svp ˆ $siteurl pour lire et rŽpondre ˆ vos messages privŽs. - -Merci, -$siteName Administrateur +$textbody --$mimeboundary -Content-Type: text/html; charset=utf-8 -Content-Transfer-Encoding: 8bit +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: base64 + +$htmlbody - - - - Friendika Message - - - - - - - - - - - - - - - - - - -
Friendika
$from t'a envoyŽ un message ˆ $siteName.
$from
$title
$htmlversion
Ouvrez une session svp ˆ $siteurl pour lire et rŽpondre ˆ vos messages privŽs.
Merci,
$siteName Administrateur
- - - --$mimeboundary-- \ No newline at end of file diff --git a/view/fr/mail_received_html_body_eml.tpl b/view/fr/mail_received_html_body_eml.tpl new file mode 100644 index 000000000..43584a4c4 --- /dev/null +++ b/view/fr/mail_received_html_body_eml.tpl @@ -0,0 +1,25 @@ + + + + Friendika Message + + + + + + + + + + + + + + + + + + +
Friendika
$from t'a envoyŽ un message ˆ $siteName.
$from
$title
$htmlversion
Ouvrez une session svp ˆ $siteurl pour lire et rŽpondre ˆ vos messages privŽs.
Merci,
$siteName Administrateur
+ + diff --git a/view/fr/mail_received_text_body_eml.tpl b/view/fr/mail_received_text_body_eml.tpl new file mode 100644 index 000000000..c877344e0 --- /dev/null +++ b/view/fr/mail_received_text_body_eml.tpl @@ -0,0 +1,10 @@ +$from t'a envoyŽ un message ˆ $siteName. + +$title + +$textversion + +Ouvrez une session svp ˆ $siteurl pour lire et rŽpondre ˆ vos messages privŽs. + +Merci, +$siteName Administrateur diff --git a/view/it/mail_received_eml.tpl b/view/it/mail_received_eml.tpl index 829c0fee5..14b983cfe 100644 --- a/view/it/mail_received_eml.tpl +++ b/view/it/mail_received_eml.tpl @@ -1,46 +1,13 @@ --$mimeboundary -Content-Type: text/plain; charset=utf-8 -Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: base64 -Hai ricevuto un nuovo messsaggio privato su $siteName da '$from'. - -$title - -$textversion - -Accedi a $siteurl per leggere e rispondere ai tuoi messaggi privati. - -Grazie, -L'amministratore di $siteName +$textbody --$mimeboundary -Content-Type: text/html; charset=utf-8 -Content-Transfer-Encoding: 8bit +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: base64 + +$htmlbody - - - - Friendika Messsaggio - - - - - - - - - - - - - - - - - - -
Friendika
Hai ricevuto un nuovo messsaggio privato su $siteName da '$from'.
$from
$title
$htmlversion
Accedi a $siteurl per leggere e rispondere ai tuoi messaggi privati.
Grazie,
L'amministratore di $siteName
- - - ---$mimeboundary-- \ No newline at end of file +--$mimeboundary-- diff --git a/view/it/mail_received_html_body_eml.tpl b/view/it/mail_received_html_body_eml.tpl new file mode 100644 index 000000000..a3c71cef9 --- /dev/null +++ b/view/it/mail_received_html_body_eml.tpl @@ -0,0 +1,25 @@ + + + + Friendika Messsaggio + + + + + + + + + + + + + + + + + + +
Friendika
Hai ricevuto un nuovo messsaggio privato su $siteName da '$from'.
$from
$title
$htmlversion
Accedi a $siteurl per leggere e rispondere ai tuoi messaggi privati.
Grazie,
L'amministratore di $siteName
+ + diff --git a/view/it/mail_received_text_body_eml.tpl b/view/it/mail_received_text_body_eml.tpl new file mode 100644 index 000000000..c7da9533f --- /dev/null +++ b/view/it/mail_received_text_body_eml.tpl @@ -0,0 +1,10 @@ +Hai ricevuto un nuovo messsaggio privato su $siteName da '$from'. + +$title + +$textversion + +Accedi a $siteurl per leggere e rispondere ai tuoi messaggi privati. + +Grazie, +L'amministratore di $siteName From 21693295474f5acaa21526ae05fa80a731eb1a6a Mon Sep 17 00:00:00 2001 From: Chris Case Date: Wed, 16 Feb 2011 08:05:10 -0800 Subject: [PATCH 4/9] forgot to check this in earlier... splits up text and html into two different templates and base64 encodes them --- mod/dfrn_notify.php | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 5f91f1b1b..040263b0c 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -210,10 +210,23 @@ function dfrn_notify_post(&$a) { = html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r","\\n\\n" ,"\\n"), "
\n",$msg['body'])))); // load the template for private message notifications - $tpl = load_view_file('view/mail_received_eml.tpl'); + $tpl = load_view_file('view/mail_received_html_body_eml.tpl'); + $email_html_body_tpl = replace_macros($tpl,array( + '$siteName' => $a->config['sitename'], // name of this site + '$siteurl' => $a->get_baseurl(), // descriptive url of this site + '$thumb' => $importer['thumb'], // thumbnail url for sender icon + '$email' => $importer['email'], // email address to send to + '$url' => $importer['url'], // full url for the site + '$from' => $msg['from-name'], // name of the person sending the message + '$title' => stripslashes($msg['title']), // subject of the message + '$htmlversion' => $msg['htmlversion'], // html version of the message + '$mimeboundary' => $msg['mimeboundary'], // mime message divider + '$hostname' => $a->get_hostname() // name of this host + )); - // import the data into the template - $email_tpl = replace_macros($tpl, array( + // load the template for private message notifications + $tpl = load_view_file('view/mail_received_text_body_eml.tpl'); + $email_text_body_tpl = replace_macros($tpl,array( '$siteName' => $a->config['sitename'], // name of this site '$siteurl' => $a->get_baseurl(), // descriptive url of this site '$thumb' => $importer['thumb'], // thumbnail url for sender icon @@ -222,11 +235,24 @@ function dfrn_notify_post(&$a) { '$from' => $msg['from-name'], // name of the person sending the message '$title' => stripslashes($msg['title']), // subject of the message '$textversion' => $msg['textversion'], // text version of the message - '$htmlversion' => $msg['htmlversion'], // html version of the message '$mimeboundary' => $msg['mimeboundary'], // mime message divider '$hostname' => $a->get_hostname() // name of this host )); + // load the template for private message notifications + $tpl = load_view_file('view/mail_received_eml.tpl'); + + // import the data into the template + $email_tpl = replace_macros($tpl, array( + '$email' => $importer['email'], // email address to send to + '$from' => $msg['from-name'], // name of the person sending the message + '$title' => stripslashes($msg['title']), // subject of the message + '$mimeboundary' => $msg['mimeboundary'], // mime message divider + '$hostname' => $a->get_hostname(), // name of this host + '$htmlbody' => chunk_split(base64_encode($email_html_body_tpl)), + '$textbody' => chunk_split(base64_encode($email_text_body_tpl)) + )); + logger("message headers: " . $msg['headers']); logger("message body: " . $mail_tpl); From 5aa6bbbbc5a32541c5b9176762aeccf573ba2601 Mon Sep 17 00:00:00 2001 From: Chris Case Date: Wed, 16 Feb 2011 08:05:54 -0800 Subject: [PATCH 5/9] fixed encoding, i had been experimenting with different ones and forgot to change it back, now UTF-8 --- view/de/mail_received_eml.tpl | 4 ++-- view/en/mail_received_eml.tpl | 4 ++-- view/fr/mail_received_eml.tpl | 4 ++-- view/it/mail_received_eml.tpl | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/view/de/mail_received_eml.tpl b/view/de/mail_received_eml.tpl index 890b71488..6ddd586fc 100644 --- a/view/de/mail_received_eml.tpl +++ b/view/de/mail_received_eml.tpl @@ -1,11 +1,11 @@ --$mimeboundary -Content-Type: text/plain; charset=ISO-8859-1 +Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 $textbody --$mimeboundary -Content-Type: text/html; charset=ISO-8859-1 +Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: base64 $htmlbody diff --git a/view/en/mail_received_eml.tpl b/view/en/mail_received_eml.tpl index 4ba0757cb..99eb14391 100644 --- a/view/en/mail_received_eml.tpl +++ b/view/en/mail_received_eml.tpl @@ -1,11 +1,11 @@ --$mimeboundary -Content-Type: text/plain; charset=ISO-8859-1 +Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 $textbody --$mimeboundary -Content-Type: text/html; charset=ISO-8859-1 +Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: base64 $htmlbody diff --git a/view/fr/mail_received_eml.tpl b/view/fr/mail_received_eml.tpl index 890b71488..6ddd586fc 100644 --- a/view/fr/mail_received_eml.tpl +++ b/view/fr/mail_received_eml.tpl @@ -1,11 +1,11 @@ --$mimeboundary -Content-Type: text/plain; charset=ISO-8859-1 +Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 $textbody --$mimeboundary -Content-Type: text/html; charset=ISO-8859-1 +Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: base64 $htmlbody diff --git a/view/it/mail_received_eml.tpl b/view/it/mail_received_eml.tpl index 14b983cfe..538d28e1e 100644 --- a/view/it/mail_received_eml.tpl +++ b/view/it/mail_received_eml.tpl @@ -1,11 +1,11 @@ --$mimeboundary -Content-Type: text/plain; charset=ISO-8859-1 +Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 $textbody --$mimeboundary -Content-Type: text/html; charset=ISO-8859-1 +Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: base64 $htmlbody From d6998ffef2277eefc6a48c2371cc3c6077102bf5 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 16 Feb 2011 13:19:54 -0800 Subject: [PATCH 6/9] small fixes --- mod/item.php | 2 +- mod/message.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mod/item.php b/mod/item.php index 5bb4b1b73..21dfb4560 100644 --- a/mod/item.php +++ b/mod/item.php @@ -545,7 +545,7 @@ function item_content(&$a) { // generate a resource-id and therefore aren't intimately linked to the item. if(strlen($item['resource-id'])) { - $q("DELETE FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d ", + q("DELETE FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d ", dbesc($item['resource-id']), intval($item['uid']) ); diff --git a/mod/message.php b/mod/message.php index c004b3d63..ef3be2c5e 100644 --- a/mod/message.php +++ b/mod/message.php @@ -87,10 +87,11 @@ function message_post(&$a) { $image_uri = substr($image,strrpos($image,'/') + 1); $image_uri = substr($image_uri,0, strpos($image_uri,'-')); $r = q("UPDATE `photo` SET `allow_cid` = '%s' - WHERE `resource-id` = '%s' AND `album` = '%s' ", + WHERE `resource-id` = '%s' AND `album` = '%s' AND `uid` = %d ", dbesc('<' . $recipient . '>'), dbesc($image_uri), - dbesc( t('Wall Photos')) + dbesc( t('Wall Photos')), + intval(local_user()) ); } } From 527e050ecc1037973595fd5de12682cfa9e19d64 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 16 Feb 2011 17:32:15 -0800 Subject: [PATCH 7/9] sanitise all incoming url's - also stop them from getting mangled by simplepie --- boot.php | 7 ++++++- images/remote-link.gif | Bin 0 -> 357 bytes include/items.php | 4 ++-- mod/follow.php | 38 +++++++++++++++++++++++--------------- simplepie/simplepie.inc | 1 + 5 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 images/remote-link.gif diff --git a/boot.php b/boot.php index dcf5b1c1a..322a4e307 100644 --- a/boot.php +++ b/boot.php @@ -2453,7 +2453,12 @@ if(! function_exists('get_plink')) { function get_plink($item) { $a = get_app(); $plink = (((x($item,'plink')) && (! $item['private'])) ? '' : ''); + . $item['plink'] . '" title="' . t('link to source') . '">' . t('link to source') . '' : ''); return $plink; }} +if(! function_exists('unamp')) { +function unamp($s) { + return str_replace('&', '&', $s); +}} + diff --git a/images/remote-link.gif b/images/remote-link.gif new file mode 100644 index 0000000000000000000000000000000000000000..008397fe8d957604ef4be8ec2ab96f4f1b6805b0 GIT binary patch literal 357 zcmZ?wbhEHb6krfwSgORp5ci)U?F>WOMTV4b3~7HD(*851{pZR#$B_jj|BDp;mnyp| zUG`t5?7u?gf7P1*8nyq8Td$e4UNZ%vwrj?%|4m!}JN5q0S^mF!=l|Ya|8KtdfBWVC zC-46~`|$ty$NxWn|Nr^tKkb0xPZmZl273k_1|R_WiGi)@!2ALa9jVsVB}SDx20Bw$ zs0L=FxkRj4TE!A$bCb*5L5-WE!?&VlLVy@EtNRwl?pDUm7mqVaTx2-Jm7*(z6xjF` zm1MbC7$kX;1(l=(loWZHne2TkrYK1W@bhsqx-l-8$|f(e+?7!{Qb|EcXuS&~yRhJ1 TAtCl1&Z$RI-H*FDGFSrur~JTp literal 0 HcmV?d00001 diff --git a/include/items.php b/include/items.php index 153debd7d..0951adbae 100644 --- a/include/items.php +++ b/include/items.php @@ -350,7 +350,7 @@ function get_atom_elements($feed,$item) { '[youtube]$1[/youtube]', $res['body']); $res['body'] = oembed_html2bbcode($res['body']); - + $config = HTMLPurifier_Config::createDefault(); $config->set('Cache.DefinitionImpl', null); @@ -363,7 +363,7 @@ function get_atom_elements($feed,$item) { $res['body'] = html2bbcode($res['body']); } - + $allow = $item->get_item_tags(NAMESPACE_DFRN,'comment-allow'); if($allow && $allow[0]['data'] == 1) $res['last-child'] = 1; diff --git a/mod/follow.php b/mod/follow.php index eaee7d5ac..763ffb1b0 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -19,15 +19,15 @@ function follow_post(&$a) { if(count($links)) { foreach($links as $link) { if($link['@attributes']['rel'] === NAMESPACE_DFRN) - $dfrn = $link['@attributes']['href']; + $dfrn = unamp($link['@attributes']['href']); if($link['@attributes']['rel'] === 'salmon') - $notify = $link['@attributes']['href']; + $notify = unamp($link['@attributes']['href']); if($link['@attributes']['rel'] === NAMESPACE_FEED) - $poll = $link['@attributes']['href']; + $poll = unamp($link['@attributes']['href']); if($link['@attributes']['rel'] === 'http://microformats.org/profile/hcard') - $hcard = $link['@attributes']['href']; + $hcard = unamp($link['@attributes']['href']); if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') - $profile = $link['@attributes']['href']; + $profile = unamp($link['@attributes']['href']); } @@ -43,10 +43,10 @@ function follow_post(&$a) { if(strpos($link['@attributes']['href'],'@') === false) { if(isset($profile)) { if($link['@attributes']['href'] !== $profile) - $alias = $link['@attributes']['href']; + $alias = unamp($link['@attributes']['href']); } else - $profile = $link['@attributes']['href']; + $profile = unamp($link['@attributes']['href']); } } } @@ -103,7 +103,7 @@ function follow_post(&$a) { $ret = scrape_feed($url); if(count($ret) && ($ret['feed_atom'] || $ret['feed_rss'])) { - $poll = ((x($ret,'feed_atom')) ? $ret['feed_atom'] : $ret['feed_rss']); + $poll = ((x($ret,'feed_atom')) ? unamp($ret['feed_atom']) : unamp($ret['feed_rss'])); $vcard = array(); require_once('simplepie/simplepie.inc'); $feed = new SimplePie(); @@ -116,27 +116,31 @@ function follow_post(&$a) { $vcard['photo'] = $feed->get_image_url(); $author = $feed->get_author(); if($author) { - $vcard['fn'] = trim($author->get_name()); - $vcard['nick'] = strtolower($vcard['fn']); + $vcard['fn'] = unxmlify(trim($author->get_name())); + $vcard['nick'] = strtolower(notags(unxmlify($vcard['fn']))); if(strpos($vcard['nick'],' ')) $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' '))); - $email = $author->get_email(); + $email = unxmlify($author->get_email()); } else { $item = $feed->get_item(0); if($item) { $author = $item->get_author(); if($author) { - $vcard['fn'] = trim($author->get_name()); - $vcard['nick'] = strtolower($vcard['fn']); + $vcard['fn'] = trim(unxmlify($author->get_name())); + if(! $vcard['fn']) + $vcard['fn'] = trim(unxmlify($author->get_email())); + if(strpos($vcard['fn'],'@') !== false) + $vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@')); + $vcard['nick'] = strtolower(unxmlify($vcard['fn'])); if(strpos($vcard['nick'],' ')) $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' '))); - $email = $author->get_email(); + $email = unxmlify($author->get_email()); } if(! $vcard['photo']) { $rawmedia = $item->get_item_tags('http://search.yahoo.com/mrss/','thumbnail'); if($rawmedia && $rawmedia[0]['attribs']['']['url']) - $vcard['photo'] = $rawmedia[0]['attribs']['']['url']; + $vcard['photo'] = unxmlify($rawmedia[0]['attribs']['']['url']); } } } @@ -150,6 +154,9 @@ function follow_post(&$a) { logger('follow: poll=' . $poll . ' notify=' . $notify . ' profile=' . $profile . ' vcard=' . print_r($vcard,true)); + $vcard['fn'] = notags($vcard['fn']); + $vcard['nick'] = notags($vcard['nick']); + // do we have enough information? if(! ((x($vcard['fn'])) && ($poll) && ($profile))) { @@ -157,6 +164,7 @@ function follow_post(&$a) { goaway($_SESSION['return_url']); } + if(! $notify) { notice( t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL); } diff --git a/simplepie/simplepie.inc b/simplepie/simplepie.inc index 185e17bcc..c3ba02b7d 100644 --- a/simplepie/simplepie.inc +++ b/simplepie/simplepie.inc @@ -9226,6 +9226,7 @@ class SimplePie_Misc function absolutize_url($relative, $base) { +return $relative; $iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative); return $iri->get_iri(); } From 67bb737aa1368e4b16de0ac42134db47874cc18c Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 16 Feb 2011 17:49:52 -0800 Subject: [PATCH 8/9] broken image + linkify site link in body --- mod/dfrn_notify.php | 1 + view/de/mail_received_html_body_eml.tpl | 4 ++-- view/en/mail_received_html_body_eml.tpl | 4 ++-- view/fr/mail_received_html_body_eml.tpl | 4 ++-- view/it/mail_received_html_body_eml.tpl | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 040263b0c..b8d86ad24 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -244,6 +244,7 @@ function dfrn_notify_post(&$a) { // import the data into the template $email_tpl = replace_macros($tpl, array( + '$siteurl' => $a->get_baseurl(), // descriptive url of this site '$email' => $importer['email'], // email address to send to '$from' => $msg['from-name'], // name of the person sending the message '$title' => stripslashes($msg['title']), // subject of the message diff --git a/view/de/mail_received_html_body_eml.tpl b/view/de/mail_received_html_body_eml.tpl index b2d914f24..32c5a651a 100644 --- a/view/de/mail_received_html_body_eml.tpl +++ b/view/de/mail_received_html_body_eml.tpl @@ -7,7 +7,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/view/en/mail_received_html_body_eml.tpl b/view/en/mail_received_html_body_eml.tpl index 981aa46e7..56cbf1d7c 100644 --- a/view/en/mail_received_html_body_eml.tpl +++ b/view/en/mail_received_html_body_eml.tpl @@ -7,7 +7,7 @@
Friendika
Friendika
Du hast eine neue private Nachricht von '$from' auf '$siteName' erhhalten.
$from
$title
$htmlversion
Bitte melde dich unter $siteurl an um deine privaten Nachrichte zu lesen und zu beantworten.
Bitte melde dich unter an um deine privaten Nachrichte zu lesen und zu beantworten.
Viele Grüße,
$siteName Administrator
- + @@ -16,7 +16,7 @@ - + diff --git a/view/fr/mail_received_html_body_eml.tpl b/view/fr/mail_received_html_body_eml.tpl index 43584a4c4..d60bbe70c 100644 --- a/view/fr/mail_received_html_body_eml.tpl +++ b/view/fr/mail_received_html_body_eml.tpl @@ -7,7 +7,7 @@
Friendika
Friendika
$from sent you a new private message at $siteName.
$from
$title
$htmlversion
Please login at $siteurl to read and reply to your private messages.
Please login at $siteurl to read and reply to your private messages.
Thank You,
$siteName Administrator
- + @@ -16,7 +16,7 @@ - + diff --git a/view/it/mail_received_html_body_eml.tpl b/view/it/mail_received_html_body_eml.tpl index a3c71cef9..7510f2b30 100644 --- a/view/it/mail_received_html_body_eml.tpl +++ b/view/it/mail_received_html_body_eml.tpl @@ -7,7 +7,7 @@
Friendika
Friendika
$from t'a envoyŽ un message ˆ $siteName.
$from
$title
$htmlversion
Ouvrez une session svp ˆ $siteurl pour lire et rŽpondre ˆ vos messages privŽs.
Ouvrez une session svp ˆ $siteurl pour lire et rŽpondre ˆ vos messages privŽs.
Merci,
$siteName Administrateur
- + @@ -16,7 +16,7 @@ - + From c397a2f89bf3c2c609852f5bfc618c1d0cb0b709 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 16 Feb 2011 20:25:10 -0800 Subject: [PATCH 9/9] properly handle error returns in post w/ajax --- mod/follow.php | 4 ++++ mod/item.php | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/mod/follow.php b/mod/follow.php index 763ffb1b0..28441eae8 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -117,6 +117,10 @@ function follow_post(&$a) { $author = $feed->get_author(); if($author) { $vcard['fn'] = unxmlify(trim($author->get_name())); + if(! $vcard['fn']) + $vcard['fn'] = trim(unxmlify($author->get_email())); + if(strpos($vcard['fn'],'@') !== false) + $vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@')); $vcard['nick'] = strtolower(notags(unxmlify($vcard['fn']))); if(strpos($vcard['nick'],' ')) $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' '))); diff --git a/mod/item.php b/mod/item.php index 21dfb4560..cbdd11eb9 100644 --- a/mod/item.php +++ b/mod/item.php @@ -35,7 +35,9 @@ function item_post(&$a) { ); if(! count($r)) { notice( t('Unable to locate original post.') . EOL); - goaway($a->get_baseurl() . "/" . $_POST['return'] ); + if(x($_POST,'return')) + goaway($a->get_baseurl() . "/" . $_POST['return'] ); + killme(); } $parent_item = $r[0]; if($parent_item['contact-id'] && $uid) { @@ -53,7 +55,9 @@ function item_post(&$a) { if(! can_write_wall($a,$profile_uid)) { notice( t('Permission denied.') . EOL) ; - return; + if(x($_POST,'return')) + goaway($a->get_baseurl() . "/" . $_POST['return'] ); + killme(); } $user = null; @@ -92,8 +96,9 @@ function item_post(&$a) { if(! strlen($body)) { notice( t('Empty post discarded.') . EOL ); - goaway($a->get_baseurl() . "/" . $_POST['return'] ); - + if(x($_POST,'return')) + goaway($a->get_baseurl() . "/" . $_POST['return'] ); + killme(); } // get contact info for poster
Friendika
Friendika
Hai ricevuto un nuovo messsaggio privato su $siteName da '$from'.
$from
$title
$htmlversion
Accedi a $siteurl per leggere e rispondere ai tuoi messaggi privati.
Accedi a $siteurl per leggere e rispondere ai tuoi messaggi privati.
Grazie,
L'amministratore di $siteName