Permalink
Browse files

Merge remote-tracking branch 'codeigniter/develop' into develop

  • Loading branch information...
2 parents 33e956e + 6858c07 commit d5bdd62e1649ae2285257964007d95f5b8c04c48 @appleboy committed Oct 8, 2011
@@ -66,7 +66,7 @@
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
- 'wav' => 'audio/x-wav',
+ 'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
'bmp' => array('image/bmp', 'image/x-windows-bmp'),
'gif' => 'image/gif',
'jpeg' => array('image/jpeg', 'image/pjpeg'),
@@ -137,4 +137,4 @@
/* End of file mimes.php */
-/* Location: ./application/config/mimes.php */
+/* Location: ./application/config/mimes.php */
@@ -49,15 +49,15 @@ class CI_DB_pdo_driver extends CI_DB {
function __construct($params)
{
- parent::CI_DB($params);
+ parent::__construct($params);
// clause and character used for LIKE escape sequences
- if(strpos($this->hostname, 'mysql') !== FALSE)
+ if (strpos($this->hostname, 'mysql') !== FALSE)
{
$this->_like_escape_str = '';
$this->_like_escape_chr = '';
}
- else if(strpos($this->hostname, 'odbc') !== FALSE)
+ else if (strpos($this->hostname, 'odbc') !== FALSE)
{
$this->_like_escape_str = " {escape '%s'} ";
$this->_like_escape_chr = '!';
@@ -180,7 +180,14 @@ function _execute($sql)
$sql = $this->_prep_query($sql);
$result_id = $this->conn_id->query($sql);
- $this->affect_rows = $result_id->rowCount();
+ if (is_object($result_id))
+ {
+ $this->affect_rows = $result_id->rowCount();
+ }
+ else
+ {
+ $this->affect_rows = 0;
+ }
return $result_id;
}
@@ -301,10 +308,16 @@ function escape_str($str, $like = FALSE)
return $str;
}
-
- // PDO doesn't require escaping
- $str = remove_invisible_characters($str);
-
+
+ //Escape the string
+ $str = $this->conn_id->quote($str);
+
+ //If there are duplicated quotes, trim them away
+ if (strpos($str, "'") === 0)
+ {
+ $str = substr($str, 1, -1);
+ }
+
// escape LIKE condition wildcards
if ($like === TRUE)
{
@@ -339,7 +352,25 @@ function affected_rows()
*/
function insert_id($name=NULL)
{
- return $this->conn_id->lastInsertId($name);
+ //Convenience method for postgres insertid
+ if (strpos($this->hostname, 'pgsql') !== FALSE)
+ {
+ $v = $this->_version();
+
+ $table = func_num_args() > 0 ? func_get_arg(0) : NULL;
+
+ if ($table == NULL && $v >= '8.1')
+ {
+ $sql='SELECT LASTVAL() as ins_id';
+ }
+ $query = $this->query($sql);
+ $row = $query->row();
+ return $row->ins_id;
+ }
+ else
+ {
+ return $this->conn_id->lastInsertId($name);
+ }
}
// --------------------------------------------------------------------
@@ -538,6 +569,24 @@ function _insert($table, $keys, $values)
{
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
}
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Insert_batch statement
+ *
+ * Generates a platform-specific insert string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the insert keys
+ * @param array the insert values
+ * @return string
+ */
+ function _insert_batch($table, $keys, $values)
+ {
+ return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values);
+ }
// --------------------------------------------------------------------
@@ -573,6 +622,58 @@ function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
return $sql;
}
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Update_Batch statement
+ *
+ * Generates a platform-specific batch update string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the update data
+ * @param array the where clause
+ * @return string
+ */
+ function _update_batch($table, $values, $index, $where = NULL)
+ {
+ $ids = array();
+ $where = ($where != '' AND count($where) >=1) ? implode(" ", $where).' AND ' : '';
+
+ foreach ($values as $key => $val)
+ {
+ $ids[] = $val[$index];
+
+ foreach (array_keys($val) as $field)
+ {
+ if ($field != $index)
+ {
+ $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
+ }
+ }
+ }
+
+ $sql = "UPDATE ".$table." SET ";
+ $cases = '';
+
+ foreach ($final as $k => $v)
+ {
+ $cases .= $k.' = CASE '."\n";
+ foreach ($v as $row)
+ {
+ $cases .= $row."\n";
+ }
+
+ $cases .= 'ELSE '.$k.' END, ';
+ }
+
+ $sql .= substr($cases, 0, -2);
+
+ $sql .= ' WHERE '.$where.$index.' IN ('.implode(',', $ids).')';
+
+ return $sql;
+ }
// --------------------------------------------------------------------
@@ -642,7 +743,7 @@ function _delete($table, $where = array(), $like = array(), $limit = FALSE)
*/
function _limit($sql, $limit, $offset)
{
- if(strpos($this->hostname, 'cubrid') !== FALSE || strpos($this->hostname, 'sqlite') !== FALSE)
+ if (strpos($this->hostname, 'cubrid') !== FALSE || strpos($this->hostname, 'sqlite') !== FALSE)
{
if ($offset == 0)
{
@@ -125,7 +125,7 @@
{%- block footer %}
<div id="footer">
<p class="top"><a href="#header" title="Return to top">Return to top</a></p>
- <p><a href="{{ project_url }}">{{ project }}</a> &ndash; Copyright &copy; {{ copyright }}</a></p>
+ <p><a href="{{ project_url }}">{{ project }}</a> &ndash; Copyright &copy; {{ copyright }}</a> &ndash; Last updated: {{ last_updated }}</p>
</div><!-- /#footer -->
{%- endblock %}
@@ -107,6 +107,7 @@ Bug fixes for 2.1.0
- Fixed a bug (#467) - Suppress warnings generated from get_magic_quotes_gpc() (deprecated in PHP 5.4)
- Fixed a bug (#484) - First time _csrf_set_hash() is called, hash is never set to the cookie (in Security.php).
- Fixed a bug (#60) - Added _file_mime_type() method to the `File Uploading Library <libraries/file_uploading>` in order to fix a possible MIME-type injection.
+- Fixed a bug (#537) - Support for all wav type in browser.
Version 2.0.3
=============
@@ -125,7 +125,7 @@
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
+html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
@@ -10,8 +10,8 @@ HTTP requests should be handled.
What is a Controller?
=====================
-A Controller is simply a class file that is named in a way that can be
-associated with a URI.
+**A Controller is simply a class file that is named in a way that can be
+associated with a URI.**
Consider this URI::
@@ -136,7 +136,7 @@ Defining a Default Controller
CodeIgniter can be told to load a default controller when a URI is not
present, as will be the case when only your site root URL is requested.
-To specify a default controller, open your application/config/routes.php
+To specify a default controller, open your **application/config/routes.php**
file and set this variable::
$route['default_controller'] = 'Blog';
@@ -199,8 +199,7 @@ Processing Output
CodeIgniter has an output class that takes care of sending your final
rendered data to the web browser automatically. More information on this
-can be found in the :doc::doc:`Views <views>` and `Output
-class <../libraries/output>` pages. In some cases, however, you
+can be found in the :doc:`Views <views>` and :doc:`Output class <../libraries/output>` pages. In some cases, however, you
might want to post-process the finalized data in some way and send it to
the browser yourself. CodeIgniter permits you to add a function named
_output() to your controller that will receive the finalized output
@@ -3,10 +3,10 @@ Helper Functions
################
Helpers, as the name suggests, help you with tasks. Each helper file is
-simply a collection of functions in a particular category. There are URL
-Helpers, that assist in creating links, there are Form Helpers that help
-you create form elements, Text Helpers perform various text formatting
-routines, Cookie Helpers set and read cookies, File Helpers help you
+simply a collection of functions in a particular category. There are **URL
+Helpers**, that assist in creating links, there are Form Helpers that help
+you create form elements, **Text Helpers** perform various text formatting
+routines, **Cookie Helpers** set and read cookies, File Helpers help you
deal with files, etc.
Unlike most other systems in CodeIgniter, Helpers are not written in an
@@ -19,9 +19,9 @@ using a Helper is to load it. Once loaded, it becomes globally available
in your :doc:`controller <../general/controllers>` and
:doc:`views <../general/views>`.
-Helpers are typically stored in your system/helpers, or
-application/helpers directory. CodeIgniter will look first in your
-application/helpers directory. If the directory does not exist or the
+Helpers are typically stored in your **system/helpers**, or
+**application/helpers directory**. CodeIgniter will look first in your
+**application/helpers directory**. If the directory does not exist or the
specified helper is not located there CI will instead look in your
global system/helpers folder.
@@ -32,11 +32,11 @@ Loading a helper file is quite simple using the following function::
$this->load->helper('name');
-Where name is the file name of the helper, without the .php file
+Where **name** is the file name of the helper, without the .php file
extension or the "helper" part.
-For example, to load the URL Helper file, which is named
-url_helper.php, you would do this::
+For example, to load the **URL Helper** file, which is named
+**url_helper.php**, you would do this::
$this->load->helper('url');
@@ -63,9 +63,8 @@ Auto-loading Helpers
If you find that you need a particular helper globally throughout your
application, you can tell CodeIgniter to auto-load it during system
-initialization. This is done by opening the
-application/config/autoload.php file and adding the helper to the
-autoload array.
+initialization. This is done by opening the **application/config/autoload.php**
+file and adding the helper to the autoload array.
Using a Helper
==============
@@ -84,8 +83,8 @@ URI to the controller/function you wish to link to.
"Extending" Helpers
===================
-To "extend" Helpers, create a file in your application/helpers/ folder
-with an identical name to the existing Helper, but prefixed with MY\_
+To "extend" Helpers, create a file in your **application/helpers/** folder
+with an identical name to the existing Helper, but prefixed with **MY\_**
(this item is configurable. See below.).
If all you need to do is add some functionality to an existing helper -
@@ -98,8 +97,8 @@ sense. Under the hood, this gives you the ability to add to the
functions a Helper provides, or to modify how the native Helper
functions operate.
-For example, to extend the native Array Helper you'll create a file
-named application/helpers/MY_array_helper.php, and add or override
+For example, to extend the native **Array Helper** you'll create a file
+named **application/helpers/MY_array_helper.php**, and add or override
functions::
// any_in_array() is not in the Array Helper, so it defines a new function
@@ -130,11 +129,11 @@ Setting Your Own Prefix
The filename prefix for "extending" Helpers is the same used to extend
libraries and Core classes. To set your own prefix, open your
-application/config/config.php file and look for this item::
+**application/config/config.php** file and look for this item::
$config['subclass_prefix'] = 'MY_';
-Please note that all native CodeIgniter libraries are prefixed with CI\_
+Please note that all native CodeIgniter libraries are prefixed with **CI\_**
so DO NOT use that as your prefix.
Now What?
@@ -1,6 +1,39 @@
+##################
+General
+##################
+
+
+- :doc:`CodeIgniter URLs <urls>`
+- :doc:`Controllers <controllers>`
+- :doc:`Reserved Names <reserved_names>`
+- :doc:`Views <views>`
+- :doc:`Models <models>`
+- :doc:`Helpers <helpers>`
+- :doc:`Using CodeIgniter Libraries <libraries>`
+- :doc:`Creating Your Own Libraries <creating_libraries>`
+- :doc:`Using CodeIgniter Drivers <drivers>`
+- :doc:`Creating Your Own Drivers <creating_drivers>`
+- :doc:`Creating Core Classes <core_classes>`
+- :doc:`Creating Ancillary Classes <ancillary_classes>`
+- :doc:`Hooks - Extending the Core <hooks>`
+- :doc:`Auto-loading Resources <autoloader>`
+- :doc:`Common Function <common_functions>`
+- :doc:`URI Routing <routing>`
+- :doc:`Error Handling <errors>`
+- :doc:`Caching <caching>`
+- :doc:`Profiling Your Application <profiling>`
+- :doc:`Running via the CLI <cli>`
+- :doc:`Managing Applications <managing_apps>`
+- :doc:`Handling Multiple Environments <environments>`
+- :doc:`Alternative PHP Syntax <alternative_php>`
+- :doc:`Security <security>`
+- :doc:`PHP Style Guide <styleguide>`
+- :doc:`Server Requirements <requirements>`
+- :doc:`Credits <credits>`
+
.. toctree::
:glob:
- :hidden:
:titlesonly:
+ :hidden:
*
Oops, something went wrong.

0 comments on commit d5bdd62

Please sign in to comment.