Project

General

Profile

« Previous | Next » 

Revision 2098

Added by darkviper almost 11 years ago

! activate class Translate for all addons in admin/ (except pages/)
! class.admin >> add translation of the current theme to Translate

View differences:

install.php
36 36
	header("Location: index.php");
37 37
	exit(0);
38 38
}
39
$oLang = Translate::getInstance();
40
$oLang->enableAddon('admin\\languages');
39 41

  
40 42
// Include the WB functions file
41 43
require_once(WB_PATH.'/framework/functions.php');
......
59 61
// Check if language dir is writable
60 62
if(!is_writable(WB_PATH.'/languages/')) {
61 63
	if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file
62
	$admin->print_error($MESSAGE['GENERIC_BAD_PERMISSIONS']);
64
	$admin->print_error($oLang->MESSAGE_GENERIC_BAD_PERMISSIONS);
63 65
}
64 66

  
65 67
// Try to upload the file to the temp dir
66 68
if(!move_uploaded_file($_FILES['userfile']['tmp_name'], $temp_file)) {
67 69
	if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file
68
	$admin->print_error($MESSAGE['GENERIC_CANNOT_UPLOAD']);
70
	$admin->print_error($oLang->MESSAGE_GENERIC_CANNOT_UPLOAD);
69 71
}
70 72

  
71 73
// Check if uploaded file is a valid language file (no binary file etc.)
72 74
$content = file_get_contents($temp_file);
73
if (strpos($content, '<?php') === false) $admin->print_error($MESSAGE['GENERIC_INVALID_LANGUAGE_FILE']);
75
if (strpos($content, '<?php') === false) $admin->print_error($oLang->MESSAGE_GENERIC_INVALID_LANGUAGE_FILE);
74 76

  
75 77
// Remove any vars with name "language_code"
76 78
unset($language_code);
......
87 89
	if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file
88 90
	// Restore to correct language
89 91
	require(WB_PATH.'/languages/'.LANGUAGE.'.php');
90
	$admin->print_error($MESSAGE['GENERIC_INVALID_LANGUAGE_FILE']);
92
	$admin->print_error($oLang->MESSAGE_GENERIC_INVALID_LANGUAGE_FILE);
91 93
}
92 94

  
93 95
// Set destination for language file
......
100 102
	if (versionCompare($language_version, $new_language_version, '>=')) {
101 103
		// Restore to correct language
102 104
		require(WB_PATH . '/languages/' . LANGUAGE . '.php');
103
		$admin->print_error($MESSAGE['GENERIC_ALREADY_INSTALLED']);
105
		$admin->print_error($oLang->MESSAGE_GENERIC_ALREADY_INSTALLED);
104 106
	}
105 107
	$action="upgrade";
106 108
	unlink($language_file);
......
119 121

  
120 122
// Print success message
121 123
if ($action=="install") {
122
	$admin->print_success($MESSAGE['GENERIC_INSTALLED']);
124
	$admin->print_success($oLang->MESSAGE_GENERIC_INSTALLED);
123 125
} else {
124
	$admin->print_success($MESSAGE['GENERIC_UPGRADED']);
126
	$admin->print_success($oLang->MESSAGE_GENERIC_UPGRADED);
125 127
}
126 128

  
127 129
// Print admin footer

Also available in: Unified diff