Location: PHPKode > projects > CsWebmail > cswebmail-3.10/cswebmail-3.10/templates/show_headers.php
<?
if(VALID_DOCUMENT != 1) die('what?');
$mailbox = get_var('mailbox');
$query = get_var('query');
$label = get_var('label');
if(isset($_REQUEST['view'])){
  $view = get_var('view');
}
else{
  $view = $_SESSION['preferences']->getDefaultView();
}
     
$headers = false;

if($_SESSION['last_headers'] && $_SESSION['last_headers']->name == $mailbox && get_var('return')){
  $headers = $_SESSION['last_headers'];
}
else if($mailbox != '' || $query != '' || $label != ''){
  $sort_order = get_var('sort_order');
  if($sort_order == '')
    $sort_order = SORT_BY_DATE;
  $start_page = get_var('start_page');
  if($start_page == '')
    $start_page = 1;
  if($mailbox != ''){
    $headers = $_SESSION['mboxes']->createMailHeaders($mailbox,$sort_order,$start_page);
    if($headers){
      $headers->view = $view;
      $_SESSION['last_headers'] = $headers;
      $_SESSION['last_mailbox'] = $mailbox;
    }
  }
  else if($query != ''){
    $type = get_var('type');
    if($type === null) $type = 'or';
    $subject = get_var('subject');
    if($subject === null) $subject = true;
    $email = get_var('email');
    if($email === null) $email = true;
    $body = get_var('body');
    if($body === null) $body = true;
    $mbox = get_var('mbox');
    if($mbox === null) $mbox = get_mailboxes_names();
    
    $headers = $_SESSION['mboxes']->query($query,
                                          $type,
                                          $subject,
                                          $email,
                                          $body,
                                          $mbox);
  }
  else if($label != ''){
    $headers = $_SESSION['mboxes']->getLabeled($label,get_mailboxes_names());
  }
}
if($headers){
?>
<script type="text/javascript">
function set_label(form,label,set){
  if(label != ''){
    form['label'].value=label;
    form['action'].value=set?'set-label':'remove-label';
    form.submit();
  }
}
function move_messages(form,to){
  if(to != ''){
    form['newmailbox'].value=to;
    form['action'].value='move';
    form.submit();
  }
}
</script> 
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<input type="hidden" name="action"/>
<input type="hidden" name="newmailbox"/>
<input type="hidden" name="label"/>
<input type="hidden" name="view" value="<?=$view?>"/>
<table class="content hsides fixed w100">
<?$headers->print_presentation();?>
</table>
</form>
<?}else{?>
<div class="error">
No Such Mailbox : "<?=$mailbox?>".<br/>
Please check your settings.
</div>
<?}?> 
Return current item: CsWebmail