From dd2fdd128dfb5998479f9edf89d0cfa3afe53fbd Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Tue, 13 Dec 2005 18:49:47 +0000 Subject: [PATCH] - Patch #40532 by wtanaka: use longblog for data in the cache. Is reported to fix utf-8 problems and improves consistency with PostgreSQL. --- database/database.mysql | 2 +- database/updates.inc | 7 +++++++ modules/contact.module | 18 +++++++++++------- modules/contact/contact.module | 18 +++++++++++------- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/database/database.mysql b/database/database.mysql index 5cbc889f35fb..c96c51ee32b9 100644 --- a/database/database.mysql +++ b/database/database.mysql @@ -166,7 +166,7 @@ CREATE TABLE boxes ( CREATE TABLE cache ( cid varchar(255) NOT NULL default '', - data longtext, + data longblob, expire int(11) NOT NULL default '0', created int(11) NOT NULL default '0', headers text, diff --git a/database/updates.inc b/database/updates.inc index 6dbc04368592..a44580c18521 100644 --- a/database/updates.inc +++ b/database/updates.inc @@ -1273,3 +1273,10 @@ function system_update_162() { return $ret; } +function system_update_163() { + $ret = array(); + if ($GLOBALS['db_type'] == 'mysql') { + $ret[] = update_sql('ALTER TABLE {cache} CHANGE data data LONGBLOB'); + } + return $ret; +} diff --git a/modules/contact.module b/modules/contact.module index 0b2803e352b0..02798a8e4ced 100644 --- a/modules/contact.module +++ b/modules/contact.module @@ -6,9 +6,6 @@ * Enables the use of personal contact forms. */ -// Users are not allowed to send more than x mails/hour: -define('CONTACT_HOURLY_THRESHOLD', 3); - /** * Implementation of hook_help(). */ @@ -74,6 +71,13 @@ function contact_settings() { '#default_value' => variable_get('contact_form_information', t('You can leave us a message using the contact form below.')), '#description' => t('Information to show on the <a href="%form">contact page</a>. Can be anything from submission guidelines to your postal address or telephone number.', array('%form' => url('contact'))) ); + $form['contact_hourly_threshold'] = array( + '#type' => 'select', + '#title' => t('Hourly threshold'), + '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50)), + '#default_value' => variable_get('contact_hourly_threshold', 3), + '#description' => t('The maximum number of contact form submissions a user can perform per hour.'), + ); return $form; } @@ -106,8 +110,8 @@ function contact_mail_user() { else if (!valid_email_address($user->mail)) { $output = t('You need to provide a valid e-mail address to contact other users. Please edit your <a href="%url">user information</a>.', array('%url' => url("user/$user->uid/edit"))); } - else if (!flood_is_allowed('contact', CONTACT_HOURLY_THRESHOLD)) { - $output = t("You can't contact more than %number users per hour. Please try again later.", array('%number' => CONTACT_HOURLY_THRESHOLD)); + else if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3))) { + $output = t("You can't contact more than %number users per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3))); } else { drupal_set_title($account->name); @@ -242,8 +246,8 @@ function contact_admin() { function contact_mail_page() { global $user; - if (!flood_is_allowed('contact', CONTACT_HOURLY_THRESHOLD)) { - $output = t("You can't send more than %number messages per hour. Please try again later.", array('%number' => CONTACT_HOURLY_THRESHOLD)); + if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3))) { + $output = t("You can't send more than %number messages per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3))); } else { if ($user->uid) { diff --git a/modules/contact/contact.module b/modules/contact/contact.module index 0b2803e352b0..02798a8e4ced 100644 --- a/modules/contact/contact.module +++ b/modules/contact/contact.module @@ -6,9 +6,6 @@ * Enables the use of personal contact forms. */ -// Users are not allowed to send more than x mails/hour: -define('CONTACT_HOURLY_THRESHOLD', 3); - /** * Implementation of hook_help(). */ @@ -74,6 +71,13 @@ function contact_settings() { '#default_value' => variable_get('contact_form_information', t('You can leave us a message using the contact form below.')), '#description' => t('Information to show on the <a href="%form">contact page</a>. Can be anything from submission guidelines to your postal address or telephone number.', array('%form' => url('contact'))) ); + $form['contact_hourly_threshold'] = array( + '#type' => 'select', + '#title' => t('Hourly threshold'), + '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50)), + '#default_value' => variable_get('contact_hourly_threshold', 3), + '#description' => t('The maximum number of contact form submissions a user can perform per hour.'), + ); return $form; } @@ -106,8 +110,8 @@ function contact_mail_user() { else if (!valid_email_address($user->mail)) { $output = t('You need to provide a valid e-mail address to contact other users. Please edit your <a href="%url">user information</a>.', array('%url' => url("user/$user->uid/edit"))); } - else if (!flood_is_allowed('contact', CONTACT_HOURLY_THRESHOLD)) { - $output = t("You can't contact more than %number users per hour. Please try again later.", array('%number' => CONTACT_HOURLY_THRESHOLD)); + else if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3))) { + $output = t("You can't contact more than %number users per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3))); } else { drupal_set_title($account->name); @@ -242,8 +246,8 @@ function contact_admin() { function contact_mail_page() { global $user; - if (!flood_is_allowed('contact', CONTACT_HOURLY_THRESHOLD)) { - $output = t("You can't send more than %number messages per hour. Please try again later.", array('%number' => CONTACT_HOURLY_THRESHOLD)); + if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3))) { + $output = t("You can't send more than %number messages per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3))); } else { if ($user->uid) { -- GitLab