Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kenjis/1267218 to your computer and use it in GitHub Desktop.
Save kenjis/1267218 to your computer and use it in GitHub Desktop.
CodeIgniter User Guide の差分
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 3b4c72b..5bb7f60 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -79,18 +79,21 @@ Change Log
<li>Helpers
<ul>
<li>Added <samp>increment_string()</samp> to <a href="helpers/string_helper.html">String Helper</a> to turn "foo" into "foo-1" or "foo-1" into "foo-2".</li>
- <li>Altered form helper - made action on form_open_multipart helper function call optional. Fixes (#65)</li>
+ <li>Altered form helper - made action on form_open_multipart helper function call optional. Fixes (#65)</li>
<li><samp>url_title()</samp> will now trim extra dashes from beginning and end.</li>
<li>Improved speed of <a href="helpers/string_helper.html">String Helper</a>'s <b>random_string()</b> method</li>
+ <li>Added XHTML Basic 1.1 doctype to <a href="helpers/html_helper.html">HTML Helper</a>.</li>
</ul>
</li>
<li>Database
<ul>
<li>Added a <a href="http://www.cubrid.org/" target="_blank">CUBRID</a> driver to the <a href="database/index.html">Database Driver</a>. Thanks to the CUBRID team for supplying this patch.</li>
+ <li>Added a PDO driver to the <a href="database/index.html">Database Driver</a>.</li>
<li>Typecast limit and offset in the <a href="database/queries.html">Database Driver</a> to integers to avoid possible injection.</li>
<li>
Added additional option 'none' for the optional third argument for <kbd>$this->db->like()</kbd> in the <a href="database/active_record.html">Database Driver</a>.
</li>
+ <li>Added <kbd>$this->db->insert_batch()</kbd> support to the OCI8 (Oracle) driver.</li>
</ul>
</li>
<li>Libraries
@@ -102,30 +105,42 @@ Change Log
<li>Added max_filename_increment config setting for Upload library.</li>
<li><samp>CI_Loader::_ci_autoloader()</samp> is now a protected method.</li>
<li>Added <kbd>is_unique</kbd> to the <a href="libraries/form_validation.html">Form Validation library</a>.</li>
+ <li>Modified valid_ip() to use PHP's filter_var() when possible (>= PHP 5.2) in the <a href="libraries/form_validation.html">Form Validation</a> library.</li>
+ <li>Added <kbd>$config['use_page_numbers']</kbd> to the <a href="libraries/pagination.html">Pagination library</a>, which enables real page numbers in the URI.</li>
+ <li>Added TLS and SSL Encryption for SMTP.</li>
</ul>
</li>
<li>Core
<ul>
<li>Changed private functions in CI_URI to protected so MY_URI can override them.</li>
+ <li>Removed CI_CORE boolean constant from CodeIgniter.php (no longer Reactor and Core versions).</li>
</ul>
</li>
</ul>
<h3>Bug fixes for 2.1.0</h3>
<ul>
+ <li class="reactor">Unlink raised an error if cache file did not exist when you try to delete it.</li>
<li class="reactor">Fixed #378 Robots identified as regular browsers by the User Agent class.</li>
<li class="reactor">If a config class was loaded first then a library with the same name is loaded, the config would be ignored.</li>
<li class="reactor">Fixed a bug (Reactor #19) where 1) the 404_override route was being ignored in some cases, and 2) auto-loaded libraries were not available to the 404_override controller when a controller existed but the requested method did not.</li>
<li class="rector">Fixed a bug (Reactor #89) where MySQL export would fail if the table had hyphens or other non alphanumeric/underscore characters.</li>
- <li class="reactor">Fixed a bug (#200) where MySQL queries would be malformed after calling <samp>count_all()</samp> then <samp>db->get()</samp></li>
- <li class="reactor">Fixed bug #105 that stopped query errors from being logged unless database debugging was enabled</li>
- <li>Fixed a bug (#181) where a mis-spelling was in the form validation language file.</li>
+ <li class="reactor">Fixed a bug (#200) where MySQL queries would be malformed after calling <samp>count_all()</samp> then <samp>db->get()</samp></li>
+ <li class="reactor">Fixed bug #105 that stopped query errors from being logged unless database debugging was enabled</li>
+ <li>Fixed a bug (#181) where a mis-spelling was in the form validation language file.</li>
<li>Fixed a bug (#160) - Removed unneeded array copy in the file cache driver.</li>
<li>Fixed a bug (#150) - <samp>field_data()</samp> now correctly returns column length.</li>
<li>Fixed a bug (#8) - <samp>load_class()</samp> now looks for core classes in <samp>APPPATH</samp> first, allowing them to be replaced.</li>
<li>Fixed a bug (#24) - ODBC database driver called incorrect parent in __construct().</li>
<li>Fixed a bug (#85) - OCI8 (Oracle) database escape_str() function did not escape correct.</li>
<li>Fixed a bug (#344) - Using schema found in <a href="libraries/sessions.html">Saving Session Data to a Database</a>, system would throw error "user_data does not have a default value" when deleting then creating a session.</li>
+ <li>Fixed a bug (#112) - OCI8 (Oracle) driver didn't pass the configured database character set when connecting.</li>
+ <li>Fixed a bug (#182) - OCI8 (Oracle) driver used to re-execute the statement whenever num_rows() is called.</li>
+ <li>Fixed a bug (#82) - WHERE clause field names in the DB <samp>update_string()</samp> method were not escaped, resulting in failed queries in some cases.</li>
+ <li>Fixed a bug (#89) - Fix a variable type mismatch in DB <samp>display_error()</samp> where an array is expected, but a string could be set instead.</li>
+ <li>Fixed a bug (#467) - Suppress warnings generated from get_magic_quotes_gpc() (deprecated in PHP 5.4)</li>
+ <li>Fixed a bug (#484) - First time _csrf_set_hash() is called, hash is never set to the cookie (in Security.php).</li>
+ <li>Fixed a bug (#60) - Added _file_mime_type() method to the <a href="libraries/file_uploading.html">File Uploading Library</a> in order to fix a possible MIME-type injection (also fixes bug #394).</li>
</ul>
<h2>Version 2.0.3</h2>
diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html
index 10259a4..70aecbd 100644
--- a/user_guide/database/active_record.html
+++ b/user_guide/database/active_record.html
@@ -543,7 +543,7 @@ $data = array(<br />
&nbsp;&nbsp;&nbsp;)<br />
);<br />
<br />
-$this->db->update_batch('mytable', $data);
+$this->db->insert_batch('mytable', $data);
<br /><br />
// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'), ('Another title', 'Another name', 'Another date')</code>
@@ -666,6 +666,41 @@ You can optionally pass this information directly into the update function as a
<p>You may also use the <dfn>$this->db->set()</dfn> function described above when performing updates.</p>
+<h2>$this->db->update_batch();</h2>
+<p>Generates an update string based on the data you supply, and runs the query. You can either pass an
+<strong>array</strong> or an <strong>object</strong> to the function. Here is an example using an array:</p>
+
+<code>
+$data = array(<br/>
+&nbsp;&nbsp;&nbsp;array(<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'title' => 'My title' ,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'name' => 'My Name 2' ,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'date' => 'My date 2'<br />
+&nbsp;&nbsp;&nbsp;),<br />
+&nbsp;&nbsp;&nbsp;array(<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'title' => 'Another title' ,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'name' => 'Another Name 2' ,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'date' => 'Another date 2'<br />
+&nbsp;&nbsp;&nbsp;)<br/>
+);<br />
+<br />
+$this->db->update_batch('mytable', $data, 'title');
+<br /><br />
+// Produces: <br />
+// UPDATE `mytable` SET `name` = CASE<br />
+// WHEN `title` = 'My title' THEN 'My Name 2'<br />
+// WHEN `title` = 'Another title' THEN 'Another Name 2'<br />
+// ELSE `name` END,<br />
+// `date` = CASE <br />
+// WHEN `title` = 'My title' THEN 'My date 2'<br />
+// WHEN `title` = 'Another title' THEN 'Another date 2'<br />
+// ELSE `date` END<br />
+// WHERE `title` IN ('My title','Another title')</code>
+
+<p>The first parameter will contain the table name, the second is an associative array of values, the third parameter is the where key.</p>
+
+<p class="important"><strong>Note:</strong> All values are escaped automatically producing safer queries.</p>
+
<a name="delete">&nbsp;</a>
<h1>Deleting Data</h1>
diff --git a/user_guide/database/connecting.html b/user_guide/database/connecting.html
index 309f2bc..b180881 100644
--- a/user_guide/database/connecting.html
+++ b/user_guide/database/connecting.html
@@ -121,6 +121,8 @@ $this->load->database(<samp>$config</samp>);</code>
<p>For information on each of these values please see the <a href="configuration.html">configuration page</a>.</p>
+<p class="important"><strong>Note:</strong> For the PDO driver, $config['hostname'] should look like this: 'mysql:host=localhost'</p>
+
<p>Or you can submit your database values as a Data Source Name. DSNs must have this prototype:</p>
<code>$dsn = 'dbdriver://username:password@hostname/database';<br />
diff --git a/user_guide/database/forge.html b/user_guide/database/forge.html
index 6b87098..528d1a2 100644
--- a/user_guide/database/forge.html
+++ b/user_guide/database/forge.html
@@ -201,6 +201,10 @@ already be running, since the forge class relies on it.</p>
$this-&gt;dbforge-&gt;add_column('table_name', $fields);<br />
<br />
// gives ALTER TABLE table_name ADD preferences TEXT</code></p>
+<p>An optional third parameter can be used to specify which existing column to add the new column after.</p>
+<p><code>
+$this-&gt;dbforge-&gt;add_column('table_name', $fields, 'after_field');
+</code></p>
<h2>$this-&gt;dbforge-&gt;drop_column()</h2>
<p>Used to remove a column from a table. </p>
<p><code>$this-&gt;dbforge-&gt;drop_column('table_name', 'column_to_drop');</code></p>
diff --git a/user_guide/database/helpers.html b/user_guide/database/helpers.html
index 6a8aba5..be6c339 100644
--- a/user_guide/database/helpers.html
+++ b/user_guide/database/helpers.html
@@ -64,11 +64,11 @@ Query Helpers
<h2>$this->db->insert_id()</h2>
<p>The insert ID number when performing database inserts.</p>
+<p class="important"><strong>Note:</strong> If using the PDO driver with PostgreSQL, this function requires a $name parameter, which specifies the appropriate sequence to check for the insert id.</p>
<h2>$this->db->affected_rows()</h2>
<p>Displays the number of affected rows, when doing "write" type queries (insert, update, etc.).</p>
-<p>Note: In MySQL "DELETE FROM TABLE" returns 0 affected rows. The database class has a small hack that allows it to return the
-correct number of affected rows. By default this hack is enabled but it can be turned off in the database driver file.</p>
+<p>Note: In MySQL "DELETE FROM TABLE" returns 0 affected rows. The database class has a small hack that allows it to return the correct number of affected rows. By default this hack is enabled but it can be turned off in the database driver file.</p>
<h2>$this->db->count_all();</h2>
diff --git a/user_guide/general/cli.html b/user_guide/general/cli.html
index 4e9bf87..9091e93 100644
--- a/user_guide/general/cli.html
+++ b/user_guide/general/cli.html
@@ -138,11 +138,11 @@ class Tools extends CI_Controller {
<div id="footer">
<p>
-Previous Topic:&nbsp;&nbsp;<a href="urls.html">CodeIgniter URLs</a>
+Previous Topic:&nbsp;&nbsp;<a href="profiling.html">Profiling Your Application</a>
&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
-Next Topic:&nbsp;&nbsp;<a href="reserved_names.html">Reserved Names</a></p>
+Next Topic:&nbsp;&nbsp;<a href="managing_apps.html">Managing Applications</a></p>
<p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 - 2011 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
</div>
diff --git a/user_guide/general/managing_apps.html b/user_guide/general/managing_apps.html
index e716d10..93585e2 100644
--- a/user_guide/general/managing_apps.html
+++ b/user_guide/general/managing_apps.html
@@ -120,14 +120,14 @@ calls the desired application. The index.php file can be named anything you wan
<div id="footer">
<p>
-Previous Topic:&nbsp;&nbsp;<a href="profiling.html">Profiling Your Application</a>
+Previous Topic:&nbsp;&nbsp;<a href="cli.html">Running via the CLI</a>
&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
-Next Topic:&nbsp;&nbsp;<a href="alternative_php.html">Alternative PHP Syntax</a>
+Next Topic:&nbsp;&nbsp;<a href="environments.html">Handling Multiple Environments</a>
</p>
<p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 - 2011 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
</div>
</body>
-</html>
\ No newline at end of file
+</html>
diff --git a/user_guide/general/profiling.html b/user_guide/general/profiling.html
index 0993da5..c7c4ed3 100644
--- a/user_guide/general/profiling.html
+++ b/user_guide/general/profiling.html
@@ -177,10 +177,10 @@ Previous Topic:&nbsp;&nbsp;<a href="caching.html">Caching</a>
&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
-Next Topic:&nbsp;&nbsp;<a href="managing_apps.html">Managing Applications</a>
+Next Topic:&nbsp;&nbsp;<a href="cli.html">Running via the CLI</a>
</p>
<p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 - 2011 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
</div>
</body>
-</html>
\ No newline at end of file
+</html>
diff --git a/user_guide/helpers/form_helper.html b/user_guide/helpers/form_helper.html
index 0afe0eb..511eeab 100644
--- a/user_guide/helpers/form_helper.html
+++ b/user_guide/helpers/form_helper.html
@@ -180,12 +180,12 @@ echo form_input('username', 'johndoe', $js);</code>
<h2>form_password()</h2>
<p>This function is identical in all respects to the <dfn>form_input()</dfn> function above
-except that is sets it as a "password" type.</p>
+except that it uses the "password" input type.</p>
<h2>form_upload()</h2>
<p>This function is identical in all respects to the <dfn>form_input()</dfn> function above
-except that is sets it as a "file" type, allowing it to be used to upload files.</p>
+except that it uses the "file" input type, allowing it to be used to upload files.</p>
<h2>form_textarea()</h2>
@@ -318,7 +318,7 @@ fourth parameter:</p>
<h2>form_radio()</h2>
-<p>This function is identical in all respects to the <dfn>form_checkbox()</dfn> function above except that is sets it as a "radio" type.</p>
+<p>This function is identical in all respects to the <dfn>form_checkbox()</dfn> function above except that it uses the "radio" input type.</p>
<h2>form_submit()</h2>
diff --git a/user_guide/helpers/html_helper.html b/user_guide/helpers/html_helper.html
index 92bfdfb..4b13427 100644
--- a/user_guide/helpers/html_helper.html
+++ b/user_guide/helpers/html_helper.html
@@ -348,6 +348,11 @@ echo doctype('html4-trans');<br />
<td class="td">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"&gt;</td>
</tr>
<tr>
+ <td class="td">XHTML Basic 1.1</td>
+ <td class="td">doctype('xhtml-basic11')</td>
+ <td class="td">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd"&gt;</td>
+ </tr>
+ <tr>
<td class="td">HTML 5</td>
<td class="td">doctype('html5')</td>
<td class="td">&lt;!DOCTYPE html&gt;</td>
diff --git a/user_guide/installation/upgrading.html b/user_guide/installation/upgrading.html
index 58a45ee..0f4a29b 100644
--- a/user_guide/installation/upgrading.html
+++ b/user_guide/installation/upgrading.html
@@ -60,6 +60,7 @@ Upgrading from a Previous Version
<p>Please read the upgrade notes corresponding to the version you are upgrading from.</p>
<ul>
+ <li><a href="upgrade_210.html">Upgrading from 2.0.3 to 2.1.0</a></li>
<li><a href="upgrade_203.html">Upgrading from 2.0.2 to 2.0.3</a></li>
<li><a href="upgrade_202.html">Upgrading from 2.0.1 to 2.0.2</a></li>
<li><a href="upgrade_201.html">Upgrading from 2.0 to 2.0.1</a></li>
diff --git a/user_guide/libraries/email.html b/user_guide/libraries/email.html
index d246254..de2f1c0 100644
--- a/user_guide/libraries/email.html
+++ b/user_guide/libraries/email.html
@@ -63,6 +63,7 @@ Email Class
<ul>
<li>Multiple Protocols: Mail, Sendmail, and SMTP</li>
+<li>TLS and SSL Encryption for SMTP</li>
<li>Multiple recipients</li>
<li>CC and BCCs</li>
<li>HTML or Plaintext email</li>
@@ -152,6 +153,8 @@ will NOT need to use the <dfn>$this->email->initialize()</dfn> function if you s
</tr><tr>
<td class="td"><strong>smtp_timeout</strong></td><td class="td">5</td><td class="td">None</td><td class="td">SMTP Timeout (in seconds).</td>
</tr><tr>
+<td class="td"><strong>smtp_crypto</strong></td><td class="td">No Default</td><td class="td">tls or ssl</td><td class="td">SMTP Encryption.</td>
+</tr><tr>
<td class="td"><strong>wordwrap</strong></td><td class="td">TRUE</td><td class="td">TRUE or FALSE (boolean)</td><td class="td">Enable word-wrap.</td>
</tr><tr>
<td class="td"><strong>wrapchars</strong></td><td class="td">76</td><td class="td"> </td><td class="td">Character count to wrap at.</td>
@@ -304,4 +307,4 @@ Next Topic:&nbsp;&nbsp;<a href="encryption.html">Encryption Class</a>
</div>
</body>
-</html>
\ No newline at end of file
+</html>
diff --git a/user_guide/libraries/pagination.html b/user_guide/libraries/pagination.html
index 1965554..6a14411 100644
--- a/user_guide/libraries/pagination.html
+++ b/user_guide/libraries/pagination.html
@@ -119,7 +119,11 @@ something different you can specify it.</p>
<p>The number of &quot;digit&quot; links you would like before and after the selected page number. For example, the number 2
will place two digits on either side, as in the example links at the very top of this page.</p>
-<h4>$config['page_query_string'] = TRUE</h4>
+
+<h4>$config['use_page_numbers'] = TRUE;</h4>
+<p>By default, the URI segment will use the starting index for the items you are paginating. If you prefer to show the the actual page number, set this to TRUE.</p>
+
+<h4>$config['page_query_string'] = TRUE;</h4>
<p>By default, the pagination library assume you are using <a href="../general/urls.html">URI Segments</a>, and constructs your links something like</p>
<p><code>http://example.com/index.php/test/page/20</code></p>
<p>If you have $config['enable_query_strings'] set to TRUE your links will automatically be re-written using Query Strings. This option can also be explictly set. Using $config['page_query_string'] set to TRUE, the pagination link will become.</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment