<?php
	
	if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
	
	global $current_user;
	if(!is_admin($current_user)) {
		ACLController::displayNoAccess();
		return;
	}
	
	if(isset($_REQUEST['ecmlanguage']) && $_REQUEST['ecmlanguage'] != '' && isset($_REQUEST['pdflanguagelist']) && $_REQUEST['pdflanguagelist'] != '') {
		
		require_once('modules/EcmTexts/EcmText.php');
		$json = getJSONobj();
		$pdfll = $json->decode(htmlspecialchars_decode($_REQUEST['pdflanguagelist']));
		
		global $app_list_strings;
		foreach($app_list_strings['ecmlanguages_dom'] as $key => $value) {
			if(isset($pdfll[$key]) && count($pdfll[$key]) > 0)
				EcmText::SaveText(null,null,'EcmServices',$key,$pdfll[$key]);
		}
		
		echo 'Saved';	
	
	}
	
	
?>