<?if(VALID_DOCUMENT != 1) die('what?');?>
<?
if(isset($_SESSION['addressbook']->prefs[$_REQUEST['entry']])){
$p = $_SESSION['addressbook']->prefs[$_REQUEST['entry']];
?>
<a href="<?=$_SERVER['PHP_SELF']?>?action=addressbook" style="<?=SMALL_STYLE?>">return to addressbook</a>
<div style="<?=HEADER_STYLE.BOLD_STYLE?>"><?=$p->name?></div>
<?if(strtolower(get_class($p)) == 'addressbookentry'){?>
<a href="<?=$_SERVER['PHP_SELF']?>?action=compose&to=<?=rawurlencode($p->getFullEmail())?>"><?=htmlspecialchars($p->get_email())?></a>
<?if(array_not_empty($p->info)){foreach($p->info as $section){?>
<div style="<?=BOLD_STYLE?>"><?=$section['name']?></div>
<?foreach($section['fields'] as $f){?>
<?=htmlspecialchars($GLOBALS['ADDITIONAL_FIELDS'][$f['key']])?>:
<?if($f['key'] == 'email'){
$email = $p->get_name().' <'.$f['value'].'>';
?>
<a href="<?=$_SERVER['PHP_SELF']?>?action=compose&to=<?=rawurlencode($email)?>"><?=htmlspecialchars($f['value'])?></a>
<?}else if($f['key'] == 'phone' || $f['key'] == 'mobile'){
$phone = preg_replace('/[^\d+]/','',$f['value']);
?>
<a href="tel:<?=rawurlencode($phone)?>"><?=htmlspecialchars($f['value'])?></a>
<?}else{?>
<?=htmlspecialchars($f['value'])?>
<?}?>
<br/>
<?}?>
<?}}?>
<?}else if(strtolower(get_class($p)) == 'addressbooklist'){?>
<a href="<?=$_SERVER['PHP_SELF']?>?action=compose&to=<?=rawurlencode($p->get_emails_presentation())?>">email to all</a>
<div>
<div style="<?=SMALL_STYLE.BOLD_STYLE?>">members:</div>
<?foreach($p->emails as $e){?>
<a href="<?=$_SERVER['PHP_SELF']?>?action=compose&to=<?=rawurlencode($e)?>"><?=htmlspecialchars($e)?></a>
<br/>
<?}?>
</div>
<?
}
}
else{
?>
<div style="<?=HEADER_STYLE.BOLD_STYLE?>">Addressbook</div>
<?
$was_list = false;
foreach($_SESSION['addressbook']->prefs as $key=>$p){
if(!$was_list && strtolower(get_class($p)) == 'addressbooklist'){
print '<div style="'.HEADER_STYLE.BOLD_STYLE.'">Lists</div>';
$was_list = true;
}
print '<div>'.
'<a href="'.$_SERVER['PHP_SELF'].'?action=addressbook&entry='.$key.'">'.$p->name.'</a>'.
'</div>';
}
?>
<?}?>