diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-11-01 15:52:35 -0800 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-11-01 15:52:35 -0800 |
commit | d3183467e06d6d7a04221c63d26173f97217cc43 (patch) | |
tree | 1da3ddc58b87a0afdfa0bf262c2d0950a192ccce /include | |
parent | b62614bbd48151837e29ab56a53e683d2f4dcb01 (diff) | |
parent | 618155e6ab1a76b5aaa667aa41a1668ce8f73a20 (diff) | |
download | volse-hubzilla-d3183467e06d6d7a04221c63d26173f97217cc43.tar.gz volse-hubzilla-d3183467e06d6d7a04221c63d26173f97217cc43.tar.bz2 volse-hubzilla-d3183467e06d6d7a04221c63d26173f97217cc43.zip |
Merge https://github.com/redmatrix/hubzilla into pending_merge
Diffstat (limited to 'include')
-rw-r--r-- | include/bb2diaspora.php | 11 | ||||
-rw-r--r-- | include/conversation.php | 3 | ||||
-rw-r--r-- | include/photo/photo_driver.php | 7 | ||||
-rw-r--r-- | include/photo/photo_gd.php | 2 | ||||
-rw-r--r-- | include/text.php | 2 | ||||
-rw-r--r-- | include/zot.php | 29 |
6 files changed, 44 insertions, 10 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 7cba40672..1be7caa19 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -162,10 +162,10 @@ function diaspora2bb($s, $use_zrl = false) { } //$s = preg_replace("/([^\]\=]|^)(https?\:\/\/)(vimeo|youtu|www\.youtube|soundcloud)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2$3$4]$2$3$4[/url]',$s); - $s = bb_tag_preg_replace("/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism",'[youtube]$2[/youtube]','url',$s); - $s = bb_tag_preg_replace("/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism",'[youtube]$1[/youtube]','url',$s); - $s = bb_tag_preg_replace("/\[url\=?(.*?)\]https?:\/ \/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism",'[vimeo]$2[/vimeo]','url',$s); - $s = bb_tag_preg_replace("/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism",'[vimeo]$1[/vimeo]','url',$s); + $s = bb_tag_preg_replace("/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism",'[embed]https://www.youtube.com/watch?v=$2[/embed]','url',$s); + $s = bb_tag_preg_replace("/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism",'[embed]https://www.youtube.com/watch?v=$1[/embed]','url',$s); + $s = bb_tag_preg_replace("/\[url\=?(.*?)\]https?:\/ \/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism",'[embed]https://vimeo.com/$2[/embed]','url',$s); + $s = bb_tag_preg_replace("/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism",'[embed]https://vimeo.com/$1[/embed]','url',$s); // remove duplicate adjacent code tags $s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s); @@ -440,6 +440,9 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { // So take off the angle brackets of any such URL $Text = preg_replace("/<http(.*?)>/is", "http$1", $Text); + // Remove empty zrl links + $Text = preg_replace("/\[zrl\=\].*?\[\/zrl\]/is", "", $Text); + // Remove all unconverted tags $Text = strip_tags($Text); diff --git a/include/conversation.php b/include/conversation.php index c2d9641ba..b2d58a025 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -681,7 +681,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $ $body = prepare_body($item,true); - $is_photo = ((($item['resource_type'] == 'photo') && (feature_enabled($profile_owner,'large_photos'))) ? true : false); $has_tags = (($body['tags'] || $body['categories'] || $body['mentions'] || $body['attachments'] || $body['folders']) ? true : false); $tmp_item = array( @@ -698,6 +697,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $ 'thumb' => $profile_avatar, 'title' => $item['title'], 'body' => $body['html'], + 'photo' => $body['photo'], 'tags' => $body['tags'], 'categories' => $body['categories'], 'mentions' => $body['mentions'], @@ -738,7 +738,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $ 'previewing' => $previewing, 'wait' => t('Please wait'), 'thread_level' => 1, - 'is_photo' => $is_photo, 'has_tags' => $has_tags, ); diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index e980a96e1..285cbc8fb 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -734,6 +734,11 @@ function import_channel_photo($photo,$type,$aid,$uid) { $photo_failure = true; } - return(($photo_failure)? false : true); + //return(($photo_failure)? false : true); + + if($photo_failure) + return false; + else + return $hash; } diff --git a/include/photo/photo_gd.php b/include/photo/photo_gd.php index fa1f700e9..2ac7287e4 100644 --- a/include/photo/photo_gd.php +++ b/include/photo/photo_gd.php @@ -137,4 +137,4 @@ class photo_gd extends photo_driver { return $string; } -}
\ No newline at end of file +} diff --git a/include/text.php b/include/text.php index 5df7bb4a1..c2573da0c 100644 --- a/include/text.php +++ b/include/text.php @@ -1233,7 +1233,7 @@ function theme_attachments(&$item) { if($label == ' ') $label = t('Unknown Attachment'); - $title = t('Attachment') . ' - ' . (($r['length']) ? userReadableSize($r['length']) : t('Size Unknown')); + $title = t('Size') . ' ' . (($r['length']) ? userReadableSize($r['length']) : t('unknown')); require_once('include/identity.php'); if(is_foreigner($item['author_xchan'])) diff --git a/include/zot.php b/include/zot.php index 793eb6b39..ed4bdc264 100644 --- a/include/zot.php +++ b/include/zot.php @@ -814,7 +814,34 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED, $ud_arr = null) { if ($local) { $ph = z_fetch_url($arr['photo'], true); if ($ph['success']) { - import_channel_photo($ph['body'], $arr['photo_mimetype'], $local[0]['channel_account_id'],$local[0]['channel_id']); + + $hash = import_channel_photo($ph['body'], $arr['photo_mimetype'], $local[0]['channel_account_id'], $local[0]['channel_id']); + + if($hash) { + // unless proven otherwise + $is_default_profile = 1; + + $profile = q("select is_default from profile where aid = %d and uid = %d limit 1", + intval($local[0]['channel_account_id']), + intval($local[0]['channel_id']) + ); + if($profile) { + if(! intval($profile[0]['is_default'])) + $is_default_profile = 0; + } + + // If setting for the default profile, unset the profile photo flag from any other photos I own + if($is_default_profile) { + q("UPDATE photo SET photo_usage = %d WHERE photo_usage = %d AND resource_id != '%s' AND aid = %d AND uid = %d", + intval(PHOTO_NORMAL), + intval(PHOTO_PROFILE), + dbesc($hash), + intval($local[0]['channel_account_id']), + intval($local[0]['channel_id']) + ); + } + } + // reset the names in case they got messed up when we had a bug in this function $photos = array( z_root() . '/photo/profile/l/' . $local[0]['channel_id'], |