Location: PHPKode > projects > CsWebmail > cswebmail-3.10/cswebmail-3.10/templates/main.php
<?
if(VALID_DOCUMENT != 1) die('what?');
// start gzip encoding
start_gzip();

// all actions that uses main design
if(check_www_authentication(true)){
  $standalone = ($_REQUEST['standalone'] == 'true');
    
  
  if($standalone){
    include(TMPLPATH."html_start.php");
    ?>
   
    <div id="notice">
    <?if(Notice::exists()){?>
    <div class="notice"><?=nl2br(Notice::erase());?></div>
    <?}?>
    <?if(Error::exists()){?>
    <pre class="error"><?=nl2br(Error::erase())?></pre>
    <?}?>
    </div>
   <?
    // show headers
    if($action == 'show-folder')
      include(TMPLPATH."show_headers.php");
    // read mail
    else if($action == 'read-mail' && $_SESSION['last_mail']){
      if($_SESSION['last_headers'] &&
         $_SESSION['last_headers']->name == $_SESSION['last_mail']->mailbox_name){
        $h = $_SESSION['last_headers']->get_header($_SESSION['last_mail']->key);
        if($h) $h->is_unseen = false;
      }
      $_SESSION['last_mail']->print_presentation();
    }
    else if(eregi('^compose',$action))
      include(TMPLPATH."compose.php");
    else if(eregi('^addressbook',$action))
      include(TMPLPATH."addressbook.php");
    else if(eregi('^folders',$action))
      include(TMPLPATH."edit_folders.php");
    else if(eregi('^settings',$action))
      include(TMPLPATH."settings.php");
    else if(eregi('^filters',$action))
      include(TMPLPATH."filters.php");
    else if(eregi('^restore',$action))
      include(TMPLPATH."restore.php");
    else if(eregi('^newsgroups',$action))
      include(TMPLPATH."newsgroups.php");
    else if(eregi('^labels',$action))
      include(TMPLPATH."labels.php");
    else if($action=='help')
      include(TMPLPATH."help.php");
    else if($action=='search')
      include(TMPLPATH."search_form.php");
    else if($action=='news' || $action == 'login' || $action == '')
      include(TMPLPATH."news.php");
    
    include(TMPLPATH."html_end.php");
  }
  else{
    include(TMPLPATH."html_start.php");
  ?>
<table cellpadding="0" class="content w100">
  <tr>
    <td class="menu center middle" rowspan="2" width="1">
    <iframe width="133" height="34" scrolling="no" frameborder="no" border="0" noborder marginwidth="0" marginheight="0" src="" id="infinite_frame">sorry ...</iframe>
    <script type="text/javascript"><!--
    frame = document.getElementById('infinite_frame');
    frame.src = '<?=$_SERVER['PHP_SELF']?>?action=infinite-session&'+'<?=sid()?>';
    //--></script>
    </td>
    <td class="menu left bottom">
      <div class="small"><?=date('l j F, Y')?></div>
      <div class="red huge">
      <?=$_SESSION['preferences']->getName().' &lt;'.$GLOBALS['MAIL_USER_NAME'].'@'.MAILSUFFIX.'&gt;'?>
      </div>
    </td>
    <td class="menu right top">
      <a href="<?=$_SERVER['PHP_SELF']?>?action=news">Whats New ?</a>&nbsp;|&nbsp;
      <a href="<?=$_SERVER['PHP_SELF']?>?action=settings">Settings</a>&nbsp;|&nbsp;
      <a href="<?=$_SERVER['PHP_SELF']?>?action=search">Search</a>&nbsp;|&nbsp;
      <a href="<?=$_SERVER['PHP_SELF']?>?action=help">Help</a>&nbsp;|&nbsp;
      <a href="<?=$_SERVER['PHP_SELF']?>?action=logout" class="bold" title="Don't forget to log out!">
      <?=isset($_SESSION['auto-id'])?'Forget me':'Log out'?>
      </a>&nbsp;
    </td>
  <tr>
    <td class="menu left bottom" colspan="2">
      <table class="content vsides">
      <tr>
      <?
      $tabs = array('compose'=>'Compose','addressbook'=>'Address Book','newsgroups'=>'News Groups',
                    'folders'=>'Edit Folders','filters'=>'Filters','restore'=>'Mail Restore');
      if($_SESSION['preferences']->getUseGnuPG()) 
        $tabs['gnupg'] = 'GnuPG';
      foreach($tabs as $act=>$name){
        $extra = $act=='compose'?'class="standalone"':'';
      ?>
      <td class="nowrap <?=strpos($action,$act)===0?'checked bold':''?>">
      &nbsp;
      <a href="<?=$_SERVER['PHP_SELF']?>?action=<?=$act?>" title="Go to <?=$name?>" <?=$extra?>><?=$name?></a>
      &nbsp;
      </td>
      <?}?>
      </tr>
      </table>
    </td>
  </tr>
<tr>
   <td>
   <div class="checked top round-tl round-br round-bl" style="padding: 0px 10px 10px 5px;">
   <?include(TMPLPATH."show_folders.php");?>
   </div>
   </td>
   <td class="left top w100" colspan="2">
   <div class="checked round-tr round-br" style="padding: 10px 10px 10px 0px;">
   
   <div id="notice">
   <?if(Notice::exists()){?>
   <div class="notice"><?=nl2br(Notice::erase());?></div>
   <?}?>
   <?if(Error::exists()){?>
   <pre class="error"><?=nl2br(Error::erase())?></pre>
   <?}?>
   </div>
   
   <table width="100%"><tr><td style="padding:3px;margin:10px;">
  <?
     // show headers
     if($action == 'show-folder')
       include(TMPLPATH."show_headers.php");
     // read mail
     else if($action == 'read-mail' && $_SESSION['last_mail']){
       if($_SESSION['last_headers'] &&
          $_SESSION['last_headers']->name == $_SESSION['last_mail']->mailbox_name){
         $h = $_SESSION['last_headers']->get_header($_SESSION['last_mail']->key);
         if($h) $h->is_unseen = false;
       }
       $_SESSION['last_mail']->print_presentation();
     }
     else if(eregi('^compose',$action))
       include(TMPLPATH."compose.php");
     else if(eregi('^addressbook',$action))
       include(TMPLPATH."addressbook.php");
     else if(eregi('^folders',$action))
       include(TMPLPATH."edit_folders.php");
     else if(eregi('^settings',$action))
       include(TMPLPATH."settings.php");
     else if(eregi('^filters',$action))
       include(TMPLPATH."filters.php");
     else if(eregi('^restore',$action))
       include(TMPLPATH."restore.php");
     else if(eregi('^newsgroups',$action))
       include(TMPLPATH."newsgroups.php");
     else if(eregi('^labels',$action))
       include(TMPLPATH."labels.php");
     else if(eregi('^gnupg',$action))
       include(TMPLPATH."gnupg.php");
     else if($action=='help')
       include(TMPLPATH."help.php");
     else if($action=='search')
       include(TMPLPATH."search_form.php");
     else if($action=='news' || $action == 'login' || $action == '')
       include(TMPLPATH."news.php");
  }
     ?>
    </td></tr></table>
    </div>

<?if(!$standalone){?>
        
<?if(array_not_empty($GLOBALS['TIPS'])){?>
<div id="tips">
<?
  shuffle($GLOBALS['TIPS']);
  print $GLOBALS['TIPS'][0];
?>
</div>
<?}?>

<div id="footer">
lab staff &copy; <?=date('Y')?><br/>
<a href="http://www.cs.bgu.ac.il" target="_blank">CS Department</a>,
<a href="http://www.bgu.ac.il" target="_blank">Ben-Gurion University of the Negev</a>
<br/>
made by <a href="http://www.cs.bgu.ac.il/~ygleyzer">Yanik Gleyzer</a>
</div>

<?}?>

    </td>
  </tr>
</table>

<?$GLOBALS['global_timer']->stop();?>
<font color="#999" class="small"><i>
<?if(gzip_supported()){?><span class="red">gzip</span> supported, <?}?>
generated in <?=$global_timer->time?> sec.
</i></font>

  <?
  include(TMPLPATH."html_end.php");
}
else{ // no session ... login
  # theme for login
  $wday = date('w');
  $day = date('j');
  $month = date('n');
  $hour = date('H');
  $year = date('Y');
  if($day == 13 && $wday == 5 ||
     ($day == 6 && $month == 6 && $year%1000 == 6)){
    $GLOBALS['DEFAULT_THEME']='Diabolic';
  }
  else if($wday == 0){
    $GLOBALS['DEFAULT_THEME']='Yahoo!';
  }
  else if($wday == 1 || $wday == 4){
    $GLOBALS['DEFAULT_THEME']='PHP.net';
  }
  else if($wday == 2 || $wday == 5){
    $GLOBALS['DEFAULT_THEME']='CS';
  }
  else if($wday == 3 || $wday == 6){
    $GLOBALS['DEFAULT_THEME']='GMail';
  }

  $no_js = true;
  include(TMPLPATH."html_start.php");
  include(TMPLPATH."login_form.php");
  include(TMPLPATH."html_end.php");
}
?>
Return current item: CsWebmail