diff options
author | zottel <github@zottel.net> | 2014-02-21 08:54:46 +0100 |
---|---|---|
committer | zottel <github@zottel.net> | 2014-02-21 08:54:46 +0100 |
commit | 8bd006bea83b3dbc02d94b4714a658e8742d9633 (patch) | |
tree | 078e9d4b634d583de8359ddae94c69d86ec19d17 /include | |
parent | 79c566bda33645f42f8545fdc6e55af35c4a7d5c (diff) | |
parent | 44d7047fce57085fe63ad5e1088911e9fc07a32e (diff) | |
download | volse-hubzilla-8bd006bea83b3dbc02d94b4714a658e8742d9633.tar.gz volse-hubzilla-8bd006bea83b3dbc02d94b4714a658e8742d9633.tar.bz2 volse-hubzilla-8bd006bea83b3dbc02d94b4714a658e8742d9633.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include')
-rw-r--r-- | include/Contact.php | 13 | ||||
-rw-r--r-- | include/bbcode.php | 9 | ||||
-rw-r--r-- | include/identity.php | 9 | ||||
-rwxr-xr-x | include/items.php | 4 | ||||
-rw-r--r-- | include/security.php | 11 | ||||
-rw-r--r-- | include/widgets.php | 2 | ||||
-rw-r--r-- | include/zot.php | 5 |
7 files changed, 38 insertions, 15 deletions
diff --git a/include/Contact.php b/include/Contact.php index 2dab62fd8..9883c598d 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -52,24 +52,27 @@ function abook_self($channel_id) { } function channelx_by_nick($nick) { - return q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_address = '%s' and not ( channel_pageflags & %d ) LIMIT 1", + $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_address = '%s' and not ( channel_pageflags & %d ) LIMIT 1", dbesc($nick), intval(PAGE_REMOVED) ); + return(($r) ? $r[0] : false); } function channelx_by_hash($hash) { - return q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_hash = '%s' and not ( channel_pageflags & %d ) LIMIT 1", + $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_hash = '%s' and not ( channel_pageflags & %d ) LIMIT 1", dbesc($hash), intval(PAGE_REMOVED) ); + return(($r) ? $r[0] : false); } function channelx_by_n($id) { - return q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_id = %d and not ( channel_pageflags & %d ) LIMIT 1", + $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_id = %d and not ( channel_pageflags & %d ) LIMIT 1", dbesc($id), intval(PAGE_REMOVED) ); + return(($r) ? $r[0] : false); } @@ -81,7 +84,7 @@ function vcard_from_xchan($xchan, $observer = null, $mode = '') { if($a->poi) { $xchan = $a->poi; } - elseif($a->profile['channel_hash']) { + elseif(is_array($a->profile) && $a->profile['channel_hash']) { $r = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($a->profile['channel_hash']) ); @@ -114,7 +117,7 @@ function vcard_from_xchan($xchan, $observer = null, $mode = '') { return replace_macros(get_markup_template('xchan_vcard.tpl'),array( '$name' => $xchan['xchan_name'], - '$photo' => ((array_key_exists('photo',$a->profile)) ? $a->profile['photo'] : $xchan['xchan_photo_l']), + '$photo' => ((is_array($a->profile) && array_key_exists('photo',$a->profile)) ? $a->profile['photo'] : $xchan['xchan_photo_l']), '$follow' => $xchan['xchan_addr'], '$connect' => $connect, '$newwin' => (($mode === 'chanview') ? t('New window') : ''), diff --git a/include/bbcode.php b/include/bbcode.php index 1969f8444..8bbf7ae01 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -227,6 +227,13 @@ function bb_location($match) { // not yet implemented } +function bbiframe($match) { + $a = get_app(); + if(strpos($match[1],get_app()->get_hostname())) + return '<a href="' . $match[1] . '">' . $match[1] . '</a>'; + return '<iframe src="' . $match[1] . '" width="' . $a->videowidth . '" height="' . $a->videoheight . '"><a href="' . $match[1] . '">' . $match[1] . '</a></iframe>'; +} + function bb_ShareAttributesSimple($match) { $attributes = $match[1]; @@ -677,7 +684,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { if ($tryoembed){ if (strpos($Text,'[/iframe]') !== false) { - $Text = preg_replace("/\[iframe\](.*?)\[\/iframe\]/ism", '<iframe src="$1" width="' . $a->videowidth . '" height="' . $a->videoheight . '"><a href="$1">$1</a></iframe>', $Text); + $Text = preg_replace_callback("/\[iframe\](.*?)\[\/iframe\]/ism", 'bbiframe', $Text); } } else { diff --git a/include/identity.php b/include/identity.php index d83498a69..82fc5fbea 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1206,3 +1206,12 @@ function remote_online_status($webbie) { return $result; } + + +function get_channel_by_nick($nick) { + $r = q("select * from channel where channel_address = '%s' limit 1", + dbesc($nick) + ); + return(($r) ? $r[0] : false); + +}
\ No newline at end of file diff --git a/include/items.php b/include/items.php index 7e15e9411..1217616d7 100755 --- a/include/items.php +++ b/include/items.php @@ -1585,7 +1585,7 @@ function item_store($arr,$allow_exec = false) { } - $arr['title'] = ((x($arr,'title')) ? notags(trim($arr['title'])) : ''); + $arr['title'] = ((x($arr,'title')) ? trim($arr['title']) : ''); $arr['body'] = ((x($arr,'body')) ? trim($arr['body']) : ''); $arr['allow_cid'] = ((x($arr,'allow_cid')) ? trim($arr['allow_cid']) : ''); @@ -1595,7 +1595,6 @@ function item_store($arr,$allow_exec = false) { $arr['item_private'] = ((x($arr,'item_private')) ? intval($arr['item_private']) : 0 ); $arr['item_flags'] = ((x($arr,'item_flags')) ? intval($arr['item_flags']) : 0 ); - $arr['title'] = escape_tags($arr['title']); // only detect language if we have text content, and if the post is private but not yet @@ -1639,7 +1638,6 @@ function item_store($arr,$allow_exec = false) { } - if((x($arr,'object')) && is_array($arr['object'])) { activity_sanitise($arr['object']); $arr['object'] = json_encode($arr['object']); diff --git a/include/security.php b/include/security.php index 5e86cf790..68dd573f7 100644 --- a/include/security.php +++ b/include/security.php @@ -47,6 +47,17 @@ function authenticate_success($user_record, $login_initial = false, $interactive goaway($a->get_baseurl() . '/' . $return_url); } + /* This account has never created a channel. Send them to new_channel by default */ + + if($a->module === 'login') { + $r = q("select count(channel_id) as total from channel where channel_account_id = %d", + intval($a->account['account_id']) + ); + if(($r) && (! $r[0]['total'])) + goaway(z_root() . '/new_channel'); + } + + /* else just return */ } diff --git a/include/widgets.php b/include/widgets.php index 3c2333323..4a5ae9de7 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -543,7 +543,7 @@ function widget_photo_albums($arr) { $channelx = channelx_by_n($a->profile['profile_uid']); if((! $channelx) || (! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_photos'))) return ''; - return photos_album_widget($channelx[0],$a->get_observer()); + return photos_album_widget($channelx,$a->get_observer()); } diff --git a/include/zot.php b/include/zot.php index a7094b2ad..298abb178 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1279,11 +1279,6 @@ function allowed_public_recips($msg) { if(array_key_exists('public_scope',$msg['message'])) $scope = $msg['message']['public_scope']; - // we can pull out these two lines once everybody has upgraded to >= 2013-02-15.225 - - else - $scope = 'public'; - $hash = base64url_encode(hash('whirlpool',$msg['notify']['sender']['guid'] . $msg['notify']['sender']['guid_sig'], true)); if($scope === 'public' || $scope === 'network: red') |