From: <bh...@us...> - 2009-03-30 17:55:06
|
Revision: 20514 http://gallery.svn.sourceforge.net/gallery/?rev=20514&view=rev Author: bharat Date: 2009-03-30 17:55:01 +0000 (Mon, 30 Mar 2009) Log Message: ----------- Updated to r807 Modified Paths: -------------- gallery3/vendor/kohana/modified/kohana/config/user_agents.php gallery3/vendor/kohana/modified/kohana/core/Bootstrap.php gallery3/vendor/kohana/modified/kohana/core/Kohana.php gallery3/vendor/kohana/modified/kohana/helpers/feed.php gallery3/vendor/kohana/modified/kohana/helpers/html.php gallery3/vendor/kohana/modified/kohana/helpers/valid.php gallery3/vendor/kohana/modified/kohana/libraries/Database.php gallery3/vendor/kohana/modified/kohana/libraries/Input.php gallery3/vendor/kohana/modified/kohana/libraries/ORM.php gallery3/vendor/kohana/modified/kohana/libraries/Validation.php gallery3/vendor/kohana/modified/kohana/libraries/drivers/Cache/Memcache.php gallery3/vendor/kohana/modified/kohana/libraries/drivers/Database/Mysqli.php gallery3/vendor/kohana/modified/kohana/libraries/drivers/Database/Pgsql.php Modified: gallery3/vendor/kohana/modified/kohana/config/user_agents.php =================================================================== --- gallery3/vendor/kohana/modified/kohana/config/user_agents.php 2009-03-30 17:53:20 UTC (rev 20513) +++ gallery3/vendor/kohana/modified/kohana/config/user_agents.php 2009-03-30 17:55:01 UTC (rev 20514) @@ -64,6 +64,7 @@ 'Camino' => 'Camino', 'Netscape' => 'Netscape', 'OmniWeb' => 'OmniWeb', + 'Chrome' => 'Chrome', 'Safari' => 'Safari', 'Konqueror' => 'Konqueror', 'Epiphany' => 'Epiphany', @@ -93,6 +94,8 @@ 'ericsson' => 'Ericsson', 'blackBerry' => 'BlackBerry', 'motorola' => 'Motorola', + 'iphone' => 'iPhone', + 'android' => 'Android', ); // There are hundreds of bots but these are the most common. Modified: gallery3/vendor/kohana/modified/kohana/core/Bootstrap.php =================================================================== --- gallery3/vendor/kohana/modified/kohana/core/Bootstrap.php 2009-03-30 17:53:20 UTC (rev 20513) +++ gallery3/vendor/kohana/modified/kohana/core/Bootstrap.php 2009-03-30 17:55:01 UTC (rev 20514) @@ -10,8 +10,8 @@ * @license http://kohanaphp.com/license.html */ -define('KOHANA_VERSION', '2.3.2'); -define('KOHANA_CODENAME', 'accipiter'); +define('KOHANA_VERSION', '2.3.3'); +define('KOHANA_CODENAME', 'aegolius'); // Test of Kohana is running in Windows define('KOHANA_IS_WIN', DIRECTORY_SEPARATOR === '\\'); Modified: gallery3/vendor/kohana/modified/kohana/core/Kohana.php =================================================================== --- gallery3/vendor/kohana/modified/kohana/core/Kohana.php 2009-03-30 17:53:20 UTC (rev 20513) +++ gallery3/vendor/kohana/modified/kohana/core/Kohana.php 2009-03-30 17:55:01 UTC (rev 20514) @@ -53,6 +53,7 @@ // Internal caches and write status private static $internal_cache = array(); private static $write_cache; + private static $internal_cache_path; /** * Sets up the PHP environment. Adds error/exception handling, output @@ -90,6 +91,12 @@ if (self::$cache_lifetime = self::config('core.internal_cache')) { + // Set the directory to be used for the internal cache + if ( ! self::$internal_cache_path = self::config('core.internal_cache_path')) + { + self::$internal_cache_path = APPPATH.'cache/'; + } + // Load cached configuration and language files self::$internal_cache['configuration'] = self::cache('configuration', self::$cache_lifetime); self::$internal_cache['language'] = self::cache('language', self::$cache_lifetime); @@ -570,7 +577,7 @@ { if ($lifetime > 0) { - $path = APPPATH.'cache/kohana_'.$name; + $path = self::$internal_cache_path.'kohana_'.$name; if (is_file($path)) { @@ -606,7 +613,7 @@ if ($lifetime < 1) return FALSE; - $path = APPPATH.'cache/kohana_'.$name; + $path = self::$internal_cache_path.'kohana_'.$name; if ($data === NULL) { @@ -1139,18 +1146,21 @@ { $items = (array) glob($path.'*'); - foreach ($items as $index => $item) + if ( ! empty($items)) { - $files[] = $item = str_replace('\\', '/', $item); - - // Handle recursion - if (is_dir($item) AND $recursive == TRUE) + foreach ($items as $index => $item) { - // Filename should only be the basename - $item = pathinfo($item, PATHINFO_BASENAME); + $files[] = $item = str_replace('\\', '/', $item); - // Append sub-directory search - $files = array_merge($files, self::list_files($directory, TRUE, $path.$item)); + // Handle recursion + if (is_dir($item) AND $recursive == TRUE) + { + // Filename should only be the basename + $item = pathinfo($item, PATHINFO_BASENAME); + + // Append sub-directory search + $files = array_merge($files, self::list_files($directory, TRUE, $path.$item)); + } } } } Modified: gallery3/vendor/kohana/modified/kohana/helpers/feed.php =================================================================== --- gallery3/vendor/kohana/modified/kohana/helpers/feed.php 2009-03-30 17:53:20 UTC (rev 20513) +++ gallery3/vendor/kohana/modified/kohana/helpers/feed.php 2009-03-30 17:55:01 UTC (rev 20514) @@ -20,6 +20,10 @@ */ public static function parse($feed, $limit = 0) { + // Check if SimpleXML is installed + if( ! function_exists('simplexml_load_file')) + throw new Kohana_User_Exception('Feed Error', 'SimpleXML must be installed!'); + // Make limit an integer $limit = (int) $limit; Modified: gallery3/vendor/kohana/modified/kohana/helpers/html.php =================================================================== --- gallery3/vendor/kohana/modified/kohana/helpers/html.php 2009-03-30 17:53:20 UTC (rev 20513) +++ gallery3/vendor/kohana/modified/kohana/helpers/html.php 2009-03-30 17:55:01 UTC (rev 20514) @@ -50,6 +50,18 @@ } /** + * Perform a html::specialchars() with additional URL specific encoding. + * + * @param string string to convert + * @param boolean encode existing entities + * @return string + */ + public static function specialurlencode($str, $double_encode = TRUE) + { + return str_replace(' ', '%20', html::specialchars($str, $double_encode)); + } + + /** * Create HTML link anchors. * * @param string URL or URI string @@ -80,7 +92,7 @@ return // Parsed URL - '<a href="'.html::specialchars($site_url, FALSE).'"' + '<a href="'.html::specialurlencode($site_url, FALSE).'"' // Attributes empty? Use an empty string .(is_array($attributes) ? html::attributes($attributes) : '').'>' // Title empty? Use the parsed URL @@ -100,7 +112,7 @@ { return // Base URL + URI = full URL - '<a href="'.html::specialchars(url::base(FALSE, $protocol).$file, FALSE).'"' + '<a href="'.html::specialurlencode(url::base(FALSE, $protocol).$file, FALSE).'"' // Attributes empty? Use an empty string .(is_array($attributes) ? html::attributes($attributes) : '').'>' // Title empty? Use the filename part of the URI Modified: gallery3/vendor/kohana/modified/kohana/helpers/valid.php =================================================================== --- gallery3/vendor/kohana/modified/kohana/helpers/valid.php 2009-03-30 17:53:20 UTC (rev 20513) +++ gallery3/vendor/kohana/modified/kohana/helpers/valid.php 2009-03-30 17:55:01 UTC (rev 20514) @@ -277,7 +277,7 @@ { // Use localeconv to set the decimal_point value: Usually a comma or period. $locale = localeconv(); - return (preg_match('/^[-0-9'.$locale['decimal_point'].']++$/D', (string) $str)); + return (preg_match('/^-?[0-9'.$locale['decimal_point'].']++$/D', (string) $str)); } /** Modified: gallery3/vendor/kohana/modified/kohana/libraries/Database.php =================================================================== --- gallery3/vendor/kohana/modified/kohana/libraries/Database.php 2009-03-30 17:53:20 UTC (rev 20513) +++ gallery3/vendor/kohana/modified/kohana/libraries/Database.php 2009-03-30 17:55:01 UTC (rev 20514) @@ -462,7 +462,18 @@ public function where($key, $value = NULL, $quote = TRUE) { $quote = (func_num_args() < 2 AND ! is_array($key)) ? -1 : $quote; - $keys = is_array($key) ? $key : array($key => $value); + if (is_object($key)) + { + $keys = array((string) $key => ''); + } + elseif ( ! is_array($key)) + { + $keys = array($key => $value); + } + else + { + $keys = $key; + } foreach ($keys as $key => $value) { @@ -484,7 +495,18 @@ public function orwhere($key, $value = NULL, $quote = TRUE) { $quote = (func_num_args() < 2 AND ! is_array($key)) ? -1 : $quote; - $keys = is_array($key) ? $key : array($key => $value); + if (is_object($key)) + { + $keys = array((string) $key => ''); + } + elseif ( ! is_array($key)) + { + $keys = array($key => $value); + } + else + { + $keys = $key; + } foreach ($keys as $key => $value) { @@ -1172,11 +1194,15 @@ * See if a table exists in the database. * * @param string table name + * @param boolean True to attach table prefix * @return boolean */ - public function table_exists($table_name) + public function table_exists($table_name, $prefix = TRUE) { - return in_array($this->config['table_prefix'].$table_name, $this->list_tables()); + if ($prefix) + return in_array($this->config['table_prefix'].$table_name, $this->list_tables()); + else + return in_array($table_name, $this->list_tables()); } /** @@ -1313,17 +1339,6 @@ } /** - * Create a prepared statement (experimental). - * - * @param string SQL query - * @return object - */ - public function stmt_prepare($sql) - { - return $this->driver->stmt_prepare($sql, $this->config); - } - - /** * Pushes existing query space onto the query stack. Use push * and pop to prevent queries from clashing before they are * executed @@ -1381,7 +1396,41 @@ return $this; } + /** + * Count the number of records in the last query, without LIMIT or OFFSET applied. + * + * @return integer + */ + public function count_last_query() + { + if ($sql = $this->last_query()) + { + if (stripos($sql, 'LIMIT') !== FALSE) + { + // Remove LIMIT from the SQL + $sql = preg_replace('/\sLIMIT\s+[^a-z]+/i', ' ', $sql); + } + if (stripos($sql, 'OFFSET') !== FALSE) + { + // Remove OFFSET from the SQL + $sql = preg_replace('/\sOFFSET\s+\d+/i', '', $sql); + } + + // Get the total rows from the last query executed + $result = $this->query + ( + 'SELECT COUNT(*) AS '.$this->escape_column('total_rows').' '. + 'FROM ('.trim($sql).') AS '.$this->escape_table('counted_results') + ); + + // Return the total number of rows from the query + return (int) $result->current()->total_rows; + } + + return FALSE; + } + } // End Database Class Modified: gallery3/vendor/kohana/modified/kohana/libraries/Input.php =================================================================== --- gallery3/vendor/kohana/modified/kohana/libraries/Input.php 2009-03-30 17:53:20 UTC (rev 20513) +++ gallery3/vendor/kohana/modified/kohana/libraries/Input.php 2009-03-30 17:55:01 UTC (rev 20514) @@ -237,18 +237,19 @@ if ($this->ip_address !== NULL) return $this->ip_address; - if ($ip = $this->server('HTTP_CLIENT_IP')) + // Server keys that could contain the client IP address + $keys = array('HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'REMOTE_ADDR'); + + foreach ($keys as $key) { - $this->ip_address = $ip; + if ($ip = $this->server($key)) + { + $this->ip_address = $ip; + + // An IP address has been found + break; + } } - elseif ($ip = $this->server('REMOTE_ADDR')) - { - $this->ip_address = $ip; - } - elseif ($ip = $this->server('HTTP_X_FORWARDED_FOR')) - { - $this->ip_address = $ip; - } if ($comma = strrpos($this->ip_address, ',') !== FALSE) { Modified: gallery3/vendor/kohana/modified/kohana/libraries/ORM.php =================================================================== --- gallery3/vendor/kohana/modified/kohana/libraries/ORM.php 2009-03-30 17:53:20 UTC (rev 20513) +++ gallery3/vendor/kohana/modified/kohana/libraries/ORM.php 2009-03-30 17:55:01 UTC (rev 20514) @@ -220,8 +220,16 @@ switch ($num_args) { case 0: - // Support for things like reset_select, reset_write, list_tables - return $this->db->$method(); + if (in_array($method, array('open_paren', 'close_paren', 'enable_cache', 'disable_cache'))) + { + // Should return ORM, not Database + $this->db->$method(); + } + else + { + // Support for things like reset_select, reset_write, list_tables + return $this->db->$method(); + } break; case 1: $this->db->$method($args[0]); @@ -1011,41 +1019,6 @@ } /** - * Count the number of records in the last query, without LIMIT or OFFSET applied. - * - * @return integer - */ - public function count_last_query() - { - if ($sql = $this->db->last_query()) - { - if (stripos($sql, 'LIMIT') !== FALSE) - { - // Remove LIMIT from the SQL - $sql = preg_replace('/\sLIMIT\s+[^a-z]+/i', ' ', $sql); - } - - if (stripos($sql, 'OFFSET') !== FALSE) - { - // Remove OFFSET from the SQL - $sql = preg_replace('/\sOFFSET\s+\d+/i', '', $sql); - } - - // Get the total rows from the last query executed - $result = $this->db->query - ( - 'SELECT COUNT(*) AS '.$this->db->escape_column('total_rows').' '. - 'FROM ('.trim($sql).') AS '.$this->db->escape_table('counted_results') - ); - - // Return the total number of rows from the query - return (int) $result->current()->total_rows; - } - - return FALSE; - } - - /** * Proxy method to Database list_fields. * * @param string table name @@ -1070,17 +1043,6 @@ } /** - * Proxy method to Database last_query. - * - * @return string - */ - public function last_query() - { - // Proxy to database - return $this->db->last_query(); - } - - /** * Proxy method to Database field_data. * * @chainable Modified: gallery3/vendor/kohana/modified/kohana/libraries/Validation.php =================================================================== --- gallery3/vendor/kohana/modified/kohana/libraries/Validation.php 2009-03-30 17:53:20 UTC (rev 20513) +++ gallery3/vendor/kohana/modified/kohana/libraries/Validation.php 2009-03-30 17:55:01 UTC (rev 20514) @@ -108,12 +108,12 @@ public function field_names() { // All the fields that are being validated - $fields = array_unique(array_merge + $fields = array_keys(array_merge ( - array_keys($this->pre_filters), - array_keys($this->rules), - array_keys($this->callbacks), - array_keys($this->post_filters) + $this->pre_filters, + $this->rules, + $this->callbacks, + $this->post_filters )); // Remove wildcard fields Modified: gallery3/vendor/kohana/modified/kohana/libraries/drivers/Cache/Memcache.php =================================================================== --- gallery3/vendor/kohana/modified/kohana/libraries/drivers/Cache/Memcache.php 2009-03-30 17:53:20 UTC (rev 20513) +++ gallery3/vendor/kohana/modified/kohana/libraries/drivers/Cache/Memcache.php 2009-03-30 17:55:01 UTC (rev 20514) @@ -17,14 +17,11 @@ protected $backend; protected $flags; - // The persistent lifetime value for expirations of 0 - protected $persistent_lifetime; - // Tags array - protected $tags; + protected static $tags; // Have the tags been changed? - protected $tags_changed = FALSE; + protected static $tags_changed = FALSE; public function __construct() { @@ -46,34 +43,34 @@ or Kohana::log('error', 'Cache: Connection failed: '.$server['host']); } - // Set "persistent lifetime" value to one year - $this->persistent_lifetime = strtotime('now +1 year'); - // Load tags - $this->tags = $this->backend->get(self::TAGS_KEY); + self::$tags = $this->backend->get(self::TAGS_KEY); - if ( ! is_array($this->tags)) + if ( ! is_array(self::$tags)) { // Create a new tags array - $this->tags = array(); + self::$tags = array(); // Tags have been created - $this->tags_changed = TRUE; + self::$tags_changed = TRUE; } } public function __destruct() { - if ($this->tags_changed === TRUE) + if (self::$tags_changed === TRUE) { // Save the tags - $this->backend->set(self::TAGS_KEY, $this->tags, $this->flags, $this->persistent_lifetime); + $this->backend->set(self::TAGS_KEY, self::$tags, $this->flags, 0); + + // Tags are now unchanged + self::$tags_changed = FALSE; } } public function find($tag) { - if (isset($this->tags[$tag]) AND $results = $this->backend->get($this->tags[$tag])) + if (isset(self::$tags[$tag]) AND $results = $this->backend->get(self::$tags[$tag])) { // Return all the found caches return $results; @@ -95,23 +92,17 @@ if ( ! empty($tags)) { // Tags will be changed - $this->tags_changed = TRUE; + self::$tags_changed = TRUE; foreach ($tags as $tag) { // Add the id to each tag - $this->tags[$tag][$id] = $id; + self::$tags[$tag][$id] = $id; } } - if ($lifetime === 0) + if ($lifetime !== 0) { - // Using an expiration of zero is unreliable, as memcache may delete - // it without warning. @see http://php.net/memcache_set - $lifetime = $this->persistent_lifetime; - } - else - { // Memcache driver expects unix timestamp $lifetime += time(); } @@ -123,14 +114,14 @@ public function delete($id, $tag = FALSE) { // Tags will be changed - $this->tags_changed = TRUE; + self::$tags_changed = TRUE; if ($id === TRUE) { if ($status = $this->backend->flush()) { // Remove all tags, all items have been deleted - $this->tags = array(); + self::$tags = array(); // We must sleep after flushing, or overwriting will not work! // @see http://php.net/manual/en/function.memcache-flush.php#81420 @@ -141,28 +132,28 @@ } elseif ($tag === TRUE) { - if (isset($this->tags[$id])) + if (isset(self::$tags[$id])) { - foreach ($this->tags[$id] as $_id) + foreach (self::$tags[$id] as $_id) { // Delete each id in the tag $this->backend->delete($_id); } // Delete the tag - unset($this->tags[$id]); + unset(self::$tags[$id]); } return TRUE; } else { - foreach ($this->tags as $tag => $_ids) + foreach (self::$tags as $tag => $_ids) { - if (isset($this->tags[$tag][$id])) + if (isset(self::$tags[$tag][$id])) { // Remove the id from the tags - unset($this->tags[$tag][$id]); + unset(self::$tags[$tag][$id]); } } @@ -173,23 +164,23 @@ public function delete_expired() { // Tags will be changed - $this->tags_changed = TRUE; + self::$tags_changed = TRUE; - foreach ($this->tags as $tag => $_ids) + foreach (self::$tags as $tag => $_ids) { foreach ($_ids as $id) { if ( ! $this->backend->get($id)) { // This id has disappeared, delete it from the tags - unset($this->tags[$tag][$id]); + unset(self::$tags[$tag][$id]); } } - if (empty($this->tags[$tag])) + if (empty(self::$tags[$tag])) { // The tag no longer has any valid ids - unset($this->tags[$tag]); + unset(self::$tags[$tag]); } } Modified: gallery3/vendor/kohana/modified/kohana/libraries/drivers/Database/Mysqli.php =================================================================== --- gallery3/vendor/kohana/modified/kohana/libraries/drivers/Database/Mysqli.php 2009-03-30 17:53:20 UTC (rev 20513) +++ gallery3/vendor/kohana/modified/kohana/libraries/drivers/Database/Mysqli.php 2009-03-30 17:55:01 UTC (rev 20514) @@ -96,12 +96,6 @@ throw new Kohana_Database_Exception('database.error', $this->show_error()); } - public function stmt_prepare($sql = '') - { - is_object($this->link) or $this->connect(); - return new Kohana_Mysqli_Statement($sql, $this->link); - } - public function escape_str($str) { if (!$this->db_config['escape']) Modified: gallery3/vendor/kohana/modified/kohana/libraries/drivers/Database/Pgsql.php =================================================================== --- gallery3/vendor/kohana/modified/kohana/libraries/drivers/Database/Pgsql.php 2009-03-30 17:53:20 UTC (rev 20513) +++ gallery3/vendor/kohana/modified/kohana/libraries/drivers/Database/Pgsql.php 2009-03-30 17:55:01 UTC (rev 20514) @@ -82,7 +82,8 @@ return self::$query_cache[$hash]; } - return new Pgsql_Result(pg_query($this->link, $sql), $this->link, $this->db_config['object'], $sql); + // Suppress warning triggered when a database error occurs (e.g., a constraint violation) + return new Pgsql_Result(@pg_query($this->link, $sql), $this->link, $this->db_config['object'], $sql); } public function set_charset($charset) @@ -161,12 +162,6 @@ return 'LIMIT '.$limit.' OFFSET '.$offset; } - public function stmt_prepare($sql = '') - { - is_object($this->link) or $this->connect(); - return new Kohana_Mysqli_Statement($sql, $this->link); - } - public function compile_select($database) { $sql = ($database['distinct'] == TRUE) ? 'SELECT DISTINCT ' : 'SELECT '; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |