[dev] Re: [cvs] commit: horde/lib/MIME Contents.php Part.php

Jon Knepher jbk at wild-e.com
Thu Jan 9 14:41:54 PST 2003


> ----- Message from chuck at horde.org ---------
> Anyone want to volunteer to rip out our other uniqid() calls where possible?
> :)

I think this works for the modules I have...-------------- next part --------------
Index: problem.php
===================================================================
RCS file: /repository/horde/problem.php,v
retrieving revision 2.83
diff -u -r2.83 problem.php
--- problem.php	3 Jan 2003 02:32:09 -0000	2.83
+++ problem.php	9 Jan 2003 22:32:22 -0000
@@ -51,7 +51,7 @@
         $headers['Received'] .= "\n\t by " . $conf['server']['name'] . ' with HTTP;';
         $headers['Received'] .= "\n\t" . date('r');
 
-        $headers['Message-ID'] = '<' . uniqid(time() . '.') . '@' . $conf['server']['name'] . '>';
+        $headers['Message-ID'] = '<' . md5(time() . '.') . '@' . $conf['server']['name'] . '>';
         $headers['Date'] = date('r');
         $headers['To'] = $conf['problems']['email'];
         if (!empty($email)) {
Index: giapeto/lib/Giapeto.php
===================================================================
RCS file: /repository/giapeto/lib/Giapeto.php,v
retrieving revision 1.88
diff -u -r1.88 Giapeto.php
--- giapeto/lib/Giapeto.php	3 Jan 2003 15:20:34 -0000	1.88
+++ giapeto/lib/Giapeto.php	9 Jan 2003 22:32:22 -0000
@@ -472,7 +472,7 @@
             if (isset($page->blocks[$block_id]['vfs_id'])) {
                 $new_block['vfs_id'] = $page->blocks[$block_id]['vfs_id'];
             } else {
-                $new_block['vfs_id'] = md5(uniqid(rand()));
+                $new_block['vfs_id'] = md5(rand());
             }
             $s = $GLOBALS['vfs']->writeData(GIAPETO_VFS_PATH . $new_block['vfs_path'], $new_block['vfs_id'], $new_block['contents']);
             // now unset this so as to not store it in horde_categories
@@ -485,7 +485,7 @@
                 if (isset($page->blocks[$block_id]['vfs_id'])) {
                     $new_block['vfs_id'] = $page->blocks[$block_id]['vfs_id'];
                 } else {
-                    $new_block['vfs_id'] = md5(uniqid(rand()));
+                    $new_block['vfs_id'] = md5(rand());
                 }
                 $s = $GLOBALS['vfs']->write(GIAPETO_VFS_PATH . $new_block['vfs_path'], $new_block['vfs_id'], $_FILES['block_newfile']['tmp_name']);
             }
