From 94fabe3a2942ca93b436694f180f8eb2a72df918 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 10 Jul 2012 06:28:02 -0700 Subject: upstream fixes and a lot of taxonomy stuff --- include/Photo.php | 2 +- include/diaspora.php | 8 ++++---- include/items.php | 4 +++- include/lock.php | 2 -- include/queue.php | 2 +- include/text.php | 10 +++++++--- mod/photos.php | 3 +-- mod/profile.php | 2 +- mod/profile_photo.php | 8 +++++++- mod/wall_upload.php | 7 +++++++ 10 files changed, 32 insertions(+), 16 deletions(-) diff --git a/include/Photo.php b/include/Photo.php index 3af1691ee..ba4241a7b 100644 --- a/include/Photo.php +++ b/include/Photo.php @@ -143,7 +143,7 @@ class Photo { public function orient($filename) { // based off comment on http://php.net/manual/en/function.imagerotate.php - if(! function_exists('exif_read_data')) + if( (! function_exists('exif_read_data')) || ($this->getType() !== 'image/jpeg') ) return; $exif = exif_read_data($filename); diff --git a/include/diaspora.php b/include/diaspora.php index 7551ea9b3..2e7bf7522 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1257,7 +1257,7 @@ function diaspora_comment($importer,$xml,$msg) { if(($parent_item['origin']) && (! $parent_author_signature)) { q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ", intval($message_id), - dbesc($author_signed_data), + dbesc($signed_data), dbesc(base64_encode($author_signature)), dbesc($diaspora_handle) ); @@ -1840,7 +1840,7 @@ EOT; if(! $parent_author_signature) { q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ", intval($message_id), - dbesc($author_signed_data), + dbesc($signed_data), dbesc(base64_encode($author_signature)), dbesc($diaspora_handle) ); @@ -2496,7 +2496,7 @@ function diaspora_send_mail($item,$owner,$contact) { } -function diaspora_transmit($owner,$contact,$slap,$public_batch) { +function diaspora_transmit($owner,$contact,$slap,$public_batch,$queue_run = false) { $enabled = intval(get_config('system','diaspora_enabled')); if(! $enabled) { @@ -2513,7 +2513,7 @@ function diaspora_transmit($owner,$contact,$slap,$public_batch) { logger('diaspora_transmit: ' . $logid . ' ' . $dest_url); - if(was_recently_delayed($contact['id'])) { + if( (! $queue_run) && (was_recently_delayed($contact['id']))) { $return_code = 0; } else { diff --git a/include/items.php b/include/items.php index 5ae769244..1f90a1d05 100755 --- a/include/items.php +++ b/include/items.php @@ -3613,7 +3613,9 @@ function posted_dates($uid,$wall) { $dnow = substr($dthen,0,8) . '28'; $ret = array(); - while($dnow >= $dthen) { + // Starting with the current month, get the first and last days of every + // month down to and including the month of the first post + while(substr($dnow, 0, 7) >= substr($dthen, 0, 7)) { $dstart = substr($dnow,0,8) . '01'; $dend = substr($dnow,0,8) . get_dim(intval($dnow),intval(substr($dnow,5))); $start_month = datetime_convert('','',$dstart,'Y-m-d'); diff --git a/include/lock.php b/include/lock.php index 5f1ca6323..707e33609 100644 --- a/include/lock.php +++ b/include/lock.php @@ -73,5 +73,3 @@ function unlock_function($fn_name) { return; }} - -?> diff --git a/include/queue.php b/include/queue.php index 7e92705be..ba3babe70 100644 --- a/include/queue.php +++ b/include/queue.php @@ -161,7 +161,7 @@ function queue_run($argv, $argc){ case NETWORK_DIASPORA: if($contact['notify']) { logger('queue: diaspora_delivery: item ' . $q_item['id'] . ' for ' . $contact['name']); - $deliver_status = diaspora_transmit($owner,$contact,$data,$public); + $deliver_status = diaspora_transmit($owner,$contact,$data,$public,true); if($deliver_status == (-1)) update_queue_time($q_item['id']); diff --git a/include/text.php b/include/text.php index f3bc94265..59ef5a88f 100644 --- a/include/text.php +++ b/include/text.php @@ -1328,10 +1328,14 @@ function file_tag_decode($s) { function file_tag_file_query($table,$s,$type = 'file') { if($type == 'file') - $str = preg_quote( '[' . str_replace('%','%%',file_tag_encode($s)) . ']' ); + $termtype = TERM_FILE; else - $str = preg_quote( '<' . str_replace('%','%%',file_tag_encode($s)) . '>' ); - return " AND " . (($table) ? dbesc($table) . '.' : '') . "file regexp '" . dbesc($str) . "' "; + $termtype = TERM_CATEGORY; + + return sprintf(" AND " . (($table) ? dbesc($table) . '.' : '') . "id in (select term.oid from term where term.type = %d and term.term = '%s' and term.uid = " . (($table) ? dbesc($table) . '.' : '') . "uid ) ", + intval($termtype), + protect_sprintf(dbesc($s)) + ); } // ex. given music,video return