aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/bbcode.php5
-rw-r--r--include/conversation.php420
-rw-r--r--include/items.php16
-rw-r--r--include/main.js23
-rw-r--r--include/nav.php6
-rw-r--r--include/notifier.php1
-rw-r--r--include/poller.php16
-rw-r--r--include/profile_advanced.php258
8 files changed, 732 insertions, 13 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 44f571450..6fadbaf7e 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -3,7 +3,7 @@ require_once("include/oembed.php");
// BBcode 2 HTML was written by WAY2WEB.net
// extended to work with Mistpark/Friendika - Mike Macgirvin
-function bbcode($Text) {
+function bbcode($Text,$preserve_nl = false) {
// Replace any html brackets with HTML Entities to prevent executing HTML or script
// Don't use strip_tags here because it breaks [url] search by replacing & with amp
@@ -12,7 +12,10 @@ function bbcode($Text) {
$Text = str_replace(">", ">", $Text);
// Convert new line chars to html <br /> tags
+
$Text = nl2br($Text);
+ if($preserve_nl)
+ $Text = str_replace(array("\n","\r"), array('',''),$Text);
// Set up the parameters for a URL search string
$URLSearchString = "^\[\]";
diff --git a/include/conversation.php b/include/conversation.php
new file mode 100644
index 000000000..839afc481
--- /dev/null
+++ b/include/conversation.php
@@ -0,0 +1,420 @@
+<?php
+
+
+function conversation(&$a, $items, $mode, $update) {
+
+ require_once('bbcode.php');
+
+ $profile_owner = 0;
+ $page_writeable = false;
+
+ if($mode === 'network') {
+ $profile_owner = local_user();
+ $page_writeable = true;
+ }
+
+ if($mode === 'profile') {
+ $profile_owner = $a->profile['profile_uid'];
+ $page_writeable = can_write_wall($a,$profile_owner);
+ }
+
+ if($mode === 'display') {
+ $profile_owner = $a->profile['uid'];
+ $page_writeable = can_write_wall($a,$profile_owner);
+ }
+
+ if($update)
+ $return_url = $_SESSION['return_url'];
+ else
+ $return_url = $_SESSION['return_url'] = $a->cmd;
+
+
+ // find all the authors involved in remote conversations
+ // We will use a local profile photo if they are one of our contacts
+ // otherwise we have to get the photo from the item owner's site
+
+ $author_contacts = extract_item_authors($items,local_user());
+
+
+ $cmnt_tpl = load_view_file('view/comment_item.tpl');
+ $like_tpl = load_view_file('view/like.tpl');
+ $noshare_tpl = load_view_file('view/like_noshare.tpl');
+ $tpl = load_view_file('view/wall_item.tpl');
+ $wallwall = load_view_file('view/wallwall_item.tpl');
+
+ $alike = array();
+ $dlike = array();
+
+ if(count($items)) {
+
+ if($mode === 'network-new' || $mode === 'search') {
+
+ // "New Item View" on network page or search page results
+ // - just loop through the items and format them minimally for display
+
+ $tpl = load_view_file('view/search_item.tpl');
+ $droptpl = load_view_file('view/wall_fake_drop.tpl');
+
+ foreach($items as $item) {
+
+ $comment = '';
+ $owner_url = '';
+ $owner_photo = '';
+ $owner_name = '';
+ $sparkle = '';
+
+ if($mode === 'search') {
+ if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE)))
+ && ($item['id'] != $item['parent']))
+ continue;
+ $nickname = $item['nickname'];
+ }
+ else
+ $nickname = $a->user['nickname'];
+
+ $profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']);
+ $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']);
+ $profile_link = ((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
+
+ $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
+
+ if(strlen($item['author-link'])) {
+ if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) {
+ $profile_link = $redirect_url;
+ $sparkle = ' sparkle';
+ }
+ elseif(isset($author_contacts[$item['author-link']])) {
+ $profile_link = $a->get_baseurl() . '/redir/' . $author_contacts[$item['author-link']];
+ $sparkle = ' sparkle';
+ }
+ }
+
+ $location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
+ $coord = (($item['coord']) ? '<a target="map" title="' . $item['coord'] . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
+ if($coord) {
+ if($location)
+ $location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
+ else
+ $location = '<span class="smalltext">' . $coord . '</span>';
+ }
+
+ $drop = '';
+ $dropping = false;
+
+ if((intval($item['contact-id']) && $item['contact-id'] == remote_user()) || ($item['uid'] == local_user()))
+ $dropping = true;
+
+ $drop = replace_macros((($dropping)? $droptpl : $fakedrop), array('$id' => $item['id'], '$delete' => t('Delete')));
+
+
+
+ $drop = replace_macros($droptpl,array('$id' => $item['id']));
+ $lock = '<div class="wall-item-lock"></div>';
+
+ $o .= replace_macros($tpl,array(
+ '$id' => $item['item_id'],
+ '$linktitle' => sprintf( t('View %s\'s profile'), $profile_name),
+ '$profile_url' => $profile_link,
+ '$item_photo_menu' => item_photo_menu($item),
+ '$name' => $profile_name,
+ '$sparkle' => $sparkle,
+ '$lock' => $lock,
+ '$thumb' => $profile_avatar,
+ '$title' => $item['title'],
+ '$body' => smilies(bbcode($item['body'])),
+ '$ago' => relative_date($item['created']),
+ '$location' => $location,
+ '$indent' => '',
+ '$owner_url' => $owner_url,
+ '$owner_photo' => $owner_photo,
+ '$owner_name' => $owner_name,
+ '$drop' => $drop,
+ '$conv' => '<a href="' . $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'] . '">' . t('View in context') . '</a>'
+ ));
+
+ }
+
+ return $o;
+ }
+
+
+
+
+ // Normal View
+
+
+ // Figure out how many comments each parent has
+ // (Comments all have gravity of 6)
+ // Store the result in the $comments array
+
+ $comments = array();
+ foreach($items as $item) {
+ if(intval($item['gravity']) == 6) {
+ if(! x($comments,$item['parent']))
+ $comments[$item['parent']] = 1;
+ else
+ $comments[$item['parent']] += 1;
+ }
+ }
+
+ // map all the like/dislike activities for each parent item
+ // Store these in the $alike and $dlike arrays
+
+ foreach($items as $item) {
+ like_puller($a,$item,$alike,'like');
+ like_puller($a,$item,$dlike,'dislike');
+ }
+
+ $comments_collapsed = false;
+ $blowhard = 0;
+ $blowhard_count = 0;
+
+ foreach($items as $item) {
+
+ $comment = '';
+ $template = $tpl;
+ $commentww = '';
+ $sparkle = '';
+ $owner_url = $owner_photo = $owner_name = '';
+
+ // We've already parsed out like/dislike for special treatment. We can ignore them now
+
+ if(((activity_match($item['verb'],ACTIVITY_LIKE))
+ || (activity_match($item['verb'],ACTIVITY_DISLIKE)))
+ && ($item['id'] != $item['parent']))
+ continue;
+
+ $toplevelpost = (($item['id'] == $item['parent']) ? true : false);
+
+
+ // Take care of author collapsing and comment collapsing
+ // If a single author has more than 3 consecutive top-level posts, squash the remaining ones.
+ // If there are more than two comments, squash all but the last 2.
+
+ if($toplevelpost) {
+
+ $item_writeable = (($item['writable'] || $item['self']) ? true : false);
+
+ if($blowhard == $item['cid'] && (! $item['self']) && ($mode != 'profile')) {
+ $blowhard_count ++;
+ if($blowhard_count == 3) {
+ $o .= '<div class="icollapse-wrapper fakelink" id="icollapse-wrapper-' . $item['parent']
+ . '" onclick="openClose(' . '\'icollapse-' . $item['parent'] . '\');" >'
+ . t('See more posts like this') . '</div>' . '<div class="icollapse" id="icollapse-'
+ . $item['parent'] . '" style="display: none;" >';
+ }
+ }
+ else {
+ $blowhard = $item['cid'];
+ if($blowhard_count >= 3)
+ $o .= '</div>';
+ $blowhard_count = 0;
+ }
+
+ $comments_seen = 0;
+ $comments_collapsed = false;
+ }
+ else
+ $comments_seen ++;
+
+
+ $show_comment_box = ((($page_writeable) && ($item_writeable) && ($comments_seen == $comments[$item['parent']])) ? true : false);
+
+ if(($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) {
+ if(! $comments_collapsed) {
+ $o .= '<div class="ccollapse-wrapper fakelink" id="ccollapse-wrapper-' . $item['parent']
+ . '" onclick="openClose(' . '\'ccollapse-' . $item['parent'] . '\');" >'
+ . sprintf( t('See all %d comments'), $comments[$item['parent']]) . '</div>'
+ . '<div class="ccollapse" id="ccollapse-' . $item['parent'] . '" style="display: none;" >';
+ $comments_collapsed = true;
+ }
+ }
+ if(($comments[$item['parent']] > 2) && ($comments_seen == ($comments[$item['parent']] - 1))) {
+ $o .= '</div>';
+ }
+
+ $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
+
+ $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
+ || strlen($item['deny_cid']) || strlen($item['deny_gid']))))
+ ? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>'
+ : '<div class="wall-item-lock"></div>');
+
+
+ // Top-level wall post not written by the wall owner (wall-to-wall)
+ // First figure out who owns it.
+
+ $osparkle = '';
+
+ if(($toplevelpost) && (! $item['self']) && ($mode !== 'profile')) {
+
+ if($item['type'] === 'wall') {
+
+ // On the network page, I am the owner. On the display page it will be the profile owner.
+ // This will have been stored in $a->page_contact by our calling page.
+ // Put this person on the left of the wall-to-wall notice.
+
+ $owner_url = $a->page_contact['url'];
+ $owner_photo = $a->page_contact['thumb'];
+ $owner_name = $a->page_contact['name'];
+ $template = $wallwall;
+ $commentww = 'ww';
+ }
+ if(($item['type'] === 'remote') && (strlen($item['owner-link'])) && ($item['owner-link'] != $item['author-link'])) {
+
+ // Could be anybody.
+
+ $owner_url = $item['owner-link'];
+ $owner_photo = $item['owner-avatar'];
+ $owner_name = $item['owner-name'];
+ $template = $wallwall;
+ $commentww = 'ww';
+ // If it is our contact, use a friendly redirect link
+ if((link_compare($item['owner-link'],$item['url']))
+ && ($item['network'] === 'dfrn')) {
+ $owner_url = $redirect_url;
+ $osparkle = ' sparkle';
+ }
+ }
+ }
+
+
+ $likebuttons = '';
+
+ if($page_writeable) {
+ if($toplevelpost) {
+ $likebuttons = replace_macros((($item['private']) ? $noshare_tpl : $like_tpl),array(
+ '$id' => $item['id'],
+ '$likethis' => t("I like this \x28toggle\x29"),
+ '$nolike' => t("I don't like this \x28toggle\x29"),
+ '$share' => t('Share'),
+ '$wait' => t('Please wait')
+ ));
+ }
+
+ if(($show_comment_box) || (($show_comment_box == false) && ($item['last-child']))) {
+ $comment = replace_macros($cmnt_tpl,array(
+ '$return_path' => '',
+ '$jsreload' => (($mode === 'display') ? $_SESSION['return_url'] : ''),
+ '$type' => (($mode === 'profile') ? 'wall-comment' : 'net-comment'),
+ '$id' => $item['item_id'],
+ '$parent' => $item['parent'],
+ '$profile_uid' => $profile_owner,
+ '$mylink' => $a->contact['url'],
+ '$mytitle' => t('This is you'),
+ '$myphoto' => $a->contact['thumb'],
+ '$comment' => t('Comment'),
+ '$submit' => t('Submit'),
+ '$ww' => (($mode === 'network') ? $commentww : '')
+ ));
+ }
+ }
+
+ $edpost = ((($profile_owner == local_user()) && ($toplevelpost) && (intval($item['wall']) == 1))
+ ? '<a class="editpost" href="' . $a->get_baseurl() . '/editpost/' . $item['id']
+ . '" title="' . t('Edit') . '"><img src="images/pencil.gif" /></a>'
+ : '');
+ $drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete')));
+
+ $photo = $item['photo'];
+ $thumb = $item['thumb'];
+
+ // Post was remotely authored.
+
+ $diff_author = ((link_compare($item['url'],$item['author-link'])) ? false : true);
+
+ $profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
+ $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $thumb);
+
+ if($mode === 'profile') {
+ if(local_user() && ($item['contact-uid'] == local_user()) && ($item['network'] === 'dfrn') && (! $item['self'] )) {
+ $profile_link = $redirect_url;
+ $sparkle = ' sparkle';
+ }
+ else {
+ $profile_link = $item['url'];
+ $sparkle = '';
+ }
+ }
+ elseif(strlen($item['author-link'])) {
+ $profile_link = $item['author-link'];
+ if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) {
+ $profile_link = $redirect_url;
+ $sparkle = ' sparkle';
+ }
+ elseif(isset($author_contacts[$item['author-link']])) {
+ $profile_link = $a->get_baseurl() . '/redir/' . $author_contacts[$item['author-link']];
+ $sparkle = ' sparkle';
+ }
+ }
+ else
+ $profile_link = $item['url'];
+
+ $like = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
+ $dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
+
+ $location = (($item['location']) ? '<a target="map" title="' . $item['location']
+ . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
+ $coord = (($item['coord']) ? '<a target="map" title="' . $item['coord']
+ . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
+ if($coord) {
+ if($location)
+ $location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
+ else
+ $location = '<span class="smalltext">' . $coord . '</span>';
+ }
+
+ $indent = (($toplevelpost) ? '' : ' comment');
+
+ if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
+ $indent .= ' shiny';
+
+ // Build the HTML
+
+ $tmp_item = replace_macros($template,array(
+ '$id' => $item['item_id'],
+ '$linktitle' => sprintf( t('View %s\'s profile'), $profile_name),
+ '$olinktitle' => sprintf( t('View %s\'s profile'), $owner_name),
+ '$to' => t('to'),
+ '$wall' => t('Wall-to-Wall'),
+ '$vwall' => t('via Wall-To-Wall:'),
+ '$profile_url' => $profile_link,
+ '$item_photo_menu' => item_photo_menu($item),
+ '$name' => $profile_name,
+ '$thumb' => $profile_avatar,
+ '$osparkle' => $osparkle,
+ '$sparkle' => $sparkle,
+ '$title' => $item['title'],
+ '$body' => smilies(bbcode($item['body'])),
+ '$ago' => relative_date($item['created']),
+ '$lock' => $lock,
+ '$location' => $location,
+ '$indent' => $indent,
+ '$owner_url' => $owner_url,
+ '$owner_photo' => $owner_photo,
+ '$owner_name' => $owner_name,
+ '$plink' => get_plink($item),
+ '$edpost' => $edpost,
+ '$drop' => $drop,
+ '$vote' => $likebuttons,
+ '$like' => $like,
+ '$dislike' => $dislike,
+ '$comment' => $comment
+ ));
+
+ $arr = array('item' => $item, 'output' => $tmp_item);
+ call_hooks('display_item', $arr);
+
+ $o .= $arr['output'];
+
+ }
+ }
+
+
+ // if author collapsing is in force but didn't get closed, close it off now.
+
+ if($blowhard_count >= 3)
+ $o .= '</div>';
+
+ return $o;
+} \ No newline at end of file
diff --git a/include/items.php b/include/items.php
index 596946681..86579512e 100644
--- a/include/items.php
+++ b/include/items.php
@@ -867,14 +867,14 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
if($dissolve)
$postvars['dissolve'] = '1';
- if(($contact['rel']) && ($contact['rel'] != REL_FAN) && (! $contact['blocked']) && (! $contact['readonly'])) {
- $postvars['data'] = $atom;
- }
- elseif($owner['page-flags'] == PAGE_COMMUNITY) {
+
+ if((($contact['rel']) && ($contact['rel'] != REL_FAN) && (! $contact['blocked'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
$postvars['data'] = $atom;
+ $postvars['perm'] = 'rw';
}
else {
$postvars['data'] = str_replace('<dfrn:comment-allow>1','<dfrn:comment-allow>0',$atom);
+ $postvars['perm'] = 'r';
}
if($rino && $rino_allowed && (! $dissolve)) {
@@ -916,7 +916,6 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
if((! $curl_stat) || (! strlen($xml)))
return(-1); // timed out
-
if(strpos($xml,'<?xml') === false) {
logger('dfrn_deliver: phase 2: no valid XML returned');
logger('dfrn_deliver: phase 2: returned XML: ' . $xml, LOGGER_DATA);
@@ -925,8 +924,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$res = parse_xml_string($xml);
- return $res->status;
-
+ return $res->status;
}
@@ -1369,8 +1367,8 @@ function new_follower($importer,$contact,$datarray,$item) {
// create contact record - set to readonly
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `name`, `nick`, `photo`, `network`, `rel`,
- `blocked`, `readonly`, `pending` )
- VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, 0, 1, 1 ) ",
+ `blocked`, `readonly`, `pending`, `writable` )
+ VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, 0, 1, 1, 1 ) ",
intval($importer['uid']),
dbesc(datetime_convert()),
dbesc($url),
diff --git a/include/main.js b/include/main.js
index 18e884b31..8779f8413 100644
--- a/include/main.js
+++ b/include/main.js
@@ -255,3 +255,26 @@
return false;
}
+
+ function bin2hex(s){
+ // Converts the binary representation of data to hex
+ //
+ // version: 812.316
+ // discuss at: http://phpjs.org/functions/bin2hex
+ // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+ // + bugfixed by: Onno Marsman
+ // + bugfixed by: Linuxworld
+ // * example 1: bin2hex('Kev');
+ // * returns 1: '4b6576'
+ // * example 2: bin2hex(String.fromCharCode(0x00));
+ // * returns 2: '00'
+ var v,i, f = 0, a = [];
+ s += '';
+ f = s.length;
+
+ for (i = 0; i<f; i++) {
+ a[i] = s.charCodeAt(i).toString(16).replace(/^([\da-f])$/,"0$1");
+ }
+
+ return a.join('');
+ } \ No newline at end of file
diff --git a/include/nav.php b/include/nav.php
index b8b65f84d..703d8da40 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -61,6 +61,12 @@ function nav(&$a) {
$a->page['nav'] .= '<a id="nav-register-link" class="nav-commlink" href="register" >'
. t('Register') . "</a>\r\n";
+ $help_url = get_config('system','help_url');
+ if(! $help_url)
+ $help_url = 'http://github.com/friendika/friendika/wiki';
+
+ $a->page['nav'] .= '<a id="nav-help-link" class="nav-link" target="friendika-help" href="' . $help_url . '">' . t('Help') . "</a>\r\n";
+
if(strlen($a->apps)) {
$a->page['nav'] .= '<a id="nav-apps-link" class="nav-link" href="apps">' . t('Apps') . "</a>\r\n";
}
diff --git a/include/notifier.php b/include/notifier.php
index ca2304845..9d74f8b9b 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -354,6 +354,7 @@ function notifier_run($argv, $argc){
case 'mail':
case 'dspr':
case 'feed':
+ case 'face':
default:
break;
}
diff --git a/include/poller.php b/include/poller.php
index 9362c28b3..b878ef295 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -165,11 +165,15 @@ function poller_run($argv, $argc){
if(intval($contact['duplex']) && $contact['dfrn-id'])
$idtosend = '0:' . $orig_id;
if(intval($contact['duplex']) && $contact['issued-id'])
- $idtosend = '1:' . $orig_id;
+ $idtosend = '1:' . $orig_id;
+
+ // they have permission to write to us. We already filtered this in the contact query.
+ $perm = 'rw';
$url = $contact['poll'] . '?dfrn_id=' . $idtosend
. '&dfrn_version=' . DFRN_PROTOCOL_VERSION
- . '&type=data&last_update=' . $last_update ;
+ . '&type=data&last_update=' . $last_update
+ . '&perm=' . $perm ;
$xml = fetch_url($url);
@@ -250,13 +254,14 @@ function poller_run($argv, $argc){
$final_dfrn_id = substr($final_dfrn_id,2);
if($final_dfrn_id != $orig_id) {
-
+ logger('poller: ID did not decode: ' . $contact['id'] . ' orig: ' . $orig_id . ' final: ' . $final_dfrn_id);
// did not decode properly - cannot trust this site
continue;
}
$postvars['dfrn_id'] = $idtosend;
$postvars['dfrn_version'] = DFRN_PROTOCOL_VERSION;
+ $postvars['perm'] = 'rw';
$xml = post_url($contact['poll'],$postvars);
}
@@ -264,6 +269,11 @@ function poller_run($argv, $argc){
// $contact['network'] !== 'dfrn'
+ if(($contact['notify']) && (! $contact['writable'])) {
+ q("UPDATE `contact` SET `writable` = 1 WHERE `id` = %d LIMIT 1",
+ intval($contact['id'])
+ );
+ }
$xml = fetch_url($contact['poll']);
}
diff --git a/include/profile_advanced.php b/include/profile_advanced.php
new file mode 100644
index 000000000..c1dfad66f
--- /dev/null
+++ b/include/profile_advanced.php
@@ -0,0 +1,258 @@
+<?php
+
+function advanced_profile(&$a) {
+
+$o .= '';
+
+$o .= '<h2>' . t('Profile') . '</h2>';
+
+if($a->profile['name']) {
+ $lbl_fullname = t('Full Name:');
+ $fullname = $a->profile['name'];
+
+$o .= <<< EOT
+<div id="advanced-profile-name-wrapper" >
+<div id="advanced-profile-name-text">$lbl_fullname</div>
+<div id="advanced-profile-name">$fullname</div>
+</div>
+<div id="advanced-profile-name-end"></div>
+EOT;
+}
+
+if($a->profile['gender']) {
+ $lbl_gender = t('Gender:');
+ $gender = $a->profile['gender'];
+
+$o .= <<< EOT
+<div id="advanced-profile-gender-wrapper" >
+<div id="advanced-profile-gender-text">$lbl_gender</div>
+<div id="advanced-profile-gender">$gender</div>
+</div>
+<div id="advanced-profile-gender-end"></div>
+EOT;
+}
+
+if(($a->profile['dob']) && ($a->profile['dob'] != '0000-00-00')) {
+ $lbl_birthday = t('Birthday:');
+
+$o .= <<< EOT
+<div id="advanced-profile-dob-wrapper" >
+<div id="advanced-profile-dob-text">$lbl_birthday</div>
+EOT;
+
+// If no year, add an arbitrary one so just we can parse the month and day.
+
+$year_bd_format = t('j F, Y');
+$short_bd_format = t('j F');
+
+$o .= '<div id="advanced-profile-dob">'
+ . ((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'],6) . ' 00:00 +00:00',$short_bd_format)))
+ . "</div>\r\n</div>";
+
+$o .= '<div id="advanced-profile-dob-end"></div>';
+
+}
+
+if($age = age($a->profile['dob'],$a->profile['timezone'],'')) {
+ $lbl_age = t('Age:');
+$o .= <<< EOT
+<div id="advanced-profile-age-wrapper" >
+<div id="advanced-profile-age-text">$lbl_age</div>
+<div id="advanced-profile-age">$age</div>
+</div>
+<div id="advanced-profile-age-end"></div>
+EOT;
+}
+
+if($a->profile['marital']) {
+ $lbl_marital = t('<span class="heart">&hearts;</span> Status:');
+ $marital = $a->profile['marital'];
+
+$o .= <<< EOT
+<div id="advanced-profile-marital-wrapper" >
+<div id="advanced-profile-marital-text">$lbl_marital</div>
+<div id="advanced-profile-marital">$marital</div>
+EOT;
+
+if($a->profile['with']) {
+ $with = $a->profile['with'];
+ $o .= "<div id=\"advanced-profile-with\">($with)</div>";
+}
+$o .= <<< EOT
+</div>
+<div id="advanced-profile-marital-end"></div>
+EOT;
+}
+
+if($a->profile['sexual']) {
+ $lbl_sexual = t('Sexual Preference:');
+ $sexual = $a->profile['sexual'];
+
+$o .= <<< EOT
+<div id="advanced-profile-sexual-wrapper" >
+<div id="advanced-profile-sexual-text">$lbl_sexual</div>
+<div id="advanced-profile-sexual">$sexual</div>
+</div>
+<div id="advanced-profile-sexual-end"></div>
+EOT;
+}
+
+if($a->profile['homepage']) {
+ $lbl_homepage = t('Homepage:');
+ $homepage = linkify($a->profile['homepage']);
+$o .= <<< EOT
+<div id="advanced-profile-homepage-wrapper" >
+<div id="advanced-profile-homepage-text">$lbl_homepage</div>
+<div id="advanced-profile-homepage">$homepage</div>
+</div>
+<div id="advanced-profile-homepage-end"></div>
+EOT;
+}
+
+if($a->profile['politic']) {
+ $lbl_politic = t('Political Views:');
+ $politic = $a->profile['politic'];
+$o .= <<< EOT
+<div id="advanced-profile-politic-wrapper" >
+<div id="advanced-profile-politic-text">$lbl_politic</div>
+<div id="advanced-profile-politic">$politic</div>
+</div>
+<div id="advanced-profile-politic-end"></div>
+EOT;
+}
+
+if($a->profile['religion']) {
+ $lbl_religion = t('Religion:');
+ $religion = $a->profile['religion'];
+$o .= <<< EOT
+<div id="advanced-profile-religion-wrapper" >
+<div id="advanced-profile-religion-text">$lbl_religion</div>
+<div id="advanced-profile-religion">$religion</div>
+</div>
+<div id="advanced-profile-religion-end"></div>
+EOT;
+}
+if($txt = prepare_text($a->profile['about'])) {
+ $lbl_about = t('About:');
+$o .= <<< EOT
+<div id="advanced-profile-about-wrapper" >
+<div id="advanced-profile-about-text">$lbl_about</div>
+<br />
+<div id="advanced-profile-about">$txt</div>
+</div>
+<div id="advanced-profile-about-end"></div>
+EOT;
+}
+
+if($txt = prepare_text($a->profile['interest'])) {
+ $lbl_interests = t('Hobbies/Interests:');
+$o .= <<< EOT
+<div id="advanced-profile-interest-wrapper" >
+<div id="advanced-profile-interest-text">$lbl_interests</div>
+<br />
+<div id="advanced-profile-interest">$txt</div>
+</div>
+<div id="advanced-profile-interest-end"></div>
+EOT;
+}
+
+if($txt = prepare_text($a->profile['contact'])) {
+ $lbl_contact = t('Contact information and Social Networks:');
+$o .= <<< EOT
+<div id="advanced-profile-contact-wrapper" >
+<div id="advanced-profile-contact-text">$lbl_contact</div>
+<br />
+<div id="advanced-profile-contact">$txt</div>
+</div>
+<div id="advanced-profile-contact-end"></div>
+EOT;
+}
+
+if($txt = prepare_text($a->profile['music'])) {
+ $lbl_music = t('Musical interests:');
+$o .= <<< EOT
+<div id="advanced-profile-music-wrapper" >
+<div id="advanced-profile-music-text">$lbl_music</div>
+<br />
+<div id="advanced-profile-music">$txt</div>
+</div>
+<div id="advanced-profile-music-end"></div>
+EOT;
+}
+
+if($txt = prepare_text($a->profile['book'])) {
+ $lbl_book = t('Books, literature:');
+$o .= <<< EOT
+<div id="advanced-profile-book-wrapper" >
+<div id="advanced-profile-book-text">$lbl_book</div>
+<br />
+<div id="advanced-profile-book">$txt</div>
+</div>
+<div id="advanced-profile-book-end"></div>
+EOT;
+}
+
+if($txt = prepare_text($a->profile['tv'])) {
+ $lbl_tv = t('Television:');
+$o .= <<< EOT
+<div id="advanced-profile-tv-wrapper" >
+<div id="advanced-profile-tv-text">$lbl_tv</div>
+<br />
+<div id="advanced-profile-tv">$txt</div>
+</div>
+<div id="advanced-profile-tv-end"></div>
+EOT;
+}
+
+if($txt = prepare_text($a->profile['film'])) {
+ $lbl_film = t('Film/dance/culture/entertainment:');
+$o .= <<< EOT
+<div id="advanced-profile-film-wrapper" >
+<div id="advanced-profile-film-text">$lbl_film</div>
+<br />
+<div id="advanced-profile-film">$txt</div>
+</div>
+<div id="advanced-profile-film-end"></div>
+EOT;
+}
+
+if($txt = prepare_text($a->profile['romance'])) {
+ $lbl_romance = t('Love/Romance:');
+$o .= <<< EOT
+<div id="advanced-profile-romance-wrapper" >
+<div id="advanced-profile-romance-text">$lbl_romance</div>
+<br />
+<div id="advanced-profile-romance">$txt</div>
+</div>
+<div id="advanced-profile-romance-end"></div>
+EOT;
+}
+
+if($txt = prepare_text($a->profile['work'])) {
+ $lbl_work = t('Work/employment:');
+$o .= <<< EOT
+<div id="advanced-profile-work-wrapper" >
+<div id="advanced-profile-work-text">$lbl_work</div>
+<br />
+<div id="advanced-profile-work">$txt</div>
+</div>
+<div id="advanced-profile-work-end"></div>
+EOT;
+}
+
+if($txt = prepare_text($a->profile['education'])) {
+ $lbl_education = t('School/education:');
+$o .= <<< EOT
+<div id="advanced-profile-education-wrapper" >
+<div id="advanced-profile-education-text">$lbl_education</div>
+<br />
+<div id="advanced-profile-education">$txt</div>
+</div>
+<div id="advanced-profile-education-end"></div>
+EOT;
+}
+
+return $o;
+}