1<?php
2/**
3 * @package tikiwiki
4 */
5// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
6//
7// All Rights Reserved. See copyright.txt for details and a complete list of authors.
8// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
9// $Id$
10
11require_once('tiki-setup.php');
12require_once('lib/language/LanguageTranslations.php');
13
14$access->check_feature('lang_use_db');
15$access->check_permission('tiki_p_edit_languages');
16
17// start interactive translation session
18if (! empty($_REQUEST['interactive_translation_mode'])) {
19	$_SESSION['interactive_translation_mode'] = $_REQUEST['interactive_translation_mode'];
20	if ($_REQUEST['interactive_translation_mode'] == 'off') {
21		$cachelib->empty_cache('templates_c');
22	}
23
24	header('Location: index.php');
25	exit;
26}
27
28/* Called by the JQuery ajax request. No response expected.
29 * Save strings translated using interactive translation to database.
30 */
31if (isset($_REQUEST['source'], $_REQUEST['trans']) && count($_REQUEST['source']) == count($_REQUEST['trans'])) {
32	$translations = new LanguageTranslations;
33
34	foreach ($_REQUEST['trans'] as $k => $translation) {
35		$source = $_REQUEST['source'][$k];
36
37		$translations->updateTrans($source, $translation);
38	}
39
40	exit;
41}
42