reply focus to "No focus" also affects composing new messages)
- Current hook name is now globally available when running a hook ($currentHookName)
- Fix bug when Saving to Draft folder that contains special characters.
+ - Added size limit to signatures saved in file backend. Created error_option_save
+ function, that allows sending error message to options page. Thanks to Martynas
+ Bieliauskas for spotting big signature "option".
Version 1.5.0
--------------------
'</td></tr></table></td></tr></table>';
}
+/**
+ * Adds message that informs about non fatal error that can happen while saving preferences
+ * @param string $message error message
+ * @since 1.5.1
+ */
+function error_option_save($message) {
+ global $optpage_save_error;
+
+ if (! is_array($optpage_save_error) )
+ $optpage_save_error=array();
+
+ $optpage_save_error=array_merge($optpage_save_error,array($message));
+}
// vim: et ts=4
?>
\ No newline at end of file
* Write the User Signature.
*/
function setSig($data_dir, $username, $number, $value) {
+ // Limit signature size to 64KB (database BLOB limit)
+ if (strlen($value)>65536) {
+ error_option_save(_("Signature is too big."));
+ return;
+ }
$filename = getHashedFile($username, $data_dir, "$username.si$number");
/* Open the file for writing, or else display an error to the user. */
if(!$file = @fopen("$filename.tmp", 'w')) {
/*** Next, process anything that needs to be processed. ***/
/***********************************************************/
+$optpage_save_error=array();
+
if ( isset( $optpage_data ) ) {
switch ($optmode) {
case SMOPT_MODE_SUBMIT:
if (!isset($frame_top)) {
$frame_top = '_top';
}
- /* Display a message indicating a successful save. */
- echo '<b>' . _("Successfully Saved Options") . ": $optpage_name</b><br>\n";
+
+ if (isset($optpage_save_error) && $optpage_save_error!=array()) {
+ echo "<font color=\"$color[2]\"><b>" . _("Error(s) happened while saving your options") . "</b></font><br />\n";
+ echo "<ul>\n";
+ foreach ($optpage_save_error as $error_message) {
+ echo '<li><small>' . $error_message . "</small></li>\n";
+ }
+ echo "</ul>\n";
+ echo '<b>' . _("Some of your preference changes are not applied.") . "</b><br />\n";
+ } else {
+ /* Display a message indicating a successful save. */
+ echo '<b>' . _("Successfully Saved Options") . ": $optpage_name</b><br>\n";
+ }
/* If $max_refresh != SMOPT_REFRESH_NONE, provide a refresh link. */
if ( !isset( $max_refresh ) ) {