Location: PHPKode > projects > CsWebmail > cswebmail-3.10/cswebmail-3.10/templates/edit_folders.php
<?
if(VALID_DOCUMENT != 1) die('what?');
if($action == 'folders-delete'){
  $mailbox = get_var('mailbox');
  Notice::set($_SESSION['mboxes']->delete($mailbox));
  location_header($_SERVER['PHP_SELF'].'?action=folders-edit');
}
else if($action == 'folders-refresh'){
  $_SESSION['mboxes']->refresh();
  Notice::set('Folders information is refreshed');
  if($_SESSION['last_mailbox'])
    location_header($_SERVER['PHP_SELF'].'?action=show-folder&mailbox='.$_SESSION['last_mailbox']);
  else
    location_header($_SERVER['PHP_SELF'].'?action=notice');
}
else if($action == 'folders-empty'){
  $mailbox = get_var('mailbox');
  $_SESSION['mboxes']->delete($mailbox);
  $_SESSION['mboxes']->create($mailbox);
  location_header($_SERVER['PHP_SELF'].'?action=folders-edit');
}
else if($action == 'folders-create'){
  Notice::set($_SESSION['mboxes']->create($_SESSION['preferences']->getMailDir().'/'.get_var('mailbox')));
  location_header($_SERVER['PHP_SELF'].'?action=folders-edit');
}
else if($action == 'folders-rename'){
  $old = get_var('old-mailbox');
  $new = get_var('mailbox');
  if($old != $new && !eregi("[/]",$new)){
    $_SESSION['mboxes']->rename($old,dirname($old).'/'.$new);
  }
  location_header($_SERVER['PHP_SELF'].'?action=folders-edit');
}
else if($action == 'folders-view'){
  $boxes = get_var('boxes');
  $_SESSION['preferences']->setMailboxesList($boxes);
  $_SESSION['preferences']->store();
  $_SESSION['mboxes']->refresh();
  location_header($_SERVER['PHP_SELF'].'?action=folders-edit');
}
else if($action == 'folders-new'){?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<input name="action" value="folders-create" type="hidden"/>
<table class="content hsides">
  <tr><th>Enter Mailbox Name</th></tr>
  <tr><td>
   <b><?=$_SESSION['preferences']->getMailDir()?>/ </b>
   <input name="mailbox" size="30" type="text"/></td></tr>
  <tr><td>
<input value="create" onclick="action.value='folders-create';submit();" type="button"/>
<input value="cancel" onclick="action.value='folders-cancel';submit();" type="button"/>
<input name="clear" value="clear" type="reset"/>
  </td></tr>
</table>
</form>
<?}else if($action == 'folders-show-rename'){  $mailbox = get_var('mailbox'); ?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post" enctype="application/x-www-form-urlencoded">
<input name="action" value="folders-rename" type="hidden"/>
<input name="old-mailbox" value="<?=$mailbox?>" type="hidden"/>
<table class="content hsides">
   <tr><th>Enter Mailbox New Name</th></tr>
  <tr><td>
   <b><?=dirname($mailbox)?>/ </b>
   <input name="mailbox" value="<?=basename($mailbox)?>" size="30" type="text"/></td></tr>
  <tr><td>
<input value="rename" onclick="action.value='folders-rename';submit();" type="button"/>
<input value="cancel" onclick="action.value='folders-cancel';submit();" type="button"/>
<input name="clear" value="clear" type="reset"/>
  </td></tr>
</table>
</form>
<?}else{?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post" enctype="application/x-www-form-urlencoded">
<input name="action" value="" type="hidden"/>
<input name="mailbox" value="" type="hidden"/>
<table class="content">
  <tr><th colspan="1" class="title">Edit Mail Folders</th></tr>
  <tr><td><?=$_SESSION['mboxes']->get_choose_folders_presentation()?></td></tr>
  <tr><td><div class="red">Warning: do not choose files that are <b>NOT</b> mailboxes.</div></td></tr>
  <tr><td>
<input value="choose checked folders" onclick="action.value='folders-view';submit();" type="button"/>
<br/>
<input value="check all" onclick="setChecked(this.form,'boxes',1)" type="button"/>
<input value="clear all" onclick="setChecked(this.form,'boxes',0)" type="button"/>
<input value="new" onclick="action.value='folders-new';submit();" type="button"/>
<input name="clear" value="reset" type="reset">
   </td></tr>
</table>
</form>
<?}?>
Return current item: CsWebmail