[!!!][BUGFIX] *_user table password field is to short
[Packages/TYPO3.CMS.git] / typo3 / sysext / indexed_search / class.tx_indexedsearch_util.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2011 Dmitry Dulepov (dmitry@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27
28 /**
29 * Class with common methods used across various classes in the indexed search.
30 * Impementation is provided by various people from the TYPO3 community.
31 *
32 * This class is final because it contains only static methods.
33 *
34 * @author Dmitry Dulepov <dmitry@typo3.com>
35 * @package TYPO3
36 * @subpackage tx_indexedsearch
37 */
38 final class tx_indexedsearch_util {
39
40 /**
41 * Check if the tables provided are configured for usage. This becomes
42 * neccessary for extensions that provide additional database functionality
43 * like indexed_search_mysql.
44 *
45 * @param string $tableName Table name to check
46 * @return boolean True if the given table is used
47 */
48 static function isTableUsed($tableName) {
49 $tableList = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['use_tables'];
50 return t3lib_div::inList($tableList, $tableName);
51 }
52
53 /**
54 * md5 integer hash
55 * Using 7 instead of 8 just because that makes the integers lower than 32 bit (28 bit) and so they do not interfere with UNSIGNED integers or PHP-versions which has varying output from the hexdec function.
56 *
57 * @param string $stringToHash String to hash
58 * @return int Integer intepretation of the md5 hash of input string.
59 */
60 static function md5inthash($stringToHash) {
61 return hexdec(substr(md5($stringToHash), 0, 7));
62 }
63
64 }
65 ?>