diff --git a/libraries/Gelato/ErrorHandler.php b/libraries/Gelato/ErrorHandler.php
index 50c8e6c..874e1cd 100644
--- a/libraries/Gelato/ErrorHandler.php
+++ b/libraries/Gelato/ErrorHandler.php
@@ -72,11 +72,11 @@ class ErrorHandler
/**
* Converts errors to ErrorExceptions.
*
- * @param integer $code The error code
- * @param string $message The error message
- * @param string $file The filename where the error occurred
- * @param integer $line The line number where the error occurred
- * @return boolean
+ * @param integer $code The error code
+ * @param string $message The error message
+ * @param string $file The filename where the error occurred
+ * @param integer $line The line number where the error occurred
+ * @return boolean
*/
public static function errorHandler($code, $message, $file, $line)
{
@@ -127,7 +127,7 @@ class ErrorHandler
$trace = array();
foreach ($backtrace as $entry) {
-
+
// Function
$function = '';
diff --git a/libraries/Gelato/Token.php b/libraries/Gelato/Token.php
new file mode 100644
index 0000000..f7896ac
--- /dev/null
+++ b/libraries/Gelato/Token.php
@@ -0,0 +1,90 @@
+
+ * $token = Token::generate();
+ *
+ *
+ * You can insert this token into your forms as a hidden field:
+ *
+ *
+ * echo Form::hidden('csrf', Token::generate());
+ *
+ *
+ * This provides a basic, but effective, method of preventing CSRF attacks.
+ *
+ * @param boolean $new force a new token to be generated?. Default is false
+ * @return string
+ */
+ public static function generate($new = false)
+ {
+ // Get the current token
+ $token = Session::get(Token::$token_name);
+
+ // Create a new unique token
+ if ($new === true or ! $token) {
+
+ // Generate a new unique token
+ $token = sha1(uniqid(mt_rand(), true));
+
+ // Store the new token
+ Session::set(Token::$token_name, $token);
+ }
+
+ // Return token
+ return $token;
+ }
+
+ /**
+ * Check that the given token matches the currently stored security token.
+ *
+ *
+ * if (Token::check($token)) {
+ * // Pass
+ * }
+ *
+ *
+ * @param string $token token to check
+ * @return boolean
+ */
+ public static function check($token)
+ {
+ return Token::token() === $token;
+ }
+
+}
diff --git a/libraries/Gelato/Valid.php b/libraries/Gelato/Valid.php
index 960f110..307f01c 100644
--- a/libraries/Gelato/Valid.php
+++ b/libraries/Gelato/Valid.php
@@ -197,7 +197,7 @@ class Valid
public static function regexp($regexp)
{
// dummy string
- $dummy = 'Monstra - fast and simple PHP library';
+ $dummy = 'Gelato is a PHP5 library for kickass Web Applications.';
// validate
return (@preg_match((string) $regexp, $dummy) !== false);