md5() -> hash()
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 15 Jan 2009 05:09:14 +0000 (22:09 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 15 Jan 2009 05:09:14 +0000 (22:09 -0700)
28 files changed:
folks/config/hooks.php.dist
folks/lib/Driver.php
folks/lib/Folks.php
folks/lib/Friends/shared.php
framework/Form/lib/Horde/Form/VarRenderer/Xhtml.php
framework/Service_Scribd/lib/Horde/Service/Scribd/Request.php
framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php
imp/lib/Compose.php
imp/lib/Contents.php
imp/lib/Folder.php
imp/lib/IMP.php
kronolith/attendees.php
kronolith/edit.php
kronolith/event.php
kronolith/lib/Block/monthlist.php
kronolith/lib/Block/prevmonthlist.php
kronolith/lib/Block/summary.php
kronolith/lib/Driver/kolab.php
kronolith/lib/Driver/sql.php
kronolith/lib/Forms/CreateCalendar.php
kronolith/lib/Kronolith.php
kronolith/lib/Views/Day.php
kronolith/lib/Views/Month.php
kronolith/lib/Views/Week.php
kronolith/templates/category_legend.inc
kronolith/templates/contacts/contacts.inc
kronolith/templates/search/event_summaries.inc
kronolith/themes/categoryCSS.php

index 5172422..f5f6d17 100644 (file)
 //                 continue;
 //             }
 //             if ($field == 'password') {
-//                 $value = md5($value);
+//                 $value = hash('md5', $value);
 //             }
 //             $fields[] = 'user_' . String::lower($field);
 //             $values[] = String::convertCharset($value, NLS::getCharset(), $conf['sql']['charset']);
 //         }
 //
 //         require_once $GLOBALS['registry']->get('fileroot', 'folks') . '/lib/Folks.php';
-//         $code = Folks::encodeString($userID, 'activate' . md5($extra['password']));
+//         $code = Folks::encodeString($userID, 'activate' . hash('md5', $extra['password']));
 //         $link = Util::addParameter(Horde::applicationUrl('account/approve.php', true, -1),
 //                                     array('user' => $userID, 'code' => $code),
 //                                     null, false);
 //         $auth = &Auth::singleton('folks');
 //         return $auth->setAuth($_COOKIE['folks_login_user'], array('transparent' => 1, 'password' => null));
 //     }
-// }
\ No newline at end of file
+// }
index a712729..728b1cb 100644 (file)
@@ -88,7 +88,7 @@ class Folks_Driver {
             return $vfs;
         }
 
-        $p = md5($user);
+        $p = hash('md5', $user);
         $vfspath = Folks::VFS_PATH . '/' . substr(str_pad($p, 2, 0, STR_PAD_LEFT), -2) . '/';
         $vfs_name = $p . '.' . $conf['images']['image_type'];
 
@@ -134,7 +134,7 @@ class Folks_Driver {
             return $vfs;
         }
 
-        $p = md5($user);
+        $p = hash('md5', $user);
         $vfspath = Folks::VFS_PATH . '/' . substr(str_pad($p, 2, 0, STR_PAD_LEFT), -2) . '/';
         $vfs_name = $p . '.' . $GLOBALS['conf']['images']['image_type'];
 
@@ -457,7 +457,7 @@ class Folks_Driver {
             $user = Auth::getAuth();
         }
 
-        $password = md5($password);
+        $password = hash('md5', $password);
 
         return $this->_saveProfile(array('user_password' => $password), $user);
     }
@@ -624,7 +624,7 @@ class Folks_Driver {
             return false;
         }
 
-        return $encrypted == md5($plaintext);
+        return $encrypted == hash('md5', $plaintext);
     }
 
     /**
@@ -814,4 +814,4 @@ class Folks_Driver {
         return $this->_deleteActivity($scope, $date, $user);
     }
 
-}
\ No newline at end of file
+}
index d31a14b..85c20f3 100644 (file)
@@ -64,7 +64,7 @@ class Folks {
                                            'id' => $user),
                                      null, false);
         } else {
-            $p = md5($user);
+            $p = hash('md5', $user);
             return $GLOBALS['conf']['images']['direct'] .
                    '/' . substr(str_pad($p, 2, 0, STR_PAD_LEFT), -2) . '/' . $view . '/' .
                    $p . '.' . $GLOBALS['conf']['images']['image_type'];
@@ -205,7 +205,7 @@ class Folks {
      */
     static function encodeString($string, $key)
     {
-        $key = substr(md5($key), 0, 24);
+        $key = substr(hash('md5', $key), 0, 24);
         $iv_size = mcrypt_get_iv_size(MCRYPT_3DES, MCRYPT_MODE_ECB);
         $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
         $string = mcrypt_ecb(MCRYPT_3DES, $key, $string, MCRYPT_ENCRYPT, $iv);
@@ -302,4 +302,4 @@ class Folks {
             return $menu->render();
         }
     }
