├── .htaccess
├── README.md
├── Rockets-config.lisp
├── Rockets-navigation.lisp
├── docs
├── _config.yml
├── customizing_rockets_blog.md
├── extending_rockets.md
├── how_rockets_works.md
├── images
│ ├── deleteme.txt
│ └── newlisp-rockets-picture-small.jpg
├── index.md
├── install_rockets_linode.md
├── install_rockets_ubuntu.md
├── running_rockets_blog.md
└── test.md
├── fileupload.lsp
├── images
├── eniac4.gif
├── forum-notice.png
├── nav-button-first.jpg
├── nav-button-last.jpg
├── nav-button-next.jpg
├── nav-button-prev.jpg
├── newlisp-rockets-picture-small.jpg
├── newlisp-rockets-picture.jpg
├── poweredby.png
├── read-msg.png
├── rockets.png
├── rockets
│ ├── r111.jpg
│ ├── r11332.jpg
│ ├── r1156.jpg
│ ├── r12994.jpg
│ ├── r13174.jpg
│ ├── r13519.jpg
│ ├── r14351.jpg
│ ├── r15537.jpg
│ ├── r15718.jpg
│ ├── r17449.jpg
│ ├── r18260.jpg
│ ├── r18459.jpg
│ ├── r18710.jpg
│ ├── r19993.jpg
│ ├── r20296.jpg
│ ├── r20803.jpg
│ ├── r22615.jpg
│ ├── r24597.jpg
│ ├── r24873.jpg
│ ├── r24941.jpg
│ ├── r25049.jpg
│ ├── r25098.jpg
│ ├── r25227.jpg
│ ├── r25721.jpg
│ ├── r26593.jpg
│ ├── r30618.jpg
│ ├── r30790.jpg
│ ├── r31383.jpg
│ ├── r31961.jpg
│ ├── r33735.jpg
│ ├── r33942.jpg
│ ├── r34429.jpg
│ ├── r34540.jpg
│ ├── r3458.jpg
│ ├── r36340.jpg
│ ├── r37682.jpg
│ ├── r37709.jpg
│ ├── r39914.jpg
│ ├── r40190.jpg
│ ├── r41090.jpg
│ ├── r41567.jpg
│ ├── r42568.jpg
│ ├── r43159.jpg
│ ├── r45026.jpg
│ ├── r46066.jpg
│ ├── r46414.jpg
│ ├── r46949.jpg
│ ├── r47432.jpg
│ ├── r47476.jpg
│ ├── r49325.jpg
│ ├── r4952.jpg
│ ├── r49658.jpg
│ ├── r51955.jpg
│ ├── r54205.jpg
│ ├── r54539.jpg
│ ├── r54642.jpg
│ ├── r59211.jpg
│ ├── r59377.jpg
│ ├── r63177.jpg
│ ├── r6520.jpg
│ ├── r65409.jpg
│ ├── r65528.jpg
│ ├── r65697.jpg
│ ├── r66502.jpg
│ ├── r66566.jpg
│ ├── r70179.jpg
│ ├── r71140.jpg
│ ├── r71294.jpg
│ ├── r71940.jpg
│ ├── r72074.jpg
│ ├── r72466.jpg
│ ├── r73358.jpg
│ ├── r73623.jpg
│ ├── r74531.jpg
│ ├── r75534.jpg
│ ├── r75775.jpg
│ ├── r84391.jpg
│ ├── r84654.jpg
│ ├── r85098.jpg
│ ├── r85249.jpg
│ ├── r8567.jpg
│ ├── r86353.jpg
│ ├── r87629.jpg
│ ├── r88269.jpg
│ ├── r88708.jpg
│ ├── r88882.jpg
│ ├── r90879.jpg
│ ├── r91551.jpg
│ ├── r93755.jpg
│ ├── r93847.jpg
│ ├── r94150.jpg
│ ├── r94993.jpg
│ ├── r95397.jpg
│ ├── r97400.jpg
│ ├── r9749.jpg
│ ├── r97516.jpg
│ ├── r97531.jpg
│ ├── r98299.jpg
│ ├── r98632.jpg
│ └── r99291.jpg
├── rss.png
└── unread-msg.png
├── index.cgi
├── log-to-database.lisp
├── newlisp-rockets.lisp
├── partials
├── panel1.html
├── panel2.html
├── panel3.html
├── panel4.html
├── rockets-checksignin.lsp
├── rockets-common-functions.lsp
├── rockets-custom.lsp
├── rockets-generate-rss.lsp
├── rockets-leftpanel.lsp
├── rockets-navbar.lsp
├── rockets-panel1.lsp
├── rockets-panel2.lsp
├── rockets-panel3.lsp
├── rockets-panel4.lsp
├── rockets-rightpanel.lsp
└── rockets-sidepanels.lsp
├── podcast
└── readme.txt
├── revision-history.txt
├── rocket-list.lisp
├── rockets-404.lsp
├── rockets-about.lsp
├── rockets-admin.lsp
├── rockets-adminupload.lsp
├── rockets-avatarupload.lsp
├── rockets-comic.lsp
├── rockets-comment-post.lsp
├── rockets-delete-confirm.lsp
├── rockets-delete.lsp
├── rockets-documentation.lsp
├── rockets-edit-post.lsp
├── rockets-experimental.lsp
├── rockets-forgotpassword.lsp
├── rockets-forum.lsp
├── rockets-item.lsp
├── rockets-main.lsp
├── rockets-poll.lsp
├── rockets-post.lsp
├── rockets-profile.lsp
├── rockets-register-confirm.lsp
├── rockets-register.lsp
├── rockets-signout.lsp
├── rockets-verify.lsp
├── rockets-why.lsp
├── setup-rockets.lisp
└── upgrade.lisp
/.htaccess:
--------------------------------------------------------------------------------
1 | AddDefaultCharset UTF-8
2 | Options -Indexes +FollowSymLinks
3 |
4 | # Prevent database backup files from being accessed
5 |
Please proceed with caution!
") 110 | (end-div) 111 | 112 | ;(displayln "Debug stuff here...
") 113 | ; this stuff is subject to change! 114 | 115 | (setq imagenum 0) 116 | 117 | (setq canvas-width 800) 118 | (setq canvas-height 600) 119 | (setq canvas-id "test1") 120 | (setq image-list '( 121 | "images/sun_halloween.jpg" 122 | "images/poweredby.png" 123 | "images/16pxdither3.png" 124 | )) 125 | (init-canvas canvas-id canvas-width canvas-height image-list) 126 | (clear-rect 0 0 canvas-width canvas-height) 127 | (draw-image "16pxdither3" 0 0 16 16 true) 128 | (draw-rectangle 25 25 300 100) 129 | (draw-text 50 75 "Hello, World!" "serif" 48 true true) 130 | (draw-image "poweredby" 50 175 200 200) 131 | (req-anim-frame) 132 | (draw-image "poweredby" 150 175) 133 | (draw-image "sun_halloween" 50 275 400 400) 134 | (close-canvas) 135 | 136 | (displayln "STUFF GOES HERE...
") 137 | 138 | (close-database) 139 | (display-footer RocketsConfig:Owner) 140 | (display-page) ; this is needed to actually display the page! 141 | -------------------------------------------------------------------------------- /rockets-forgotpassword.lsp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env newlisp 2 | 3 | (load "newlisp-rockets.lisp") ; this is where the magic happens! 4 | 5 | ; (rockets-forgotpassword.lsp) - Rockets - Forgot password page 6 | ; 7 | 8 | (load "Rockets-config.lisp") ; load configuration information 9 | (module "crypto.lsp") ; for setting new passwords 10 | (display-header (string RocketsConfig:Name " - Forgot Password")) 11 | (open-database RocketsConfig:Database) 12 | (display-partial "rockets-checksignin") ; checks to see if user is signed in 13 | (display-partial "rockets-navbar") 14 | (display-partial "rockets-common-functions") 15 | 16 | (start-div "hero-unit") 17 | (displayln "Currently running newLISP on Rockets version: " $ROCKETS_VERSION "
") 19 | ;(displayln "Writing Holmes is an experimental writing site. Feel free to look around!
") 20 | (end-div) 21 | 22 | (define (expire-old-tokens) 23 | (dolist (x RocketsTokens:Tokens) 24 | ;(displayln "New list: " RocketsTokens:Tokens) 32 | ) 33 | 34 | ; start executing page----------------------- 35 | 36 | (if (nil? RocketsConfig:AdminEmail) 37 | (set 'RocketsConfig:AdminEmail "newlisponrockets@newlisponrockets.com")) 38 | 39 | (if (nil? RocketsConfig:SiteURL) 40 | (set 'RocketsConfig:SiteURL "pleaseconfigureyoursiteurl.com")) 41 | 42 | (set 'email-to-send ($POST "email")) 43 | 44 | (set 'uuid-to-verify ($GET "u")) 45 | 46 | (if (file-info "reset-tokens.lisp") (load "reset-tokens.lisp")) 47 | 48 | (if uuid-to-verify (begin 49 | (set 'uuid-expired-message (string "
You have attempted to reset your password, but the one-hour reset window has expired. Please return to the Forgot Password page and try again.")) 50 | ; first verify that uuid exists 51 | (if RocketsTokens:Tokens 52 | (begin 53 | ;(displayln "
Token file exists") 54 | (expire-old-tokens) 55 | (save "reset-tokens.lisp" 'RocketsTokens) 56 | ;(displayln "
new tokens: " RocketsTokens:Tokens) 57 | (if (and RocketsTokens:Tokens (ref uuid-to-verify RocketsTokens:Tokens)) 58 | (begin 59 | (set 'new-password ($POST "pass")) 60 | (set 'confirm-password ($POST "conf")) 61 | (displayln "
Passwords match! Now changing and logging you in.") 73 | ; first find the appropriate email address 74 | (set 'ref-uuid (ref uuid-to-verify RocketsTokens:Tokens)) 75 | (if ref-uuid (set 'email-to-reset (RocketsTokens:Tokens (first ref-uuid) 2))) 76 | (displayln "
email to change: " email-to-reset) 77 | (set 'UserEmail email-to-reset) 78 | (if UserEmail (set 'user-data (first (get-record "Users" UserEmail)))) 79 | (displayln "
User data: " user-data) 80 | (if user-data (begin 81 | (set 'UserSalt (user-data 3)) 82 | (set 'CookieSalt (user-data 8)) 83 | (set 'UserPasswordHash (crypto:sha1 (string UserSalt new-password))) 84 | ;(displayln "
New password: " UserPasswordHash) 85 | (update-record "Users" UserEmail UserPasswordHash) 86 | (displayln "
Password updated!") 87 | ; now set the cookie 88 | (set 'UserId (user-data 0)) 89 | (set 'new-cookie (string UserId "|" CookieSalt)) 90 | (set-cookie Blog:rocket-cookie-name new-cookie (date-value 2053 2 28)) 91 | (page-redirect "rockets-main" "e=resetpassword") 92 | )) 93 | )) 94 | ) 95 | (displayln uuid-expired-message) 96 | ) 97 | ) 98 | (displayln uuid-expired-message) 99 | ) 100 | )) 101 | 102 | (if email-to-send (begin 103 | (set 'date-of-email (date-value)) 104 | (set 'uuid-of-email (uuid)) 105 | (push (list date-of-email uuid-of-email email-to-send) RocketsTokens:Tokens -1) 106 | (expire-old-tokens) 107 | (save "reset-tokens.lisp" 'RocketsTokens) 108 | (set 'link-text (string "http://" RocketsConfig:SiteURL "/rockets-forgotpassword.lsp?u=" uuid-of-email )) 109 | (set 'email-text (string "Either you, or someone pretending to be you, has sent a Reset Password request for the site " RocketsConfig:Name ". To reset your password, click on this link: " link-text ". If you did not request a password reset, please ignore this message.")) 110 | (set 'subject-text (string "Reset password request for " RocketsConfig:Name)) 111 | ; check if it was a valid email address 112 | (set 'check-if-valid-email (query (string "SELECT * From Users WHERE UserEmail='" email-to-send "';"))) 113 | (if check-if-valid-email 114 | (begin 115 | (displayln "
We are sending a message to your email address. If you don't receive it right away, check your Spam folder. Click on the link in the email to reset your password.") 116 | (send-mail email-to-send RocketsConfig:AdminEmail RocketsConfig:Owner subject-text email-text) 117 | ) 118 | (displayln "
Sorry, that email address was not found in our user database. Try again.") 119 | ) 120 | ;(displayln "
Sending email to: " email-to-send " from " RocketsConfig:AdminEmail " on " date-of-email " code: " uuid-of-email) 121 | 122 | ) 123 | (if (not uuid-to-verify) (begin 124 | (displayln "
") 43 | (displayln "Avatar: ")
45 | (displayln "
Upload new avatar (all avatars scaled to 64x64 pixels):
") 46 | 47 | ) ; -- end section that shows if the user is signed in 48 | (displayln "You must be signed in to view your user profile.
") 49 | ) 50 | 51 | 52 | 53 | (close-database) 54 | (display-footer RocketsConfig:Owner) 55 | (display-page) ; this is needed to actually display the page! -------------------------------------------------------------------------------- /rockets-register-confirm.lsp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env newlisp 2 | (load "newlisp-rockets.lisp") 3 | (load "Rockets-config.lisp") ; load configuration information 4 | (display-header) 5 | (open-database RocketsConfig:Database) 6 | (display-partial "rockets-checksignin") ; checks to see if user is signed in 7 | (display-partial "rockets-common-functions") ; loads functions common to the blog but not part of Rockets 8 | (set 'active-page "rockets-register-confirm") 9 | (display-partial "rockets-navbar") ; shows the navigation bar with Rockets blog menus 10 | 11 | ; set Rockets cookie name (will be from a file later) 12 | (set 'rocket-cookie-name "rockets-4dckq3-e4jcx-2wgxc") 13 | 14 | (module "crypto.lsp") 15 | 16 | (set 'UserPassword ($GET "p")) 17 | (set 'UserConfirmPassword ($GET "c")) 18 | (set 'UserName ($GET "u")) 19 | (set 'UserEmail ($GET "e")) 20 | 21 | (load "rocket-list.lisp") ; load up RocketReg:rocket-list and RocketReg:not-rocket-list 22 | (set 'found-rockets 0) 23 | (dolist (z RocketReg:rocket-list) 24 | (display ">>TOTAL FOUND ROCKETS: " found-rockets) 35 | (displayln "
>>TOTAL FOUND NOTROCKETS: " found-not-rockets)
36 |
37 | (if (< found-rockets 3) (page-redirect "rockets-register" "e=few"))
38 | (if (> found-not-rockets 0) (page-redirect "rockets-register" "e=many"))
39 |
40 | ; now check these things to see if they are acceptable
41 |
42 | ; first check to see if the user name or email exists in the database already
43 | (if (query (string "SELECT * FROM Users WHERE UserName='" (trim UserName) "'")) (page-redirect "rockets-register" "e=samename"))
44 | (if (query (string "SELECT * FROM Users WHERE UserEmail='" (trim UserEmail) "'")) (page-redirect "rockets-register" "e=samename"))
45 | (if (= (trim UserName) "") (page-redirect "rockets-register" "e=noname"))
46 | (if (= (trim UserPassword) "") (page-redirect "rockets-register" "e=nopw"))
47 | (if (!= UserPassword UserConfirmPassword) (page-redirect "rockets-register" "e=pwmatch"))
48 | (if (= (trim UserEmail) "") (page-redirect "rockets-register" "e=noemail"))
49 |
50 | ; everything checked out, let's register this person!
51 | (displayln (query "pragma table_info('Users')"))
52 | (set 'UserId (+ (int (first (first (query "select MAX(UserId) from Users")))) 1))
53 | (displayln "
UserId: " UserId)
54 | (displayln "
UserEmail: " UserEmail)
55 | (displayln "
UserPassword: " UserPassword)
56 | (set 'UserSalt (uuid))
57 | (set 'UserPasswordHash (crypto:sha1 (string UserSalt UserPassword)))
58 | (displayln "
UserSalt: " UserSalt)
59 | (displayln "
UserPasswordHash: " UserPasswordHash)
60 | (set 'CookieSalt (uuid))
61 | (displayln "
UserSalt: " CookieSalt)
62 | (set 'UserPosts 0)
63 | (displayln "
UserPosts: " UserPosts)
64 | (displayln "
UserName: " UserName)
65 |
66 | (create-record "Users" UserId UserEmail UserPasswordHash UserSalt UserPosts CookieSalt UserName)
67 | (displayln (query (string "select * from Users")))
68 | ; set the cookie
69 | (set 'new-cookie (string UserId "|" CookieSalt))
70 | (set-cookie rocket-cookie-name new-cookie (+ (date-value) (* 60 60 24 365))) ; set cookie for one year from now
71 |
72 | ; one last thing, send a nice email welcoming the new user!
73 | (set 'welcome-email "Thank you for registering. If you have any questions, please don't hesitate to email me or post a comment on the blog.\n\nSincerely,\n\nRocket Man")
74 | (send-mail UserEmail "newlisponrockets@newlisponrockets.com" "Rocket Man" "Welcome to the newLISP on Rockets blog!" welcome-email)
75 | ; and send a mail to me so that I know that a new user registered!
76 | (set 'new-user-registered-mail (string "A new user by the name of: " UserName " just registered with the email address " UserEmail "."))
77 | (send-mail "newlisponrockets@newlisponrockets.com" "newlisponrockets@newlisponrockets.com" "Rocket Man" "A new user has registered on the newLISP on Rockets blog" new-user-registered-mail)
78 |
79 |
80 | (page-redirect "rockets-main" "e=newuser")
81 |
82 | (display-footer RocketsConfig:Owner)
83 | (display-page)
84 |
--------------------------------------------------------------------------------
/rockets-register.lsp:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env newlisp
2 |
3 | (load "newlisp-rockets.lisp") ; this is where the magic happens!
4 |
5 | ; (rockets-verify.lsp) - Rockets - Registration page
6 | ;
7 | ; This is the first version of the self-hosted blog for newLISP on Rockets.
8 | ; The blog is designed to showcase how you would use Rockets for a real application.
9 | ;
10 | ; Written 2012 by Rocket Man
11 |
12 | (load "Rockets-config.lisp") ; load configuration information
13 | (display-header (string RocketsConfig:Name " - Register"))
14 | (open-database RocketsConfig:Database)
15 | (display-partial "rockets-checksignin") ; checks to see if user is signed in
16 | (set 'active-page "rockets-register")
17 | (display-partial "rockets-navbar")
18 |
19 | (displayln "
Tired of having to squint at distorted letters just to register for a new website? So are we. So let's try something more fun.
") 21 | 22 | (load "rocket-list.lisp") 23 | (set 'total-critter-list-num (append RocketReg:rocket-list RocketReg:not-rocket-list)) 24 | (dolist (q total-critter-list-num) 25 | (set 'temp-critter (string q)) 26 | (push temp-critter total-critter-list -1)) 27 | 28 | ; note: "cats" are rockets. "not-cats" are other vehicles. 29 | (seed (time-of-day)) 30 | (do-until (= (length (unique new-cat-list)) 3) (set 'new-cat-list (rand 9 3))) ; keep doing it until you get 3 distinct cats 31 | (set 'new-not-cat-list-temp (rand (- 91 9) 9)) 32 | (dolist (y new-not-cat-list-temp) (push (+ y 9) new-not-cat-list -1)) 33 | 34 | (set 'total-animal-list (append new-cat-list new-not-cat-list)) 35 | (set 'total-animal-list (randomize total-animal-list)) 36 | 37 | (displayln "Please click the checkboxes below all three rockets, to prove you are a human.
") 39 | (displayln "Then, enter a user name, password, and email address below and click 'Register'.
") 40 | (displayln "You will be registered and signed in automatically.
") 41 | 42 | (displayln "