Code Duplication    Length = 11-22 lines in 4 locations

catalog/admin/includes/functions/general.php 3 locations

@@ 754-774 (lines=21) @@
751
752
////
753
// Sets the status of a product
754
  function tep_set_product_status($products_id, $status) {
755
    $OSCOM_Db = Registry::get('Db');
756
757
    if ($status == '1') {
758
      return $OSCOM_Db->save('products', [
759
        'products_status' => '1',
760
        'products_last_modified' => 'now()'
761
      ], [
762
        'products_id' => (int)$products_id
763
      ]);
764
    } elseif ($status == '0') {
765
      return $OSCOM_Db->save('products', [
766
        'products_status' => '0',
767
        'products_last_modified' => 'now()'
768
      ], [
769
        'products_id' => (int)$products_id
770
      ]);
771
    } else {
772
      return -1;
773
    }
774
  }
775
776
////
777
// Sets the status of a review
@@ 778-798 (lines=21) @@
775
776
////
777
// Sets the status of a review
778
  function tep_set_review_status($reviews_id, $status) {
779
    $OSCOM_Db = Registry::get('Db');
780
781
    if ($status == '1') {
782
      return $OSCOM_Db->save('reviews', [
783
        'reviews_status' => '1',
784
        'last_modified' => 'now()'
785
      ], [
786
        'reviews_id' => (int)$reviews_id
787
      ]);
788
    } elseif ($status == '0') {
789
      return $OSCOM_Db->save('reviews', [
790
        'reviews_status' => '0',
791
        'last_modified' => 'now()'
792
      ], [
793
        'reviews_id' => (int)$reviews_id
794
      ]);
795
    } else {
796
      return -1;
797
    }
798
  }
799
800
////
801
// Sets the status of a product on special
@@ 802-823 (lines=22) @@
799
800
////
801
// Sets the status of a product on special
802
  function tep_set_specials_status($specials_id, $status) {
803
    $OSCOM_Db = Registry::get('Db');
804
805
    if ($status == '1') {
806
      return $OSCOM_Db->save('specials', [
807
        'status' => '1',
808
        'expires_date' => 'null',
809
        'date_status_change' => 'null'
810
      ], [
811
        'specials_id' => (int)$specials_id
812
      ]);
813
    } elseif ($status == '0') {
814
      return $OSCOM_Db->save('specials', [
815
        'status' => '0',
816
        'date_status_change' => 'now()'
817
      ], [
818
        'specials_id' => (int)$specials_id
819
      ]);
820
    } else {
821
      return -1;
822
    }
823
  }
824
825
////
826
// Sets timeout for the current script.

catalog/includes/functions/banner.php 1 location

@@ 15-25 (lines=11) @@
12
13
////
14
// Sets the status of a banner
15
  function tep_set_banner_status($banners_id, $status) {
16
    $OSCOM_Db = Registry::get('Db');
17
18
    if ($status == '1') {
19
      return $OSCOM_Db->save('banners', ['status' => 1, 'date_status_change' => 'now()', 'date_scheduled' => 'null'], ['banners_id' => (int)$banners_id]);
20
    } elseif ($status == '0') {
21
      return $OSCOM_Db->save('banners', ['status' => 0, 'date_status_change' => 'now()'], ['banners_id' => (int)$banners_id]);
22
    } else {
23
      return -1;
24
    }
25
  }
26
27
////
28
// Auto activate banners