Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kenjis/1367006 to your computer and use it in GitHub Desktop.
Save kenjis/1367006 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 11a1537..167616e 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -58,13 +58,14 @@ Change Log
<h1>Change Log</h1>
<h2>Version 2.1.0</h2>
-<p>Release Date: November 01, 2011</p>
+<p>Release Date: November 14, 2011</p>
<ul>
<li>General Changes
<ul>
+ <li>Fixed a potential parameter injection flaw in the <a href="libraries/security.html">Security Library</a> and strengthened the XSS filter for HTML5 vulnerabilites.</li>
<li>Callback validation rules can now accept parameters like any other validation rule.</li>
- <li class="reactor">Added html_escape() to the <a href="general/common_functions.html">Common functions<a> to escape HTML output for preventing XSS easliy.</li>
+ <li>Added html_escape() to the <a href="general/common_functions.html">Common functions</a> to escape HTML output for preventing XSS easliy.</li>
</ul>
</li>
<li>Helpers
@@ -77,32 +78,36 @@ Change Log
</li>
<li>Database
<ul>
- <li>Added a <a href="http://www.cubrid.org/" target="_blank">CUBRID</a> driver to the <a href="libraries/database.html">Database Driver</a>. Thanks to the CUBRID team for supplying this patch.</li>
- <li>Added a <a href="http://www.php.net/manual/en/intro.pdo.php" target="_blank">PDO</a> driver to the <a href="libraries/database.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>Added a <a href="http://www.cubrid.org/" target="_blank">CUBRID</a> driver to the <a href="libraries/database.html">Database driver</a>. Thanks to the CUBRID team for supplying this patch.</li>
+ <li>Added a <a href="http://www.php.net/manual/en/intro.pdo.php" target="_blank">PDO</a> driver to the <a href="libraries/database.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
<ul>
- <li>Changed <kbd>$this->cart->insert()</kbd> in the <a href="libraries/cart.html">Cart Library</a> to return the Row ID if a single item was inserted successfully.</li>
- <li>Added support to set an optional parameter in your callback rules of validation using the <a href="libraries/form_validation.html">Form Validation Library</a>.</li>
- <li>Added a <a href="libraries/migration.html">Migration Library</a> to assist with applying incremental updates to your database schema.</li>
+ <li>Changed <kbd>$this->cart->insert()</kbd> in the <a href="libraries/cart.html">Cart library</a> to return the Row ID if a single item was inserted successfully.</li>
+ <li>Added support to set an optional parameter in your callback rules of validation using the <a href="libraries/form_validation.html">Form Validation library</a>.</li>
+ <li>Added a <a href="libraries/migration.html">Migration library</a> to assist with applying incremental updates to your database schema.</li>
<li>Driver children can be located in any package path.</li>
+ <li>Added <samp>is_unique</samp> to the <a href="libraries/form_validation.html">Form Validation library</a>.</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 <a href="libraries/cart.html">URI Library</a> to protected so <kdb>MY_URI</kdb> can override them.</li>
- <li>Removed <var>CI_CORE</var> boolean constant from CodeIgniter.php (there are no longer different Reactor and Core versions).</li>
+ <li>Changed private functions in <a href="libraries/cart.html">URI library</a> to protected so <kdb>MY_URI</kdb> can override them.</li>
+ <li>Removed <samp>CI_CORE</samp> boolean constant from CodeIgniter.php (there are no longer different Reactor and Core versions).</li>
</ul>
</li>
</ul>
<h3>Bug fixes for 2.1.0</h3>
<ul>
- <li>Fixed #378 Robots identified as regular browsers by the User Agent class.</li>
+ <li>Fixed #378 Robots identified as regular browsers by the <a href="libraries/user_agent.html">User Agent class</a>.</li>
<li>If a config class was loaded first then a library with the same name is loaded, the config would be ignored.</li>
<li>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>Fixed a bug (Reactor #89) where MySQL export would fail if the table had hyphens or other non alphanumeric/underscore characters.</li>
@@ -110,7 +115,7 @@ Change Log
<li>Fixed bug #105 that stopped query errors from being logged unless database debugging was enabled</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) - load_class() now looks for core classes in APPPATH first, allowing them to be replaced.</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 <kbd>escape_str()</kbd> 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>
@@ -123,6 +128,7 @@ Change Log
<li>Fixed a bug (#60) - Added <kbd>_file_mime_type()</kbd> 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>
<li>Fixed a bug (#537) - Support for all wav type in browser.</li>
<li>Fixed a bug (#576) - Using <kbd>ini_get()</kbd> function to detect if apc is enabled or not.</li>
+ <li>Fixed invalid date time format in <a href="helpers/date_helper.html">Date helper</a> and <a href="libraries/xmlrpc.html">XMLRPC library</a>.</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 bd3c07d..17c58c9 100644
--- a/user_guide/database/active_record.html
+++ b/user_guide/database/active_record.html
@@ -546,7 +546,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>
@@ -669,6 +669,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>
@@ -786,4 +821,4 @@ Next Topic:&nbsp;&nbsp;<a href="transactions.html">Transactions</a>
</div>
</body>
-</html>
\ No newline at end of file
+</html>
diff --git a/user_guide/installation/downloads.html b/user_guide/installation/downloads.html
index 074fd8b..14c65ed 100644
--- a/user_guide/installation/downloads.html
+++ b/user_guide/installation/downloads.html
@@ -88,14 +88,14 @@ Downloading CodeIgniter
-<h1 id="hg">Mercurial Server</h1>
-<p><a href="http://mercurial.selenic.com">Mercurial</a> is a distributed version control system.</p>
+<h1 id="git">Git Server</h1>
+<p><a href="http://git-scm.com/about">Git</a> is a distributed version control system.</p>
- <p>Public Hg access is available at <a href="http://bitbucket.org/ellislab/codeigniter-reactor/">BitBucket</a>.
+ <p>Public Git access is available at <a href="https://github.com/EllisLab/CodeIgniter">GitHub</a>.
Please note that while every effort is made to keep this code base functional, we cannot guarantee the functionality of code taken
from the tip.</p>
- <p>Beginning with version 1.6.1, stable tags are also available via BitBucket, simply select the version from the Tags dropdown.</p>
+ <p>Beginning with version 2.0.3, stable tags are also available via GitHub, simply select the version from the Tags dropdown.</p>
</div>
<!-- END CONTENT -->
diff --git a/user_guide/libraries/input.html b/user_guide/libraries/input.html
index cfb0d5e..10c84a9 100644
--- a/user_guide/libraries/input.html
+++ b/user_guide/libraries/input.html
@@ -73,11 +73,11 @@ Input Class
<p>The security filtering function is called automatically when a new <a href="../general/controllers.html">controller</a> is invoked. It does the following:</p>
<ul>
-<li>Destroys the global GET array. Since CodeIgniter does not utilize GET strings, there is no reason to allow it.</li>
+<li>If $config['allow_get_array'] is FALSE(default is TRUE), destroys the global GET array.</li>
<li>Destroys all global variables in the event register_globals is turned on.</li>
-<li>Filters the POST/COOKIE array keys, permitting only alpha-numeric (and a few other) characters.</li>
+<li>Filters the GET/POST/COOKIE array keys, permitting only alpha-numeric (and a few other) characters.</li>
<li>Provides XSS (Cross-site Scripting Hacks) filtering. This can be enabled globally, or upon request.</li>
-<li>Standardizes newline characters to \n</li>
+<li>Standardizes newline characters to \n(In Windows \r\n)</li>
</ul>
@@ -133,13 +133,13 @@ else<br />
<code>$this->input->post('some_data', TRUE);</code>
<p>To return an array of all POST items call without any parameters.</p>
-<p>To return all POST items and pass them through the XSS filter leave the first parameter blank while setting the second parameter to boolean;</p>
+<p>To return all POST items and pass them through the XSS filter set the first parameter NULL while setting the second parameter to boolean;</p>
<p>The function returns FALSE (boolean) if there are no items in the POST.</p>
<code>
- $this->input->post(); // returns all POST items with XSS filter
+ $this->input->post(NULL, TRUE); // returns all POST items with XSS filter
<br />
- $this->input->post(NULL, FALSE); // returns all POST items without XSS
+ $this->input->post(); // returns all POST items without XSS filter
</code>
<h2>$this->input->get()</h2>
@@ -149,13 +149,13 @@ else<br />
<code>$this->input->get('some_data', TRUE);</code>
<p>To return an array of all GET items call without any parameters.</p>
-<p>To return all GET items and pass them through the XSS filter leave the first parameter blank while setting the second parameter to boolean;</p>
+<p>To return all GET items and pass them through the XSS filter set the first parameter NULL while setting the second parameter to boolean;</p>
<p>The function returns FALSE (boolean) if there are no items in the GET.</p>
<code>
- $this->input->get(); // returns all GET items with XSS filter
+ $this->input->get(NULL, TRUE); // returns all GET items with XSS filter
<br />
- $this->input->get(NULL, FALSE); // returns all GET items without XSS filtering
+ $this->input->get(); // returns all GET items without XSS filtering
</code>
<h2>$this->input->get_post()</h2>
diff --git a/user_guide/libraries/pagination.html b/user_guide/libraries/pagination.html
index b5f971f..6478694 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