Location: PHPKode > projects > CsWebmail > cswebmail-3.10/cswebmail-3.10/templates/newsgroups.php
<?
if(VALID_DOCUMENT != 1) die('what?');
$action = get_var('action');

if($action == 'newsgroups-refresh'){
  $_SESSION['newsrc'] = new Newsrc(NEWSRC_FILE);
  $_SESSION['mboxes']->refresh();
  location_header($_SERVER['PHP_SELF'].'?action=newsgroups');
}
else if($action == 'newsgroups-add' || $action == 'newsgroups-save'){
  $_SESSION['newsrc']->load();
  $_SESSION['newsrc']->store();
  $_SESSION['mboxes']->refresh();
  location_header($_SERVER['PHP_SELF'].'?action=newsgroups');
}
else if($action == 'newsgroups-delete'){
  $_SESSION['newsrc']->delete(get_var('key'));
  $_SESSION['newsrc']->store();
  $_SESSION['mboxes']->refresh();
  location_header($_SERVER['PHP_SELF'].'?action=newsgroups');
}
else if($action == 'newsgroups-list'){
?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<input type="hidden" name="action"/>
<table class="content hsides">
<tr><th colspan="1" class="title">Add Groups From List</th></tr>
<tr><td colspan="1">
<?=$_SESSION['newsrc']->get_add_list_presentation(get_var('query'))?>
</td></tr>
<tr><td colspan="2">
<input type="submit" value="add" onclick="this.form['action'].value='newsgroups-add'"/>
<input type="submit" value="cancel" onclick="this.form['action'].value='newsgroups'"/>
</td></tr>
</table>
</form>
<?}else{?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<input type="hidden" name="action"/>
<table class="content hsides">
<tr><th colspan="2" class="title">Newsgroups</th></tr>
<?=$_SESSION['newsrc']->get_presentation()?>
<tr><td colspan="2">
<input type="submit" value="new" onclick="action.value='newsgroups-new'"/>
<input type="submit" value="refresh" onclick="action.value='newsgroups-refresh'"/>
<input type="submit" value="delete" onclick="action.value='newsgroups-delete'"/>
<br/>
<input type="text" name="group" size="25"/>
<input type="submit" value="add new" onclick="this.form['action'].value='newsgroups-add'"/>
<br/>
<input type="text" name="query" size="25"/>
<input type="submit" value="search groups" onclick="this.form['action'].value='newsgroups-list'"/>
</td></tr>
</table>
</form>
<?}?>
Return current item: CsWebmail