Commit Graph

11 Commits

Author SHA1 Message Date
Zuhayr
b47d91b612 Merge resolution, master into dev. 2014-08-21 12:01:38 +09:30
MrStonedOne
873c15178c Fixes sql errors caused by odd and unexpected behavor in dbcon.Quote() 2014-08-18 14:07:14 +01:00
MrStonedOne
f396b94068 SQL injection fix.
Google sanitizing sql input. almost every single article explains why you should never attempt to roll your own function to do this.
2014-08-18 14:07:04 +01:00
Whitellama
0528675846 Added dynamic flavour text, where covered bodyparts' flavour isn't displayed 2014-07-26 17:08:55 -07:00
YotaXP
68ae21fac3 Optimized and refactored list2text, text2list, and replacetext.
Also fixed some grammar in the station blueprint code.

Conflicts:
	code/game/objects/items/blueprints.dm
	code/game/objects/items/devices/uplinks.dm
	code/modules/admin/verbs/debug.dm
	code/modules/clothing/masks/gasmask.dm
	code/modules/detectivework/scanner.dm
	code/modules/flufftext/TextFilters.dm
	code/modules/mob/living/carbon/human/say.dm
	code/modules/mob/living/silicon/ai/say.dm
2014-01-08 11:41:51 +00:00
Zuhayr
b048f0a00a Revert "Bygex - Regex implementation for byond."
This reverts commit a9bea16ac8.
2013-12-15 14:16:21 +10:30
carnie
a9bea16ac8 Bygex - Regex implementation for byond.
Source-code for the dll can be found here under LGPL license:
https://github.com/Carn/bygex
It is merely an interface to boost::regex. It uses perl syntax (non-recursive).

Guidelines for use:
var/datum/regex/Rgx = regex_findall(haystack, regex_expression)
for(var/i=1, i<=Rgx.matches.len, ++i)
    world << Rgx.str(i)

The implementation is different to the one other regex-in-byond library I found. This implementation only returns a string containing the position and length of each match and submatch. This uses far less memory than also passing back the matched strings (especially in large files like dream-maker maps).

Note: Regex indexes begin at 1 (since byond lists begin at 1), unlike traditional regex. If we are using a procedure such as regex_findall(), with 3 sub-expressions, match 1 will be the overall match. Match 2 will be subexpression 1, match 3 will be subexpression 2.... Match 5 will be the overall match of the next match...and so on. To ease use, there is /datum/regex/var/anchors which is a numerical value which can be used inside loops like so:

for(var/i=1, i<=Rgx.matches.len, i+=Rgx.anchors)
    world << Rgx.str(i+1)
This will print the first submatch of each match to world.
2013-11-21 18:54:01 +00:00
Chinsky
e34d033cc9 Moved tag whitelist check to HELPERS.
Removed img tag from whitelist.
2013-02-12 20:43:22 +04:00
giacomand@gmail.com
ba4e25b97d -Added some new helper procs.
-Used some helper procs in my advance diseases.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5142 316c924e-a436-60f5-8080-3fe189b3f50e
2012-11-21 02:01:39 +00:00
elly1989@rocketmail.com
4d9876fd65 Fixes issues with pen bbcode. Replacetext did not work correctly after I changed text2list - (It was missing 'needles' at the beginning of 'haystacks').
>dd_replacetext and dd_replacetext_case are now replacetext and replacetextEx respectively.
>replacetext and replacetextEx works using strings only; it doesn't convert it into a list and then back into a string.

Fixes some dumb-dumbs in textlist and text2listEx
> "<" where there should be a "<="
> no else case for when the separator is longer than the text (causing empty lists to be returned)

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4971 316c924e-a436-60f5-8080-3fe189b3f50e
2012-10-27 21:21:17 +00:00
elly1989@rocketmail.com
7b720a20b6 >Moved most of the helper procs into code/__HELPERS. If you see ANYTHING generic enough to be a helper proc just throw it in there and help purge the copypasta 5ever
>Replaced dd_text2list, dd_text2listcase, tg_text2listcase and tg_text2list with text2list and text2listEx. text2list will return a list of each and every character in the string if you set separator=""
>added return_file_text(filepath) which returns text from a file after doing some checks: does the file exist? is the file empty? It prints helpful error messages to the world.log if it runs into problems
>Replaced dd_file2list(filepath, seperator) with file2list(filepath, seperator). It just calls text2list(return_file_text(filepath), seperator). rather than copypasta
>Replaced time_stamp() so it's not as retarded
>Lots of the world setup stuff uses file2list now, rather than file2text -> sanity -> text2list
>Added error() warning() testing() procs. These print messages to world.log with a prefix. e.g. ## ERROR: msg.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4948 316c924e-a436-60f5-8080-3fe189b3f50e
2012-10-24 14:39:36 +00:00