Better unique ID generator.
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 1 Dec 2008 10:31:49 +0000 (03:31 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 1 Dec 2008 22:28:06 +0000 (15:28 -0700)
imp/attachment.php
imp/compose.php
imp/lib/MIMP.php

index 0961a4c..a24f0e3 100644 (file)
@@ -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);
index 60ca2ed..42c86e3 100644 (file)
@@ -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...")));
index 9f31634..ccba323 100644 (file)
@@ -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') {