mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Fix library shit for reals
This commit is contained in:
@@ -29,22 +29,23 @@
|
||||
if(query)
|
||||
var/where = 0
|
||||
if(query.title)
|
||||
searchquery += " WHERE title LIKE [query.title]"
|
||||
searchquery += " WHERE title LIKE '%[query.title]%'"
|
||||
where = 1
|
||||
if(query.author)
|
||||
searchquery += " [where ? "WHERE" : "AND"] author LIKE [query.author]"
|
||||
searchquery += " [where ? "WHERE" : "AND"] author LIKE '%[query.author]%'"
|
||||
where = 1
|
||||
if(query.category)
|
||||
searchquery += " [where ? "WHERE" : "AND"] category LIKE [query.category]"
|
||||
searchquery += " [where ? "WHERE" : "AND"] category LIKE '%[query.category]%'"
|
||||
where = 1
|
||||
var/sql = "SELECT id, author, title, category, ckey FROM library [searchquery] LIMIT [page_num * LIBRARY_BOOKS_PER_PAGE], [LIBRARY_BOOKS_PER_PAGE]"
|
||||
|
||||
//if(query)
|
||||
//sql += " [query.toSQL()]"
|
||||
// Pagination
|
||||
|
||||
var/DBQuery/_query = dbcon_old.NewQuery(sql)
|
||||
_query.Execute()
|
||||
if(_query.ErrorMsg())
|
||||
world.log << _query.ErrorMsg()
|
||||
|
||||
var/list/results = list()
|
||||
while(_query.NextRow())
|
||||
|
||||
@@ -179,7 +179,7 @@
|
||||
if(!emagged)
|
||||
forbidden |= /obj/item/weapon/book/manual/nuclear
|
||||
|
||||
var/manualcount = 0
|
||||
var/manualcount = 1
|
||||
var/obj/item/weapon/book/manual/M = null
|
||||
|
||||
for(var/manual_type in (typesof(/obj/item/weapon/book/manual) - forbidden))
|
||||
@@ -372,6 +372,9 @@
|
||||
return
|
||||
|
||||
var/datum/cachedbook/newbook = getBookByID(href_list["id"]) // Sanitized in getBookByID
|
||||
if(!newbook)
|
||||
alert("No book found")
|
||||
return
|
||||
if((newbook.forbidden == 2 && !emagged) || newbook.forbidden == 1)
|
||||
alert("This book is forbidden and cannot be printed.")
|
||||
return
|
||||
@@ -384,7 +387,30 @@
|
||||
spawn(60)
|
||||
bibledelay = 0
|
||||
make_external_book(newbook)
|
||||
if(href_list["manual"])
|
||||
if(!href_list["manual"]) return
|
||||
var/bookid = href_list["manual"]
|
||||
|
||||
if(!dbcon_old.IsConnected())
|
||||
alert("Connection to Archive has been severed. Aborting.")
|
||||
return
|
||||
|
||||
var/datum/cachedbook/newbook = getBookByID("M[bookid]")
|
||||
if(!newbook)
|
||||
alert("No book found")
|
||||
return
|
||||
if((newbook.forbidden == 2 && !emagged) || newbook.forbidden == 1)
|
||||
alert("This book is forbidden and cannot be printed.")
|
||||
return
|
||||
|
||||
if(bibledelay)
|
||||
for (var/mob/V in hearers(src))
|
||||
V.show_message("<b>[src]</b>'s monitor flashes, \"Printer unavailable. Please allow a short time before attempting to print.\"")
|
||||
else
|
||||
bibledelay = 1
|
||||
spawn(60)
|
||||
bibledelay = 0
|
||||
make_external_book(newbook)
|
||||
|
||||
src.add_fingerprint(usr)
|
||||
src.updateUsrDialog()
|
||||
|
||||
Reference in New Issue
Block a user