]> git.mxchange.org Git - friendica.git/blobdiff - mod/profile.php
Merge branch 'pull'
[friendica.git] / mod / profile.php
old mode 100644 (file)
new mode 100755 (executable)
index b7f2c96..428679f
@@ -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;
@@ -21,7 +27,7 @@ function profile_init(&$a) {
        profile_load($a,$which,$profile);
 
        if((x($a->profile,'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY)) {
-               $a->page['htmlhead'] .= '<meta name="friendika.community" content="true" />';
+               $a->page['htmlhead'] .= '<meta name="friendica.community" content="true" />';
        }
        if(x($a->profile,'openidserver'))                               
                $a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->profile['openidserver'] . '" />' . "\r\n";
@@ -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'] .= '<meta name="keywords" content="' . $keywords . '" />' . "\r\n" ;
        }
@@ -101,7 +107,7 @@ function profile_content(&$a, $update = 0) {
 
        $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
 
-       if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
+       if($a->user['hidewall'] && (! $is_owner) && (! $remote_contact)) {
                notice( t('Access to this profile has been restricted.') . EOL);
                return;
        }
@@ -122,7 +128,7 @@ function profile_content(&$a, $update = 0) {
                }
 
                if(x($_SESSION,'new_member') && $_SESSION['new_member'] && $is_owner)
-                       $o .= '<a href="newmember">' . t('Tips for New Members') . '</a>' . EOL;
+                       $o .= '<a href="newmember" id="newmember-tips" style="font-size: 1.2em;"><b>' . t('Tips for New Members') . '</b></a>' . EOL;
 
                $commpage = (($a->profile['page-flags'] == PAGE_COMMUNITY) ? true : false);
                $commvisitor = (($commpage && $remote_contact == true) ? true : false);
@@ -153,7 +159,7 @@ function profile_content(&$a, $update = 0) {
         * Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups
         */
 
-       $sql_extra = permissions_sql($a->profile['profile_uid'],$remote_contact,$groups);
+       $sql_extra = item_permissions_sql($a->profile['profile_uid'],$remote_contact,$groups);
 
 
        if($update) {
@@ -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`.`moderated` = 0 and `item`.`unseen` = 1
                        AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
                        AND `item`.`wall` = 1
                        $sql_extra
@@ -175,7 +181,7 @@ function profile_content(&$a, $update = 0) {
                $r = q("SELECT COUNT(*) AS `total`
                        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`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 
                        AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1
                        $sql_extra ",
                        intval($a->profile['profile_uid'])
@@ -191,7 +197,7 @@ function profile_content(&$a, $update = 0) {
                $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`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
                        AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1
                        $sql_extra
                        ORDER BY `item`.`created` DESC $pager_sql ",
@@ -212,16 +218,20 @@ 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 `item`.`moderated` = 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');
+       } else {
+               $items = array();
        }
 
        if($is_owner && ! $update) {
@@ -236,7 +246,7 @@ function profile_content(&$a, $update = 0) {
 
                $o .= '<div id="live-profile"></div>' . "\r\n";
                $o .= "<script> var profile_uid = " . $a->profile['profile_uid'] 
-                       . "; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
+                       . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
        }