summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-09-21 07:36:15 +0200
committeradmin <devnull@localhost>2006-09-21 07:36:15 +0200
commit885b0343036695ad673fc24ba7682fc155c54036 (patch)
tree648e3d80b6082c905cc291e0bb1d033f57bf06ba /system
parentcfc1fb38f0d7cd49c735730a603f7ca5a98a664d (diff)
Diffstat (limited to 'system')
-rw-r--r--system/drivers/DB_active_record.php2
-rw-r--r--system/helpers/cookie_helper.php49
-rw-r--r--system/libraries/Validation.php2
3 files changed, 51 insertions, 2 deletions
diff --git a/system/drivers/DB_active_record.php b/system/drivers/DB_active_record.php
index c7e4f096c..af12d9d27 100644
--- a/system/drivers/DB_active_record.php
+++ b/system/drivers/DB_active_record.php
@@ -390,7 +390,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
if (trim($direction) != '')
{
- $direction = (in_array(strtoupper(trim($direction)), array('ASC', 'DESC'))) ? ' '.$direction : ' ASC';
+ $direction = (in_array(strtoupper(trim($direction)), array('ASC', 'DESC', 'RAND()'))) ? ' '.$direction : ' ASC';
}
$this->ar_orderby[] = $orderby.$direction;
diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php
index 24e243ddd..fc5920f25 100644
--- a/system/helpers/cookie_helper.php
+++ b/system/helpers/cookie_helper.php
@@ -55,6 +55,22 @@ function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path =
}
}
+ // Set the config file options
+ $obj =& get_instance();
+
+ if ($prefix == '' AND $obj->config->item('cookie_prefix') != '')
+ {
+ $obj->config->item('cookie_prefix');
+ }
+ if ($domain == '' AND $obj->config->item('cookie_domain') != '')
+ {
+ $obj->config->item('cookie_domain');
+ }
+ if ($prefix == '/' AND $obj->config->item('cookie_path') != '/')
+ {
+ $obj->config->item('cookie_path');
+ }
+
if ( ! is_numeric($expire))
{
$expire = time() - 86500;
@@ -73,5 +89,38 @@ function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path =
setcookie($prefix.$name, $value, $expire, $path, $domain, 0);
}
+
+// --------------------------------------------------------------------
+
+/**
+ * Fetch an item from the COOKIE array
+ *
+ * @access public
+ * @param string
+ * @param bool
+ * @return mixed
+ */
+function get_cookie($index = '', $xss_clean = FALSE)
+{
+ $obj =& get_instance();
+ return $obj->input->cookie($index, $xss_clean);
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Delete a COOKIE
+ *
+ * @param mixed
+ * @param string the cookie domain. Usually: .yourdomain.com
+ * @param string the cookie path
+ * @param string the cookie prefix
+ * @return void
+ */
+function delete_cookie($name = '', $domain = '', $path = '/', $prefix = '')
+{
+ set_cookie($name, '', '', $domain, $path, $prefix);
+}
+
?> \ No newline at end of file
diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php
index 065e7a2d5..f9b51d778 100644
--- a/system/libraries/Validation.php
+++ b/system/libraries/Validation.php
@@ -524,7 +524,7 @@ class CI_Validation {
*/
function numeric($str)
{
- return ( ! is_numeric($str)) ? FALSE : TRUE;
+ return ( ! ereg("^[0-9]+$", $str)) ? FALSE : TRUE;
}
// --------------------------------------------------------------------