forked from newlisponrockets/newLISP-on-Rockets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rockets-delete.lsp
executable file
·33 lines (28 loc) · 1.24 KB
/
rockets-delete.lsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env newlisp
(load "newlisp-rockets.lisp") ; this is where the magic happens!
; Rockets Blog - Delete page (rockets-delete.lsp)
;
; This page shows a confirmation for the user before deleting a post
(load "Rockets-config.lisp") ; load configuration information
(display-header (string RocketsConfig:Name " - Confirm delete"))
(open-database RocketsConfig:Database)
(display-partial "rockets-checksignin") ; checks to see if user is signed in
(display-partial "rockets-common-functions") ; loads functions common to the blog
(display-partial "rockets-navbar")
(set 'Id (integer ($GET "post")))
(set 'PostId Id) ; for deleting comments
(if Rockets:IsUserAdmin (begin ; only an admin can delete posts
(displayln "<br>")
(display-h1 "Confirm post deletion")
(displayln "Are you sure you want to delete this post?")
(displayln "<br><br>")
(display-button-green "No - don't delete" "rockets-main")
(display-button-red "Yes - delete post" (string "rockets-delete-confirm.lsp?post=" Id))
(displayln "<br>")
)
(displayln "")
) ; if the user tried to enter the URL manually it will just do nothing.
; Regardless, redirect back to main page.
;(page-redirect "rockets-main.lsp")
(display-footer RocketsConfig:Owner)
(display-page)