summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-ximageinfo_cache.admin.inc9
-rwxr-xr-ximageinfo_cache.module4
2 files changed, 6 insertions, 7 deletions
diff --git a/imageinfo_cache.admin.inc b/imageinfo_cache.admin.inc
index 944613e..639cacb 100755
--- a/imageinfo_cache.admin.inc
+++ b/imageinfo_cache.admin.inc
@@ -63,8 +63,8 @@ function imageinfo_cache_admin_form($form_state) {
$form['imageinfo_cache_url_key'] = array(
'#type' => 'textfield',
'#title' => t('Shared authentication key'),
- '#default_value' => variable_get('imageinfo_cache_url_key', FALSE),
- '#description' => t('Use at least a 9 digit key. This must match on all async servers.'),
+ '#default_value' => variable_get('imageinfo_cache_url_key', md5(drupal_get_private_key())),
+ '#description' => t('Use a 32 character md5 hash. This must match on all async servers.'),
);
$form['imageinfo_cache_server_addr'] = array(
'#type' => 'textfield',
@@ -109,10 +109,9 @@ function imageinfo_cache_admin_form_validate($form, &$form_state) {
}
if ( empty($values['imageinfo_cache_url_key'])
- || !is_numeric($values['imageinfo_cache_url_key'])
- || $values['imageinfo_cache_url_key'] < 1
+ || !preg_match('/^[a-f0-9]{32}$/', $md5)
) {
- form_set_error('imageinfo_cache_url_key', t('Number must be a positive interger.'));
+ form_set_error('imageinfo_cache_url_key', t('Value must be a valid md5 hash. Recommended md5 hash on this server: %value', array('%value' => md5(drupal_get_private_key()))));
}
// Do no set certian variables.
diff --git a/imageinfo_cache.module b/imageinfo_cache.module
index 20d49fd..57248e2 100755
--- a/imageinfo_cache.module
+++ b/imageinfo_cache.module
@@ -226,7 +226,7 @@ function imageinfo_cache_shutdown_async($file = NULL, $op = NULL, $state = NULL)
}
// URL key.
- $key = md5(drupal_get_private_key());
+ $key = variable_get('imageinfo_cache_url_key', md5(drupal_get_private_key()));
foreach ($files as $values) {
$query['files'] = $values;
@@ -444,7 +444,7 @@ function imageinfo_cache_primer($values = NULL) {
if (empty($_POST['key']) || empty($_POST['files'])) {
return;
}
- $key = md5(drupal_get_private_key());
+ $key = variable_get('imageinfo_cache_url_key', md5(drupal_get_private_key()));
if ($key != $_POST['key']) {
return;
}