forked from tikiorg/tiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tiki-interactive_trans.php
41 lines (33 loc) · 1.26 KB
/
tiki-interactive_trans.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
* @package tikiwiki
*/
// (c) Copyright 2002-2015 by authors of the Tiki Wiki CMS Groupware Project
//
// 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$
require_once ('tiki-setup.php');
require_once('lib/language/LanguageTranslations.php');
$access->check_feature('lang_use_db');
$access->check_permission('tiki_p_edit_languages');
// start interactive translation session
if (!empty($_REQUEST['interactive_translation_mode'])) {
$_SESSION['interactive_translation_mode'] = $_REQUEST['interactive_translation_mode'];
if ($_REQUEST['interactive_translation_mode'] == 'off') {
$cachelib->empty_cache('templates_c');
}
header('Location: ' . $_SESSION['last_mid_php']);
exit;
}
/* Called by the JQuery ajax request. No response expected.
* Save strings translated using interactive translation to database.
*/
if ( isset( $_REQUEST['source'], $_REQUEST['trans'] ) && count($_REQUEST['source']) == count($_REQUEST['trans']) ) {
$translations = new LanguageTranslations;
foreach ( $_REQUEST['trans'] as $k => $translation ) {
$source = $_REQUEST['source'][$k];
$translations->updateTrans($source, $translation);
}
exit;
}