?> <form method="POST" action="<?php echo dirname($_SERVER['REQUEST_URI']) . '/' . basename($_SERVER['PHP_SELF']); ?> "> <label for="profilename">API Profile Name:</label> <input type="text" id="profilename" name="pname" /><br /> <input type="submit" name="submitCreate" value="Create" /> <input type="submit" name="submitEdit" value="Edit" /> </form> <?php } else { if (isset($_POST['submitCreate']) || isset($_POST['submitEdit']) || isset($_POST['submitChanges'])) { if (!isset($_POST['pname'])) { endPage('Stop hacking.'); } $apm = APIProfileModel::getInstance(); $fields = APIProfileBean::getFields(); if (isset($_POST['submitCreate']) && !$apm->generateProfile($_POST['pname'])) { endPage('Error creating profile. Does that name already exist?'); } if (isset($_POST['submitChanges'])) { if (!isset($_POST['pname'])) { endPage('Stop hacking.'); } $apip = $apm->getByName($_POST['pname']); foreach ($fields as $field) { if ($field == 'allowed_app_fields' && isset($_POST[$field])) { $apip->{$field} = explode(' ', $_POST[$field]); } else { if ($field == 'active' || substr($field, 0, 5) == 'perm_') { if (isset($_POST[$field]) && $_POST[$field] == 1) {
protected function getProfile($name) { $apm = APIProfileModel::getInstance(); return $apm->getByNameCached($name); }