| 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';
require_once('functions.real_sentences_suggestions.php');
$real_sentences_sugg_obj = new Real_sentences_suggestions();
//error_reporting(E_ALL);
//ini_set("display_errors",1);
if ( isset($_POST['sentence_id']) && isset($_POST['rss_id']) && isset($_SESSION['tm_id']) && isset($_POST['suggestion']) ) {
$sentence_id = $_POST['sentence_id'];
$rss_id = $_POST['rss_id']; //real sentences suggestions id
$suggestion = addslashes($_POST['suggestion']);
$user_id = $_SESSION['tm_id'];
if ( is_numeric($sentence_id) && $sentence_id > 0 && is_numeric($rss_id) && $rss_id > 0 ) {
//get real sentences success suggestions count for sentence
$success_suggestion_count = $real_sentences_sugg_obj->getRealSentencesSuccessSuggestionsCountBySentenceId( $sentence_id );
//check sentence suggested success less than 3
if ($success_suggestion_count < 3) {
//accept the suggestion, update sentence suggestion make lock and success suggestion
$resultUpdateS = $real_sentences_sugg_obj->submitRealSentenceSuggestionAndUpdateToSuccess( $suggestion, $rss_id );
if ($resultUpdateS == true) {
//update suggestion started at date in real_sentences, after received suggestion if date is null
$real_sentences_sugg_obj->updateRealSentenceSuggestionStartedAtDate( $sentence_id );
//after submit again rerun success count query
$success_suggestion_count2 = $real_sentences_sugg_obj->getRealSentencesSuccessSuggestionsCountBySentenceId( $sentence_id );
//check suggested success count
if( $success_suggestion_count2 >= 3 ) {
//close the real sentences for suggestion
$real_sentences_sugg_obj->closeRealSentenceForSuggestions( $sentence_id );
}
echo json_encode(array("status" => "200", "msg" => "Suggestion submitted successfully"));
} else {
echo json_encode(array("status" => "300", "msg" => "Submission timed out took more than 5 mins"));
}
} else {
//make suggestion fail in real sentences suggestions
$real_sentences_sugg_obj->makeRealSentenceSuggestionFailed( $rss_id );
echo json_encode(array("status" => "300", "msg" => "This sentence has already reached 3 suggestions.<br>
Contribute on a new one."));
}
} else {
echo json_encode(array("status" => "300", "msg" => 'Something went wrong, Please try again.'));
}
} else {
echo json_encode(array("status" => "300", "msg" => 'User not found'));
}