';
@@ -1592,6 +1783,10 @@ function contact_block() {
$o .= '
';
}
+
+ $arr = array('contacts' => $r, 'output' => $o);
+
+ call_hooks('contact_block_end', $arr);
return $o;
}}
@@ -1654,12 +1849,34 @@ function aes_encrypt($val,$ky)
return mcrypt_encrypt($enc, $key, $val, $mode, mcrypt_create_iv( mcrypt_get_iv_size($enc, $mode), MCRYPT_DEV_URANDOM));
}}
+
+/**
+ *
+ * Function: linkify
+ *
+ * Replace naked text hyperlink with HTML formatted hyperlink
+ *
+ */
+
if(! function_exists('linkify')) {
function linkify($s) {
$s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%]*)/", '
$1', $s);
return($s);
}}
+
+/**
+ *
+ * Function: smilies
+ *
+ * Description:
+ * Replaces text emoticons with graphical images
+ *
+ * @Parameter: string $s
+ *
+ * Returns string
+ */
+
if(! function_exists('smilies')) {
function smilies($s) {
$a = get_app();
@@ -1739,14 +1956,159 @@ function profile_load(&$a, $nickname, $profile = 0) {
$a->profile = $r[0];
- $a->page['template'] = 'profile';
$a->page['title'] = $a->profile['name'];
$_SESSION['theme'] = $a->profile['theme'];
if(! (x($a->page,'aside')))
$a->page['aside'] = '';
+
+ $a->page['aside'] .= profile_sidebar($a->profile);
$a->page['aside'] .= contact_block();
return;
}}
+
+
+/**
+ *
+ * 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
+ *
+ * Returns HTML string stuitable for sidebar inclusion
+ * Exceptions: Returns empty string if passed $profile is wrong type or not populated
+ *
+ */
+
+
+if(! function_exists('profile_sidebar')) {
+function profile_sidebar($profile) {
+
+ $o = '';
+ $location = '';
+ $address = false;
+
+ if((! is_array($profile)) && (! count($profile)))
+ return $o;
+
+ $fullname = '
' . $profile['name'] . '
';
+
+ $tabs = '';
+
+ $photo = '
';
+
+ $connect = (($profile['uid'] != local_user()) ? '
' . t('Connect') . '' : '');
+
+ if((x($profile,'address') == 1)
+ || (x($profile,'locality') == 1)
+ || (x($profile,'region') == 1)
+ || (x($profile,'postal-code') == 1)
+ || (x($profile,'country-name') == 1))
+ $address = true;
+
+ if($address) {
+ $location .= '
' . t('Location:') . ' ';
+ $location .= ((x($profile,'address') == 1) ? '
' . $profile['address'] . '
' : '');
+ $location .= (((x($profile,'locality') == 1) || (x($profile,'region') == 1) || (x($profile,'postal-code') == 1))
+ ? '
' . $profile['locality'] . ''
+ . ((x($profile['locality']) == 1) ? t(', ') : '')
+ . '' . $profile['region'] . ''
+ . ' ' . $profile['postal-code'] . '' : '');
+ $location .= ((x($profile,'country-name') == 1) ? '
' . $profile['country-name'] . '' : '');
+ $location .= '
';
+
+ }
+
+ $gender = ((x($profile,'gender') == 1) ? '
' . t('Gender:') . ' ' . $profile['gender'] . '
' : '');
+
+ $pubkey = ((x($profile,'pubkey') == 1) ? '
' . $profile['pubkey'] . '
' : '');
+
+ $marital = ((x($profile,'marital') == 1) ? '
♥ ' . t('Status:') . ' ' . $profile['marital'] . '