From 824085200b3362bfe1db1ecce52bf555dd064b57 Mon Sep 17 00:00:00 2001 From: rwillert Date: Tue, 10 Jul 2012 14:02:01 +0300 Subject: Reconnect to PostgreSQL database if connection droped. --- system/database/drivers/postgre/postgre_driver.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 20b78673e..c24c523de 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -132,7 +132,15 @@ class CI_DB_postgre_driver extends CI_DB { */ public function db_pconnect() { - return @pg_pconnect($this->dsn); + $conn = @pg_pconnect($this->dsn); + if ($conn && pg_connection_status($conn) === PGSQL_CONNECTION_BAD) + { + if (pg_ping($conn) === FALSE) + { + return FALSE; + } + } + return $conn; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 0875d69dc7b5138cc40ea2f248024b2a886a0d82 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sun, 15 Jul 2012 18:56:48 +0100 Subject: Changed double quotes to single quotes to meet style guidelines --- system/database/drivers/pdo/pdo_driver.php | 2 +- system/language/english/calendar_lang.php | 90 ++++++++++++------------ system/language/english/email_lang.php | 36 +++++----- system/language/english/form_validation_lang.php | 50 ++++++------- system/language/english/ftp_lang.php | 24 +++---- system/language/english/imglib_lang.php | 36 +++++----- system/language/english/migration_lang.php | 14 ++-- system/language/english/upload_lang.php | 32 ++++----- 8 files changed, 142 insertions(+), 142 deletions(-) diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index b36a3d927..705b16560 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -366,7 +366,7 @@ class CI_DB_pdo_driver extends CI_DB { protected function _update_batch($table, $values, $index, $where = NULL) { $ids = array(); - $where = ($where !== '' && count($where) >=1) ? implode(" ", $where).' AND ' : ''; + $where = ($where !== '' && count($where) >=1) ? implode(' ', $where).' AND ' : ''; foreach ($values as $key => $val) { diff --git a/system/language/english/calendar_lang.php b/system/language/english/calendar_lang.php index b357ca7d6..a70a564e8 100644 --- a/system/language/english/calendar_lang.php +++ b/system/language/english/calendar_lang.php @@ -25,51 +25,51 @@ * @filesource */ -$lang['cal_su'] = "Su"; -$lang['cal_mo'] = "Mo"; -$lang['cal_tu'] = "Tu"; -$lang['cal_we'] = "We"; -$lang['cal_th'] = "Th"; -$lang['cal_fr'] = "Fr"; -$lang['cal_sa'] = "Sa"; -$lang['cal_sun'] = "Sun"; -$lang['cal_mon'] = "Mon"; -$lang['cal_tue'] = "Tue"; -$lang['cal_wed'] = "Wed"; -$lang['cal_thu'] = "Thu"; -$lang['cal_fri'] = "Fri"; -$lang['cal_sat'] = "Sat"; -$lang['cal_sunday'] = "Sunday"; -$lang['cal_monday'] = "Monday"; -$lang['cal_tuesday'] = "Tuesday"; -$lang['cal_wednesday'] = "Wednesday"; -$lang['cal_thursday'] = "Thursday"; -$lang['cal_friday'] = "Friday"; -$lang['cal_saturday'] = "Saturday"; -$lang['cal_jan'] = "Jan"; -$lang['cal_feb'] = "Feb"; -$lang['cal_mar'] = "Mar"; -$lang['cal_apr'] = "Apr"; -$lang['cal_may'] = "May"; -$lang['cal_jun'] = "Jun"; -$lang['cal_jul'] = "Jul"; -$lang['cal_aug'] = "Aug"; -$lang['cal_sep'] = "Sep"; -$lang['cal_oct'] = "Oct"; -$lang['cal_nov'] = "Nov"; -$lang['cal_dec'] = "Dec"; -$lang['cal_january'] = "January"; -$lang['cal_february'] = "February"; -$lang['cal_march'] = "March"; -$lang['cal_april'] = "April"; -$lang['cal_mayl'] = "May"; -$lang['cal_june'] = "June"; -$lang['cal_july'] = "July"; -$lang['cal_august'] = "August"; -$lang['cal_september'] = "September"; -$lang['cal_october'] = "October"; -$lang['cal_november'] = "November"; -$lang['cal_december'] = "December"; +$lang['cal_su'] = 'Su'; +$lang['cal_mo'] = 'Mo'; +$lang['cal_tu'] = 'Tu'; +$lang['cal_we'] = 'We'; +$lang['cal_th'] = 'Th'; +$lang['cal_fr'] = 'Fr'; +$lang['cal_sa'] = 'Sa'; +$lang['cal_sun'] = 'Sun'; +$lang['cal_mon'] = 'Mon'; +$lang['cal_tue'] = 'Tue'; +$lang['cal_wed'] = 'Wed'; +$lang['cal_thu'] = 'Thu'; +$lang['cal_fri'] = 'Fri'; +$lang['cal_sat'] = 'Sat'; +$lang['cal_sunday'] = 'Sunday'; +$lang['cal_monday'] = 'Monday'; +$lang['cal_tuesday'] = 'Tuesday'; +$lang['cal_wednesday'] = 'Wednesday'; +$lang['cal_thursday'] = 'Thursday'; +$lang['cal_friday'] = 'Friday'; +$lang['cal_saturday'] = 'Saturday'; +$lang['cal_jan'] = 'Jan'; +$lang['cal_feb'] = 'Feb'; +$lang['cal_mar'] = 'Mar'; +$lang['cal_apr'] = 'Apr'; +$lang['cal_may'] = 'May'; +$lang['cal_jun'] = 'Jun'; +$lang['cal_jul'] = 'Jul'; +$lang['cal_aug'] = 'Aug'; +$lang['cal_sep'] = 'Sep'; +$lang['cal_oct'] = 'Oct'; +$lang['cal_nov'] = 'Nov'; +$lang['cal_dec'] = 'Dec'; +$lang['cal_january'] = 'January'; +$lang['cal_february'] = 'February'; +$lang['cal_march'] = 'March'; +$lang['cal_april'] = 'April'; +$lang['cal_mayl'] = 'May'; +$lang['cal_june'] = 'June'; +$lang['cal_july'] = 'July'; +$lang['cal_august'] = 'August'; +$lang['cal_september'] = 'September'; +$lang['cal_october'] = 'October'; +$lang['cal_november'] = 'November'; +$lang['cal_december'] = 'December'; /* End of file calendar_lang.php */ /* Location: ./system/language/english/calendar_lang.php */ \ No newline at end of file diff --git a/system/language/english/email_lang.php b/system/language/english/email_lang.php index 1d736ecbf..0de9aa27e 100644 --- a/system/language/english/email_lang.php +++ b/system/language/english/email_lang.php @@ -25,24 +25,24 @@ * @filesource */ -$lang['email_must_be_array'] = "The email validation method must be passed an array."; -$lang['email_invalid_address'] = "Invalid email address: %s"; -$lang['email_attachment_missing'] = "Unable to locate the following email attachment: %s"; -$lang['email_attachment_unreadable'] = "Unable to open this attachment: %s"; -$lang['email_no_recipients'] = "You must include recipients: To, Cc, or Bcc"; -$lang['email_send_failure_phpmail'] = "Unable to send email using PHP mail(). Your server might not be configured to send mail using this method."; -$lang['email_send_failure_sendmail'] = "Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method."; -$lang['email_send_failure_smtp'] = "Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method."; -$lang['email_sent'] = "Your message has been successfully sent using the following protocol: %s"; -$lang['email_no_socket'] = "Unable to open a socket to Sendmail. Please check settings."; -$lang['email_no_hostname'] = "You did not specify a SMTP hostname."; -$lang['email_smtp_error'] = "The following SMTP error was encountered: %s"; -$lang['email_no_smtp_unpw'] = "Error: You must assign a SMTP username and password."; -$lang['email_failed_smtp_login'] = "Failed to send AUTH LOGIN command. Error: %s"; -$lang['email_smtp_auth_un'] = "Failed to authenticate username. Error: %s"; -$lang['email_smtp_auth_pw'] = "Failed to authenticate password. Error: %s"; -$lang['email_smtp_data_failure'] = "Unable to send data: %s"; -$lang['email_exit_status'] = "Exit status code: %s"; +$lang['email_must_be_array'] = 'The email validation method must be passed an array.'; +$lang['email_invalid_address'] = 'Invalid email address: %s'; +$lang['email_attachment_missing'] = 'Unable to locate the following email attachment: %s'; +$lang['email_attachment_unreadable'] = 'Unable to open this attachment: %s'; +$lang['email_no_recipients'] = 'You must include recipients: To, Cc, or Bcc'; +$lang['email_send_failure_phpmail'] = 'Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.'; +$lang['email_send_failure_sendmail'] = 'Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method.'; +$lang['email_send_failure_smtp'] = 'Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.'; +$lang['email_sent'] = 'Your message has been successfully sent using the following protocol: %s'; +$lang['email_no_socket'] = 'Unable to open a socket to Sendmail. Please check settings.'; +$lang['email_no_hostname'] = 'You did not specify a SMTP hostname.'; +$lang['email_smtp_error'] = 'The following SMTP error was encountered: %s'; +$lang['email_no_smtp_unpw'] = 'Error: You must assign a SMTP username and password.'; +$lang['email_failed_smtp_login'] = 'Failed to send AUTH LOGIN command. Error: %s'; +$lang['email_smtp_auth_un'] = 'Failed to authenticate username. Error: %s'; +$lang['email_smtp_auth_pw'] = 'Failed to authenticate password. Error: %s'; +$lang['email_smtp_data_failure'] = 'Unable to send data: %s'; +$lang['email_exit_status'] = 'Exit status code: %s'; /* End of file email_lang.php */ /* Location: ./system/language/english/email_lang.php */ \ No newline at end of file diff --git a/system/language/english/form_validation_lang.php b/system/language/english/form_validation_lang.php index 149a62d71..021776161 100644 --- a/system/language/english/form_validation_lang.php +++ b/system/language/english/form_validation_lang.php @@ -25,31 +25,31 @@ * @filesource */ -$lang['required'] = "The %s field is required."; -$lang['isset'] = "The %s field must have a value."; -$lang['valid_email'] = "The %s field must contain a valid email address."; -$lang['valid_emails'] = "The %s field must contain all valid email addresses."; -$lang['valid_url'] = "The %s field must contain a valid URL."; -$lang['valid_ip'] = "The %s field must contain a valid IP."; -$lang['min_length'] = "The %s field must be at least %s characters in length."; -$lang['max_length'] = "The %s field cannot exceed %s characters in length."; -$lang['exact_length'] = "The %s field must be exactly %s characters in length."; -$lang['alpha'] = "The %s field may only contain alphabetical characters."; -$lang['alpha_numeric'] = "The %s field may only contain alpha-numeric characters."; -$lang['alpha_dash'] = "The %s field may only contain alpha-numeric characters, underscores, and dashes."; -$lang['numeric'] = "The %s field must contain only numbers."; -$lang['is_numeric'] = "The %s field must contain only numeric characters."; -$lang['integer'] = "The %s field must contain an integer."; -$lang['regex_match'] = "The %s field is not in the correct format."; -$lang['matches'] = "The %s field does not match the %s field."; -$lang['is_unique'] = "The %s field must contain a unique value."; -$lang['is_natural'] = "The %s field must contain only positive numbers."; -$lang['is_natural_no_zero'] = "The %s field must contain a number greater than zero."; -$lang['decimal'] = "The %s field must contain a decimal number."; -$lang['less_than'] = "The %s field must contain a number less than %s."; -$lang['less_than_equal_to'] = "The %s field must contain a number less than or equal to %s."; -$lang['greater_than'] = "The %s field must contain a number greater than %s."; -$lang['greater_than_equal_to'] = "The %s field must contain a number greater than or equal to %s."; +$lang['required'] = 'The %s field is required.'; +$lang['isset'] = 'The %s field must have a value.'; +$lang['valid_email'] = 'The %s field must contain a valid email address.'; +$lang['valid_emails'] = 'The %s field must contain all valid email addresses.'; +$lang['valid_url'] = 'The %s field must contain a valid URL.'; +$lang['valid_ip'] = 'The %s field must contain a valid IP.'; +$lang['min_length'] = 'The %s field must be at least %s characters in length.'; +$lang['max_length'] = 'The %s field cannot exceed %s characters in length.'; +$lang['exact_length'] = 'The %s field must be exactly %s characters in length.'; +$lang['alpha'] = 'The %s field may only contain alphabetical characters.'; +$lang['alpha_numeric'] = 'The %s field may only contain alpha-numeric characters.'; +$lang['alpha_dash'] = 'The %s field may only contain alpha-numeric characters, underscores, and dashes.'; +$lang['numeric'] = 'The %s field must contain only numbers.'; +$lang['is_numeric'] = 'The %s field must contain only numeric characters.'; +$lang['integer'] = 'The %s field must contain an integer.'; +$lang['regex_match'] = 'The %s field is not in the correct format.'; +$lang['matches'] = 'The %s field does not match the %s field.'; +$lang['is_unique'] = 'The %s field must contain a unique value.'; +$lang['is_natural'] = 'The %s field must contain only positive numbers.'; +$lang['is_natural_no_zero'] = 'The %s field must contain a number greater than zero.'; +$lang['decimal'] = 'The %s field must contain a decimal number.'; +$lang['less_than'] = 'The %s field must contain a number less than %s.'; +$lang['less_than_equal_to'] = 'The %s field must contain a number less than or equal to %s.'; +$lang['greater_than'] = 'The %s field must contain a number greater than %s.'; +$lang['greater_than_equal_to'] = 'The %s field must contain a number greater than or equal to %s.'; /* End of file form_validation_lang.php */ /* Location: ./system/language/english/form_validation_lang.php */ \ No newline at end of file diff --git a/system/language/english/ftp_lang.php b/system/language/english/ftp_lang.php index 6a1f1bc51..24923c8d8 100644 --- a/system/language/english/ftp_lang.php +++ b/system/language/english/ftp_lang.php @@ -25,18 +25,18 @@ * @filesource */ -$lang['ftp_no_connection'] = "Unable to locate a valid connection ID. Please make sure you are connected before peforming any file routines."; -$lang['ftp_unable_to_connect'] = "Unable to connect to your FTP server using the supplied hostname."; -$lang['ftp_unable_to_login'] = "Unable to login to your FTP server. Please check your username and password."; -$lang['ftp_unable_to_makdir'] = "Unable to create the directory you have specified."; -$lang['ftp_unable_to_changedir'] = "Unable to change directories."; -$lang['ftp_unable_to_chmod'] = "Unable to set file permissions. Please check your path. Note: This feature is only available in PHP 5 or higher."; -$lang['ftp_unable_to_upload'] = "Unable to upload the specified file. Please check your path."; -$lang['ftp_unable_to_download'] = "Unable to download the specified file. Please check your path."; -$lang['ftp_no_source_file'] = "Unable to locate the source file. Please check your path."; -$lang['ftp_unable_to_rename'] = "Unable to rename the file."; -$lang['ftp_unable_to_delete'] = "Unable to delete the file."; -$lang['ftp_unable_to_move'] = "Unable to move the file. Please make sure the destination directory exists."; +$lang['ftp_no_connection'] = 'Unable to locate a valid connection ID. Please make sure you are connected before peforming any file routines.'; +$lang['ftp_unable_to_connect'] = 'Unable to connect to your FTP server using the supplied hostname.'; +$lang['ftp_unable_to_login'] = 'Unable to login to your FTP server. Please check your username and password.'; +$lang['ftp_unable_to_makdir'] = 'Unable to create the directory you have specified.'; +$lang['ftp_unable_to_changedir'] = 'Unable to change directories.'; +$lang['ftp_unable_to_chmod'] = 'Unable to set file permissions. Please check your path. Note: This feature is only available in PHP 5 or higher.'; +$lang['ftp_unable_to_upload'] = 'Unable to upload the specified file. Please check your path.'; +$lang['ftp_unable_to_download'] = 'Unable to download the specified file. Please check your path.'; +$lang['ftp_no_source_file'] = 'Unable to locate the source file. Please check your path.'; +$lang['ftp_unable_to_rename'] = 'Unable to rename the file.'; +$lang['ftp_unable_to_delete'] = 'Unable to delete the file.'; +$lang['ftp_unable_to_move'] = 'Unable to move the file. Please make sure the destination directory exists.'; /* End of file ftp_lang.php */ /* Location: ./system/language/english/ftp_lang.php */ \ No newline at end of file diff --git a/system/language/english/imglib_lang.php b/system/language/english/imglib_lang.php index 7090eb506..d755437f2 100644 --- a/system/language/english/imglib_lang.php +++ b/system/language/english/imglib_lang.php @@ -25,24 +25,24 @@ * @filesource */ -$lang['imglib_source_image_required'] = "You must specify a source image in your preferences."; -$lang['imglib_gd_required'] = "The GD image library is required for this feature."; -$lang['imglib_gd_required_for_props'] = "Your server must support the GD image library in order to determine the image properties."; -$lang['imglib_unsupported_imagecreate'] = "Your server does not support the GD function required to process this type of image."; -$lang['imglib_gif_not_supported'] = "GIF images are often not supported due to licensing restrictions. You may have to use JPG or PNG images instead."; -$lang['imglib_jpg_not_supported'] = "JPG images are not supported."; -$lang['imglib_png_not_supported'] = "PNG images are not supported."; -$lang['imglib_jpg_or_png_required'] = "The image resize protocol specified in your preferences only works with JPEG or PNG image types."; -$lang['imglib_copy_error'] = "An error was encountered while attempting to replace the file. Please make sure your file directory is writable."; -$lang['imglib_rotate_unsupported'] = "Image rotation does not appear to be supported by your server."; -$lang['imglib_libpath_invalid'] = "The path to your image library is not correct. Please set the correct path in your image preferences."; -$lang['imglib_image_process_failed'] = "Image processing failed. Please verify that your server supports the chosen protocol and that the path to your image library is correct."; -$lang['imglib_rotation_angle_required'] = "An angle of rotation is required to rotate the image."; -$lang['imglib_writing_failed_gif'] = "GIF image."; -$lang['imglib_invalid_path'] = "The path to the image is not correct."; -$lang['imglib_copy_failed'] = "The image copy routine failed."; -$lang['imglib_missing_font'] = "Unable to find a font to use."; -$lang['imglib_save_failed'] = "Unable to save the image. Please make sure the image and file directory are writable."; +$lang['imglib_source_image_required'] = 'You must specify a source image in your preferences.'; +$lang['imglib_gd_required'] = 'The GD image library is required for this feature.'; +$lang['imglib_gd_required_for_props'] = 'Your server must support the GD image library in order to determine the image properties.'; +$lang['imglib_unsupported_imagecreate'] = 'Your server does not support the GD function required to process this type of image.'; +$lang['imglib_gif_not_supported'] = 'GIF images are often not supported due to licensing restrictions. You may have to use JPG or PNG images instead.'; +$lang['imglib_jpg_not_supported'] = 'JPG images are not supported.'; +$lang['imglib_png_not_supported'] = 'PNG images are not supported.'; +$lang['imglib_jpg_or_png_required'] = 'The image resize protocol specified in your preferences only works with JPEG or PNG image types.'; +$lang['imglib_copy_error'] = 'An error was encountered while attempting to replace the file. Please make sure your file directory is writable.'; +$lang['imglib_rotate_unsupported'] = 'Image rotation does not appear to be supported by your server.'; +$lang['imglib_libpath_invalid'] = 'The path to your image library is not correct. Please set the correct path in your image preferences.'; +$lang['imglib_image_process_failed'] = 'Image processing failed. Please verify that your server supports the chosen protocol and that the path to your image library is correct.'; +$lang['imglib_rotation_angle_required'] = 'An angle of rotation is required to rotate the image.'; +$lang['imglib_writing_failed_gif'] = 'GIF image.'; +$lang['imglib_invalid_path'] = 'The path to the image is not correct.'; +$lang['imglib_copy_failed'] = 'The image copy routine failed.'; +$lang['imglib_missing_font'] = 'Unable to find a font to use.'; +$lang['imglib_save_failed'] = 'Unable to save the image. Please make sure the image and file directory are writable.'; /* End of file imglib_lang.php */ /* Location: ./system/language/english/imglib_lang.php */ \ No newline at end of file diff --git a/system/language/english/migration_lang.php b/system/language/english/migration_lang.php index 9c8909a8f..5753c00bf 100644 --- a/system/language/english/migration_lang.php +++ b/system/language/english/migration_lang.php @@ -25,13 +25,13 @@ * @filesource */ -$lang['migration_none_found'] = "No migrations were found."; -$lang['migration_not_found'] = "No migration could be found with the version number: %d."; -$lang['migration_multiple_version'] = "There are multiple migrations with the same version number: %d."; -$lang['migration_class_doesnt_exist'] = "The migration class \"%s\" could not be found."; -$lang['migration_missing_up_method'] = "The migration class \"%s\" is missing an 'up' method."; -$lang['migration_missing_down_method'] = "The migration class \"%s\" is missing a 'down' method."; -$lang['migration_invalid_filename'] = "Migration \"%s\" has an invalid filename."; +$lang['migration_none_found'] = 'No migrations were found.'; +$lang['migration_not_found'] = 'No migration could be found with the version number: %d.'; +$lang['migration_multiple_version'] = 'There are multiple migrations with the same version number: %d.'; +$lang['migration_class_doesnt_exist'] = 'The migration class "%s" could not be found.'; +$lang['migration_missing_up_method'] = 'The migration class "%s" is missing an "up" method.'; +$lang['migration_missing_down_method'] = 'The migration class "%s" is missing a "down" method.'; +$lang['migration_invalid_filename'] = 'Migration "%s" has an invalid filename.'; /* End of file migration_lang.php */ diff --git a/system/language/english/upload_lang.php b/system/language/english/upload_lang.php index de814d377..d70e7f20f 100644 --- a/system/language/english/upload_lang.php +++ b/system/language/english/upload_lang.php @@ -25,22 +25,22 @@ * @filesource */ -$lang['upload_userfile_not_set'] = "Unable to find a post variable called userfile."; -$lang['upload_file_exceeds_limit'] = "The uploaded file exceeds the maximum allowed size in your PHP configuration file."; -$lang['upload_file_exceeds_form_limit'] = "The uploaded file exceeds the maximum size allowed by the submission form."; -$lang['upload_file_partial'] = "The file was only partially uploaded."; -$lang['upload_no_temp_directory'] = "The temporary folder is missing."; -$lang['upload_unable_to_write_file'] = "The file could not be written to disk."; -$lang['upload_stopped_by_extension'] = "The file upload was stopped by extension."; -$lang['upload_no_file_selected'] = "You did not select a file to upload."; -$lang['upload_invalid_filetype'] = "The filetype you are attempting to upload is not allowed."; -$lang['upload_invalid_filesize'] = "The file you are attempting to upload is larger than the permitted size."; -$lang['upload_invalid_dimensions'] = "The image you are attempting to upload exceeds the maximum height or width."; -$lang['upload_destination_error'] = "A problem was encountered while attempting to move the uploaded file to the final destination."; -$lang['upload_no_filepath'] = "The upload path does not appear to be valid."; -$lang['upload_no_file_types'] = "You have not specified any allowed file types."; -$lang['upload_bad_filename'] = "The file name you submitted already exists on the server."; -$lang['upload_not_writable'] = "The upload destination folder does not appear to be writable."; +$lang['upload_userfile_not_set'] = 'Unable to find a post variable called userfile.'; +$lang['upload_file_exceeds_limit'] = 'The uploaded file exceeds the maximum allowed size in your PHP configuration file.'; +$lang['upload_file_exceeds_form_limit'] = 'The uploaded file exceeds the maximum size allowed by the submission form.'; +$lang['upload_file_partial'] = 'The file was only partially uploaded.'; +$lang['upload_no_temp_directory'] = 'The temporary folder is missing.'; +$lang['upload_unable_to_write_file'] = 'The file could not be written to disk.'; +$lang['upload_stopped_by_extension'] = 'The file upload was stopped by extension.'; +$lang['upload_no_file_selected'] = 'You did not select a file to upload.'; +$lang['upload_invalid_filetype'] = 'The filetype you are attempting to upload is not allowed.'; +$lang['upload_invalid_filesize'] = 'The file you are attempting to upload is larger than the permitted size.'; +$lang['upload_invalid_dimensions'] = 'The image you are attempting to upload exceeds the maximum height or width.'; +$lang['upload_destination_error'] = 'A problem was encountered while attempting to move the uploaded file to the final destination.'; +$lang['upload_no_filepath'] = 'The upload path does not appear to be valid.'; +$lang['upload_no_file_types'] = 'You have not specified any allowed file types.'; +$lang['upload_bad_filename'] = 'The file name you submitted already exists on the server.'; +$lang['upload_not_writable'] = 'The upload destination folder does not appear to be writable.'; /* End of file upload_lang.php */ /* Location: ./system/language/english/upload_lang.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From afee226aa4487b3645fb916f99b4cf7f012af536 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sun, 15 Jul 2012 18:59:01 +0100 Subject: Changed TRUE and FALSE values to be uppercase --- system/libraries/Migration.php | 2 +- system/libraries/Xmlrpcs.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php index c786703ca..5d637d44a 100644 --- a/system/libraries/Migration.php +++ b/system/libraries/Migration.php @@ -285,7 +285,7 @@ class CI_Migration { if ( ! $migrations = $this->find_migrations()) { $this->_error_string = $this->lang->line('migration_none_found'); - return false; + return FALSE; } $last_migration = basename(end($migrations)); diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index e81f2ca9a..5d01d374d 100644 --- a/system/libraries/Xmlrpcs.php +++ b/system/libraries/Xmlrpcs.php @@ -230,7 +230,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc ); xml_set_object($parser, $parser_object); - xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true); + xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, TRUE); xml_set_element_handler($parser, 'open_tag', 'closing_tag'); xml_set_character_data_handler($parser, 'character_data'); //xml_set_default_handler($parser, 'default_handler'); -- cgit v1.2.3-24-g4f1b From 6697cf0c64d34992f8b2a97383d582b2fbf66b1f Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Tue, 17 Jul 2012 18:43:00 +0100 Subject: Updated .htaccess files with Apache 2.4+ safe deny statements. Fixes #1631 --- application/.htaccess | 7 ++++++- application/cache/.htaccess | 7 ++++++- system/.htaccess | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/application/.htaccess b/application/.htaccess index 14249c50b..ae1d1e6fb 100644 --- a/application/.htaccess +++ b/application/.htaccess @@ -1 +1,6 @@ -Deny from all \ No newline at end of file + + Require all denied + + + Deny from all + \ No newline at end of file diff --git a/application/cache/.htaccess b/application/cache/.htaccess index 3418e55a6..ae1d1e6fb 100644 --- a/application/cache/.htaccess +++ b/application/cache/.htaccess @@ -1 +1,6 @@ -deny from all \ No newline at end of file + + Require all denied + + + Deny from all + \ No newline at end of file diff --git a/system/.htaccess b/system/.htaccess index 14249c50b..ae1d1e6fb 100644 --- a/system/.htaccess +++ b/system/.htaccess @@ -1 +1,6 @@ -Deny from all \ No newline at end of file + + Require all denied + + + Deny from all + \ No newline at end of file -- cgit v1.2.3-24-g4f1b From d1f02a8ac7912f0b8f31bfe50e2fa92e9201ef33 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Tue, 17 Jul 2012 21:28:49 +0200 Subject: Improve the solution for issue #1631 .htaccess directives compatible with both Apache 2.2 and 2.4 --- application/.htaccess | 2 +- application/cache/.htaccess | 2 +- system/.htaccess | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/application/.htaccess b/application/.htaccess index ae1d1e6fb..6c63ed4c4 100644 --- a/application/.htaccess +++ b/application/.htaccess @@ -1,6 +1,6 @@ Require all denied - + Deny from all \ No newline at end of file diff --git a/application/cache/.htaccess b/application/cache/.htaccess index ae1d1e6fb..6c63ed4c4 100644 --- a/application/cache/.htaccess +++ b/application/cache/.htaccess @@ -1,6 +1,6 @@ Require all denied - + Deny from all \ No newline at end of file diff --git a/system/.htaccess b/system/.htaccess index ae1d1e6fb..6c63ed4c4 100644 --- a/system/.htaccess +++ b/system/.htaccess @@ -1,6 +1,6 @@ Require all denied - + Deny from all \ No newline at end of file -- cgit v1.2.3-24-g4f1b From fa4af2c268eb920e8eb772b793962000c10ac79c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 19 Jul 2012 15:15:17 +0300 Subject: Enable travis for feature/* branches --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 31b74b13b..2496def0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,4 +23,5 @@ script: phpunit --coverage-text --configuration tests/travis/$DB.phpunit.xml branches: only: - - develop \ No newline at end of file + - develop + - /^feature\/.+$/ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From a5a71359a5b320b0dc35fabfeb3e74e97a466a10 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Fri, 20 Jul 2012 19:36:43 -0300 Subject: Added support for IP Address Range Masks (e.g. 192.168.137.0/24) to the Proxy IPs config option --- system/core/Input.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/system/core/Input.php b/system/core/Input.php index 162e40c85..c0c85a5e8 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -330,10 +330,27 @@ class CI_Input { if (config_item('proxy_ips') != '' && $this->server('HTTP_X_FORWARDED_FOR') && $this->server('REMOTE_ADDR')) { + $hasRanges = strpos($proxies, '/') !== false; $proxies = preg_split('/[\s,]/', config_item('proxy_ips'), -1, PREG_SPLIT_NO_EMPTY); $proxies = is_array($proxies) ? $proxies : array($proxies); - - $this->ip_address = in_array($_SERVER['REMOTE_ADDR'], $proxies) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; + + if ($hasRanges) { + $longIP = ip2long($_SERVER['REMOTE_ADDR']); + $bit32 = 1 << 32; + + foreach($proxies as $ip) { + list($address, $maskLength) = explode('/', $ip); + + $bitmask = $bit32 - (1 << (32 - (int)$maskLength)); + + if (($longIP & $bitmask) == $address) { + $this->ip_address = $_SERVER['HTTP_X_FORWARDED_FOR']; + break; + } + } + } else { + $this->ip_address = in_array($_SERVER['REMOTE_ADDR'], $proxies) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; + } } elseif ( ! $this->server('HTTP_CLIENT_IP') && $this->server('REMOTE_ADDR')) { -- cgit v1.2.3-24-g4f1b From 8711aebec411ea31ae650202f49908de1f313689 Mon Sep 17 00:00:00 2001 From: Przemyslaw Tomaszewski Date: Sun, 22 Jul 2012 03:28:41 +0200 Subject: Comment fix. Html5 is most popular these days and should be added to comment. Also - information that there are more doctypes than specified in comment was not included. --- system/helpers/html_helper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 68ce70248..6fabf9c05 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -242,9 +242,9 @@ if ( ! function_exists('doctype')) * * Generates a page document type declaration * - * Valid options are xhtml-11, xhtml-strict, xhtml-trans, xhtml-frame, - * html4-strict, html4-trans, and html4-frame. Values are saved in the - * doctypes config file. + * Examples of valid options: html5, xhtml-11, xhtml-strict, xhtml-trans, + * xhtml-frame, html4-strict, html4-trans, and html4-frame. + * All values are saved in the doctypes config file. * * @param string type The doctype to be generated * @return string -- cgit v1.2.3-24-g4f1b From 74cb495239927d5ea876459b179954e5bcc0488c Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sat, 21 Jul 2012 22:55:58 -0400 Subject: Removing $reduce_linebreaks in auto_typography helper. Fixes #1642 I researched this back to a commit by @derekjones but couldn't find any history on what the reason for it was or why it was even added. Signed-off-by: Eric Barnes --- system/helpers/typography_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php index af9d16a89..9dbba0679 100644 --- a/system/helpers/typography_helper.php +++ b/system/helpers/typography_helper.php @@ -65,11 +65,11 @@ if ( ! function_exists('auto_typography')) * @param bool whether to reduce multiple instances of double newlines to two * @return string */ - function auto_typography($str, $strip_js_event_handlers = TRUE, $reduce_linebreaks = FALSE) + function auto_typography($str, $reduce_linebreaks = FALSE) { $CI =& get_instance(); $CI->load->library('typography'); - return $CI->typography->auto_typography($str, $strip_js_event_handlers, $reduce_linebreaks); + return $CI->typography->auto_typography($str, $reduce_linebreaks); } } -- cgit v1.2.3-24-g4f1b From 8960acf4fae56fd7b62a451ce8ea571c0e631ed1 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 23 Jul 2012 09:05:49 -0300 Subject: Update system/core/Input.php --- system/core/Input.php | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/system/core/Input.php b/system/core/Input.php index c0c85a5e8..968a42a9a 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -330,24 +330,30 @@ class CI_Input { if (config_item('proxy_ips') != '' && $this->server('HTTP_X_FORWARDED_FOR') && $this->server('REMOTE_ADDR')) { - $hasRanges = strpos($proxies, '/') !== false; + $has_ranges = strpos($proxies, '/') !== false; $proxies = preg_split('/[\s,]/', config_item('proxy_ips'), -1, PREG_SPLIT_NO_EMPTY); $proxies = is_array($proxies) ? $proxies : array($proxies); - if ($hasRanges) { - $longIP = ip2long($_SERVER['REMOTE_ADDR']); - $bit32 = 1 << 32; - - foreach($proxies as $ip) { - list($address, $maskLength) = explode('/', $ip); - - $bitmask = $bit32 - (1 << (32 - (int)$maskLength)); - - if (($longIP & $bitmask) == $address) { + if ($has_ranges) + { + $long_ip = ip2long($_SERVER['REMOTE_ADDR']); + $bit_32 = 1 << 32; + + // Go through each of the IP Addresses to check for and + // test against range notation + foreach($proxies as $ip) + { + list($address, $mask_length) = explode('/', $ip); + + // Generate the bitmask for a 32 bit IP Address + $bitmask = $bit_32 - (1 << (32 - (int)$mask_length)); + if (($long_ip & $bitmask) == $address) + { $this->ip_address = $_SERVER['HTTP_X_FORWARDED_FOR']; break; } } + } else { $this->ip_address = in_array($_SERVER['REMOTE_ADDR'], $proxies) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; } -- cgit v1.2.3-24-g4f1b From ede49ba66b127535f3430e20aac72ceed2c4611a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 23 Jul 2012 16:06:36 +0300 Subject: Fix a bug in CI_DB_sqlsrv_driver::affected_rows() --- system/database/drivers/sqlsrv/sqlsrv_driver.php | 2 +- user_guide_src/source/changelog.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index 8bd18bd76..bda450e88 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -225,7 +225,7 @@ class CI_DB_sqlsrv_driver extends CI_DB { */ public function affected_rows() { - return sqlrv_rows_affected($this->result_id); + return sqlsrv_rows_affected($this->result_id); } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 68719efa7..6ba416856 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -316,6 +316,7 @@ Bug fixes for 3.0 - Fixed a bug (#135) - PHP Error logging was impossible without the errors being displayed. - Fixed a bug (#1613) - :doc:`Form Helper ` functions ``form_multiselect()``, ``form_dropdown()`` didn't properly handle empty array option groups. - Fixed a bug (#1605) - :doc:`Pagination Library ` produced incorrect *previous* and *next* link values. +- Fixed a bug in SQLSRV's ``affected_rows()`` method where an erroneous function name was used. Version 2.1.2 ============= -- cgit v1.2.3-24-g4f1b From 3c13522ebf4e27094ea5947df16b304cd79bd818 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 23 Jul 2012 16:54:48 +0300 Subject: Fix issue #1644 --- application/config/mimes.php | 2 +- user_guide_src/source/changelog.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/application/config/mimes.php b/application/config/mimes.php index 4b1d6a85d..a239bb254 100644 --- a/application/config/mimes.php +++ b/application/config/mimes.php @@ -37,7 +37,7 @@ return array( 'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'), 'cpt' => 'application/mac-compactpro', - 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'), + 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'), 'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'), 'dms' => 'application/octet-stream', 'lha' => 'application/octet-stream', diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 6ba416856..5098e9e49 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -36,6 +36,7 @@ Release Date: Not Released - Updated support for doc files in mimes.php. - Updated support for php files in mimes.php. - Updated support for zip files in mimes.php. + - Updated support for csv files in mimes.php. - Added some more doctypes. - Added Romanian and Greek characters in foreign_characters.php. - Changed logger to only chmod when file is first created. -- cgit v1.2.3-24-g4f1b From 1288fe36214e0c8a22edec16da209081930e17c9 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Mon, 23 Jul 2012 16:22:06 +0200 Subject: output->_display_cache() optimization faster method to remove the timestamp from the content to be served --- system/core/Output.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/core/Output.php b/system/core/Output.php index 5ec8c4bc0..2bf4e998f 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -575,7 +575,7 @@ class CI_Output { } // Display the cache - $this->_display(str_replace($match[0], '', $cache)); + $this->_display(substr($cache, strlen($match[0]))); log_message('debug', 'Cache file is current. Sending it to browser.'); return TRUE; } -- cgit v1.2.3-24-g4f1b From d9384ad6472dd042a897a9b80d78bbf92a794c0f Mon Sep 17 00:00:00 2001 From: vlakoff Date: Mon, 23 Jul 2012 17:06:36 +0200 Subject: output->_display_cache() simplifications remove an unneeded regex capturing group and an unneeded trim() --- system/core/Output.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/core/Output.php b/system/core/Output.php index 2bf4e998f..9842f834d 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -552,13 +552,13 @@ class CI_Output { fclose($fp); // Strip out the embedded timestamp - if ( ! preg_match('/(\d+TS--->)/', $cache, $match)) + if ( ! preg_match('/\d+TS--->/', $cache, $match)) { return FALSE; } $last_modified = filemtime($cache_path); - $expire = trim(str_replace('TS--->', '', $match[1])); + $expire = str_replace('TS--->', '', $match[0]); // Has the file expired? if ($_SERVER['REQUEST_TIME'] >= $expire && is_really_writable($cache_path)) -- cgit v1.2.3-24-g4f1b From 9defe90c7716ba6fb70fb5a2f95864563f0e9395 Mon Sep 17 00:00:00 2001 From: Debeet Date: Wed, 25 Jul 2012 17:32:11 +0300 Subject: Windows 8 and PlayStation 3 in user_agents.php --- application/config/user_agents.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/config/user_agents.php b/application/config/user_agents.php index 416ef5679..9befddc99 100644 --- a/application/config/user_agents.php +++ b/application/config/user_agents.php @@ -36,6 +36,7 @@ */ $platforms = array( + 'windows nt 6.2' => 'Windows 8', 'windows nt 6.1' => 'Windows 7', 'windows nt 6.0' => 'Windows Vista', 'windows nt 5.2' => 'Windows 2003', @@ -146,6 +147,7 @@ $mobiles = array( 'ipaq' => 'HP iPaq', 'mot-' => 'Motorola', 'playstation portable' => 'PlayStation Portable', + 'playstation 3' => 'PlayStation 3', 'hiptop' => 'Danger Hiptop', 'nec-' => 'NEC', 'panasonic' => 'Panasonic', -- cgit v1.2.3-24-g4f1b From f0ecb55dfe8dbfaf4c65dbe9d7e1bba8c131ebf4 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Thu, 26 Jul 2012 17:00:33 +0200 Subject: If $htdocs = FALSE delete_files would never unlink --- system/helpers/file_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 3834d4895..b6c95d554 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -124,7 +124,7 @@ if ( ! function_exists('delete_files')) { delete_files($path.DIRECTORY_SEPARATOR.$filename, $del_dir, $level + 1, $htdocs); } - elseif ($htdocs === TRUE && ! preg_match('/^(\.htaccess|index\.(html|htm|php)|web\.config)$/i', $filename)) + elseif ($htdocs === FALSE OR ($htdocs === TRUE && ! preg_match('/^(\.htaccess|index\.(html|htm|php)|web\.config)$/i', $filename))) { @unlink($path.DIRECTORY_SEPARATOR.$filename); } -- cgit v1.2.3-24-g4f1b From 27228c97d6f2bc44cf8913c2b0d2e2ee439eb696 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 27 Jul 2012 10:36:29 +0300 Subject: Improve change from f0ecb55dfe8dbfaf4c65dbe9d7e1bba8c131ebf4 and add changelog entries for pull #1654 --- system/helpers/file_helper.php | 2 +- user_guide_src/source/changelog.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index b6c95d554..e68bb7f7a 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -124,7 +124,7 @@ if ( ! function_exists('delete_files')) { delete_files($path.DIRECTORY_SEPARATOR.$filename, $del_dir, $level + 1, $htdocs); } - elseif ($htdocs === FALSE OR ($htdocs === TRUE && ! preg_match('/^(\.htaccess|index\.(html|htm|php)|web\.config)$/i', $filename))) + elseif ($htdocs !== TRUE OR ! preg_match('/^(\.htaccess|index\.(html|htm|php)|web\.config)$/i', $filename)) { @unlink($path.DIRECTORY_SEPARATOR.$filename); } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 5098e9e49..625127e2a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -22,7 +22,7 @@ Release Date: Not Released - ``$_SERVER['CI_ENV']`` can now be set to control the ``ENVIRONMENT`` constant. - Added an optional backtrace to php-error template. - Added Android to the list of user agents. - - Added Windows 7, Android, Blackberry and iOS to the list of user platforms. + - Added Windows 7, Windows 8, Android, Blackberry, iOS and PlayStation 3 to the list of user platforms. - Added Fennec (Firefox for mobile) to the list of mobile user agents. - Ability to log certain error types, not all under a threshold. - Added support for pem, p10, p12, p7a, p7c, p7m, p7r, p7s, crt, crl, der, kdb, rsa, cer, sst, csr Certs to mimes.php. -- cgit v1.2.3-24-g4f1b From f9ee005f77ea215d5318a9c5991c37453ef18ca0 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Fri, 27 Jul 2012 17:11:41 -0300 Subject: Change log for IPv4 range mask support --- user_guide_src/source/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 68719efa7..0436a8642 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -204,7 +204,7 @@ Release Date: Not Released - Changed :doc:`Config Library ` method site_url() to accept an array as well. - Added method ``strip_image_tags()`` to the :doc:`Security Library `. - Changed ``_exception_handler()`` to respect php.ini 'display_errors' setting. - + - Added support for IPv4 range masks (e.g. 192.168.1.1/24) to specify ranges of IP addresses for use with the proxy_ips setting. Bug fixes for 3.0 ------------------ -- cgit v1.2.3-24-g4f1b From 62ab8b24fc37a25eab9205c46321fa41729e5faf Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sat, 28 Jul 2012 14:57:04 -0400 Subject: Adding optional attributes as array or object for html helper --- application/controllers/welcome.php | 5 ++- system/helpers/html_helper.php | 59 +++++++++++++++++--------- tests/codeigniter/helpers/html_helper_test.php | 17 +++++++- 3 files changed, 60 insertions(+), 21 deletions(-) diff --git a/application/controllers/welcome.php b/application/controllers/welcome.php index 1ed82d2a7..9aaab14ad 100644 --- a/application/controllers/welcome.php +++ b/application/controllers/welcome.php @@ -44,7 +44,10 @@ class Welcome extends CI_Controller { */ public function index() { - $this->load->view('welcome_message'); + $this->load->helper('html'); + echo img('test.png', FALSE, array('class' => 'foo')); + + // $this->load->view('welcome_message'); } } diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 6fabf9c05..96234bb02 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -51,7 +51,7 @@ if ( ! function_exists('heading')) */ function heading($data = '', $h = '1', $attributes = '') { - return ''.$data.''; + return ''.$data.''; } } @@ -119,23 +119,8 @@ if ( ! function_exists('_list')) // Set the indentation based on the depth $out = str_repeat(' ', $depth); - // Were any attributes submitted? If so generate a string - if (is_array($attributes)) - { - $atts = ''; - foreach ($attributes as $key => $val) - { - $atts .= ' '.$key.'="'.$val.'"'; - } - $attributes = $atts; - } - elseif (is_string($attributes) && strlen($attributes) > 0) - { - $attributes = ' '.$attributes; - } - // Write the opening list tag - $out .= '<'.$type.$attributes.">\n"; + $out .= '<'.$type._html_attributes_to_string($attributes).">\n"; // Cycle through the list elements. If an array is // encountered we will recursively call _list() @@ -191,9 +176,10 @@ if ( ! function_exists('img')) * * @param mixed * @param bool + * @param mixed * @return string */ - function img($src = '', $index_page = FALSE) + function img($src = '', $index_page = FALSE, $attributes = '') { if ( ! is_array($src) ) { @@ -229,7 +215,7 @@ if ( ! function_exists('img')) } } - return $img.'/>'; + return $img._html_attributes_to_string($attributes).'/>'; } } @@ -407,5 +393,40 @@ if ( ! function_exists('nbs')) } } +if ( ! function_exists('_html_attributes_to_string')) +{ + /** + * Attributes To String + * + * Helper function used to convert array or object of attributes to a string + * + * @param mixed + * @param bool + * @return string + */ + function _html_attributes_to_string($attributes) + { + if (is_object($attributes) && count($attributes) > 0) + { + $attributes = (array) $attributes; + } + + if (is_array($attributes) && count($attributes) > 0) + { + $atts = ''; + foreach ($attributes as $key => $val) + { + $atts .= ' '.$key.'="'.$val.'"'; + } + return $atts; + } + elseif (is_string($attributes) && strlen($attributes) > 0) + { + return ' '.$attributes; + } + + return $attributes; + } +} /* End of file html_helper.php */ /* Location: ./system/helpers/html_helper.php */ \ No newline at end of file diff --git a/tests/codeigniter/helpers/html_helper_test.php b/tests/codeigniter/helpers/html_helper_test.php index 9a7bb48bf..4dd717ff7 100644 --- a/tests/codeigniter/helpers/html_helper_test.php +++ b/tests/codeigniter/helpers/html_helper_test.php @@ -22,6 +22,22 @@ class Html_helper_test extends CI_TestCase { $this->assertEquals('

foobar

', heading('foobar', 2, 'class="bar"')); } + public function test_heading_array_attributes() + { + // Test array of attributes + $this->assertEquals('

foobar

', heading('foobar', 2, array('class' => 'bar', 'id' => 'foo'))); + } + + public function test_heading_object_attributes() + { + // Test array of attributes + $this->assertEquals('

foobar

', heading('foobar', 2, array('class' => 'bar', 'id' => 'foo'))); + $test = new stdClass; + $test->class = "bar"; + $test->id = "foo"; + $this->assertEquals('

foobar

', heading('foobar', 2, $test)); + } + // ------------------------------------------------------------------------ public function test_Ul() @@ -72,5 +88,4 @@ EOH; $this->assertEquals($expect, meta(array('name' => 'foo'))); } - } \ No newline at end of file -- cgit v1.2.3-24-g4f1b From acedd2b1a37b22cb04b01038f21876ddfe38b83a Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sun, 29 Jul 2012 00:15:40 -0400 Subject: Adding a common stringify_attributes function for dealing with attributes through out various helpers. Signed-off-by: Eric Barnes --- system/core/Common.php | 49 +++++++++++++++++++++++++++++++++ system/helpers/date_helper.php | 17 +----------- system/helpers/html_helper.php | 41 ++-------------------------- system/helpers/url_helper.php | 50 +++------------------------------- tests/codeigniter/core/Common_test.php | 31 +++++++++++++++++++++ 5 files changed, 88 insertions(+), 100 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index 06b162264..d4d01f813 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -598,5 +598,54 @@ if ( ! function_exists('html_escape')) } } +// ------------------------------------------------------------------------ + +if ( ! function_exists('_stringify_attributes')) +{ + /** + * Attributes To String + * + * Helper function used to convert an array or object of + * attributes to a string + * + * @param mixed + * @return string + */ + function _stringify_attributes($attributes, $js = FALSE) + { + if (is_object($attributes) && count($attributes) > 0) + { + $attributes = (array) $attributes; + } + + if (is_array($attributes)) + { + $atts = ''; + if (count($attributes) === 0) + { + return $atts; + } + foreach ($attributes as $key => $val) + { + if ($js) + { + $atts .= $key.'='.$val.','; + } + else + { + $atts .= ' '.$key.'="'.$val.'"'; + } + } + return rtrim($atts, ','); + } + elseif (is_string($attributes) && strlen($attributes) > 0) + { + return ' '.$attributes; + } + + return $attributes; + } +} + /* End of file Common.php */ /* Location: ./system/core/Common.php */ \ No newline at end of file diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index a45b3d7ac..a792f09a2 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -575,22 +575,7 @@ if ( ! function_exists('timezone_menu')) $menu .= ' class="'.$class.'"'; } - // Generate a string from the attributes submitted, if any - if (is_array($attributes)) - { - $atts = ''; - foreach ($attributes as $key => $val) - { - $atts .= ' '.$key.'="'.$val.'"'; - } - $attributes = $atts; - } - elseif (is_string($attributes) && strlen($attributes) > 0) - { - $attributes = ' '.$attributes; - } - - $menu .= $attributes.">\n"; + $menu .= _stringify_attributes($attributes).">\n"; foreach (timezones() as $key => $val) { diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 96234bb02..9843e804e 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -51,7 +51,7 @@ if ( ! function_exists('heading')) */ function heading($data = '', $h = '1', $attributes = '') { - return ''.$data.''; + return ''.$data.''; } } @@ -120,7 +120,7 @@ if ( ! function_exists('_list')) $out = str_repeat(' ', $depth); // Write the opening list tag - $out .= '<'.$type._html_attributes_to_string($attributes).">\n"; + $out .= '<'.$type._stringify_attributes($attributes).">\n"; // Cycle through the list elements. If an array is // encountered we will recursively call _list() @@ -215,7 +215,7 @@ if ( ! function_exists('img')) } } - return $img._html_attributes_to_string($attributes).'/>'; + return $img._stringify_attributes($attributes).'/>'; } } @@ -393,40 +393,5 @@ if ( ! function_exists('nbs')) } } -if ( ! function_exists('_html_attributes_to_string')) -{ - /** - * Attributes To String - * - * Helper function used to convert array or object of attributes to a string - * - * @param mixed - * @param bool - * @return string - */ - function _html_attributes_to_string($attributes) - { - if (is_object($attributes) && count($attributes) > 0) - { - $attributes = (array) $attributes; - } - - if (is_array($attributes) && count($attributes) > 0) - { - $atts = ''; - foreach ($attributes as $key => $val) - { - $atts .= ' '.$key.'="'.$val.'"'; - } - return $atts; - } - elseif (is_string($attributes) && strlen($attributes) > 0) - { - return ' '.$attributes; - } - - return $attributes; - } -} /* End of file html_helper.php */ /* Location: ./system/helpers/html_helper.php */ \ No newline at end of file diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 39e6343a6..57208c948 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -165,7 +165,7 @@ if ( ! function_exists('anchor')) if ($attributes !== '') { - $attributes = _parse_attributes($attributes); + $attributes = _stringify_attributes($attributes); } return ''.$title.''; @@ -221,10 +221,10 @@ if ( ! function_exists('anchor_popup')) unset($attributes[$key]); } - $attributes = empty($attributes) ? '' : _parse_attributes($attributes); + $attributes = _stringify_attributes($attributes); return ''.$title.''; } } @@ -250,7 +250,7 @@ if ( ! function_exists('mailto')) $title = $email; } - return ''.$title.''; + return ''.$title.''; } } @@ -560,47 +560,5 @@ if ( ! function_exists('redirect')) } } -// ------------------------------------------------------------------------ - -if ( ! function_exists('_parse_attributes')) -{ - /** - * Parse out the attributes - * - * Some of the functions use this - * - * @param array - * @param bool - * @return string - */ - function _parse_attributes($attributes, $javascript = FALSE) - { - if (is_string($attributes)) - { - return ($attributes !== '') ? ' '.$attributes : ''; - } - - $att = ''; - foreach ($attributes as $key => $val) - { - if ($javascript === TRUE) - { - $att .= $key.'='.$val.','; - } - else - { - $att .= ' '.$key.'="'.$val.'"'; - } - } - - if ($javascript === TRUE && $att !== '') - { - return substr($att, 0, -1); - } - - return $att; - } -} - /* End of file url_helper.php */ /* Location: ./system/helpers/url_helper.php */ \ No newline at end of file diff --git a/tests/codeigniter/core/Common_test.php b/tests/codeigniter/core/Common_test.php index f9bf6c27f..27d48efc2 100644 --- a/tests/codeigniter/core/Common_test.php +++ b/tests/codeigniter/core/Common_test.php @@ -10,4 +10,35 @@ class Common_test extends CI_TestCase { $this->assertEquals(FALSE, is_php('9999.9.9')); } + // ------------------------------------------------------------------------ + + public function test_stringify_attributes() + { + $this->assertEquals(' class="foo" id="bar"', _stringify_attributes(array('class' => 'foo', 'id' => 'bar'))); + + $atts = new Stdclass; + $atts->class = 'foo'; + $atts->id = 'bar'; + $this->assertEquals(' class="foo" id="bar"', _stringify_attributes($atts)); + + $atts = new Stdclass; + $this->assertEquals('', _stringify_attributes($atts)); + + $this->assertEquals(' class="foo" id="bar"', _stringify_attributes('class="foo" id="bar"')); + + $this->assertEquals('', _stringify_attributes(array())); + } + + // ------------------------------------------------------------------------ + + public function test_stringify_js_attributes() + { + $this->assertEquals('width=800,height=600', _stringify_attributes(array('width' => '800', 'height' => '600'), TRUE)); + + $atts = new Stdclass; + $atts->width = 800; + $atts->height = 600; + $this->assertEquals('width=800,height=600', _stringify_attributes($atts, TRUE)); + } + } \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 19204f96b8abc1322feb0f660240ed7abb69026b Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sun, 29 Jul 2012 00:18:07 -0400 Subject: Refactored _stringify_attributes function Signed-off-by: Eric Barnes --- system/core/Common.php | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index d4d01f813..7c46c590a 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -603,47 +603,45 @@ if ( ! function_exists('html_escape')) if ( ! function_exists('_stringify_attributes')) { /** - * Attributes To String + * Stringify attributes for use in html tags. * - * Helper function used to convert an array or object of + * Helper function used to convert a string, array, or object of * attributes to a string * - * @param mixed + * @param mixed string, array, object + * @param bool * @return string */ function _stringify_attributes($attributes, $js = FALSE) { - if (is_object($attributes) && count($attributes) > 0) + if (is_string($attributes)) + { + return strlen($attributes) > 0 ? ' '.$attributes : $attributes; + } + + if (is_object($attributes)) { $attributes = (array) $attributes; } - if (is_array($attributes)) + if (count($attributes) === 0) + { + return; + } + + $atts = ''; + foreach ($attributes as $key => $val) { - $atts = ''; - if (count($attributes) === 0) + if ($js) { - return $atts; + $atts .= $key.'='.$val.','; } - foreach ($attributes as $key => $val) + else { - if ($js) - { - $atts .= $key.'='.$val.','; - } - else - { - $atts .= ' '.$key.'="'.$val.'"'; - } + $atts .= ' '.$key.'="'.$val.'"'; } - return rtrim($atts, ','); - } - elseif (is_string($attributes) && strlen($attributes) > 0) - { - return ' '.$attributes; } - - return $attributes; + return rtrim($atts, ','); } } -- cgit v1.2.3-24-g4f1b From a1abadaab34d8d08c54557c7e60d12eb624b72fe Mon Sep 17 00:00:00 2001 From: Chad Furman Date: Sun, 29 Jul 2012 01:03:50 -0400 Subject: refactored (crunched down) _stringify_attributes --- system/core/Common.php | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/system/core/Common.php b/system/core/Common.php index 06b162264..5cd3961d1 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -598,5 +598,44 @@ if ( ! function_exists('html_escape')) } } +// ------------------------------------------------------------------------ + +if ( ! function_exists('_stringify_attributes')) +{ + /** + * Stringify attributes for use in html tags. + * + * Helper function used to convert a string, array, or object of + * attributes to a string + * + * @param mixed string, array, object + * @param bool + * @return string + */ + function _stringify_attributes($attributes, $js = FALSE) + { + $atts = null; + + if (empty($attributes)) + { + return $atts; + } + + if (is_string($attributes)) + { + return ' '.$attributes; + } + + $attributes = (array) $attributes; + + foreach ($attributes as $key => $val) + { + $atts .= ($js) ? $key.'='.$val.',' : ' '.$key.'="'.$val.'"'; + } + + return rtrim($atts, ','); + } +} + /* End of file Common.php */ -/* Location: ./system/core/Common.php */ \ No newline at end of file +/* Location: ./system/core/Common.php */ -- cgit v1.2.3-24-g4f1b From 49d2f304d4bb9c04c41c34f4675813b9d8ac3204 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sun, 29 Jul 2012 01:21:53 -0400 Subject: Fixed messed up welcome controller. Not sure how to revert this. Signed-off-by: Eric Barnes --- application/controllers/welcome.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/application/controllers/welcome.php b/application/controllers/welcome.php index 9aaab14ad..1ed82d2a7 100644 --- a/application/controllers/welcome.php +++ b/application/controllers/welcome.php @@ -44,10 +44,7 @@ class Welcome extends CI_Controller { */ public function index() { - $this->load->helper('html'); - echo img('test.png', FALSE, array('class' => 'foo')); - - // $this->load->view('welcome_message'); + $this->load->view('welcome_message'); } } -- cgit v1.2.3-24-g4f1b From 220aa6a7c6e6dcf8d1ebb7a929fec198898373fa Mon Sep 17 00:00:00 2001 From: InFog Date: Sun, 29 Jul 2012 13:42:50 -0300 Subject: Added documentation for mail_to function. --- user_guide_src/source/helpers/url_helper.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/helpers/url_helper.rst b/user_guide_src/source/helpers/url_helper.rst index 82db6a5b3..305454048 100644 --- a/user_guide_src/source/helpers/url_helper.rst +++ b/user_guide_src/source/helpers/url_helper.rst @@ -207,7 +207,12 @@ Creates a standard HTML email link. Usage example echo mailto('me@my-site.com', 'Click Here to Contact Me'); As with the anchor() tab above, you can set attributes using the third -parameter. +parameter: + +:: + + $attributes = array('title' => 'Mail me'); + echo mailto('me@my-site.com', 'Contact Me', $attributes); safe_mailto() ============= -- cgit v1.2.3-24-g4f1b From 00b3df41ba0acfd4c6b5d6838c239f857d6033cb Mon Sep 17 00:00:00 2001 From: InFog Date: Sun, 29 Jul 2012 13:42:50 -0300 Subject: Added documentation for mailto function. --- user_guide_src/source/helpers/url_helper.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/helpers/url_helper.rst b/user_guide_src/source/helpers/url_helper.rst index 82db6a5b3..305454048 100644 --- a/user_guide_src/source/helpers/url_helper.rst +++ b/user_guide_src/source/helpers/url_helper.rst @@ -207,7 +207,12 @@ Creates a standard HTML email link. Usage example echo mailto('me@my-site.com', 'Click Here to Contact Me'); As with the anchor() tab above, you can set attributes using the third -parameter. +parameter: + +:: + + $attributes = array('title' => 'Mail me'); + echo mailto('me@my-site.com', 'Contact Me', $attributes); safe_mailto() ============= -- cgit v1.2.3-24-g4f1b From b901e736a811907cea99dda9d06f656f526f5090 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Mon, 30 Jul 2012 09:44:57 +0100 Subject: After sending an email clear the parameters --- system/libraries/Email.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index fdb9be4da..9d80f0720 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -1257,11 +1257,15 @@ class CI_Email { if ($this->bcc_batch_mode && count($this->_bcc_array) > $this->bcc_batch_size) { - return $this->batch_bcc_send(); + $result = $this->batch_bcc_send(); + $this->clear(); + return $result; } $this->_build_message(); - return $this->_spool_email(); + $result = $this->_spool_email(); + $this->clear(); + return $result; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From d7bc8d04e5c13bbafe3bf10ca2634c1f8481ed53 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Mon, 30 Jul 2012 09:46:20 +0100 Subject: New parameter to automatically clear the parameters --- system/libraries/Email.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 9d80f0720..8239862a9 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -1238,7 +1238,7 @@ class CI_Email { * * @return bool */ - public function send() + public function send($auto_clear = TRUE) { if ($this->_replyto_flag === FALSE) { @@ -1258,13 +1258,23 @@ class CI_Email { if ($this->bcc_batch_mode && count($this->_bcc_array) > $this->bcc_batch_size) { $result = $this->batch_bcc_send(); - $this->clear(); + + if ($auto_clear) + { + $this->clear(); + } + return $result; } $this->_build_message(); $result = $this->_spool_email(); - $this->clear(); + + if ($auto_clear) + { + $this->clear(); + } + return $result; } -- cgit v1.2.3-24-g4f1b From a87aab39488367c18b9e60d2020665b17b35f4b1 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Mon, 30 Jul 2012 09:50:37 +0100 Subject: Only clear if request was successful --- system/libraries/Email.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 8239862a9..196a4b36c 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -1259,7 +1259,7 @@ class CI_Email { { $result = $this->batch_bcc_send(); - if ($auto_clear) + if ($result && $auto_clear) { $this->clear(); } @@ -1270,11 +1270,11 @@ class CI_Email { $this->_build_message(); $result = $this->_spool_email(); - if ($auto_clear) + if ($result && $auto_clear) { $this->clear(); } - + return $result; } -- cgit v1.2.3-24-g4f1b From a473d8009e5ef2043f1570acf632f3b1a1253ed0 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Mon, 30 Jul 2012 09:51:04 +0100 Subject: Updated email library documentation --- user_guide_src/source/libraries/email.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst index c5fa68004..f56bc2ff5 100644 --- a/user_guide_src/source/libraries/email.rst +++ b/user_guide_src/source/libraries/email.rst @@ -226,6 +226,14 @@ success or failure, enabling it to be used conditionally:: // Generate error } +This function will automatically clear all parameters if the request was + successful. To stop this behaviour pass FALSE:: + + if ($this->email->send(FALSE)) + { + // Parameters won't be cleared + } + $this->email->attach() ---------------------- -- cgit v1.2.3-24-g4f1b From 5f441eaedf5fecbad29131c5d44e3c2d53c4c4b5 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Mon, 30 Jul 2012 09:53:14 +0100 Subject: Updated changelog --- user_guide_src/source/changelog.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 7f428e5db..4d69c4dc3 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -176,7 +176,9 @@ Release Date: Not Released - Allowed for setting table class defaults in a config file. - Added a Wincache driver to the :doc:`Caching Library `. - Added a Redis driver to the :doc:`Caching Library `. - - Added dsn (delivery status notification) option to the :doc:`Email Library `. + - :doc:`Email library ` changes include: + - Added dsn (delivery status notification) option. + - Successfully sent emails will automatically clear the parameters. - Renamed method _set_header() to set_header() and made it public to enable adding custom headers in the :doc:`Email Library `. - Added an "index" parameter to the data() method in the :doc:`Upload Library `. - :doc:`Pagination Library ` changes include: -- cgit v1.2.3-24-g4f1b From bdb99999195711903af712fab58fdf4ef3da72ad Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 30 Jul 2012 17:38:05 +0300 Subject: Some clean-up and style changes --- system/core/Common.php | 18 +++++++++--------- system/libraries/Email.php | 2 +- user_guide_src/source/changelog.rst | 10 +++++----- user_guide_src/source/libraries/email.rst | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index 5cd3961d1..57374b07d 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -603,18 +603,18 @@ if ( ! function_exists('html_escape')) if ( ! function_exists('_stringify_attributes')) { /** - * Stringify attributes for use in html tags. + * Stringify attributes for use in HTML tags. * - * Helper function used to convert a string, array, or object of - * attributes to a string + * Helper function used to convert a string, array, or object + * of attributes to a string. * - * @param mixed string, array, object - * @param bool - * @return string + * @param mixed string, array, object + * @param bool + * @return string */ function _stringify_attributes($attributes, $js = FALSE) { - $atts = null; + $atts = NULL; if (empty($attributes)) { @@ -632,10 +632,10 @@ if ( ! function_exists('_stringify_attributes')) { $atts .= ($js) ? $key.'='.$val.',' : ' '.$key.'="'.$val.'"'; } - + return rtrim($atts, ','); } } /* End of file Common.php */ -/* Location: ./system/core/Common.php */ +/* Location: ./system/core/Common.php */ \ No newline at end of file diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 196a4b36c..8fd7a79e7 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -1269,7 +1269,7 @@ class CI_Email { $this->_build_message(); $result = $this->_spool_email(); - + if ($result && $auto_clear) { $this->clear(); diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 4d69c4dc3..03df6e3a8 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -146,8 +146,6 @@ Release Date: Not Released - CI_Session now respects php.ini's session.gc_probability and session.gc_divisor - Added max_filename_increment config setting for Upload library. - CI_Loader::_ci_autoloader() is now a protected method. - - Added custom filename to Email::attach() as $this->email->attach($filename, $disposition, $newname). - - Added possibility to send attachment as buffer string in Email::attach() as $this->email->attach($buffer, $disposition, $newname, $mime). - :doc:`Cart library ` changes include: - It now auto-increments quantity's instead of just resetting it, this is the default behaviour of large e-commerce sites. - Product Name strictness can be disabled via the Cart Library by switching "$product_name_safe". @@ -177,9 +175,11 @@ Release Date: Not Released - Added a Wincache driver to the :doc:`Caching Library `. - Added a Redis driver to the :doc:`Caching Library `. - :doc:`Email library ` changes include: - - Added dsn (delivery status notification) option. - - Successfully sent emails will automatically clear the parameters. - - Renamed method _set_header() to set_header() and made it public to enable adding custom headers in the :doc:`Email Library `. + - Added custom filename to ``Email::attach()`` as ``$this->email->attach($filename, $disposition, $newname)``. + - Added possibility to send attachment as buffer string in ``Email::attach()`` as ``$this->email->attach($buffer, $disposition, $newname, $mime)``. + - Added dsn (delivery status notification) option. + - Renamed method _set_header() to set_header() and made it public to enable adding custom headers in the :doc:`Email Library `. + - Successfully sent emails will automatically clear the parameters. - Added an "index" parameter to the data() method in the :doc:`Upload Library `. - :doc:`Pagination Library ` changes include: - Added support for the anchor "rel" attribute. diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst index f56bc2ff5..4403079b6 100644 --- a/user_guide_src/source/libraries/email.rst +++ b/user_guide_src/source/libraries/email.rst @@ -227,7 +227,7 @@ success or failure, enabling it to be used conditionally:: } This function will automatically clear all parameters if the request was - successful. To stop this behaviour pass FALSE:: +successful. To stop this behaviour pass FALSE:: if ($this->email->send(FALSE)) { -- cgit v1.2.3-24-g4f1b From 3a2d573a96241c01124d15c1ce517078e07c6235 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Tue, 31 Jul 2012 11:42:06 +0100 Subject: Added upgrade note about the breaking change in the email library. Problem noticed in #1671 --- user_guide_src/source/installation/upgrade_300.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst index f304a716f..f3a637326 100644 --- a/user_guide_src/source/installation/upgrade_300.rst +++ b/user_guide_src/source/installation/upgrade_300.rst @@ -138,4 +138,16 @@ As a result of that, the 'anchor_class' setting is now deprecated and scheduled CodeIgniter 3.1+. .. note:: This setting is still available, but you're strongly encouraged to remove its' usage sooner - rather than later. \ No newline at end of file + rather than later. + +Email library +============= + +The :doc:`Email library <../libraries/email>` will automatically clear the set parameters after successfully sending +emails. To override this behaviour, pass FALSE as the first parameter in the ``send()`` function: + +:: + if ($this->email->send(FALSE)) + { + // Parameters won't be cleared + } \ No newline at end of file -- cgit v1.2.3-24-g4f1b