aboutsummaryrefslogtreecommitdiffstats
path: root/mod/profile.php
diff options
context:
space:
mode:
authorOlivier Migeot <olivier@migeot.org>2011-04-12 13:55:43 +0200
committerOlivier Migeot <olivier@migeot.org>2011-04-12 13:55:43 +0200
commit85f709320b588f3231875d097217bd9abd223c9f (patch)
tree988f92ae345657ece74dbcc9dd0d8f17d41f20a5 /mod/profile.php
parent294577a48b2d6356dd7695716ea0379bf3a087df (diff)
parent6da84027afa18633ac5d5dacce99bb244be2aa7b (diff)
downloadvolse-hubzilla-85f709320b588f3231875d097217bd9abd223c9f.tar.gz
volse-hubzilla-85f709320b588f3231875d097217bd9abd223c9f.tar.bz2
volse-hubzilla-85f709320b588f3231875d097217bd9abd223c9f.zip
Merge remote branch 'mike/master'
Diffstat (limited to 'mod/profile.php')
-rw-r--r--mod/profile.php211
1 files changed, 9 insertions, 202 deletions
diff --git a/mod/profile.php b/mod/profile.php
index b421591f6..0a044069a 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -106,16 +106,9 @@ function profile_content(&$a, $update = 0) {
if($tab === 'profile') {
- $profile_lang = get_config('system','language');
- if(! $profile_lang)
- $profile_lang = 'en';
- if(file_exists("view/$profile_lang/profile_advanced.php"))
- require_once("view/$profile_lang/profile_advanced.php");
- else
- require_once('view/profile_advanced.php');
-
+ require_once('include/profile_advanced.php');
+ $o .= advanced_profile($a);
call_hooks('profile_advanced',$o);
-
return $o;
}
@@ -279,7 +272,7 @@ function profile_content(&$a, $update = 0) {
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`network`, `contact`.`rel`,
- `contact`.`thumb`, `contact`.`self`,
+ `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
@@ -295,203 +288,17 @@ function profile_content(&$a, $update = 0) {
if($is_owner && ! $update)
$o .= get_birthdays();
- $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');
-
- $droptpl = load_view_file('view/wall_item_drop.tpl');
- $fakedrop = load_view_file('view/wall_fake_drop.tpl');
-
- if($update)
- $return_url = $_SESSION['return_url'];
- else
- $return_url = $_SESSION['return_url'] = $a->cmd;
-
- $alike = array();
- $dlike = array();
-
- if($r !== false && count($r)) {
-
- $comments = array();
- foreach($r as $rr) {
- if(intval($rr['gravity']) == 6) {
- if(! x($comments,$rr['parent']))
- $comments[$rr['parent']] = 1;
- else
- $comments[$rr['parent']] += 1;
- }
- }
-
- foreach($r as $item) {
- like_puller($a,$item,$alike,'like');
- like_puller($a,$item,$dlike,'dislike');
- }
-
- $comments_collapsed = false;
- foreach($r as $item) {
+ require_once('include/conversation.php');
- $sparkle = '';
- $comment = '';
- $likebuttons = '';
+ $o .= conversation($a,$r,'profile',$update);
- $template = $tpl;
-
- $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
- if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE)))
- && ($item['id'] != $item['parent']))
- continue;
-
- if($item['id'] == $item['parent']) {
- $comments_seen = 0;
- $comments_collapsed = false;
- }
- else
- $comments_seen ++;
-
-
- 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>';
- $o .= '<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></div>';
- }
-
- $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>');
-
- if(can_write_wall($a,$a->profile['profile_uid'])) {
- if($item['id'] == $item['parent']) {
- $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($item['last-child']) {
- $comment = replace_macros($cmnt_tpl,array(
- '$return_path' => '',
- '$jsreload' => '', // $_SESSION['return_url'],
- '$type' => 'wall-comment',
- '$id' => $item['item_id'],
- '$parent' => $item['parent'],
- '$profile_uid' => $a->profile['profile_uid'],
- '$mylink' => $contact['url'],
- '$mytitle' => t('This is you'),
- '$myphoto' => $contact['thumb'],
- '$ww' => ''
- ));
- }
- }
-
-
- $profile_url = $item['url'];
-
- // This is my profile page but I'm not the author of this post/comment. If it's somebody that's a fan or mutual friend,
- // I can go directly to their profile as an authenticated guest.
-
- if(local_user() && ($item['contact-uid'] == local_user())
- && ($item['network'] === 'dfrn') && (! $item['self'] )) {
- $profile_url = $redirect_url;
- $sparkle = ' sparkle';
- }
- else
- $sparkle = '';
-
-
- $edpost = '';
- if((local_user()) && ($a->profile['profile_uid'] == local_user()) && ($item['id'] == $item['parent']) && (intval($item['wall']) == 1))
- $edpost = '<a class="editpost" href="' . $a->get_baseurl() . '/editpost/' . $item['id'] . '" title="' . t('Edit') . '"><img src="images/pencil.gif" /></a>';
-
-
- // We would prefer to use our own avatar link for this item because the one in the author-avatar might reference a
- // remote site (which could be down). We will use author-avatar if we haven't got something stored locally.
- // We use this same logic block in mod/network.php to determine it this is a third party post and we don't have any
- // local contact info at all. In this module you should never encounter a third-party author, but we still will do
- // the right thing if you ever do.
-
- $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'] : $item['thumb']);
-
- $profile_link = $profile_url;
-
- $drop = '';
- $dropping = false;
-
- if(($item['contact-id'] == remote_user()) || ($item['uid'] == local_user()))
- $dropping = true;
-
- $drop = replace_macros((($dropping)? $droptpl : $fakedrop), array('$id' => $item['id'], '$delete' => t('Delete')));
-
-
- $like = ((isset($alike[$item['id']])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
- $dislike = ((isset($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 = (($item['parent'] != $item['item_id']) ? ' comment' : '');
-
- if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
- $indent .= ' shiny';
-
-
- $tmp_item = replace_macros($template,array(
- '$id' => $item['item_id'],
- '$linktitle' => t('View $name\'s profile'),
- '$profile_url' => $profile_link,
- '$item_photo_menu' => item_photo_menu($item),
- '$name' => $profile_name,
- '$thumb' => $profile_avatar,
- '$sparkle' => $sparkle,
- '$title' => $item['title'],
- '$body' => smilies(bbcode($item['body'])),
- '$ago' => relative_date($item['created']),
- '$lock' => $lock,
- '$location' => $location,
- '$indent' => $indent,
- '$plink' => get_plink($item),
- '$edpost' => $edpost,
- '$drop' => $drop,
- '$like' => $like,
- '$vote' => $likebuttons,
- '$dislike' => $dislike,
- '$comment' => $comment
- ));
-
- $arr = array('item' => $item, 'output' => $tmp_item);
- call_hooks('display_item', $arr);
-
- $o .= $arr['output'];
-
- }
- }
-
- if($update) {
- return $o;
- }
+ if(! $update) {
- $o .= paginate($a);
- $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>';
+ $o .= paginate($a);
+ $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>';
+ }
return $o;
}