summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-12-13 18:49:47 +0000
committerDries Buytaert <dries@buytaert.net>2005-12-13 18:49:47 +0000
commitdd2fdd128dfb5998479f9edf89d0cfa3afe53fbd (patch)
tree98fb537b3d407731e93593bacf05019cf47501d9
parentccb3fa0219643d98d08fdd26dddecfa2dbb5e3b5 (diff)
downloadbrdo-dd2fdd128dfb5998479f9edf89d0cfa3afe53fbd.tar.gz
brdo-dd2fdd128dfb5998479f9edf89d0cfa3afe53fbd.tar.bz2
- Patch #40532 by wtanaka: use longblog for data in the cache. Is reported to fix utf-8 problems and improves consistency with PostgreSQL.
-rw-r--r--database/database.mysql2
-rw-r--r--database/updates.inc7
-rw-r--r--modules/contact.module18
-rw-r--r--modules/contact/contact.module18
4 files changed, 30 insertions, 15 deletions
diff --git a/database/database.mysql b/database/database.mysql
index 5cbc889f3..c96c51ee3 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 6dbc04368..a44580c18 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 0b2803e35..02798a8e4 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 0b2803e35..02798a8e4 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) {