-}
\ No newline at end of file
+}
index c58ad14..7a2e416 100644 (file)
@@ -221,7 +221,7 @@ class Folks_Friends_shared extends  Folks_Friends_sql  {
     {
         $GLOBALS['folks_shares'] = Horde_Share::singleton('folks');
 
-        $share = $GLOBALS['folks_shares']->newShare(md5(microtime()));
+        $share = $GLOBALS['folks_shares']->newShare(hash('md5', microtime()));
         if ($share instanceof PEAR_Error) {
             return $share;
         }
@@ -234,4 +234,4 @@ class Folks_Friends_shared extends  Folks_Friends_sql  {
 
         return $GLOBALS['folks_shares']->addShare($share);
     }
-}
\ No newline at end of file
+}
index 9209cfa..ec3938d 100644 (file)
@@ -866,7 +866,7 @@ EOT;
     {
         $varname = $var->getVarName();
         $varvalue = $vars->get($varname);
-        $fieldId = 'obrowser_' . md5(uniqid(rand(), true));
+        $fieldId = 'obrowser_' . hash('md5', uniqid(rand(), true));
         $html = '
             <script type="text/javascript">
             var obrowserWindowName;
index 4efa0a4..f9a70ff 100644 (file)
@@ -65,7 +65,7 @@ class Horde_Service_Scribd_Request
             $signature .= $k . $v;
         }
 
-        return md5($signature);
+        return hash('md5', $signature);
     }
 
 }
