Binary files TYPO3.CMS/.git/index and TYPO3.CMS.PATCHED/.git/index differ diff -ruN TYPO3.CMS/typo3/sysext/frontend/Classes/ContentObject/Menu/CategoryMenuUtility.php TYPO3.CMS.PATCHED/typo3/sysext/frontend/Classes/ContentObject/Menu/CategoryMenuUtility.php --- TYPO3.CMS/typo3/sysext/frontend/Classes/ContentObject/Menu/CategoryMenuUtility.php Mon Jul 13 13:49:46 2015 +++ TYPO3.CMS.PATCHED/typo3/sysext/frontend/Classes/ContentObject/Menu/CategoryMenuUtility.php Thu Oct 22 22:36:02 2015 @@ -100,26 +100,32 @@ protected function sortPages($pages, $order) { // Perform the sorting only if a criterion was actually defined if (!empty(self::$sortingField)) { - // Check that the sorting field exists (checking the first record is enough) - $firstPage = current($pages); - if (isset($firstPage[self::$sortingField])) { - // Make sure the order property is either "asc" or "desc" (default is "asc") - if (!empty($order)) { - $order = strtolower($order); - if ($order != 'desc') { - $order = 'asc'; + // Shuffle pages if sorting is set to mysql randomize function + if ("rand()" == self::$sortingField) { + shuffle($pages); + } + else { + // Check that the sorting field exists (checking the first record is enough) + $firstPage = current($pages); + if (isset($firstPage[self::$sortingField])) { + // Make sure the order property is either "asc" or "desc" (default is "asc") + if (!empty($order)) { + $order = strtolower($order); + if ($order != 'desc') { + $order = 'asc'; + } + } + uasort( + $pages, + array( + '\TYPO3\CMS\Frontend\ContentObject\Menu\CategoryMenuUtility', + 'sortPagesUtility' + ) + ); + // If the sort order is descending, reverse the sorted array + if ($order == 'desc') { + $pages = array_reverse($pages, TRUE); } - } - uasort( - $pages, - array( - '\TYPO3\CMS\Frontend\ContentObject\Menu\CategoryMenuUtility', - 'sortPagesUtility' - ) - ); - // If the sort order is descending, reverse the sorted array - if ($order == 'desc') { - $pages = array_reverse($pages, TRUE); } } }