X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fprofile.php;h=1101c69981a262a4c6610021a936301d09998a7b;hb=a41b4c6e6726b1158a8d05f37c1630d67e462fe5;hp=5615573b952be9850f98b20d69339cf6c34c9eb4;hpb=5f54503780ac6f94bbfe2692682aab5355673d16;p=friendica.git diff --git a/mod/profile.php b/mod/profile.php index 5615573b95..1101c69981 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -28,6 +28,11 @@ function profile_init(&$a) { $a->page['htmlhead'] .= '' . "\r\n"; } + $keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : ''); + $keywords = str_replace(array(',',' ',',,'),array(' ',',',','),$keywords); + if(strlen($keywords)) + $a->page['htmlhead'] .= '' . "\r\n" ; + $a->page['htmlhead'] .= '' . "\r\n" ; $a->page['htmlhead'] .= '' . "\r\n" ; $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : '')); @@ -93,7 +98,10 @@ function profile_content(&$a, $update = 0) { $o .= replace_macros($tpl,array( '$url' => $a->get_baseurl() . '/' . $a->cmd, - '$phototab' => $a->get_baseurl() . '/photos/' . $a->profile['nickname'] + '$phototab' => $a->get_baseurl() . '/photos/' . $a->profile['nickname'], + '$status' => t('Status'), + '$profile' => t('Profile'), + '$photos' => t('Photos') )); @@ -125,7 +133,12 @@ function profile_content(&$a, $update = 0) { $a->page['htmlhead'] .= replace_macros($tpl, array( '$baseurl' => $a->get_baseurl(), '$geotag' => $geotag, - '$nickname' => $a->profile['nickname'] + '$nickname' => $a->profile['nickname'], + '$linkurl' => t('Please enter a link URL:'), + '$utubeurl' => t('Please enter a YouTube link:'), + '$vidurl' => t("Please enter a video\x28.ogg\x29 link/URL:"), + '$audurl' => t("Please enter an audio\x28.ogg\x29 link/URL:"), + '$whereareu' => t('Where are you right now?') )); require_once('include/acl_selectors.php'); @@ -152,6 +165,8 @@ function profile_content(&$a, $update = 0) { '$upload' => t('Upload photo'), '$weblink' => t('Insert web link'), '$youtube' => t('Insert YouTube video'), + '$video' => t('Insert Vorbis [.ogg] video'), + '$audio' => t('Insert Vorbis [.ogg] audio'), '$setloc' => t('Set your location'), '$noloc' => t('Clear browser location'), '$wait' => t('Please wait'), @@ -228,31 +243,52 @@ function profile_content(&$a, $update = 0) { FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` AND `wall` = 1 ) + AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1 $sql_extra ", intval($a->profile['profile_uid']) ); - if(count($r)) + if(count($r)) { $a->set_pager_total($r[0]['total']); + $a->set_pager_itemspage(40); + } - $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, - `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`network`, `contact`.`rel`, - `contact`.`thumb`, `contact`.`self`, - `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` + $r = q("SELECT `item`.`id` AS `item_id`, `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 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` AND `wall` = 1 ) + AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1 $sql_extra - ORDER BY `parent` DESC, `gravity` ASC, `id` ASC LIMIT %d ,%d ", + ORDER BY `item`.`created` DESC LIMIT %d ,%d ", intval($a->profile['profile_uid']), intval($a->pager['start']), intval($a->pager['itemspage']) ); + $parents_arr = array(); + $parents_str = ''; + + if(count($r)) { + foreach($r as $rr) + $parents_arr[] = $rr['item_id']; + $parents_str = implode(', ', $parents_arr); + + $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, + `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`network`, `contact`.`rel`, + `contact`.`thumb`, `contact`.`self`, + `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 + AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 + AND `item`.`parent` IN ( %s ) + $sql_extra + ORDER BY `parent` DESC, `gravity` ASC, `item`.`id` ASC ", + intval($a->profile['profile_uid']), + dbesc($parents_str) + ); + } if($is_owner && ! $update) $o .= get_birthdays(); @@ -260,6 +296,7 @@ function profile_content(&$a, $update = 0) { $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'); @@ -276,11 +313,23 @@ function profile_content(&$a, $update = 0) { 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) { $sparkle = ''; @@ -295,6 +344,25 @@ function profile_content(&$a, $update = 0) { && ($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 .= ''; + $o .= ''; + } + $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])))) ? '
' . t('Private Message') . '
' @@ -302,10 +370,11 @@ function profile_content(&$a, $update = 0) { if(can_write_wall($a,$a->profile['profile_uid'])) { if($item['id'] == $item['parent']) { - $likebuttons = replace_macros($like_tpl,array( + $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') )); } @@ -339,6 +408,12 @@ function profile_content(&$a, $update = 0) { else $sparkle = ''; + + $edpost = ''; + if((local_user()) && ($a->profile['profile_uid'] == local_user()) && ($item['id'] == $item['parent']) && (intval($item['wall']) == 1)) + $edpost = ''; + + // 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 @@ -391,6 +466,7 @@ function profile_content(&$a, $update = 0) { '$location' => $location, '$indent' => $indent, '$plink' => get_plink($item), + '$edpost' => $edpost, '$drop' => $drop, '$like' => $like, '$vote' => $likebuttons, @@ -413,6 +489,5 @@ function profile_content(&$a, $update = 0) { $o .= paginate($a); $o .= '
' . t('Shared content is covered by the Creative Commons Attribution 3.0 license.') . '
'; - return $o; }