More places to use Horde_Support_Randomid
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 6 Sep 2010 22:01:40 +0000 (16:01 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 7 Sep 2010 01:16:01 +0000 (19:16 -0600)
imp/lib/Injector/Factory/Compose.php
imp/lib/Mailbox.php
imp/lib/Mime/Viewer/Html.php
imp/lib/Search.php

index 5432b9f..6c02b38 100644 (file)
@@ -62,7 +62,7 @@ class IMP_Injector_Factory_Compose
     public function getOb($cacheid = null)
     {
         if (empty($cacheid)) {
-            $cacheid = uniqid(mt_rand());
+            $cacheid = strval(new Horde_Support_Randomid());
         } elseif (!isset($this->_instances[$cacheid])) {
             $obs = $GLOBALS['injector']->getInstance('Horde_SessionObjects');
             $this->_instances[$cacheid] = $obs->query($cacheid);
index 11f1f35..0e49d54 100644 (file)
@@ -773,8 +773,7 @@ class IMP_Mailbox implements Countable
             } catch (Horde_Imap_Client_Exception $e) {}
         }
 
-        /* This should generate a sufficiently random #. */
-        return time() . mt_rand();
+        return strval(new Horde_Support_Randomid());
     }
 
     /* Countable methods. */
index 71c9ffe..3384f5e 100644 (file)
@@ -79,7 +79,7 @@ class IMP_Mime_Viewer_Html extends Horde_Mime_Viewer_Html
 
         /* Catch case where using mimp on a javascript browser. */
         if ($_SESSION['imp']['view'] != 'mimp') {
-            $uid = 'htmldata_' . uniqid(mt_rand());
+            $uid = strval(new Horde_Support_Randomid());
 
             Horde::addScriptFile('imp.js', 'imp');
 
@@ -146,7 +146,7 @@ class IMP_Mime_Viewer_Html extends Horde_Mime_Viewer_Html
                 'img' => ($inline && $GLOBALS['prefs']->getValue('html_image_replacement') && !$this->_inAddressBook()),
                 'imgblock' => false,
                 'inline' => $inline,
-                'target' => 'target_' . uniqid(mt_rand())
+                'target' => strval(new Horde_Support_Randomid())
             );
 
             /* Image filtering. */
index b5a288a..1c026e2 100644 (file)
@@ -370,7 +370,9 @@ class IMP_Search
     public function createSearchQuery($query, $folders, $criteria, $label,
                                       $id = null)
     {
-        $id = is_null($id) ? uniqid(mt_rand()) : $this->_strip($id);
+        $id = is_null($id)
+            ? strval(new Horde_Support_Randomid())
+            : $this->_strip($id);
 
         $_SESSION['imp']['search'][$id] = array(
             'c' => $criteria,