Code Duplication    Length = 15-15 lines in 2 locations

catalog/admin/includes/functions/general.php 1 location

@@ 1379-1393 (lines=15) @@
1376
1377
////
1378
// Parse and secure the cPath parameter values
1379
  function tep_parse_category_path($cPath) {
1380
// make sure the category IDs are integers
1381
    $cPath_array = array_map('tep_string_to_int', explode('_', $cPath));
1382
1383
// make sure no duplicate category IDs exist which could lock the server in a loop
1384
    $tmp_array = array();
1385
    $n = sizeof($cPath_array);
1386
    for ($i=0; $i<$n; $i++) {
1387
      if (!in_array($cPath_array[$i], $tmp_array)) {
1388
        $tmp_array[] = $cPath_array[$i];
1389
      }
1390
    }
1391
1392
    return $tmp_array;
1393
  }
1394
1395
  function tep_validate_ip_address($ip_address) {
1396
    if (function_exists('filter_var') && defined('FILTER_VALIDATE_IP')) {

catalog/includes/functions/general.php 1 location

@@ 1234-1248 (lines=15) @@
1231
1232
////
1233
// Parse and secure the cPath parameter values
1234
  function tep_parse_category_path($cPath) {
1235
// make sure the category IDs are integers
1236
    $cPath_array = array_map('tep_string_to_int', explode('_', $cPath));
1237
1238
// make sure no duplicate category IDs exist which could lock the server in a loop
1239
    $tmp_array = array();
1240
    $n = sizeof($cPath_array);
1241
    for ($i=0; $i<$n; $i++) {
1242
      if (!in_array($cPath_array[$i], $tmp_array)) {
1243
        $tmp_array[] = $cPath_array[$i];
1244
      }
1245
    }
1246
1247
    return $tmp_array;
1248
  }
1249
1250
////
1251
// Return a random value