//This file was auto-corrected by findeclaration.exe on 29/05/2012 15:03:04 #define BOOK_VERSION_MIN 1 #define BOOK_VERSION_MAX 2 #define BOOK_PATH "data/books/" var/global/datum/book_manager/book_mgr = new() /datum/book_manager/proc/path(id) if(isnum(id)) // kill any path exploits return "[BOOK_PATH][id].sav" /datum/book_manager/proc/getall() var/list/paths = flist(BOOK_PATH) var/list/books = new() for(var/path in paths) var/datum/archived_book/B = new(BOOK_PATH + path) books += B return books /datum/book_manager/proc/freeid() var/list/paths = flist(BOOK_PATH) var/id = paths.len + 101 // start at 101+number of books, which will be correct id if none have been deleted, etc // otherwise, keep moving forward until we find an open id while(fexists(path(id))) id++ return id /client/proc/delbook() set name = "Delete Book" set desc = "Permamently deletes a book from the database." set category = "Admin.Moderation" if(!src.holder) to_chat(src, "Only administrators may use this command.") return //VOREStation Edit Start var/obj/machinery/librarycomp/our_comp for(var/obj/machinery/librarycomp/l in world) if(istype(l, /obj/machinery/librarycomp)) our_comp = l break if(!our_comp) to_chat(usr, span_warning("Unable to locate a library computer to use for book deleting.")) return var/dat = "Book Inventory Management\n" // dat += "

ADMINISTRATIVE MANAGEMENT

" establish_old_db_connection() if(!SSdbcore.IsConnected()) dat += span_red(span_bold("ERROR") + ": Unable to contact External Archive. Please contact your system administrator for assistance.") else dat += {"(Order book by SS13BN)

TITLE> version if (isnull(version) || version < BOOK_VERSION_MIN || version > BOOK_VERSION_MAX) fdel(path) to_chat(usr, "What book?") return 0 F["author"] >> author F["title"] >> title F["category"] >> category F["id"] >> id F["dat"] >> dat F["author_real"] >> author_real F["author_key"] >> author_key F["photos"] >> photos if(!photos) photos = new() // let's sanitize it here too! for(var/tag in paper_blacklist) if(findtext(dat,"<"+tag)) dat = "" return /datum/archived_book/proc/save() var/savefile/F = new(book_mgr.path(id)) F["version"] << BOOK_VERSION_MAX F["author"] << author F["title"] << title F["category"] << category F["id"] << id F["dat"] << dat F["author_real"] << author_real F["author_key"] << author_key F["photos"] << photos #undef BOOK_VERSION_MIN #undef BOOK_VERSION_MAX #undef BOOK_PATH