Esempio n. 1
0
$admin = createAdminPerson();
if (!isset($admin) || !$admin->isAuth()) {
    echo "Not authenticated! Cannot continue<br />\n";
    exit(0);
}
/* Get list of issued certiticates */
if (isset($_POST['action'])) {
    $action = Input::sanitize($_POST['action']);
} else {
    /* if no action provided, assume the client wants a list of issued certificates. */
    $action = 'cert_list';
}
switch ($action) {
    case 'cert_list':
        Logger::log_event(LOG_NOTICE, "[RI] " . $admin->getEPPN() . " cert-list request.");
        $res = Robot::createCertList($admin);
        printXMLRes($res, 'userList');
        break;
    case 'revoke_list':
        if (!isset($_POST['list'])) {
            echo "No data provided.\n";
            exit(0);
        }
        /* for some reason, php adds 'smart-qoutes' to XML-data. Lets just call
         * this not-so-smart-quotes */
        $xml = str_replace("\\", "", $_POST['list']);
        /* Start parsing */
        if (!is_null($xml)) {
            try {
                $parsedXML = new SimpleXMLElement($xml);
            } catch (Exception $e) {