Newer
Older
if(!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin()) die('Access Denied');
$info=array();
$qstr='';
if($api && $_REQUEST['a']!='add'){
$title='Update API Key';
$action='update';
$submit_text='Save Changes';
Peter Rotich
committed
$info=$api->getHashtable();
$qstr.='&id='.$api->getId();
}else {
$title='Add New API Key';
$action='add';
$submit_text='Add Key';
$info['isactive']=isset($info['isactive'])?$info['isactive']:1;
$qstr.='&a='.urlencode($_REQUEST['a']);
}
$info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
?>
<form action="apikeys.php?<?php echo $qstr; ?>" method="post" id="save">
<input type="hidden" name="do" value="<?php echo $action; ?>">
<input type="hidden" name="a" value="<?php echo Format::htmlchars($_REQUEST['a']); ?>">
<input type="hidden" name="id" value="<?php echo $info['id']; ?>">
<h2>API Key</h2>
<table class="form_table" width="940" border="0" cellspacing="0" cellpadding="2">
<thead>
<tr>
<th colspan="2">
<h4><?php echo $title; ?></h4>
Peter Rotich
committed
<em>API Key is auto-generated. Delete and re-add to change the key.</em>
Peter Rotich
committed
<td width="150" class="required">
Status:
</td>
<td>
<input type="radio" name="isactive" value="1" <?php echo $info['isactive']?'checked="checked"':''; ?>><strong>Active</strong>
<input type="radio" name="isactive" value="0" <?php echo !$info['isactive']?'checked="checked"':''; ?>>Disabled
<span class="error">* </span>
</td>
</tr>
<?php if($api){ ?>
<tr>
Peter Rotich
committed
<td width="150">
IP Address:
</td>
<td>
<?php echo $api->getIPAddr(); ?>
</td>
</tr>
<tr>
Peter Rotich
committed
<td width="150">
Peter Rotich
committed
<td><?php echo $api->getKey(); ?> </td>
Peter Rotich
committed
<td width="150" class="required">
IP Address:
</td>
<td>
<input type="text" size="30" name="ipaddr" value="<?php echo $info['ipaddr']; ?>">
<span class="error">* <?php echo $errors['ipaddr']; ?></span>
</td>
</tr>
<?php } ?>
<tr>
<th colspan="2">
<em><strong>Services:</strong>: Check applicable API services enabled for the key.</em>
Peter Rotich
committed
<td colspan=2 style="padding-left:5px">
<label>
<input type="checkbox" name="can_create_tickets" value="1" <?php echo $info['can_create_tickets']?'checked="checked"':''; ?> >
Can Create Tickets <em>(XML/JSON/EMAIL)</em>
</label>
</td>
</tr>
<tr>
<td colspan=2 style="padding-left:5px">
<label>
<input type="checkbox" name="can_exec_cron" value="1" <?php echo $info['can_exec_cron']?'checked="checked"':''; ?> >
Can Execute Cron
</label>
</td>
</tr>
<tr>
<th colspan="2">
<em><strong>Admin Notes</strong>: Internal notes. </em>
</th>
</tr>
<tr>
<td colspan=2>
<textarea class="richtext no-bar" name="notes" cols="21"
rows="8" style="width: 80%;"><?php echo $info['notes']; ?></textarea>
</td>
</tr>
</tbody>
</table>
<p style="padding-left:225px;">
<input type="submit" name="submit" value="<?php echo $submit_text; ?>">
<input type="reset" name="reset" value="Reset">
<input type="button" name="cancel" value="Cancel" onclick='window.location.href="apikeys.php"'>
</p>
</form>