Code Duplication    Length = 19-19 lines in 2 locations

class/faq.php 2 locations

@@ 850-868 (lines=19) @@
847
        $limit = $start = 0;
848
        $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq');
849
850
        if (null !== $criteria && is_subclass_of($criteria, 'criteriaelement')) {
851
            $whereClause = $criteria->renderWhere();
852
853
            if ($whereClause !== 'WHERE ()') {
854
                $sql .= ' ' . $criteria->renderWhere();
855
                if (!empty($notNullFields)) {
856
                    $sql .= $this->NotNullFieldClause($notNullFields, true);
857
                }
858
            } elseif (!empty($notNullFields)) {
859
                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
860
            }
861
            if ($criteria->getSort() != '') {
862
                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
863
            }
864
            $limit = $criteria->getLimit();
865
            $start = $criteria->getStart();
866
        } elseif (!empty($notNullFields)) {
867
            $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
868
        }
869
870
        //echo "<br>" . $sql . "<br>";
871
        $result = $this->db->query($sql, $limit, $start);
@@ 929-947 (lines=19) @@
926
                            faq.exacturl AS exacturl
927
                FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_categories') . ' AS category ON faq.categoryid = category.categoryid ';
928
929
        if (null !== $criteria && is_subclass_of($criteria, 'criteriaelement')) {
930
            $whereClause = $criteria->renderWhere();
931
932
            if ($whereClause !== 'WHERE ()') {
933
                $sql .= ' ' . $criteria->renderWhere();
934
                if (!empty($notNullFields)) {
935
                    $sql .= $this->NotNullFieldClause($notNullFields, true);
936
                }
937
            } elseif (!empty($notNullFields)) {
938
                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
939
            }
940
            if ($criteria->getSort() != '') {
941
                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
942
            }
943
            $limit = $criteria->getLimit();
944
            $start = $criteria->getStart();
945
        } elseif (!empty($notNullFields)) {
946
            $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
947
        }
948
949
        //echo "<br>" . $sql . "<br>";
950
        $result = $this->db->query($sql, $limit, $start);