From 85e82e919e146454a8b3973ed4a2a69066b98aa3 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 9 Jun 2016 22:05:52 +0200 Subject: more style work --- include/attach.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/attach.php b/include/attach.php index 78efde51f..17e5067ff 100644 --- a/include/attach.php +++ b/include/attach.php @@ -1903,4 +1903,4 @@ function get_attach_binname($s) { $p = substr($p,strpos($p,'/')+1); } return $p; -} \ No newline at end of file +} -- cgit v1.2.3 From e2de2f65d5f434f800ac9fb6b824f9cbb5f860e8 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 26 Jun 2016 20:15:42 -0700 Subject: issue #442, tables contain too much whitespace (there's a definite issue here, but I should note the offending example was full of carriage returns as well as linefeeds; which exacerbated the problem). --- include/bbcode.php | 14 +++++++++++++- include/network.php | 12 ++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 0bf326506..7f7be4300 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -498,6 +498,18 @@ function bb_highlight($match) { return $match[0]; } +function bb_fixtable_lf($match) { + + // remove extraneous whitespace between table element tags since newlines will all + // be converted to '
' and turn your neatly crafted tables into a whole lot of + // empty space. + + $x = preg_replace("/\]\s+\[/",'][',$match[1]); + return '[table]' . $x . '[/table]'; + +} + + // BBcode 2 HTML was written by WAY2WEB.net // extended to work with Mistpark/Friendica/Redmatrix/Hubzilla - Mike Macgirvin @@ -579,7 +591,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) $Text = preg_replace_callback("/\[code=(.*?)\](.*?)\[\/code\]/ism", 'bb_highlight', $Text); } - + $Text = preg_replace_callback("/\[table\](.*?)\[\/table\]/ism",'bb_fixtable_lf',$Text); // Convert new line chars to html
tags diff --git a/include/network.php b/include/network.php index 91dac936e..96bf714f6 100644 --- a/include/network.php +++ b/include/network.php @@ -1336,8 +1336,20 @@ function discover_by_webbie($webbie) { $fullname = $vcard['fn']; if($vcard['photo'] && (strpos($vcard['photo'],'http') !== 0)) $vcard['photo'] = $diaspora_base . '/' . $vcard['photo']; + if(($vcard['key']) && (! $pubkey)) + $pubkey = $vcard['key']; if(! $avatar) $avatar = $vcard['photo']; + if($diaspora) { + if(($vcard['guid']) && (! $diaspora_guid)) + $diaspora_guid = $vcard['guid']; + if(($vcard['url']) && (! $diaspora_base)) + $diaspora_base = $vcard['url']; + + + + + } } } -- cgit v1.2.3 From 3035c792dcef91cd679034ee67eb2b28ed6f3d35 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 26 Jun 2016 22:13:59 -0700 Subject: remove the app $a passed to profile_load, also add profile_load to mod_wiki which should fix issue #431 --- include/channel.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/channel.php b/include/channel.php index a7624f060..913768017 100644 --- a/include/channel.php +++ b/include/channel.php @@ -761,11 +761,10 @@ function identity_export_year($channel_id,$year,$month = 0) { * * The channel default theme is also selected for use, unless over-riden elsewhere. * - * @param[in,out] App &$a * @param string $nickname * @param string $profile */ -function profile_load(&$a, $nickname, $profile = '') { +function profile_load($nickname, $profile = '') { // logger('profile_load: ' . $nickname . (($profile) ? ' profile: ' . $profile : '')); -- cgit v1.2.3 From 3704ff57cb65dce6ddd17136580e3bf82e7d97f2 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 27 Jun 2016 16:50:06 -0700 Subject: replace [+] and [-] with chevron icons --- include/js_strings.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/js_strings.php b/include/js_strings.php index b1817f373..1b4668061 100644 --- a/include/js_strings.php +++ b/include/js_strings.php @@ -4,10 +4,10 @@ function js_strings() { return replace_macros(get_markup_template('js_strings.tpl'), array( '$delitem' => t('Delete this item?'), '$comment' => t('Comment'), - '$showmore' => t('[+] show all'), - '$showfewer' => t('[-] show less'), - '$divgrowmore' => t('[+] expand'), - '$divgrowless' => t('[-] collapse'), + '$showmore' => sprintf( t('%s show all'), ''), + '$showfewer' => sprintf( t('%s show less'), ''), + '$divgrowmore' => sprintf( t('%s expand'), ''), + '$divgrowless' => sprintf( t('%s collapse'),''), '$pwshort' => t("Password too short"), '$pwnomatch' => t("Passwords do not match"), '$everybody' => t('everybody'), -- cgit v1.2.3 From b155e93ab134759f3d31a509d197916a5af84adb Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 27 Jun 2016 19:04:00 -0700 Subject: add letsencrypt x3 intermediate cert and new cert file, improve UX of new registrations --- include/account.php | 18 +++++++++++++++++- include/nav.php | 4 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/account.php b/include/account.php index caf12878e..c02a74928 100644 --- a/include/account.php +++ b/include/account.php @@ -499,11 +499,27 @@ function account_approve($hash) { intval($register[0]['uid']) ); + // get a fresh copy after we've modified it. + + $account = q("SELECT * FROM account WHERE account_id = %d LIMIT 1", + intval($register[0]['uid']) + ); + + if(! $account) + return $ret; + + + if(get_config('system','auto_channel_create') || UNO) auto_channel_create($register[0]['uid']); + else { + $_SESSION['login_return_url'] = 'new_channel'; + authenticate_success($account[0],true,true,false,true); + } + - info( t('Account verified. Please login.') . EOL ); + // info( t('Account verified. Please login.') . EOL ); return true; } diff --git a/include/nav.php b/include/nav.php index 70faec598..21e9d2c3a 100644 --- a/include/nav.php +++ b/include/nav.php @@ -126,7 +126,7 @@ EOT; $nav['lock'] = array('logout','','lock', sprintf( t('%s - click to logout'), $observer['xchan_addr'])); } - else { + elseif(! $_SESSION['authenticated']) { $nav['loginmenu'][] = Array('rmagic',t('Remote authentication'),'',t('Click to authenticate to your home hub'),'rmagic_nav_btn'); } @@ -143,7 +143,7 @@ EOT; if((App::$module != 'home') && (! (local_channel()))) $nav['home'] = array($homelink, t('Home'), "", t('Home Page'),'home_nav_btn'); - if((App::$config['system']['register_policy'] == REGISTER_OPEN) && (! local_channel()) && (! remote_channel())) + if((App::$config['system']['register_policy'] == REGISTER_OPEN) && (! $_SESSION['authenticated'])) $nav['register'] = array('register',t('Register'), "", t('Create an account'),'register_nav_btn'); if(! get_config('system','hide_help')) { -- cgit v1.2.3 From 7d7f43c2056fd50ff26aed5df553bf4936ead196 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 27 Jun 2016 22:25:37 -0700 Subject: still working through some issues with curl magic-auth fixed profile photo upload --- include/network.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/network.php b/include/network.php index 96bf714f6..47863b680 100644 --- a/include/network.php +++ b/include/network.php @@ -101,6 +101,9 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { if(x($opts,'cookiefile')) @curl_setopt($ch, CURLOPT_COOKIEFILE, $opts['cookiefile']); + if(x($opts,'cookie')) + @curl_setopt($ch, CURLOPT_COOKIE, $opts['cookie']); + @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, ((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true)); @@ -258,6 +261,10 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { if(x($opts,'cookiefile')) @curl_setopt($ch, CURLOPT_COOKIEFILE, $opts['cookiefile']); + + if(x($opts,'cookie')) + @curl_setopt($ch, CURLOPT_COOKIE, $opts['cookie']); + @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, ((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true)); -- cgit v1.2.3 From 7d62e087c65d964282171dd736e337cba135610f Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 28 Jun 2016 13:36:48 -0700 Subject: identity_export_year() was a bit short-sighted. We really require arbitrary date ranges. A new function was created to tackle this - channel_export_items() which takes a channel, and a start and finish date. Finish date will default to "now" if not set. Will be working this into the interface under a module named "export_items" which will correspond closely to the existing "import_items" module you'll need to do the reverse operation. Will also make it available via the API. Once that is complete, I anticipate removing identity_export_year() as it will then be somewhat redundant, and modifying the documentation on the channel export page accordingly. Note: the function works strictly in GMT so an interface would need to convert from channel local time. --- include/channel.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'include') diff --git a/include/channel.php b/include/channel.php index 913768017..95506ed78 100644 --- a/include/channel.php +++ b/include/channel.php @@ -747,6 +747,44 @@ function identity_export_year($channel_id,$year,$month = 0) { return $ret; } +// export items within an arbitrary date range. Date/time is in UTC. + +function channel_export_items($channel_id,$start,$finish) { + + if(! $start) + return array(); + else + $start = datetime_convert('UTC','UTC',$start); + + $finish = datetime_convert('UTC','UTC',(($finish) ? $finish : 'now')); + if($finish < $start) + return array(); + + $ret = array(); + + $ch = channelx_by_n($channel_id); + if($ch) { + $ret['relocate'] = [ 'channel_address' => $ch['channel_address'], 'url' => z_root()]; + } + + $r = q("select * from item where ( item_wall = 1 or item_type != %d ) and item_deleted = 0 and uid = %d and created >= '%s' and created < '%s' and resource_type = '' order by created", + intval(ITEM_TYPE_POST), + intval($channel_id), + dbesc($start), + dbesc($finish) + ); + + if($r) { + $ret['item'] = array(); + xchan_query($r); + $r = fetch_post_tags($r,true); + foreach($r as $rr) + $ret['item'][] = encode_item($rr,true); + } + + return $ret; +} + /** * @brief Loads a profile into the App structure. -- cgit v1.2.3 From 2e93a09d83f16f12796ff4edc1aca09339ae2ccf Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 29 Jun 2016 17:31:48 -0700 Subject: stream large photos through buffered I/O if possible --- include/attach.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/attach.php b/include/attach.php index dbcb0f930..b3ddfee88 100644 --- a/include/attach.php +++ b/include/attach.php @@ -1468,7 +1468,7 @@ function find_filename_by_hash($channel_id, $attachHash) { function pipe_streams($in, $out) { $size = 0; while (!feof($in)) - $size += fwrite($out, fread($in, 8192)); + $size += fwrite($out, fread($in, 16384)); return $size; } -- cgit v1.2.3 From 9ef710c557fcc4ea01c87e03fd7a477eb037f09c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 29 Jun 2016 20:59:00 -0700 Subject: provide wiki as a feature (default is on so there aren't any surprises) and add to channel menu and profile tabs --- include/conversation.php | 16 +++++++++++----- include/features.php | 1 + include/nav.php | 2 ++ 3 files changed, 14 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index d2d4ffca0..957dbf8e9 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1703,13 +1703,19 @@ function profile_tabs($a, $is_owner = false, $nickname = null){ 'title' => t('Manage Webpages'), 'id' => 'webpages-tab', ); - } else { - /** - * @FIXME we probably need a listing of events that were created by - * this channel and are visible to the observer - */ + } + + if(feature_enabled($uid,'wiki') && (! UNO)) { + $tabs[] = array( + 'label' => t('Wiki'), + 'url' => z_root() . '/wiki/' . $nickname, + 'sel' => ((argv(0) == 'wiki') ? 'active' : ''), + 'title' => t('Wiki'), + 'id' => 'wiki-tab', + ); } + $arr = array('is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs); call_hooks('profile_tabs', $arr); diff --git a/include/features.php b/include/features.php index 6d38bcfb4..660ea2975 100644 --- a/include/features.php +++ b/include/features.php @@ -52,6 +52,7 @@ function get_features($filtered = true) { array('advanced_profiles', t('Advanced Profiles'), t('Additional profile sections and selections'),false,get_config('feature_lock','advanced_profiles')), array('profile_export', t('Profile Import/Export'), t('Save and load profile details across sites/channels'),false,get_config('feature_lock','profile_export')), array('webpages', t('Web Pages'), t('Provide managed web pages on your channel'),false,get_config('feature_lock','webpages')), + array('wiki', t('Wiki'), t('Provide a wiki for your channel'),true,get_config('feature_lock','wiki')), array('hide_rating', t('Hide Rating'), t('Hide the rating buttons on your channel and profile pages. Note: People can still rate you somewhere else.'),false,get_config('feature_lock','hide_rating')), array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders (note: not encrypted)'),false,get_config('feature_lock','private_notes')), array('nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu'),false,get_config('feature_lock','nav_channel_select')), diff --git a/include/nav.php b/include/nav.php index 21e9d2c3a..6a79b6530 100644 --- a/include/nav.php +++ b/include/nav.php @@ -104,6 +104,8 @@ EOT; if(feature_enabled($channel['channel_id'],'webpages') && (! UNO)) $nav['usermenu'][] = Array('webpages/' . $channel['channel_address'],t('Webpages'),"",t('Your webpages'),'webpages_nav_btn'); + if(feature_enabled($channel['channel_id'],'wiki') && (! UNO)) + $nav['usermenu'][] = Array('wiki/' . $channel['channel_address'],t('Wiki'),"",t('Your wiki'),'wiki_nav_btn'); } else { if(! get_account_id()) { -- cgit v1.2.3 From 339e620738ed90d18fdfb7e83b637b7d0e50f56e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 29 Jun 2016 21:03:53 -0700 Subject: wiki featured disabled by default in UNO. --- include/features.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/features.php b/include/features.php index 660ea2975..2d71aa9be 100644 --- a/include/features.php +++ b/include/features.php @@ -52,7 +52,7 @@ function get_features($filtered = true) { array('advanced_profiles', t('Advanced Profiles'), t('Additional profile sections and selections'),false,get_config('feature_lock','advanced_profiles')), array('profile_export', t('Profile Import/Export'), t('Save and load profile details across sites/channels'),false,get_config('feature_lock','profile_export')), array('webpages', t('Web Pages'), t('Provide managed web pages on your channel'),false,get_config('feature_lock','webpages')), - array('wiki', t('Wiki'), t('Provide a wiki for your channel'),true,get_config('feature_lock','wiki')), + array('wiki', t('Wiki'), t('Provide a wiki for your channel'),((UNO) ? false : true),get_config('feature_lock','wiki')), array('hide_rating', t('Hide Rating'), t('Hide the rating buttons on your channel and profile pages. Note: People can still rate you somewhere else.'),false,get_config('feature_lock','hide_rating')), array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders (note: not encrypted)'),false,get_config('feature_lock','private_notes')), array('nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu'),false,get_config('feature_lock','nav_channel_select')), -- cgit v1.2.3