| Server IP : 64.202.187.69 / Your IP : 216.73.216.192 Web Server : Apache System : Linux 69.187.202.64.host.secureserver.net 3.10.0-1160.144.1.el7.tuxcare.els6.x86_64 #1 SMP Fri May 29 16:22:24 UTC 2026 x86_64 User : transmarket ( 1001) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/transmarket/translator/controllers/ |
Upload File : |
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
include 'connection.php';
//ini_set('display_errors',1);
//error_reporting(E_ALL);
require_once('functions.test_voting.php');
$test_voting_obj = new Test_voting();
if ( isset($_POST['test_voting_sentence_id']) && isset($_POST['ttvsm_id']) && isset($_POST['suggested_text']) && isset($_SESSION['tm_id'])) {
$test_voting_sentence_id = $_POST['test_voting_sentence_id'];
$ttvsm_id = $_POST['ttvsm_id'];
$user_id = $_SESSION['tm_id'];
$suggested_text = $_POST['suggested_text'];
if (is_numeric($ttvsm_id) && is_numeric($ttvsm_id)) {
//get test voting sentence extra suggestions count
$extra_suggestions_count = $test_voting_obj->getTestVotingSentenceExtraSuggestionsCountBySentenceId( $test_voting_sentence_id );
if ( $extra_suggestions_count < 3 ) {
//save extra suggestion
$result_save_extra_suggestion = $test_voting_obj->saveTestVotingSentenceExtraSuggestion( $test_voting_sentence_id, $ttvsm_id, $user_id, $suggested_text );
if ($result_save_extra_suggestion == true) {
//get test voting sentence extra suggestions count after submit suggestion
$extra_suggestions_count2 = $test_voting_obj->getTestVotingSentenceExtraSuggestionsCountBySentenceId( $test_voting_sentence_id );
if( $extra_suggestions_count2 == 3 ) {
//remove or disable test sentence from test voting sentences
$test_voting_obj->disableSentenceFromTestVotingById( $test_voting_sentence_id );
}
$data['status'] = 200;
$data['msg'] = "Suggestion submitted successfully!";
} else {
$data['status'] = 300;
$data['msg'] = "Something went wrong! Vote could not submit at the moment, Please try again.";
}
} else {
$data['status'] = 300;
$data['msg'] = "You suggestion could not submit, we have already received 3 suggestions.";
}
} else {
$data['status'] = 300;
$data['msg'] = "Something went wrong, Please try again.";
}
} else {
$data['status'] = 300;
$data['msg'] = "Something went wrong, Please try again.";
}
echo json_encode($data);