This repository has been archived on 2025-05-24. You can view files and clone it, but cannot push or open issues or pull requests.
Files
qemudb/admin/editAppNote.php
Jonathan Ernst 3096e63828 Rename util_show_error_page() to util_show_error_page_and_exit() and redirect() to util_redirect_and_exit()
so it is explicit that we exit in those functions that so we know it isn't necessary to put an exit after
we call them
2006-07-06 18:44:56 +00:00

69 lines
1.9 KiB
PHP

<?php
/****************/
/* Edit AppNote */
/****************/
include("path.php");
require(BASE."include/incl.php");
require(BASE."include/application.php");
require(BASE."include/mail.php");
$aClean = array(); //array of filtered user input
$aClean['iNoteId'] = makeSafe($_REQUEST['iNoteId']);
$aClean['sSub'] = makeSafe($_REQUEST['sSub']);
$aClean['sSubmit'] = makeSafe($_REQUEST['sSubmit']);
$aClean['sPreview'] = makeSafe($_REQUEST['sPreview']);
if(!is_numeric($aClean['iNoteId']))
util_show_error_page_and_exit('Wrong note ID');
/* Get note data */
$oNote = new Note($aClean['iNoteId']);
/* Check for privs */
if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->isMaintainer($oNote->iVersionId) && !$_SESSION['current']->isSuperMaintainer($oNote->iAppId))
util_show_error_page_and_exit("Insufficient Privileges!");
if(!empty($aClean['sSub']))
{
$oNote->GetOutputEditorValues(); /* retrieve the updated values */
if ($aClean['sSub'] == 'Delete')
{
$oNote->delete();
}
else if ($aClean['sSub'] == 'Update')
{
$oNote->update();
}
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId={$oNote->iVersionId}"));
} else /* display note */
{
// show form
apidb_header("Application Note");
/* if preview is set display the note for review */
if($aClean['sPreview'])
{
$oNote->GetOutputEditorValues(); /* retrieve the updated values */
$oNote->show(true);
}
echo "<form method=post action='editAppNote.php'>\n";
/* display the editor for this note */
$oNote->OutputEditor();
echo '<center>';
echo '<input type="submit" name=sPreview value="Preview">&nbsp',"\n";
echo '<input type="submit" name=sSub value="Update">&nbsp',"\n";
echo '<input type="submit" name=sSub value="Delete"></td></tr>',"\n";
echo '</center>';
echo html_back_link(1,BASE."appview.php?iVersionId=".$oNote->iVersionId);
}
apidb_footer();
?>