Code Duplication    Length = 9-10 lines in 2 locations

catalog/includes/functions/general.php 2 locations

@@ 570-578 (lines=9) @@
567
////
568
// Return all subcategory IDs
569
// TABLES: categories
570
  function tep_get_subcategories(&$subcategories_array, $parent_id = 0) {
571
    $subcategories_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$parent_id . "'");
572
    while ($subcategories = tep_db_fetch_array($subcategories_query)) {
573
      $subcategories_array[sizeof($subcategories_array)] = $subcategories['categories_id'];
574
      if ($subcategories['categories_id'] != $parent_id) {
575
        tep_get_subcategories($subcategories_array, $subcategories['categories_id']);
576
      }
577
    }
578
  }
579
580
// Output a raw date string in the selected locale date format
581
// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS
@@ 903-912 (lines=10) @@
900
////
901
// Recursively go through the categories and retreive all parent categories IDs
902
// TABLES: categories
903
  function tep_get_parent_categories(&$categories, $categories_id) {
904
    $parent_categories_query = tep_db_query("select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$categories_id . "'");
905
    while ($parent_categories = tep_db_fetch_array($parent_categories_query)) {
906
      if ($parent_categories['parent_id'] == 0) return true;
907
      $categories[sizeof($categories)] = $parent_categories['parent_id'];
908
      if ($parent_categories['parent_id'] != $categories_id) {
909
        tep_get_parent_categories($categories, $parent_categories['parent_id']);
910
      }
911
    }
912
  }
913
914
////
915
// Construct a category path to the product