From 6a7a16073aefbc0bff0fb850d97ea11c57d693c1 Mon Sep 17 00:00:00 2001 From: dimitribalazs Date: Wed, 18 Nov 2015 11:50:22 +0100 Subject: Added alt attribute functionality … MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It hasn't been possible to set the alt attribute on the image. Added img_alt key on the $defaults array and integrated the $img_alt variable into the img string. --- system/helpers/captcha_helper.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 85bcfb5a0..3cf581bba 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -79,7 +79,8 @@ if ( ! function_exists('create_captcha')) 'border' => array(153,102,102), 'text' => array(204,153,153), 'grid' => array(255,182,182) - ) + ), + 'img_alt' => 'captcha' ); foreach ($defaults as $key => $val) @@ -330,7 +331,7 @@ if ( ! function_exists('create_captcha')) return FALSE; } - $img = ' '; + $img = ''.$img_alt.''; ImageDestroy($im); return array('word' => $word, 'time' => $now, 'image' => $img, 'filename' => $img_filename); -- cgit v1.2.3-24-g4f1b From fd70fa5ff7cec722a69f3e720a962aea3dec03fe Mon Sep 17 00:00:00 2001 From: Sébastien Adam Date: Wed, 25 Nov 2015 18:25:17 +0100 Subject: HTML Helper - meta(): now can generate HTML meta charset & Open Graph property --- system/helpers/html_helper.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 28fbe00be..4e25f8c9b 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -338,7 +338,7 @@ if ( ! function_exists('link_tag')) if ( ! function_exists('meta')) { /** - * Generates meta tags from an array of key/values + * Generates meta tags from an array of key/values, compatible with html5 and open graph * * @param array * @param string @@ -359,13 +359,14 @@ if ( ! function_exists('meta')) // Turn single array into multidimensional $name = array($name); } - + $allowed_type = array('charset', 'http-equiv', 'name', 'property'); $str = ''; foreach ($name as $meta) { - $type = (isset($meta['type']) && $meta['type'] !== 'name') ? 'http-equiv' : 'name'; + $meta['type'] = (isset($meta['type']) && ($meta['type'] == 'equiv')) ? 'http-equiv' : $meta['type']; // backward compatibility + $type = (isset($meta['type']) && in_array($meta['type'], $allowed_type))? $meta['type'] : 'name'; $name = isset($meta['name']) ? $meta['name'] : ''; - $content = isset($meta['content']) ? $meta['content'] : ''; + $content = (isset($meta['content']) && $type != 'charset') ? $meta['content'] : ''; $newline = isset($meta['newline']) ? $meta['newline'] : "\n"; $str .= ''.$newline; -- cgit v1.2.3-24-g4f1b From dfcc5318d378ae66dd21806c6ac2dad67d73dc26 Mon Sep 17 00:00:00 2001 From: Sébastien Adam Date: Wed, 25 Nov 2015 18:30:34 +0100 Subject: HTML Helper - doctype(): now default type is HTML 5 --- system/helpers/html_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 4e25f8c9b..b4c605a01 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -229,7 +229,7 @@ if ( ! function_exists('doctype')) * @param string type The doctype to be generated * @return string */ - function doctype($type = 'xhtml1-strict') + function doctype($type = 'html5') { static $doctypes; -- cgit v1.2.3-24-g4f1b From 6ab09773d96ce6ac672a3d852256126d10aa25d8 Mon Sep 17 00:00:00 2001 From: Sébastien Adam Date: Tue, 1 Dec 2015 20:02:07 +0100 Subject: Modified as asked after pull request: * comment of meta fuction adapted * alignments in meta fuction adapted * using '===' comparator in meta function * changing back the example of the meta function help * changing back the default value of the doctype function Also changing test unit to reflect the modification of the meta function (original tests not modified). --- system/helpers/html_helper.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index b4c605a01..36680053a 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -229,7 +229,7 @@ if ( ! function_exists('doctype')) * @param string type The doctype to be generated * @return string */ - function doctype($type = 'html5') + function doctype($type = 'xhtml1-strict') { static $doctypes; @@ -363,13 +363,13 @@ if ( ! function_exists('meta')) $str = ''; foreach ($name as $meta) { - $meta['type'] = (isset($meta['type']) && ($meta['type'] == 'equiv')) ? 'http-equiv' : $meta['type']; // backward compatibility - $type = (isset($meta['type']) && in_array($meta['type'], $allowed_type))? $meta['type'] : 'name'; - $name = isset($meta['name']) ? $meta['name'] : ''; - $content = (isset($meta['content']) && $type != 'charset') ? $meta['content'] : ''; - $newline = isset($meta['newline']) ? $meta['newline'] : "\n"; + $meta['type'] = isset($meta['type']) ? (($meta['type'] === 'equiv') ? 'http-equiv' : $meta['type']) : ''; // backward compatibility + $type = in_array($meta['type'], $allowed_type) ? $meta['type'] : 'name'; + $name = isset($meta['name']) ? $meta['name'] : ''; + $content = isset($meta['content']) ? $meta['content'] : ''; + $newline = isset($meta['newline']) ? $meta['newline'] : "\n"; - $str .= ''.$newline; + $str .= ''.$newline; } return $str; -- cgit v1.2.3-24-g4f1b From 7cf4cda4d56ca8c7dc51b38442d83d3b593d96f8 Mon Sep 17 00:00:00 2001 From: Sébastien Adam Date: Tue, 1 Dec 2015 20:24:32 +0100 Subject: Forgot change in the comment on the meta function --- system/helpers/html_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 36680053a..9ed21a168 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -338,7 +338,7 @@ if ( ! function_exists('link_tag')) if ( ! function_exists('meta')) { /** - * Generates meta tags from an array of key/values, compatible with html5 and open graph + * Generates meta tags from an array of key/values * * @param array * @param string -- cgit v1.2.3-24-g4f1b From 8f1047ff6bc961159a7103e7be02e6cc459d925e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 13:20:12 +0200 Subject: Polish changes from PR #4269 --- system/helpers/html_helper.php | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 5cc994ff1..becd9a00c 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -359,17 +359,31 @@ if ( ! function_exists('meta')) // Turn single array into multidimensional $name = array($name); } - $allowed_type = array('charset', 'http-equiv', 'name', 'property'); + + $allowed_types = array('charset', 'http-equiv', 'name', 'property'); $str = ''; foreach ($name as $meta) { - $meta['type'] = isset($meta['type']) ? (($meta['type'] === 'equiv') ? 'http-equiv' : $meta['type']) : ''; // backward compatibility - $type = in_array($meta['type'], $allowed_type) ? $meta['type'] : 'name'; - $name = isset($meta['name']) ? $meta['name'] : ''; - $content = isset($meta['content']) ? $meta['content'] : ''; - $newline = isset($meta['newline']) ? $meta['newline'] : "\n"; + // This is to preserve BC with pre-3.1 versions where only + // 'http-equiv' (default) and 'name' were supported. + if (isset($meta['type'])) + { + if ($meta['type'] === 'equiv') + { + $meta['type'] === 'http-equiv'; + } + elseif ( ! in_array($meta['type'], $allowed_types, TRUE)) + { + $meta['type'] = 'name'; + } + } + + $type = isset($meta['type']) ? $meta['type'] : 'name'; + $name = isset($meta['name']) ? $meta['name'] : ''; + $content = isset($meta['content']) ? $meta['content'] : ''; + $newline = isset($meta['newline']) ? $meta['newline'] : "\n"; - $str .= ''.$newline; + $str .= ''.$newline; } return $str; -- cgit v1.2.3-24-g4f1b From b6774cbeb11ac7bc5bd694c1da87ed77e9d4f9fb Mon Sep 17 00:00:00 2001 From: Sébastien Adam Date: Wed, 20 Jan 2016 09:25:22 +0100 Subject: Default doctype is now HTML 5 --- system/helpers/html_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index becd9a00c..696f0eee2 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -229,7 +229,7 @@ if ( ! function_exists('doctype')) * @param string type The doctype to be generated * @return string */ - function doctype($type = 'xhtml1-strict') + function doctype($type = 'html5') { static $doctypes; -- cgit v1.2.3-24-g4f1b From cadcef85a218595b5999442d669086bdb5628947 Mon Sep 17 00:00:00 2001 From: Kasim Tan Date: Thu, 19 May 2016 12:06:07 -0700 Subject: Fixed PHPDoc parameter name and type discrepancies --- system/helpers/form_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 3e1039525..dfb9ae2d2 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -568,7 +568,7 @@ if ( ! function_exists('form_label')) * * @param string The text to appear onscreen * @param string The id the label applies to - * @param string Additional attributes + * @param array Additional attributes * @return string */ function form_label($label_text = '', $id = '', $attributes = array()) -- cgit v1.2.3-24-g4f1b From e1b9495b7b1b55c8dfd6b602e35b6d5c269c0a90 Mon Sep 17 00:00:00 2001 From: Kasim Tan Date: Fri, 20 May 2016 07:16:14 -0700 Subject: Removed an extra space char --- system/helpers/form_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index dfb9ae2d2..8825ecc2c 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -568,7 +568,7 @@ if ( ! function_exists('form_label')) * * @param string The text to appear onscreen * @param string The id the label applies to - * @param array Additional attributes + * @param array Additional attributes * @return string */ function form_label($label_text = '', $id = '', $attributes = array()) -- cgit v1.2.3-24-g4f1b From 64d9d1ec12be9f02459a5e5c8a9124fc97686529 Mon Sep 17 00:00:00 2001 From: nopesled Date: Thu, 7 Jul 2016 17:40:47 +0100 Subject: Update path_helper.php Protect against RFI via php:// wrapper --- system/helpers/path_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index 838ece9e9..f3757affb 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -61,7 +61,7 @@ if ( ! function_exists('set_realpath')) function set_realpath($path, $check_existance = FALSE) { // Security check to make sure the path is NOT a URL. No remote file inclusion! - if (preg_match('#^(http:\/\/|https:\/\/|www\.|ftp)#i', $path) OR filter_var($path, FILTER_VALIDATE_IP) === $path ) + if (preg_match('#^(http:\/\/|https:\/\/|www\.|ftp|php)#i', $path) OR filter_var($path, FILTER_VALIDATE_IP) === $path ) { show_error('The path you submitted must be a local server path, not a URL'); } -- cgit v1.2.3-24-g4f1b From 85eaa0bff12574b8a1c08b68942ff070e6bb341c Mon Sep 17 00:00:00 2001 From: nopesled Date: Thu, 7 Jul 2016 17:48:22 +0100 Subject: Update path_helper.php --- system/helpers/path_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index f3757affb..18e175093 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -61,7 +61,7 @@ if ( ! function_exists('set_realpath')) function set_realpath($path, $check_existance = FALSE) { // Security check to make sure the path is NOT a URL. No remote file inclusion! - if (preg_match('#^(http:\/\/|https:\/\/|www\.|ftp|php)#i', $path) OR filter_var($path, FILTER_VALIDATE_IP) === $path ) + if (preg_match('#^(http:\/\/|https:\/\/|www\.|ftp|php:\/\/)#i', $path) OR filter_var($path, FILTER_VALIDATE_IP) === $path ) { show_error('The path you submitted must be a local server path, not a URL'); } -- cgit v1.2.3-24-g4f1b From b6ed3d102dc7c8e2a591405e56aa780d64d385d6 Mon Sep 17 00:00:00 2001 From: Vivek Dinesh Date: Thu, 11 Aug 2016 17:40:45 +0530 Subject: URI schemes are not case-sensitive Signed-off-by: Vivek Dinesh --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index fd7b5e116..82b9e02af 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -443,7 +443,7 @@ if ( ! function_exists('prep_url')) */ function prep_url($str = '') { - if ($str === 'http://' OR $str === '') + if (strtolower($str) === 'http://' OR $str === '') { return ''; } -- cgit v1.2.3-24-g4f1b From 669cc5f881970ec3cc19b57f4da0382c7d8f5542 Mon Sep 17 00:00:00 2001 From: Vivek Dinesh Date: Thu, 11 Aug 2016 18:21:11 +0530 Subject: Removed useless checks Based on GitHub discussion. Signed-off-by: Vivek Dinesh --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 82b9e02af..8a5a75c44 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -443,7 +443,7 @@ if ( ! function_exists('prep_url')) */ function prep_url($str = '') { - if (strtolower($str) === 'http://' OR $str === '') + if ($str === '') { return ''; } -- cgit v1.2.3-24-g4f1b From fd8d3987226bcde81db0682eee9c9acca0beb9a1 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Sun, 25 Sep 2016 19:52:58 +0300 Subject: - captcha helper uses now filemtime to get file timestamp - captcha generated files are a sha1 of current timestamp and word - changed the usage of microtime to time, as this is a more realistic approach Signed-off-by: George Petculescu --- system/helpers/captcha_helper.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 3c1e006f8..c2a1dcfbd 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -105,12 +105,13 @@ if ( ! function_exists('create_captcha')) // Remove old images // ----------------------------------- - $now = microtime(TRUE); + $now = time(); $current_dir = @opendir($img_path); while ($filename = @readdir($current_dir)) { - if (substr($filename, -4) === '.jpg' && (str_replace('.jpg', '', $filename) + $expiration) < $now) + if (in_array(substr($filename, -4), array('.jpg', '.png')) + && (filemtime($img_path.$filename) + $expiration) < $now) { @unlink($img_path.$filename); } @@ -319,12 +320,12 @@ if ( ! function_exists('create_captcha')) if (function_exists('imagejpeg')) { - $img_filename = $now.'.jpg'; + $img_filename = sha1($now.$word).'.jpg'; imagejpeg($im, $img_path.$img_filename); } elseif (function_exists('imagepng')) { - $img_filename = $now.'.png'; + $img_filename = sha1($now.$word).'.png'; imagepng($im, $img_path.$img_filename); } else -- cgit v1.2.3-24-g4f1b From 8d684c23364f2fd28700e0a5ae2e90dd7fab61fe Mon Sep 17 00:00:00 2001 From: Edwin Smulders Date: Tue, 27 Sep 2016 11:02:39 +0200 Subject: Remove inline styles from hidden form input This change fixes console errors when using a CSP header that disables inline styles. --- system/helpers/form_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 8825ecc2c..aa7379f77 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -100,7 +100,7 @@ if ( ! function_exists('form_open')) { foreach ($hidden as $name => $value) { - $form .= ''."\n"; + $form .= ''."\n"; } } -- cgit v1.2.3-24-g4f1b From 6ed047335d216a74162aab488002239235dfe95e Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Tue, 27 Sep 2016 20:07:58 +0300 Subject: - revert --- system/helpers/captcha_helper.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index c2a1dcfbd..3c1e006f8 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -105,13 +105,12 @@ if ( ! function_exists('create_captcha')) // Remove old images // ----------------------------------- - $now = time(); + $now = microtime(TRUE); $current_dir = @opendir($img_path); while ($filename = @readdir($current_dir)) { - if (in_array(substr($filename, -4), array('.jpg', '.png')) - && (filemtime($img_path.$filename) + $expiration) < $now) + if (substr($filename, -4) === '.jpg' && (str_replace('.jpg', '', $filename) + $expiration) < $now) { @unlink($img_path.$filename); } @@ -320,12 +319,12 @@ if ( ! function_exists('create_captcha')) if (function_exists('imagejpeg')) { - $img_filename = sha1($now.$word).'.jpg'; + $img_filename = $now.'.jpg'; imagejpeg($im, $img_path.$img_filename); } elseif (function_exists('imagepng')) { - $img_filename = sha1($now.$word).'.png'; + $img_filename = $now.'.png'; imagepng($im, $img_path.$img_filename); } else -- cgit v1.2.3-24-g4f1b From 89eb04b5f09f4d7fb2d319e417bc188f0ed915d0 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Tue, 27 Sep 2016 20:25:43 +0300 Subject: - captcha helper will now look for .png files too when deleting old files --- system/helpers/captcha_helper.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 3c1e006f8..f6c42b4f7 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -110,7 +110,8 @@ if ( ! function_exists('create_captcha')) $current_dir = @opendir($img_path); while ($filename = @readdir($current_dir)) { - if (substr($filename, -4) === '.jpg' && (str_replace('.jpg', '', $filename) + $expiration) < $now) + if (in_array(substr($filename, -4), array('.jpg', '.png')) + && (str_replace(array('.jpg', '.png'), '', $filename) + $expiration) < $now) { @unlink($img_path.$filename); } -- cgit v1.2.3-24-g4f1b From f394b9e0a764d47532363cae8f3e491718fcf8fa Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Tue, 27 Sep 2016 20:28:24 +0300 Subject: - fixed identation --- system/helpers/captcha_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index f6c42b4f7..f2ff4dccf 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -111,7 +111,7 @@ if ( ! function_exists('create_captcha')) while ($filename = @readdir($current_dir)) { if (in_array(substr($filename, -4), array('.jpg', '.png')) - && (str_replace(array('.jpg', '.png'), '', $filename) + $expiration) < $now) + && (str_replace(array('.jpg', '.png'), '', $filename) + $expiration) < $now) { @unlink($img_path.$filename); } -- cgit v1.2.3-24-g4f1b From e36664c07896a9a9ef69daad5dc9f880ea08e5c4 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Thu, 29 Sep 2016 00:01:59 +0300 Subject: - download helper uses better file buffering when the content of a local file is output'd --- system/helpers/download_helper.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index a6463dfd7..3701e0b8b 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -121,11 +121,6 @@ if ( ! function_exists('force_download')) $filename = implode('.', $x); } - if ($data === NULL && ($fp = @fopen($filepath, 'rb')) === FALSE) - { - return; - } - // Clean output buffer if (ob_get_level() !== 0 && @ob_end_clean() === FALSE) { @@ -146,13 +141,12 @@ if ( ! function_exists('force_download')) exit($data); } - // Flush 1MB chunks of data - while ( ! feof($fp) && ($data = fread($fp, 1048576)) !== FALSE) - { - echo $data; - } + // Flush the file + if (@readfile($filepath) === FALSE) + { + return; + } - fclose($fp); exit; } } -- cgit v1.2.3-24-g4f1b From bdf21c4e4cae0c232661f783c2f7070a03a7a912 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Thu, 29 Sep 2016 00:26:46 +0300 Subject: - reverting changes, wrong branch selected. --- system/helpers/download_helper.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 3701e0b8b..a6463dfd7 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -121,6 +121,11 @@ if ( ! function_exists('force_download')) $filename = implode('.', $x); } + if ($data === NULL && ($fp = @fopen($filepath, 'rb')) === FALSE) + { + return; + } + // Clean output buffer if (ob_get_level() !== 0 && @ob_end_clean() === FALSE) { @@ -141,12 +146,13 @@ if ( ! function_exists('force_download')) exit($data); } - // Flush the file - if (@readfile($filepath) === FALSE) - { - return; - } + // Flush 1MB chunks of data + while ( ! feof($fp) && ($data = fread($fp, 1048576)) !== FALSE) + { + echo $data; + } + fclose($fp); exit; } } -- cgit v1.2.3-24-g4f1b From 826b6196b748c2c1ccca0dbb5703fd50c600afa5 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Fri, 30 Sep 2016 21:34:44 +0300 Subject: - download helper uses better file buffering when the content of a local file is output'd --- system/helpers/download_helper.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index a6463dfd7..7f5c2397a 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -121,11 +121,6 @@ if ( ! function_exists('force_download')) $filename = implode('.', $x); } - if ($data === NULL && ($fp = @fopen($filepath, 'rb')) === FALSE) - { - return; - } - // Clean output buffer if (ob_get_level() !== 0 && @ob_end_clean() === FALSE) { @@ -146,13 +141,12 @@ if ( ! function_exists('force_download')) exit($data); } - // Flush 1MB chunks of data - while ( ! feof($fp) && ($data = fread($fp, 1048576)) !== FALSE) + // Flush the file + if (@readfile($filepath) === FALSE) { - echo $data; + return; } - fclose($fp); exit; } } -- cgit v1.2.3-24-g4f1b From 7e302394b21ea16b2dce9c42d4431a180c4a58aa Mon Sep 17 00:00:00 2001 From: René de Kat Date: Mon, 10 Oct 2016 14:46:23 +0100 Subject: Updated list of words that aren't countable Updated list of words that are the same in plural and singular form in English. --- system/helpers/inflector_helper.php | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index c064d8de4..6dc3b5030 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -238,8 +238,37 @@ if ( ! function_exists('is_countable')) return ! in_array( strtolower($word), array( - 'equipment', 'information', 'rice', 'money', - 'species', 'series', 'fish', 'meta' + 'audio', + 'bison', + 'chassis', + 'compensation', + 'coreopsis', + 'data', + 'deer', + 'education', + 'emoji', + 'equipment', + 'fish', + 'furniture', + 'gold', + 'information', + 'knowledge', + 'love', + 'rain', + 'money', + 'moose', + 'nutrition', + 'offspring', + 'plankton', + 'pokemon', + 'police', + 'rice', + 'series', + 'sheep', + 'species', + 'swine', + 'traffic', + 'wheat', ) ); } -- cgit v1.2.3-24-g4f1b From d933c9eb04752496124ef4a5f5df6ffbaf0a1d87 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Thu, 20 Oct 2016 00:52:50 +0300 Subject: added ordinal_format() to Number helper; added to docs the info. --- system/helpers/number_helper.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'system/helpers') diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index e7810c706..8e77c91ab 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -92,3 +92,32 @@ if ( ! function_exists('byte_format')) return number_format($num, $precision).' '.$unit; } } + +// ------------------------------------------------------------------------ + +if ( ! function_exists('ordinal_format')) +{ + /** + * Returns the English ordinal numeral for a given number + * + * @param int $number + * @return string + */ + function ordinal_format($number) + { + if ( ! is_int($number) OR $number < 1) + { + return FALSE; + } + + $ends = array('th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th'); + if ((($number % 100) >= 11) && (($number % 100) <= 13)) + { + return $number.'th'; + } + else + { + return $number.$ends[$number % 10]; + } + } +} -- cgit v1.2.3-24-g4f1b From 433ebc5814cda44a93664812f28e030f61732564 Mon Sep 17 00:00:00 2001 From: gxgpet Date: Thu, 20 Oct 2016 11:54:19 +0300 Subject: Accepting strings too, 0 allowed. --- system/helpers/number_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index 8e77c91ab..d7b96c322 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -105,7 +105,7 @@ if ( ! function_exists('ordinal_format')) */ function ordinal_format($number) { - if ( ! is_int($number) OR $number < 1) + if ( ! is_numeric($number) OR $number < 0) { return FALSE; } -- cgit v1.2.3-24-g4f1b From 7534aa85c2c8a4359f6df0a6f421fb15ca981877 Mon Sep 17 00:00:00 2001 From: gxgpet Date: Thu, 20 Oct 2016 12:19:48 +0300 Subject: small refactorisations --- system/helpers/number_helper.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index d7b96c322..e94a5ffbc 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -110,14 +110,24 @@ if ( ! function_exists('ordinal_format')) return FALSE; } - $ends = array('th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th'); + $last_digit = array( + 0 => 'th', + 1 => 'st', + 2 => 'nd', + 3 => 'rd', + 4 => 'th', + 5 => 'th', + 6 => 'th', + 7 => 'th', + 8 => 'th', + 9 => 'th'); if ((($number % 100) >= 11) && (($number % 100) <= 13)) { return $number.'th'; } else { - return $number.$ends[$number % 10]; + return $number.$last_digit[$number % 10]; } } } -- cgit v1.2.3-24-g4f1b From 1ff88001bead0ff4187a5b121d9d36a25a45c313 Mon Sep 17 00:00:00 2001 From: gxgpet Date: Thu, 20 Oct 2016 12:21:05 +0300 Subject: fixed floating for ordinal_format() --- system/helpers/number_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index e94a5ffbc..af8b70f86 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -105,7 +105,7 @@ if ( ! function_exists('ordinal_format')) */ function ordinal_format($number) { - if ( ! is_numeric($number) OR $number < 0) + if ( ! ctype_digit((string) $number) OR $number < 0) { return FALSE; } -- cgit v1.2.3-24-g4f1b From 7de46d4d99017b42ba172cebff8998163ee6295f Mon Sep 17 00:00:00 2001 From: gxgpet Date: Thu, 20 Oct 2016 12:31:44 +0300 Subject: fixed coding style + removal of extra paranthesis --- system/helpers/number_helper.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index af8b70f86..20e262e66 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -120,8 +120,9 @@ if ( ! function_exists('ordinal_format')) 6 => 'th', 7 => 'th', 8 => 'th', - 9 => 'th'); - if ((($number % 100) >= 11) && (($number % 100) <= 13)) + 9 => 'th' + ); + if (($number % 100) >= 11 && ($number % 100) <= 13) { return $number.'th'; } -- cgit v1.2.3-24-g4f1b From 11954d2521475f6964bfa9c65dcd2f3e53a65af5 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Thu, 20 Oct 2016 20:53:11 +0300 Subject: moved ordinal_format() helper function from Number helper to Inflector helper --- system/helpers/inflector_helper.php | 40 +++++++++++++++++++++++++++++++++++ system/helpers/number_helper.php | 42 +------------------------------------ 2 files changed, 41 insertions(+), 41 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 6dc3b5030..c71516564 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -273,3 +273,43 @@ if ( ! function_exists('is_countable')) ); } } + +// ------------------------------------------------------------------------ + +if ( ! function_exists('ordinal_format')) +{ + /** + * Returns the English ordinal numeral for a given number + * + * @param int $number + * @return string + */ + function ordinal_format($number) + { + if ( ! ctype_digit((string) $number) OR $number < 0) + { + return FALSE; + } + + $last_digit = array( + 0 => 'th', + 1 => 'st', + 2 => 'nd', + 3 => 'rd', + 4 => 'th', + 5 => 'th', + 6 => 'th', + 7 => 'th', + 8 => 'th', + 9 => 'th' + ); + if (($number % 100) >= 11 && ($number % 100) <= 13) + { + return $number.'th'; + } + else + { + return $number.$last_digit[$number % 10]; + } + } +} \ No newline at end of file diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index 20e262e66..219124cb5 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -91,44 +91,4 @@ if ( ! function_exists('byte_format')) return number_format($num, $precision).' '.$unit; } -} - -// ------------------------------------------------------------------------ - -if ( ! function_exists('ordinal_format')) -{ - /** - * Returns the English ordinal numeral for a given number - * - * @param int $number - * @return string - */ - function ordinal_format($number) - { - if ( ! ctype_digit((string) $number) OR $number < 0) - { - return FALSE; - } - - $last_digit = array( - 0 => 'th', - 1 => 'st', - 2 => 'nd', - 3 => 'rd', - 4 => 'th', - 5 => 'th', - 6 => 'th', - 7 => 'th', - 8 => 'th', - 9 => 'th' - ); - if (($number % 100) >= 11 && ($number % 100) <= 13) - { - return $number.'th'; - } - else - { - return $number.$last_digit[$number % 10]; - } - } -} +} \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 4fe5e99f437fe79cc40cebd08277eb319d8a6095 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Thu, 20 Oct 2016 20:58:10 +0300 Subject: fixed unnecessary file termination for Number helper --- system/helpers/number_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index 219124cb5..e7810c706 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -91,4 +91,4 @@ if ( ! function_exists('byte_format')) return number_format($num, $precision).' '.$unit; } -} \ No newline at end of file +} -- cgit v1.2.3-24-g4f1b From 03a1eac3b7bed8ed6df59109364a3eebe3f1cceb Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Thu, 20 Oct 2016 21:03:38 +0300 Subject: ordinal_format will accept only non-negative natural numbers and return original value on failure + docs update regarding this. --- system/helpers/inflector_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index c71516564..04e178aec 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -286,9 +286,9 @@ if ( ! function_exists('ordinal_format')) */ function ordinal_format($number) { - if ( ! ctype_digit((string) $number) OR $number < 0) + if ( ! ctype_digit((string) $number) OR $number < 1) { - return FALSE; + return $number; } $last_digit = array( -- cgit v1.2.3-24-g4f1b From 25dc0937dd27c6d3c9f4d4483a857c218d6a9dad Mon Sep 17 00:00:00 2001 From: gxgpet Date: Fri, 21 Oct 2016 17:44:03 +0300 Subject: fixed small coding style issues --- system/helpers/inflector_helper.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 04e178aec..83bf28098 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -303,13 +303,12 @@ if ( ! function_exists('ordinal_format')) 8 => 'th', 9 => 'th' ); + if (($number % 100) >= 11 && ($number % 100) <= 13) { return $number.'th'; } - else - { - return $number.$last_digit[$number % 10]; - } + + return $number.$last_digit[$number % 10]; } -} \ No newline at end of file +} -- cgit v1.2.3-24-g4f1b From e7e70c3532f06ac008cfc038791fcb46d4a551ed Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 21 Oct 2016 18:06:26 +0300 Subject: [ci skip] Add changelog entry for PR #4862 --- system/helpers/inflector_helper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 83bf28098..f14f57c54 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -268,7 +268,7 @@ if ( ! function_exists('is_countable')) 'species', 'swine', 'traffic', - 'wheat', + 'wheat' ) ); } @@ -303,12 +303,12 @@ if ( ! function_exists('ordinal_format')) 8 => 'th', 9 => 'th' ); - + if (($number % 100) >= 11 && ($number % 100) <= 13) { return $number.'th'; } - + return $number.$last_digit[$number % 10]; } } -- cgit v1.2.3-24-g4f1b From c867754cbb2260efeaa25ff9c339989807e8c713 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Mon, 31 Oct 2016 01:38:18 +0200 Subject: download helper should be able to offer a download by reading a local file and also a custom destination filename. --- system/helpers/download_helper.php | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index a6463dfd7..289ea199a 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -56,7 +56,7 @@ if ( ! function_exists('force_download')) * * Generates headers that force a download to happen * - * @param string filename + * @param mixed filename (or an array of local file path => destination filename) * @param mixed the data to be downloaded * @param bool whether to try and send the actual file MIME type * @return void @@ -69,14 +69,28 @@ if ( ! function_exists('force_download')) } elseif ($data === NULL) { - if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE) + // Is $filename an array as ['local source path' => 'destination filename']? + if(is_array($filename)) { - return; - } + $filepath = key($filename); + $filename = current($filename); - $filepath = $filename; - $filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename)); - $filename = end($filename); + if ( ! @is_file($filepath) OR ($filesize = @filesize($filepath)) === FALSE) + { + return; + } + } + else + { + if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE) + { + return; + } + + $filepath = $filename; + $filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename)); + $filename = end($filename); + } } else { -- cgit v1.2.3-24-g4f1b From 214a537e4df19f3885943604c1b8a49c3f64993d Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Mon, 31 Oct 2016 01:42:41 +0200 Subject: single entry restriction if $filename is an array --- system/helpers/download_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 289ea199a..a1d149f91 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -70,7 +70,7 @@ if ( ! function_exists('force_download')) elseif ($data === NULL) { // Is $filename an array as ['local source path' => 'destination filename']? - if(is_array($filename)) + if(is_array($filename) && count($filename) === 1) { $filepath = key($filename); $filename = current($filename); -- cgit v1.2.3-24-g4f1b From c953c128649e06bb1a3594e56459cf14bdb6e048 Mon Sep 17 00:00:00 2001 From: George PETCULESCU Date: Mon, 31 Oct 2016 14:06:48 +0200 Subject: fixed coding style --- system/helpers/download_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index a1d149f91..32ee773bb 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -70,7 +70,7 @@ if ( ! function_exists('force_download')) elseif ($data === NULL) { // Is $filename an array as ['local source path' => 'destination filename']? - if(is_array($filename) && count($filename) === 1) + if(is_array($filename) && count($filename)) { $filepath = key($filename); $filename = current($filename); -- cgit v1.2.3-24-g4f1b From b907c8ad41dfb4a9394b3a73182f0abf7fe14f94 Mon Sep 17 00:00:00 2001 From: George PETCULESCU Date: Mon, 31 Oct 2016 14:08:36 +0200 Subject: fixed coding style (2) --- system/helpers/download_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 32ee773bb..9158272ef 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -70,7 +70,7 @@ if ( ! function_exists('force_download')) elseif ($data === NULL) { // Is $filename an array as ['local source path' => 'destination filename']? - if(is_array($filename) && count($filename)) + if(is_array($filename) && count($filename) == 1) { $filepath = key($filename); $filename = current($filename); -- cgit v1.2.3-24-g4f1b From 627b050e89ea3e9794e7ad03c28aeb770417357a Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Tue, 1 Nov 2016 08:16:47 +0200 Subject: if download helper receives a numeric array now it won't work --- system/helpers/download_helper.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 9158272ef..4bab69005 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -75,6 +75,11 @@ if ( ! function_exists('force_download')) $filepath = key($filename); $filename = current($filename); + if(is_int($filepath)) + { + return; + } + if ( ! @is_file($filepath) OR ($filesize = @filesize($filepath)) === FALSE) { return; -- cgit v1.2.3-24-g4f1b From 54a1138a864a9d2d3ce7ef6d4b9d22df86440bb5 Mon Sep 17 00:00:00 2001 From: gxgpet Date: Tue, 1 Nov 2016 10:44:32 +0200 Subject: Fixed coding style (this time for real) --- system/helpers/download_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 4bab69005..eb714c1ff 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -70,12 +70,12 @@ if ( ! function_exists('force_download')) elseif ($data === NULL) { // Is $filename an array as ['local source path' => 'destination filename']? - if(is_array($filename) && count($filename) == 1) + if (is_array($filename) && count($filename) == 1) { $filepath = key($filename); $filename = current($filename); - if(is_int($filepath)) + if (is_int($filepath)) { return; } -- cgit v1.2.3-24-g4f1b From 3e86cc27d531e15c7d7dc7c606f87e1694272f92 Mon Sep 17 00:00:00 2001 From: George PETCULESCU Date: Tue, 1 Nov 2016 14:02:46 +0200 Subject: fixed when $filename is an array with a different count than 1. --- system/helpers/download_helper.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index eb714c1ff..43c3924a3 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -70,8 +70,13 @@ if ( ! function_exists('force_download')) elseif ($data === NULL) { // Is $filename an array as ['local source path' => 'destination filename']? - if (is_array($filename) && count($filename) == 1) + if (is_array($filename)) { + if (count($filename) != 1) + { + return; + } + $filepath = key($filename); $filename = current($filename); -- cgit v1.2.3-24-g4f1b From 49407be71a80d67151a296be25fff2468c68ab55 Mon Sep 17 00:00:00 2001 From: George PETCULESCU Date: Tue, 1 Nov 2016 16:10:59 +0200 Subject: strict comparison of 1. --- system/helpers/download_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 43c3924a3..9619c61b1 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -72,7 +72,7 @@ if ( ! function_exists('force_download')) // Is $filename an array as ['local source path' => 'destination filename']? if (is_array($filename)) { - if (count($filename) != 1) + if (count($filename) !== 1) { return; } -- cgit v1.2.3-24-g4f1b From b226bccb2f748e252b75595c497ab4b3accfe21e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Dec 2016 15:00:02 +0200 Subject: Remove previously deprecated Email Helper --- system/helpers/email_helper.php | 84 ----------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 system/helpers/email_helper.php (limited to 'system/helpers') diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php deleted file mode 100644 index 35944fc7b..000000000 --- a/system/helpers/email_helper.php +++ /dev/null @@ -1,84 +0,0 @@ - Date: Thu, 1 Dec 2016 15:08:11 +0200 Subject: Remove previously deprecated Date Helper function standard_date() --- system/helpers/date_helper.php | 40 ---------------------------------------- 1 file changed, 40 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 0606a4562..1f8e319ca 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -122,46 +122,6 @@ if ( ! function_exists('mdate')) // ------------------------------------------------------------------------ -if ( ! function_exists('standard_date')) -{ - /** - * Standard Date - * - * Returns a date formatted according to the submitted standard. - * - * As of PHP 5.2, the DateTime extension provides constants that - * serve for the exact same purpose and are used with date(). - * - * @todo Remove in version 3.1+. - * @deprecated 3.0.0 Use PHP's native date() instead. - * @link http://www.php.net/manual/en/class.datetime.php#datetime.constants.types - * - * @example date(DATE_RFC822, now()); // default - * @example date(DATE_W3C, $time); // a different format and time - * - * @param string $fmt = 'DATE_RFC822' the chosen format - * @param int $time = NULL Unix timestamp - * @return string - */ - function standard_date($fmt = 'DATE_RFC822', $time = NULL) - { - if (empty($time)) - { - $time = now(); - } - - // Procedural style pre-defined constants from the DateTime extension - if (strpos($fmt, 'DATE_') !== 0 OR defined($fmt) === FALSE) - { - return FALSE; - } - - return date(constant($fmt), $time); - } -} - -// ------------------------------------------------------------------------ - if ( ! function_exists('timespan')) { /** -- cgit v1.2.3-24-g4f1b From 0c84ef9a33d18d758e36447fd18a240a458ae2bc Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Dec 2016 15:12:35 +0200 Subject: Remove previously deprecated Security Helper function do_hash() --- system/helpers/security_helper.php | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 4eb63883d..048f06b68 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -80,30 +80,6 @@ if ( ! function_exists('sanitize_filename')) } } -// -------------------------------------------------------------------- - -if ( ! function_exists('do_hash')) -{ - /** - * Hash encode a string - * - * @todo Remove in version 3.1+. - * @deprecated 3.0.0 Use PHP's native hash() instead. - * @param string $str - * @param string $type = 'sha1' - * @return string - */ - function do_hash($str, $type = 'sha1') - { - if ( ! in_array(strtolower($type), hash_algos())) - { - $type = 'md5'; - } - - return hash($type, $str); - } -} - // ------------------------------------------------------------------------ if ( ! function_exists('strip_image_tags')) -- cgit v1.2.3-24-g4f1b From 5e47aa3d87b44627bd79850536bfacd8d39a92a6 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Dec 2016 15:18:46 +0200 Subject: Remove previously deprecated HTML helper functions br(), nbs() --- system/helpers/html_helper.php | 34 ---------------------------------- 1 file changed, 34 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 696f0eee2..22ef39c2e 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -389,37 +389,3 @@ if ( ! function_exists('meta')) return $str; } } - -// ------------------------------------------------------------------------ - -if ( ! function_exists('br')) -{ - /** - * Generates HTML BR tags based on number supplied - * - * @deprecated 3.0.0 Use str_repeat() instead - * @param int $count Number of times to repeat the tag - * @return string - */ - function br($count = 1) - { - return str_repeat('
', $count); - } -} - -// ------------------------------------------------------------------------ - -if ( ! function_exists('nbs')) -{ - /** - * Generates non-breaking space entities based on number supplied - * - * @deprecated 3.0.0 Use str_repeat() instead - * @param int - * @return string - */ - function nbs($num = 1) - { - return str_repeat(' ', $num); - } -} -- cgit v1.2.3-24-g4f1b From 41091ba2fd3005d4a387ee17bfd7520475028627 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Dec 2016 15:25:25 +0200 Subject: Remove previously deprecates String Helper functions trim_slashes(), repeater() --- system/helpers/string_helper.php | 47 ---------------------------------------- 1 file changed, 47 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index db531fa9a..62b1a18e0 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -49,33 +49,6 @@ defined('BASEPATH') OR exit('No direct script access allowed'); // ------------------------------------------------------------------------ -if ( ! function_exists('trim_slashes')) -{ - /** - * Trim Slashes - * - * Removes any leading/trailing slashes from a string: - * - * /this/that/theother/ - * - * becomes: - * - * this/that/theother - * - * @todo Remove in version 3.1+. - * @deprecated 3.0.0 This is just an alias for PHP's native trim() - * - * @param string - * @return string - */ - function trim_slashes($str) - { - return trim($str, '/'); - } -} - -// ------------------------------------------------------------------------ - if ( ! function_exists('strip_slashes')) { /** @@ -284,23 +257,3 @@ if ( ! function_exists('alternator')) return $args[($i++ % count($args))]; } } - -// ------------------------------------------------------------------------ - -if ( ! function_exists('repeater')) -{ - /** - * Repeater function - * - * @todo Remove in version 3.1+. - * @deprecated 3.0.0 This is just an alias for PHP's native str_repeat() - * - * @param string $data String to repeat - * @param int $num Number of repeats - * @return string - */ - function repeater($data, $num = 1) - { - return ($num > 0) ? str_repeat($data, $num) : ''; - } -} -- cgit v1.2.3-24-g4f1b From 172f949370bb1498789c7d897fdaa4073388ebd5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Dec 2016 15:28:41 +0200 Subject: Remove previously deprecated File Helper function read_file() --- system/helpers/file_helper.php | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 3cb36a551..484bf3228 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -49,26 +49,6 @@ defined('BASEPATH') OR exit('No direct script access allowed'); // ------------------------------------------------------------------------ -if ( ! function_exists('read_file')) -{ - /** - * Read File - * - * Opens the file specified in the path and returns it as a string. - * - * @todo Remove in version 3.1+. - * @deprecated 3.0.0 It is now just an alias for PHP's native file_get_contents(). - * @param string $file Path to file - * @return string File contents - */ - function read_file($file) - { - return @file_get_contents($file); - } -} - -// ------------------------------------------------------------------------ - if ( ! function_exists('write_file')) { /** -- cgit v1.2.3-24-g4f1b From 37c4cc599698da0634d620665491fc27e9a36beb Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Dec 2016 15:33:42 +0200 Subject: Remove previously deprecated Form Helper function form_prep() --- system/helpers/form_helper.php | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index aa7379f77..9756437ae 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -653,25 +653,6 @@ if ( ! function_exists('form_close')) // ------------------------------------------------------------------------ -if ( ! function_exists('form_prep')) -{ - /** - * Form Prep - * - * Formats text so that it can be safely placed in a form field in the event it has HTML tags. - * - * @deprecated 3.0.0 An alias for html_escape() - * @param string|string[] $str Value to escape - * @return string|string[] Escaped values - */ - function form_prep($str) - { - return html_escape($str, TRUE); - } -} - -// ------------------------------------------------------------------------ - if ( ! function_exists('set_value')) { /** -- cgit v1.2.3-24-g4f1b From d2e4ccfe3bba903227c3686b9390d8b9525b197d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 12 Dec 2016 15:15:39 +0200 Subject: Remove previously deprecated Smiley Helper --- system/helpers/smiley_helper.php | 255 --------------------------------------- 1 file changed, 255 deletions(-) delete mode 100644 system/helpers/smiley_helper.php (limited to 'system/helpers') diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php deleted file mode 100644 index 688ca24c2..000000000 --- a/system/helpers/smiley_helper.php +++ /dev/null @@ -1,255 +0,0 @@ -field_id pairs - * @param string field_id if alias name was passed in - * @param bool - * @return array - */ - function smiley_js($alias = '', $field_id = '', $inline = TRUE) - { - static $do_setup = TRUE; - $r = ''; - - if ($alias !== '' && ! is_array($alias)) - { - $alias = array($alias => $field_id); - } - - if ($do_setup === TRUE) - { - $do_setup = FALSE; - $m = array(); - - if (is_array($alias)) - { - foreach ($alias as $name => $id) - { - $m[] = '"'.$name.'" : "'.$id.'"'; - } - } - - $m = '{'.implode(',', $m).'}'; - - $r .= << $id) - { - $r .= 'smiley_map["'.$name.'"] = "'.$id."\";\n"; - } - } - - return ($inline) - ? '' - : $r; - } -} - -// ------------------------------------------------------------------------ - -if ( ! function_exists('get_clickable_smileys')) -{ - /** - * Get Clickable Smileys - * - * Returns an array of image tag links that can be clicked to be inserted - * into a form field. - * - * @param string the URL to the folder containing the smiley images - * @param array - * @return array - */ - function get_clickable_smileys($image_url, $alias = '') - { - // For backward compatibility with js_insert_smiley - if (is_array($alias)) - { - $smileys = $alias; - } - elseif (FALSE === ($smileys = _get_smiley_array())) - { - return FALSE; - } - - // Add a trailing slash to the file path if needed - $image_url = rtrim($image_url, '/').'/'; - - $used = array(); - foreach ($smileys as $key => $val) - { - // Keep duplicates from being used, which can happen if the - // mapping array contains multiple identical replacements. For example: - // :-) and :) might be replaced with the same image so both smileys - // will be in the array. - if (isset($used[$smileys[$key][0]])) - { - continue; - } - - $link[] = ''.$smileys[$key][3].''; - $used[$smileys[$key][0]] = TRUE; - } - - return $link; - } -} - -// ------------------------------------------------------------------------ - -if ( ! function_exists('parse_smileys')) -{ - /** - * Parse Smileys - * - * Takes a string as input and swaps any contained smileys for the actual image - * - * @param string the text to be parsed - * @param string the URL to the folder containing the smiley images - * @param array - * @return string - */ - function parse_smileys($str = '', $image_url = '', $smileys = NULL) - { - if ($image_url === '' OR ( ! is_array($smileys) && FALSE === ($smileys = _get_smiley_array()))) - { - return $str; - } - - // Add a trailing slash to the file path if needed - $image_url = rtrim($image_url, '/').'/'; - - foreach ($smileys as $key => $val) - { - $str = str_replace($key, ''.$smileys[$key][3].'', $str); - } - - return $str; - } -} - -// ------------------------------------------------------------------------ - -if ( ! function_exists('_get_smiley_array')) -{ - /** - * Get Smiley Array - * - * Fetches the config/smiley.php file - * - * @return mixed - */ - function _get_smiley_array() - { - static $_smileys; - - if ( ! is_array($_smileys)) - { - if (file_exists(APPPATH.'config/smileys.php')) - { - include(APPPATH.'config/smileys.php'); - } - - if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php')) - { - include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'); - } - - if (empty($smileys) OR ! is_array($smileys)) - { - $_smileys = array(); - return FALSE; - } - - $_smileys = $smileys; - } - - return $_smileys; - } -} -- cgit v1.2.3-24-g4f1b From 4e0c208f24b0755c47905e17b82854c538a0c530 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 14 Dec 2016 13:23:06 +0200 Subject: Remove 'global_xss_filtering' config setting --- system/helpers/cookie_helper.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index ca4324495..f8943fde3 100644 --- a/system/helpers/cookie_helper.php +++ b/system/helpers/cookie_helper.php @@ -85,9 +85,8 @@ if ( ! function_exists('get_cookie')) * @param bool * @return mixed */ - function get_cookie($index, $xss_clean = NULL) + function get_cookie($index, $xss_clean = FALSE) { - is_bool($xss_clean) OR $xss_clean = (config_item('global_xss_filtering') === TRUE); $prefix = isset($_COOKIE[$index]) ? '' : config_item('cookie_prefix'); return get_instance()->input->cookie($prefix.$index, $xss_clean); } -- cgit v1.2.3-24-g4f1b From a299f56629c764afd8909c90ca3bb36625e84109 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 14 Dec 2016 14:09:27 +0200 Subject: Remove dead parameter from form_upload() Close #3558 --- system/helpers/form_helper.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 9756437ae..496fc1055 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -244,11 +244,10 @@ if ( ! function_exists('form_upload')) * Identical to the input function but adds the "file" type * * @param mixed - * @param string * @param mixed * @return string */ - function form_upload($data = '', $value = '', $extra = '') + function form_upload($data = '', $extra = '') { $defaults = array('type' => 'file', 'name' => ''); is_array($data) OR $data = array('name' => $data); -- cgit v1.2.3-24-g4f1b From 8d369209b9c1db8cf3fe06bba54441ca84a8d6e4 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Thu, 15 Dec 2016 23:17:16 +0100 Subject: Small code simplification in character_limiter() --- system/helpers/text_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 4f9210f2d..e54ed04e1 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -102,7 +102,7 @@ if ( ! function_exists('character_limiter')) } // a bit complicated, but faster than preg_replace with \s+ - $str = preg_replace('/ {2,}/', ' ', str_replace(array("\r", "\n", "\t", "\x0B", "\x0C"), ' ', $str)); + $str = preg_replace('/ {2,}/', ' ', str_replace(array("\r", "\n", "\t", "\v", "\f"), ' ', $str)); if (mb_strlen($str) <= $n) { -- cgit v1.2.3-24-g4f1b From fced25f5728ce81fe810216fcaa4ccec7523f6c9 Mon Sep 17 00:00:00 2001 From: Master Yoda Date: Sat, 31 Dec 2016 08:46:18 -0800 Subject: Update copyright data to 2017 --- system/helpers/array_helper.php | 4 ++-- system/helpers/captcha_helper.php | 4 ++-- system/helpers/cookie_helper.php | 4 ++-- system/helpers/date_helper.php | 4 ++-- system/helpers/directory_helper.php | 4 ++-- system/helpers/download_helper.php | 4 ++-- system/helpers/file_helper.php | 4 ++-- system/helpers/form_helper.php | 4 ++-- system/helpers/html_helper.php | 4 ++-- system/helpers/inflector_helper.php | 4 ++-- system/helpers/language_helper.php | 4 ++-- system/helpers/number_helper.php | 4 ++-- system/helpers/path_helper.php | 4 ++-- system/helpers/security_helper.php | 4 ++-- system/helpers/string_helper.php | 4 ++-- system/helpers/text_helper.php | 4 ++-- system/helpers/typography_helper.php | 4 ++-- system/helpers/url_helper.php | 4 ++-- system/helpers/xml_helper.php | 4 ++-- 19 files changed, 38 insertions(+), 38 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php index 3fdccf909..74c7c15a8 100644 --- a/system/helpers/array_helper.php +++ b/system/helpers/array_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index f2ff4dccf..8f44806cc 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index f8943fde3..30b475ce6 100644 --- a/system/helpers/cookie_helper.php +++ b/system/helpers/cookie_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 1f8e319ca..799c9f6d2 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php index cdc4c16bc..2785241e6 100644 --- a/system/helpers/directory_helper.php +++ b/system/helpers/directory_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 9619c61b1..b9a0e6be9 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 484bf3228..6af632b07 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 496fc1055..9844c752a 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 22ef39c2e..b5e8ed783 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index f14f57c54..49e2a53db 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php index 3721164b7..d26cf5b8d 100644 --- a/system/helpers/language_helper.php +++ b/system/helpers/language_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index e7810c706..cc8a7760c 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index 6c846a211..6896cb97b 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 048f06b68..72736fa7d 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index 62b1a18e0..311f7a420 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index e54ed04e1..07c01c3af 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php index 928cb6d04..183e117bf 100644 --- a/system/helpers/typography_helper.php +++ b/system/helpers/typography_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 8a5a75c44..99e82ef9f 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php index 3489da91c..a12ee25db 100644 --- a/system/helpers/xml_helper.php +++ b/system/helpers/xml_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b From 806e014ec46f739398d7510b07be62593e0c3377 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 4 Jan 2017 17:19:30 +0200 Subject: Close #4904 --- system/helpers/cookie_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index 30b475ce6..d069cdb15 100644 --- a/system/helpers/cookie_helper.php +++ b/system/helpers/cookie_helper.php @@ -59,7 +59,7 @@ if ( ! function_exists('set_cookie')) * * @param mixed * @param string the value of the cookie - * @param string the number of seconds until expiration + * @param int the number of seconds until expiration * @param string the cookie domain. Usually: .yourdomain.com * @param string the cookie path * @param string the cookie prefix @@ -67,7 +67,7 @@ if ( ! function_exists('set_cookie')) * @param bool true makes the cookie accessible via http(s) only (no javascript) * @return void */ - function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = FALSE, $httponly = FALSE) + function set_cookie($name, $value = '', $expire = 0, $domain = '', $path = '/', $prefix = '', $secure = FALSE, $httponly = FALSE) { // Set the config file options get_instance()->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure, $httponly); -- cgit v1.2.3-24-g4f1b From cd78f072773bc670eb8ec13f2a3bff1d926d7b61 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 6 Jan 2017 12:50:58 +0200 Subject: [ci skip] A cosmetic change to the PR #4251 --- system/helpers/captcha_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 442a915ef..a79904c35 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -68,6 +68,7 @@ if ( ! function_exists('create_captcha')) 'img_url' => '', 'img_width' => '150', 'img_height' => '30', + 'img_alt' => 'captcha' 'font_path' => '', 'expiration' => 7200, 'word_length' => 8, @@ -79,8 +80,7 @@ if ( ! function_exists('create_captcha')) 'border' => array(153,102,102), 'text' => array(204,153,153), 'grid' => array(255,182,182) - ), - 'img_alt' => 'captcha' + ) ); foreach ($defaults as $key => $val) -- cgit v1.2.3-24-g4f1b From f41b4e33d1d5fe8d17b3d572b9676b0fdfedc8f7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 16 Jan 2017 12:03:38 +0200 Subject: [ci skip] Fix #4985 --- system/helpers/captcha_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index a79904c35..f98d8a4cd 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -68,7 +68,7 @@ if ( ! function_exists('create_captcha')) 'img_url' => '', 'img_width' => '150', 'img_height' => '30', - 'img_alt' => 'captcha' + 'img_alt' => 'captcha', 'font_path' => '', 'expiration' => 7200, 'word_length' => 8, -- cgit v1.2.3-24-g4f1b From b27e4451ee2ae65581f3245971155927c75d6ec7 Mon Sep 17 00:00:00 2001 From: Zach Ploskey Date: Mon, 13 Feb 2017 16:21:37 -0800 Subject: Don't duplicate is_file and filesize checks Move duplicate is_file and file_size checks out of if/else branches. Signed-off-by: Zach Ploskey --- system/helpers/download_helper.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index ea3da1bf4..7500bc827 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -84,23 +84,18 @@ if ( ! function_exists('force_download')) { return; } - - if ( ! @is_file($filepath) OR ($filesize = @filesize($filepath)) === FALSE) - { - return; - } } else { - if ( ! @is_file($filename) OR ($filesize = @filesize($filename)) === FALSE) - { - return; - } - $filepath = $filename; $filename = explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $filename)); $filename = end($filename); } + + if ( ! @is_file($filepath) OR ($filesize = @filesize($filepath)) === FALSE) + { + return; + } } else { -- cgit v1.2.3-24-g4f1b From 0b9d5c35e46eff9e8d19f66047eff88067bdcf4a Mon Sep 17 00:00:00 2001 From: vlakoff Date: Wed, 15 Feb 2017 19:17:20 +0100 Subject: Do not fail if the array pointer is after the element --- system/helpers/download_helper.php | 1 + 1 file changed, 1 insertion(+) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 7500bc827..b2f0edb48 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -77,6 +77,7 @@ if ( ! function_exists('force_download')) return; } + reset($filename); $filepath = key($filename); $filename = current($filename); -- cgit v1.2.3-24-g4f1b From 583e9a073c3c91b6938644a1eaf5393466047cdf Mon Sep 17 00:00:00 2001 From: Fatih Turan Date: Sat, 6 May 2017 18:42:07 +0300 Subject: quizzes singular is doesnt work. --- system/helpers/inflector_helper.php | 1 + 1 file changed, 1 insertion(+) (limited to 'system/helpers') diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 49e2a53db..9e3cc38bc 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -95,6 +95,7 @@ if ( ! function_exists('singular')) '/(s)tatuses$/' => '\1\2tatus', '/(c)hildren$/' => '\1\2hild', '/(n)ews$/' => '\1\2ews', + '/(quiz)zes$/' => '\1', '/([^us])s$/' => '\1' ); -- cgit v1.2.3-24-g4f1b From a785a4f2d1c8137ac82062d5b52cf7b6f575a72f Mon Sep 17 00:00:00 2001 From: aroche Date: Wed, 24 May 2017 15:30:05 +0200 Subject: fix bad attribute handling of form_label When passing a string for extra attributes in form_label helper function, these attributes were skipped. --- system/helpers/form_helper.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 4a4a7c89f..6f7e63b32 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -609,13 +609,7 @@ if ( ! function_exists('form_label')) $label .= ' for="'.$id.'"'; } - if (is_array($attributes) && count($attributes) > 0) - { - foreach ($attributes as $key => $val) - { - $label .= ' '.$key.'="'.$val.'"'; - } - } + $label .= _attributes_to_string($attributes); return $label.'>'.$label_text.''; } -- cgit v1.2.3-24-g4f1b From 3e59801223f1393507d81e9f394c4f5ae33e1c04 Mon Sep 17 00:00:00 2001 From: Uekawa Date: Fri, 29 Sep 2017 15:10:41 +0900 Subject: Fix auto_link --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 system/helpers/url_helper.php (limited to 'system/helpers') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php old mode 100644 new mode 100755 index 99e82ef9f..421b3bad5 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -393,7 +393,7 @@ if ( ! function_exists('auto_link')) function auto_link($str, $type = 'both', $popup = FALSE) { // Find and replace any URLs. - if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) + if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w/?#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { // Set our target HTML if using popup links. $target = ($popup) ? ' target="_blank"' : ''; -- cgit v1.2.3-24-g4f1b From db92b5b336cbc6603f613916bde55940c9c24a05 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 29 Sep 2017 12:02:06 +0300 Subject: [ci skip] Revert file permission change from PR #5278 --- system/helpers/url_helper.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 system/helpers/url_helper.php (limited to 'system/helpers') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php old mode 100755 new mode 100644 -- cgit v1.2.3-24-g4f1b From 0ef93646615516ae2bc87e54894708adaa29700f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 7 Nov 2017 15:30:36 +0200 Subject: Implement data:image URIs in CAPTCHA helper Also, switched to PNG by default and dropped JPEG; refactored image files GC. Close #5200 --- system/helpers/captcha_helper.php | 74 ++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 28 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index f98d8a4cd..1da4a923b 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -70,9 +70,9 @@ if ( ! function_exists('create_captcha')) 'img_height' => '30', 'img_alt' => 'captcha', 'font_path' => '', + 'font_size' => 16, 'expiration' => 7200, 'word_length' => 8, - 'font_size' => 16, 'img_id' => '', 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'colors' => array( @@ -95,30 +95,41 @@ if ( ! function_exists('create_captcha')) } } - if ($img_path === '' OR $img_url === '' - OR ! is_dir($img_path) OR ! is_really_writable($img_path) - OR ! extension_loaded('gd')) + if ( ! extension_loaded('gd')) { return FALSE; } - // ----------------------------------- - // Remove old images - // ----------------------------------- + if ($img_url !== '' OR $img_path !== '') + { + if ($img_path === '' OR $img_url === '' OR ! is_dir($img_path) OR ! is_really_writable($img_path)) + { + return FALSE; + } - $now = microtime(TRUE); + /** + * Remove old images + */ + $now = microtime(TRUE); - $current_dir = @opendir($img_path); - while ($filename = @readdir($current_dir)) - { - if (in_array(substr($filename, -4), array('.jpg', '.png')) - && (str_replace(array('.jpg', '.png'), '', $filename) + $expiration) < $now) + $current_dir = @opendir($img_path); + while ($filename = @readdir($current_dir)) { - @unlink($img_path.$filename); + if (preg_match('#^(?\d{10})\.png$#', $filename, $match) && ($match['ts'] + $expiration) < $now) + { + @unlink($img_path.$filename); + } } - } - @closedir($current_dir); + @closedir($current_dir); + + // This variable will later be used later to determine whether we write to disk or output a data:image URI + $img_filename = $now.'.png'; + } + else + { + $img_filename = NULL; + } // ----------------------------------- // Do we have a "word" yet? @@ -228,8 +239,8 @@ if ( ! function_exists('create_captcha')) // Determine angle and position // ----------------------------------- $length = strlen($word); - $angle = ($length >= 6) ? mt_rand(-($length-6), ($length-6)) : 0; - $x_axis = mt_rand(6, (360/$length)-16); + $angle = ($length >= 6) ? mt_rand(-($length - 6), ($length - 6)) : 0; + $x_axis = mt_rand(6, (360 / $length)-16); $y_axis = ($angle >= 0) ? mt_rand($img_height, $img_width) : mt_rand(6, $img_height); // Create image @@ -317,24 +328,31 @@ if ( ! function_exists('create_captcha')) // ----------------------------------- // Generate the image // ----------------------------------- - $img_url = rtrim($img_url, '/').'/'; - if (function_exists('imagejpeg')) - { - $img_filename = $now.'.jpg'; - imagejpeg($im, $img_path.$img_filename); - } - elseif (function_exists('imagepng')) + if (isset($img_filename)) { - $img_filename = $now.'.png'; + $img_src = rtrim($img_url, '/').'/'.$img_filename; imagepng($im, $img_path.$img_filename); } else { - return FALSE; + // I don't see an easier way to get the image contents without writing to file + $buffer = fopen('php://memory', 'wb+'); + imagepng($im, $buffer); + rewind($buffer); + $img_src = ''; + + // fread() will return an empty string (not FALSE) after the entire contents are read + while (strlen($read = fread($buffer, 4096))) + { + $img_src .= $read; + } + + fclose($buffer); + $img_src = 'data:image/png;base64,'.base64_encode($img_src); } - $img = ''.$img_alt.''; + $img = ''.$img_alt.''; ImageDestroy($im); return array('word' => $word, 'time' => $now, 'image' => $img, 'filename' => $img_filename); -- cgit v1.2.3-24-g4f1b From 208381009ed12768478b2e8110bfb6e506acc3e1 Mon Sep 17 00:00:00 2001 From: Master Yoda Date: Tue, 9 Jan 2018 00:53:27 -0800 Subject: Annual copyright update --- system/helpers/array_helper.php | 4 ++-- system/helpers/captcha_helper.php | 4 ++-- system/helpers/cookie_helper.php | 4 ++-- system/helpers/date_helper.php | 4 ++-- system/helpers/directory_helper.php | 4 ++-- system/helpers/download_helper.php | 4 ++-- system/helpers/file_helper.php | 4 ++-- system/helpers/form_helper.php | 4 ++-- system/helpers/html_helper.php | 4 ++-- system/helpers/inflector_helper.php | 4 ++-- system/helpers/language_helper.php | 4 ++-- system/helpers/number_helper.php | 4 ++-- system/helpers/path_helper.php | 4 ++-- system/helpers/security_helper.php | 4 ++-- system/helpers/string_helper.php | 4 ++-- system/helpers/text_helper.php | 4 ++-- system/helpers/typography_helper.php | 4 ++-- system/helpers/url_helper.php | 4 ++-- system/helpers/xml_helper.php | 4 ++-- 19 files changed, 38 insertions(+), 38 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php index 74c7c15a8..3d4a496be 100644 --- a/system/helpers/array_helper.php +++ b/system/helpers/array_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 214e7f8fc..875ff23b4 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index a1a9324ff..4c7b826ab 100644 --- a/system/helpers/cookie_helper.php +++ b/system/helpers/cookie_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 799c9f6d2..b62803785 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php index 2785241e6..0d3f20572 100644 --- a/system/helpers/directory_helper.php +++ b/system/helpers/directory_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index b2f0edb48..02d4ce11e 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 6af632b07..9ce43f3ef 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 0c7ee4a40..1e516ebce 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 93ba2dd7d..c935f2619 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 9e3cc38bc..547e4602e 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php index d26cf5b8d..f1dc8151d 100644 --- a/system/helpers/language_helper.php +++ b/system/helpers/language_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index cc8a7760c..00e645136 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index 6896cb97b..697f6bd19 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 72736fa7d..f79f317bd 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index 896973704..b51ab48f4 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 217729b70..3e2dca8a2 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php index 183e117bf..e97c83ba6 100644 --- a/system/helpers/typography_helper.php +++ b/system/helpers/typography_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 2e09534f5..e5d2d372f 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php index a12ee25db..68fb9d762 100644 --- a/system/helpers/xml_helper.php +++ b/system/helpers/xml_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2017, British Columbia Institute of Technology + * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b From 459eaa897191cceb674820a6a9e2630f7ca1350f Mon Sep 17 00:00:00 2001 From: Mehdi Bounya <5004111+mehdibo@users.noreply.github.com> Date: Sun, 28 Jan 2018 19:29:29 +0000 Subject: Added rel attribute to auto_link() Fixed security issue: allowing the target page to take control of the original page Details about the issue here: https://mathiasbynens.github.io/rel-noopener/ --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index e5d2d372f..3eb2cb0b0 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -396,7 +396,7 @@ if ( ! function_exists('auto_link')) if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[a-z0-9]+(-+[a-z0-9]+)*(\.[a-z0-9]+(-+[a-z0-9]+)*)+(/([^\s()<>;]+\w)?/?)?#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { // Set our target HTML if using popup links. - $target = ($popup) ? ' target="_blank"' : ''; + $target = ($popup) ? ' target="_blank" rel="noopener"' : ''; // We process the links in reverse order (last -> first) so that // the returned string offsets from preg_match_all() are not -- cgit v1.2.3-24-g4f1b From 719e4acbafecbef3f143affb45a8dcd90945dd04 Mon Sep 17 00:00:00 2001 From: ytetsuro Date: Tue, 30 Jan 2018 01:43:48 +0900 Subject: fix rfc6266 --- system/helpers/download_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 02d4ce11e..338725477 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -149,7 +149,7 @@ if ( ! function_exists('force_download')) // Generate the server headers header('Content-Type: '.$mime); - header('Content-Disposition: attachment; filename="'.$filename.'"'); + header('Content-Disposition: attachment; filename="'.$filename.'"; filename*=UTF-8\'\''.rawurlencode($filename)); header('Expires: 0'); header('Content-Transfer-Encoding: binary'); header('Content-Length: '.$filesize); -- cgit v1.2.3-24-g4f1b From a3e36019c787eb87fd0bc2e5ba9948c85c4a2c44 Mon Sep 17 00:00:00 2001 From: ytetsuro Date: Thu, 1 Feb 2018 11:38:00 +0900 Subject: change filename. convert to utf-8 --- system/helpers/download_helper.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 338725477..93d468421 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -147,9 +147,24 @@ if ( ! function_exists('force_download')) @ob_clean(); } + $utf8_filename = $filename; + $encoding = config_item('charset'); + if (strtoupper($encoding) !== 'UTF-8') + { + if (MB_ENABLED) + { + $utf8_filename = mb_convert_encoding($utf8_filename, 'UTF-8', $encoding); + } + elseif (ICONV_ENABLED) + { + $utf8_filename = @iconv($encoding, 'UTF-8', $utf8_filename); + } + } + // Generate the server headers header('Content-Type: '.$mime); - header('Content-Disposition: attachment; filename="'.$filename.'"; filename*=UTF-8\'\''.rawurlencode($filename)); + // charset attribute (RFC 6266 only allows UTF-8) + header('Content-Disposition: attachment; filename="'.$filename.'"; filename*=UTF-8\'\''.rawurlencode($utf8_filename)); header('Expires: 0'); header('Content-Transfer-Encoding: binary'); header('Content-Length: '.$filesize); -- cgit v1.2.3-24-g4f1b From c755a6b0b32b58c86989e5c6cfd8085732b1e497 Mon Sep 17 00:00:00 2001 From: ytetsuro Date: Thu, 1 Feb 2018 11:50:36 +0900 Subject: refactor use Utf8 class --- system/helpers/download_helper.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 93d468421..a169c3fd5 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -151,13 +151,10 @@ if ( ! function_exists('force_download')) $encoding = config_item('charset'); if (strtoupper($encoding) !== 'UTF-8') { - if (MB_ENABLED) + $CI =& get_instance(); + if ($converted_filename = $CI->utf8->convert_to_utf8($utf8_filename, $encoding) ) { - $utf8_filename = mb_convert_encoding($utf8_filename, 'UTF-8', $encoding); - } - elseif (ICONV_ENABLED) - { - $utf8_filename = @iconv($encoding, 'UTF-8', $utf8_filename); + $utf8_filename = $converted_filename; } } -- cgit v1.2.3-24-g4f1b From a70cdc5a9ed9e181e9f76fdc94006f3cc20198cd Mon Sep 17 00:00:00 2001 From: ytetsuro Date: Mon, 5 Feb 2018 22:44:56 +0900 Subject: change use direct convert_to_utf8 method --- system/helpers/download_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index a169c3fd5..fdca76830 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -151,8 +151,8 @@ if ( ! function_exists('force_download')) $encoding = config_item('charset'); if (strtoupper($encoding) !== 'UTF-8') { - $CI =& get_instance(); - if ($converted_filename = $CI->utf8->convert_to_utf8($utf8_filename, $encoding) ) + $converted_filename = get_instance()->utf8->convert_to_utf8($utf8_filename, $encoding); + if ($converted_filename) { $utf8_filename = $converted_filename; } -- cgit v1.2.3-24-g4f1b From e5d719d822646a7c0bcd1a2732eb8fe19357444a Mon Sep 17 00:00:00 2001 From: ytetsuro Date: Mon, 5 Feb 2018 23:04:17 +0900 Subject: Determine exactly whether converted filename is false --- system/helpers/download_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index fdca76830..344fd4e9a 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -152,7 +152,7 @@ if ( ! function_exists('force_download')) if (strtoupper($encoding) !== 'UTF-8') { $converted_filename = get_instance()->utf8->convert_to_utf8($utf8_filename, $encoding); - if ($converted_filename) + if ($converted_filename !== FALSE) { $utf8_filename = $converted_filename; } -- cgit v1.2.3-24-g4f1b From 4dc34279cdc19b7a1df3385b1f679aeac6767c89 Mon Sep 17 00:00:00 2001 From: ytetsuro Date: Mon, 5 Feb 2018 23:05:50 +0900 Subject: change variable name --- system/helpers/download_helper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 344fd4e9a..afdb77956 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -148,10 +148,10 @@ if ( ! function_exists('force_download')) } $utf8_filename = $filename; - $encoding = config_item('charset'); - if (strtoupper($encoding) !== 'UTF-8') + $charset = config_item('charset'); + if (strtoupper($charset) !== 'UTF-8') { - $converted_filename = get_instance()->utf8->convert_to_utf8($utf8_filename, $encoding); + $converted_filename = get_instance()->utf8->convert_to_utf8($utf8_filename, $charset); if ($converted_filename !== FALSE) { $utf8_filename = $converted_filename; -- cgit v1.2.3-24-g4f1b From 8f04f20b0f63ace705e4371a24d0ddf139655dba Mon Sep 17 00:00:00 2001 From: ytetsuro Date: Tue, 6 Feb 2018 00:01:45 +0900 Subject: Changed to include Content-Disposition parameters in variables --- system/helpers/download_helper.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index afdb77956..43e12cf9e 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -147,21 +147,21 @@ if ( ! function_exists('force_download')) @ob_clean(); } - $utf8_filename = $filename; + $disposition = 'attachment; filename="'.$filename.'";'; $charset = config_item('charset'); if (strtoupper($charset) !== 'UTF-8') { - $converted_filename = get_instance()->utf8->convert_to_utf8($utf8_filename, $charset); - if ($converted_filename !== FALSE) + // charset attribute (RFC 6266 only allows UTF-8) + $utf8_filename = get_instance()->utf8->convert_to_utf8($filename, $charset); + if ($utf8_filename !== FALSE) { - $utf8_filename = $converted_filename; + $disposition .= ' filename*=UTF-8\'\''.rawurlencode($utf8_filename); } } // Generate the server headers header('Content-Type: '.$mime); - // charset attribute (RFC 6266 only allows UTF-8) - header('Content-Disposition: attachment; filename="'.$filename.'"; filename*=UTF-8\'\''.rawurlencode($utf8_filename)); + header('Content-Disposition: '.$disposition); header('Expires: 0'); header('Content-Transfer-Encoding: binary'); header('Content-Length: '.$filesize); -- cgit v1.2.3-24-g4f1b From 43538863b7bdd52529c38ad314ffc0f9edbbaa8b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 7 Feb 2018 17:49:07 +0200 Subject: [ci skip] Finalize changes from PR #5394 --- system/helpers/download_helper.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 43e12cf9e..b7a5336b6 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -147,21 +147,26 @@ if ( ! function_exists('force_download')) @ob_clean(); } - $disposition = 'attachment; filename="'.$filename.'";'; - $charset = config_item('charset'); - if (strtoupper($charset) !== 'UTF-8') + // RFC 6266 allows for multibyte filenames, but only in UTF-8, + // so we have to make it conditional ... + $utf8_filename = $filename; + $charset = strtoupper(config_item('charset')); + if ($charset !== 'UTF-8') { - // charset attribute (RFC 6266 only allows UTF-8) - $utf8_filename = get_instance()->utf8->convert_to_utf8($filename, $charset); - if ($utf8_filename !== FALSE) - { - $disposition .= ' filename*=UTF-8\'\''.rawurlencode($utf8_filename); - } + $utf8_filename = (UTF8_ENABLED === TRUE) + ? get_instance()->utf8->convert_to_utf8($filename, $charset) + : FALSE; + } + else + { + $utf8_filename = $filename; } + isset($utf8_filename[0]) && $utf8_filename = " filename*=UTF-8''".rawurlencode($utf8_filename); + // Generate the server headers header('Content-Type: '.$mime); - header('Content-Disposition: '.$disposition); + header('Content-Disposition: attachment; filename="'.$filename.'";'.$utf8_filename); header('Expires: 0'); header('Content-Transfer-Encoding: binary'); header('Content-Length: '.$filesize); -- cgit v1.2.3-24-g4f1b From ff1029018a8e5ba7261cdfb71fb3d102c3efc22b Mon Sep 17 00:00:00 2001 From: ytetsuro Date: Thu, 8 Feb 2018 22:08:23 +0900 Subject: Fixed bug that character code did not change --- system/helpers/download_helper.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index b7a5336b6..a2e28a6e9 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -153,9 +153,7 @@ if ( ! function_exists('force_download')) $charset = strtoupper(config_item('charset')); if ($charset !== 'UTF-8') { - $utf8_filename = (UTF8_ENABLED === TRUE) - ? get_instance()->utf8->convert_to_utf8($filename, $charset) - : FALSE; + $utf8_filename = get_instance()->utf8->convert_to_utf8($filename, $charset); } else { -- cgit v1.2.3-24-g4f1b From c82f3236069fae1f21a0900b026d346752d089c9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 12 Feb 2018 14:31:20 +0200 Subject: [ci skip] More polish on the download helper --- system/helpers/download_helper.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index a2e28a6e9..000e4c707 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -149,17 +149,10 @@ if ( ! function_exists('force_download')) // RFC 6266 allows for multibyte filenames, but only in UTF-8, // so we have to make it conditional ... - $utf8_filename = $filename; $charset = strtoupper(config_item('charset')); - if ($charset !== 'UTF-8') - { - $utf8_filename = get_instance()->utf8->convert_to_utf8($filename, $charset); - } - else - { - $utf8_filename = $filename; - } - + $utf8_filename = ($charset !== 'UTF-8') + ? $utf8_filename = get_instance()->utf8->convert_to_utf8($filename, $charset) + : $filename; isset($utf8_filename[0]) && $utf8_filename = " filename*=UTF-8''".rawurlencode($utf8_filename); // Generate the server headers -- cgit v1.2.3-24-g4f1b From b7ca09f989ae344682395d16402bcf07062dd655 Mon Sep 17 00:00:00 2001 From: ytetsuro Date: Wed, 14 Feb 2018 16:32:41 +0900 Subject: Delete unnecessary assignment expressions --- system/helpers/download_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 000e4c707..901e3277c 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -151,7 +151,7 @@ if ( ! function_exists('force_download')) // so we have to make it conditional ... $charset = strtoupper(config_item('charset')); $utf8_filename = ($charset !== 'UTF-8') - ? $utf8_filename = get_instance()->utf8->convert_to_utf8($filename, $charset) + ? get_instance()->utf8->convert_to_utf8($filename, $charset) : $filename; isset($utf8_filename[0]) && $utf8_filename = " filename*=UTF-8''".rawurlencode($utf8_filename); -- cgit v1.2.3-24-g4f1b From 52a87e506d4fc70bd5922b07a532852d28f28ab6 Mon Sep 17 00:00:00 2001 From: Mehdi Bounya Date: Thu, 17 May 2018 23:41:30 +0000 Subject: http:// to https:// --- system/helpers/array_helper.php | 4 ++-- system/helpers/captcha_helper.php | 4 ++-- system/helpers/cookie_helper.php | 4 ++-- system/helpers/date_helper.php | 4 ++-- system/helpers/directory_helper.php | 4 ++-- system/helpers/download_helper.php | 4 ++-- system/helpers/file_helper.php | 4 ++-- system/helpers/form_helper.php | 4 ++-- system/helpers/html_helper.php | 4 ++-- system/helpers/inflector_helper.php | 4 ++-- system/helpers/language_helper.php | 4 ++-- system/helpers/number_helper.php | 4 ++-- system/helpers/path_helper.php | 4 ++-- system/helpers/security_helper.php | 4 ++-- system/helpers/string_helper.php | 4 ++-- system/helpers/text_helper.php | 4 ++-- system/helpers/typography_helper.php | 4 ++-- system/helpers/url_helper.php | 8 ++++---- system/helpers/xml_helper.php | 4 ++-- 19 files changed, 40 insertions(+), 40 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php index 3d4a496be..0c2c1e66a 100644 --- a/system/helpers/array_helper.php +++ b/system/helpers/array_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 875ff23b4..b58a19091 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index 4c7b826ab..d19dcfc06 100644 --- a/system/helpers/cookie_helper.php +++ b/system/helpers/cookie_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index b62803785..995cf5ea1 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php index 0d3f20572..0a668adfc 100644 --- a/system/helpers/directory_helper.php +++ b/system/helpers/directory_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 901e3277c..b1a1b0232 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 9ce43f3ef..6d6f7fc51 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 1e516ebce..7383e4cb8 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index c935f2619..0e1e6042c 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 547e4602e..376cac783 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php index f1dc8151d..c6862e812 100644 --- a/system/helpers/language_helper.php +++ b/system/helpers/language_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index 00e645136..68c77b496 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index 697f6bd19..44f750fbf 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index f79f317bd..fb7be1ce8 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index b51ab48f4..5bf387a60 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 3e2dca8a2..46b0faba5 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php index e97c83ba6..867e4fae8 100644 --- a/system/helpers/typography_helper.php +++ b/system/helpers/typography_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 3eb2cb0b0..f99343ff1 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource @@ -211,7 +211,7 @@ if ( ! function_exists('anchor_popup')) { $attributes = array($attributes); - // Ref: http://www.w3schools.com/jsref/met_win_open.asp + // Ref: https://www.w3schools.com/jsref/met_win_open.asp $window_name = '_blank'; } elseif ( ! empty($attributes['window_name'])) @@ -546,7 +546,7 @@ if ( ! function_exists('redirect')) if (isset($_SERVER['SERVER_PROTOCOL'], $_SERVER['REQUEST_METHOD']) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1') { $code = ($_SERVER['REQUEST_METHOD'] !== 'GET') - ? 303 // reference: http://en.wikipedia.org/wiki/Post/Redirect/Get + ? 303 // reference: https://en.wikipedia.org/wiki/Post/Redirect/Get : 307; } else diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php index 68fb9d762..3ded1a187 100644 --- a/system/helpers/xml_helper.php +++ b/system/helpers/xml_helper.php @@ -29,8 +29,8 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License + * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource -- cgit v1.2.3-24-g4f1b From 605dcbc55ed4dfa1c8fb8ed659dc51b0710ff165 Mon Sep 17 00:00:00 2001 From: William Poetra Yoga <30787981+wpyh@users.noreply.github.com> Date: Wed, 30 May 2018 10:04:01 +0700 Subject: Use Config::base_url() properly Using the Config::slash_item() method, we get double forward slashes. For example, base_url = 'http://localhost:8080/' and asset is '/assets/my_asset.css', then the generated URL would be 'http://localhost:8080//assets/my_asset.css'. This patch fixes that, so the generated URL would be 'http://localhost:8080/assets/my_asset.css'. There is actually already an analog example in the case if index_page === TRUE, where the site_url() function is used. --- system/helpers/html_helper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index c935f2619..985c68c8a 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -200,7 +200,7 @@ if ( ! function_exists('img')) } else { - $img .= ' src="'.get_instance()->config->slash_item('base_url').$v.'"'; + $img .= ' src="'.get_instance()->config->base_url($v).'"'; } } else @@ -292,7 +292,7 @@ if ( ! function_exists('link_tag')) } else { - $link .= 'href="'.$CI->config->slash_item('base_url').$v.'" '; + $link .= 'href="'.$CI->config->base_url($v).'" '; } } else @@ -313,7 +313,7 @@ if ( ! function_exists('link_tag')) } else { - $link .= 'href="'.$CI->config->slash_item('base_url').$href.'" '; + $link .= 'href="'.$CI->config->base_url($href).'" '; } $link .= 'rel="'.$rel.'" type="'.$type.'" '; -- cgit v1.2.3-24-g4f1b From 721e34619f79585cdad92174373edcf2b049931f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 1 Jun 2018 18:07:34 +0300 Subject: [ci skip] Close #5482 --- system/helpers/inflector_helper.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 376cac783..2682649e9 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -63,7 +63,7 @@ if ( ! function_exists('singular')) { $result = strval($str); - if ( ! is_countable($result)) + if ( ! word_is_countable($result)) { return $result; } @@ -128,7 +128,7 @@ if ( ! function_exists('plural')) { $result = strval($str); - if ( ! is_countable($result)) + if ( ! word_is_countable($result)) { return $result; } @@ -226,7 +226,7 @@ if ( ! function_exists('humanize')) // -------------------------------------------------------------------- -if ( ! function_exists('is_countable')) +if ( ! function_exists('word_is_countable')) { /** * Checks if the given word has a plural version. @@ -234,7 +234,7 @@ if ( ! function_exists('is_countable')) * @param string $word Word to check * @return bool */ - function is_countable($word) + function word_is_countable($word) { return ! in_array( strtolower($word), -- cgit v1.2.3-24-g4f1b From 48d617d9fa3ff61bcba85b90d07effc653faeb8d Mon Sep 17 00:00:00 2001 From: Khaled Date: Sun, 9 Dec 2018 14:11:45 -0700 Subject: Add px to width and height for inline style The image's width and height are always more than 0; so, adding "px" after the width and height is necessary for HTML validation. --- system/helpers/captcha_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index b58a19091..f53c90517 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -352,7 +352,7 @@ if ( ! function_exists('create_captcha')) $img_src = 'data:image/png;base64,'.base64_encode($img_src); } - $img = ''.$img_alt.''; + $img = ''.$img_alt.''; ImageDestroy($im); return array('word' => $word, 'time' => $now, 'image' => $img, 'filename' => $img_filename); -- cgit v1.2.3-24-g4f1b From 4478a23f7a43af0f02f5134a23745585fd319c3c Mon Sep 17 00:00:00 2001 From: Paweł Kłopotek-Główczewski Date: Mon, 17 Dec 2018 21:10:44 +0100 Subject: Change comparison operator to assignment, which it should be. --- system/helpers/html_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 3a478bf26..cd430d7fe 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -370,7 +370,7 @@ if ( ! function_exists('meta')) { if ($meta['type'] === 'equiv') { - $meta['type'] === 'http-equiv'; + $meta['type'] = 'http-equiv'; } elseif ( ! in_array($meta['type'], $allowed_types, TRUE)) { -- cgit v1.2.3-24-g4f1b From 8bb638e392f5991c05ec9a1e57b882213844dc6f Mon Sep 17 00:00:00 2001 From: Jim Parry Date: Wed, 26 Dec 2018 21:03:09 -0800 Subject: Update copyright date to 2019 --- system/helpers/array_helper.php | 4 ++-- system/helpers/captcha_helper.php | 4 ++-- system/helpers/cookie_helper.php | 4 ++-- system/helpers/date_helper.php | 4 ++-- system/helpers/directory_helper.php | 4 ++-- system/helpers/download_helper.php | 4 ++-- system/helpers/file_helper.php | 4 ++-- system/helpers/form_helper.php | 4 ++-- system/helpers/html_helper.php | 4 ++-- system/helpers/inflector_helper.php | 4 ++-- system/helpers/language_helper.php | 4 ++-- system/helpers/number_helper.php | 4 ++-- system/helpers/path_helper.php | 4 ++-- system/helpers/security_helper.php | 4 ++-- system/helpers/string_helper.php | 4 ++-- system/helpers/text_helper.php | 4 ++-- system/helpers/typography_helper.php | 4 ++-- system/helpers/url_helper.php | 4 ++-- system/helpers/xml_helper.php | 4 ++-- 19 files changed, 38 insertions(+), 38 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php index 0c2c1e66a..cb7eca68b 100644 --- a/system/helpers/array_helper.php +++ b/system/helpers/array_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index f53c90517..c3ecf9079 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index d19dcfc06..d9724932e 100644 --- a/system/helpers/cookie_helper.php +++ b/system/helpers/cookie_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 995cf5ea1..6ee3c3119 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php index 0a668adfc..73777bfb5 100644 --- a/system/helpers/directory_helper.php +++ b/system/helpers/directory_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index b1a1b0232..4d7829640 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 6d6f7fc51..ebc863bbc 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 7383e4cb8..7a2dadaf3 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 3a478bf26..ca9e7f923 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 2682649e9..04f2ac9d2 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php index c6862e812..2cefcc277 100644 --- a/system/helpers/language_helper.php +++ b/system/helpers/language_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index 68c77b496..15a53ff72 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index 44f750fbf..543e4c078 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index fb7be1ce8..dcf5b8b58 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index 5bf387a60..7738bf97f 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 46b0faba5..e1c5e246e 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php index 867e4fae8..d308a57d5 100644 --- a/system/helpers/typography_helper.php +++ b/system/helpers/typography_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index f99343ff1..6a959f0e6 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php index 3ded1a187..2639956fe 100644 --- a/system/helpers/xml_helper.php +++ b/system/helpers/xml_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2018, British Columbia Institute of Technology + * Copyright (c) 2014 - 2019, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b From 67563c64025085e61598a83fef3e25bef38b32c4 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 8 Jan 2019 16:48:01 +0200 Subject: [ci skip] Fix #5674 --- system/helpers/captcha_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index c3ecf9079..94365adb5 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -83,6 +83,8 @@ if ( ! function_exists('create_captcha')) ) ); + $now = microtime(TRUE); + foreach ($defaults as $key => $val) { if ( ! is_array($data) && empty($$key)) @@ -110,8 +112,6 @@ if ( ! function_exists('create_captcha')) /** * Remove old images */ - $now = microtime(TRUE); - $current_dir = @opendir($img_path); while ($filename = @readdir($current_dir)) { -- cgit v1.2.3-24-g4f1b From 98baf38d5384b316fc443f764d01041c8912d31e Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Sun, 8 Sep 2019 15:58:36 +0300 Subject: improve create_captcha logging --- system/helpers/captcha_helper.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 94365adb5..ca9b86540 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -99,13 +99,19 @@ if ( ! function_exists('create_captcha')) if ( ! extension_loaded('gd')) { + log_message('error', 'create_captcha(): GD extension is not loaded.'); return FALSE; } if ($img_url !== '' OR $img_path !== '') { - if ($img_path === '' OR $img_url === '' OR ! is_dir($img_path) OR ! is_really_writable($img_path)) + if ($img_path === '' OR $img_url === '') { + log_message('error', 'create_captcha(): "img_path" and "img_url" are required.'); + return FALSE; + } elseif ( ! is_dir($img_path) OR ! is_really_writable($img_path)) + { + log_message('error', "create_captcha(): '$img_path' is not a dir, nor it's writable."); return FALSE; } -- cgit v1.2.3-24-g4f1b From 25931b0d5e639cf48dd8488b46975787ee5e5ed2 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Sun, 22 Sep 2019 20:56:55 +0300 Subject: if+elseif => if + if --- system/helpers/captcha_helper.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index ca9b86540..4552225ef 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -109,7 +109,9 @@ if ( ! function_exists('create_captcha')) { log_message('error', 'create_captcha(): "img_path" and "img_url" are required.'); return FALSE; - } elseif ( ! is_dir($img_path) OR ! is_really_writable($img_path)) + } + + if ( ! is_dir($img_path) OR ! is_really_writable($img_path)) { log_message('error', "create_captcha(): '$img_path' is not a dir, nor it's writable."); return FALSE; -- cgit v1.2.3-24-g4f1b From 24ff922ccb2cd647f997a7bc074d8863ea34fb10 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Sun, 22 Sep 2019 20:57:54 +0300 Subject: adding $img_path in curly; fixing words order --- system/helpers/captcha_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 4552225ef..a71148c97 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -113,7 +113,7 @@ if ( ! function_exists('create_captcha')) if ( ! is_dir($img_path) OR ! is_really_writable($img_path)) { - log_message('error', "create_captcha(): '$img_path' is not a dir, nor it's writable."); + log_message('error', "create_captcha(): '{$img_path}' is not a dir, nor is it writable."); return FALSE; } -- cgit v1.2.3-24-g4f1b From 6c6742cfe6b259e4e675b77c5e42c4e21dbd5104 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Sun, 22 Sep 2019 21:04:41 +0300 Subject: adding $ to var names in the log message --- system/helpers/captcha_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index a71148c97..1d87b80e5 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -107,7 +107,7 @@ if ( ! function_exists('create_captcha')) { if ($img_path === '' OR $img_url === '') { - log_message('error', 'create_captcha(): "img_path" and "img_url" are required.'); + log_message('error', 'create_captcha(): "$img_path" and "$img_url" are required.'); return FALSE; } -- cgit v1.2.3-24-g4f1b From fa5ab87854124729e83b33470fec1030a61d1b97 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Tue, 8 Oct 2019 10:11:47 +0300 Subject: removes double quotes --- system/helpers/captcha_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 1d87b80e5..642ff3a50 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -107,7 +107,7 @@ if ( ! function_exists('create_captcha')) { if ($img_path === '' OR $img_url === '') { - log_message('error', 'create_captcha(): "$img_path" and "$img_url" are required.'); + log_message('error', 'create_captcha(): $img_path and $img_url are required.'); return FALSE; } -- cgit v1.2.3-24-g4f1b From 2a80014590526ceaca427d9f9c1f5260b7b0de13 Mon Sep 17 00:00:00 2001 From: Francisco Javier Llanquipichun Garcia Date: Sat, 25 Jan 2020 12:51:09 -0300 Subject: inserted required attribute in html tag Signed-off-by: Francisco Javier Llanquipichun Garcia --- system/helpers/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/index.html b/system/helpers/index.html index b702fbc39..bcb7cae34 100644 --- a/system/helpers/index.html +++ b/system/helpers/index.html @@ -1,5 +1,5 @@ - + 403 Forbidden -- cgit v1.2.3-24-g4f1b From 6ba0207160f8f2b99c79dd285bccf45f574ec660 Mon Sep 17 00:00:00 2001 From: sapics Date: Wed, 24 Jun 2020 11:51:36 +0900 Subject: Fix user guide url Replace from https://codeigniter.com/user_guide/* to https://codeigniter.com/userguide3/* --- system/helpers/array_helper.php | 2 +- system/helpers/captcha_helper.php | 2 +- system/helpers/cookie_helper.php | 2 +- system/helpers/date_helper.php | 2 +- system/helpers/directory_helper.php | 2 +- system/helpers/download_helper.php | 2 +- system/helpers/file_helper.php | 2 +- system/helpers/form_helper.php | 2 +- system/helpers/html_helper.php | 2 +- system/helpers/inflector_helper.php | 2 +- system/helpers/language_helper.php | 2 +- system/helpers/number_helper.php | 2 +- system/helpers/path_helper.php | 2 +- system/helpers/security_helper.php | 2 +- system/helpers/string_helper.php | 2 +- system/helpers/text_helper.php | 2 +- system/helpers/typography_helper.php | 2 +- system/helpers/url_helper.php | 2 +- system/helpers/xml_helper.php | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php index cb7eca68b..2c359240a 100644 --- a/system/helpers/array_helper.php +++ b/system/helpers/array_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/array_helper.html + * @link https://codeigniter.com/userguide3/helpers/array_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index dcd6882c8..f178903b2 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/captcha_helper.html + * @link https://codeigniter.com/userguide3/helpers/captcha_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index d9724932e..8183e0541 100644 --- a/system/helpers/cookie_helper.php +++ b/system/helpers/cookie_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/cookie_helper.html + * @link https://codeigniter.com/userguide3/helpers/cookie_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 6ee3c3119..db9e9642d 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/date_helper.html + * @link https://codeigniter.com/userguide3/helpers/date_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php index 73777bfb5..4732db57b 100644 --- a/system/helpers/directory_helper.php +++ b/system/helpers/directory_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/directory_helper.html + * @link https://codeigniter.com/userguide3/helpers/directory_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 4d7829640..9bdeea13d 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/download_helper.html + * @link https://codeigniter.com/userguide3/helpers/download_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index ebc863bbc..398d11afd 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/file_helper.html + * @link https://codeigniter.com/userguide3/helpers/file_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 7a2dadaf3..4b88d3b12 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/form_helper.html + * @link https://codeigniter.com/userguide3/helpers/form_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 8b06e4406..531ae2251 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/html_helper.html + * @link https://codeigniter.com/userguide3/helpers/html_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index a36836b00..b7f472bcc 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/inflector_helper.html + * @link https://codeigniter.com/userguide3/helpers/inflector_helper.html */ // -------------------------------------------------------------------- diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php index 2cefcc277..dff6a6b24 100644 --- a/system/helpers/language_helper.php +++ b/system/helpers/language_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/language_helper.html + * @link https://codeigniter.com/userguide3/helpers/language_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index 15a53ff72..55fa1e5a0 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/number_helper.html + * @link https://codeigniter.com/userguide3/helpers/number_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index 543e4c078..47d10c2f5 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/path_helper.html + * @link https://codeigniter.com/userguide3/helpers/path_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index dcf5b8b58..f6dbafec9 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/security_helper.html + * @link https://codeigniter.com/userguide3/helpers/security_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index 7738bf97f..3a05525db 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/string_helper.html + * @link https://codeigniter.com/userguide3/helpers/string_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index e1c5e246e..5d5a958e2 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/text_helper.html + * @link https://codeigniter.com/userguide3/helpers/text_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php index d308a57d5..47617ffb2 100644 --- a/system/helpers/typography_helper.php +++ b/system/helpers/typography_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/typography_helper.html + * @link https://codeigniter.com/userguide3/helpers/typography_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 6a959f0e6..4c060a203 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/url_helper.html + * @link https://codeigniter.com/userguide3/helpers/url_helper.html */ // ------------------------------------------------------------------------ diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php index 2639956fe..f83f3f544 100644 --- a/system/helpers/xml_helper.php +++ b/system/helpers/xml_helper.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link https://codeigniter.com/user_guide/helpers/xml_helper.html + * @link https://codeigniter.com/userguide3/helpers/xml_helper.html */ // ------------------------------------------------------------------------ -- cgit v1.2.3-24-g4f1b From 324628c27ca82e89d5e3a85034127835d29dd9fc Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 4 Feb 2021 19:49:53 +0200 Subject: [ci skip] Add 'img_class' option to CAPTCHA helper Close #5999 --- system/helpers/captcha_helper.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index f178903b2..6fce05267 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -69,6 +69,7 @@ if ( ! function_exists('create_captcha')) 'img_width' => '150', 'img_height' => '30', 'img_alt' => 'captcha', + 'img_class' => '', 'font_path' => '', 'font_size' => 16, 'expiration' => 7200, @@ -372,7 +373,10 @@ if ( ! function_exists('create_captcha')) $img_src = 'data:image/png;base64,'.base64_encode($img_src); } - $img = ''.$img_alt.''; + $img_class = trim($img_class); + $img_class = (bool) strlen($img_class) ? 'class="'.$img_class.'" ' : ''; + + $img = ''; ImageDestroy($im); return array('word' => $word, 'time' => $now, 'image' => $img, 'filename' => $img_filename); -- cgit v1.2.3-24-g4f1b From e837d3589ba5c5da5daa58f69bdc14447c90bc51 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 5 Jan 2022 23:44:53 +0200 Subject: Drop some previously deprecated functionality --- system/helpers/string_helper.php | 4 +--- system/helpers/url_helper.php | 15 ++------------- 2 files changed, 3 insertions(+), 16 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index 3a05525db..5b359f730 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -170,7 +170,7 @@ if ( ! function_exists('random_string')) /** * Create a "Random" String * - * @param string type of random string. basic, alpha, alnum, numeric, nozero, unique, md5, encrypt and sha1 + * @param string type of random string. basic, alpha, alnum, numeric, nozero, md5 and sha1 * @param int number of characters * @return string */ @@ -200,10 +200,8 @@ if ( ! function_exists('random_string')) break; } return substr(str_shuffle(str_repeat($pool, ceil($len / strlen($pool)))), 0, $len); - case 'unique': // todo: remove in 3.1+ case 'md5': return md5(uniqid(mt_rand())); - case 'encrypt': // todo: remove in 3.1+ case 'sha1': return sha1(uniqid(mt_rand(), TRUE)); } diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 4c060a203..17601c40c 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -470,31 +470,20 @@ if ( ! function_exists('url_title')) * human-friendly URL string with a "separator" string * as the word separator. * - * @todo Remove old 'dash' and 'underscore' usage in 3.1+. * @param string $str Input string - * @param string $separator Word separator - * (usually '-' or '_') + * @param string $separator Word separator (usually '-' or '_') * @param bool $lowercase Whether to transform the output string to lowercase * @return string */ function url_title($str, $separator = '-', $lowercase = FALSE) { - if ($separator === 'dash') - { - $separator = '-'; - } - elseif ($separator === 'underscore') - { - $separator = '_'; - } - $q_separator = preg_quote($separator, '#'); $trans = array( '&.+?;' => '', '[^\w\d _-]' => '', '\s+' => $separator, - '('.$q_separator.')+' => $separator + '('.$q_separator.')+' => $separator, ); $str = strip_tags($str); -- cgit v1.2.3-24-g4f1b From aae89a56a3e1b61b6a840dc455657e5e4952cf24 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 6 Jan 2022 00:09:30 +0200 Subject: Drop more deprecated functionality --- system/helpers/captcha_helper.php | 11 +++---- system/helpers/date_helper.php | 66 --------------------------------------- 2 files changed, 4 insertions(+), 73 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 6fce05267..43b98b71f 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -54,13 +54,10 @@ if ( ! function_exists('create_captcha')) /** * Create CAPTCHA * - * @param array $data Data for the CAPTCHA - * @param string $img_path Path to create the image in (deprecated) - * @param string $img_url URL to the CAPTCHA image folder (deprecated) - * @param string $font_path Server path to font (deprecated) - * @return string + * @param array $data Data for the CAPTCHA + * @return array */ - function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '') + function create_captcha($data) { $defaults = array( 'word' => '', @@ -106,7 +103,7 @@ if ( ! function_exists('create_captcha')) if ($img_path === '' OR $img_url === '') { - log_message('error', 'create_captcha(): $img_path and $img_url are required.'); + log_message('error', 'create_captcha(): img_path and img_url are required.'); return FALSE; } diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index db9e9642d..f04bdcc30 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -450,72 +450,6 @@ if ( ! function_exists('human_to_unix')) // ------------------------------------------------------------------------ -if ( ! function_exists('nice_date')) -{ - /** - * Turns many "reasonably-date-like" strings into something - * that is actually useful. This only works for dates after unix epoch. - * - * @deprecated 3.1.3 Use DateTime::createFromFormat($input_format, $input)->format($output_format); - * @param string The terribly formatted date-like string - * @param string Date format to return (same as php date function) - * @return string - */ - function nice_date($bad_date = '', $format = FALSE) - { - if (empty($bad_date)) - { - return 'Unknown'; - } - elseif (empty($format)) - { - $format = 'U'; - } - - // Date like: YYYYMM - if (preg_match('/^\d{6}$/i', $bad_date)) - { - if (in_array(substr($bad_date, 0, 2), array('19', '20'))) - { - $year = substr($bad_date, 0, 4); - $month = substr($bad_date, 4, 2); - } - else - { - $month = substr($bad_date, 0, 2); - $year = substr($bad_date, 2, 4); - } - - return date($format, strtotime($year.'-'.$month.'-01')); - } - - // Date Like: YYYYMMDD - if (preg_match('/^\d{8}$/i', $bad_date, $matches)) - { - return DateTime::createFromFormat('Ymd', $bad_date)->format($format); - } - - // Date Like: MM-DD-YYYY __or__ M-D-YYYY (or anything in between) - if (preg_match('/^(\d{1,2})-(\d{1,2})-(\d{4})$/i', $bad_date, $matches)) - { - return date($format, strtotime($matches[3].'-'.$matches[1].'-'.$matches[2])); - } - - // Any other kind of string, when converted into UNIX time, - // produces "0 seconds after epoc..." is probably bad... - // return "Invalid Date". - if (date('U', strtotime($bad_date)) === '0') - { - return 'Invalid Date'; - } - - // It's probably a valid-ish date format already - return date($format, strtotime($bad_date)); - } -} - -// ------------------------------------------------------------------------ - if ( ! function_exists('timezone_menu')) { /** -- cgit v1.2.3-24-g4f1b From e2caa77d0afa700adf9bfa029c453ea59f1e368d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 8 Jan 2022 21:48:42 +0200 Subject: Fix #92 --- system/helpers/file_helper.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 398d11afd..c3b35d96d 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -227,8 +227,9 @@ if ( ! function_exists('get_dir_file_info')) } elseif ($file[0] !== '.') { - $_filedata[$file] = get_file_info($source_dir.$file); - $_filedata[$file]['relative_path'] = $relative_path; + $filedata = get_dir_file_info($source_dir.$file); + $filedata['relative_path'] = $relative_path; + $_filedata[] = $filedata; } } -- cgit v1.2.3-24-g4f1b From dafbbba4f0ce775b7a70f37ba12ee85b65a941b1 Mon Sep 17 00:00:00 2001 From: Toto Prayogo Date: Fri, 11 Feb 2022 21:30:15 +0700 Subject: whitespaces --- system/helpers/html_helper.php | 1 - 1 file changed, 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 531ae2251..715515199 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -133,7 +133,6 @@ if ( ! function_exists('_list')) // Write the opening list tag .'<'.$type._stringify_attributes($attributes).">\n"; - // Cycle through the list elements. If an array is // encountered we will recursively call _list() -- cgit v1.2.3-24-g4f1b From ca00ea86443d2b1563b0e1b51ce8225bd315e69e Mon Sep 17 00:00:00 2001 From: Mouad Err Date: Tue, 21 Jun 2022 14:15:11 +0100 Subject: Bug Fix: [cookie_helper.php] set_cookie was missing sameSite argument --- system/helpers/cookie_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index 2ea9c2901..0325e3db3 100644 --- a/system/helpers/cookie_helper.php +++ b/system/helpers/cookie_helper.php @@ -68,10 +68,10 @@ if ( ! function_exists('set_cookie')) * @param bool true makes the cookie accessible via http(s) only (no javascript) * @return void */ - function set_cookie($name, $value = '', $expire = 0, $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL) + function set_cookie($name, $value = '', $expire = 0, $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL, $samesite = NULL) { // Set the config file options - get_instance()->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure, $httponly); + get_instance()->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure, $httponly, $samesite); } } -- cgit v1.2.3-24-g4f1b