identity.php - code cleanup + doxygen

This commit is contained in:
rabuzarus 2015-12-25 17:26:04 +01:00
parent e42bbcd6c4
commit 839895e434
2 changed files with 527 additions and 528 deletions

View File

@ -9,12 +9,8 @@ require_once("mod/proxy.php");
/**
*
* Function : profile_load
* @parameter App $a
* @parameter string $nickname
* @parameter int $profile
* @brief Loads a profile into the page sidebar.
*
* Summary: Loads a profile into the page sidebar.
* The function requires a writeable copy of the main App structure, and the nickname
* of a registered local account.
*
@ -26,13 +22,15 @@ require_once("mod/proxy.php");
* Profile information is placed in the App structure for later retrieval.
* Honours the owner's chosen theme for display.
*
* IMPORTANT: Should only be run in the _init() functions of a module. That ensures that
* @attention Should only be run in the _init() functions of a module. That ensures that
* the theme is chosen before the _init() function of a theme is run, which will usually
* load a lot of theme-specific content
*
* @param App $a
* @param string $nickname
* @param int $profile
* @param array $profiledata
*/
if(! function_exists('profile_load')) {
function profile_load(&$a, $nickname, $profile = 0, $profiledata = array()) {
$user = q("SELECT `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1",
@ -78,7 +76,7 @@ if(! function_exists('profile_load')) {
$_SESSION['mobile-theme'] = $a->profile['mobile-theme'];
/**
/*
* load/reload current theme info
*/
@ -101,9 +99,11 @@ if(! function_exists('profile_load')) {
$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
/**
* @todo
* 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
@ -114,11 +114,11 @@ if(! function_exists('profile_load')) {
return;
}
}
/**
* @brief Get all profil data of a local user
*
* If the viewer is an authenticated remote viewer, the profile displayed is the
* one that has been configured for his/her viewing in the Contact manager.
* Passing a non-zero profile ID can also allow a preview of a selected profile
@ -170,20 +170,18 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0) {
/**
* @brief Formats a profile for display in the sidebar.
*
* Function: profile_sidebar
*
* Formats a profile for display in the sidebar.
* It is very difficult to templatise the HTML completely
* because of all the conditional logic.
*
* @parameter: array $profile
* @param array $profile
* @param int $block
*
* Returns HTML string stuitable for sidebar inclusion
* Exceptions: Returns empty string if passed $profile is wrong type or not populated
* @return HTML string stuitable for sidebar inclusion
*
* @note Returns empty string if passed $profile is wrong type or not populated
*/
if(! function_exists('profile_sidebar')) {
function profile_sidebar($profile, $block = 0) {
$a = get_app();
@ -400,10 +398,8 @@ if(! function_exists('profile_sidebar')) {
return $o;
}
}
if(! function_exists('get_birthdays')) {
function get_birthdays() {
$a = get_app();
@ -484,10 +480,8 @@ if(! function_exists('get_birthdays')) {
));
}
}
if(! function_exists('get_events')) {
function get_events() {
require_once('include/bbcode.php');
@ -567,7 +561,6 @@ if(! function_exists('get_events')) {
'$events' => $r,
));
}
}
function advanced_profile(&$a) {
@ -669,7 +662,6 @@ function advanced_profile(&$a) {
return '';
}
if(! function_exists('profile_tabs')){
function profile_tabs($a, $is_owner=False, $nickname=Null){
//echo "<pre>"; var_dump($a->user); killme();
@ -754,7 +746,6 @@ if(! function_exists('profile_tabs')){
return replace_macros($tpl,array('$tabs' => $arr['tabs']));
}
}
function get_my_url() {
if(x($_SESSION,'my_url'))
@ -799,12 +790,20 @@ function zrl($s,$force = false) {
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.
/**
* @brief Get the user ID of the page owner
*
* 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.
*
* @return int user ID
*
* @note Returns local_user instead of user ID if "always_my_theme"
* is set to true
*/
function get_theme_uid() {
$uid = (($_REQUEST['puid']) ? intval($_REQUEST['puid']) : 0);
if(local_user()) {

View File

@ -1,6 +1,6 @@
<?php
/**
* @file include/identity.php
* @file include/plugin.php
*
* @brief Some functions to handle addons and themes.
*/