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 * @brief Loads a profile into the page sidebar.
* @parameter App $a
* @parameter string $nickname
* @parameter int $profile
* *
* Summary: Loads a profile into the page sidebar.
* The function requires a writeable copy of the main App structure, and the nickname * The function requires a writeable copy of the main App structure, and the nickname
* of a registered local account. * of a registered local account.
* *
@ -26,14 +22,16 @@ require_once("mod/proxy.php");
* Profile information is placed in the App structure for later retrieval. * Profile information is placed in the App structure for later retrieval.
* Honours the owner's chosen theme for display. * 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 * the theme is chosen before the _init() function of a theme is run, which will usually
* load a lot of theme-specific content * load a lot of theme-specific content
* *
* @param App $a
* @param string $nickname
* @param int $profile
* @param array $profiledata
*/ */
function profile_load(&$a, $nickname, $profile = 0, $profiledata = array()) {
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", $user = q("SELECT `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1",
dbesc($nickname) dbesc($nickname)
@ -78,7 +76,7 @@ if(! function_exists('profile_load')) {
$_SESSION['mobile-theme'] = $a->profile['mobile-theme']; $_SESSION['mobile-theme'] = $a->profile['mobile-theme'];
/** /*
* load/reload current theme info * 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); $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 * @todo
// But: When this profile was on the same server, then we could display the contacts * 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) if ($profiledata)
$a->page['aside'] .= profile_sidebar($profiledata, true); $a->page['aside'] .= profile_sidebar($profiledata, true);
else else
@ -113,12 +113,12 @@ if(! function_exists('profile_load')) {
$a->page['aside'] .= contact_block();*/ $a->page['aside'] .= contact_block();*/
return; return;
}
} }
/** /**
* @brief Get all profil data of a local user * @brief Get all profil data of a local user
*
* If the viewer is an authenticated remote viewer, the profile displayed is the * 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. * 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 * Passing a non-zero profile ID can also allow a preview of a selected profile
@ -170,21 +170,19 @@ 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 * It is very difficult to templatise the HTML completely
* because of all the conditional logic. * because of all the conditional logic.
* *
* @parameter: array $profile * @param array $profile
* @param int $block
* *
* Returns HTML string stuitable for sidebar inclusion * @return HTML string stuitable for sidebar inclusion
* Exceptions: Returns empty string if passed $profile is wrong type or not populated
* *
* @note Returns empty string if passed $profile is wrong type or not populated
*/ */
if(! function_exists('profile_sidebar')) { function profile_sidebar($profile, $block = 0) {
function profile_sidebar($profile, $block = 0) {
$a = get_app(); $a = get_app();
$o = ''; $o = '';
@ -399,12 +397,10 @@ if(! function_exists('profile_sidebar')) {
call_hooks('profile_sidebar', $arr); call_hooks('profile_sidebar', $arr);
return $o; return $o;
}
} }
if(! function_exists('get_birthdays')) { function get_birthdays() {
function get_birthdays() {
$a = get_app(); $a = get_app();
$o = ''; $o = '';
@ -483,12 +479,10 @@ if(! function_exists('get_birthdays')) {
'$rbr' => '}' '$rbr' => '}'
)); ));
}
} }
if(! function_exists('get_events')) { function get_events() {
function get_events() {
require_once('include/bbcode.php'); require_once('include/bbcode.php');
@ -566,7 +560,6 @@ if(! function_exists('get_events')) {
'$event_title' => t('Events this week:'), '$event_title' => t('Events this week:'),
'$events' => $r, '$events' => $r,
)); ));
}
} }
function advanced_profile(&$a) { function advanced_profile(&$a) {
@ -669,8 +662,7 @@ function advanced_profile(&$a) {
return ''; return '';
} }
if(! function_exists('profile_tabs')){ function profile_tabs($a, $is_owner=False, $nickname=Null){
function profile_tabs($a, $is_owner=False, $nickname=Null){
//echo "<pre>"; var_dump($a->user); killme(); //echo "<pre>"; var_dump($a->user); killme();
if (is_null($nickname)) if (is_null($nickname))
@ -753,7 +745,6 @@ if(! function_exists('profile_tabs')){
$tpl = get_markup_template('common_tabs.tpl'); $tpl = get_markup_template('common_tabs.tpl');
return replace_macros($tpl,array('$tabs' => $arr['tabs'])); return replace_macros($tpl,array('$tabs' => $arr['tabs']));
}
} }
function get_my_url() { function get_my_url() {
@ -799,12 +790,20 @@ function zrl($s,$force = false) {
return $s; 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 * @brief Get the user ID of the page owner
// 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 * Used from within PCSS themes to set theme parameters. If there's a
// settings except their own while on this site. * 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() { function get_theme_uid() {
$uid = (($_REQUEST['puid']) ? intval($_REQUEST['puid']) : 0); $uid = (($_REQUEST['puid']) ? intval($_REQUEST['puid']) : 0);
if(local_user()) { if(local_user()) {

View File

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