source: extensions/autoupdate/trunk/ajax/update_language.php @ 9710

Revision 9710, 1.7 KB checked in by patdenice, 9 years ago (diff)

New languages keys.

Line 
1<?php
2
3define('PHPWG_ROOT_PATH','../../../');
4define('IN_ADMIN', true);
5include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
6include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
7include_once(PHPWG_ROOT_PATH.'admin/include/functions_plugins.inc.php');
8
9check_status(ACCESS_ADMINISTRATOR);
10
11if (!is_webmaster())
12{
13  echo json_encode(array(
14    'result' => false,
15    'msg' => l10n('Webmaster status is required.'),
16    )
17  );
18  exit;
19}
20
21if (empty($_REQUEST['id']) or empty($_REQUEST['revision']))
22{
23  echo json_encode(array(
24    'result' => false,
25    'msg' => 'Wrong parameters',
26    )
27  );
28  exit;
29}
30
31include_once(PHPWG_ROOT_PATH.'admin/include/languages.class.php');
32$languages = new languages();
33
34$language_id = $_REQUEST['id'];
35$revision = $_REQUEST['revision'];
36
37$upgrade_status = $languages->extract_language_files('upgrade', $revision, $language_id);
38
39switch ($upgrade_status)
40{
41  case 'ok':
42    $result = array(
43      'result' => true,
44      'msg' => sprintf(l10n('%s has been successfully upgraded.'), $languages->fs_languages[$language_id]['name'])
45    );
46    break;
47
48  case 'temp_path_error':
49    $result = array(
50      'result' => false,
51      'msg' => l10n('Can\'t create temporary file.')
52    );
53    break;
54
55  case 'dl_archive_error':
56    $result = array(
57      'result' => false,
58      'msg' => l10n('Can\'t download archive.')
59    );
60    break;
61
62  case 'archive_error':
63    $result = array(
64      'result' => false,
65      'msg' => l10n('Can\'t read or extract archive.')
66    );
67    break;
68
69  default:
70    $result = array(
71      'result' => false,
72      'msg' => sprintf(l10n('An error occured during extraction (%s).'), $upgrade_status)
73    );
74}
75
76$template->delete_compiled_templates();
77echo json_encode($result);
78exit;
79
80?>
Note: See TracBrowser for help on using the repository browser.