index bd53c67..478c07b 100644 (file)
@@ -104,7 +104,7 @@ class Horde_Service_Vimeo_Simple extends Horde_Service_Vimeo {
         // See if we have a cache, and if so, try to get the data from it before
         // polling the vimeo service.
         if (!empty($this->_cache)) {
-            $cache_key = 'VimeoJson' . md5(serialize($options));
+            $cache_key = 'VimeoJson' . hash('md5', serialize($options));
             $data = $this->_cache->get($cache_key, $this->_cache_lifetime);
             if ($data !== false) {
                 return unserialize($data);
@@ -138,7 +138,7 @@ class Horde_Service_Vimeo_Simple extends Horde_Service_Vimeo {
     {
         $call =  '/' . $this->_identifier . '/' . $this->_method . '.' . $this->_format;
         if (!empty($this->_cache)) {
-            $cache_key = 'VimeoRequest' . md5($call);
+            $cache_key = 'VimeoRequest' . hash('md5', $call);
             $data = $this->_cache->get($cache_key, $this->_cache_lifetime);
             if ($data !== false) {
                 // php format is already returned serialized
@@ -166,4 +166,4 @@ class Horde_Service_Vimeo_Simple extends Horde_Service_Vimeo {
 
     }
 
-}
\ No newline at end of file
+}
index ff15487..dfac759 100644 (file)
@@ -2388,7 +2388,7 @@ class IMP_Compose
 
         $vfs = VFS::singleton($GLOBALS['conf']['vfs']['type'], Horde::getDriverConfig('vfs', $GLOBALS['conf']['vfs']['type']));
         // TODO: Garbage collection?
-        $result = $vfs->writeData(self::VFS_DRAFTS_PATH, md5(Util::getFormData('user')), $body, true);
+        $result = $vfs->writeData(self::VFS_DRAFTS_PATH, hash('md5', Util::getFormData('user')), $body, true);
         if (is_a($result, 'PEAR_Error')) {
             return;
         }
@@ -2405,7 +2405,7 @@ class IMP_Compose
             return;
         }
 
-        $filename = md5($_SESSION['imp']['uniquser']);
+        $filename = hash('md5', $_SESSION['imp']['uniquser']);
         $vfs = VFS::singleton($GLOBALS['conf']['vfs']['type'], Horde::getDriverConfig('vfs', $GLOBALS['conf']['vfs']['type']));
         if ($vfs->exists(self::VFS_DRAFTS_PATH, $filename)) {
             $data = $vfs->read(self::VFS_DRAFTS_PATH, $filename);
index cdd967a..bc7479f 100644 (file)
@@ -88,7 +88,7 @@ class IMP_Contents
         static $instance = array();
 
         $sig = is_a($in, 'Horde_Mime_Part')
-            ? md5(serialize($in))
+            ? hash('md5', serialize($in))
             : $in;
 
         if (empty($instance[$sig])) {
@@ -667,7 +667,7 @@ class IMP_Contents
             'params' => array()
         ), $options);
 
-        return Horde::link($this->urlView($mime_part, $actionID, $options), $options['jstext'], $options['class'], empty($options['dload']) ? null : 'view_' . md5($mime_part->getMIMEId() . $this->_mailbox . $this->_index)) . $text . '</a>';
+        return Horde::link($this->urlView($mime_part, $actionID, $options), $options['jstext'], $options['class'], empty($options['dload']) ? null : 'view_' . hash('md5', $mime_part->getMIMEId() . $this->_mailbox . $this->_index)) . $text . '</a>';
     }
 
     /**
index 53ff5d9..13140fc 100644 (file)
@@ -98,7 +98,7 @@ class IMP_Folder
         }
 
         /* Compute values that will uniquely identify this list. */
-        $sig = md5(serialize(array(intval($sub), $filter)));
+        $sig = hash('md5', serialize(array(intval($sub), $filter)));
 
         /* Either get the list from the cache, or go to the IMAP server to
            obtain it. */
index d74a8f6..daac3da 100644 (file)
@@ -1529,7 +1529,7 @@ class IMP
         }
 
         require_once IMP_BASE . '/lib/version.php';
-        $sig = md5(serialize($s_list) . max($mtime) . IMP_VERSION);
+        $sig = hash('md5', serialize($s_list) . max($mtime) . IMP_VERSION);
 
         switch ($cache_type) {
         case 'filesystem':
@@ -1666,7 +1666,7 @@ class IMP
             }
 
             require_once IMP_BASE . '/lib/version.php';
-            $sig = md5(serialize($css) . max($mtime) . IMP_VERSION);
+            $sig = hash('md5', serialize($css) . max($mtime) . IMP_VERSION);
 
             switch ($cache_type) {
             case 'filesystem':
index 8dfb7a4..233208d 100644 (file)
@@ -178,7 +178,7 @@ case 'dismiss':
     }
 
     // Make sure URL is unique.
-    $location = Util::addParameter($location, 'unique', md5(microtime()));
+    $location = Util::addParameter($location, 'unique', hash('md5', microtime()));
     header('Location: ' . $location);
     exit;
 
index c1d3d08..304b35f 100644 (file)
@@ -181,5 +181,5 @@ if (!empty($url)) {
 }
 
 // Make sure URL is unique.
-$location = Util::addParameter($location, 'unique', md5(microtime()), false);
+$location = Util::addParameter($location, 'unique', hash('md5', microtime()), false);
 header('Location: ' . $location);
index 368fe98..0076994 100644 (file)
@@ -39,7 +39,7 @@ case 'EditEvent':
         if (empty($url)) {
             $url = Horde::applicationUrl($prefs->getValue('defaultview') . '.php', true);
         }
-        header('Location: ' . Util::addParameter($url, 'unique', md5(microtime()), false));
+        header('Location: ' . Util::addParameter($url, 'unique', hash('md5', microtime()), false));
         exit;
     }
     break;
index fc330b7..c07b820 100644 (file)
@@ -150,7 +150,7 @@ class Horde_Block_Kronolith_monthlist extends Horde_Block {
                 }
 
                 $html .= '</td><td class="text">&nbsp;&nbsp;&nbsp;</td>' .
-                    '<td class="block-eventbox category' . md5($event->getCategory()) . '" valign="top">';
+                    '<td class="block-eventbox category' . hash('md5', $event->getCategory()) . '" valign="top">';
 
                 if ($event->start->compareDate($now) < 0 &&
                     $event->end->compareDate($now) > 0) {
index 8144ba1..4d438c0 100644 (file)
@@ -142,7 +142,7 @@ class Horde_Block_Kronolith_prevmonthlist extends Horde_Block {
                 }
 
                 $html .= '</td><td class="text">&nbsp;&nbsp;&nbsp;</td>' .
-                    '<td class="block-eventbox category' . md5($event->getCategory()) . '" valign="top">';
+                    '<td class="block-eventbox category' . hash('md5', $event->getCategory()) . '" valign="top">';
 
                 if ($event->start->compareDate($startDate) < 0 &&
                     $event->end->compareDate($startDate) > 0) {
index afb566b..a3a1ac8 100644 (file)
@@ -175,7 +175,7 @@ class Horde_Block_Kronolith_summary extends Horde_Block {
                 }
 
                 $html .= '</td><td class="text">&nbsp;&nbsp;&nbsp;</td>' .
-                    '<td class="block-eventbox category' . md5($event->getCategory()) . '" valign="top">';
+                    '<td class="block-eventbox category' . hash('md5', $event->getCategory()) . '" valign="top">';
 
                 if ($event_active) {
                     $html .= '<strong>';
index f94785c..7d52d84 100644 (file)
@@ -469,7 +469,7 @@ class Kronolith_Driver_kolab_wrapper_old extends Kronolith_Driver_kolab_wrapper
             if ($event->getUID()) {
                 $uid = $event->getUID();
             } else {
-                $uid = md5(uniqid(mt_rand(), true));
+                $uid = hash('md5', uniqid(mt_rand(), true));
                 $event->setUID($uid);
                 $event->setId($uid);
             }
index 8e5b9bf..b41a8a5 100644 (file)
@@ -535,7 +535,7 @@ class Kronolith_Driver_sql extends Kronolith_Driver {
             if ($event->getId()) {
                 $id = $event->getId();
             } else {
-                $id = md5(uniqid(mt_rand(), true));
+                $id = hash('md5', uniqid(mt_rand(), true));
                 $event->setId($id);
             }
 
index 2206578..09866fa 100644 (file)
@@ -42,7 +42,7 @@ class Kronolith_CreateCalendarForm extends Horde_Form {
     function execute()
     {
         // Create new share.
-        $calendar = $GLOBALS['kronolith_shares']->newShare(md5(microtime()));
+        $calendar = $GLOBALS['kronolith_shares']->newShare(hash('md5', microtime()));
         if (is_a($calendar, 'PEAR_Error')) {
             return $calendar;
         }
index 79f0b7c..cd13a32 100644 (file)
@@ -263,7 +263,7 @@ class Kronolith {
         }
 
         require_once KRONOLITH_BASE . '/lib/version.php';
-        $sig = md5(serialize($s_list) . max($mtime) . KRONOLITH_VERSION);
+        $sig = hash('md5', serialize($s_list) . max($mtime) . KRONOLITH_VERSION);
 
         switch ($cache_type) {
         case 'filesystem':
@@ -373,7 +373,7 @@ class Kronolith {
             }
 
             require_once KRONOLITH_BASE . '/lib/version.php';
-            $sig = md5(serialize($css) . max($mtime) . KRONOLITH_VERSION);
+            $sig = hash('md5', serialize($css) . max($mtime) . KRONOLITH_VERSION);
 
             switch ($cache_type) {
             case 'filesystem':
index acbf922..60afd6d 100644 (file)
@@ -134,7 +134,7 @@ class Kronolith_View_Day extends Kronolith_Day {
                         $eventCategories[$event->getCategory()] = true;
                     }
 
-                    $row .= '<td class="day-eventbox category' . md5($event->getCategory()) . '" '
+                    $row .= '<td class="day-eventbox category' . hash('md5', $event->getCategory()) . '" '
                         . 'width="' . round(90 / count($this->_currentCalendars))  . '%" '
                         . 'valign="top" colspan="' . $this->_span[$cid] . '">'
                         . $event->getLink($this, true, $this->link(0, true));
@@ -249,7 +249,7 @@ class Kronolith_View_Day extends Kronolith_Day {
                             }
                         }
 
-                        $row .= '<td class="day-eventbox category' . md5($event->getCategory()) . '" '
+                        $row .= '<td class="day-eventbox category' . hash('md5', $event->getCategory()) . '" '
                             . 'width="' . round((90 / count($this->_currentCalendars)) * ($span / $this->_span[$cid]))  . '%" '
                             . 'valign="top" colspan="' . $span . '" rowspan="' . $event->rowspan . '">'
                             . $event->getLink($this, true, $this->link(0, true));
index f846671..45ab666 100644 (file)
@@ -209,7 +209,7 @@ class Kronolith_View_Month {
                             if ($event->hasPermission(PERMS_READ)) {
                                 $eventCategories[$event->getCategory()] = true;
                             }
-                            $html .= '<div class="month-eventbox category' . md5($event->getCategory()) . '">'
+                            $html .= '<div class="month-eventbox category' . hash('md5', $event->getCategory()) . '">'
                                 . $event->getLink($date, true, $this->link(0, true));
                             if ($showTime) {
                                 $html .= '<div class="event-time">' . htmlspecialchars($event->getTimeRange()) . '</div>';
index 748d565..c8963fa 100644 (file)
@@ -148,7 +148,7 @@ class Kronolith_View_Week {
                                 $eventCategories[$event->getCategory()] = true;
                             }
 
-                            $row .= '<td class="week-eventbox category' . md5($event->getCategory()) . '" '
+                            $row .= '<td class="week-eventbox category' . hash('md5', $event->getCategory()) . '" '
                                 . 'width="' . round(99 / count($this->days[$j]->_currentCalendars)) . '%" '
                                 . 'valign="top">'
                                 . $event->getLink($this->days[$j], true, $this->link(0, true));
@@ -275,7 +275,7 @@ class Kronolith_View_Week {
                                     }
                                 }
 
-                                $row .= '<td class="week-eventbox category' . md5($event->getCategory()) . '" '
+                                $row .= '<td class="week-eventbox category' . hash('md5', $event->getCategory()) . '" '
                                     . 'valign="top" '
                                     . 'width="' . floor(((90 / count($this->days)) / count($this->_currentCalendars)) * ($span / $this->days[$j]->_span[$cid])) . '%" '
                                     . 'colspan="' . $span . '" rowspan="' . $event->rowspan . '">'
index 2a1265f..d934664 100644 (file)
@@ -10,7 +10,7 @@ if ($GLOBALS['prefs']->getValue('show_legend') && count($eventCategories)) {
             continue;
         }
 
-        $html .= ' <span class="legend-eventbox event category' . md5($category) . '">' .
+        $html .= ' <span class="legend-eventbox event category' . hash('md5', $category) . '">' .
             Text::htmlAllSpaces($category) . '</span>';
     }
 
index 0a5102f..689d5da 100644 (file)
@@ -131,7 +131,7 @@ window.onload = function() {
 
 //-->
 </script>
-<form method="post" name="contacts" onsubmit="passAddresses();" action="contacts.php?nocache=<?php echo md5(mt_rand()) ?>">
+<form method="post" name="contacts" onsubmit="passAddresses();" action="contacts.php?nocache=<?php echo hash('md5', mt_rand()) ?>">
 <input type="hidden" name="sa" />
 <?php Util::pformInput() ?>
 
index bd7df64..4a37373 100644 (file)
@@ -1,5 +1,5 @@
 <tr class="text">
- <td nowrap="nowrap" class="category<?php echo md5($found->getCategory()) ?>">
+ <td nowrap="nowrap" class="category<?php echo hash('md5', $found->getCategory()) ?>">
   <?php echo $found->getLink() ?>
  </td>
  <td class="nowrap"><?php echo htmlspecialchars($found->getCategory()) ?></td>
index a25468e..b783f91 100644 (file)
@@ -27,7 +27,7 @@ foreach ($colors as $category => $color) {
             '.month-eventBox a, .week-eventBox a, .day-eventBox a, .block-eventBox a, .legend-eventBox a, ',
             '.month-eventBox a:hover, .week-eventBox a:hover, .day-eventBox a:hover, .block-eventBox a:hover, .legend-eventBox a:hover { ';
     } else {
-        $class = '.category' . md5($category);
+        $class = '.category' . hash('md5', $category);
         echo "$class, .linedRow td$class, $class a, $class a:hover { ";
     }