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