1 | <?php |
---|
2 | |
---|
3 | define('PHPWG_ROOT_PATH','../../../'); |
---|
4 | define('IN_ADMIN', true); |
---|
5 | include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); |
---|
6 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
7 | include_once(PHPWG_ROOT_PATH.'admin/include/functions_plugins.inc.php'); |
---|
8 | |
---|
9 | check_status(ACCESS_ADMINISTRATOR); |
---|
10 | |
---|
11 | if (!is_webmaster()) |
---|
12 | { |
---|
13 | echo json_encode(array( |
---|
14 | 'result' => false, |
---|
15 | 'msg' => l10n('Webmaster status is required.'), |
---|
16 | ) |
---|
17 | ); |
---|
18 | exit; |
---|
19 | } |
---|
20 | |
---|
21 | if (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 | |
---|
31 | include_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 | $upgrade_status = 'ok'; |
---|
39 | |
---|
40 | switch ($upgrade_status) |
---|
41 | { |
---|
42 | case 'ok': |
---|
43 | $result = array( |
---|
44 | 'result' => true, |
---|
45 | 'msg' => sprintf(l10n('%s has been successfully upgraded.'), $languages->fs_languages[$language_id]['name']) |
---|
46 | ); |
---|
47 | break; |
---|
48 | |
---|
49 | case 'temp_path_error': |
---|
50 | $result = array( |
---|
51 | 'result' => false, |
---|
52 | 'msg' => l10n('Can\'t create temporary file.') |
---|
53 | ); |
---|
54 | break; |
---|
55 | |
---|
56 | case 'dl_archive_error': |
---|
57 | $result = array( |
---|
58 | 'result' => false, |
---|
59 | 'msg' => l10n('Can\'t download archive.') |
---|
60 | ); |
---|
61 | break; |
---|
62 | |
---|
63 | case 'archive_error': |
---|
64 | $result = array( |
---|
65 | 'result' => false, |
---|
66 | 'msg' => l10n('Can\'t read or extract archive.') |
---|
67 | ); |
---|
68 | break; |
---|
69 | |
---|
70 | default: |
---|
71 | $result = array( |
---|
72 | 'result' => false, |
---|
73 | 'msg' => sprintf(l10n('An error occured during extraction (%s).'), $upgrade_status) |
---|
74 | ); |
---|
75 | } |
---|
76 | |
---|
77 | $template->delete_compiled_templates(); |
---|
78 | echo json_encode($result); |
---|
79 | exit; |
---|
80 | |
---|
81 | ?> |
---|