From 33955c93ae8050778c75c18756585a59103ea86f Mon Sep 17 00:00:00 2001 From: Scott Ostler Date: Sun, 24 Oct 2010 20:46:30 -0400 Subject: Add initial event logic and merge --- src/site.clj | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src/site.clj') diff --git a/src/site.clj b/src/site.clj index 98fde79..1523c6f 100644 --- a/src/site.clj +++ b/src/site.clj @@ -19,7 +19,6 @@ admin compojure email - events fame utils cookie-login @@ -473,7 +472,7 @@ ORDER BY cnt DESC (defn generic-profile-handler [session nick date msg-id func redirecter unknown] (if-let [user-info (fetch-nick nick)] - ;; If a valid msg-id is provided, the date is ignored. + ;; If a valid msg-id is provided, the date is ignored. ;; This makes urls such as /user/bogus/5 valid. (cond msg-id (if-let [msg-id (maybe-parse-int msg-id)] (func session user-info nil msg-id) @@ -489,12 +488,12 @@ ORDER BY cnt DESC (defn build-mini-profile [user-info] (let [st (fetch-template-fragment "mini_profile") - nick (user-info :nick) - score (lookup-score nick)] + nick (user-info :nick) + score (lookup-score nick)] (doseq [a [:nick :avatar :contact :bio]] (let [v (user-info a)] - (.setAttribute st (name a) - (if (non-empty-string? v) (escape-html v))))) + (.setAttribute st (name a) + (if (non-empty-string? v) (escape-html v))))) (doto st (.setAttribute "score" (comma-format score)) (.setAttribute "score_ent" (score-to-entity score)) @@ -1150,14 +1149,14 @@ WHERE u.user_id = ANY(?)" (str "FILE_TOO_BIG " limit))) (defn invalid-image-dimensions? [f [max-width max-height]] - (try - (let [i (ImageIO/read f) - height (.getHeight i) - width (.getWidth i)] - (if (or (> width max-width) - (> height max-height)) - (str "INVALID_RESOLUTION " max-width " " max-height))) - (catch Exception _ "INVALID_IMAGE"))) + (try + (let [i (ImageIO/read f) + height (.getHeight i) + width (.getWidth i)] + (if (or (> width max-width) + (> height max-height)) + (str "INVALID_RESOLUTION " max-width " " max-height))) + (catch Exception _ "INVALID_IMAGE"))) (defn format-filename [s nick] (let [spaceless (.replace s \space \-) @@ -1165,7 +1164,7 @@ WHERE u.user_id = ANY(?)" subbed (re-gsub #"[^\w.-]" "" spaceless)] (str-join "-" [(System/currentTimeMillis) "dumpfm" nick-clean subbed]))) -(defn image-url-from-file [dir date file] +(defn image-url-from-file [dir date file] (str-join "/" [*server-url* dir date (.getName file)])) (defn validate-upload-file [f room] @@ -1339,7 +1338,9 @@ WHERE u.user_id = ANY(?)" ;; Events - (GET "/event" (current-event session)) +; (GET "/event" (event-page session)) +; (GET "/event/proxy" (image-proxy session params request)) +; (POST "/event/submit" (submit! session params request)) ;; Fullscreen (GET "/fullscreen" (serve-meme session "fullscreen")) -- cgit v1.2.3-70-g09d2