From f4ebd2a21332264d998d5fad8b7e5e86dd889862 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 16 Jan 2011 14:58:07 -0800 Subject: [PATCH 01/12] Don't send conversation slaps, only immediate replies. Redundant and flawed. --- include/notifier.php | 23 +++++++++++++---------- mod/salmon.php | 7 ++++++- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/include/notifier.php b/include/notifier.php index 7791b9bd4..683cff360 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -207,7 +207,6 @@ )); } else { - if($followup) { foreach($items as $item) { // there is only one item if($item['id'] == $item_id) { @@ -224,7 +223,13 @@ continue; $atom .= atom_entry($item,'text',$contact,$owner,true); - $slaps[] = atom_entry($item,'html',$contact,$owner,true); + + // There's a problem here - we *were* going to use salmon to provide semi-authenticated + // communication to OStatus, but unless we're the item author they won't verify. + // commented out for now, though we'll still send local replies (and any mentions + // that they contain) upstream. Rethinking the problem space. + +// $slaps[] = atom_entry($item,'html',$contact,$owner,true); } } } @@ -232,7 +237,7 @@ logger('notifier: ' . $atom, LOGGER_DATA); - logger('notifier: slaps: ' . print_r($slaps,true), LOGGER_DATA); +// logger('notifier: slaps: ' . print_r($slaps,true), LOGGER_DATA); if($followup) $recip_str = $parent['contact-id']; @@ -324,14 +329,12 @@ // send additional slaps to mentioned remote tags (@foo@example.com) - if(count($slaps) && count($url_recipients) && $notify_hub) { + if($slap && count($url_recipients) && $followup && $notify_hub) { foreach($url_recipients as $url) { - logger('notifier: urldelivery: ' . $url); - foreach($slaps as $slappy) { - if($url) { - $deliver_status = slapper($owner,$url,$slappy); - // TODO: redeliver/queue these items on failure, though there is no contact record - } + if($url) { + logger('notifier: urldelivery: ' . $url); + $deliver_status = slapper($owner,$url,$slap); + // TODO: redeliver/queue these items on failure, though there is no contact record } } } diff --git a/mod/salmon.php b/mod/salmon.php index 2ae6aa628..8c7d921c8 100644 --- a/mod/salmon.php +++ b/mod/salmon.php @@ -199,7 +199,12 @@ function salmon_post(&$a) { $hub = ''; - // consume_feed will only accept a follow activity from this person if there is no contact record. + /** + * + * anti-spam measure: consume_feed will accept a follow activity from + * this person (and nothing else) if there is no existing contact record. + * + */ $contact_rec = ((count($r)) ? $r[0] : null); From fa9e1a9abba4e116a24f5df3680dcf1a6f8b3f72 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 16 Jan 2011 15:23:34 -0800 Subject: [PATCH 02/12] apply date translation to birthday in profiles --- view/en/profile_advanced.php | 4 ++-- view/it/profile_advanced.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/view/en/profile_advanced.php b/view/en/profile_advanced.php index 82c66adec..9aee6c262 100644 --- a/view/en/profile_advanced.php +++ b/view/en/profile_advanced.php @@ -39,8 +39,8 @@ EOT; $o .= '
' . ((intval($a->profile['dob'])) - ? datetime_convert('UTC',date_default_timezone_get(),$a->profile['dob'],'j F, Y') - : datetime_convert('UTC',date_default_timezone_get(),'2001-' . substr($a->profile['dob'],6),'j F')) + ? day_translate(datetime_convert('UTC',date_default_timezone_get(),$a->profile['dob'],'j F, Y')) + : day_translate(datetime_convert('UTC',date_default_timezone_get(),'2001-' . substr($a->profile['dob'],6),'j F'))) . "
\r\n"; $o .= '
'; diff --git a/view/it/profile_advanced.php b/view/it/profile_advanced.php index 50bb0dd28..899fd56b2 100644 --- a/view/it/profile_advanced.php +++ b/view/it/profile_advanced.php @@ -39,8 +39,8 @@ EOT; $o .= '
' . ((intval($a->profile['dob'])) - ? datetime_convert('UTC',date_default_timezone_get(),$a->profile['dob'],'j F, Y') - : datetime_convert('UTC',date_default_timezone_get(),'2001-' . substr($a->profile['dob'],6),'j F')) + ? day_translate(datetime_convert('UTC',date_default_timezone_get(),$a->profile['dob'],'j F, Y')) + : day_translate(datetime_convert('UTC',date_default_timezone_get(),'2001-' . substr($a->profile['dob'],6),'j F'))) . "
\r\n"; $o .= '
'; From 3811923c14b5a2be88104ea8069d0d0bb3d9800a Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 16 Jan 2011 16:40:09 -0800 Subject: [PATCH 03/12] put birthday reminders on default network page, add smileys to private mail --- mod/message.php | 2 +- mod/network.php | 4 ++++ mod/profile.php | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mod/message.php b/mod/message.php index 251b5a414..9cc2e2826 100644 --- a/mod/message.php +++ b/mod/message.php @@ -270,7 +270,7 @@ function message_content(&$a) { '$sparkle' => $sparkle, '$from_photo' => $message['from-photo'], '$subject' => $message['title'], - '$body' => bbcode($message['body']), + '$body' => smilies(bbcode($message['body'])), '$delete' => t('Delete message'), '$to_name' => $message['name'], '$date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A') diff --git a/mod/network.php b/mod/network.php index 08607fa18..5073b8a61 100644 --- a/mod/network.php +++ b/mod/network.php @@ -115,6 +115,10 @@ function network_content(&$a, $update = 0) { $o = '

