From de88cb2c1209503f3cd16c60d262e10ce6b9a33c Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 1 Dec 2008 03:31:49 -0700 Subject: [PATCH] Better unique ID generator. --- imp/attachment.php | 2 +- imp/compose.php | 2 +- imp/lib/MIMP.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/imp/attachment.php b/imp/attachment.php index 0961a4cf7..a24f0e386 100644 --- a/imp/attachment.php +++ b/imp/attachment.php @@ -70,7 +70,7 @@ if ($conf['compose']['link_attachments_notify']) { } } else { /* Create a random identifier for this file. */ - $id = base_convert($file_name . microtime(), 10, 36); + $id = uniqid(mt_rand()); $res = $vfsroot->writeData($full_path, $file_name . '.notify' , $id, true); if (is_a($res, 'PEAR_Error')) { Horde::logMessage($res, __FILE__, __LINE__, PEAR_LOG_ERR); diff --git a/imp/compose.php b/imp/compose.php index 60ca2ed3b..42c86e3cf 100644 --- a/imp/compose.php +++ b/imp/compose.php @@ -826,7 +826,7 @@ if ($showmenu) { /* Set up the base template now. */ $t = new IMP_Template(); $t->setOption('gettext', true); -$t->set('post_action', Util::addParameter(Horde::applicationUrl('compose.php'), 'uniq', base_convert(microtime(), 10, 36))); +$t->set('post_action', Util::addParameter(Horde::applicationUrl('compose.php'), 'uniq', uniqid(mt_rand()))); $t->set('allow_compose', !$compose_disable); if ($has_js) { $t->set('loading_img', Horde::img('loading.gif', _("Loading..."))); diff --git a/imp/lib/MIMP.php b/imp/lib/MIMP.php index 9f3163415..ccba323f6 100644 --- a/imp/lib/MIMP.php +++ b/imp/lib/MIMP.php @@ -34,7 +34,7 @@ class MIMP (empty($GLOBALS['conf']['hooks']['disable_compose']) || Horde::callHook('_imp_hook_disable_compose', array(true), 'imp'))) { - $items[Util::addParameter(Horde::applicationUrl('compose-mimp.php'), 'u', base_convert(microtime() . mt_rand(), 10, 36))] = _("New Message"); + $items[Util::addParameter(Horde::applicationUrl('compose-mimp.php'), 'u', uniqid(mt_rand()))] = _("New Message"); } if ($page != 'folders') { -- 2.11.0