diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm
index 4c6abbd7d0b..082af09f3f1 100644
--- a/code/__HELPERS/text.dm
+++ b/code/__HELPERS/text.dm
@@ -431,7 +431,7 @@ proc/checkhtml(var/t)
text = copytext(text, 1, index) + repl_chars[char] + copytext(text, index+keylength)
index = findtext(text, char)
return text
-
+
//Checks if any of a given list of needles is in the haystack
/proc/text_in_list(haystack, list/needle_list, start=1, end=0)
for(var/needle in needle_list)
@@ -445,3 +445,98 @@ proc/checkhtml(var/t)
if(findtextEx(haystack, needle, start, end))
return 1
return 0
+
+
+// Pencode
+/proc/pencode_to_html(text, mob/user, var/obj/item/weapon/pen/P = null, deffont = "Verdana", signfont = "Times New Roman", crayonfont = "Comic Sans MS")
+ text = replacetext(text, "\n", "
")
+ text = replacetext(text, "\[center\]", "
")
+
+ text = "[text]"
+ else // If it is a crayon, and he still tries to use these, make them empty!
+ text = replacetext(text, "\[*\]", "")
+ text = replacetext(text, "\[hr\]", "")
+ text = replacetext(text, "\[small\]", "")
+ text = replacetext(text, "\[/small\]", "")
+ text = replacetext(text, "\[list\]", "")
+ text = replacetext(text, "\[/list\]", "")
+ text = replacetext(text, "\[table\]", "")
+ text = replacetext(text, "\[/table\]", "")
+ text = replacetext(text, "\[row\]", "")
+ text = replacetext(text, "\[cell\]", "")
+ text = replacetext(text, "\[logo\]", "")
+
+ text = "[text]"
+
+ text = copytext(text, 1, MAX_PAPER_MESSAGE_LEN)
+ return text
+
+/proc/html_to_pencode(text)
+ text = replacetext(text, "
", "\[logo\]")
+ return text
+
diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm
index 4a01b1161e8..97f531b89fc 100644
--- a/code/modules/admin/topic.dm
+++ b/code/modules/admin/topic.dm
@@ -3019,6 +3019,59 @@
else
error_viewer.showTo(usr, null, href_list["viewruntime_linear"])
+ // Library stuff
+ else if(href_list["library_book_id"])
+ var/isbn = href_list["library_book_id"]
+
+ if(href_list["view_library_book"])
+ var/DBQuery/query_view_book = dbcon.NewQuery("SELECT content, title FROM [format_table_name("library")] WHERE id=[isbn]")
+ if(!query_view_book.Execute())
+ var/err = query_view_book.ErrorMsg()
+ log_game("SQL ERROR viewing book. Error : \[[err]\]\n")
+ return
+
+ var/content = ""
+ var/title = ""
+ while(query_view_book.NextRow())
+ content = query_view_book.item[1]
+ title = html_encode(query_view_book.item[2])
+
+ var/dat = ""
+ dat += "[html_encode(html_to_pencode(content))]"
+ dat += ""
+
+ var/datum/browser/popup = new(usr, "admin_view_book", "[title]", 700, 400)
+ popup.set_content(dat)
+ popup.open(0)
+
+ log_admin("[key_name(usr)] has viewed the book [isbn].")
+ message_admins("[key_name_admin(usr)] has viewed the book [isbn].")
+ return
+
+ else if(href_list["unflag_library_book"])
+ var/DBQuery/query_unflag_book = dbcon.NewQuery("UPDATE [format_table_name("library")] SET flagged = 0 WHERE id=[isbn]")
+ if(!query_unflag_book.Execute())
+ var/err = query_unflag_book.ErrorMsg()
+ log_game("SQL ERROR unflagging book. Error : \[[err]\]\n")
+ return
+
+ log_admin("[key_name(usr)] has unflagged the book [isbn].")
+ message_admins("[key_name_admin(usr)] has unflagged the book [isbn].")
+
+ else if(href_list["delete_library_book"])
+ var/DBQuery/query_delbook = dbcon.NewQuery("DELETE FROM [format_table_name("library")] WHERE id=[isbn]")
+ if(!query_delbook.Execute())
+ var/err = query_delbook.ErrorMsg()
+ log_game("SQL ERROR deleting book. Error : \[[err]\]\n")
+ return
+
+ log_admin("[key_name(usr)] has deleted the book [isbn].")
+ message_admins("[key_name_admin(usr)] has deleted the book [isbn].")
+
+ // Refresh the page
+ src.view_flagged_books()
+
+
/proc/admin_jump_link(var/atom/target)
if(!target) return
// The way admin jump links handle their src is weirdly inconsistent...
diff --git a/code/modules/library/admin.dm b/code/modules/library/admin.dm
index 7e3abd91db9..83268c5eecb 100644
--- a/code/modules/library/admin.dm
+++ b/code/modules/library/admin.dm
@@ -29,13 +29,36 @@
to_chat(src, "Only administrators may use this command.")
return
+ holder.view_flagged_books()
+
+/datum/admins/proc/view_flagged_books()
+ if(!usr.client.holder)
+ return
+
+ var/dat = "| ISBN | Title | Total Flags | Options |
|---|---|---|---|
| [add_zero(isbn, 4)] | [query.item[2]] | [query.item[3]] | " + dat += "View Content" + dat += "Unflag" + dat += "Delete" + dat += " | " + + dat += "
")
-
- t = "[t]"
- else // If it is a crayon, and he still tries to use these, make them empty!
- t = replacetext(t, "\[*\]", "")
- t = replacetext(t, "\[hr\]", "")
- t = replacetext(t, "\[small\]", "")
- t = replacetext(t, "\[/small\]", "")
- t = replacetext(t, "\[list\]", "")
- t = replacetext(t, "\[/list\]", "")
- t = replacetext(t, "\[table\]", "")
- t = replacetext(t, "\[/table\]", "")
- t = replacetext(t, "\[row\]", "")
- t = replacetext(t, "\[cell\]", "")
- t = replacetext(t, "\[logo\]", "")
-
- t = "[t]"
-
- t = copytext(t, 1, MAX_PAPER_MESSAGE_LEN)
+/obj/item/weapon/paper/proc/parsepencode(var/t, var/obj/item/weapon/pen/P, mob/user as mob)
+ t = pencode_to_html(t, usr, P, deffont, signfont, crayonfont)
//Count the fields
var/laststart = 1
@@ -303,12 +249,10 @@
//var/t = strip_html_simple(input("Enter what you want to write:", "Write", null, null) as message, MAX_MESSAGE_LEN)
var/t = input("Enter what you want to write:", "Write", null, null) as message
var/obj/item/i = usr.get_active_hand() // Check to see if he still got that darn pen, also check if he's using a crayon or pen.
- var/iscrayon = 0
add_hiddenprint(usr) // No more forging nasty documents as someone else, you jerks
if(!istype(i, /obj/item/weapon/pen))
if(!istype(i, /obj/item/toy/crayon))
return
- iscrayon = 1
// if paper is not in usr, then it must be near them, or in a clipboard or folder, which must be in or near usr
@@ -326,8 +270,7 @@
return
*/
t = html_encode(t)
- t = replacetext(t, "\n", "