From fbeb33479b454248f377ab22244b5c7e8137a193 Mon Sep 17 00:00:00 2001 From: redmatrix <redmatrix@redmatrix.me> Date: Tue, 29 Dec 2015 11:16:13 -0800 Subject: store perms_accept on channel creation --- include/identity.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 98ba26bd8..cfedd243a 100644 --- a/include/identity.php +++ b/include/identity.php @@ -178,7 +178,7 @@ function create_identity($arr) { $ret = array('success' => false); if(! $arr['account_id']) { - $ret['message'] = t('No account identifier'); + $ret['message'] = t('No account identifier'); return $ret; } $ret = identity_check_service_class($arr['account_id']); @@ -352,7 +352,7 @@ function create_identity($arr) { ); if($role_permissions) { - $myperms = ((array_key_exists('perms_auto',$role_permissions) && $role_permissions['perms_auto']) ? intval($role_permissions['perms_accept']) : 0); + $myperms = ((array_key_exists('perms_accept',$role_permissions)) ? intval($role_permissions['perms_accept']) : 0); } else $myperms = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK -- cgit v1.2.3 From baedd253090e1129dfea8284ee6dc29649286b3b Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Tue, 12 Jan 2016 15:43:08 -0800 Subject: 'auto channel creation' - if the corresponding config variable is set, create a channel when an account is created. Plugins can provide the necessary channel details (probably from an extended registration form). If no details are provided, a social (mostly public) channel will be created using the LHS of the email address and you will be directed to your channel page (unless email verification is required, in which case this step will be delayed until successful validation and login). If the reddress is already assigned a random name(1000-9999) reddress will be assigned. --- include/identity.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index cfedd243a..1d908056f 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1695,3 +1695,45 @@ function profiles_build_sync($channel_id) { build_sync_packet($channel_id,array('profile' => $r)); } } + + +function auto_channel_create($account_id) { + + if(! $account_id) + return false; + + $arr = array(); + $arr['account_id'] = $account_id; + $arr['name'] = get_aconfig($account_id,'register','channel_name'); + $arr['nickname'] = legal_webbie(get_aconfig($account_id,'register','channel_address')); + $arr['permissions_role'] = get_aconfig($account_id,'register','permissions_role'); + + del_aconfig($account_id,'register','channel_name'); + del_aconfig($account_id,'register','channel_address'); + del_aconfig($account_id,'register','permissions_role'); + + if((! $arr['name']) || (! $arr['nickname'])) { + $x = q("select * from account where account_id = %d limit 1", + intval($account_id) + ); + if($x) { + if(! $arr['name']) + $arr['name'] = substr($x[0]['account_email'],0,strpos($x[0]['account_email'],'@')); + if(! $arr['nickname']) + $arr['nickname'] = legal_webbie(substr($x[0]['account_email'],0,strpos($x[0]['account_email'],'@'))); + } + } + if(! $arr['permissions_role']) + $arr['permissions_role'] = 'social'; + + if(validate_channelname($arr['name'])) + return false; + if($arr['nickname'] === 'sys') + $arr['nickname'] = $arr['nickname'] . mt_rand(1000,9999); + + $arr['nickname'] = check_webbie(array($arr['nickname'], $arr['nickname'] . mt_rand(1000,9999))); + + return create_identity($arr); + +} + -- cgit v1.2.3 From 64753effd1cd47c43846e5bc8653180acd7c4bc9 Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Thu, 14 Jan 2016 17:25:27 -0800 Subject: cover photo fetch and widget --- include/identity.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 1d908056f..deccaa299 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1737,3 +1737,38 @@ function auto_channel_create($account_id) { } +function get_cover_photo($channel_id,$format = 'bbcode', $res = PHOTO_RES_COVER_1200) { + + $r = q("select height, width, resource_id, type from photo where uid = %d and scale = %d and photo_usage = %d", + intval($channel_id), + intval($res), + intval(PHOTO_COVER) + ); + if(! $r) + return false; + + $output = false; + + $url = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $res ; + + switch($format) { + case 'bbcode': + $output = '[zrl=' . $r[0]['width'] . 'x' . $r[0]['height'] . ']' . $url . '[/zrl]'; + break; + case 'html': + $output = '<img class="zrl" width="' . $r[0]['width'] . '" height="' . $r[0]['height'] . '" src="' . $url . '" alt="' . t('cover photo') . '" />'; + break; + case 'array': + default: + $output = array( + 'width' => $r[0]['width'], + 'height' => $r[0]['type'], + 'type' => $r[0]['type'], + 'url' => $url + ); + break; + } + + return $output; + +} \ No newline at end of file -- cgit v1.2.3 From 10ed334e8c81d1db4a506716b78ece13dc69266c Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Sun, 17 Jan 2016 16:29:32 -0800 Subject: various issues from the forums --- include/identity.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index deccaa299..2a02d4093 100644 --- a/include/identity.php +++ b/include/identity.php @@ -482,6 +482,8 @@ function identity_basic_export($channel_id, $items = false) { $ret = array(); + // use constants here as otherwise we will have no idea if we can import from a site + // with a non-standard platform and version. $ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION); $r = q("select * from channel where channel_id = %d limit 1", -- cgit v1.2.3 From a036d88a4e6e6a83f9962f0f46094cfdac99d263 Mon Sep 17 00:00:00 2001 From: jeroenpraat <jeroenpraat@xs4all.nl> Date: Mon, 18 Jan 2016 21:37:47 +0100 Subject: Added a feature to hide rating buttons from a members channel and profile pages. --- include/identity.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 2a02d4093..32c4dd130 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1051,8 +1051,10 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) { $tpl = get_markup_template('profile_vcard.tpl'); require_once('include/widgets.php'); - $z = widget_rating(array('target' => $profile['channel_hash'])); + if(! feature_enabled($profile['uid'],'hide_rating')) + $z = widget_rating(array('target' => $profile['channel_hash'])); + $o .= replace_macros($tpl, array( '$profile' => $profile, '$connect' => $connect, @@ -1773,4 +1775,4 @@ function get_cover_photo($channel_id,$format = 'bbcode', $res = PHOTO_RES_COVER_ return $output; -} \ No newline at end of file +} -- cgit v1.2.3 From ae3ca2b7df7cd9a9cfc069d43f7b6d6cd7aae387 Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Wed, 27 Jan 2016 23:02:36 -0800 Subject: block_public_blackout setting --- include/identity.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 32c4dd130..fd0b4d7f5 100644 --- a/include/identity.php +++ b/include/identity.php @@ -924,6 +924,9 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) { $pdesc = true; $reddress = true; + if($block && intval(get_config('system','block_public_blackout'))) + return $o; + if((! is_array($profile)) && (! count($profile))) return $o; @@ -935,6 +938,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) { $show_connect = false; + $profile['picdate'] = urlencode($profile['picdate']); call_hooks('profile_sidebar_enter', $profile); -- cgit v1.2.3 From 08aeeadd7157d48fa3f4aff0cc2b58a314e508d2 Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Fri, 29 Jan 2016 14:07:10 -0800 Subject: move permission check before global block check --- include/identity.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index fd0b4d7f5..e1e79394a 100644 --- a/include/identity.php +++ b/include/identity.php @@ -924,6 +924,10 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) { $pdesc = true; $reddress = true; + if(! perm_is_allowed($profile['uid'],((is_array($observer)) ? $observer['xchan_hash'] : ''),'view_profile')) { + $block = true; + } + if($block && intval(get_config('system','block_public_blackout'))) return $o; @@ -1012,9 +1016,6 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) { // logger('online: ' . $profile['online']); - if(! perm_is_allowed($profile['uid'],((is_array($observer)) ? $observer['xchan_hash'] : ''),'view_profile')) { - $block = true; - } if(($profile['hidewall'] && (! local_channel()) && (! remote_channel())) || $block ) { $location = $reddress = $pdesc = $gender = $marital = $homepage = False; -- cgit v1.2.3 From 723a49cceecf92a87eb34243e824b8deb900f184 Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Mon, 1 Feb 2016 17:42:53 -0800 Subject: add photos to the profile "likes this" dropdowns --- include/identity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index e1e79394a..11b80a46d 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1267,7 +1267,7 @@ function advanced_profile(&$a) { $profile['like_button_label'] = tt('Like','Likes',$profile['like_count'],'noun'); if($likers) { foreach($likers as $l) - $profile['likers'][] = array('name' => $l['xchan_name'],'url' => zid($l['xchan_url'])); + $profile['likers'][] = array('name' => $l['xchan_name'],'photo' => zid($l['xchan_photo_s']), 'url' => zid($l['xchan_url'])); } if(($a->profile['dob']) && ($a->profile['dob'] != '0000-00-00')) { -- cgit v1.2.3 From 5edbc008659141349857363974f3760c41e7a5e5 Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Mon, 1 Feb 2016 21:09:50 -0800 Subject: profile embeds (still needs a bit of work) --- include/identity.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 11b80a46d..037cf5061 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1781,3 +1781,45 @@ function get_cover_photo($channel_id,$format = 'bbcode', $res = PHOTO_RES_COVER_ return $output; } + +function get_zcard($channel,$observer_hash = '',$args = array()) { + + logger('get_zcard'); + + $channel['channel_addr'] = $channel['channel_address'] . '@' . get_app()->get_hostname(); + + $r = q("select height, width, resource_id, scale, type from photo where uid = %d and scale = %d and photo_usage = %d", + intval($channel['channel_id']), + intval(PHOTO_RES_COVER_1200), + intval(PHOTO_COVER) + ); + + if($r) { + $cover = $r[0]; + $cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['scale']; + } + + $pphoto = array('type' => $channel['xchan_photo_mimetype'], + 'width' => 300 , 'height' => 300, 'href' => $channel['xchan_photo_l']); + + $maxwidth = (($args['width']) ? intval($args['width']) : 0); + $maxheight = (($args['height']) ? intval($args['height']) : 0); + + $zcard = array('chan' => $channel); + if(($maxwidth > 1200) || ($maxwidth < 1)) + $maxwidth = 1200; + $scale = (float) $maxwidth / 1200; + + $translate = intval(($scale / 1.0) * 100); + + $o .= replace_macros(get_markup_template('zcard.tpl'),array( + '$scale' => $scale, + '$translate' => $translate, + '$cover' => $cover, + '$pphoto' => $pphoto, + '$zcard' => $zcard + )); + + return $o; + +} \ No newline at end of file -- cgit v1.2.3 From 06dcaaa821d6229568709e53d104233081c4d3e9 Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Tue, 2 Feb 2016 17:14:07 -0800 Subject: some zcard cleanup - still eneds a lot more work --- include/identity.php | 47 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 14 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 037cf5061..76ada577e 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1786,11 +1786,42 @@ function get_zcard($channel,$observer_hash = '',$args = array()) { logger('get_zcard'); + $maxwidth = (($args['width']) ? intval($args['width']) : 0); + $maxheight = (($args['height']) ? intval($args['height']) : 0); + + + if(($maxwidth > 1200) || ($maxwidth < 1)) + $maxwidth = 1200; + + if($maxwidth <= 425) { + $width = 425; + $size = 'hz_small'; + $cover_size = PHOTO_RES_COVER_425; + $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 80 , 'height' => 80, 'href' => $channel['xchan_photo_m']); + } + elseif($maxwidth <= 850) { + $width = 850; + $size = 'hz_medium'; + $cover_size = PHOTO_RES_COVER_850; + $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 160 , 'height' => 160, 'href' => $channel['xchan_photo_l']); + } + elseif($maxwidth <= 1200) { + $width = 1200; + $size = 'hz_large'; + $cover_size = PHOTO_RES_COVER_1200; + $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 300 , 'height' => 300, 'href' => $channel['xchan_photo_l']); + } + +// $scale = (float) $maxwidth / $width; +// $translate = intval(($scale / 1.0) * 100); + + $channel['channel_addr'] = $channel['channel_address'] . '@' . get_app()->get_hostname(); + $zcard = array('chan' => $channel); $r = q("select height, width, resource_id, scale, type from photo where uid = %d and scale = %d and photo_usage = %d", intval($channel['channel_id']), - intval(PHOTO_RES_COVER_1200), + intval($cover_size), intval(PHOTO_COVER) ); @@ -1799,22 +1830,10 @@ function get_zcard($channel,$observer_hash = '',$args = array()) { $cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['scale']; } - $pphoto = array('type' => $channel['xchan_photo_mimetype'], - 'width' => 300 , 'height' => 300, 'href' => $channel['xchan_photo_l']); - - $maxwidth = (($args['width']) ? intval($args['width']) : 0); - $maxheight = (($args['height']) ? intval($args['height']) : 0); - - $zcard = array('chan' => $channel); - if(($maxwidth > 1200) || ($maxwidth < 1)) - $maxwidth = 1200; - $scale = (float) $maxwidth / 1200; - - $translate = intval(($scale / 1.0) * 100); - $o .= replace_macros(get_markup_template('zcard.tpl'),array( '$scale' => $scale, '$translate' => $translate, + '$size' => $size, '$cover' => $cover, '$pphoto' => $pphoto, '$zcard' => $zcard -- cgit v1.2.3 From a7ed50ecd4b4defbc1d5fdf0bb4fd7d65d08a0fd Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Tue, 2 Feb 2016 19:39:47 -0800 Subject: more zcard tweaks --- include/identity.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 76ada577e..4f58d7dc5 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1829,6 +1829,10 @@ function get_zcard($channel,$observer_hash = '',$args = array()) { $cover = $r[0]; $cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['scale']; } + else { + // @fixme remove this when we have a fallback cover photo and use that instead. + return; + } $o .= replace_macros(get_markup_template('zcard.tpl'),array( '$scale' => $scale, -- cgit v1.2.3 From 9c3568800cfec34bd24844d0b120a4b195c17e93 Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Thu, 4 Feb 2016 23:59:09 -0800 Subject: remove blackout setting now that the keepout plugin performs the same tasks (plus a lot more) --- include/identity.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 4f58d7dc5..898827525 100644 --- a/include/identity.php +++ b/include/identity.php @@ -928,9 +928,6 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) { $block = true; } - if($block && intval(get_config('system','block_public_blackout'))) - return $o; - if((! is_array($profile)) && (! count($profile))) return $o; -- cgit v1.2.3 From 021584d782c5bfafaa5ffe26d0c5850c8fffdd8f Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Fri, 5 Feb 2016 23:45:16 -0800 Subject: fix uno import by disabling for now --- include/identity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 898827525..0b9842caf 100644 --- a/include/identity.php +++ b/include/identity.php @@ -484,7 +484,7 @@ function identity_basic_export($channel_id, $items = false) { // use constants here as otherwise we will have no idea if we can import from a site // with a non-standard platform and version. - $ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION); + $ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION, 'server_role' => UNO ); $r = q("select * from channel where channel_id = %d limit 1", intval($channel_id) -- cgit v1.2.3 From d8e6fd5df0713ef4f52277944d15fd8230deec81 Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Sun, 7 Feb 2016 18:11:10 -0800 Subject: provide get_server_role() to abstract different roles and capabilities --- include/identity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 0b9842caf..641f188f4 100644 --- a/include/identity.php +++ b/include/identity.php @@ -484,7 +484,7 @@ function identity_basic_export($channel_id, $items = false) { // use constants here as otherwise we will have no idea if we can import from a site // with a non-standard platform and version. - $ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION, 'server_role' => UNO ); + $ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION, 'server_role' => get_server_role()); $r = q("select * from channel where channel_id = %d limit 1", intval($channel_id) -- cgit v1.2.3 From 315ce6d880855444c0cea683810b9b2fbd80c0d3 Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Mon, 8 Feb 2016 18:16:42 -0800 Subject: lots more zcard tweaks --- include/identity.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 641f188f4..9d41e9633 100644 --- a/include/identity.php +++ b/include/identity.php @@ -913,7 +913,7 @@ function profile_load(&$a, $nickname, $profile = '') { * @return HTML string suitable for sidebar inclusion * Exceptions: Returns empty string if passed $profile is wrong type or not populated */ -function profile_sidebar($profile, $block = 0, $show_connect = true) { +function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = false) { $a = get_app(); @@ -1056,8 +1056,9 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) { if(! feature_enabled($profile['uid'],'hide_rating')) $z = widget_rating(array('target' => $profile['channel_hash'])); - + $o .= replace_macros($tpl, array( + '$zcard' => $zcard, '$profile' => $profile, '$connect' => $connect, '$connect_url' => $connect_url, @@ -1796,8 +1797,8 @@ function get_zcard($channel,$observer_hash = '',$args = array()) { $cover_size = PHOTO_RES_COVER_425; $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 80 , 'height' => 80, 'href' => $channel['xchan_photo_m']); } - elseif($maxwidth <= 850) { - $width = 850; + elseif($maxwidth <= 900) { + $width = 900; $size = 'hz_medium'; $cover_size = PHOTO_RES_COVER_850; $pphoto = array('type' => $channel['xchan_photo_mimetype'], 'width' => 160 , 'height' => 160, 'href' => $channel['xchan_photo_l']); @@ -1832,6 +1833,7 @@ function get_zcard($channel,$observer_hash = '',$args = array()) { } $o .= replace_macros(get_markup_template('zcard.tpl'),array( + '$maxwidth' => $maxwidth, '$scale' => $scale, '$translate' => $translate, '$size' => $size, -- cgit v1.2.3 From f984502499c836cde0be647907be505508c04e0c Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Mon, 8 Feb 2016 19:33:25 -0800 Subject: need to re-arrange a few things for a short vcard --- include/identity.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 9d41e9633..51744f7bf 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1050,7 +1050,10 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa $channel_menu .= comanche_block($menublock); } - $tpl = get_markup_template('profile_vcard.tpl'); + if($zcard) + $tpl = get_markup_template('profile_vcard_short.tpl'); + else + $tpl = get_markup_template('profile_vcard.tpl'); require_once('include/widgets.php'); -- cgit v1.2.3 From 342fda94e4162634eeb67c18c1d284e7d78f217f Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Thu, 18 Feb 2016 15:24:58 -0800 Subject: Provide Zotlabs\Project and System class for querying details about the project/version info. Move these out of /boot.php --- include/identity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 51744f7bf..717deca14 100644 --- a/include/identity.php +++ b/include/identity.php @@ -484,7 +484,7 @@ function identity_basic_export($channel_id, $items = false) { // use constants here as otherwise we will have no idea if we can import from a site // with a non-standard platform and version. - $ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION, 'server_role' => get_server_role()); + $ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION, 'server_role' => Zotlabs\Project\System::get_server_role()); $r = q("select * from channel where channel_id = %d limit 1", intval($channel_id) -- cgit v1.2.3 From 02e82e496e3ec8dbd8264248ad8550dd5e335cba Mon Sep 17 00:00:00 2001 From: Mario Vavti <mario@mariovavti.com> Date: Fri, 19 Feb 2016 22:28:21 +0100 Subject: pimp up mod new_channel --- include/identity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 717deca14..a389a613e 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1847,4 +1847,4 @@ function get_zcard($channel,$observer_hash = '',$args = array()) { return $o; -} \ No newline at end of file +} -- cgit v1.2.3 From b2474334a7b7f009442883a08d544280231b29fc Mon Sep 17 00:00:00 2001 From: Mario Vavti <mario@mariovavti.com> Date: Thu, 25 Feb 2016 22:50:16 +0100 Subject: provide an edit button for the profile page --- include/identity.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index a389a613e..0a88ed208 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1237,10 +1237,6 @@ function advanced_profile(&$a) { if(! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_profile')) return ''; - $o = ''; - - $o .= '<h2>' . t('Profile') . '</h2>'; - if($a->profile['name']) { $tpl = get_markup_template('profile_advanced.tpl'); @@ -1351,6 +1347,10 @@ function advanced_profile(&$a) { $profile['extra_fields'] = $a->profile['extra_fields']; } + + $is_owner = (($a->profile['profile_uid'] == local_channel()) ? true : false); + $edit = (($is_owner) ? array('link' => $a->get_baseurl() . '/profiles/' . $a->profile['profile_uid'], 'label' => t('Edit')) : ''); + $things = get_things($a->profile['profile_guid'],$a->profile['profile_uid']); // logger('mod_profile: things: ' . print_r($things,true), LOGGER_DATA); @@ -1360,6 +1360,7 @@ function advanced_profile(&$a) { '$canlike' => (($profile['canlike'])? true : false), '$likethis' => t('Like this thing'), '$profile' => $profile, + '$edit' => $edit, '$things' => $things )); } -- cgit v1.2.3 From dc8c7a2d2e8060d295c46637e2f1caac76aca6fa Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Thu, 25 Feb 2016 16:21:38 -0800 Subject: small improvements to profile like activity --- include/identity.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 0a88ed208..caf2de710 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1832,8 +1832,7 @@ function get_zcard($channel,$observer_hash = '',$args = array()) { $cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['scale']; } else { - // @fixme remove this when we have a fallback cover photo and use that instead. - return; + $cover = $pphoto; } $o .= replace_macros(get_markup_template('zcard.tpl'),array( -- cgit v1.2.3 From d27a627c4f65ca67bcc0f46fb830368c713043cd Mon Sep 17 00:00:00 2001 From: Mario Vavti <mario@mariovavti.com> Date: Mon, 29 Feb 2016 22:01:13 +0100 Subject: simplify profile edit button(s) and make it useful for multiple profiles --- include/identity.php | 92 +++++++++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 41 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index caf2de710..dc60e661c 100644 --- a/include/identity.php +++ b/include/identity.php @@ -900,6 +900,55 @@ function profile_load(&$a, $nickname, $profile = '') { } +function profile_edit_menu($uid) { + + $a = get_app(); + $ret = array(); + + $is_owner = (($uid == local_channel()) ? true : false); + + // show edit profile to profile owner + if($is_owner) { + $ret['menu'] = array( + 'chg_photo' => t('Change profile photo'), + 'entries' => array(), + ); + + $multi_profiles = feature_enabled(local_channel(), 'multi_profiles'); + if($multi_profiles) { + $ret['multi'] = 1; + $ret['edit'] = array($a->get_baseurl(). '/profiles', t('Edit Profiles'), '', t('Edit')); + $ret['menu']['cr_new'] = t('Create New Profile'); + } + else { + $ret['edit'] = array($a->get_baseurl() . '/profiles/' . $uid, t('Edit Profile'), '', t('Edit')); + } + + $r = q("SELECT * FROM profile WHERE uid = %d", + local_channel() + ); + + if($r) { + foreach($r as $rr) { + if(!($multi_profiles || $rr['is_default'])) + continue; + $ret['menu']['entries'][] = array( + 'photo' => $rr['thumb'], + 'id' => $rr['id'], + 'alt' => t('Profile Image'), + 'profile_name' => $rr['profile_name'], + 'isdefault' => $rr['is_default'], + 'visible_to_everybody' => t('Visible to everybody'), + 'edit_visibility' => t('Edit visibility'), + ); + } + } + } + + return $ret; + +} + /** * @brief Formats a profile for display in the sidebar. * @@ -961,42 +1010,6 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa $connect_url = z_root() . '/connect/' . $profile['channel_address']; } - // show edit profile to yourself - if($is_owner) { - $profile['menu'] = array( - 'chg_photo' => t('Change profile photo'), - 'entries' => array(), - ); - - $multi_profiles = feature_enabled(local_channel(), 'multi_profiles'); - if($multi_profiles) { - $profile['edit'] = array($a->get_baseurl(). '/profiles', t('Profiles'),"", t('Manage/edit profiles')); - $profile['menu']['cr_new'] = t('Create New Profile'); - } - else - $profile['edit'] = array($a->get_baseurl() . '/profiles/' . $profile['id'], t('Edit Profile'),'',t('Edit Profile')); - - $r = q("SELECT * FROM `profile` WHERE `uid` = %d", - local_channel()); - - if($r) { - foreach($r as $rr) { - if(!($multi_profiles || $rr['is_default'])) - continue; - $profile['menu']['entries'][] = array( - 'photo' => $rr['thumb'], - 'id' => $rr['id'], - 'alt' => t('Profile Image'), - 'profile_name' => $rr['profile_name'], - 'isdefault' => $rr['is_default'], - 'visible_to_everybody' => t('visible to everybody'), - 'edit_visibility' => t('Edit visibility'), - ); - } - } - } - - if((x($profile,'address') == 1) || (x($profile,'locality') == 1) || (x($profile,'region') == 1) @@ -1075,6 +1088,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa '$reddress' => $reddress, '$rating' => $z, '$contact_block' => $contact_block, + '$editmenu' => profile_edit_menu($profile['uid']) )); $arr = array('profile' => &$profile, 'entry' => &$o); @@ -1347,10 +1361,6 @@ function advanced_profile(&$a) { $profile['extra_fields'] = $a->profile['extra_fields']; } - - $is_owner = (($a->profile['profile_uid'] == local_channel()) ? true : false); - $edit = (($is_owner) ? array('link' => $a->get_baseurl() . '/profiles/' . $a->profile['profile_uid'], 'label' => t('Edit')) : ''); - $things = get_things($a->profile['profile_guid'],$a->profile['profile_uid']); // logger('mod_profile: things: ' . print_r($things,true), LOGGER_DATA); @@ -1360,7 +1370,7 @@ function advanced_profile(&$a) { '$canlike' => (($profile['canlike'])? true : false), '$likethis' => t('Like this thing'), '$profile' => $profile, - '$edit' => $edit, + '$editmenu' => profile_edit_menu($a->profile['profile_uid']), '$things' => $things )); } -- cgit v1.2.3 From 3f90da5643e36cd09b53043f05a3e3e2dea6d90a Mon Sep 17 00:00:00 2001 From: Mario Vavti <mario@mariovavti.com> Date: Mon, 29 Feb 2016 22:07:14 +0100 Subject: remove unused variable --- include/identity.php | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index dc60e661c..15a4ae8ad 100644 --- a/include/identity.php +++ b/include/identity.php @@ -982,13 +982,9 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa head_set_icon($profile['thumb']); - $is_owner = (($profile['uid'] == local_channel()) ? true : false); - if(is_sys_channel($profile['uid'])) $show_connect = false; - - $profile['picdate'] = urlencode($profile['picdate']); call_hooks('profile_sidebar_enter', $profile); -- cgit v1.2.3 From be2b7c0b5f7f9b8080affbb4bc44c5adda18e82f Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Mon, 29 Feb 2016 19:31:52 -0800 Subject: abconfig --- include/identity.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index caf2de710..478079d39 100644 --- a/include/identity.php +++ b/include/identity.php @@ -505,8 +505,12 @@ function identity_basic_export($channel_id, $items = false) { if($r) { $ret['abook'] = $r; - foreach($r as $rr) - $xchans[] = $rr['abook_xchan']; + for($x = 0; $x < count($ret['abook']); $x ++) { + $xchans[] = $ret['abook'][$x]['abook_chan']; + $abconfig = load_abconfig($ret['channel']['channel_hash'],$ret['abook'][$x]['abook_xchan']); + if($abconfig) + $ret['abook'][$x]['abconfig'] = $abconfig; + } stringify_array_elms($xchans); } -- cgit v1.2.3 From 765dd5569b9ce2f18ac9974123d96452d0d19926 Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Tue, 1 Mar 2016 14:55:04 -0800 Subject: Allow configuration of the display order of profile fields. This is an important piece of a more general profile configuration framework which will eventually be accessible via the admin page. --- include/identity.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 380556246..382b096fe 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1253,6 +1253,24 @@ function advanced_profile(&$a) { if($a->profile['name']) { + $profile_fields_basic = get_profile_fields_basic(); + $profile_fields_advanced = get_profile_fields_advanced(); + + $advanced = ((feature_enabled($a->profile['profile_uid'],'advanced_profiles')) ? true : false); + if($advanced) + $fields = $profile_fields_advanced; + else + $fields = $profile_fields_basic; + + $clean_fields = array(); + if($fields) { + foreach($fields as $k => $v) { + $clean_fields[] = trim($k); + } + } + + + $tpl = get_markup_template('profile_advanced.tpl'); $profile = array(); @@ -1370,6 +1388,7 @@ function advanced_profile(&$a) { '$canlike' => (($profile['canlike'])? true : false), '$likethis' => t('Like this thing'), '$profile' => $profile, + '$fields' => $clean_fields, '$editmenu' => profile_edit_menu($a->profile['profile_uid']), '$things' => $things )); -- cgit v1.2.3 From 548bf884a4b34a4881f3188e54c592597f755dc9 Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Tue, 1 Mar 2016 21:06:27 -0800 Subject: profile field admin page (functional only: still needs a lot of HTML/CSS cleanup) --- include/identity.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 382b096fe..0a461dbe4 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1652,7 +1652,7 @@ function get_profile_fields_basic($filter = 0) { $profile_fields_basic = (($filter == 0) ? get_config('system','profile_fields_basic') : null); if(! $profile_fields_basic) - $profile_fields_basic = array('name','pdesc','chandesc','gender','dob','dob_tz','address','locality','region','postal_code','country_name','marital','sexual','homepage','hometown','keywords','about','contact'); + $profile_fields_basic = array('name','pdesc','chandesc','gender','dob','dob_tz','address','locality','region','postal_code','country_name','marital','with','howlong','sexual','homepage','hometown','keywords','about','contact'); $x = array(); if($profile_fields_basic) @@ -1667,7 +1667,7 @@ function get_profile_fields_advanced($filter = 0) { $basic = get_profile_fields_basic($filter); $profile_fields_advanced = (($filter == 0) ? get_config('system','profile_fields_advanced') : null); if(! $profile_fields_advanced) - $profile_fields_advanced = array('with','howlong','politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','work','education'); + $profile_fields_advanced = array('politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','work','education'); $x = array(); if($basic) -- cgit v1.2.3 From 428b4dbad63d429c3b0d47b49ff5918dbda3c596 Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Tue, 1 Mar 2016 22:47:07 -0800 Subject: sort out the with and howlong dependencies --- include/identity.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 0a461dbe4..382b096fe 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1652,7 +1652,7 @@ function get_profile_fields_basic($filter = 0) { $profile_fields_basic = (($filter == 0) ? get_config('system','profile_fields_basic') : null); if(! $profile_fields_basic) - $profile_fields_basic = array('name','pdesc','chandesc','gender','dob','dob_tz','address','locality','region','postal_code','country_name','marital','with','howlong','sexual','homepage','hometown','keywords','about','contact'); + $profile_fields_basic = array('name','pdesc','chandesc','gender','dob','dob_tz','address','locality','region','postal_code','country_name','marital','sexual','homepage','hometown','keywords','about','contact'); $x = array(); if($profile_fields_basic) @@ -1667,7 +1667,7 @@ function get_profile_fields_advanced($filter = 0) { $basic = get_profile_fields_basic($filter); $profile_fields_advanced = (($filter == 0) ? get_config('system','profile_fields_advanced') : null); if(! $profile_fields_advanced) - $profile_fields_advanced = array('politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','work','education'); + $profile_fields_advanced = array('with','howlong','politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','work','education'); $x = array(); if($basic) -- cgit v1.2.3 From eca119d695603680541a715d9d91d33f888653bb Mon Sep 17 00:00:00 2001 From: jeroenpraat <jeroenpraat@xs4all.nl> Date: Thu, 17 Mar 2016 15:48:44 +0100 Subject: See issue https://github.com/redmatrix/hubzilla-addons/issues/17 (UNO: enable the Diaspora protocol for all channels (if addon is enabled) - I had to do this during channel creation and not in the addon itself, or else the member can't change this after the channel is created. Tested it on UNO and normal Hubzilla. If this is not the right place for this, please move it. If not wanted at all, please discuss. --- include/identity.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 382b096fe..5d18d69e0 100644 --- a/include/identity.php +++ b/include/identity.php @@ -410,7 +410,15 @@ function create_identity($arr) { set_pconfig($ret['channel']['channel_id'],'system','photo_path', '%Y-%m'); set_pconfig($ret['channel']['channel_id'],'system','attach_path','%Y-%m'); } - + + // UNO: channel defaults, incl addons (addons specific pconfig will only work after the relevant addon is enabled by the admin). It's located here, so members can modify these defaults after the channel is created. + if(UNO) { + //diaspora protocol addon + set_pconfig($ret['channel']['channel_id'],'system','diaspora_allowed', '1'); + set_pconfig($ret['channel']['channel_id'],'system','diaspora_public_comments', '1'); + set_pconfig($ret['channel']['channel_id'],'system','prevent_tag_hijacking', '0'); + } + // auto-follow any of the hub's pre-configured channel choices. // Only do this if it's the first channel for this account; // otherwise it could get annoying. Don't make this list too big -- cgit v1.2.3 From 1cd3b4182595b838a535dd6b6990251db05d49e6 Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Wed, 30 Mar 2016 22:13:24 -0700 Subject: deprecate $a->get_baseurl() --- include/identity.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 5d18d69e0..03049639d 100644 --- a/include/identity.php +++ b/include/identity.php @@ -321,9 +321,9 @@ function create_identity($arr) { dbesc($guid), dbesc($sig), dbesc($key['pubkey']), - dbesc($a->get_baseurl() . "/photo/profile/l/{$newuid}"), - dbesc($a->get_baseurl() . "/photo/profile/m/{$newuid}"), - dbesc($a->get_baseurl() . "/photo/profile/s/{$newuid}"), + dbesc(z_root() . "/photo/profile/l/{$newuid}"), + dbesc(z_root() . "/photo/profile/m/{$newuid}"), + dbesc(z_root() . "/photo/profile/s/{$newuid}"), dbesc($ret['channel']['channel_address'] . '@' . get_app()->get_hostname()), dbesc(z_root() . '/channel/' . $ret['channel']['channel_address']), dbesc(z_root() . '/follow?f=&url=%s'), @@ -347,8 +347,8 @@ function create_identity($arr) { 1, $publish, dbesc($ret['channel']['channel_name']), - dbesc($a->get_baseurl() . "/photo/profile/l/{$newuid}"), - dbesc($a->get_baseurl() . "/photo/profile/m/{$newuid}") + dbesc(z_root() . "/photo/profile/l/{$newuid}"), + dbesc(z_root() . "/photo/profile/m/{$newuid}") ); if($role_permissions) { @@ -929,11 +929,11 @@ function profile_edit_menu($uid) { $multi_profiles = feature_enabled(local_channel(), 'multi_profiles'); if($multi_profiles) { $ret['multi'] = 1; - $ret['edit'] = array($a->get_baseurl(). '/profiles', t('Edit Profiles'), '', t('Edit')); + $ret['edit'] = array(z_root(). '/profiles', t('Edit Profiles'), '', t('Edit')); $ret['menu']['cr_new'] = t('Create New Profile'); } else { - $ret['edit'] = array($a->get_baseurl() . '/profiles/' . $uid, t('Edit Profile'), '', t('Edit')); + $ret['edit'] = array(z_root() . '/profiles/' . $uid, t('Edit Profile'), '', t('Edit')); } $r = q("SELECT * FROM profile WHERE uid = %d", @@ -1159,7 +1159,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa $url = $rr['url']; if($rr['network'] === NETWORK_DFRN) { $sparkle = " sparkle"; - $url = $a->get_baseurl() . '/redir/' . $rr['cid']; + $url = z_root() . '/redir/' . $rr['cid']; } $rr['link'] = $url; @@ -1172,7 +1172,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa } $tpl = get_markup_template("birthdays_reminder.tpl"); return replace_macros($tpl, array( - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$classtoday' => $classtoday, '$count' => $total, '$event_reminders' => t('Birthday Reminders'), @@ -1244,7 +1244,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa $tpl = get_markup_template("events_reminder.tpl"); return replace_macros($tpl, array( - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$classtoday' => $classtoday, '$count' => count($r), '$event_reminders' => t('Event Reminders'), -- cgit v1.2.3 From 9abd95fad3784a10fc48bc40f9b8a75d7d74edda Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Thu, 31 Mar 2016 16:06:03 -0700 Subject: static App --- include/identity.php | 154 +++++++++++++++++++++++++-------------------------- 1 file changed, 77 insertions(+), 77 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 03049639d..67fd63aaf 100644 --- a/include/identity.php +++ b/include/identity.php @@ -275,7 +275,7 @@ function create_identity($arr) { intval($pageflags), intval($system), intval($expire), - dbesc($a->timezone) + dbesc(App::$timezone) ); $r = q("select * from channel where channel_account_id = %d @@ -302,11 +302,11 @@ function create_identity($arr) { dbesc($guid), dbesc($sig), dbesc($hash), - dbesc($ret['channel']['channel_address'] . '@' . get_app()->get_hostname()), + dbesc($ret['channel']['channel_address'] . '@' . App::get_hostname()), intval($primary), dbesc(z_root()), dbesc(base64url_encode(rsa_sign(z_root(),$ret['channel']['channel_prvkey']))), - dbesc(get_app()->get_hostname()), + dbesc(App::get_hostname()), dbesc(z_root() . '/post'), dbesc(get_config('system','pubkey')), dbesc('zot') @@ -324,7 +324,7 @@ function create_identity($arr) { dbesc(z_root() . "/photo/profile/l/{$newuid}"), dbesc(z_root() . "/photo/profile/m/{$newuid}"), dbesc(z_root() . "/photo/profile/s/{$newuid}"), - dbesc($ret['channel']['channel_address'] . '@' . get_app()->get_hostname()), + dbesc($ret['channel']['channel_address'] . '@' . App::get_hostname()), dbesc(z_root() . '/channel/' . $ret['channel']['channel_address']), dbesc(z_root() . '/follow?f=&url=%s'), dbesc(z_root() . '/poco/' . $ret['channel']['channel_address']), @@ -780,14 +780,14 @@ function profile_load(&$a, $nickname, $profile = '') { ); if(! $user) { - logger('profile error: ' . $a->query_string, LOGGER_DEBUG); + logger('profile error: ' . App::$query_string, LOGGER_DEBUG); notice( t('Requested channel is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } // get the current observer - $observer = $a->get_observer(); + $observer = App::get_observer(); $can_view_profile = true; @@ -826,9 +826,9 @@ function profile_load(&$a, $nickname, $profile = '') { } if(! $p) { - logger('profile error: ' . $a->query_string, LOGGER_DEBUG); + logger('profile error: ' . App::$query_string, LOGGER_DEBUG); notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } @@ -885,23 +885,23 @@ function profile_load(&$a, $nickname, $profile = '') { if($p[0]['keywords']) { $keywords = str_replace(array('#',',',' ',',,'),array('',' ',',',','),$p[0]['keywords']); if(strlen($keywords) && $can_view_profile) - $a->page['htmlhead'] .= '<meta name="keywords" content="' . htmlentities($keywords,ENT_COMPAT,'UTF-8') . '" />' . "\r\n" ; + App::$page['htmlhead'] .= '<meta name="keywords" content="' . htmlentities($keywords,ENT_COMPAT,'UTF-8') . '" />' . "\r\n" ; } - $a->profile = $p[0]; - $a->profile_uid = $p[0]['profile_uid']; - $a->page['title'] = $a->profile['channel_name'] . " - " . $a->profile['channel_address'] . "@" . $a->get_hostname(); + App::$profile = $p[0]; + App::$profile_uid = $p[0]['profile_uid']; + App::$page['title'] = App::$profile['channel_name'] . " - " . App::$profile['channel_address'] . "@" . App::get_hostname(); - $a->profile['permission_to_view'] = $can_view_profile; + App::$profile['permission_to_view'] = $can_view_profile; if($can_view_profile) { $online = get_online_status($nickname); - $a->profile['online_status'] = $online['result']; + App::$profile['online_status'] = $online['result']; } if(local_channel()) { - $a->profile['channel_mobile_theme'] = get_pconfig(local_channel(),'system', 'mobile_theme'); - $_SESSION['mobile_theme'] = $a->profile['channel_mobile_theme']; + App::$profile['channel_mobile_theme'] = get_pconfig(local_channel(),'system', 'mobile_theme'); + $_SESSION['mobile_theme'] = App::$profile['channel_mobile_theme']; } /* @@ -978,7 +978,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa $a = get_app(); - $observer = $a->get_observer(); + $observer = App::get_observer(); $o = ''; $location = false; @@ -1010,7 +1010,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa $connect_url = rconnect_url($profile['uid'],get_observer_hash()); $connect = (($connect_url) ? t('Connect') : ''); if($connect_url) - $connect_url = sprintf($connect_url,urlencode($profile['channel_address'] . '@' . $a->get_hostname())); + $connect_url = sprintf($connect_url,urlencode($profile['channel_address'] . '@' . App::get_hostname())); // premium channel - over-ride @@ -1164,7 +1164,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa $rr['link'] = $url; $rr['title'] = $rr['name']; - $rr['date'] = day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . t('[today]') : ''); + $rr['date'] = day_translate(datetime_convert('UTC', App::$timezone, $rr['start'], $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . t('[today]') : ''); $rr['startime'] = Null; $rr['today'] = $today; } @@ -1214,15 +1214,15 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa if(strlen($rr['name'])) $total ++; - $strt = datetime_convert('UTC',$rr['convert'] ? $a->timezone : 'UTC',$rr['start'],'Y-m-d'); - if($strt === datetime_convert('UTC',$a->timezone,'now','Y-m-d')) + $strt = datetime_convert('UTC',$rr['convert'] ? App::$timezone : 'UTC',$rr['start'],'Y-m-d'); + if($strt === datetime_convert('UTC',App::$timezone,'now','Y-m-d')) $istoday = true; } $classtoday = (($istoday) ? 'event-today' : ''); foreach($r as &$rr) { if($rr['adjust']) - $md = datetime_convert('UTC',$a->timezone,$rr['start'],'Y/m'); + $md = datetime_convert('UTC',App::$timezone,$rr['start'],'Y/m'); else $md = datetime_convert('UTC','UTC',$rr['start'],'Y/m'); $md .= "/#link-".$rr['id']; @@ -1231,12 +1231,12 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa if(! $title) $title = t('[No description]'); - $strt = datetime_convert('UTC',$rr['convert'] ? $a->timezone : 'UTC',$rr['start']); - $today = ((substr($strt,0,10) === datetime_convert('UTC',$a->timezone,'now','Y-m-d')) ? true : false); + $strt = datetime_convert('UTC',$rr['convert'] ? App::$timezone : 'UTC',$rr['start']); + $today = ((substr($strt,0,10) === datetime_convert('UTC',App::$timezone,'now','Y-m-d')) ? true : false); $rr['link'] = $md; $rr['title'] = $title; - $rr['date'] = day_translate(datetime_convert('UTC', $rr['adjust'] ? $a->timezone : 'UTC', $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : ''); + $rr['date'] = day_translate(datetime_convert('UTC', $rr['adjust'] ? App::$timezone : 'UTC', $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : ''); $rr['startime'] = $strt; $rr['today'] = $today; } @@ -1256,15 +1256,15 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa function advanced_profile(&$a) { require_once('include/text.php'); - if(! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_profile')) + if(! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'view_profile')) return ''; - if($a->profile['name']) { + if(App::$profile['name']) { $profile_fields_basic = get_profile_fields_basic(); $profile_fields_advanced = get_profile_fields_advanced(); - $advanced = ((feature_enabled($a->profile['profile_uid'],'advanced_profiles')) ? true : false); + $advanced = ((feature_enabled(App::$profile['profile_uid'],'advanced_profiles')) ? true : false); if($advanced) $fields = $profile_fields_advanced; else @@ -1283,19 +1283,19 @@ function advanced_profile(&$a) { $profile = array(); - $profile['fullname'] = array( t('Full Name:'), $a->profile['name'] ) ; + $profile['fullname'] = array( t('Full Name:'), App::$profile['name'] ) ; - if($a->profile['gender']) $profile['gender'] = array( t('Gender:'), $a->profile['gender'] ); + if(App::$profile['gender']) $profile['gender'] = array( t('Gender:'), App::$profile['gender'] ); $ob_hash = get_observer_hash(); - if($ob_hash && perm_is_allowed($a->profile['profile_uid'],$ob_hash,'post_like')) { + if($ob_hash && perm_is_allowed(App::$profile['profile_uid'],$ob_hash,'post_like')) { $profile['canlike'] = true; $profile['likethis'] = t('Like this channel'); - $profile['profile_guid'] = $a->profile['profile_guid']; + $profile['profile_guid'] = App::$profile['profile_guid']; } $likers = q("select liker, xchan.* from likes left join xchan on liker = xchan_hash where channel_id = %d and target_type = '%s' and verb = '%s'", - intval($a->profile['profile_uid']), + intval(App::$profile['profile_uid']), dbesc(ACTIVITY_OBJ_PROFILE), dbesc(ACTIVITY_LIKE) ); @@ -1307,87 +1307,87 @@ function advanced_profile(&$a) { $profile['likers'][] = array('name' => $l['xchan_name'],'photo' => zid($l['xchan_photo_s']), 'url' => zid($l['xchan_url'])); } - if(($a->profile['dob']) && ($a->profile['dob'] != '0000-00-00')) { + if((App::$profile['dob']) && (App::$profile['dob'] != '0000-00-00')) { $val = ''; - if((substr($a->profile['dob'],5,2) === '00') || (substr($a->profile['dob'],8,2) === '00')) - $val = substr($a->profile['dob'],0,4); + if((substr(App::$profile['dob'],5,2) === '00') || (substr(App::$profile['dob'],8,2) === '00')) + $val = substr(App::$profile['dob'],0,4); $year_bd_format = t('j F, Y'); $short_bd_format = t('j F'); if(! $val) { - $val = ((intval($a->profile['dob'])) - ? day_translate(datetime_convert('UTC','UTC',$a->profile['dob'] . ' 00:00 +00:00',$year_bd_format)) - : day_translate(datetime_convert('UTC','UTC','2001-' . substr($a->profile['dob'],5) . ' 00:00 +00:00',$short_bd_format))); + $val = ((intval(App::$profile['dob'])) + ? day_translate(datetime_convert('UTC','UTC',App::$profile['dob'] . ' 00:00 +00:00',$year_bd_format)) + : day_translate(datetime_convert('UTC','UTC','2001-' . substr(App::$profile['dob'],5) . ' 00:00 +00:00',$short_bd_format))); } $profile['birthday'] = array( t('Birthday:'), $val); } - if($age = age($a->profile['dob'],$a->profile['timezone'],'')) + if($age = age(App::$profile['dob'],App::$profile['timezone'],'')) $profile['age'] = array( t('Age:'), $age ); - if($a->profile['marital']) - $profile['marital'] = array( t('Status:'), $a->profile['marital']); + if(App::$profile['marital']) + $profile['marital'] = array( t('Status:'), App::$profile['marital']); - if($a->profile['with']) - $profile['marital']['with'] = bbcode($a->profile['with']); + if(App::$profile['with']) + $profile['marital']['with'] = bbcode(App::$profile['with']); - if(strlen($a->profile['howlong']) && $a->profile['howlong'] !== NULL_DATE) { - $profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s')); + if(strlen(App::$profile['howlong']) && App::$profile['howlong'] !== NULL_DATE) { + $profile['howlong'] = relative_date(App::$profile['howlong'], t('for %1$d %2$s')); } - if($a->profile['sexual']) $profile['sexual'] = array( t('Sexual Preference:'), $a->profile['sexual'] ); + if(App::$profile['sexual']) $profile['sexual'] = array( t('Sexual Preference:'), App::$profile['sexual'] ); - if($a->profile['homepage']) $profile['homepage'] = array( t('Homepage:'), linkify($a->profile['homepage']) ); + if(App::$profile['homepage']) $profile['homepage'] = array( t('Homepage:'), linkify(App::$profile['homepage']) ); - if($a->profile['hometown']) $profile['hometown'] = array( t('Hometown:'), linkify($a->profile['hometown']) ); + if(App::$profile['hometown']) $profile['hometown'] = array( t('Hometown:'), linkify(App::$profile['hometown']) ); - if($a->profile['keywords']) $profile['keywords'] = array( t('Tags:'), $a->profile['keywords']); + if(App::$profile['keywords']) $profile['keywords'] = array( t('Tags:'), App::$profile['keywords']); - if($a->profile['politic']) $profile['politic'] = array( t('Political Views:'), $a->profile['politic']); + if(App::$profile['politic']) $profile['politic'] = array( t('Political Views:'), App::$profile['politic']); - if($a->profile['religion']) $profile['religion'] = array( t('Religion:'), $a->profile['religion']); + if(App::$profile['religion']) $profile['religion'] = array( t('Religion:'), App::$profile['religion']); - if($txt = prepare_text($a->profile['about'])) $profile['about'] = array( t('About:'), $txt ); + if($txt = prepare_text(App::$profile['about'])) $profile['about'] = array( t('About:'), $txt ); - if($txt = prepare_text($a->profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt); + if($txt = prepare_text(App::$profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt); - if($txt = prepare_text($a->profile['likes'])) $profile['likes'] = array( t('Likes:'), $txt); + if($txt = prepare_text(App::$profile['likes'])) $profile['likes'] = array( t('Likes:'), $txt); - if($txt = prepare_text($a->profile['dislikes'])) $profile['dislikes'] = array( t('Dislikes:'), $txt); + if($txt = prepare_text(App::$profile['dislikes'])) $profile['dislikes'] = array( t('Dislikes:'), $txt); - if($txt = prepare_text($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt); + if($txt = prepare_text(App::$profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt); - if($txt = prepare_text($a->profile['channels'])) $profile['channels'] = array( t('My other channels:'), $txt); + if($txt = prepare_text(App::$profile['channels'])) $profile['channels'] = array( t('My other channels:'), $txt); - if($txt = prepare_text($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt); + if($txt = prepare_text(App::$profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt); - if($txt = prepare_text($a->profile['book'])) $profile['book'] = array( t('Books, literature:'), $txt); + if($txt = prepare_text(App::$profile['book'])) $profile['book'] = array( t('Books, literature:'), $txt); - if($txt = prepare_text($a->profile['tv'])) $profile['tv'] = array( t('Television:'), $txt); + if($txt = prepare_text(App::$profile['tv'])) $profile['tv'] = array( t('Television:'), $txt); - if($txt = prepare_text($a->profile['film'])) $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt); + if($txt = prepare_text(App::$profile['film'])) $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt); - if($txt = prepare_text($a->profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt); + if($txt = prepare_text(App::$profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt); - if($txt = prepare_text($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt); + if($txt = prepare_text(App::$profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt); - if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt ); + if($txt = prepare_text(App::$profile['education'])) $profile['education'] = array( t('School/education:'), $txt ); - if($a->profile['extra_fields']) { - foreach($a->profile['extra_fields'] as $f) { + if(App::$profile['extra_fields']) { + foreach(App::$profile['extra_fields'] as $f) { $x = q("select * from profdef where field_name = '%s' limit 1", dbesc($f) ); - if($x && $txt = prepare_text($a->profile[$f])) + if($x && $txt = prepare_text(App::$profile[$f])) $profile[$f] = array( $x[0]['field_desc'] . ':',$txt); } - $profile['extra_fields'] = $a->profile['extra_fields']; + $profile['extra_fields'] = App::$profile['extra_fields']; } - $things = get_things($a->profile['profile_guid'],$a->profile['profile_uid']); + $things = get_things(App::$profile['profile_guid'],App::$profile['profile_uid']); // logger('mod_profile: things: ' . print_r($things,true), LOGGER_DATA); @@ -1397,7 +1397,7 @@ function advanced_profile(&$a) { '$likethis' => t('Like this thing'), '$profile' => $profile, '$fields' => $clean_fields, - '$editmenu' => profile_edit_menu($a->profile['profile_uid']), + '$editmenu' => profile_edit_menu(App::$profile['profile_uid']), '$things' => $things )); } @@ -1440,7 +1440,7 @@ function zid_init(&$a) { $tmp_str = get_my_address(); if(validate_email($tmp_str)) { proc_run('php','include/gprobe.php',bin2hex($tmp_str)); - $arr = array('zid' => $tmp_str, 'url' => $a->cmd); + $arr = array('zid' => $tmp_str, 'url' => App::$cmd); call_hooks('zid_init',$arr); if(! local_channel()) { $r = q("select * from hubloc where hubloc_addr = '%s' order by hubloc_connected desc limit 1", @@ -1450,7 +1450,7 @@ function zid_init(&$a) { return; logger('zid_init: not authenticated. Invoking reverse magic-auth for ' . $tmp_str); // try to avoid recursion - but send them home to do a proper magic auth - $query = $a->query_string; + $query = App::$query_string; $query = str_replace(array('?zid=','&zid='),array('?rzid=','&rzid='),$query); $dest = '/' . urlencode($query); if($r && ($r[0]['hubloc_url'] != z_root()) && (! strstr($dest,'/magic')) && (! strstr($dest,'/rmagic'))) { @@ -1631,7 +1631,7 @@ function identity_selector() { intval(get_account_id()) ); if (count($r) > 1) { - //$account = get_app()->get_account(); + //$account = App::get_account(); $o = replace_macros(get_markup_template('channel_id_select.tpl'), array( '$channels' => $r, '$selected' => local_channel() @@ -1649,7 +1649,7 @@ function is_public_profile() { return false; if(intval(get_config('system','block_public'))) return false; - $channel = get_app()->get_channel(); + $channel = App::get_channel(); if($channel && $channel['channel_r_profile'] == PERMS_PUBLIC) return true; @@ -1855,7 +1855,7 @@ function get_zcard($channel,$observer_hash = '',$args = array()) { // $translate = intval(($scale / 1.0) * 100); - $channel['channel_addr'] = $channel['channel_address'] . '@' . get_app()->get_hostname(); + $channel['channel_addr'] = $channel['channel_address'] . '@' . App::get_hostname(); $zcard = array('chan' => $channel); $r = q("select height, width, resource_id, scale, type from photo where uid = %d and scale = %d and photo_usage = %d", -- cgit v1.2.3 From 0cda43145629586e6110e83fa2356e1c4ee4811a Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Thu, 31 Mar 2016 20:15:47 -0700 Subject: create miniApp to convert existing settings files to the static App class --- include/identity.php | 7 ------- 1 file changed, 7 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 67fd63aaf..849742c8e 100644 --- a/include/identity.php +++ b/include/identity.php @@ -174,7 +174,6 @@ function channel_total() { */ function create_identity($arr) { - $a = get_app(); $ret = array('success' => false); if(! $arr['account_id']) { @@ -914,7 +913,6 @@ function profile_load(&$a, $nickname, $profile = '') { function profile_edit_menu($uid) { - $a = get_app(); $ret = array(); $is_owner = (($uid == local_channel()) ? true : false); @@ -976,8 +974,6 @@ function profile_edit_menu($uid) { */ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = false) { - $a = get_app(); - $observer = App::get_observer(); $o = ''; @@ -1112,7 +1108,6 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa */ function get_birthdays() { - $a = get_app(); $o = ''; if(! local_channel()) @@ -1191,8 +1186,6 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = fa require_once('include/bbcode.php'); - $a = get_app(); - if(! local_channel()) return $o; -- cgit v1.2.3 From e4391e6336e9994d963b6c9e669be9b0d59e21b8 Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Wed, 6 Apr 2016 21:36:47 -0700 Subject: missing profile photo in export data --- include/identity.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 849742c8e..9bb4fb3c5 100644 --- a/include/identity.php +++ b/include/identity.php @@ -550,7 +550,8 @@ function identity_basic_export($channel_id, $items = false) { if($r) $ret['config'] = $r; - $r = q("select type, data, os_storage from photo where scale = 4 and profile = 1 and uid = %d limit 1", + $r = q("select type, data, os_storage from photo where scale = 4 and photo_usage = %d and uid = %d limit 1", + intval(PHOTO_PROFILE), intval($channel_id) ); -- cgit v1.2.3 From ed0bff798badf32ba95278a5d260198b283f8bc3 Mon Sep 17 00:00:00 2001 From: redmatrix <git@macgirvin.com> Date: Wed, 13 Apr 2016 22:58:37 -0700 Subject: fix marked bug in code --- include/identity.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 9bb4fb3c5..1c899048a 100644 --- a/include/identity.php +++ b/include/identity.php @@ -874,9 +874,8 @@ function profile_load(&$a, $nickname, $profile = '') { // fetch user tags if this isn't the default profile if(! $p[0]['is_default']) { - /** @BUG $profile_uid is undefinded for this query, so should not work. */ $x = q("select `keywords` from `profile` where uid = %d and `is_default` = 1 limit 1", - intval($profile_uid) + intval($p[0]['profile_uid']) ); if($x && $can_view_profile) $p[0]['keywords'] = $x[0]['keywords']; -- cgit v1.2.3