Code Duplication    Length = 12-14 lines in 2 locations

application/modules/comments/comments.php 1 location

@@ 395-406 (lines=12) @@
392
            $comment_text_minus = trim(htmlspecialchars($this->input->post('comment_text_minus')));
393
            $comment_text_minus = str_replace("\n", '<br/>', $comment_text_minus);
394
            $rate = $this->input->post('ratec');
395
            if ($this->input->post('ratec')) {
396
                if (SProductsQuery::create()->findPk($item_id) !== null) {
397
                    $model = SProductsRatingQuery::create()->findPk($item_id);
398
                    if ($model === null) {
399
                        $model = new SProductsRating;
400
                        $model->setProductId($item_id);
401
                    }
402
                    $model->setVotes($model->getVotes() + 1);
403
                    $model->setRating($model->getRating() + $rate);
404
                    $model->save();
405
                }
406
            }
407
            $parent = $this->input->post('parent');
408
409
            if ($comment_text != '') {

application/modules/comments/commentsapi.php 1 location

@@ 508-521 (lines=14) @@
505
            $comment_text_minus = trim(htmlspecialchars($this->input->post('comment_text_minus')));
506
            $comment_text_minus = str_replace("\n", '<br/>', $comment_text_minus);
507
            $rate = $this->input->post('ratec');
508
            if ($this->input->post('ratec')) {
509
                if (class_exists('SProductsQuery')) {
510
                    if (SProductsQuery::create()->findPk($item_id) !== null) {
511
                        $model = SProductsRatingQuery::create()->findPk($item_id);
512
                        if ($model === null) {
513
                            $model = new SProductsRating;
514
                            $model->setProductId($item_id);
515
                        }
516
                        $model->setVotes($model->getVotes() + 1);
517
                        $model->setRating($model->getRating() + $rate);
518
                        $model->save();
519
                    }
520
                }
521
            }
522
        }
523
        if ($this->input->post('action') == 'newPost') {
524
            $email = $this->db->select('email')