]> git.mxchange.org Git - friendica.git/blobdiff - mod/profile.php
Merge remote branch 'upstream/master'
[friendica.git] / mod / profile.php
old mode 100755 (executable)
new mode 100644 (file)
index 74e1a23..51f9444
@@ -2,6 +2,11 @@
 
 function profile_init(&$a) {
 
+       require_once('include/contact_widgets.php');
+
+       if(! x($a->page,'aside'))
+               $a->page['aside'] = '';
+
        $blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
 
        if($a->argc > 1)
@@ -9,7 +14,7 @@ function profile_init(&$a) {
        else {
                $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'];
+                       goaway($a->get_baseurl() . '/profile/' . $r[0]['nickname']);
                }
                else {
                        notice( t('Requested profile is not available.') . EOL );
@@ -27,7 +32,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";
@@ -59,6 +64,13 @@ function profile_init(&$a) {
 
 function profile_content(&$a, $update = 0) {
 
+        if (x($a->category)) {
+               $category = $a->category;
+       }
+        else {
+               $category = ((x($_GET,'category')) ? $_GET['category'] : '');
+       }
+
        if(get_config('system','block_public') && (! local_user()) && (! remote_user())) {
                return login();
        }
@@ -107,13 +119,14 @@ function profile_content(&$a, $update = 0) {
 
        $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
 
-       if($a->user['hidewall'] && (! $is_owner) && (! $remote_contact)) {
+       if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
                notice( t('Access to this profile has been restricted.') . EOL);
                return;
        }
 
-       
        if(! $update) {
+
+
                if(x($_GET,'tab'))
                        $tab = notags(trim($_GET['tab']));
 
@@ -135,6 +148,8 @@ function profile_content(&$a, $update = 0) {
 
                $celeb = ((($a->profile['page-flags'] == PAGE_SOAPBOX) || ($a->profile['page-flags'] == PAGE_COMMUNITY)) ? true : false);
 
+               $a->page['aside'] .= categories_widget($a->get_baseurl(true) . '/profile/' . $a->profile['nickname'],(x($category) ? xmlify($category) : ''));
+
                if(can_write_wall($a,$a->profile['profile_uid'])) {
 
                        $x = array(
@@ -159,7 +174,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) {
@@ -178,6 +193,10 @@ function profile_content(&$a, $update = 0) {
        }
        else {
 
+                if(x($category)) {
+                       $sql_extra .= file_tag_file_query('item',$category,'category');
+               }
+
                $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
@@ -204,6 +223,7 @@ function profile_content(&$a, $update = 0) {
                        intval($a->profile['profile_uid'])
 
                );
+
        }
 
        $parents_arr = array();