cleanup boot

This commit is contained in:
friendica 2012-12-31 17:18:11 -08:00
parent a8812346c4
commit 8d32477bff
3 changed files with 26 additions and 70 deletions

View File

@ -774,6 +774,7 @@ if(! class_exists('App')) {
return $this->curl_headers; return $this->curl_headers;
} }
//FIXME or remove
function get_cached_avatar_image($avatar_image){ function get_cached_avatar_image($avatar_image){
if($this->cached_profile_image[$avatar_image]) if($this->cached_profile_image[$avatar_image])
return $this->cached_profile_image[$avatar_image]; return $this->cached_profile_image[$avatar_image];
@ -1031,19 +1032,6 @@ function check_config(&$a) {
} }
function get_guid($size=16) {
$exists = true; // assume by default that we don't have a unique guid
do {
$s = random_string($size);
$r = q("select id from guid where guid = '%s' limit 1", dbesc($s));
if(! count($r))
$exists = false;
} while($exists);
q("insert into guid ( guid ) values ( '%s' ) ", dbesc($s));
return $s;
}
// wrapper for adding a login box. If $register == true provide a registration // wrapper for adding a login box. If $register == true provide a registration
// link. This will most always depend on the value of $a->config['register_policy']. // link. This will most always depend on the value of $a->config['register_policy'].
// returns the complete html for inserting into the page // returns the complete html for inserting into the page
@ -1209,7 +1197,7 @@ function profile_load(&$a, $nickname, $profile = 0) {
dbesc($nickname) dbesc($nickname)
); );
if(! ($user && count($user))) { if(! $user) {
logger('profile error: ' . $a->query_string, LOGGER_DEBUG); logger('profile error: ' . $a->query_string, LOGGER_DEBUG);
notice( t('Requested account is not available.') . EOL ); notice( t('Requested account is not available.') . EOL );
$a->error = 404; $a->error = 404;
@ -1251,7 +1239,7 @@ function profile_load(&$a, $nickname, $profile = 0) {
); );
} }
if(! ($r && count($r))) { if(! $r) {
logger('profile error: ' . $a->query_string, LOGGER_DEBUG); logger('profile error: ' . $a->query_string, LOGGER_DEBUG);
notice( t('Requested profile is not available.') . EOL ); notice( t('Requested profile is not available.') . EOL );
$a->error = 404; $a->error = 404;
@ -1264,7 +1252,7 @@ function profile_load(&$a, $nickname, $profile = 0) {
$x = q("select `keywords` from `profile` where uid = %d and `is_default` = 1 limit 1", $x = q("select `keywords` from `profile` where uid = %d and `is_default` = 1 limit 1",
intval($profile_uid) intval($profile_uid)
); );
if($x && count($x)) if($x)
$r[0]['keywords'] = $x[0]['keywords']; $r[0]['keywords'] = $x[0]['keywords'];
} }
@ -1285,20 +1273,9 @@ function profile_load(&$a, $nickname, $profile = 0) {
require_once($theme_info_file); require_once($theme_info_file);
} }
// 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); $block = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
$a->set_widget('profile',profile_sidebar($a->profile, $block)); $a->set_widget('profile',profile_sidebar($a->profile, $block));
/*if(! $block)
$a->page['aside'] .= contact_block();*/
return; return;
} }
} }
@ -1342,7 +1319,6 @@ if(! function_exists('profile_sidebar')) {
call_hooks('profile_sidebar_enter', $profile); call_hooks('profile_sidebar_enter', $profile);
// don't show connect link to yourself // don't show connect link to yourself
$connect = (($profile['uid'] != local_user()) ? t('Connect') : False); $connect = (($profile['uid'] != local_user()) ? t('Connect') : False);
@ -1378,8 +1354,7 @@ if(! function_exists('profile_sidebar')) {
local_user()); local_user());
if(count($r)) { if($r) {
foreach($r as $rr) { foreach($r as $rr) {
$profile['menu']['entries'][] = array( $profile['menu']['entries'][] = array(
'photo' => $rr['thumb'], 'photo' => $rr['thumb'],
@ -1387,21 +1362,13 @@ if(! function_exists('profile_sidebar')) {
'alt' => t('Profile Image'), 'alt' => t('Profile Image'),
'profile_name' => $rr['profile_name'], 'profile_name' => $rr['profile_name'],
'isdefault' => $rr['is_default'], 'isdefault' => $rr['is_default'],
'visibile_to_everybody' => t('visible to everybody'), 'visible_to_everybody' => t('visible to everybody'),
'edit_visibility' => t('Edit visibility'), 'edit_visibility' => t('Edit visibility'),
); );
} }
} }
} }
if((x($profile,'address') == 1) if((x($profile,'address') == 1)
|| (x($profile,'locality') == 1) || (x($profile,'locality') == 1)
|| (x($profile,'region') == 1) || (x($profile,'region') == 1)
@ -1410,10 +1377,7 @@ if(! function_exists('profile_sidebar')) {
$location = t('Location:'); $location = t('Location:');
$gender = ((x($profile,'gender') == 1) ? t('Gender:') : False); $gender = ((x($profile,'gender') == 1) ? t('Gender:') : False);
$marital = ((x($profile,'marital') == 1) ? t('Status:') : False); $marital = ((x($profile,'marital') == 1) ? t('Status:') : False);
$homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False); $homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False);
if(($profile['hidewall'] || $block) && (! local_user()) && (! remote_user())) { if(($profile['hidewall'] || $block) && (! local_user()) && (! remote_user())) {
@ -1424,32 +1388,24 @@ if(! function_exists('profile_sidebar')) {
? trim(substr($profile['name'],0,strpos($profile['name'],' '))) : $profile['name']); ? trim(substr($profile['name'],0,strpos($profile['name'],' '))) : $profile['name']);
$lastname = (($firstname === $profile['name']) ? '' : trim(substr($profile['name'],strlen($firstname)))); $lastname = (($firstname === $profile['name']) ? '' : trim(substr($profile['name'],strlen($firstname))));
logger('observer' . print_r($observer,true));
logger('uid' . $profile['uid']);
if(is_array($observer) if(is_array($observer)
&& perm_is_allowed($profile['uid'],$observer['xchan_hash'],'view_contacts')) { && perm_is_allowed($profile['uid'],$observer['xchan_hash'],'view_contacts')) {
$contact_block = contact_block(); $contact_block = contact_block();
} }
$tpl = get_markup_template('profile_vcard.tpl'); $tpl = get_markup_template('profile_vcard.tpl');
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$profile' => $profile, '$profile' => $profile,
'$connect' => $connect, '$connect' => $connect,
'$wallmessage' => $wallmessage, '$location' => $location,
'$location' => template_escape($location),
'$gender' => $gender, '$gender' => $gender,
'$pdesc' => $pdesc, '$pdesc' => $pdesc,
'$marital' => $marital, '$marital' => $marital,
'$homepage' => $homepage, '$homepage' => $homepage,
'$diaspora' => $diaspora,
'$contact_block' => $contact_block, '$contact_block' => $contact_block,
)); ));
$arr = array('profile' => &$profile, 'entry' => &$o); $arr = array('profile' => &$profile, 'entry' => &$o);
call_hooks('profile_sidebar', $arr); call_hooks('profile_sidebar', $arr);
@ -1458,6 +1414,7 @@ logger('uid' . $profile['uid']);
} }
} }
// FIXME
if(! function_exists('get_birthdays')) { if(! function_exists('get_birthdays')) {
function get_birthdays() { function get_birthdays() {
@ -1536,6 +1493,7 @@ if(! function_exists('get_birthdays')) {
} }
} }
// FIXME
if(! function_exists('get_events')) { if(! function_exists('get_events')) {
function get_events() { function get_events() {

View File

@ -6,7 +6,7 @@
// Returns an array // Returns an array
// $return['success'] boolean true if successful // $return['success'] boolean true if successful
// $return['abook_id'] Address book ID if successful // $return['abook'] Address book entry joined with xchan if successful
// $return['message'] error text if success is false. // $return['message'] error text if success is false.
require_once('include/zot.php'); require_once('include/zot.php');

View File

@ -18,8 +18,6 @@
<div class="fn label">$profile.name</div> <div class="fn label">$profile.name</div>
{{ if $pdesc }}<div class="title">$profile.pdesc</div>{{ endif }} {{ if $pdesc }}<div class="title">$profile.pdesc</div>{{ endif }}
<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="$profile.photo?rev=$profile.picdate" alt="$profile.name"></div> <div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="$profile.photo?rev=$profile.picdate" alt="$profile.name"></div>