include_once('omdb.inc.php');
//Debug options:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$omdb = new OMDB();
$cd_id = (int) @$_GET['cd_id'];
$cdar = $omdb->GetCD($cd_id);
if (!IS_ADMIN) die('Foei!');
?>
OpenMath: Admin: Add CD support
echo $omdb->PrintClickPath(array('CDs' => 'omcds.php', $cdar['cd_name'] => 'omdefs.php?cd_id='.$cd_id, 'Add support' => ''));
if (isset($_POST['ipt_cas_id'])) {
$ipt_enc = ( @$_POST['ipt_enc'] == 'on' ? 1 : 0 );
$ipt_dec = ( @$_POST['ipt_dec'] == 'on' ? 1 : 0 );
$ipt_refurl = @$_POST['ipt_refurl'];
foreach ($_POST['ipt_cas_id'] as $cas_id => $action) {
if ($action == 'add') {
$omdb->AddCDCas($cd_id, $cas_id, $ipt_enc, $ipt_dec, $ipt_refurl);
} else if ($action == 'remv') {
$omdb->RemvCDCas($cd_id, $cas_id);
} else if ($action != 'inv') {
die ('Unknown action -- '.$action);
}
}
}
if (!$cd_id) {
echo "Something's wrong here.";
} else {
echo $omdb->PrintAddCasForm($cd_id);
}
?>