';
$PHP_tmp_SELF = PreparePHP_SELF( $_REQUEST );
$remove = $remove_modfunc_on_cancel ? array( 'modfunc' ) : array();
$PHP_tmp_SELF_cancel = PreparePHP_SELF( $_REQUEST, $remove, array( 'delete_cancel' => true ) );
PopTable( 'header', _( 'Confirm' ) . ( mb_strpos( $action, ' ' ) === false ? ' '. $action : '' ) );
echo '
' . button( 'warning', '', '', 'bigger' ) .
'
' . sprintf( _( 'Are you sure you want to %s that %s?' ), $action, $title ) . '
';
PopTable( 'footer' );
return false;
}
// If user clicked OK or Cancel + modfunc.
RedirectURL( array( 'delete_ok', 'delete_cancel' ) );
return true;
}
/**
* Prompt question to user
* and display OK & Cancel buttons
*
* Go back in browser history on Cancel
*
* @example if ( Prompt( _( 'Confirm' ), _( 'Do you want to dance?' ), $message ) )
*
* @param string $title Prompt title (optional). Defaults to 'Confirm'.
* @param string $question Prompt question (optional). Defaults to ''.
* @param string $message Prompt message (optional). Defaults to ''.
*
* @return boolean true if user clicks OK, else false
*/
function Prompt( $title = 'Confirm', $question = '', $message = '' )
{
// Display prompt.
if ( empty( $_REQUEST['delete_ok'] ) )
{
// Set default title.
if ( $title === 'Confirm' )
{
$title = _( 'Confirm' );
}
echo '
';
$PHP_tmp_SELF = PreparePHP_SELF();
PopTable( 'header', $title );
echo '' . $question . '
';
PopTable( 'footer' );
return false;
}
// If user clicked OK.
$_REQUEST['delete_ok'] = false;
$_SESSION['_REQUEST_vars']['delete_ok'] = false;
return true;
}
/**
* Prompt message in JS Alert box & close window
*
* Use the BackPrompt function only if there is an error
* in a script opened in a new window (ie. PDF printing)
* BackPrompt will alert the message and close the window
*
* @param string $message Alert box message.
*
* @return string JS Alert box & close window, then exits
*/
function BackPrompt( $message )
{
?>