@@ 1342-1362 (lines=21) @@ | ||
1339 | ||
1340 | //// |
|
1341 | // Return a random value |
|
1342 | function tep_rand($min = null, $max = null) { |
|
1343 | static $seeded; |
|
1344 | ||
1345 | if (!isset($seeded)) { |
|
1346 | $seeded = true; |
|
1347 | ||
1348 | if ( (PHP_VERSION < '4.2.0') ) { |
|
1349 | mt_srand((double)microtime()*1000000); |
|
1350 | } |
|
1351 | } |
|
1352 | ||
1353 | if (isset($min) && isset($max)) { |
|
1354 | if ($min >= $max) { |
|
1355 | return $min; |
|
1356 | } else { |
|
1357 | return mt_rand($min, $max); |
|
1358 | } |
|
1359 | } else { |
|
1360 | return mt_rand(); |
|
1361 | } |
|
1362 | } |
|
1363 | ||
1364 | // nl2br() prior PHP 4.2.0 did not convert linefeeds on all OSs (it only converted \n) |
|
1365 | function tep_convert_linefeeds($from, $to, $string) { |
@@ 1252-1272 (lines=21) @@ | ||
1249 | ||
1250 | //// |
|
1251 | // Return a random value |
|
1252 | function tep_rand($min = null, $max = null) { |
|
1253 | static $seeded; |
|
1254 | ||
1255 | if (!isset($seeded)) { |
|
1256 | $seeded = true; |
|
1257 | ||
1258 | if ( (PHP_VERSION < '4.2.0') ) { |
|
1259 | mt_srand((double)microtime()*1000000); |
|
1260 | } |
|
1261 | } |
|
1262 | ||
1263 | if (isset($min) && isset($max)) { |
|
1264 | if ($min >= $max) { |
|
1265 | return $min; |
|
1266 | } else { |
|
1267 | return mt_rand($min, $max); |
|
1268 | } |
|
1269 | } else { |
|
1270 | return mt_rand(); |
|
1271 | } |
|
1272 | } |
|
1273 | ||
1274 | function tep_setcookie($name, $value = '', $expire = 0, $path = '/', $domain = '', $secure = 0) { |
|
1275 | setcookie($name, $value, $expire, $path, (tep_not_null($domain) ? $domain : ''), $secure); |