' . t('Group: ') . $r[0]['name'] . '

' . $o; } + if((! $group) && (! $update)) + $o .= get_birthdays(); + + $r = q("SELECT COUNT(*) AS `total` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 diff --git a/mod/profile.php b/mod/profile.php index 9b8388177..bcd2b64e3 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -230,7 +230,7 @@ function profile_content(&$a, $update = 0) { if($is_owner && ! $update) - $o .= get_birthdays(); + $o .= get_birthdays(); $cmnt_tpl = load_view_file('view/comment_item.tpl'); From 2e0a3e06938f159ebe3729a8d488de928e3230a5 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 16 Jan 2011 17:56:26 -0800 Subject: [PATCH 04/12] birthday notifications: missing div close --- boot.php | 3 ++- include/notifier.php | 2 +- view/theme/default/style.css | 2 +- view/theme/duepuntozero/style.css | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/boot.php b/boot.php index 9715f9cfd..5184a833c 100644 --- a/boot.php +++ b/boot.php @@ -2168,7 +2168,8 @@ function get_birthdays() { $o .= '
' . $rr['name'] . ' ' - . day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : '') ; + . day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : '') + . '
' ; } $o .= ''; diff --git a/include/notifier.php b/include/notifier.php index 683cff360..39640e51a 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -181,7 +181,7 @@ '$feed_title' => xmlify($owner['name']), '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', $updated . '+00:00' , ATOM_TIME)) , '$hub' => $hubxml, - '$salmon' => '', // private feed, we don't use salmon here + '$salmon' => '', // private feed, we don't use salmon here '$name' => xmlify($owner['name']), '$profile_page' => xmlify($owner['url']), '$photo' => xmlify($owner['photo']), diff --git a/view/theme/default/style.css b/view/theme/default/style.css index fd14c6bdd..d9e93bbe6 100644 --- a/view/theme/default/style.css +++ b/view/theme/default/style.css @@ -1979,5 +1979,5 @@ a.mail-list-link { } #birthday-wrapper { - margin-bottom: 15px; + margin-bottom: 20px; } diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 37670df01..7453ce212 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -1876,5 +1876,5 @@ a.mail-list-link { } #birthday-wrapper { - margin-bottom: 15px; + margin-bottom: 20px; } From 1002f9dc96e5dc7d387cf7eb8489bcc2fc7c966d Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 16 Jan 2011 19:01:13 -0800 Subject: [PATCH 05/12] there were some bug fixes, roll version number --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot.php b/boot.php index 5184a833c..2be34a529 100644 --- a/boot.php +++ b/boot.php @@ -3,7 +3,7 @@ set_time_limit(0); define ( 'BUILD_ID', 1031 ); -define ( 'FRIENDIKA_VERSION', '2.01.1000' ); +define ( 'FRIENDIKA_VERSION', '2.01.1001' ); define ( 'DFRN_PROTOCOL_VERSION', '2.0' ); define ( 'EOL', "
\r\n" ); From d5ac7e938bf5a8737a2afdcf69f095b13bb7e5af Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 16 Jan 2011 23:48:44 -0800 Subject: [PATCH 06/12] newlines were getting stripped --- boot.php | 1 - include/html2bbcode.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/boot.php b/boot.php index 2be34a529..ac577887c 100644 --- a/boot.php +++ b/boot.php @@ -910,7 +910,6 @@ function xmlify($str) { case "'" : $buffer .= '''; break; - case "\"" : $buffer .= '"'; break; diff --git a/include/html2bbcode.php b/include/html2bbcode.php index 688c01452..7cacadd65 100644 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -32,7 +32,7 @@ function html2bbcode($s) { // Replace with $bbtags = array( - '', + "\n", '[b]$1[/b]', '[i]$1[/i]', '[u]$1[/u]', From bb2130ca7f0166a4a0fc171d130590977936445c Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 17 Jan 2011 11:45:06 +0100 Subject: [PATCH 07/12] Mods to duepuntozero .shiny class --- view/theme/duepuntozero/shiny.jpg | Bin 338 -> 0 bytes view/theme/duepuntozero/shiny.png | Bin 0 -> 362 bytes view/theme/duepuntozero/style.css | 27 +++++++-------------------- 3 files changed, 7 insertions(+), 20 deletions(-) delete mode 100644 view/theme/duepuntozero/shiny.jpg create mode 100644 view/theme/duepuntozero/shiny.png diff --git a/view/theme/duepuntozero/shiny.jpg b/view/theme/duepuntozero/shiny.jpg deleted file mode 100644 index 17c97881694c48738e258f2cf474b712b155e191..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 338 zcmex=LJ%Z3brsR%R9! z7G_o;!OF_Y#?HgR4g~z%+?+gu{6a#4{DOkQVlv{wB2uD)f)a`nQnIr0^76vsN-9cn zDl&5Nav(z(fm+$w*!eg(_~b+cMdU~Z{|_(-axl089mA-^z$D1XEXer(2!lAt{frFA zfSHK{C?O#Ll0cCW5@aj{X#t8dBWqw_WMEDD*GD0X#=CwqOyN|ANrXCgtsO~{o7Kx>VR49a!E110l tt5Y-2UBA!rY|*rqD|U=*i^{m~zTrK5!YQLoO7=6zm!7VEF6*2UngHobgVX>3 literal 0 HcmV?d00001 diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 7453ce212..b2bdb6e87 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -3,23 +3,10 @@ * Fabio Comuni */ -@font-face { - font-family: FreeSans; - font-style: normal; - font-weight: bold; - src: local('FreeSansBold'), url('FreeSansBold.otf'); -} -@font-face { - font-family: FreeSans; - font-style: normal; - font-weight: normal; - src: local('FreeSans'), url('FreeSans.otf'); -} - /* generals */ body { - font-family: /*FreeSans,*/ helvetica,arial,clean,sans-serif; + font-family: helvetica,arial,freesans,clean,sans-serif; font-size: 12px; background-color: #ffffff; background-image: url(head.jpg); @@ -209,10 +196,10 @@ footer { } -.shiny { - background-image: url(shiny.jpg); - background-repeat: repeat-x; - background-position: left bottom; +div.wall-item-content-wrapper.shiny { + background-image: url('shiny.png'); + background-position: -5px 30px; + background-repeat:no-repeat; } /* from defautlt */ @@ -801,7 +788,7 @@ input#dfrn-url { .wall-item-content-wrapper.comment { margin-left: 50px; - background: #CCCCCC; + background: #EEEEEE; } .wall-item-photo-wrapper { @@ -879,7 +866,7 @@ input#dfrn-url { .comment-edit-wrapper { margin-top: 15px; - background: #CCCCCC; + background: #f3f3f3; margin-left: 50px; } From 46c4bb6d4c885d232b255bb60066e3aaa4dfe8f4 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 17 Jan 2011 02:51:26 -0800 Subject: [PATCH 08/12] ensure birthday "today" calculation is relative to UTC. --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot.php b/boot.php index ac577887c..d8549d5c0 100644 --- a/boot.php +++ b/boot.php @@ -2163,7 +2163,7 @@ function get_birthdays() { foreach($r as $rr) { $now = strtotime('now'); - $today = (((strtotime($rr['start']) < $now) && (strtotime($rr['finish']) > $now)) ? true : false); + $today = (((strtotime($rr['start'] . ' +00:00') < $now) && (strtotime($rr['finish'] . ' +00:00') > $now)) ? true : false); $o .= '
' . $rr['name'] . ' ' From 710cb7d13c005b244cf50d2f33479b68596d1330 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 17 Jan 2011 16:06:22 -0800 Subject: [PATCH 09/12] activity object link had incorrect attribute, highlight critical install steps --- INSTALL.txt | 8 +++++++- boot.php | 2 +- include/items.php | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/INSTALL.txt b/INSTALL.txt index 577f3f354..70e4f24ef 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -17,7 +17,7 @@ hosting provider prior to installation. - Apache with mod-rewrite enabled and "Options All" so you can use a local .htaccess file - - PHP > 5.1. The later the better. You'll need 5.3 for encryption of key + - PHP 5.2+. The later the better. You'll need 5.3 for encryption of key exchange conversations encryption support - PHP *command line* access with register_argc_argv set to true in the @@ -67,6 +67,12 @@ database was not installed correctly. You might wish to move/rename .htconfig.php to another name and empty (called 'dropping') the database tables, so that you can start fresh. +**************************************************************************** +**************************************************************************** +******** THIS NEXT STEP IS IMPORTANT!!!! *********** +**************************************************************************** +**************************************************************************** + 7. Set up a cron job or scheduled task to run the poller once every 5-10 minutes to pick up the recent "public" postings of your friends. Example: diff --git a/boot.php b/boot.php index d8549d5c0..d168a2b8e 100644 --- a/boot.php +++ b/boot.php @@ -3,7 +3,7 @@ set_time_limit(0); define ( 'BUILD_ID', 1031 ); -define ( 'FRIENDIKA_VERSION', '2.01.1001' ); +define ( 'FRIENDIKA_VERSION', '2.01.1002' ); define ( 'DFRN_PROTOCOL_VERSION', '2.0' ); define ( 'EOL', "
\r\n" ); diff --git a/include/items.php b/include/items.php index 1a5ca5a1f..c076e0fbf 100644 --- a/include/items.php +++ b/include/items.php @@ -35,6 +35,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0) else killme(); + /** * * Determine the next birthday, but only if the birthday is published @@ -571,7 +572,7 @@ function encode_rel_links($links) { if($link['attribs']['']['type']) $o .= 'type="' . $link['attribs']['']['type'] . '" '; if($link['attribs']['']['href']) - $o .= 'type="' . $link['attribs']['']['href'] . '" '; + $o .= 'href="' . $link['attribs']['']['href'] . '" '; if( (x($link['attribs'],NAMESPACE_MEDIA)) && $link['attribs'][NAMESPACE_MEDIA]['width']) $o .= 'media:width="' . $link['attribs'][NAMESPACE_MEDIA]['width'] . '" '; if( (x($link['attribs'],NAMESPACE_MEDIA)) && $link['attribs'][NAMESPACE_MEDIA]['height']) From 050618a2b690ad2e2d8e84afbada8b12f9da0f01 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 17 Jan 2011 16:28:32 -0800 Subject: [PATCH 10/12] repair any bad links in activity objects --- boot.php | 4 ++-- update.php | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/boot.php b/boot.php index d168a2b8e..13e1e1793 100644 --- a/boot.php +++ b/boot.php @@ -2,8 +2,8 @@ set_time_limit(0); -define ( 'BUILD_ID', 1031 ); -define ( 'FRIENDIKA_VERSION', '2.01.1002' ); +define ( 'BUILD_ID', 1032 ); +define ( 'FRIENDIKA_VERSION', '2.01.1003' ); define ( 'DFRN_PROTOCOL_VERSION', '2.0' ); define ( 'EOL', "
\r\n" ); diff --git a/update.php b/update.php index ae0e35531..7aacffb40 100644 --- a/update.php +++ b/update.php @@ -302,3 +302,18 @@ function update_1030() { } +function update_1031() { + // Repair any bad links that slipped into the item table + $r = q("SELECT `id`, `object` FROM `item` WHERE `object` != '' "); + if($r && count($r)) { + foreach($r as $rr) { + if(strstr($rr['object'],'type="http')) { + q("UPDATE `item` SET `object` = '%s' WHERE `id` = %d LIMIT 1", + dbesc(str_replace('type="http','href="http',$rr['object'])), + intval($rr['id']) + ); + } + } + } +} + From fa1f2ce8f38962b97c4a6a327c5f50e238eabb9b Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 17 Jan 2011 19:50:18 -0800 Subject: [PATCH 11/12] fix some linebreak issues --- include/html2bbcode.php | 6 ++++++ include/items.php | 23 ++++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/include/html2bbcode.php b/include/html2bbcode.php index 7cacadd65..65cbcec41 100644 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -11,6 +11,9 @@ function html2bbcode($s) { $htmltags = array( '/\n/is', + '/\(.*?)\<\/pre\>/is', + '/\/is', + '/\<\/p\>/is', '/\(.*?)\<\/b\>/is', '/\(.*?)\<\/i\>/is', '/\(.*?)\<\/u\>/is', @@ -32,6 +35,9 @@ function html2bbcode($s) { // Replace with $bbtags = array( + '', + '[code]$1[/code]', + '', "\n", '[b]$1[/b]', '[i]$1[/i]', diff --git a/include/items.php b/include/items.php index c076e0fbf..beed024a1 100644 --- a/include/items.php +++ b/include/items.php @@ -381,7 +381,7 @@ function get_atom_elements($feed,$item) { // It isn't certain at this point whether our content is plaintext or html and we'd be foolish to trust // the content type. Our own network only emits text normally, though it might have been converted to - // html if we used a pubsubhubbub transport. But if we see even one html open tag in our text, we will + // html if we used a pubsubhubbub transport. But if we see even one html tag in our text, we will // have to assume it is all html and needs to be purified. // It doesn't matter all that much security wise - because before this content is used anywhere, we are @@ -390,7 +390,7 @@ function get_atom_elements($feed,$item) { // html. - if(strpos($res['body'],'<')) { + if((strpos($res['body'],'<')) || (strpos($res['body'],'>'))) { $res['body'] = preg_replace('#]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?#s', '[youtube]$1[/youtube]', $res['body']); @@ -404,11 +404,12 @@ function get_atom_elements($feed,$item) { $purifier = new HTMLPurifier($config); $res['body'] = $purifier->purify($res['body']); + + $res['body'] = html2bbcode($res['body']); } - + else + $res['body'] = escape_tags($res['body']); - $res['body'] = html2bbcode($res['body']); - $allow = $item->get_item_tags(NAMESPACE_DFRN,'comment-allow'); if($allow && $allow[0]['data'] == 1) @@ -496,7 +497,7 @@ function get_atom_elements($feed,$item) { $body = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data']; // preserve a copy of the original body content in case we later need to parse out any microformat information, e.g. events $res['object'] .= '' . xmlify($body) . '' . "\n"; - if(strpos($body,'<')) { + if((strpos($body,'<')) || (strpos($body,'>'))) { $body = preg_replace('#]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?#s', '[youtube]$1[/youtube]', $body); @@ -506,9 +507,11 @@ function get_atom_elements($feed,$item) { $purifier = new HTMLPurifier($config); $body = $purifier->purify($body); + $body = html2bbcode($body); } + else + $body = escape_tags($body); - $body = html2bbcode($body); $res['object'] .= '' . $body . '' . "\n"; } @@ -535,7 +538,7 @@ function get_atom_elements($feed,$item) { $body = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data']; // preserve a copy of the original body content in case we later need to parse out any microformat information, e.g. events $res['object'] .= '' . xmlify($body) . '' . "\n"; - if(strpos($body,'<')) { + if((strpos($body,'<')) || (strpos($body,'>'))) { $body = preg_replace('#]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?#s', '[youtube]$1[/youtube]', $body); @@ -545,9 +548,11 @@ function get_atom_elements($feed,$item) { $purifier = new HTMLPurifier($config); $body = $purifier->purify($body); + $body = html2bbcode($body); } + else + $body = escape_tags($body); - $body = html2bbcode($body); $res['target'] .= '' . $body . '' . "\n"; } From 028460a5c1de4833bb1dcfaa945c1292952bf923 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 17 Jan 2011 21:08:16 -0800 Subject: [PATCH 12/12] tracking errant bin2hex call --- boot.php | 5 +++++ include/items.php | 4 ++-- include/poller.php | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/boot.php b/boot.php index 13e1e1793..85e159883 100644 --- a/boot.php +++ b/boot.php @@ -945,6 +945,11 @@ function unxmlify($s) { if(! function_exists('hex2bin')) { function hex2bin($s) { + if(! ctype_xdigit($s)) { + logger('hex2bin: illegal input: ' . print_r(debug_backtrace(), true)); + return($s); + } + return(pack("H*",$s)); }} diff --git a/include/items.php b/include/items.php index beed024a1..1fdbc6fc2 100644 --- a/include/items.php +++ b/include/items.php @@ -788,8 +788,8 @@ function dfrn_deliver($owner,$contact,$atom) { return (($res->status) ? $res->status : 3); $postvars = array(); - $sent_dfrn_id = hex2bin($res->dfrn_id); - $challenge = hex2bin($res->challenge); + $sent_dfrn_id = hex2bin((string) $res->dfrn_id); + $challenge = hex2bin((string) $res->challenge); $rino_allowed = ((intval($res->rino) === 1) ? 1 : 0); $final_dfrn_id = ''; diff --git a/include/poller.php b/include/poller.php index 28e421f5f..fc45ff9c3 100644 --- a/include/poller.php +++ b/include/poller.php @@ -186,8 +186,8 @@ $postvars = array(); - $sent_dfrn_id = hex2bin($res->dfrn_id); - $challenge = hex2bin($res->challenge); + $sent_dfrn_id = hex2bin((string) $res->dfrn_id); + $challenge = hex2bin((string) $res->challenge); $final_dfrn_id = '';