From aa985502c99d96aa5d7fb5af49870b9ffa806c4c Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 29 Sep 2016 23:16:17 -0400 Subject: [PATCH 01/13] Fix Issue #2813 - Remove adding a notification for each admin on register approval request - Fix wrong display of the above notification that is removed anyway - Fix comments --- js/main.js | 10 +++++----- mod/register.php | 18 ------------------ 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/js/main.js b/js/main.js index 72bef88490..79b5aae2bc 100644 --- a/js/main.js +++ b/js/main.js @@ -264,13 +264,13 @@ var html = notifications_tpl.format( e.attr('href'), // {0} // link to the source e.attr('photo'), // {1} // photo of the contact - text, // {2} // preformatet text (autor + text) + text, // {2} // preformatted text (autor + text) e.attr('date'), // {3} // date of notification (time ago) - seenclass, // {4} // vistiting status of the notification - new Date(e.attr('timestamp')*1000), // {5} //date of notification + seenclass, // {4} // visited status of the notification + new Date(e.attr('timestamp')*1000), // {5} // date of notification e.attr('url'), // {6} // profile url of the contact - e.text().format(""), // {7} // clean status text - contact // {8} //preformatat author (name + profile url) + e.text().format(contact), // {7} // preformatted html (text including author profile url) + '' // {8} // Deprecated ); nnm.append(html); }); diff --git a/mod/register.php b/mod/register.php index 6fc5887ef5..62b6a5f033 100644 --- a/mod/register.php +++ b/mod/register.php @@ -132,24 +132,6 @@ function register_post(&$a) { $admin_mail_list ); - - foreach ($adminlist as $admin) { - notification(array( - 'type' => NOTIFY_SYSTEM, - 'event' => 'SYSTEM_REGISTER_REQUEST', - 'source_name' => $user['username'], - 'source_mail' => $user['email'], - 'source_nick' => $user['nickname'], - 'source_link' => $a->get_baseurl()."/admin/users/", - 'link' => $a->get_baseurl()."/admin/users/", - 'source_photo' => $a->get_baseurl() . "/photo/avatar/".$user['uid'].".jpg", - 'to_email' => $admin['email'], - 'uid' => $admin['uid'], - 'language' => ($admin['language']?$admin['language']:'en')) - ); - } - - info( t('Your registration is pending approval by the site owner.') . EOL ) ; goaway(z_root()); From f0382bb159244b8f9d9243f737e673b0375ca7c8 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 30 Sep 2016 08:57:16 -0400 Subject: [PATCH 02/13] Restore admin notification email on register approval - Reverted changes to mod/register.php - Added "show_in_notification_page" flag to prevent `notify` DB insertion --- include/enotify.php | 2 +- mod/register.php | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/enotify.php b/include/enotify.php index bed00c5eaf..4973bedc24 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -49,7 +49,7 @@ function notification($params) { // with $params['show_in_notification_page'] == false, the notification isn't inserted into // the database, and an email is sent if applicable. // default, if not specified: true - $show_in_notification_page = ((x($params, 'show_in_notification_page')) ? $params['show_in_notification_page']:True); + $show_in_notification_page = ((x($params, 'show_in_notification_page')) ? $params['show_in_notification_page']:true); $additional_mail_header = ""; $additional_mail_header .= "Precedence: list\n"; diff --git a/mod/register.php b/mod/register.php index 62b6a5f033..0d29b3f9e5 100644 --- a/mod/register.php +++ b/mod/register.php @@ -132,6 +132,23 @@ function register_post(&$a) { $admin_mail_list ); + foreach ($adminlist as $admin) { + notification(array( + 'type' => NOTIFY_SYSTEM, + 'event' => 'SYSTEM_REGISTER_REQUEST', + 'source_name' => $user['username'], + 'source_mail' => $user['email'], + 'source_nick' => $user['nickname'], + 'source_link' => $a->get_baseurl()."/admin/users/", + 'link' => $a->get_baseurl()."/admin/users/", + 'source_photo' => $a->get_baseurl() . "/photo/avatar/".$user['uid'].".jpg", + 'to_email' => $admin['email'], + 'uid' => $admin['uid'], + 'language' => ($admin['language']?$admin['language']:'en'), + 'show_in_notification_page' => false + )); + } + info( t('Your registration is pending approval by the site owner.') . EOL ) ; goaway(z_root()); From 8b972510fe2463fe2cd20db70e1fd6d0d05bdee6 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 1 Oct 2016 16:07:23 +0200 Subject: [PATCH 03/13] with translations now in /view/lang/lng shift the array index along --- include/pgettext.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pgettext.php b/include/pgettext.php index 3c389ce2e5..b400baa3cf 100644 --- a/include/pgettext.php +++ b/include/pgettext.php @@ -179,7 +179,7 @@ function get_avaiable_languages() { asort($langs); foreach($langs as $l) { $t = explode("/",$l); - $lang_choices[$t[1]] = $t[1]; + $lang_choices[$t[2]] = $t[2]; } } return $lang_choices; From 21b30373425391347d462d771ff87ad99147c830 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Sat, 1 Oct 2016 21:16:23 +0200 Subject: [PATCH 04/13] frio: improve readabillity for code blocks --- view/theme/frio/css/style.css | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 18b7514503..84e8b6e7d8 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -1422,6 +1422,7 @@ section #jotOpen { width: 20px; } +/* wall-item content elements */ .shared-wrapper, .vevent { padding: 10px; @@ -1451,6 +1452,12 @@ blockquote.shared_content { margin-left: 0px; color: inherit; } +code > .hl-main { + padding: 10px 10px 1px 0; +} +.hl-main ol { + line-height: 1.7; +} .wall-item-tags, .itemedited { margin-top: 10px; @@ -1500,7 +1507,7 @@ blockquote.shared_content { .wall-item-actions .button-likes { padding-left: 0px; padding-right: 0px; - text-transform: capitalize; + text-transform: capitalize; } /* wall item hover effects */ From 60a0235af0dfb0a85613fbcf96d48906179f06c4 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 1 Oct 2016 20:03:27 +0000 Subject: [PATCH 05/13] The account type is now read and displayed --- include/Contact.php | 51 ++++++++++++++++++++++++++++++++++++++------ include/dfrn.php | 14 +++++++++++- include/identity.php | 11 ++-------- mod/allfriends.php | 2 +- mod/cal.php | 5 +---- mod/common.php | 2 +- mod/contacts.php | 15 ++++--------- mod/directory.php | 10 +-------- mod/dirfind.php | 2 +- mod/hovercard.php | 3 +-- mod/match.php | 2 +- mod/network.php | 5 +++-- mod/photos.php | 5 +---- mod/suggest.php | 3 +-- mod/videos.php | 5 +---- mod/viewcontacts.php | 2 +- 16 files changed, 78 insertions(+), 59 deletions(-) diff --git a/include/Contact.php b/include/Contact.php index 004d3aa287..f1e8bbe6d6 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -208,22 +208,22 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) { $uid = local_user(); // Fetch contact data from the contact table for the given user - $r = q("SELECT `id`, `id` AS `cid`, 0 AS `gid`, 0 AS `zid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, - `xmpp`, `keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `bd` AS `birthday`, `self` + $r = q("SELECT `id`, `id` AS `cid`, 0 AS `gid`, 0 AS `zid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`, + `keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, `self` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d", dbesc(normalise_link($url)), intval($uid)); // Fetch the data from the contact table with "uid=0" (which is filled automatically) if (!$r) - $r = q("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, - `xmpp`, `keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `bd` AS `birthday`, 0 AS `self` + $r = q("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`, + `keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, 0 AS `self` FROM `contact` WHERE `nurl` = '%s' AND `uid` = 0", dbesc(normalise_link($url))); // Fetch the data from the gcontact table if (!$r) - $r = q("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, - '' AS `xmpp`, `keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, `community` AS `forum`, 0 AS `prv`, `community`, `birthday`, 0 AS `self` + $r = q("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, '' AS `xmpp`, + `keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, `community` AS `forum`, 0 AS `prv`, `community`, 0 AS `contact-type`, `birthday`, 0 AS `self` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($url))); @@ -683,4 +683,43 @@ function formatted_location($profile) { return $location; } + +/** + * @brief Returns the account type name + * + * The function be called with either the profile or the contct array + * + * @param array $contact contact or profile array + */ +function account_type($contact) { + + if((isset($contact['page-flags']) && (intval($contact['page-flags']) == PAGE_COMMUNITY)) + || (isset($contact['page-flags']) && (intval($contact['page-flags']) == PAGE_PRVGROUP)) + || (isset($contact['forum']) && intval($contact['forum'])) + || (isset($contact['prv']) && intval($contact['prv'])) + || (isset($contact['community']) && intval($contact['community']))) + $type = ACCOUNT_TYPE_COMMUNITY; + else + $type = ACCOUNT_TYPE_PERSON; + + if (isset($contact["contact-type"])) + $type = $contact["contact-type"]; + if (isset($contact["account-type"])) + $type = $contact["account-type"]; + + if ($type != 0) + switch($type) { + case ACCOUNT_TYPE_ORGANISATION: + $account_type = t("Organisation"); + break; + case ACCOUNT_TYPE_NEWS: + $account_type = t('News'); + break; + case ACCOUNT_TYPE_COMMUNITY: + $account_type = t("Forum"); + break; + } + + return $account_type; +} ?> diff --git a/include/dfrn.php b/include/dfrn.php index e9cfb228f6..c5d00e8a67 100644 --- a/include/dfrn.php +++ b/include/dfrn.php @@ -2492,7 +2492,19 @@ class dfrn { logger("Import DFRN message for user ".$importer["uid"]." from contact ".$importer["id"], LOGGER_DEBUG); - // is it a public forum? Private forums aren't supported by now with this method + // The account type is new since 3.5.1 + if ($xpath->query("/atom:feed/dfrn:account_type")->length > 0) { + $accounttype = intval($xpath->evaluate("/atom:feed/dfrn:account_type/text()", $context)->item(0)->nodeValue); + + if ($accounttype != $importer["contact-type"]) + q("UPDATE `contact` SET `contact-type` = %d WHERE `id` = %d", + intval($accounttype), + intval($importer["id"]) + ); + } + + // is it a public forum? Private forums aren't supported with this method + // This is deprecated since 3.5.1 $forum = intval($xpath->evaluate("/atom:feed/dfrn:community/text()", $context)->item(0)->nodeValue); if ($forum != $importer["forum"]) diff --git a/include/identity.php b/include/identity.php index def50a98fc..b3dbea8fc6 100644 --- a/include/identity.php +++ b/include/identity.php @@ -310,15 +310,8 @@ function profile_sidebar($profile, $block = 0) { ); } - // check if profile is a forum - if((intval($profile['page-flags']) == PAGE_COMMUNITY) - || (intval($profile['page-flags']) == PAGE_PRVGROUP) - || (isset($profile['forum']) && intval($profile['forum'])) - || (isset($profile['prv']) && intval($profile['prv'])) - || (isset($profile['community']) && intval($profile['community']))) - $account_type = t('Forum'); - else - $account_type = ""; + // Fetch the account type + $account_type = account_type($profile); if((x($profile,'address') == 1) || (x($profile,'location') == 1) diff --git a/mod/allfriends.php b/mod/allfriends.php index 498b9d7dbf..03f78e696e 100644 --- a/mod/allfriends.php +++ b/mod/allfriends.php @@ -76,7 +76,7 @@ function allfriends_content(&$a) { 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], - 'account_type' => (($contact_details['community']) ? t('Forum') : ''), + 'account_type' => account_type($contact_details), 'network' => network_to_name($contact_details['network'], $contact_details['url']), 'photo_menu' => $photo_menu, 'conntxt' => t('Connect'), diff --git a/mod/cal.php b/mod/cal.php index ab20617257..78907da06a 100644 --- a/mod/cal.php +++ b/mod/cal.php @@ -40,10 +40,7 @@ function cal_init(&$a) { $profile = get_profiledata_by_nick($nick, $a->profile_uid); - if((intval($profile['page-flags']) == PAGE_COMMUNITY) || (intval($profile['page-flags']) == PAGE_PRVGROUP)) - $account_type = t('Forum'); - else - $account_type = ""; + $account_type = account_type($profile); $tpl = get_markup_template("vcard-widget.tpl"); diff --git a/mod/common.php b/mod/common.php index 9b2c69f6d7..063eafe67b 100644 --- a/mod/common.php +++ b/mod/common.php @@ -120,7 +120,7 @@ function common_content(&$a) { 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], - 'account_type' => (($contact_details['community']) ? t('Forum') : ''), + 'account_type' => account_type($contact_details), 'network' => network_to_name($contact_details['network'], $contact_details['url']), 'photo_menu' => $photo_menu, 'id' => ++$id, diff --git a/mod/contacts.php b/mod/contacts.php index be8135f5cb..410cced8e6 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -38,7 +38,7 @@ function contacts_init(&$a) { if (($a->data['contact']['network'] != "") AND ($a->data['contact']['network'] != NETWORK_DFRN)) { $networkname = format_network_name($a->data['contact']['network'],$a->data['contact']['url']); - } else + } else $networkname = ''; $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array( @@ -48,7 +48,7 @@ function contacts_init(&$a) { '$addr' => (($a->data['contact']['addr'] != "") ? ($a->data['contact']['addr']) : ""), '$network_name' => $networkname, '$network' => t('Network:'), - 'account_type' => (($a->data['contact']['forum'] || $a->data['contact']['prv']) ? t('Forum') : '') + '$account_type' => account_type($a->data['contact']) )); $finpeople_widget = ''; $follow_widget = ''; @@ -623,7 +623,7 @@ function contacts_content(&$a) { '$url' => $url, '$profileurllabel' => t('Profile URL'), '$profileurl' => $contact['url'], - 'account_type' => (($contact['forum'] || $contact['prv']) ? t('Forum') : ''), + '$account_type' => account_type($contact), '$location' => bbcode($contact["location"]), '$location_label' => t("Location:"), '$xmpp' => bbcode($contact["xmpp"]), @@ -910,8 +910,6 @@ function contact_posts($a, $contact_id) { function _contact_detail_for_template($rr){ - $community = ''; - switch($rr['rel']) { case CONTACT_IS_FRIEND: $dir_icon = 'images/lrarrow.gif'; @@ -937,11 +935,6 @@ function _contact_detail_for_template($rr){ $sparkle = ''; } - //test if contact is a forum page - if (isset($rr['forum']) OR isset($rr['prv'])) - $community = ($rr['forum'] OR $rr['prv']); - - return array( 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']), 'edit_hover' => t('Edit contact'), @@ -952,7 +945,7 @@ function _contact_detail_for_template($rr){ 'thumb' => proxy_url($rr['thumb'], false, PROXY_SIZE_THUMB), 'name' => htmlentities($rr['name']), 'username' => htmlentities($rr['name']), - 'account_type' => ($community ? t('Forum') : ''), + 'account_type' => account_type($rr), 'sparkle' => $sparkle, 'itemurl' => (($rr['addr'] != "") ? $rr['addr'] : $rr['url']), 'url' => $url, diff --git a/mod/directory.php b/mod/directory.php index a6a9cb8ab2..06aeec622f 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -99,7 +99,6 @@ function directory_content(&$a) { foreach($r as $rr) { - $community = ''; $itemurl= ''; $itemurl = (($rr['addr'] != "") ? $rr['addr'] : $rr['profile_url']); @@ -128,13 +127,6 @@ function directory_content(&$a) { // if(strlen($rr['gender'])) // $details .= '
' . t('Gender: ') . $rr['gender']; - - // show if account is a community account - /// @TODO The other page types should be also respected, but first we need a good - /// translatiion and systemwide consistency for displaying the page type - if((intval($rr['page-flags']) == PAGE_COMMUNITY) OR (intval($rr['page-flags']) == PAGE_PRVGROUP)) - $community = true; - $profile = $rr; if((x($profile,'address') == 1) @@ -171,7 +163,7 @@ function directory_content(&$a) { 'img_hover' => $rr['name'], 'name' => $rr['name'], 'details' => $details, - 'account_type' => ($community ? t('Forum') : ''), + 'account_type' => account_type($rr), 'profile' => $profile, 'location' => $location_e, 'tags' => $rr['pub_keywords'], diff --git a/mod/dirfind.php b/mod/dirfind.php index 52e1617554..215731978c 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -220,7 +220,7 @@ function dirfind_content(&$a, $prefix = "") { 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], - 'account_type' => (($contact_details['community']) ? t('Forum') : ''), + 'account_type' => account_type($contact_details), 'network' => network_to_name($jj->network, $jj->url), 'id' => ++$id, ); diff --git a/mod/hovercard.php b/mod/hovercard.php index 9bd91f0d5a..65b75b3211 100644 --- a/mod/hovercard.php +++ b/mod/hovercard.php @@ -77,10 +77,9 @@ function hovercard_content() { // 'server_url' => $contact["server_url"], 'bd' => (($contact["birthday"] == "0000-00-00") ? "" : $contact["birthday"]), // 'generation' => $contact["generation"], - 'account_type' => ($contact['community'] ? t("Forum") : ""), + 'account_type' => account_type($contact), 'actions' => $actions, ); - if($datatype == "html") { $t = get_markup_template("hovercard.tpl"); diff --git a/mod/match.php b/mod/match.php index 8341911577..33e07c91ce 100644 --- a/mod/match.php +++ b/mod/match.php @@ -81,7 +81,7 @@ function match_content(&$a) { 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], - 'account_type' => (($contact_details['community']) ? t('Forum') : ''), + 'account_type' => account_type($contact_details), 'thumb' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB), 'inttxt' => ' ' . t('is interested in:'), 'conntxt' => t('Connect'), diff --git a/mod/network.php b/mod/network.php index 6ebedbcae8..f4af489db9 100644 --- a/mod/network.php +++ b/mod/network.php @@ -502,7 +502,7 @@ function network_content(&$a, $update = 0) { } elseif($cid) { - $r = q("SELECT `id`,`name`,`network`,`writable`,`nurl`, `forum`, `prv`, `addr`, `thumb`, `location` FROM `contact` WHERE `id` = %d + $r = q("SELECT `id`,`name`,`network`,`writable`,`nurl`, `forum`, `prv`, `contact-type`, `addr`, `thumb`, `location` FROM `contact` WHERE `id` = %d AND `blocked` = 0 AND `pending` = 0 LIMIT 1", intval($cid) ); @@ -514,10 +514,11 @@ function network_content(&$a, $update = 0) { 'name' => htmlentities($r[0]['name']), 'itemurl' => (($r[0]['addr']) ? ($r[0]['addr']) : ($r[0]['nurl'])), 'thumb' => proxy_url($r[0]['thumb'], false, PROXY_SIZE_THUMB), - 'account_type' => (($r[0]['forum']) || ($r[0]['prv']) ? t('Forum') : ''), 'details' => $r[0]['location'], ); + $entries[0]["account_type"] = account_type($r[0]); + $o = replace_macros(get_markup_template("viewcontact_template.tpl"),array( 'contacts' => $entries, 'id' => 'network', diff --git a/mod/photos.php b/mod/photos.php index a191dcf071..741181b2e9 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -38,10 +38,7 @@ function photos_init(&$a) { $profile = get_profiledata_by_nick($nick, $a->profile_uid); - if((intval($profile['page-flags']) == PAGE_COMMUNITY) || (intval($profile['page-flags']) == PAGE_PRVGROUP)) - $account_type = t('Forum'); - else - $account_type = ""; + $account_type = account_type($profile); $tpl = get_markup_template("vcard-widget.tpl"); diff --git a/mod/suggest.php b/mod/suggest.php index 00033b2d24..4399450ecc 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -95,7 +95,7 @@ function suggest_content(&$a) { 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], - 'account_type' => (($contact_details['community']) ? t('Forum') : ''), + 'account_type' => account_type($contact_details), 'ignlnk' => $ignlnk, 'ignid' => $rr['id'], 'conntxt' => t('Connect'), @@ -113,7 +113,6 @@ function suggest_content(&$a) { $o .= replace_macros($tpl,array( '$title' => t('Friend Suggestions'), '$contacts' => $entries, - )); return $o; diff --git a/mod/videos.php b/mod/videos.php index e5a0887bb9..fb742eb015 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -33,10 +33,7 @@ function videos_init(&$a) { $profile = get_profiledata_by_nick($nick, $a->profile_uid); - if((intval($profile['page-flags']) == PAGE_COMMUNITY) || (intval($profile['page-flags']) == PAGE_PRVGROUP)) - $account_type = t('Forum'); - else - $account_type = ""; + $account_type = account_type($profile); $tpl = get_markup_template("vcard-widget.tpl"); diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php index 2eae8fec8e..19dd8b7f95 100644 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -102,7 +102,7 @@ function viewcontacts_content(&$a) { 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], - 'account_type' => (($contact_details['community']) ? t('Forum') : ''), + 'account_type' => account_type($contact_details), 'url' => $url, 'sparkle' => '', 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']), From 9dee3cc809ab7319e4ce67ccadaf0ac492dc9613 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 1 Oct 2016 20:20:27 +0000 Subject: [PATCH 06/13] Some small changes --- include/Contact.php | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/include/Contact.php b/include/Contact.php index f1e8bbe6d6..936589be98 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -687,12 +687,13 @@ function formatted_location($profile) { /** * @brief Returns the account type name * - * The function be called with either the profile or the contct array + * The function can be called with either the user or the contact array * - * @param array $contact contact or profile array + * @param array $contact contact or user array */ function account_type($contact) { + // There are several fields that indicate that the contact or user is a forum if((isset($contact['page-flags']) && (intval($contact['page-flags']) == PAGE_COMMUNITY)) || (isset($contact['page-flags']) && (intval($contact['page-flags']) == PAGE_PRVGROUP)) || (isset($contact['forum']) && intval($contact['forum'])) @@ -702,23 +703,26 @@ function account_type($contact) { else $type = ACCOUNT_TYPE_PERSON; + // The field is named differently in the user and the contact record if (isset($contact["contact-type"])) $type = $contact["contact-type"]; if (isset($contact["account-type"])) $type = $contact["account-type"]; - if ($type != 0) - switch($type) { - case ACCOUNT_TYPE_ORGANISATION: - $account_type = t("Organisation"); - break; - case ACCOUNT_TYPE_NEWS: - $account_type = t('News'); - break; - case ACCOUNT_TYPE_COMMUNITY: - $account_type = t("Forum"); - break; - } + switch($type) { + case ACCOUNT_TYPE_ORGANISATION: + $account_type = t("Organisation"); + break; + case ACCOUNT_TYPE_NEWS: + $account_type = t('News'); + break; + case ACCOUNT_TYPE_COMMUNITY: + $account_type = t("Forum"); + break; + default: + $account_type = ""; + break; + } return $account_type; } From 2a93c5b816b0762699e0fc5691669109a10aaa16 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 1 Oct 2016 20:27:49 +0000 Subject: [PATCH 07/13] Little fix to the utf8mb4: Now here's the changed database.sql --- database.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/database.sql b/database.sql index ecd2be1529..a482b106cf 100644 --- a/database.sql +++ b/database.sql @@ -58,7 +58,7 @@ CREATE TABLE IF NOT EXISTS `cache` ( `v` text, `expire_mode` int(11) NOT NULL DEFAULT 0, `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY(`k`), + PRIMARY KEY(`k`(191)), INDEX `updated` (`updated`) ) DEFAULT CHARSET=utf8mb4; @@ -679,7 +679,7 @@ CREATE TABLE IF NOT EXISTS `oembed` ( `url` varchar(255) NOT NULL, `content` text, `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY(`url`), + PRIMARY KEY(`url`(191)), INDEX `created` (`created`) ) DEFAULT CHARSET=utf8mb4; @@ -692,7 +692,7 @@ CREATE TABLE IF NOT EXISTS `parsed_url` ( `oembed` tinyint(1) NOT NULL DEFAULT 0, `content` text, `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - PRIMARY KEY(`url`,`guessing`,`oembed`), + PRIMARY KEY(`url`(191),`guessing`,`oembed`), INDEX `created` (`created`) ) DEFAULT CHARSET=utf8mb4; From f302f66dcdbd5f7eb0a1a5deb0e8642cf4457abc Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 1 Oct 2016 18:19:43 -0400 Subject: [PATCH 08/13] Fix Issue #2800 - Prevent internal links to switch to Safari in standalone mode Add a event delegation to keep internal links inside the standalone window. Fixes 1. of #2800 --- view/templates/head.tpl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/view/templates/head.tpl b/view/templates/head.tpl index 70add44c2f..fe14a29dcd 100644 --- a/view/templates/head.tpl +++ b/view/templates/head.tpl @@ -18,12 +18,16 @@ - + + +