/** * @brief * * @param App &$a * @param boolean $connect */ function profile_create_sidebar(&$a, $connect = true) { $block = get_config('system', 'block_public') && !local_channel() && !remote_channel() ? true : false; $a->set_widget('profile', profile_sidebar($a->profile, $block, $connect)); }
function widget_fullprofile($arr) { $a = get_app(); if (!$a->profile['profile_uid']) { return; } $block = get_config('system', 'block_public') && !local_user() && !remote_user() ? true : false; return profile_sidebar($a->profile, $block); }
function profile_load(&$a, $nickname, $profile = 0) { $user = q("select uid from user where nickname = '%s' limit 1", dbesc($nickname)); if (!($user && count($user))) { logger('profile error: ' . $a->query_string, LOGGER_DEBUG); notice(t('Requested account is not available.') . EOL); $a->error = 404; return; } if (remote_user() && count($_SESSION['remote'])) { foreach ($_SESSION['remote'] as $visitor) { if ($visitor['uid'] == $user[0]['uid']) { $r = q("SELECT `profile-id` FROM `contact` WHERE `id` = %d LIMIT 1", intval($visitor['cid'])); if (count($r)) { $profile = $r[0]['profile-id']; } break; } } } $r = null; if ($profile) { $profile_int = intval($profile); $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`\n\t\t\t\t\tleft join `contact` on `contact`.`uid` = `profile`.`uid` LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid`\n\t\t\t\t\tWHERE `user`.`nickname` = '%s' AND `profile`.`id` = %d and `contact`.`self` = 1 LIMIT 1", dbesc($nickname), intval($profile_int)); } if (!$r && !count($r)) { $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`\n\t\t\t\t\tleft join `contact` on `contact`.`uid` = `profile`.`uid` LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid`\n\t\t\t\t\tWHERE `user`.`nickname` = '%s' AND `profile`.`is-default` = 1 and `contact`.`self` = 1 LIMIT 1", dbesc($nickname)); } if ($r === false || !count($r)) { logger('profile error: ' . $a->query_string, LOGGER_DEBUG); notice(t('Requested profile is not available.') . EOL); $a->error = 404; return; } // fetch user tags if this isn't the default profile if (!$r[0]['is-default']) { $x = q("select `pub_keywords` from `profile` where uid = %d and `is-default` = 1 limit 1", intval($r[0]['profile_uid'])); if ($x && count($x)) { $r[0]['pub_keywords'] = $x[0]['pub_keywords']; } } $a->profile = $r[0]; $a->profile['mobile-theme'] = get_pconfig($a->profile['profile_uid'], 'system', 'mobile_theme'); $a->page['title'] = $a->profile['name'] . " @ " . $a->config['sitename']; $_SESSION['theme'] = $a->profile['theme']; $_SESSION['mobile-theme'] = $a->profile['mobile-theme']; /** * load/reload current theme info */ $a->set_template_engine(); // reset the template engine to the default in case the user's theme doesn't specify one $theme_info_file = "view/theme/" . current_theme() . "/theme.php"; if (file_exists($theme_info_file)) { require_once $theme_info_file; } if (!x($a->page, 'aside')) { $a->page['aside'] = ''; } if (local_user() && local_user() == $a->profile['uid']) { $a->page['aside'] .= replace_macros(get_markup_template('profile_edlink.tpl'), array('$editprofile' => t('Edit profile'), '$profid' => $a->profile['id'])); } $block = get_config('system', 'block_public') && !local_user() && !remote_user() ? true : false; $a->page['aside'] .= profile_sidebar($a->profile, $block); /*if(! $block) $a->page['aside'] .= contact_block();*/ return; }
function widget_shortprofile($arr) { $a = get_app(); if (!$a->profile['profile_uid']) { return; } $block = get_config('system', 'block_public') && !local_channel() && !remote_channel() ? true : false; return profile_sidebar($a->profile, $block, true, true); }
function profile_load(&$a, $nickname, $profile = 0, $profiledata = array()) { $user = q("SELECT `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1", dbesc($nickname)); if (!$user && count($user) && !count($profiledata)) { logger('profile error: ' . $a->query_string, LOGGER_DEBUG); notice(t('Requested account is not available.') . EOL); $a->error = 404; return; } $pdata = get_profiledata_by_nick($nickname, $user[0]['uid'], $profile); if ($pdata === false || !count($pdata) && !count($profiledata)) { logger('profile error: ' . $a->query_string, LOGGER_DEBUG); notice(t('Requested profile is not available.') . EOL); $a->error = 404; return; } // fetch user tags if this isn't the default profile if (!$pdata['is-default']) { $x = q("SELECT `pub_keywords` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1", intval($pdata['profile_uid'])); if ($x && count($x)) { $pdata['pub_keywords'] = $x[0]['pub_keywords']; } } $a->profile = $pdata; $a->profile_uid = $pdata['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']; $_SESSION['mobile-theme'] = $a->profile['mobile-theme']; /** * load/reload current theme info */ $a->set_template_engine(); // reset the template engine to the default in case the user's theme doesn't specify one $theme_info_file = "view/theme/" . current_theme() . "/theme.php"; if (file_exists($theme_info_file)) { require_once $theme_info_file; } if (!x($a->page, 'aside')) { $a->page['aside'] = ''; } if (local_user() && local_user() == $a->profile['uid'] && $profiledata) { $a->page['aside'] .= replace_macros(get_markup_template('profile_edlink.tpl'), array('$editprofile' => t('Edit profile'), '$profid' => $a->profile['id'])); } $block = get_config('system', 'block_public') && !local_user() && !remote_user() ? true : false; // To-Do: // By now, the contact block isn't shown, when a different profile is given // But: When this profile was on the same server, then we could display the contacts if ($profiledata) { $a->page['aside'] .= profile_sidebar($profiledata, true); } else { $a->page['aside'] .= profile_sidebar($a->profile, $block); } /*if(! $block) $a->page['aside'] .= contact_block();*/ return; }
function profile_load(&$a, $nickname, $profile = 0) { if (remote_user()) { $r = q("SELECT `profile-id` FROM `contact` WHERE `id` = %d LIMIT 1", intval($_SESSION['visitor_id'])); if (count($r)) { $profile = $r[0]['profile-id']; } } $r = null; if ($profile) { $profile_int = intval($profile); $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile` \n\t\t\tleft join `contact` on `contact`.`uid` = `profile`.`uid` LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid`\n\t\t\tWHERE `user`.`nickname` = '%s' AND `profile`.`id` = %d and `contact`.`self` = 1 LIMIT 1", dbesc($nickname), intval($profile_int)); } if (!count($r)) { $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile` \n\t\t\tleft join `contact` on `contact`.`uid` = `profile`.`uid` LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid`\n\t\t\tWHERE `user`.`nickname` = '%s' AND `profile`.`is-default` = 1 and `contact`.`self` = 1 LIMIT 1", dbesc($nickname)); } if ($r === false || !count($r)) { notice(t('Requested profile is not available.') . EOL); $a->error = 404; return; } $a->profile = $r[0]; $a->page['title'] = $a->profile['name'] . " @ " . $a->config['sitename']; $_SESSION['theme'] = $a->profile['theme']; /** * load/reload current theme info */ $theme_info_file = "view/theme/" . current_theme() . "/theme.php"; if (file_exists($theme_info_file)) { require_once $theme_info_file; } if (!x($a->page, 'aside')) { $a->page['aside'] = ''; } if (local_user() && local_user() == $a->profile['uid']) { $a->page['aside'] .= replace_macros(get_markup_template('profile_edlink.tpl'), array('$editprofile' => t('Edit profile'), '$profid' => $a->profile['id'])); } $block = get_config('system', 'block_public') && !local_user() && !remote_user() ? true : false; $a->page['aside'] .= profile_sidebar($a->profile, $block); /*if(! $block) $a->page['aside'] .= contact_block();*/ return; }
function widget_shortprofile($arr) { if (!App::$profile['profile_uid']) { return; } $block = observer_prohibited(); return profile_sidebar(App::$profile, $block, true, true); }