Code Duplication    Length = 12-14 lines in 2 locations

application/modules/comments/comments.php 1 location

@@ 404-415 (lines=12) @@
401
            $comment_text_minus = trim(htmlspecialchars($this->input->post('comment_text_minus')));
402
            $comment_text_minus = str_replace("\n", '<br/>', $comment_text_minus);
403
            $rate = $this->input->post('ratec');
404
            if ($this->input->post('ratec')) {
405
                if (SProductsQuery::create()->setComment(__METHOD__)->findPk($item_id) !== null) {
406
                    $model = SProductsRatingQuery::create()->setComment(__METHOD__)->findPk($item_id);
407
                    if ($model === null) {
408
                        $model = new SProductsRating;
409
                        $model->setProductId($item_id);
410
                    }
411
                    $model->setVotes($model->getVotes() + 1);
412
                    $model->setRating($model->getRating() + $rate);
413
                    $model->save();
414
                }
415
            }
416
            $parent = $this->input->post('parent');
417
418
            if ($comment_text != '') {

application/modules/comments/commentsapi.php 1 location

@@ 525-538 (lines=14) @@
522
            $comment_text_minus = trim(htmlspecialchars($this->input->post('comment_text_minus')));
523
            $comment_text_minus = str_replace("\n", '<br/>', $comment_text_minus);
524
            $rate = $this->input->post('ratec');
525
            if ($this->input->post('ratec')) {
526
                if (class_exists('SProductsQuery')) {
527
                    if (SProductsQuery::create()->setComment(__METHOD__)->findPk($item_id) !== null) {
528
                        $model = SProductsRatingQuery::create()->setComment(__METHOD__)->findPk($item_id);
529
                        if ($model === null) {
530
                            $model = new SProductsRating;
531
                            $model->setProductId($item_id);
532
                        }
533
                        $model->setVotes($model->getVotes() + 1);
534
                        $model->setRating($model->getRating() + $rate);
535
                        $model->save();
536
                    }
537
                }
538
            }
539
        }
540
        if ($this->input->post('action') == 'newPost') {
541
            $email = $this->db->select('email')