//#define NEWSFILE "data/news.sav" //where the memos are saved //ChompEDIT - moved to __defines/admin_ch /client/ //var/last_news_hash = null // Stores a hash of the last news window it saw, which gets compared to the current one to see if it is different. // Returns true if news was updated since last seen. /client/proc/check_for_new_server_news() if(servernews_hash != prefs.lastnews) //ChompEDIT return TRUE return FALSE /client/proc/modify_server_news() set name = "Modify Public News" set category = "Server.Game" //CHOMPEdit if(!check_rights(0)) return var/savefile/F = new(NEWSFILE) if(F) //ChompEDIT start - handle reads correctly var/title F["title"] >> title //This is done twice on purpose. For some reason BYOND misses the first read, if performed before the world starts F["title"] >> title var/body F["body"] >> body body = html2paper_markup(body) //ChompEDIT end var/new_title = sanitize(tgui_input_text(src,"Write a good title for the news update. Note: HTML is NOT supported.","Write News", title), extra = 0) if(!new_title) return var/new_body = sanitize(tgui_input_text(src,"Write the body of the news update here. Note: HTML is NOT supported, however paper markup is supported. \n\ Hitting enter will automatically add a line break. \n\ Valid markup includes: \[b\], \[i\], \[u\], \[large\], \[h1\], \[h2\], \[h3\]\ \[*\], \[hr\], \[small\], \[list\], \[table\], \[grid\], \ \[row\], \[cell\], \[logo\], \[sglogo\].","Write News", body, multiline = TRUE, prevent_enter = TRUE), extra = 0) new_body = paper_markup2html(new_body) if(findtext(new_body,"[new_title]
[new_body]") /client/proc/get_server_news() //ChompEDIT - child of /client/ var/savefile/F = new(NEWSFILE) if(F) if(servernews_hash != prefs.lastnews) //ChompADD prefs.lastnews = servernews_hash //ChompADD SScharacter_setup.queue_preferences_save(prefs) //ChompADD return F // This is used when submitting the news input, so the safe markup can get past sanitize. /proc/paper_markup2html(var/text) text = replacetext(text, "\n", "
") text = replacetext(text, "\[center\]", "
") text = replacetext(text, "\[/center\]", "
") text = replacetext(text, "\[br\]", "
") text = replacetext(text, "\[b\]", "") text = replacetext(text, "\[/b\]", "") text = replacetext(text, "\[i\]", "") text = replacetext(text, "\[/i\]", "") text = replacetext(text, "\[u\]", "") text = replacetext(text, "\[/u\]", "") text = replacetext(text, "\[large\]", "") text = replacetext(text, "\[/large\]", "") text = replacetext(text, "\[h1\]", "

") text = replacetext(text, "\[/h1\]", "

") text = replacetext(text, "\[h2\]", "

") text = replacetext(text, "\[/h2\]", "

") text = replacetext(text, "\[h3\]", "

") text = replacetext(text, "\[/h3\]", "

") text = replacetext(text, "\[*\]", "
  • ") text = replacetext(text, "\[hr\]", "
    ") text = replacetext(text, "\[small\]", "") text = replacetext(text, "\[/small\]", "") text = replacetext(text, "\[list\]", "") text = replacetext(text, "\[table\]", "") text = replacetext(text, "\[/table\]", "
    ") text = replacetext(text, "\[grid\]", "") text = replacetext(text, "\[/grid\]", "
    ") text = replacetext(text, "\[row\]", "") text = replacetext(text, "\[cell\]", "") text = replacetext(text, "\[logo\]", "") // Not sure if these would get used but why not text = replacetext(text, "\[sglogo\]", "") return text // This is used when reading text that went through paper_markup2html(), to reverse it so that edits don't need to replace everything once more to avoid sanitization. /proc/html2paper_markup(var/text) text = replacetext(text, "
    ", "\[br\]") text = replacetext(text, "
    ", "\[center\]") text = replacetext(text, "
    ", "\[/center\]") text = replacetext(text, "
    ", "\[br\]") text = replacetext(text, "", "\[b\]") text = replacetext(text, "", "\[/b\]") text = replacetext(text, "", "\[i\]") text = replacetext(text, "", "\[/i\]") text = replacetext(text, "", "\[u\]") text = replacetext(text, "", "\[/u\]") text = replacetext(text, "", "\[large\]") text = replacetext(text, "", "\[/large\]") text = replacetext(text, "

    ", "\[h1\]") text = replacetext(text, "

    ", "\[/h1\]") text = replacetext(text, "

    ", "\[h2\]") text = replacetext(text, "

    ", "\[/h2\]") text = replacetext(text, "

    ", "\[h3\]") text = replacetext(text, "

    ", "\[/h3\]") text = replacetext(text, "
  • ", "\[*\]") text = replacetext(text, "
    ", "\[hr\]") text = replacetext(text, "", "\[small\]") text = replacetext(text, "", "\[/small\]") text = replacetext(text, "", "\[/list\]") text = replacetext(text, "", "\[table\]") text = replacetext(text, "
    ", "\[/table\]") text = replacetext(text, "", "\[grid\]") text = replacetext(text, "
    ", "\[/grid\]") text = replacetext(text, "", "\[row\]") text = replacetext(text, "", "\[cell\]") text = replacetext(text, "", "\[logo\]") // Not sure if these would get used but why not text = replacetext(text, "", "\[sglogo\]") return text #undef NEWSFILE