X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fidentity.php;h=0282b2d9a51a1a14ff4bb0c417714ff071a41317;hb=56e7b2002d156f49c92752c289be84a732081d85;hp=bc930a3c6f4d72836f96a247bf7afc4a69eba38f;hpb=28f0e9a2de449232c6a1eb031f7ba056f9ae11eb;p=friendica.git diff --git a/include/identity.php b/include/identity.php index bc930a3c6f..0282b2d9a5 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1,4 +1,9 @@ profile = $r[0]; + $a->profile_uid = $r[0]['profile_uid']; $a->profile['mobile-theme'] = get_pconfig($a->profile['profile_uid'], 'system', 'mobile_theme'); $a->profile['network'] = NETWORK_DFRN; $a->page['title'] = $a->profile['name'] . " @ " . $a->config['sitename']; - if (!$profiledata) - $_SESSION['theme'] = $a->profile['theme']; +// if (!$profiledata) +// $_SESSION['theme'] = $a->profile['theme']; $_SESSION['mobile-theme'] = $a->profile['mobile-theme']; @@ -174,7 +180,7 @@ if(! function_exists('profile_sidebar')) { if (($profile['network'] != "") AND ($profile['network'] != NETWORK_DFRN)) { require_once('include/contact_selectors.php'); if ($profile['url'] != "") - $profile['network_name'] = ''.network_to_name($profile['network']).""; + $profile['network_name'] = ''.network_to_name($profile['network'], $profile['url']).""; else $profile['network_name'] = network_to_name($profile['network']); } else @@ -210,7 +216,12 @@ if(! function_exists('profile_sidebar')) { } if ($connect AND ($profile['network'] != NETWORK_DFRN) AND !isset($profile['remoteconnect'])) - $connect = false; + $connect = false; + + if ($connect) + $subscribe_feed = t("Atom feed"); + else + $subscribe_feed = false; if (isset($profile['remoteconnect'])) $remoteconnect = $profile['remoteconnect']; @@ -284,6 +295,7 @@ if(! function_exists('profile_sidebar')) { $lastname = (($firstname === $profile['name']) ? '' : trim(substr($profile['name'],strlen($firstname)))); $diaspora = array( + 'guid' => $profile['guid'], 'podloc' => $a->get_baseurl(), 'searchable' => (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' ), 'nickname' => $profile['nickname'], @@ -304,7 +316,7 @@ if(! function_exists('profile_sidebar')) { if(count($r)) $updated = date("c", strtotime($r[0]['updated'])); - $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 AND `hidden` = 0 AND `archive` = 0 + $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 AND `network` IN ('%s', '%s', '%s', '')", intval($profile['uid']), dbesc(NETWORK_DFRN), @@ -330,6 +342,7 @@ if(! function_exists('profile_sidebar')) { '$profile' => $p, '$connect' => $connect, '$remoteconnect' => $remoteconnect, + '$subscribe_feed' => $subscribe_feed, '$wallmessage' => $wallmessage, '$location' => $location, '$gender' => $gender, @@ -499,7 +512,7 @@ if(! function_exists('get_events')) { } $today = ((substr($strt,0,10) === datetime_convert('UTC',$a->timezone,'now','Y-m-d')) ? true : false); - + $rr['title'] = $title; $rr['description'] = $desciption; $rr['date'] = day_translate(datetime_convert('UTC', $rr['adjust'] ? $a->timezone : 'UTC', $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : ''); @@ -523,29 +536,30 @@ if(! function_exists('get_events')) { function advanced_profile(&$a) { $o = ''; + $uid = $a->profile['uid']; - $o .= replace_macros(get_markup_template("section_title.tpl"),array( + $o .= replace_macros(get_markup_template('section_title.tpl'),array( '$title' => t('Profile') )); if($a->profile['name']) { $tpl = get_markup_template('profile_advanced.tpl'); - + $profile = array(); - + $profile['fullname'] = array( t('Full Name:'), $a->profile['name'] ) ; - + if($a->profile['gender']) $profile['gender'] = array( t('Gender:'), $a->profile['gender'] ); - + if(($a->profile['dob']) && ($a->profile['dob'] != '0000-00-00')) { - + $year_bd_format = t('j F, Y'); $short_bd_format = t('j F'); - - $val = ((intval($a->profile['dob'])) + + $val = ((intval($a->profile['dob'])) ? day_translate(datetime_convert('UTC','UTC',$a->profile['dob'] . ' 00:00 +00:00',$year_bd_format)) : day_translate(datetime_convert('UTC','UTC','2001-' . substr($a->profile['dob'],5) . ' 00:00 +00:00',$short_bd_format))); @@ -554,7 +568,7 @@ function advanced_profile(&$a) { } if($age = age($a->profile['dob'],$a->profile['timezone'],'')) $profile['age'] = array( t('Age:'), $age ); - + if($a->profile['marital']) $profile['marital'] = array( t('Status:'), $a->profile['marital']); @@ -589,7 +603,7 @@ function advanced_profile(&$a) { if($txt = prepare_text($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt); if($txt = prepare_text($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt); - + if($txt = prepare_text($a->profile['book'])) $profile['book'] = array( t('Books, literature:'), $txt); if($txt = prepare_text($a->profile['tv'])) $profile['tv'] = array( t('Television:'), $txt); @@ -597,14 +611,19 @@ function advanced_profile(&$a) { if($txt = prepare_text($a->profile['film'])) $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt); if($txt = prepare_text($a->profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt); - + if($txt = prepare_text($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt); if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt ); - + + //show subcribed forum if it is enabled in the usersettings + if (feature_enabled($uid,'forumlist_profile')) { + $profile['forumlist'] = array( t('Forums:'), forumlist_profile_advanced($uid)); + } + if ($a->profile['uid'] == local_user()) $profile['edit'] = array($a->get_baseurl(). '/profiles/'.$a->profile['id'], t('Edit profile'),"", t('Edit profile')); - + return replace_macros($tpl, array( '$title' => t('Profile'), '$profile' => $profile @@ -633,6 +652,7 @@ if(! function_exists('profile_tabs')){ 'sel' => ((!isset($tab)&&$a->argv[0]=='profile')?'active':''), 'title' => t('Status Messages and Posts'), 'id' => 'status-tab', + 'accesskey' => 'm', ), array( 'label' => t('Profile'), @@ -640,6 +660,7 @@ if(! function_exists('profile_tabs')){ 'sel' => ((isset($tab) && $tab=='profile')?'active':''), 'title' => t('Profile Details'), 'id' => 'profile-tab', + 'accesskey' => 'r', ), array( 'label' => t('Photos'), @@ -647,6 +668,7 @@ if(! function_exists('profile_tabs')){ 'sel' => ((!isset($tab)&&$a->argv[0]=='photos')?'active':''), 'title' => t('Photo Albums'), 'id' => 'photo-tab', + 'accesskey' => 'h', ), array( 'label' => t('Videos'), @@ -654,23 +676,27 @@ if(! function_exists('profile_tabs')){ 'sel' => ((!isset($tab)&&$a->argv[0]=='videos')?'active':''), 'title' => t('Videos'), 'id' => 'video-tab', + 'accesskey' => 'v', ), ); if ($is_owner){ - $tabs[] = array( - 'label' => t('Events'), - 'url' => $a->get_baseurl() . '/events', - 'sel' =>((!isset($tab)&&$a->argv[0]=='events')?'active':''), - 'title' => t('Events and Calendar'), - 'id' => 'events-tab', - ); + if ($a->theme_events_in_profile) + $tabs[] = array( + 'label' => t('Events'), + 'url' => $a->get_baseurl() . '/events', + 'sel' =>((!isset($tab)&&$a->argv[0]=='events')?'active':''), + 'title' => t('Events and Calendar'), + 'id' => 'events-tab', + 'accesskey' => 'e', + ); $tabs[] = array( 'label' => t('Personal Notes'), 'url' => $a->get_baseurl() . '/notes', 'sel' =>((!isset($tab)&&$a->argv[0]=='notes')?'active':''), 'title' => t('Only You Can See This'), 'id' => 'notes-tab', + 'accesskey' => 't', ); } @@ -701,7 +727,7 @@ function zrl_init(&$a) { $result = Cache::get("gprobe:".$urlparts["host"]); if (!is_null($result)) { $result = unserialize($result); - if ($result["network"] == NETWORK_FEED) { + if (in_array($result["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) { logger("DDoS attempt detected for ".$urlparts["host"]." by ".$_SERVER["REMOTE_ADDR"].". server data: ".print_r($_SERVER, true), LOGGER_DEBUG); return; } @@ -726,3 +752,19 @@ function zrl($s,$force = false) { return $s . $achar . 'zrl=' . urlencode($mine); return $s; } + +// Used from within PCSS themes to set theme parameters. If there's a +// puid request variable, that is the "page owner" and normally their theme +// settings take precedence; unless a local user sets the "always_my_theme" +// system pconfig, which means they don't want to see anybody else's theme +// settings except their own while on this site. + +function get_theme_uid() { + $uid = (($_REQUEST['puid']) ? intval($_REQUEST['puid']) : 0); + if(local_user()) { + if((get_pconfig(local_user(),'system','always_my_theme')) || (! $uid)) + return local_user(); + } + + return $uid; +}