From 93c09877da81323e083322126d9d02b97a9583d1 Mon Sep 17 00:00:00 2001 From: Ahmad Anbar Date: Sat, 31 May 2014 18:52:13 +0300 Subject: Added _display documentation. --- user_guide_src/source/libraries/output.rst | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/output.rst b/user_guide_src/source/libraries/output.rst index e49ea5366..c3f948805 100644 --- a/user_guide_src/source/libraries/output.rst +++ b/user_guide_src/source/libraries/output.rst @@ -205,4 +205,32 @@ Class Reference Caches the current page for the specified amount of seconds. - For more information, please see the :doc:`caching documentation <../general/caching>`. \ No newline at end of file + For more information, please see the :doc:`caching documentation <../general/caching>`. + + .. method:: _display([$output='']) + + :param string $output: Output data override + :returns: void + :rtype: void + + sends finalized output data to the browser along with any server headers and profile data. It also stops benchmark + timers so the page rendering speed and memory usage can be shown. + + :: + + $this->output->_display(); + + .. note:: This method is called automatically at the end of script execution, you won't need to call it manually unless + you are aborting script execution using ``exit()`` or ``die()`` in your code. + + :: + $response = array('status' => 'OK'); + + $this->output + ->set_status_header(200) + ->set_content_type('application/json', 'utf-8') + ->set_output(json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)) + ->_display(); + exit(); + + .. note:: Calling this method manually without aborting script execution will result in a duplicated output. \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 054bbe8f16f14cd817d4a7e3b6b440ddc2be8245 Mon Sep 17 00:00:00 2001 From: Ahmad Anbar Date: Sun, 1 Jun 2014 12:20:08 +0300 Subject: Fixed code style. --- user_guide_src/source/libraries/output.rst | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/output.rst b/user_guide_src/source/libraries/output.rst index c3f948805..5c82e455a 100644 --- a/user_guide_src/source/libraries/output.rst +++ b/user_guide_src/source/libraries/output.rst @@ -207,30 +207,26 @@ Class Reference For more information, please see the :doc:`caching documentation <../general/caching>`. - .. method:: _display([$output='']) + .. method:: _display([$output = '']) :param string $output: Output data override :returns: void :rtype: void - sends finalized output data to the browser along with any server headers and profile data. It also stops benchmark - timers so the page rendering speed and memory usage can be shown. - - :: - - $this->output->_display(); + Sends finalized output data to the browser along with any server headers. It also stops benchmark + timers. .. note:: This method is called automatically at the end of script execution, you won't need to call it manually unless you are aborting script execution using ``exit()`` or ``die()`` in your code. - :: + Example:: $response = array('status' => 'OK'); $this->output - ->set_status_header(200) - ->set_content_type('application/json', 'utf-8') - ->set_output(json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)) - ->_display(); - exit(); + ->set_status_header(200) + ->set_content_type('application/json', 'utf-8') + ->set_output(json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)) + ->_display(); + exit; - .. note:: Calling this method manually without aborting script execution will result in a duplicated output. \ No newline at end of file + .. note:: Calling this method manually without aborting script execution will result in duplicated output. \ No newline at end of file -- cgit v1.2.3-24-g4f1b From e06c5c4f04583eddf35aa8549ca16ed11e2503bf Mon Sep 17 00:00:00 2001 From: Ahmad Anbar Date: Sun, 1 Jun 2014 12:22:12 +0300 Subject: reduced line length. --- user_guide_src/source/libraries/output.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/output.rst b/user_guide_src/source/libraries/output.rst index 5c82e455a..218ec5896 100644 --- a/user_guide_src/source/libraries/output.rst +++ b/user_guide_src/source/libraries/output.rst @@ -216,8 +216,8 @@ Class Reference Sends finalized output data to the browser along with any server headers. It also stops benchmark timers. - .. note:: This method is called automatically at the end of script execution, you won't need to call it manually unless - you are aborting script execution using ``exit()`` or ``die()`` in your code. + .. note:: This method is called automatically at the end of script execution, you won't need to + call it manually unless you are aborting script execution using ``exit()`` or ``die()`` in your code. Example:: $response = array('status' => 'OK'); -- cgit v1.2.3-24-g4f1b From 7428ff0cebbf89d6ad8dd9c8b77a5e0103e13c68 Mon Sep 17 00:00:00 2001 From: AdwinTrave Date: Wed, 4 Jun 2014 17:44:17 -0500 Subject: Updating table template prototype id documentation Updating template prototype in documentation to reflect the actual template prototype in the table library. --- user_guide_src/source/libraries/table.rst | 36 ++++++++++++++++++------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/table.rst b/user_guide_src/source/libraries/table.rst index 9d95eddfc..bb001e84c 100644 --- a/user_guide_src/source/libraries/table.rst +++ b/user_guide_src/source/libraries/table.rst @@ -95,24 +95,30 @@ The Table Class permits you to set a table template with which you can specify the design of your layout. Here is the template prototype:: $template = array( - 'table_open' => '', + 'table_open' => '
', - 'heading_row_start' => '', - 'heading_row_end' => '', - 'heading_cell_start' => '', + 'thead_open' => '', + 'thead_close' => '', - 'row_start' => '', - 'row_end' => '', - 'cell_start' => '', + 'heading_row_start' => '', + 'heading_row_end' => '', + 'heading_cell_start' => '', - 'row_alt_start' => '', - 'row_alt_end' => '', - 'cell_alt_start' => '', + 'tbody_open' => '', + 'tbody_close' => '', - 'table_close' => '
', - 'heading_cell_end' => '
', - 'cell_end' => '
', + 'heading_cell_end' => '
', - 'cell_alt_end' => '
' + 'row_start' => '', + 'row_end' => '', + 'cell_start' => '', + 'cell_end' => '', + + 'row_alt_start' => '', + 'row_alt_end' => '', + 'cell_alt_start' => '', + 'cell_alt_end' => '', + + 'table_close' => '' ); $this->table->set_template($template); @@ -288,4 +294,4 @@ Class Reference $this->table->add_row('Mary', 'Monday', 'Air'); $this->table->add_row('John', 'Saturday', 'Overnight'); - echo $this->table->generate(); \ No newline at end of file + echo $this->table->generate(); -- cgit v1.2.3-24-g4f1b From 1e83d69a52a85a4f568bfa086d658556acd48980 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 19 Jun 2014 20:08:59 +0300 Subject: Remove the custom IV option from CI_Encryption It serves for no practical purpose and can only do harm. --- user_guide_src/source/libraries/encryption.rst | 1 - 1 file changed, 1 deletion(-) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/encryption.rst b/user_guide_src/source/libraries/encryption.rst index a4415f510..ff41ade78 100644 --- a/user_guide_src/source/libraries/encryption.rst +++ b/user_guide_src/source/libraries/encryption.rst @@ -425,7 +425,6 @@ Option Default value Mandatory / Optional Description cipher N/A Yes Encryption algorithm (see :ref:`ciphers-and-modes`). mode N/A Yes Encryption mode (see :ref:`encryption-modes`). key N/A Yes Encryption key. -iv N/A No Initialization vector (IV). If not provided it will be automatically generated during encryption and looked for during decryption. hmac TRUE No Whether to use a HMAC. -- cgit v1.2.3-24-g4f1b From 38372554817921aa4efbab2225471474c2893b4a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 19 Jun 2014 21:18:40 +0300 Subject: [ci skip] Leftover from 1e83d69a52a85a4f568bfa086d658556acd48980 --- user_guide_src/source/libraries/encryption.rst | 2 -- 1 file changed, 2 deletions(-) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/encryption.rst b/user_guide_src/source/libraries/encryption.rst index ff41ade78..28aa57302 100644 --- a/user_guide_src/source/libraries/encryption.rst +++ b/user_guide_src/source/libraries/encryption.rst @@ -425,8 +425,6 @@ Option Default value Mandatory / Optional Description cipher N/A Yes Encryption algorithm (see :ref:`ciphers-and-modes`). mode N/A Yes Encryption mode (see :ref:`encryption-modes`). key N/A Yes Encryption key. - If not provided it will be automatically generated - during encryption and looked for during decryption. hmac TRUE No Whether to use a HMAC. Boolean. If set to FALSE, then *hmac_digest* and *hmac_key* will be ignored. -- cgit v1.2.3-24-g4f1b From 42183de45621e09621399ee161135f995af552ff Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 22 Jun 2014 00:09:36 +0300 Subject: Add CI_Encryption::create_key() This was planned, we somehow forgot about it. :) --- user_guide_src/source/libraries/encryption.rst | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/encryption.rst b/user_guide_src/source/libraries/encryption.rst index 28aa57302..1353c4ed0 100644 --- a/user_guide_src/source/libraries/encryption.rst +++ b/user_guide_src/source/libraries/encryption.rst @@ -84,14 +84,19 @@ your server is not totally under your control it's impossible to ensure key security so you may want to think carefully before using it for anything that requires high security, like storing credit card numbers. -Your encryption key should be as long as the encyption algorithm in use -allows. For AES-128, that's 128 bits or 16 bytes (charcters) long. The -key should be as random as possible and it should **not** be a simple -text string. - +Your encryption key **must** be as long as the encyption algorithm in use +allows. For AES-128, that's 128 bits or 16 bytes (charcters) long. You will find a table below that shows the supported key lengths of different ciphers. +The key should be as random as possible and it **must not** be a regular +text string, nor the output of a hashing function, etc. In order to create +a proper key, you must use the Encryption library's ``create_key()`` method +:: + + // $key will be assigned a 16-byte (128-bit) random key + $key = $this->encryption->create_key(16); + The key can be either stored in your *application/config/config.php*, or you can design your own storage mechanism and pass the key dynamically when encrypting/decrypting. -- cgit v1.2.3-24-g4f1b From ab9971f112c1394db0d0fc963d860479d3ec408b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 2 Jul 2014 19:09:08 +0300 Subject: Remove GCM mode from CI_Encryption (OpenSSL) While openssl_get_cipher_methods() lists 'aes--gcm' as supported, it appears that this is only half of the story. To be more specific, only the encryption operation of GCM is performed, and the authentication message is completely missing, rendering the whole thing useles. --- user_guide_src/source/libraries/encryption.rst | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/encryption.rst b/user_guide_src/source/libraries/encryption.rst index 1353c4ed0..5d92b109a 100644 --- a/user_guide_src/source/libraries/encryption.rst +++ b/user_guide_src/source/libraries/encryption.rst @@ -173,9 +173,9 @@ but regardless, here's a list of most of them: ============== ========= ============================== ========================================= Cipher name Driver Key lengths (bits / bytes) Supported modes ============== ========= ============================== ========================================= -AES-128 OpenSSL 128 / 16 CBC, CTR, CFB, CFB8, OFB, ECB, GCM, XTS -AES-192 OpenSSL 192 / 24 CBC, CTR, CFB, CFB8, OFB, ECB, GCM, XTS -AES-256 OpenSSL 256 / 32 CBC, CTR, CFB, CFB8, OFB, ECB, GCM, XTS +AES-128 OpenSSL 128 / 16 CBC, CTR, CFB, CFB8, OFB, ECB, XTS +AES-192 OpenSSL 192 / 24 CBC, CTR, CFB, CFB8, OFB, ECB, XTS +AES-256 OpenSSL 256 / 32 CBC, CTR, CFB, CFB8, OFB, ECB, XTS Rijndael-128 MCrypt 128 / 16, 192 / 24, 256 / 32 CBC, CTR, CFB, CFB8, OFB, OFB8, ECB Rijndael-192 MCrypt 128 / 16, 192 / 24, 256 / 32 CBC, CTR, CFB, CFB8, OFB, OFB8, ECB Rijndael-256 MCrypt 128 / 16, 192 / 24, 256 / 32 CBC, CTR, CFB, CFB8, OFB, OFB8, ECB @@ -239,7 +239,6 @@ CFB8 cfb8 MCrypt, OpenSSL Same as CFB, but operates in 8- OFB ofb MCrypt, OpenSSL N/A OFB8 ofb8 MCrypt Same as OFB, but operates in 8-bit mode (not recommended). ECB ecb MCrypt, OpenSSL Ignores IV (not recommended). -GCM gcm OpenSSL Provides authentication and therefore doesn't need a HMAC. XTS xts OpenSSL Usually used for encrypting random access data such as RAM or hard-disk storage. Stream stream MCrypt, OpenSSL This is not actually a mode, it just says that a stream cipher is being used. Required because of the general cipher+mode initialization process. =========== ================== ================= =================================================================================================================================================== @@ -251,10 +250,9 @@ It's probably important for you to know that an encrypted string is usually longer than the original, plain-text string (depending on the cipher). This is influenced by the cipher algorithm itself, the IV prepended to the -cipher-text and (unless you are using GCM mode) the HMAC authentication -message that is also prepended. Furthermore, the encrypted message is also -Base64-encoded so that it is safe for storage and transmission, regardless -of a possible character set in use. +cipher-text and the HMAC authentication message that is also prepended. +Furthermore, the encrypted message is also Base64-encoded so that it is safe +for storage and transmission, regardless of a possible character set in use. Keep this information in mind when selecting your data storage mechanism. Cookies, for example, can only hold 4K of information. @@ -446,9 +444,6 @@ raw_data FALSE No Whether the cipher-t value is incorrect. This includes *hmac_key*, unless *hmac* is set to FALSE. -.. note:: If GCM mode is used, *hmac* will always be FALSE. This is - because GCM mode itself provides authentication. - .. _digests: Supported HMAC authentication algorithms -- cgit v1.2.3-24-g4f1b From 5b3fe7c4af5e08e17480b911fbfa8cf0ef6475c0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 7 Jul 2014 10:55:53 +0300 Subject: Fix a few typos and add a backport (compat) for hex2bin() --- user_guide_src/source/libraries/encryption.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/encryption.rst b/user_guide_src/source/libraries/encryption.rst index 5d92b109a..f29ebf4ed 100644 --- a/user_guide_src/source/libraries/encryption.rst +++ b/user_guide_src/source/libraries/encryption.rst @@ -5,13 +5,13 @@ Encryption Library The Encryption Library provides two-way data encryption. To do so in a cryptographically secure way, it utilizes PHP extensions that are unfortunately not always available on all systems. -You must meet one of the following dependancies in order to use this +You must meet one of the following dependencies in order to use this library: - `OpenSSL `_ (and PHP 5.3.3) - `MCrypt `_ (and `MCRYPT_DEV_URANDOM` availability) -If neither of the above dependancies is met, we simply cannot offer +If neither of the above dependencies is met, we simply cannot offer you a good enough implementation to meet the high standards required for proper cryptography. -- cgit v1.2.3-24-g4f1b From 2f4c3bc5c2fac164d1c58ac9aaa09ae070687443 Mon Sep 17 00:00:00 2001 From: Casey Hancock Date: Mon, 11 Aug 2014 12:52:20 -0400 Subject: CSRF whitelist supports regex Signed-off-by: Casey Hancock --- user_guide_src/source/libraries/security.rst | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/security.rst b/user_guide_src/source/libraries/security.rst index fb875a0d9..566924398 100644 --- a/user_guide_src/source/libraries/security.rst +++ b/user_guide_src/source/libraries/security.rst @@ -97,6 +97,12 @@ by editing the 'csrf_exclude_uris' config parameter:: $config['csrf_exclude_uris'] = array('api/person/add'); +Optionally, you can use regular expressions as well as the ':any' and ':num' +wildcards in the URIs:: + + $config['csrf_exclude_uris'] = array('api/record/:num','api/title/[a-zA-Z]+'); + + *************** Class Reference *************** -- cgit v1.2.3-24-g4f1b From 8ef828129c559705447dd66a597071de5ae564a9 Mon Sep 17 00:00:00 2001 From: caseyh Date: Mon, 18 Aug 2014 05:13:11 -0400 Subject: Alter Pull #3176 - CSRF Whitelist --- user_guide_src/source/libraries/security.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/security.rst b/user_guide_src/source/libraries/security.rst index 566924398..19480b4f8 100644 --- a/user_guide_src/source/libraries/security.rst +++ b/user_guide_src/source/libraries/security.rst @@ -97,10 +97,9 @@ by editing the 'csrf_exclude_uris' config parameter:: $config['csrf_exclude_uris'] = array('api/person/add'); -Optionally, you can use regular expressions as well as the ':any' and ':num' -wildcards in the URIs:: +Optionally, you can use regular expressions in the URIs:: - $config['csrf_exclude_uris'] = array('api/record/:num','api/title/[a-zA-Z]+'); + $config['csrf_exclude_uris'] = array('api/record/[0-9]+','api/title/[a-zA-Z]+'); *************** @@ -162,4 +161,4 @@ Class Reference This method acts a lot like PHP's own native ``html_entity_decode()`` function in ENT_COMPAT mode, only it tries to detect HTML entities that don't end in a semicolon because some browsers allow that. - If the ``$charset`` parameter is left empty, then your configured ``$config['charset']`` value will be used. \ No newline at end of file + If the ``$charset`` parameter is left empty, then your configured ``$config['charset']`` value will be used. -- cgit v1.2.3-24-g4f1b From 6c52096f4f9147244e9631b8040088025ae6e79d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 18 Aug 2014 12:24:42 +0300 Subject: [ci skip] Polish changes from PR #3176 --- user_guide_src/source/libraries/security.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/security.rst b/user_guide_src/source/libraries/security.rst index 19480b4f8..c8d69d16f 100644 --- a/user_guide_src/source/libraries/security.rst +++ b/user_guide_src/source/libraries/security.rst @@ -97,10 +97,12 @@ by editing the 'csrf_exclude_uris' config parameter:: $config['csrf_exclude_uris'] = array('api/person/add'); -Optionally, you can use regular expressions in the URIs:: +Regular expressions are also supported (case-insensitive):: - $config['csrf_exclude_uris'] = array('api/record/[0-9]+','api/title/[a-zA-Z]+'); - + $config['csrf_exclude_uris'] = array( + 'api/record/[0-9]+', + 'api/title/[a-z]+' + ); *************** Class Reference @@ -161,4 +163,4 @@ Class Reference This method acts a lot like PHP's own native ``html_entity_decode()`` function in ENT_COMPAT mode, only it tries to detect HTML entities that don't end in a semicolon because some browsers allow that. - If the ``$charset`` parameter is left empty, then your configured ``$config['charset']`` value will be used. + If the ``$charset`` parameter is left empty, then your configured ``$config['charset']`` value will be used. \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 487ccc9c8a21cb6338aab7173b3adda194d29c26 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 27 Aug 2014 16:26:23 +0300 Subject: Add CI_Security::get_random_bytes() for CSRF & XSS token generation --- user_guide_src/source/libraries/security.rst | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/security.rst b/user_guide_src/source/libraries/security.rst index c8d69d16f..0c51e342b 100644 --- a/user_guide_src/source/libraries/security.rst +++ b/user_guide_src/source/libraries/security.rst @@ -163,4 +163,19 @@ Class Reference This method acts a lot like PHP's own native ``html_entity_decode()`` function in ENT_COMPAT mode, only it tries to detect HTML entities that don't end in a semicolon because some browsers allow that. - If the ``$charset`` parameter is left empty, then your configured ``$config['charset']`` value will be used. \ No newline at end of file + If the ``$charset`` parameter is left empty, then your configured ``$config['charset']`` value will be used. + + .. method:: get_random_bytes($length) + + :param int $length: Output length + :returns: A binary stream of random bytes or FALSE on failure + :rtype: string + + A convenience method for getting proper random bytes via ``mcrypt_create_iv()``, + ``/dev/urandom`` or ``openssl_random_pseudo_bytes()`` (in that order), if one + of them is available. + + Used for generating CSRF and XSS tokens. + + .. note:: The output is NOT guaranteed to be cryptographically secure, + just the best attempt at that. \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 459657415189f4fe3f8d4eb05b209ab78409f9b0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 27 Aug 2014 20:40:11 +0300 Subject: Fix #2963 Changed all file permissions settings throught the framework and the documentation. Also added configuration settings for CI_Log and CI_Image_lib --- user_guide_src/source/libraries/ftp.rst | 6 +++--- user_guide_src/source/libraries/image_lib.rst | 2 ++ user_guide_src/source/libraries/zip.rst | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/ftp.rst b/user_guide_src/source/libraries/ftp.rst index dd9440443..4be1a6ea4 100644 --- a/user_guide_src/source/libraries/ftp.rst +++ b/user_guide_src/source/libraries/ftp.rst @@ -270,7 +270,7 @@ Class Reference :: // Creates a folder named "bar" - $this->ftp->mkdir('/public_html/foo/bar/', DIR_WRITE_MODE); + $this->ftp->mkdir('/public_html/foo/bar/', 0755); .. method:: chmod($path, $perm) @@ -282,8 +282,8 @@ Class Reference Permits you to set file permissions. Supply the path to the file or directory you wish to alter permissions on:: - // Chmod "bar" to 777 - $this->ftp->chmod('/public_html/foo/bar/', DIR_WRITE_MODE); + // Chmod "bar" to 755 + $this->ftp->chmod('/public_html/foo/bar/', 0755); .. method:: changedir($path[, $suppress_debug = FALSE]) diff --git a/user_guide_src/source/libraries/image_lib.rst b/user_guide_src/source/libraries/image_lib.rst index 16acf090b..a52cf3e02 100644 --- a/user_guide_src/source/libraries/image_lib.rst +++ b/user_guide_src/source/libraries/image_lib.rst @@ -137,6 +137,8 @@ Preference Default Value Options image can be shown at a time, and it can't be positioned on the page. It simply outputs the raw image dynamically to your browser, along with image headers. +**file_permissions** 0644 (integer) File system permissions to apply on the resulting image file, R, C, X, W + writing it to the disk. WARNING: Use octal integer notation! **quality** 90% 1 - 100% Sets the quality of the image. The higher the quality the larger the R, C, X, W file size. **new_image** None None Sets the destination image name/path. You'll use this preference when R, C, X, W diff --git a/user_guide_src/source/libraries/zip.rst b/user_guide_src/source/libraries/zip.rst index 5ff7d07d6..4ca14086a 100644 --- a/user_guide_src/source/libraries/zip.rst +++ b/user_guide_src/source/libraries/zip.rst @@ -173,7 +173,7 @@ Class Reference :rtype: bool Writes the Zip-encoded file to a directory on your server. Submit a valid server path ending in the file name. - Make sure the directory is writable (660 or 666 is usually OK). Example:: + Make sure the directory is writable (755 is usually OK). Example:: $this->zip->archive('/path/to/folder/myarchive.zip'); // Creates a file named myarchive.zip -- cgit v1.2.3-24-g4f1b From 60726ef7dc7a70a41a6a8944525d25c4476edea9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 8 Sep 2014 11:31:48 +0300 Subject: Add 'named callable' rules to Form validation library Requested in issue #3183 Supersedes PR #3220 --- .../source/libraries/form_validation.rst | 31 +++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst index 2ae56d29a..2b7780ff2 100644 --- a/user_guide_src/source/libraries/form_validation.rst +++ b/user_guide_src/source/libraries/form_validation.rst @@ -505,11 +505,40 @@ function:: 'required', function($value) { - // Check $value and return TRUE/FALSE + // Check $value } ) ); +Of course, since a Callable rule by itself is not a string, it isn't +a rule name either. That is a problem when you want to set error messages +for them. In order to get around that problem, you can put such rules as +the second element of an array, with the first one being the rule name:: + + $this->form_validation->set_rules( + 'username', 'Username', + array( + 'required', + array('username_callable', array($this->users_model', 'valid_username')) + ) + ); + +Anonymous function (PHP 5.3+) version:: + + $this->form_validation->set_rules( + 'username', 'Username', + array( + 'required', + array( + 'username_callable', + function($str) + { + // Check validity of $str and return TRUE or FALSE + } + ) + ) + ); + .. _setting-error-messages: Setting Error Messages -- cgit v1.2.3-24-g4f1b From cbde7d4762bdfa1d476e01bb33bd56fa962ad140 Mon Sep 17 00:00:00 2001 From: Ahmad Anbar Date: Mon, 15 Sep 2014 18:22:08 +0300 Subject: removed extra quote --- user_guide_src/source/libraries/form_validation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst index 2b7780ff2..aae9e3b89 100644 --- a/user_guide_src/source/libraries/form_validation.rst +++ b/user_guide_src/source/libraries/form_validation.rst @@ -519,7 +519,7 @@ the second element of an array, with the first one being the rule name:: 'username', 'Username', array( 'required', - array('username_callable', array($this->users_model', 'valid_username')) + array('username_callable', array($this->users_model, 'valid_username')) ) ); -- cgit v1.2.3-24-g4f1b