summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/core/Input.php32
-rw-r--r--user_guide/changelog.html1
-rw-r--r--user_guide/libraries/input.html20
3 files changed, 53 insertions, 0 deletions
diff --git a/system/core/Input.php b/system/core/Input.php
index cb842812f..ea5b248cf 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -111,6 +111,22 @@ class CI_Input {
*/
function get($index = '', $xss_clean = FALSE)
{
+ // check if a field has been entered
+ if( empty($index) AND is_array($_GET) AND count($_GET) )
+ {
+ // no field entered - return all fields
+
+ $all_get_fields = array();
+
+ // loop through the full _GET array
+ foreach( $_GET as $key )
+ {
+ $all_get_fields[$key] = $this->_fetch_from_array($_GET, $key, $xss_clean);
+ }
+ return $all_get_fields;
+
+ }
+
return $this->_fetch_from_array($_GET, $index, $xss_clean);
}
@@ -126,6 +142,22 @@ class CI_Input {
*/
function post($index = '', $xss_clean = FALSE)
{
+ // check if a field has been entered
+ if( empty($index) AND is_array($_POST) AND count($_POST) )
+ {
+ // no field entered - return all fields
+
+ $all_post_fields = array();
+
+ // loop through the full _POST array
+ foreach( $_POST as $key )
+ {
+ $all_post_fields[$key] = $this->_fetch_from_array($_POST, $key, $xss_clean);
+ }
+ return $all_post_fields;
+
+ }
+
return $this->_fetch_from_array($_POST, $index, $xss_clean);
}
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index c37bd4f26..d58d43552 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -139,6 +139,7 @@ Hg Tag: v2.0.0</p>
<li>Altered Email Library to allow for method chaining.</li>
<li>Added <kbd>request_headers()</kbd>, <kbd>get_request_header()</kbd> and <kbd>is_ajax_request()</kbd> to the input class.</li>
<li class="reactor">Altered <a href="libraries/user_agent.html">User agent library</a> so that <kbd>is_browser()</kbd>, <kbd>is_mobile()</kbd> and <kbd>is_robot()</kbd> can optionally check for a specific browser or mobile device.</li>
+ <li class="reactor">Altered <a href="libraries/input.html">Input library</a> so that <kbd>post()</kbd> and <kbd>get()</kbd> will return all POST and GET items (respectively) if there are no parameters passed in.</li>
</ul>
</li>
<li>Database
diff --git a/user_guide/libraries/input.html b/user_guide/libraries/input.html
index 552c49afd..4faecd768 100644
--- a/user_guide/libraries/input.html
+++ b/user_guide/libraries/input.html
@@ -132,12 +132,32 @@ 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>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
+ <br />
+ $this->input->post('', FALSE); // returns all POST items without XSS
+</code>
+
<h2>$this->input->get()</h2>
<p>This function is identical to the post function, only it fetches get data:</p>
<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>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
+ <br />
+ $this->input->get('', FALSE); // returns all GET items without XSS filtering
+</code>
+
<h2>$this->input->get_post()</h2>
<p>This function will search through both the post and get streams for data, looking first in post, and then in get:</p>