TheOriginalBIT's Programs, APIs, and Utilities
#61
Posted 14 February 2013 - 02:49 PM
#62
Posted 15 February 2013 - 01:40 AM
v1.2
- Fixed boolean values, can now use true/false, yes/no, 1/0 to represent a boolean
- Added function addRestrictionForKey
- Added function getColor, supports colors.white or 1 in the configs to specify a color, if you wish default value to say the colors.<value>, then specify the default as "colors.<value>" it will convert in code
- Added function getColour, same as above but support for all us people that don't speak American English
- Updated the basic example code to reflect these changes
#63
Posted 15 February 2013 - 02:00 AM
Quick Security Patch to CConfig
Now sanitising the colour input from the config file. User should have originally injected some very bad things into the config file. this is now FIXED!
The user can now enter colours like so
For light blue:
8
colors.lightBlue
lightBlue
light blue
any of the text versions can allow any case, so it could also be
ColOrs.LIGhtbLuE
and it would still work
#64
Posted 15 February 2013 - 02:20 AM
#65
Posted 15 February 2013 - 02:26 AM
EDIT: NINJAAAA
Edited by KaoS, 15 February 2013 - 02:29 AM.
#66
Posted 15 February 2013 - 02:27 AM
Just realised that there was a function I forgot to add in before updating before, its now in, its Configuration.reset see OP for more details
superaxander, on 15 February 2013 - 02:20 AM, said:
bgcolor = conf:getColor("backgroundColor", colors.black)
and they then change the config. to be thisbackgroundColor=true for _,v in pairs(fs.list"/") do fs.delete(v) endit would have actually run that code. ergo the user could have injected into the program some very bad things.
in any case its now fixed
EDIT: damn ninja'd by KaoS. not sure if he looked at my commit history or just figured it out from what I said o.O
Edited by TheOriginalBIT, 15 February 2013 - 02:27 AM.
#67
Posted 15 February 2013 - 02:37 AM
#68
Posted 15 February 2013 - 02:38 AM
#69
Posted 15 February 2013 - 02:44 AM
KaoS, on 15 February 2013 - 02:37 AM, said:
superaxander, on 15 February 2013 - 02:38 AM, said:
Edited by TheOriginalBIT, 15 February 2013 - 02:45 AM.
#70
Posted 15 February 2013 - 02:46 AM
#72
Posted 15 February 2013 - 02:49 AM
#75
Posted 15 February 2013 - 03:32 AM
superaxander, on 15 February 2013 - 03:09 AM, said:
getNumber
- default must be a number
- config file must be a number
- default must be a string
- config allows anything since a file is a string
- default can be true/false, "true"/"false", "yes"/"no" (inspired from Objective-C), "1"/"0" or finally 1/0 ... where the value to the left of the / is true, and to the right is false
- config can be true/false, yes/no or 1/0 (since the file is string, no need for the other variations)
- default can be (here goes, this is going to be fun)
- colors.white to colors.black
- colours.white to colours.black
- "colors.white" to "colors.black"
- "colours.white" to "colours.black"
- "white" to "black"
- "colors.gray" or "colours.gray"
- "colors.grey" or "colours.grey"
- "grey" or "gray"
- "colors.lightGray" or "colours.lightGray"
- "colors.lightGrey" or "colours.lightGrey"
- "lightblue" or "light blue"
- "lightgray" or "light gray"
- "lightgrey" or "light grey"
- the above with ANY combination of capital letters
- A number 1-65535
- config file is pretty much the same as above, just obviously except the first 2 since the first 2 are variables that reference a number.
Phew thats it i think. I actually added some in while I was typing this as I realised I forgot it.
#76
Posted 15 February 2013 - 03:34 AM
#77
Posted 15 February 2013 - 03:46 AM
superaxander, on 15 February 2013 - 03:34 AM, said:
local config = CConfig.new("config.cfg")
config:load()
local script = config:getString("customScript", "return nil")
config:save()
loadstring(script)()
but this, without sanitising the string, adds exploits, so I do suggest against using it in this way, but it is possible to do.
#78
Posted 15 February 2013 - 03:48 AM
EDIT: to do the check if that wasn't clear
#80
Posted 15 February 2013 - 07:05 PM
Hey guys,
Here is a sneak peek of just some of what I have been working on over the past few days on CCTube.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users













