func getdeleteart(wr *web.Context) { var alltotal int //Get list of articles all := jailgo.GetartList() if all != nil { alltotal = len(all.Arts) - 1 } for i := 0; i <= alltotal; i++ { if alltotal < 0 { log.Println("DEBUG Admin: Negative Slice passed") } else { // i IS NOT EQUAL TO THREADID!!! if all.Arts != nil { //Convert Row to string artid := all.Arts[i].Str(all.Id) //Convert string to int articleid, _ := strconv.Atoi(artid) //Print Article through its Id if jailgo.Getart(articleid) != nil { index_del.Exec(wr, ViewCtxArticle{jailgo.Getart(articleid)}) } } } } }
func last(wr *web.Context) { var alltotal int //Get list of articles all := jailgo.GetartList() if all != nil { alltotal = len(all.Arts) - 1 //Get three last articles for i := alltotal; i >= alltotal-2; i-- { if alltotal < 0 { log.Println("DEBUG Last: Negative Slice passed") return } else { // i IS NOT EQUAL TO THREADID!!! if all.Arts != nil && i >= 0 { //Convert Row to string artid := all.Arts[i].Str(all.Id) //Convert string to int articleid, _ := strconv.Atoi(artid) //Print Article through its Id foot_last.Exec(wr, ViewCtxArticle{jailgo.Getart(articleid)}) } } } } }
func showblog(wr *web.Context) { var ( alltotal int ) // Render basic layout html index.Exec(wr) //Get list of articles all := jailgo.GetartList() if all != nil { alltotal = len(all.Arts) - 1 } for i := alltotal; i >= alltotal-6; i-- { if alltotal < 0 { log.Println("DEBUG Negative Slice passed") } else { // i IS NOT EQUAL TO THREADID!!! if all.Arts != nil && i >= 0 { //Convert Row to string artid := all.Arts[i].Str(all.Id) //Convert string to int articleid, _ := strconv.Atoi(artid) //Print Article through its Id index_view.Exec(wr, ViewCtxArticle{jailgo.Getart(articleid)}) } } } // Get login if wr.Params["check"] != "" { check := wr.Params["check"] foot1.Exec(wr, ViewCtxLogin{BlogLogin(wr, check), vinfo()}) // Get last published last(wr) foot2.Exec(wr) } else { check := "" foot1.Exec(wr, ViewCtxLogin{BlogLogin(wr, check), vinfo()}) last(wr) foot2.Exec(wr) } }
func entry(wr *web.Context, art_num string) { var eidtotal int // Render basic layout html with article and captcha art_num = wr.Params["threadid"] id, _ := strconv.Atoi(art_num) // Check if you're coming from wrong typed captcha if wr.Params["fail"] != "" { commentfail.Exec(wr, ViewCtxArticle{jailgo.Getart(id)}) } else { comment.Exec(wr, ViewCtxArticle{jailgo.Getart(id)}) } // Render all comments for article eid := jailgo.GetEntryList(id) if eid != nil { eidtotal = len(eid.Entrys) } // Looping through all entries in List (not too expensive) if eidtotal != 0 { for i := range eid.Entrys { if eidtotal < 0 { log.Println("DEBUG Negative Slice passed") } else { // i IS NOT EQUAL TO ENTRYID!!! //Convert Row to string entid := eid.Entrys[i].Str(eid.Id) //Convert string to int entryid, _ := strconv.Atoi(entid) // Skip empty rows if jailgo.GetEntry(entryid, id) != nil { comment_view.Exec(wr, ViewCtxComment{jailgo.GetEntry(entryid, id)}) } } } } // Render Add comment box and captcha comment2.Exec(wr, ViewCtxArtCom{jailgo.Getart(id), showForm(wr)}) // Get login if wr.Params["check"] != "" { check := wr.Params["check"] foot1.Exec(wr, ViewCtxLogin{BlogLogin(wr, check), vinfo()}) // Get last published and search content to javascript last(wr) foot2.Exec(wr) } else { check := "" foot1.Exec(wr, ViewCtxLogin{BlogLogin(wr, check), vinfo()}) last(wr) foot2.Exec(wr) } }
func search(wr *web.Context) { var ( alltotal int ) // Render basic layout html searching.Exec(wr) year := wr.Request.Params["threadyear"] month := wr.Request.Params["threaddate"] //Get list of articles all := jailgo.GetartList() if all != nil { alltotal = len(all.Arts) - 1 } for i := 0; i <= alltotal; i++ { if alltotal < 0 { log.Println("DEBUG Negative Slice passed") } else { // i IS NOT EQUAL TO THREADID!!! if all.Arts != nil { //Convert Row to string artid := all.Arts[i].Str(all.Id) //Convert string to int articleid, _ := strconv.Atoi(artid) // Getting Options if month != "select" && year != "select" { a := jailgo.Getart(articleid) if a.Year == year && a.Month == month { results.Exec(wr, ViewCtxArticle{a}) } } else if month != "select" { a := jailgo.Getart(articleid) if a.Month == month { results.Exec(wr, ViewCtxArticle{a}) } } else if year != "select" { a := jailgo.Getart(articleid) if a.Year == year { results.Exec(wr, ViewCtxArticle{a}) } } } } } // Get login if wr.Request.Params["check"] != "" { check := wr.Request.Params["check"] foot1.Exec(wr, ViewCtxLogin{BlogLogin(wr, check), vinfo()}) // Get last published last(wr) foot2.Exec(wr) } else { check := "" foot1.Exec(wr, ViewCtxLogin{BlogLogin(wr, check), vinfo()}) last(wr) foot2.Exec(wr) } }