tiki-interactive_trans.php 1.24 KB
Newer Older
changi67's avatar
changi67 committed
1 2 3 4
<?php
/**
 * @package tikiwiki
 */
5
// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
rjsmelo's avatar
rjsmelo committed
6
//
changi67's avatar
changi67 committed
7 8 9 10
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

rjsmelo's avatar
rjsmelo committed
11
require_once('tiki-setup.php');
12
require_once('lib/language/LanguageTranslations.php');
hangerman's avatar
hangerman committed
13

14 15 16 17
$access->check_feature('lang_use_db');
$access->check_permission('tiki_p_edit_languages');

// start interactive translation session
rjsmelo's avatar
rjsmelo committed
18 19
if (! empty($_REQUEST['interactive_translation_mode'])) {
	$_SESSION['interactive_translation_mode'] = $_REQUEST['interactive_translation_mode'];
20 21 22
	if ($_REQUEST['interactive_translation_mode'] == 'off') {
		$cachelib->empty_cache('templates_c');
	}
hangerman's avatar
hangerman committed
23

24 25 26
	header('Location: ' . $_SESSION['last_mid_php']);
	exit;
}
hangerman's avatar
hangerman committed
27

28 29
/* Called by the JQuery ajax request. No response expected.
 * Save strings translated using interactive translation to database.
rjsmelo's avatar
rjsmelo committed
30 31
 */
if (isset($_REQUEST['source'], $_REQUEST['trans']) && count($_REQUEST['source']) == count($_REQUEST['trans'])) {
32
	$translations = new LanguageTranslations;
rjsmelo's avatar
rjsmelo committed
33 34

	foreach ($_REQUEST['trans'] as $k => $translation) {
35 36
		$source = $_REQUEST['source'][$k];

37
		$translations->updateTrans($source, $translation);
38 39 40 41
	}

	exit;
}