Revision: 1660
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1660&view=rev
Author:   cimorrison
Date:     2010-12-02 11:22:31 +0000 (Thu, 02 Dec 2010)

Log Message:
-----------
Improved algorithm for generating globally unique iCalendar uids

Modified Paths:
--------------
    mrbs/branches/ics_attachments/web/edit_entry_handler.php

Modified: mrbs/branches/ics_attachments/web/edit_entry_handler.php
===================================================================
--- mrbs/branches/ics_attachments/web/edit_entry_handler.php    2010-12-02 
11:03:37 UTC (rev 1659)
+++ mrbs/branches/ics_attachments/web/edit_entry_handler.php    2010-12-02 
11:22:31 UTC (rev 1660)
@@ -17,13 +17,13 @@
 //
 // We will generate a uid of the form "mrbs-uniqid-md5h...@domain_name" 
 // where uniqid is time based and is generated by uniqid() and the
-// MD5hash is the first 8 characters of the MD5 hash of the $str - 
-// typically this will be something specific to the booking such as
-// the brief description.
+// MD5hash is the first 8 characters of the MD5 hash of $str concatenated
+// with a random number.  Typically $str will be something specific to
+// the booking such as the brief description.
 function generate_ical_uid($str)
 {
   $uid = uniqid('MRBS-');
-  $uid .= "-" . substr(md5($str), 0, 8);
+  $uid .= "-" . substr(md5($str . rand(0,10000)), 0, 8);
   $uid .= "@";
   // Add on the domain name if possible, if not the server name,
   // otherwise 'MRBS'
@@ -39,6 +39,7 @@
   {
     $uid .= $_SERVER['SERVER_NAME'];
   }
+
   return $uid;
 }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to