X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fprofile.php;h=90a609d0361df46433c94f8f8066347fa871d82f;hb=1f074cb44c5deda5b480f5ff814ff3640ec843d0;hp=b7f2c96624af17bc672992b4d3322664a7c679ab;hpb=c45b903178f5dd0a6b98697db52de444c4a5d66a;p=friendica.git diff --git a/mod/profile.php b/mod/profile.php old mode 100644 new mode 100755 index b7f2c96624..90a609d036 --- a/mod/profile.php +++ b/mod/profile.php @@ -7,9 +7,15 @@ function profile_init(&$a) { if($a->argc > 1) $which = $a->argv[1]; else { - notice( t('No profile') . EOL ); - $a->error = 404; - return; + $r = q("select nickname from user where blocked = 0 and account_expired = 0 and verified = 1 order by rand() limit 1"); + if(count($r)) { + $which = $r[0]['nickname']; + } + else { + notice( t('Requested profile is not available.') . EOL ); + $a->error = 404; + return; + } } $profile = 0; @@ -32,7 +38,7 @@ function profile_init(&$a) { if(! $blocked) { $keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : ''); - $keywords = str_replace(array(',',' ',',,'),array(' ',',',','),$keywords); + $keywords = str_replace(array('#',',',' ',',,'),array('',' ',',',','),$keywords); if(strlen($keywords)) $a->page['htmlhead'] .= '' . "\r\n" ; } @@ -161,7 +167,7 @@ function profile_content(&$a, $update = 0) { $r = q("SELECT distinct(parent) 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 `item`.`parent` in (select parent from item where unseen = 1 ) + and `item`.`unseen` = 1 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`wall` = 1 $sql_extra @@ -212,18 +218,19 @@ function profile_content(&$a, $update = 0) { `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`network`, `contact`.`rel`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` - FROM `item`, (SELECT `p`.`id`,`p`.`created` FROM `item` AS `p` WHERE `p`.`parent` = `p`.`id`) AS `parentitem`, `contact` + FROM `item`, `contact` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 AND `contact`.`id` = `item`.`contact-id` AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - AND `item`.`parent` = `parentitem`.`id` AND `item`.`parent` IN ( %s ) - $sql_extra - ORDER BY `parentitem`.`created` DESC, `gravity` ASC, `item`.`created` ASC ", + AND `item`.`parent` IN ( %s ) + $sql_extra ", intval($a->profile['profile_uid']), dbesc($parents_str) ); } + $items = conv_sort($items,'created'); + if($is_owner && ! $update) { $o .= get_birthdays(); $o .= get_events(); @@ -236,7 +243,7 @@ function profile_content(&$a, $update = 0) { $o .= '
' . "\r\n"; $o .= "\r\n"; + . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; \r\n"; }