Index: imp/lib/Compose.php
===================================================================
RCS file: /repository/imp/lib/Compose.php,v
retrieving revision 1.12
diff -u -r1.12 Compose.php
--- imp/lib/Compose.php	9 Jan 2003 00:12:19 -0000	1.12
+++ imp/lib/Compose.php	9 Jan 2003 22:32:23 -0000
@@ -407,7 +407,7 @@
         if ($conf['compose']['use_vfs']) {
             require_once HORDE_BASE . '/lib/VFS.php';
             $vfs = &Horde_VFS::singleton($conf['vfs']['type'], Horde::getDriverConfig('vfs', $conf['vfs']['type']));
-            $cacheID = md5(uniqid(rand()));
+            $cacheID = md5(rand());
             if ($vfs_file) {
                 $vfs->write(VFS_ATTACH_PATH, $cacheID, $data);
             } else {
Index: imp/lib/Headers.php
===================================================================
RCS file: /repository/imp/lib/Headers.php,v
retrieving revision 1.46
diff -u -r1.46 Headers.php
--- imp/lib/Headers.php	6 Jan 2003 09:35:55 -0000	1.46
+++ imp/lib/Headers.php	9 Jan 2003 22:32:23 -0000
@@ -397,7 +397,7 @@
      */
     function addMessageIdHeader()
     {
-        $this->addHeader('Message-ID', '<' . uniqid(time() . '.') . '@' . $_SERVER['SERVER_NAME'] . '>');
+        $this->addHeader('Message-ID', '<' . md5(time() . '.') . '@' . $_SERVER['SERVER_NAME'] . '>');
     }
 
     /**
@@ -417,7 +417,7 @@
         $this->addHeader('Resent-Date', date('r'));
         $this->addHeader('Resent-From', $from);
         $this->addHeader('Resent-To', $to);
-        $this->addHeader('Resent-Message-ID', '<' . uniqid(time() . '.') . '@' . $conf['server']['name'] . '>');
+        $this->addHeader('Resent-Message-ID', '<' . md5(time() . '.') . '@' . $conf['server']['name'] . '>');
     }
 
     /**
Index: imp/templates/compose/bounce.inc
===================================================================
RCS file: /repository/imp/templates/compose/bounce.inc,v
retrieving revision 2.35
diff -u -r2.35 bounce.inc
--- imp/templates/compose/bounce.inc	31 Dec 2002 22:38:34 -0000	2.35
+++ imp/templates/compose/bounce.inc	9 Jan 2003 22:32:37 -0000
@@ -13,7 +13,7 @@
 //-->
 </script>
 
-<form method="post" action="<?php echo Horde::addParameter(Horde::selfURL(), 'uniq=' . uniqid(rand())) ?>" name="compose" onsubmit="return bounceSubmit(this)">
+<form method="post" action="<?php echo Horde::addParameter(Horde::selfURL(), 'uniq=' . md5(rand())) ?>" name="compose" onsubmit="return bounceSubmit(this)">
 <input type="hidden" name="mailbox" value="<?php echo htmlspecialchars($mailbox) ?>" />
 <input type="hidden" name="index" value="<?php echo htmlspecialchars($index) ?>" />
 <input type="hidden" name="actionID" value="<?php echo BOUNCE_MESSAGE ?>" />
Index: imp/templates/compose/compose.inc
===================================================================
RCS file: /repository/imp/templates/compose/compose.inc,v
retrieving revision 2.201
diff -u -r2.201 compose.inc
--- imp/templates/compose/compose.inc	8 Jan 2003 08:58:10 -0000	2.201
+++ imp/templates/compose/compose.inc	9 Jan 2003 22:32:37 -0000
@@ -1,5 +1,5 @@
 <?php $useHelp = ($conf['user']['online_help'] && $browser->hasFeature('javascript')); ?>
-<form method="post" name="compose" <?php if ($imp['file_upload']): ?>enctype="multipart/form-data" <?php endif; ?>action="<?php echo Horde::addParameter(Horde::url('compose.php'), 'uniq=' . uniqid(rand())) ?>">
+<form method="post" name="compose" <?php if ($imp['file_upload']): ?>enctype="multipart/form-data" <?php endif; ?>action="<?php echo Horde::addParameter(Horde::url('compose.php'), 'uniq=' . md5(rand())) ?>">
 <?php if ($imp['file_upload']): ?>
 <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $imp['file_upload'] ?>" />
 <?php endif; ?>
Index: imp/templates/compose/spelling.inc
===================================================================
RCS file: /repository/imp/templates/compose/spelling.inc,v
retrieving revision 1.31
diff -u -r1.31 spelling.inc
--- imp/templates/compose/spelling.inc	15 Dec 2002 08:40:04 -0000	1.31
+++ imp/templates/compose/spelling.inc	9 Jan 2003 22:32:37 -0000
@@ -1,4 +1,4 @@
-<form method="post" name="compose" enctype="multipart/form-data" action="<?php echo Horde::addParameter(Horde::applicationUrl('compose.php'), 'uniq=' . uniqid(rand())) ?>">
+<form method="post" name="compose" enctype="multipart/form-data" action="<?php echo Horde::addParameter(Horde::applicationUrl('compose.php'), 'uniq=' . md5(rand())) ?>">
 
 <?php
 $count = 0;
Index: imp/templates/contacts/contacts.inc
===================================================================
RCS file: /repository/imp/templates/contacts/contacts.inc,v
retrieving revision 1.12
diff -u -r1.12 contacts.inc
--- imp/templates/contacts/contacts.inc	8 Nov 2002 19:10:20 -0000	1.12
+++ imp/templates/contacts/contacts.inc	9 Jan 2003 22:32:37 -0000
@@ -1,6 +1,6 @@
 <?php echo Help::javascript(); ?>
 
-<form method="post" name="contacts" onsubmit="passAddresses();" action="<?php echo Horde::url('contacts.php?uniq=' . uniqid(rand())) ?>">
+<form method="post" name="contacts" onsubmit="passAddresses();" action="<?php echo Horde::url('contacts.php?uniq=' . md5(rand())) ?>">
 <input type="hidden" name="actionID" value="<?php echo SEARCH_CONTACT ?>" />
 
 <table border="0" align="center" cellpadding="0" cellspacing="1">
Index: kronolith/invite.php
===================================================================
RCS file: /repository/kronolith/invite.php,v
retrieving revision 1.17
diff -u -r1.17 invite.php
--- kronolith/invite.php	4 Jan 2003 06:03:59 -0000	1.17
+++ kronolith/invite.php	9 Jan 2003 22:32:39 -0000
@@ -63,7 +63,7 @@
          $headers['Received'] .= "\n\t by " . $conf['server']['name'] . ' with HTTP;';
          $headers['Received'] .= "\n\t" . date('r');
 
-         $headers['Message-ID'] = '<' . uniqid(time() . '.') . '@' . $conf['server']['name'] . '>';
+         $headers['Message-ID'] = '<' . md5(time() . '.') . '@' . $conf['server']['name'] . '>';
          $headers['Date'] = date('r');
          $headers['To'] = $invitees;
          $headers['From'] = $from;
Index: kronolith/templates/contacts/contacts.inc
===================================================================
RCS file: /repository/kronolith/templates/contacts/contacts.inc,v
retrieving revision 1.1
diff -u -r1.1 contacts.inc
--- kronolith/templates/contacts/contacts.inc	26 Jul 2002 23:06:19 -0000	1.1
+++ kronolith/templates/contacts/contacts.inc	9 Jan 2003 22:32:39 -0000
@@ -1,5 +1,5 @@
 <?php echo Help::javascript(); ?>
-<form method="post" name="contacts" onsubmit="passAddresses();" action="contacts.php?nocache=<?php echo uniqid(rand()) ?>">
+<form method="post" name="contacts" onsubmit="passAddresses();" action="contacts.php?nocache=<?php echo md5(rand()) ?>">
 <?php Horde::pformInput() ?>
 <table border="0" align="center" cellpadding="0" cellspacing="1">
 <tr height="25">
Index: lib/Horde.php
===================================================================
RCS file: /repository/horde/lib/Horde.php,v
retrieving revision 1.248
diff -u -r1.248 Horde.php
--- lib/Horde.php	9 Jan 2003 18:43:24 -0000	1.248
+++ lib/Horde.php	9 Jan 2003 22:32:43 -0000
@@ -672,7 +672,7 @@
         /* We may need to set a dummy parameter 'nocache' since some browsers
            do not always honor the 'no-cache' header. */
         if ($browser->hasQuirk('cache_same_url') && $nocache) {
-            return Horde::addParameter($url, 'nocache', uniqid(rand()));
+            return Horde::addParameter($url, 'nocache', md5(rand()));
         } else {
             return $url;
         }
@@ -986,7 +986,7 @@
         /* Get the first 8 characters of a random string to use as a temporary
            directory name. */
         do {
-            $temp_dir .= '/' . substr(md5(uniqid(rand())), 0, 8);
+            $temp_dir .= '/' . substr(md5(rand()), 0, 8);
         } while (file_exists($temp_dir));
 
         $old_umask = umask(0000);
Index: lib/Secret.php
===================================================================
RCS file: /repository/horde/lib/Secret.php,v
retrieving revision 1.26
diff -u -r1.26 Secret.php
--- lib/Secret.php	3 Jan 2003 02:32:48 -0000	1.26
+++ lib/Secret.php	9 Jan 2003 22:32:43 -0000
@@ -107,7 +107,7 @@
                 $key = $_COOKIE[$keyname . '_key'];
             } else {
                 Secret::_srand();
-                $key = md5(uniqid(mt_rand()));
+                $key = md5(mt_rand());
                 $_COOKIE[$keyname . '_key'] = $key;
                 setcookie($keyname . '_key', $key, null, $conf['cookie']['path'], $conf['cookie']['domain']);
             }
Index: lib/Snoopy.php
===================================================================
RCS file: /repository/horde/lib/Snoopy.php,v
retrieving revision 1.4
diff -u -r1.4 Snoopy.php
--- lib/Snoopy.php	15 Dec 2002 03:19:34 -0000	1.4
+++ lib/Snoopy.php	9 Jan 2003 22:32:43 -0000
@@ -908,7 +908,7 @@
         if($this->read_timeout > 0)
             $cmdline_params .= " -m ".$this->read_timeout;
         
-        $headerfile = uniqid(time());
+        $headerfile = md5(time());
 
         exec($this->curl_path." -D \"/tmp/$headerfile\"".$cmdline_params." ".$URI,$results,$return);
         
@@ -1109,7 +1109,7 @@
                 break;
 
             case "multipart/form-data":
-                $this->_mime_boundary = "Snoopy".md5(uniqid(microtime()));
+                $this->_mime_boundary = "Snoopy".md5(microtime());
                 
                 reset($formvars);
                 while(list($key,$val) = each($formvars)) {
Index: lib/Category/null.php
===================================================================
RCS file: /repository/horde/lib/Category/null.php,v
retrieving revision 1.4
diff -u -r1.4 null.php
--- lib/Category/null.php	10 Dec 2002 18:38:17 -0000	1.4
+++ lib/Category/null.php	9 Jan 2003 22:32:43 -0000
@@ -83,7 +83,7 @@
             $order = null;
         }
 
-        $id = md5(uniqid(rand()));
+        $id = md5(rand());
         if (strstr($fullname, ':')) {
             $parts = explode(':', $fullname);
             $name = array_pop($parts);
Index: lib/Mobile/Renderer/wml.php
===================================================================
RCS file: /repository/horde/lib/Mobile/Renderer/wml.php,v
retrieving revision 1.19
diff -u -r1.19 wml.php
--- lib/Mobile/Renderer/wml.php	3 Jan 2003 02:39:52 -0000	1.19
+++ lib/Mobile/Renderer/wml.php	9 Jan 2003 22:32:43 -0000
@@ -51,7 +51,7 @@
         }
 
         // Tricks to foil caching.
-        header('Content-location: ' . Horde::addParameter(Horde::selfURL(true), 'munq', uniqid(date('U'))));
+        header('Content-location: ' . Horde::addParameter(Horde::selfURL(true), 'munq', md5(date('U'))));
 
         echo "<?xml version=\"1.0\"?>\n";
         if ($this->hasQuirk('ow_gui_1.3')) {
Index: templates/contents/open_view_win.js
===================================================================
RCS file: /repository/horde/templates/contents/open_view_win.js,v
retrieving revision 1.1
diff -u -r1.1 open_view_win.js
--- templates/contents/open_view_win.js	23 Dec 2002 20:38:48 -0000	1.1
+++ templates/contents/open_view_win.js	9 Jan 2003 22:32:56 -0000
@@ -4,7 +4,7 @@
 function view(url, partid)
 {
     param = "menubar=yes,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes";
-    window.open(url, '<?php echo uniqid(rand()) ?>' + tr(partid), param);
+    window.open(url, '<?php echo md5(rand()) ?>' + tr(partid), param);
 }
 
 // -->
Index: turba/lib/Driver/prefs.php
===================================================================
RCS file: /repository/turba/lib/Driver/prefs.php,v
retrieving revision 1.2
diff -u -r1.2 prefs.php
--- turba/lib/Driver/prefs.php	22 Aug 2002 15:29:20 -0000	1.2
+++ turba/lib/Driver/prefs.php	9 Jan 2003 22:32:56 -0000
@@ -121,7 +121,7 @@
      */
     function makeKey($attributes)
     {
-        return md5(uniqid(rand()));
+        return md5(rand());
     }
 
     function _getAddressBook()
Index: turba/lib/Driver/sql.php
===================================================================
RCS file: /repository/turba/lib/Driver/sql.php,v
retrieving revision 1.28
diff -u -r1.28 sql.php
--- turba/lib/Driver/sql.php	5 Jan 2003 02:10:03 -0000	1.28
+++ turba/lib/Driver/sql.php	9 Jan 2003 22:32:56 -0000
@@ -252,7 +252,7 @@
      */
     function makeKey($attributes)
     {
-        return md5(uniqid(rand()));
+        return md5(rand());
     }
 
 }


More information about the dev mailing list