diff options
Diffstat (limited to 'system')
-rw-r--r-- | system/helpers/form.php | 19 | ||||
-rw-r--r-- | system/helpers/url.php | 9 | ||||
-rw-r--r-- | system/libraries/Database.php | 9 | ||||
-rw-r--r-- | system/libraries/ORM.php | 4 | ||||
-rw-r--r-- | system/libraries/Session.php | 9 | ||||
-rw-r--r-- | system/libraries/drivers/Database.php | 4 |
6 files changed, 38 insertions, 16 deletions
diff --git a/system/helpers/form.php b/system/helpers/form.php index ce8767c5..815eef84 100644 --- a/system/helpers/form.php +++ b/system/helpers/form.php @@ -283,15 +283,21 @@ class form_Core { // Inner key should always be a string $inner_key = (string) $inner_key; - $sel = in_array($inner_key, $selected) ? ' selected="selected"' : ''; - $input .= '<option value="'.$inner_key.'"'.$sel.'>'.$inner_val.'</option>'."\n"; + $attr = array('value' => $inner_key); + if (in_array($inner_key, $selected)) { + $attr['selected'] = 'selected'; + } + $input .= '<option '.html::attributes($attr).'>'.html::purify($inner_val).'</option>'."\n"; } $input .= '</optgroup>'."\n"; } else { - $sel = in_array($key, $selected) ? ' selected="selected"' : ''; - $input .= '<option value="'.$key.'"'.$sel.'>'.$val.'</option>'."\n"; + $attr = array('value' => $key); + if (in_array($key, $selected)) { + $attr['selected'] = 'selected'; + } + $input .= '<option '.html::attributes($attr).'>'.html::purify($val).'</option>'."\n"; } } $input .= '</select>'; @@ -410,8 +416,9 @@ class form_Core { { $value = arr::remove('value', $data); } + // $value must be ::purify - return '<button'.form::attributes($data, 'button').' '.$extra.'>'.$value.'</button>'; + return '<button'.form::attributes($data, 'button').' '.$extra.'>'.html::purify($value).'</button>'; } /** @@ -455,7 +462,7 @@ class form_Core { $text = ucwords(inflector::humanize($data['for'])); } - return '<label'.form::attributes($data).' '.$extra.'>'.$text.'</label>'; + return '<label'.form::attributes($data).' '.$extra.'>'.html::purify($text).'</label>'; } /** diff --git a/system/helpers/url.php b/system/helpers/url.php index f3d0ec8b..56f6db4b 100644 --- a/system/helpers/url.php +++ b/system/helpers/url.php @@ -2,7 +2,7 @@ /** * URL helper class. * - * $Id: url.php 4029 2009-03-03 12:39:32Z Shadowhand $ + * $Id: url.php 4479 2009-07-23 04:51:22Z ixmatus $ * * @package Core * @author Kohana Team @@ -15,11 +15,14 @@ class url_Core { * Fetches the current URI. * * @param boolean include the query string + * @param boolean include the suffix * @return string */ - public static function current($qs = FALSE) + public static function current($qs = FALSE, $suffix = FALSE) { - return ($qs === TRUE) ? Router::$complete_uri : Router::$current_uri; + $uri = ($qs === TRUE) ? Router::$complete_uri : Router::$current_uri; + + return ($suffix === TRUE) ? $uri.Kohana::config('core.url_suffix') : $uri; } /** diff --git a/system/libraries/Database.php b/system/libraries/Database.php index 6267f63a..2039371c 100644 --- a/system/libraries/Database.php +++ b/system/libraries/Database.php @@ -2,7 +2,7 @@ /** * Provides database access in a platform agnostic way, using simple query building blocks. * - * $Id: Database.php 4342 2009-05-08 16:56:01Z jheathco $ + * $Id: Database.php 4438 2009-07-06 04:11:16Z kiall $ * * @package Core * @author Kohana Team @@ -1144,7 +1144,12 @@ class Database_Core { $query = $this->select('COUNT(*) AS '.$this->escape_column('records_found'))->get()->result(TRUE); - return (int) $query->current()->records_found; + $query = $query->current(); + + if ( ! $query) + return 0; + else + return (int) $query->records_found; } /** diff --git a/system/libraries/ORM.php b/system/libraries/ORM.php index c1048604..5196ba27 100644 --- a/system/libraries/ORM.php +++ b/system/libraries/ORM.php @@ -1295,7 +1295,9 @@ class ORM_Core { $value = (float) $value; break; case 'boolean': - $value = (bool) $value; + if ($value === "t") $value = true; // For PgSQL + else if ($value === "f") $value = false; // For PgSQL + else $value = (bool) $value; break; case 'string': $value = (string) $value; diff --git a/system/libraries/Session.php b/system/libraries/Session.php index 670ee6a6..51acce00 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -2,7 +2,7 @@ /** * Session library. * - * $Id: Session.php 4433 2009-07-01 03:44:20Z kiall $ + * $Id: Session.php 4493 2009-07-27 20:05:41Z ixmatus $ * * @package Core * @author Kohana Team @@ -43,11 +43,16 @@ class Session_Core { return Session::$instance; } + + /** + * Be sure to block the use of __clone. + */ + private function __clone(){} /** * On first session instance creation, sets up the driver and creates session. */ - public function __construct() + protected function __construct() { $this->input = Input::instance(); diff --git a/system/libraries/drivers/Database.php b/system/libraries/drivers/Database.php index 807469f6..27f6ea8e 100644 --- a/system/libraries/drivers/Database.php +++ b/system/libraries/drivers/Database.php @@ -120,7 +120,7 @@ abstract class Database_Driver { $key .= ' ='; } - $value = ($value == TRUE) ? ' 1' : ' 0'; + $value = ($value == TRUE) ? ' TRUE' : ' FALSE'; } else { @@ -310,7 +310,7 @@ abstract class Database_Driver { $value = '\''.$this->escape_str($value).'\''; break; case 'boolean': - $value = (int) $value; + $value = ($value == TRUE) ? 'TRUE' : 'FALSE'; break; case 'double': // Convert to non-locale aware float to prevent possible commas |