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:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12
===============================================================================
13 13

  
14
11 Feb-2014 Build 2098 Manuela v.d.Decken(DarkViper)
15
! activate class Translate for all addons in admin/ (except pages/)
16
! class.admin >> add translation of the current theme to Translate
14 17
11 Feb-2014 Build 2097 Manuela v.d.Decken(DarkViper)
15 18
# droplet >> [[SiteModified]]  typo corrected
16 19
! upgrade-script.php >> new classes activated and little corrections
branches/2.8.x/wb/admin/groups/delete.inc.php
26 26
	{
27 27
		$oDb = WbDatabase::getInstance();
28 28
		$oLang = Translate::getInstance();
29
  		$oLang->enableAddon('admin\\groups');
30

  
29 31
	// first check form-tan
30 32
		if (!$admin->checkFTAN() || $iGroupId <= 1) {
31 33
			msgQueue::add($oLang->MESSAGE_GENERIC_SECURITY_OFFENSE );
branches/2.8.x/wb/admin/groups/groups_list.inc.php
25 25
 */
26 26
	function show_grouplist($admin)
27 27
	{
28
//		global $TEXT, $MESSAGE, $MENU, $HEADING;
29
		$database = WbDatabase::getInstance();
30
		$mLang = Translate::getInstance();
28
		$oDb = WbDatabase::getInstance();
29
		$oLang = Translate::getInstance();
30
		$oLang->enableAddon('admin\\groups');
31 31
// Create new template object for the modify/remove section
32 32
		$tpl = new Template(dirname($admin->correct_theme_source('groups_list.htt')),'keep');
33 33
		$tpl->set_file('page', 'groups_list.htt');
34 34
		$tpl->set_block('page', 'main_block', 'main');
35 35

  
36
        $tpl->set_var($oLang->getLangArray());
36 37
		$tpl->set_var('ACTION_URL', $_SERVER['SCRIPT_NAME']);
37 38
		$tpl->set_var('FTAN', $admin->getFTAN());
38 39

  
......
40 41
		$tpl->set_block('main_block', 'show_cmd_manage_users_block', 'show_cmd_manage_users');
41 42
		if($admin->get_permission('users') == true)
42 43
		{
43
			$tpl->set_var('TEXT_MANAGE_USERS', $mLang->TEXT_MANAGE_USERS);
44
			$tpl->set_var('TEXT_MANAGE_USERS', $oLang->TEXT_MANAGE_USERS);
44 45
			$tpl->set_var('LINK_MANAGE_USERS', ADMIN_URL.'/users/index'.PAGE_EXTENSION);
45 46
			$tpl->parse('show_cmd_manage_users', 'show_cmd_manage_users_block', true);
46 47
		}else { // switch off cmd_manage_groups_block
......
50 51
		$tpl->set_block('main_block', 'show_cmd_group_list_block', 'show_cmd_group_list');
51 52
		if( $admin->get_permission('groups_view') == true )
52 53
		{
53
			$tpl->set_var('CONTENT_HEADER', $mLang->HEADING_VIEW_GROUPS);
54
			$tpl->set_var('CONTENT_HEADER', $oLang->HEADING_VIEW_GROUPS);
54 55
			if( ($admin->get_permission('groups_modify') == true) )
55 56
			{
56
			$tpl->set_var('CONTENT_HEADER', $mLang->HEADING_MODIFY_DELETE_GROUP);
57
			$tpl->set_var('CONTENT_HEADER', $oLang->HEADING_MODIFY_DELETE_GROUP);
57 58
			}
58 59
		}
59 60

  
......
65 66
		// $tpl->set_var('GROUP_ID',   $admin->getIDKEY(0));
66 67
		$tpl->set_var('GROUP_ID', 0);
67 68
		$tpl->set_var('GROUP_NAME', '');
68
		$tpl->set_var('GROUP_DISPLAY_NAME', $mLang->TEXT_PLEASE_SELECT.'...');
69
		$tpl->set_var('GROUP_DISPLAY_NAME', $oLang->TEXT_PLEASE_SELECT.'...');
69 70
		$tpl->set_var('CSS_GROUP_DELETED', '');
70 71

  
71 72
		$tpl->parse('grouplist', 'grouplist_block', true);
72 73
		$sql  = 'SELECT `group_id`, `name` ';
73
		$sql .= 'FROM `'.TABLE_PREFIX.'groups` ';
74
		$sql .= 'FROM `'.$oDb->TablePrefix.'groups` ';
74 75
		$sql .= 'WHERE `group_id` > 1 ORDER BY `name` ';
75
		if( ($res_groups = $database->query($sql)) != false )
76
		if( ($res_groups = $oDb->doQuery($sql)) != false )
76 77
		{
77 78
			while($rec_group = $res_groups->fetchRow(MYSQL_ASSOC))
78 79
			{
......
120 121
		{
121 122
			$tpl->set_var('DISPLAY_ADD', '');
122 123
			$tpl->set_var('GROUP_ACTION_URL', $_SERVER['SCRIPT_NAME']);
123
			$tpl->set_var('GROUPS_HEADER', $mLang->HEADING_ADD_GROUP );
124
			$tpl->set_var('SUBMIT_TITLE', $mLang->TEXT_ADD);
124
			$tpl->set_var('GROUPS_HEADER', $oLang->HEADING_ADD_GROUP );
125
			$tpl->set_var('SUBMIT_TITLE', $oLang->TEXT_ADD);
125 126
			$tpl->set_var('ACTION_HANDLE', 'action_modify');
126 127
			$tpl->set_var('ACTION_HIDDEN', 'action_add');
127 128
			$tpl->set_var('FORM_NAME_GROUPMASK', 'frm_addnew_group');
......
139 140
		);
140 141
	// Insert language text and messages
141 142
		$tpl->set_var(array(
142
				'TEXT_MODIFY'    => ($admin->get_permission('groups_modify') == true) ? $mLang->TEXT_MODIFY : $mLang->TEXT_VIEW,
143
				'TEXT_DELETE'    => $mLang->TEXT_DELETE,
144
				'CONFIRM_DELETE' => $mLang->MESSAGE_GROUPS_CONFIRM_DELETE
143
				'TEXT_MODIFY'    => ($admin->get_permission('groups_modify') == true) ? $oLang->TEXT_MODIFY : $oLang->TEXT_VIEW,
144
				'TEXT_DELETE'    => $oLang->TEXT_DELETE,
145
				'CONFIRM_DELETE' => $oLang->MESSAGE_GROUPS_CONFIRM_DELETE
145 146
				));
146 147

  
147 148
	// Parse template object
branches/2.8.x/wb/admin/groups/groups_mask.inc.php
39 39
//		global $TEXT, $MESSAGE, $HEADING, $MENU;
40 40

  
41 41
		$database = WbDatabase::getInstance();
42
		$mLang = Translate::getInstance();
43
//		$mLang->setLanguage(dirname(__FILE__).'/languages/', LANGUAGE, DEFAULT_LANGUAGE);
42

  
43
//		$oLang->setLanguage(dirname(__FILE__).'/languages/', LANGUAGE, DEFAULT_LANGUAGE);
44 44
		include_once('upgradePermissions.php');
45 45
		include_once(WB_PATH.'/framework/functions.php');
46 46
	// Create new template object for the modify/remove menu
......
48 48
		$tpl->set_file('page', 'groups_form.htt');
49 49
		$tpl->debug = false; // false, true
50 50

  
51
        $oLang = Translate::getInstance();
52
        $oLang->enableAddon('admin\\groups');
53
        $tpl->set_var($oLang->getLangArray());
54

  
51 55
		$tpl->set_block('page', 'main_block', 'main');
52 56
		$tpl->set_block('main_block', 'show_cmd_permission_block', 'show_cmd_permission');
53 57
		$tpl->set_var('FTAN', $admin->getFTAN());
......
78 82
				}
79 83

  
80 84
			$tpl->set_var(array(
81
						'SUBMIT_TITLE' =>  ($admin->get_permission('groups_modify') == true) ? $mLang->TEXT_SAVE : $mLang->TEXT_BACK,
85
						'SUBMIT_TITLE' =>  ($admin->get_permission('groups_modify') == true) ? $oLang->TEXT_SAVE : $oLang->TEXT_BACK,
82 86
						'ACTION_HIDDEN' => ($admin->get_permission('groups_modify') == true) ? 'action_modify' : 'action_cancel',
83 87
						'ACTION_HANDLE' => ($admin->get_permission('groups_modify') == true) ? 'action_save' : 'action_cancel',
84 88
						'GROUP_ID' => $rec_group['group_id'],
......
96 100
				$rec_group['template_permissions'] = convertArrayToString($template_permissions);
97 101

  
98 102
				$tpl->set_var(array(
99
							'SUBMIT_TITLE' =>  ($admin->get_permission('groups_modify') == true) ? $mLang->TEXT_SAVE : $mLang->TEXT_BACK,
103
							'SUBMIT_TITLE' =>  ($admin->get_permission('groups_modify') == true) ? $oLang->TEXT_SAVE : $oLang->TEXT_BACK,
100 104
							'ACTION_HANDLE' => ($admin->get_permission('groups_modify') == true) ? 'action_save' : 'action_cancel',
101 105
							'ACTION_HIDDEN' => ($admin->get_permission('groups_modify') == true) ? 'action_modify' : 'action_cancel',
102
							'TEXT_GROUPS_NAME' => $mLang->TEXT_GROUP.': ',
106
							'TEXT_GROUPS_NAME' => $oLang->TEXT_GROUP.': ',
103 107
							'FORM_NAME_GROUPMASK' => 'frm_modify_group',
104 108
	//						'GROUPNAME_DISABLED' => ' readonly="readonly"',
105 109
	//						'GROUPNAME_INPUT_DISABLED' => ' input_text_disabled no_input'
......
126 130
			$rec_group['template_permissions'] = $template_permissions;
127 131

  
128 132
			$tpl->set_var(array(
129
						'SUBMIT_TITLE' =>  ($admin->get_permission('groups_add') == true) ? $mLang->TEXT_ADD : $mLang->TEXT_BACK,
133
						'SUBMIT_TITLE' =>  ($admin->get_permission('groups_add') == true) ? $oLang->TEXT_ADD : $oLang->TEXT_BACK,
130 134
						'ACTION_HANDLE' => ($admin->get_permission('groups_add') == true) ? 'action_save' : 'action_cancel',
131 135
						'ACTION_HIDDEN' => ($admin->get_permission('groups_add') == true) ? 'action_modify' : 'action_cancel',
132 136
						'TEXT_GROUPS_NAME' => '',
......
159 163
		// otherwise the $rec_group object contains existing data from requested group
160 164
		// $tpl->set_var('GROUP_ID', $group_id != 0 ? $admin->getIDKEY($group_id) : 0);
161 165
		$tpl->set_var('GROUP_ACTION_URL', $_SERVER['SCRIPT_NAME']);
162
        $header_extra = $mLang->TEXT_FILESYSTEM_PERMISSIONS.' ';
166
        $header_extra = $oLang->TEXT_FILESYSTEM_PERMISSIONS.' ';
163 167
		if( ($admin->get_permission('groups_view') == true) )
164 168
		{
165
			$tpl->set_var('GROUPS_HEADER', $header_extra.$mLang->HEADING_VIEW_GROUP );
169
			$tpl->set_var('GROUPS_HEADER', $header_extra.$oLang->HEADING_VIEW_GROUP );
166 170
			if( ($admin->get_permission('groups_modify') == true) )
167 171
			{
168
			$tpl->set_var('GROUPS_HEADER', ($group_id == 0 ? $header_extra.$mLang->HEADING_ADD_GROUP : $header_extra.$mLang->HEADING_MODIFY_GROUP) );
172
			$tpl->set_var('GROUPS_HEADER', ($group_id == 0 ? $header_extra.$oLang->HEADING_ADD_GROUP : $header_extra.$oLang->HEADING_MODIFY_GROUP) );
169 173
			}
170 174
		}
171 175

  
172 176
// Insert language text and messages
173 177
		$tpl->set_var('MODULE_FUNCTION', '');
174
		$tpl->set_var($mLang->getLangArray());
178
		$tpl->set_var($oLang->getLangArray());
175 179

  
176 180
// ------------------------
177 181
// Tell the browser whether or not to show advanced options
......
187 191
			setSystemCheckboxes( $tpl, $admin, isset($_POST['system_permissions']) ? $_POST['system_permissions'] : $rec_group['system_permissions'] );
188 192
			$tpl->set_var('DISPLAY_ADVANCED', '');
189 193
			$tpl->set_var('DISPLAY_BASIC', '');
190
			$tpl->set_var('FILESYSTEM_PERMISSIONS', $mLang->TEXT_FILESYSTEM_PERMISSIONS.' ');
194
			$tpl->set_var('FILESYSTEM_PERMISSIONS', $oLang->TEXT_FILESYSTEM_PERMISSIONS.' ');
191 195

  
192 196
			$tpl->parse('advanced_permission_block', 'show_cmd_advanced_permission_block', true);
193 197
			$tpl->parse('permission_block', 'show_cmd_manage_permission_block', true);
194 198

  
195 199
// ------------------------
196 200

  
197
		$tpl->set_var('HEADER_MODULE_FUNCTION', '<h6>'.$mLang->TEXT_MODULE_PERMISSIONS.'</h6>');
201
		$tpl->set_var('HEADER_MODULE_FUNCTION', '<h6>'.$oLang->TEXT_MODULE_PERMISSIONS.'</h6>');
198 202
// Insert values into pages module list
199 203
		$tpl->set_block('show_cmd_permission', 'pages_module_list_block', 'module_list');
200 204
		$sql  = 'SELECT `directory`,`name`,`function` FROM `'.TABLE_PREFIX.'addons` ';
......
229 233
			}
230 234
		}
231 235

  
232
		$tpl->set_var('HEADER_MODULE_FUNCTION', '<h6>'.$mLang->TEXT_MODULE_PERMISSIONS.'</h6>');
236
		$tpl->set_var('HEADER_MODULE_FUNCTION', '<h6>'.$oLang->TEXT_MODULE_PERMISSIONS.'</h6>');
233 237
		// Insert values into pages module list
234 238
		$tpl->set_block('show_cmd_permission', 'tools_module_list_block', 'tools_list');
235 239
		$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'addons` ';
......
262 266
				$tmp_header = $addon['function'];
263 267
			}
264 268
		}
265
		$tpl->set_var('HEADER_TEMPLATE_FUNCTION', '<h6>'.$mLang->TEXT_TEMPLATE_PERMISSIONS.'</h6>');
269
		$tpl->set_var('HEADER_TEMPLATE_FUNCTION', '<h6>'.$oLang->TEXT_TEMPLATE_PERMISSIONS.'</h6>');
266 270
		// Insert values into pages module list
267 271
		$tpl->set_block('show_cmd_permission', 'template_list_block', 'template_list');
268 272
		$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'addons` ';
branches/2.8.x/wb/admin/groups/save.inc.php
37 37
		include_once('upgradePermissions.php');
38 38
		include_once(WB_PATH.'/framework/functions.php');
39 39
		$database = WbDatabase::getInstance();
40
		$mLang = Translate::getInstance();
40
		$oLang = Translate::getInstance();
41
		$oLang->enableAddon('admin\groups');
41 42
	// check for valid group_id
42 43
		$sql = '';
43 44

  
......
77 78

  
78 79
			if($group_name == '')
79 80
			{
80
				msgQueue::add($mLang->MESSAGE_GROUPS_GROUP_NAME_BLANK );
81
				msgQueue::add($oLang->MESSAGE_GROUPS_GROUP_NAME_BLANK );
81 82
			} elseif($group_name != '') {
82 83
		// check request vars and assign values to record
83 84
				if( $database->get_one($sql) != false )
84 85
				{
85
					msgQueue::add($mLang->MESSAGE_GROUPS_GROUP_NAME_EXISTS );
86
					msgQueue::add($oLang->MESSAGE_GROUPS_GROUP_NAME_EXISTS );
86 87
				} else {
87 88
					if( $group_id == 0 )
88 89
					{
......
105 106
				$sql .= $where;
106 107
				if( $database->query($sql) )
107 108
				{
108
	                msgQueue::add($mLang->MESSAGE_GROUPS_SAVED ,true);
109
	                msgQueue::add($oLang->MESSAGE_GROUPS_SAVED ,true);
109 110
				} else {
110
					msgQueue::add($mLang->MESSAGE_RECORD_MODIFIED_FAILED );
111
					msgQueue::add($oLang->MESSAGE_RECORD_MODIFIED_FAILED );
111 112
				}
112 113
			}
113 114
		} else {
branches/2.8.x/wb/admin/groups/index.php
20 20
	function admin_groups_index()
21 21
	{
22 22
		$database = WbDatabase::getInstance();
23
		$mLang = Translate::getInstance();
24
		$mLang->enableAddon('admin\groups');
23
		$oLang = Translate::getInstance();
24
		$oLang->enableAddon('admin\groups');
25 25

  
26 26
		$mod_path = dirname(str_replace('\\', '/', __FILE__));
27 27
		$mod_name = basename($mod_path);
branches/2.8.x/wb/admin/media/rename2.php
23 23
    	require($config_file);
24 24
    }
25 25
}
26
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
26
//if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
27
$oTrans = Translate::getInstance();
28
$oTrans->enableAddon('admin\\media');
27 29

  
28 30
$admin = new admin('Media', 'media', false);
29 31

  
......
48 50

  
49 51
// first Check to see if it contains ..
50 52
if (!check_media_path($directory)) {
51
	$admin->print_error($MESSAGE['MEDIA_DIR_DOT_DOT_SLASH'],$rootlink, false);
53
	$admin->print_error($oTrans->MESSAGE_MEDIA_DIR_DOT_DOT_SLASH, $rootlink, false);
52 54
}
53 55

  
54 56
// Get the temp id
55 57
$file_id = intval($admin->checkIDKEY('id', false, $_SERVER['REQUEST_METHOD']));
56 58
if (!$file_id) {
57
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$dirlink, false);
59
	$admin->print_error($oTrans->MESSAGE_GENERIC_SECURITY_ACCESS, $dirlink, false);
58 60
}
59 61

  
60 62
// Check for potentially malicious files
......
106 108
$file_id = $admin->getIDKEY($file_id);
107 109

  
108 110
if(!isset($rename_file)) {
109
	$admin->print_error($MESSAGE['MEDIA_FILE_NOT_FOUND'], $dirlink, false);
111
	$admin->print_error($oTrans->MESSAGE_MEDIA_FILE_NOT_FOUND, $dirlink, false);
110 112
}
111 113

  
112 114
// Check if they entered a new name
113 115
if(media_filename($admin->get_post('name')) == "") {
114
	$admin->print_error($MESSAGE['MEDIA_BLANK_NAME'], "rename.php?dir=$directory&id=$file_id", false);
116
	$admin->print_error($oTrans->MESSAGE_MEDIA_BLANK_NAME, "rename.php?dir=$directory&id=$file_id", false);
115 117
} else {
116 118
	$old_name = $admin->get_post('old_name');
117 119
	$new_name =  media_filename($admin->get_post('name'));
......
120 122
// Check if they entered an extension
121 123
if($type == 'file') {
122 124
	if(media_filename($admin->get_post('extension')) == "") {
123
		$admin->print_error($MESSAGE['MEDIA_BLANK_EXTENSION'], "rename.php?dir=$directory&id=$file_id", false);
125
		$admin->print_error($oTrans->MESSAGE_MEDIA_BLANK_EXTENSION, "rename.php?dir=$directory&id=$file_id", false);
124 126
	} else {
125 127
		$extension = media_filename($admin->get_post('extension'));
126 128
	}
......
136 138
$dots = (substr($info['basename'], 0, 1) == '.') || (substr($info['basename'], -1, 1) == '.');
137 139

  
138 140
if( preg_match('/'.$forbidden_file_types.'$/i', $ext) || $dots == '.' ) {
139
	$admin->print_error($MESSAGE['MEDIA_CANNOT_RENAME'], "rename.php?dir=$directory&id=$file_id", false);
141
	$admin->print_error($oTrans->MESSAGE_MEDIA_CANNOT_RENAME, "rename.php?dir=$directory&id=$file_id", false);
140 142
}
141 143

  
142 144
// Check if the name contains ..
143 145
if(strstr($name, '..')) {
144
	$admin->print_error($MESSAGE['MEDIA_NAME_DOT_DOT_SLASH'], "rename.php?dir=$directory&id=$file_id", false);
146
	$admin->print_error($oTrans->MESSAGE_MEDIA_NAME_DOT_DOT_SLASH, "rename.php?dir=$directory&id=$file_id", false);
145 147
}
146 148

  
147 149
// Check if the name is index.php
148 150
if($name == 'index.php') {
149
	$admin->print_error($MESSAGE['MEDIA_NAME_INDEX_PHP'], "rename.php?dir=$directory&id=$file_id", false);
151
	$admin->print_error($oTrans->MESSAGE_MEDIA_NAME_INDEX_PHP, "rename.php?dir=$directory&id=$file_id", false);
150 152
}
151 153

  
152 154
// Check that the name still has a value
153 155
if($name == '') {
154
	$admin->print_error($MESSAGE['MEDIA_BLANK_NAME'], "rename.php?dir=$directory&id=$file_id", false);
156
	$admin->print_error($oTrans->MESSAGE_MEDIA_BLANK_NAME, "rename.php?dir=$directory&id=$file_id", false);
155 157
}
156 158

  
157 159
$info = pathinfo(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$rename_file);
......
159 161
$dots = (substr($info['basename'], 0, 1) == '.') || (substr($info['basename'], -1, 1) == '.');
160 162

  
161 163
if( preg_match('/'.$forbidden_file_types.'$/i', $ext) || $dots == '.' ) {
162
	$admin->print_error($MESSAGE['MEDIA_CANNOT_RENAME'], "rename.php?dir=$directory&id=$file_id", false);
164
	$admin->print_error($oTrans->MESSAGE_MEDIA_CANNOT_RENAME, "rename.php?dir=$directory&id=$file_id", false);
163 165
}
164 166

  
165 167
// Check if we should overwrite or not
166 168
if($admin->get_post('overwrite') != 'yes' AND file_exists(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$name) == true) {
167 169
	if($type == 'folder') {
168
		$admin->print_error($MESSAGE['MEDIA_DIR_EXISTS'], "rename.php?dir=$directory&id=$file_id", false);
170
		$admin->print_error($oTrans->MESSAGE_MEDIA_DIR_EXISTS, "rename.php?dir=$directory&id=$file_id", false);
169 171
	} else {
170
		$admin->print_error($MESSAGE['MEDIA_FILE_EXISTS'], "rename.php?dir=$directory&id=$file_id", false);
172
		$admin->print_error($oTrans->MESSAGE_MEDIA_FILE_EXISTS, "rename.php?dir=$directory&id=$file_id", false);
171 173
	}
172 174
}
173 175

  
......
177 179
    // feature freeze
178 180
	// require_once(ADMIN_PATH.'/media/dse.php');
179 181

  
180
	$admin->print_success($MESSAGE['MEDIA_RENAMED'], $dirlink);
182
	$admin->print_success($oTrans->MESSAGE_MEDIA_RENAMED, $dirlink);
181 183
} else {
182
	$admin->print_error($MESSAGE['MEDIA_CANNOT_RENAME'], "rename.php?dir=$directory&id=$file_id", false);
184
	$admin->print_error($oTrans->MESSAGE_MEDIA_CANNOT_RENAME, "rename.php?dir=$directory&id=$file_id", false);
183 185
}
branches/2.8.x/wb/admin/media/setparameter.php
23 23
    	require($config_file);
24 24
    }
25 25
}
26
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
26
//if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
27
$oTrans = Translate::getInstance();
28
$oTrans->enableAddon('admin\\access');
27 29

  
28 30
$admin = new admin('Media', 'media', false);
29 31
// Include the WB functions file
30 32
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
31 33

  
32
// check if theme language file exists for the language set by the user (e.g. DE, EN)
33
if(!file_exists(THEME_PATH .'/languages/'.LANGUAGE .'.php')) {
34
	// no theme language file exists for the language set by the user, include default theme language file EN.php
35
	require_once(THEME_PATH .'/languages/EN.php');
36
} else {
37
	// a theme language file exists for the language defined by the user, load it
38
	require_once(THEME_PATH .'/languages/'.LANGUAGE .'.php');
39
}
34
//// check if theme language file exists for the language set by the user (e.g. DE, EN)
35
//if(!file_exists(THEME_PATH .'/languages/'.LANGUAGE .'.php')) {
36
//	// no theme language file exists for the language set by the user, include default theme language file EN.php
37
//	require_once(THEME_PATH .'/languages/EN.php');
38
//} else {
39
//	// a theme language file exists for the language defined by the user, load it
40
//	require_once(THEME_PATH .'/languages/'.LANGUAGE .'.php');
41
//}
40 42
// Get the current homedir
41 43
$currentHome = WB_PATH.MEDIA_DIRECTORY.$admin->get_home_folder();
42 44
$currentHome = str_replace(WB_PATH, '', $currentHome);
......
96 98
$template = new Template(dirname($admin->correct_theme_source('setparameter.htt')));
97 99
$template->set_file('page', 'setparameter.htt');
98 100
$template->set_block('page', 'main_block', 'main');
101
$template->set_var($oTrans->getLangArray());
99 102
if ($_SESSION['GROUP_ID'] != 1) {
100 103
	$template->set_var('DISPLAY_ADMIN', 'hide');
101 104
}
102 105
$template->set_var(array(
103
				'TEXT_HEADER' => $TEXT['TEXT_HEADER'],
104
				'SAVE_TEXT' => $TEXT['SAVE'],
105
				'BACK' => $TEXT['BACK'],
106
			)
107
		);
106
        'TEXT_HEADER' => $oTrans->TEXT_TEXT_HEADER,
107
        'SAVE_TEXT' => $oTrans->TEXT_SAVE,
108
        'BACK' => $oTrans->TEXT_BACK,
109
    )
110
);
108 111

  
109 112
$template->set_block('main_block', 'list_block', 'list');
110 113
$row_bg_color = '';
......
131 134
    $row_bg_color = ($row_bg_color == '#dedede') ? '#fff' : '#dedede';
132 135

  
133 136
	$template->set_var(array(
134
					'ADMIN_URL' => ADMIN_URL,
135
					'THEME_URL' => THEME_URL,
136
					'PATH_NAME' => $relative,
137
					'WIDTH' => $TEXT['WIDTH'],
138
					'HEIGHT' => $TEXT['HEIGHT'],
139
					'FIELD_NAME_W' => $safepath.'-w',
140
					'FIELD_NAME_H' => $safepath.'-h',
141
					'CAN_EDIT_CLASS' => ($bPathCanEdit==false) ? '' : 'bold',
142
					'SHOW_EDIT_CLASS' => ($bPathCanEdit==false) ? 'hide' : '',
143
					'READ_ONLY_DIR' => ($bPathCanEdit==false) ? ' readonly="readonly"' : '',
144
					'CUR_HEIGHT' => $cur_height,
145
					'CUR_WIDTH' => $cur_width,
146
					'SETTINGS' => $TEXT['SETTINGS'],
147
					'ADMIN_ONLY' => $TEXT['ADMIN_ONLY'],
148
					'ADMIN_ONLY_SELECTED' => isset($pathsettings['global']['admin_only']) ? $pathsettings['global']['admin_only']:'',
149
					'NO_SHOW_THUMBS' => $TEXT['NO_SHOW_THUMBS'],
150
					'NO_SHOW_THUMBS_SELECTED' => isset($pathsettings['global']['show_thumbs']) ? $pathsettings['global']['show_thumbs']:'',
151
					'ROW_BG_COLOR' => $row_bg_color,
152
					'FTAN' => $admin->getFTAN()
153
				)
154
		);
137
            'ADMIN_URL' => ADMIN_URL,
138
            'THEME_URL' => THEME_URL,
139
            'PATH_NAME' => $relative,
140
            'WIDTH' => $oTrans->TEXT_WIDTH,
141
            'HEIGHT' => $oTrans->TEXT_HEIGHT,
142
            'FIELD_NAME_W' => $safepath.'-w',
143
            'FIELD_NAME_H' => $safepath.'-h',
144
            'CAN_EDIT_CLASS' => ($bPathCanEdit==false) ? '' : 'bold',
145
            'SHOW_EDIT_CLASS' => ($bPathCanEdit==false) ? 'hide' : '',
146
            'READ_ONLY_DIR' => ($bPathCanEdit==false) ? ' readonly="readonly"' : '',
147
            'CUR_HEIGHT' => $cur_height,
148
            'CUR_WIDTH' => $cur_width,
149
            'SETTINGS' => $oTrans->TEXT_SETTINGS,
150
            'ADMIN_ONLY' => $oTrans->TEXT_ADMIN_ONLY,
151
            'ADMIN_ONLY_SELECTED' => isset($pathsettings['global']['admin_only']) ? $pathsettings['global']['admin_only']:'',
152
            'NO_SHOW_THUMBS' => $oTrans->TEXT_NO_SHOW_THUMBS,
153
            'NO_SHOW_THUMBS_SELECTED' => isset($pathsettings['global']['show_thumbs']) ? $pathsettings['global']['show_thumbs']:'',
154
            'ROW_BG_COLOR' => $row_bg_color,
155
            'FTAN' => $admin->getFTAN()
156
        )
157
    );
155 158
	$template->parse('list', 'list_block', true);
156 159
}
157 160

  
branches/2.8.x/wb/admin/media/browse.php
24 24
    	require($config_file);
25 25
    }
26 26
}
27
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
28

  
27
//if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
28
$oTrans = Translate::getInstance();
29
$oTrans->enableAddon('admin\\media');
29 30
$admin = new admin('Media', 'media', false);
30 31

  
31 32
$starttime = explode(" ", microtime());
......
35 36
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
36 37
include ('parameters.php');
37 38

  
38
// check if theme language file exists for the language set by the user (e.g. DE, EN)
39
if(!file_exists(THEME_PATH .'/languages/'.LANGUAGE .'.php')) {
40
	// no theme language file exists for the language set by the user, include default theme language file EN.php
41
	require_once(THEME_PATH .'/languages/EN.php');
42
} else {
43
	// a theme language file exists for the language defined by the user, load it
44
	require_once(THEME_PATH .'/languages/'.LANGUAGE .'.php');
45
}
39
//// check if theme language file exists for the language set by the user (e.g. DE, EN)
40
//if(!file_exists(THEME_PATH .'/languages/'.LANGUAGE .'.php')) {
41
//	// no theme language file exists for the language set by the user, include default theme language file EN.php
42
//	require_once(THEME_PATH .'/languages/EN.php');
43
//} else {
44
//	// a theme language file exists for the language defined by the user, load it
45
//	require_once(THEME_PATH .'/languages/'.LANGUAGE .'.php');
46
//}
46 47

  
47 48
// Byte convert for filesize
48 49
function byte_convert($bytes) {
......
127 128
$template = new Template(dirname($admin->correct_theme_source('media_browse.htt')));
128 129
$template->set_file('page', 'media_browse.htt');
129 130
$template->set_block('page', 'main_block', 'main');
130

  
131
$template->set_var($oTrans->getLangArray());
131 132
// Get the current dir
132 133
//$currentHome = $admin->get_home_folder();
133 134
$currentHome = (defined('HOME_FOLDERS') && HOME_FOLDERS) ? $admin->get_home_folder() : '';
......
164 165
// Check to see if it contains ../
165 166
if (!check_media_path($directory)) {
166 167
	// $admin->print_header();
167
	$admin->print_error($MESSAGE['MEDIA_DIR_DOT_DOT_SLASH']);
168
	$admin->print_error($oTrans->MESSAGE_MEDIA_DIR_DOT_DOT_SLASH);
168 169
}
169 170

  
170 171
if(!file_exists(WB_PATH.MEDIA_DIRECTORY.$directory)) {
171 172
	// $admin->print_header();
172
	$admin->print_error($MESSAGE['MEDIA_DIR_DOES_NOT_EXIST']);
173
	$admin->print_error($oTrans->MESSAGE_MEDIA_DIR_DOES_NOT_EXIST);
173 174
}
174 175

  
175 176
// Check to see if the user wanted to go up a directory into the parent folder
......
358 359
// Insert language text and messages
359 360
$template->set_var(array(
360 361
					'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
361
					'TEXT_CURRENT_FOLDER' => $TEXT['CURRENT_FOLDER'],
362
					'TEXT_RELOAD' => $TEXT['RELOAD'],
363
					'TEXT_RENAME' => $TEXT['RENAME'],
364
					'TEXT_DELETE' => $TEXT['DELETE'],
365
					'TEXT_SIZE' => $TEXT['SIZE'],
366
					'TEXT_DATE' => $TEXT['DATE'],
367
					'TEXT_NAME' => $TEXT['NAME'],
368
					'TEXT_TYPE' => $TEXT['TYPE'],
369
					'TEXT_UP' => $TEXT['UP'],
370
					'NONE_FOUND' => $MESSAGE['MEDIA_NONE_FOUND'],
371
					'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
372
					'CONFIRM_DELETE' => $MESSAGE['MEDIA_CONFIRM_DELETE']
362
					'NONE_FOUND' => $oTrans->MESSAGE_MEDIA_NONE_FOUND,
363
					'CHANGE_SETTINGS' => $oTrans->TEXT_MODIFY_SETTINGS,
364
					'CONFIRM_DELETE' => $oTrans->MESSAGE_MEDIA_CONFIRM_DELETE
373 365
				)
374 366
			);
375 367

  
branches/2.8.x/wb/admin/media/delete.php
23 23
    	require($config_file);
24 24
    }
25 25
}
26
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
26
//if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
27
$oTrans = Translate::getInstance();
28
$oTrans->enableAddon('admin\\media');
27 29

  
28 30
$admin = new admin('Media', 'media', false);
29 31

  
......
47 49
// Check to see if it contains ..
48 50
if (!check_media_path($directory)) {
49 51
	// $admin->print_header();
50
	$admin->print_error($MESSAGE['MEDIA_DIR_DOT_DOT_SLASH'],$rootlink,false );
52
	$admin->print_error($oTrans->MESSAGE_MEDIA_DIR_DOT_DOT_SLASH, $rootlink, false );
51 53
}
52 54

  
53 55
// Get the file id
54 56
$file_id = $admin->checkIDKEY('id', false, $_SERVER['REQUEST_METHOD']);
55 57
if (!$file_id) {
56
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $dirlink,false);
58
	$admin->print_error($oTrans->MESSAGE_GENERIC_SECURITY_ACCESS, $dirlink, false);
57 59
}
58 60

  
59 61
// Get home folder not to show
......
68 70
}
69 71
*/
70 72
// Figure out what folder name the temp id is
71
if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory)) {
73
if(($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory))) {
72 74
	// Loop through the files and dirs an add to list
73 75
   while (false !== ($file = readdir($handle))) {
74 76
		if(substr($file, 0, 1) != '.' AND $file != '.svn' AND $file != 'index.php') {
......
106 108

  
107 109
// Check to see if we could find an id to match
108 110
if(!isset($delete_file)) {
109
	$admin->print_error($MESSAGE['MEDIA_FILE_NOT_FOUND'], $dirlink, false);
111
	$admin->print_error($oTrans->MESSAGE_MEDIA_FILE_NOT_FOUND, $dirlink, false);
110 112
}
111 113
$relative_path = WB_PATH.MEDIA_DIRECTORY.'/'.$directory.'/'.$delete_file;
112 114
// Check if the file/folder exists
113 115
if(!file_exists($relative_path)) {
114
	$admin->print_error($MESSAGE['MEDIA_FILE_NOT_FOUND'], $dirlink, false);
116
	$admin->print_error($oTrans->MESSAGE_MEDIA_FILE_NOT_FOUND, $dirlink, false);
115 117
}
116 118

  
117 119
// Find out whether its a file or folder
118 120
if($type == 'folder') {
119 121
	// Try and delete the directory
120 122
	if(rm_full_dir($relative_path)) {
121
		$admin->print_success($MESSAGE['MEDIA_DELETED_DIR'], $dirlink);
123
		$admin->print_success($oTrans->MESSAGE_MEDIA_DELETED_DIR, $dirlink);
122 124
	} else {
123
		$admin->print_error($MESSAGE['MEDIA_CANNOT_DELETE_DIR'], $dirlink, false);
125
		$admin->print_error($oTrans->MESSAGE_MEDIA_CANNOT_DELETE_DIR, $dirlink, false);
124 126
	}
125 127
} else {
126 128
	// Try and delete the file
127 129
	if(unlink($relative_path)) {
128
		$admin->print_success($MESSAGE['MEDIA_DELETED_FILE'], $dirlink);
130
		$admin->print_success($oTrans->MESSAGE_MEDIA_DELETED_FILE, $dirlink);
129 131
	} else {
130
		$admin->print_error($MESSAGE['MEDIA_CANNOT_DELETE_FILE'], $dirlink, false);
132
		$admin->print_error($oTrans->MESSAGE_MEDIA_CANNOT_DELETE_FILE, $dirlink, false);
131 133
	}
132 134
}
branches/2.8.x/wb/admin/media/create.php
23 23
    	require($config_file);
24 24
    }
25 25
}
26
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
26
//if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
27
$oTrans = Translate::getInstance();
28
$oTrans->enableAddon('admin\\media');
27 29
// Include the WB functions file
28 30
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
29 31

  
......
37 39
// Check to see if name or target contains ../
38 40
if(strstr($name, '..')) {
39 41
	$admin->print_header();
40
	$admin->print_error($MESSAGE['MEDIA_NAME_DOT_DOT_SLASH']);
42
	$admin->print_error($oTrans->MESSAGE_MEDIA_NAME_DOT_DOT_SLASH);
41 43
}
42 44

  
43 45
// Remove bad characters
......
50 52
if (!$admin->checkFTAN())
51 53
{
52 54
	$admin->print_header();
53
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
55
	$admin->print_error($oTrans->MESSAGE_GENERIC_SECURITY_ACCESS);
54 56
}
55 57
// After check print the header
56 58
$admin->print_header();
57 59

  
58 60
if (!check_media_path($target, false)) {
59
	$admin->print_error($MESSAGE['MEDIA_TARGET_DOT_DOT_SLASH']);
61
	$admin->print_error($oTrans->MESSAGE_MEDIA_TARGET_DOT_DOT_SLASH);
60 62
}
61 63

  
62 64
// Create relative path of the new dir name
......
64 66

  
65 67
// Check to see if the folder already exists
66 68
if(file_exists($directory)) {
67
	$admin->print_error($MESSAGE['MEDIA_DIR_EXISTS']);
69
	$admin->print_error($oTrans->MESSAGE_MEDIA_DIR_EXISTS);
68 70
}
69 71

  
70 72
if ( sizeof(createFolderProtectFile( $directory )) )
71 73
{
72
	$admin->print_error($MESSAGE['MEDIA_DIR_NOT_MADE']);
74
	$admin->print_error($oTrans->MESSAGE_MEDIA_DIR_NOT_MADE);
73 75
} else {
74 76
	$usedFiles = array();
75 77
    // feature freeze
76 78
	// require_once(ADMIN_PATH.'/media/dse.php');
77
	$admin->print_success($MESSAGE['MEDIA_DIR_MADE']);
79
	$admin->print_success($oTrans->MESSAGE_MEDIA_DIR_MADE);
78 80
}
79 81

  
80 82
// Print admin
branches/2.8.x/wb/admin/media/parameters.php
28 28
	$__ret = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $sObject );
29 29
	return unserialize($__ret);
30 30
}
31

  
31
$oDb = WbDatabase::getInstance();
32 32
$pathsettings = array( 'global' => array( 'admin_only' => false,'show_thumbs' => false ) );
33 33
if(DEFAULT_THEME != '') {
34
	$query = $database->query ( "SELECT * FROM ".TABLE_PREFIX."settings where `name`='mediasettings'" );
35
	if ($query && $query->numRows() > 0) {
36
		$settings = $query->fetchRow();
34
	$sql = 'SELECT * FROM `'.$oDb->TablePrefix.'settings` '
35
         . 'WHERE `name`=\'mediasettings\'';
36
	$query = $oDb->doQuery($sql);
37
    if ($query && (($settings = $query->fetchRow(MYSQL_ASSOC)))) {
37 38
		$pathsettings = __unserialize($settings['value']);
38 39
	} else {
39
		$database->query ( "INSERT INTO ".TABLE_PREFIX."settings (`name`,`value`) VALUES ('mediasettings','')" );
40
		$sql = 'INSERT INTO `'.$oDb->TablePrefix.'settings` '
41
             . 'SET `name`=\'mediasettings\', '
42
             .     '`value`=\'\'';
43
		$oDb->doQuery($sql);
40 44
	}
41 45
}
branches/2.8.x/wb/admin/media/upload.php
23 23
    	require($config_file);
24 24
    }
25 25
}
26
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
26
//if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
27
$oTrans = Translate::getInstance();
28
$oTrans->enableAddon('admin\\media');
27 29

  
28 30
$modulePath = dirname(__FILE__);
29 31

  
......
36 38
if( !$admin->checkFTAN() )
37 39
{
38 40
	$admin->print_header();
39
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'] );
41
	$admin->print_error($oTrans->MESSAGE_GENERIC_SECURITY_ACCESS );
40 42
}
41 43
// After check print the header
42 44
$admin->print_header();
......
55 57
// Check to see if target contains ../
56 58
if (!check_media_path($target, false))
57 59
{
58
	$admin->print_error($MESSAGE['MEDIA_TARGET_DOT_DOT_SLASH'] );
60
	$admin->print_error($oTrans->MESSAGE_MEDIA_TARGET_DOT_DOT_SLASH );
59 61
}
60 62

  
61 63
// Create relative path of the target location for the file
......
200 202
unset($list);
201 203

  
202 204
if($sum_files == 1) {
203
	$admin->print_success($sum_files.' '.$MESSAGE['MEDIA_SINGLE_UPLOADED'] );
205
	$admin->print_success($sum_files.' '.$oTrans->MESSAGE_MEDIA_SINGLE_UPLOADED );
204 206
} elseif($sum_files > 1) {
205
	$admin->print_success($sum_files.' '.$MESSAGE['MEDIA_UPLOADED'] );
207
	$admin->print_success($sum_files.' '.$oTrans->MESSAGE_MEDIA_UPLOADED );
206 208
} else {
207 209

  
208 210
	if(file_exists($relative.$filename)) {
209
    	$admin->print_error($MESSAGE['MEDIA_FILE_EXISTS'] );
211
    	$admin->print_error($oTrans->MESSAGE_MEDIA_FILE_EXISTS );
210 212
    } else {
211
    	$admin->print_error($MESSAGE['MEDIA_NO_FILE_UPLOADED'] );
213
    	$admin->print_error($oTrans->MESSAGE_MEDIA_NO_FILE_UPLOADED );
212 214
    }
213 215
}
214 216

  
branches/2.8.x/wb/admin/media/index.php
24 24
    	require($config_file);
25 25
    }
26 26
}
27
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
27
$oTrans = Translate::getInstance();
28
$oTrans->enableAddon('admin\\media');
28 29

  
30
//if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
31

  
29 32
$admin = new admin('Media', 'media');
30 33

  
31 34
$starttime = explode(" ", microtime());
......
37 40
$template = new Template(dirname($admin->correct_theme_source('media.htt')));
38 41
$template->set_file('page', 'media.htt');
39 42
$template->set_block('page', 'main_block', 'main');
40

  
43
$template->set_var($oTrans->getLangArray());
41 44
// Include the WB functions file
42 45
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
43 46

  
......
95 98

  
96 99
// Insert language headings
97 100
$template->set_var(array(
98
					'HEADING_BROWSE_MEDIA' => $HEADING['BROWSE_MEDIA'],
99 101
					'HOME_DIRECTORY' => $currentHome,
100 102
//					'HOME_DIRECTORY' => ( $currentHome!='') ? $currentHome : $directory,
101
					'DISPLAY_UP_ARROW' => $display_up_arrow, // **!
102
					'HEADING_CREATE_FOLDER' => $HEADING['CREATE_FOLDER'],
103
					'HEADING_UPLOAD_FILES' => $HEADING['UPLOAD_FILES']
103
					'DISPLAY_UP_ARROW' => $display_up_arrow // **!
104 104
				)
105 105
			);
106 106
// insert urls
......
115 115
$template->set_var(array(
116 116
					'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
117 117
//					'MEDIA_DIRECTORY' => ($currentHome!='') ? MEDIA_DIRECTORY : $currentHome,
118
					'TEXT_NAME' => $TEXT['TITLE'],
119
					'TEXT_RELOAD' => $TEXT['RELOAD'],
120
					'TEXT_TARGET_FOLDER' => $TEXT['TARGET_FOLDER'],
121
					'TEXT_OVERWRITE_EXISTING' => $TEXT['OVERWRITE_EXISTING'],
122
					'TEXT_FILES' => $TEXT['FILES'],
123
					'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'],
124
					'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
125
					'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
126
					'OPTIONS' => $TEXT['OPTION'],
127
					'TEXT_UNZIP_FILE' => $TEXT['UNZIP_FILE'],
128
					'TEXT_DELETE_ZIP' => $TEXT['DELETE_ZIP'],
118
					'TEXT_NAME' => $oTrans->TEXT_TITLE,
119
					'CHANGE_SETTINGS' => $oTrans->TEXT_MODIFY_SETTINGS,
120
					'OPTIONS' => $oTrans->TEXT_OPTION,
129 121
					'FTAN' => $admin->getFTAN()
130 122
				)
131 123
			);
branches/2.8.x/wb/admin/media/rename.php
23 23
    	require($config_file);
24 24
    }
25 25
}
26
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
26
//if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
27
$oTrans = Translate::getInstance();
28
$oTrans->enableAddon('admin\\media');
27 29

  
28 30
$admin = new admin('Media', 'media', false);
29 31

  
......
47 49

  
48 50
// first Check to see if it contains ..
49 51
if (!check_media_path($directory)) {
50
	$admin->print_error($MESSAGE['MEDIA_DIR_DOT_DOT_SLASH'],$rootlink, false);
52
	$admin->print_error($oTrans->MESSAGE_MEDIA_DIR_DOT_DOT_SLASH, $rootlink, false);
51 53
}
52 54

  
53 55
// Get the temp id
54 56
$file_id = intval($admin->checkIDKEY('id', false, $_SERVER['REQUEST_METHOD']));
55 57
if (!$file_id) {
56
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$dirlink, false);
58
	$admin->print_error($oTrans->MESSAGE_GENERIC_SECURITY_ACCESS, $dirlink, false);
57 59
}
58 60

  
59 61
// Get home folder not to show
......
105 107
}
106 108

  
107 109
if(!isset($rename_file)) {
108
	$admin->print_error($MESSAGE['MEDIA_FILE_NOT_FOUND'], $dirlink, false);
110
	$admin->print_error($oTrans->MESSAGE_MEDIA_FILE_NOT_FOUND, $dirlink, false);
109 111
}
110 112

  
111 113
// Setup template object, parse vars to it, then parse it
......
114 116
$template->set_file('page', 'media_rename.htt');
115 117
$template->set_block('page', 'main_block', 'main');
116 118
//echo WB_PATH.'/media/'.$directory.'/'.$rename_file;
119
$template->set_var($oTrans->getLangArray());
120

  
117 121
if($type == 'folder') {
118 122
	$template->set_var('DISPlAY_EXTENSION', 'hide');
119 123
	$extension = '';
......
139 143
					'FTAN' => $admin->getFTAN()
140 144
				)
141 145
			);
142

  
143

  
144
// Insert language text and messages
145
$template->set_var(array(
146
					'TEXT_TO' => $TEXT['TO'],
147
					'TEXT_RENAME' => $TEXT['RENAME'],
148
					'TEXT_CANCEL' => $TEXT['CANCEL'],
149
					'TEXT_UP' => $TEXT['UP'],
150
					'TEXT_OVERWRITE_EXISTING' => $TEXT['OVERWRITE_EXISTING']
151
				)
152
			);
153

  
154 146
// Parse template object
155 147
$template->parse('main', 'main_block', false);
156 148
$template->pparse('output', 'page');
branches/2.8.x/wb/admin/start/index.php
15 15
 *
16 16
 */
17 17

  
18
$config_file = realpath('../../config.php');
19
if(file_exists($config_file) && !defined('WB_URL'))
20
{
21
	require_once($config_file);
18
if (!defined('WB_URL')) {
19
	require_once('../../config.php');
22 20
}
23

  
24
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
25

  
21
$oDb = WbDatabase::getInstance();
22
$oTrans = Translate::getInstance();
23
$oTrans->enableAddon('admin\\start');
24
//$template->set_var($oTrans->getLangArray());
26 25
$admin = new admin('Start','start');
27 26
// ---------------------------------------
28 27
//	$database = WbDatabase::getInstance();
......
55 54
		closedir($handle);
56 55
		}
57 56
	}
58
	$sql = 'DELETE FROM `'.TABLE_PREFIX.'settings` WHERE `name`=\'FINALIZE_SETUP\'';
59
	if($database->query($sql)) { }
57
	$sql = 'DELETE FROM `'.$oDb-TablePrefix.'settings` WHERE `name`=\'FINALIZE_SETUP\'';
58
	$oDb->doQuery($sql);
60 59
}
61 60
// ---------------------------------------
62 61
// check if it is neccessary to start the uograde-script
63 62

  
64 63
$msg  = '';
65
$msg .= (is_readable(WB_PATH.'/install/')) ?  $MESSAGE['START_INSTALL_DIR_EXISTS'].'<br />' : $msg;
64
$msg .= (is_readable(WB_PATH.'/install/')) ?  $oTrans->MESSAGE_START_INSTALL_DIR_EXISTS.'<br />' : $msg;
66 65
$aReplace =array( 
67 66
      'file' => '<a style="font-weight:bold;" href="'.WB_URL.'/upgrade-script.php">upgrade-script.php</a>'
68 67
    );
69
$msg .= (is_readable(WB_PATH.'/upgrade-script.php') ?  replace_vars($MESSAGE['START_UPGRADE_SCRIPT_EXISTS'].'<br />',$aReplace) : '');
70
//$msg .= ''.$MESSAGE['START_UPGRADE_SCRIPT_EXISTS'].'<br />';
68
$msg .= (is_readable(WB_PATH.'/upgrade-script.php') ?  replace_vars($oTrans->MESSAGE_START_UPGRADE_SCRIPT_EXISTS.'<br />',$aReplace) : '');
71 69

  
72 70
// ---------------------------------------
73 71
// check if it is neccessary to start the uograde-script
74 72
// ---------------------------------------
75 73
if(($admin->get_user_id()==1) && file_exists(WB_PATH.'/upgrade-script.php')) {
76 74
	// check if it is neccessary to start the uograde-script
77
	$sql = 'SELECT `value` FROM `'.TABLE_PREFIX.'settings` WHERE `name`=\'wb_revision\'';
78
	if($wb_revision=$database->get_one($sql)) {
79
	}
75
	$sql = 'SELECT `value` FROM `'.$oDb-TablePrefix.'settings` WHERE `name`=\'wb_revision\'';
76
	$wb_revision = $oDb->getOne($sql);
80 77
	if (version_compare($wb_revision, REVISION ) < 0) {
81 78
echo "<p style=\"text-align:center;\"> If the <strong>upgrade script</strong> could not be start automatically.\n" .
82 79
     "Please click <a style=\"font-weight:bold;\" " .
......
105 102
// ---------------------------------------
106 103
// workout to upgrade the groups system_permissions
107 104
// ---------------------------------------
108
if( ($admin->get_user_id()==1) &&
109
	file_exists(ADMIN_PATH.'/groups/upgradePermissions.php') && !defined('GROUPS_UPDATED') )
105
if( ($admin->get_user_id()==1) && file_exists(ADMIN_PATH.'/groups/upgradePermissions.php') && !defined('GROUPS_UPDATED') )
110 106
{
111 107
	// check if it is neccessary to start the uograde-script
112
	$sql = 'SELECT `value` FROM `'.TABLE_PREFIX.'settings` WHERE `name`=\'wb_revision\'';
113
	if($wb_revision = $database->get_one($sql)) {
114

  
115
	}
116

  
108
	$sql = 'SELECT `value` FROM `'.$oDb-TablePrefix.'settings` WHERE `name`=\'wb_revision\'';
109
	$wb_revision = $database->get_one($sql);
117 110
	if ((version_compare($wb_revision, '1800' )  < 0)&& !defined('GROUPS_UPDATED')) {
118 111
		require_once (ADMIN_PATH.'/groups/upgradePermissions.php');
119 112
		// build new or changed $sTempPermissions
......
140 133
/**
141 134
 * delete Outdated Confirmations
142 135
 */
143
$sql = 'DELETE FROM `'.TABLE_PREFIX.'users` WHERE `confirm_timeout` BETWEEN 1 AND '.time();
144
WbDatabase::getInstance()->query($sql);
136
$sql = 'DELETE FROM `'.$oDb-TablePrefix.'users` WHERE `confirm_timeout` BETWEEN 1 AND '.time();
137
$oDb->doQuery($sql);
145 138

  
146 139
/**
147 140
 * delete stored ip adresses default after 60 days
148 141
 */
149
$sql = 'UPDATE `'.TABLE_PREFIX.'users` SET `login_ip` = \'\' WHERE `login_when` < '.(time()-(60*84600));
150
WbDatabase::getInstance()->query($sql);
142
$sql = 'UPDATE `'.$oDb-TablePrefix.'users` SET `login_ip` = \'\' WHERE `login_when` < '.(time()-(60*84600));
143
$oDb->doQuery($sql);
151 144

  
152 145
// ---------------------------------------
153 146
// Setup template object, parse vars to it, then parse it
......
155 148
$oTpl = new Template(dirname($admin->correct_theme_source('start.htt')),'keep');
156 149
$oTpl->set_file('page', 'start.htt');
157 150
$oTpl->set_block('page', 'main_block', 'main');
158

  
151
$oTpl->set_var($oTrans->getLangArray());
159 152
// Insert values into the template object
160 153
$oTpl->set_var(array(
161
					'WELCOME_MESSAGE' => $MESSAGE['START_WELCOME_MESSAGE'],
162
					'CURRENT_USER' => $MESSAGE['START_CURRENT_USER'],
163
					'DISPLAY_NAME' => $admin->get_display_name(),
154
					'WELCOME_MESSAGE' => $oTrans->MESSAGE_START_WELCOME_MESSAGE,
155
					'CURRENT_USER'    => $oTrans->MESSAGE_START_CURRENT_USER,
156
					'DISPLAY_NAME'    => $admin->get_display_name(),
164 157
                    'DISPLAY_WARNING' => '',
165
                    'WARNING' => '',
166
					'ADMIN_URL' => ADMIN_URL,
167
					'WB_URL' => WB_URL,
168
					'THEME_URL' => THEME_URL,
169
					'WB_VERSION' => WB_VERSION,
170
					'NO_CONTENT' => ''
158
                    'WARNING'         => '',
159
					'ADMIN_URL'       => ADMIN_URL,
160
					'WB_URL'          => WB_URL,
161
					'THEME_URL'       => THEME_URL,
162
					'WB_VERSION'      => WB_VERSION,
163
					'NO_CONTENT'      => ''
171 164
				)
172 165
			);
173 166

  
......
228 221
	$oTpl->parse('show_preferences', 'show_preferences_block', true);
229 222
}
230 223

  
231

  
232
/*
233
if($admin->get_permission('pages') != true)
234
{
235
	$oTpl->set_var('DISPLAY_PAGES', 'display:none;');
236
}
237
if($admin->get_permission('media') != true)
238
{
239
	$oTpl->set_var('DISPLAY_MEDIA', 'display:none;');
240
}
241
if($admin->get_permission('addons') != true)
242
{
243
	$oTpl->set_var('DISPLAY_ADDONS', 'display:none;');
244
}
245
if($admin->get_permission('access') != true)
246
{
247
	$oTpl->set_var('DISPLAY_ACCESS', 'display:none;');
248
}
249
if($admin->get_permission('settings') != true)
250
{
251
	$oTpl->set_var('DISPLAY_SETTINGS', 'display:none;');
252
}
253
if($admin->get_permission('admintools') != true)
254
{
255
	$oTpl->set_var('DISPLAY_ADMINTOOLS', 'display:none;');
256
}
257
*/
258

  
259

  
260 224
$oTpl->set_block('main_block', 'show_install_block', 'show_install');
261 225
if($admin->get_user_id() != 1)
262 226
{
......
280 244
}
281 245

  
282 246
// Insert "Add-ons" section overview (pretty complex compared to normal)
283
$addons_overview = $TEXT['MANAGE'].' ';
247
$addons_overview = $oTrans->TEXT_MANAGE.' ';
284 248
$addons_count = 0;
285 249
if($admin->get_permission('modules') == true)
286 250
{
287
	$addons_overview .= '<a href="'.ADMIN_URL.'/modules/index.php">'.$MENU['MODULES'].'</a>';
251
	$addons_overview .= '<a href="'.ADMIN_URL.'/modules/index.php">'.$oTrans->MENU_MODULES.'</a>';
288 252
	$addons_count = 1;
289 253
}
290 254
if($admin->get_permission('templates') == true)
291 255
{
292 256
	if($addons_count == 1) { $addons_overview .= ', '; }
293
	$addons_overview .= '<a href="'.ADMIN_URL.'/templates/index.php">'.$MENU['TEMPLATES'].'</a>';
257
	$addons_overview .= '<a href="'.ADMIN_URL.'/templates/index.php">'.$oTrans->MENU_TEMPLATES.'</a>';
294 258
	$addons_count = 1;
295 259
}
296 260
if($admin->get_permission('languages') == true)
297 261
{
298 262
	if($addons_count == 1) { $addons_overview .= ', '; }
299
	$addons_overview .= '<a href="'.ADMIN_URL.'/languages/index.php">'.$MENU['LANGUAGES'].'</a>';
263
	$addons_overview .= '<a href="'.ADMIN_URL.'/languages/index.php">'.$oTrans->MENU_LANGUAGES.'</a>';
300 264
}
301 265

  
302 266
// Insert "Access" section overview (pretty complex compared to normal)
303
$access_overview = $TEXT['MANAGE'].' ';
267
$access_overview = $oTrans->TEXT_MANAGE.' ';
304 268
$access_count = 0;
305 269
if($admin->get_permission('users') == true) {
306
	$access_overview .= '<a href="'.ADMIN_URL.'/users/index.php">'.$MENU['USERS'].'</a>';
270
	$access_overview .= '<a href="'.ADMIN_URL.'/users/index.php">'.$oTrans->MENU_USERS.'</a>';
307 271
	$access_count = 1;
308 272
}
309 273
if($admin->get_permission('groups') == true) {
310 274
	if($access_count == 1) { $access_overview .= ', '; }
311
	$access_overview .= '<a href="'.ADMIN_URL.'/groups/index.php">'.$MENU['GROUPS'].'</a>';
275
	$access_overview .= '<a href="'.ADMIN_URL.'/groups/index.php">'.$oTrans->MENU_GROUPS.'</a>';
312 276
	$access_count = 1;
313 277
}
314 278

  
315 279
// Insert section names and descriptions
316 280
$oTpl->set_var(array(
317
					'PAGES' => $MENU['PAGES'],
318
					'MEDIA' => $MENU['MEDIA'],
319
					'ADDONS' => $MENU['ADDONS'],
320
					'ACCESS' => $MENU['ACCESS'],
321
					'PREFERENCES' => $MENU['PREFERENCES'],
322
					'SETTINGS' => $MENU['SETTINGS'],
323
					'ADMINTOOLS' => $MENU['ADMINTOOLS'],
324
					'HOME_OVERVIEW' => $OVERVIEW['START'],
325
					'PAGES_OVERVIEW' => $OVERVIEW['PAGES'],
326
					'MEDIA_OVERVIEW' => $OVERVIEW['MEDIA'],
327
					'ADDONS_OVERVIEW' => $addons_overview,
328
					'ACCESS_OVERVIEW' => $access_overview,
329
					'PREFERENCES_OVERVIEW' => $OVERVIEW['PREFERENCES'],
330
					'SETTINGS_OVERVIEW' => $OVERVIEW['SETTINGS'],
331
					'ADMINTOOLS_OVERVIEW' => $OVERVIEW['ADMINTOOLS']
281
					'PAGES'                => $oTrans->MENU_PAGES,
282
					'MEDIA'                => $oTrans->MENU_MEDIA,
283
					'ADDONS'               => $oTrans->MENU_ADDONS,
284
					'ACCESS'               => $oTrans->MENU_ACCESS,
285
					'PREFERENCES'          => $oTrans->MENU_PREFERENCES,
286
					'SETTINGS'             => $oTrans->MENU_SETTINGS,
287
					'ADMINTOOLS'           => $oTrans->MENU_ADMINTOOLS,
288
					'HOME_OVERVIEW'        => $oTrans->OVERVIEW_START,
289
					'PAGES_OVERVIEW'       => $oTrans->OVERVIEW_PAGES,
290
					'MEDIA_OVERVIEW'       => $oTrans->OVERVIEW_MEDIA,
291
					'ADDONS_OVERVIEW'      => $addons_overview,
292
					'ACCESS_OVERVIEW'      => $access_overview,
293
					'PREFERENCES_OVERVIEW' => $oTrans->OVERVIEW_PREFERENCES,
294
					'SETTINGS_OVERVIEW'    => $oTrans->OVERVIEW_SETTINGS,
295
					'ADMINTOOLS_OVERVIEW'  => $oTrans->OVERVIEW_ADMINTOOLS
332 296
				)
333 297
			);
334 298

  
branches/2.8.x/wb/admin/templates/uninstall.php
17 17

  
18 18
// Setup admin object
19 19
require('../../config.php');
20
require_once(WB_PATH.'/framework/class.admin.php');
20
$oDb = WbDatabase::getInstance();
21
$oTrans = Translate::getInstance();
22
$oTrans->enableAddon('admin\\addons');
21 23
// suppress to print the header, so no new FTAN will be set
22 24
$admin = new admin('Addons', 'templates_uninstall', false);
23 25
if( !$admin->checkFTAN() )
24 26
{
25 27
	$admin->print_header();
26
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
28
	$admin->print_error($oTrans->MESSAGE_GENERIC_SECURITY_ACCESS);
27 29
}
28 30
// After check print the header
29 31
$admin->print_header();
30 32
if(!isset($_POST['file']) OR $_POST['file'] == "") {
31
	$admin->print_error($MESSAGE['GENERIC_FORGOT_OPTIONS']);
33
	$admin->print_error($oTrans->MESSAGE_GENERIC_FORGOT_OPTIONS);
32 34
} else {
33 35
	$file = preg_replace('/[^a-z0-9_-]/i', "", $_POST['file']);  // fix secunia 2010-92-2
34 36
}
35 37

  
36 38
// Check if the template exists
37 39
if(!is_dir(WB_PATH.'/templates/'.$file)) {
38
	$admin->print_error($MESSAGE['GENERIC_NOT_INSTALLED']);
40
	$admin->print_error($oTrans->MESSAGE_GENERIC_NOT_INSTALLED);
39 41
}
40 42

  
41 43
// Check if the template exists
42 44
if(!is_readable(WB_PATH.'/templates/'.$file)) {
43
	$admin->print_error($MESSAGE['ADMIN_INSUFFICIENT_PRIVELLIGES']);
45
	$admin->print_error($oTrans->MESSAGE_ADMIN_INSUFFICIENT_PRIVELLIGES);
44 46
}
45 47

  
46 48
// Check if user selected template
......
62 64
// Include the WB functions file
63 65
require_once(WB_PATH.'/framework/functions.php');
64 66
if (!function_exists("replace_all")) {
65
	function replace_all ($aStr = "", &$aArray ) {
66
		foreach($aArray as $k=>$v) $aStr = str_replace("{{".$k."}}", $v, $aStr);
67
	function replace_all($aStr = "", array $aArray = null ) {
68
		foreach ($aArray as $k=>$v) {
69
            $aStr = str_replace("{{".$k."}}", $v, $aStr);
70
        }
67 71
		return $aStr;
68 72
	}
69 73
}
......
71 75
/**
72 76
*	Check if the template is the standard-template or still in use
73 77
*/
74
if (!array_key_exists('CANNOT_UNINSTALL_IS_DEFAULT_TEMPLATE', $MESSAGE['GENERIC'] ) )
75
	$MESSAGE['GENERIC_CANNOT_UNINSTALL_IS_DEFAULT_TEMPLATE'] = "Can't uninstall this template <b>{{name}}</b> because it's the standardtemplate!";
76

  
78
$sMsgTpl = (isset($oTrans->MESSAGE_GENERIC_CANNOT_UNINSTALL_IS_DEFAULT_TEMPLATE)
79
            ? $oTrans->MESSAGE_GENERIC_CANNOT_UNINSTALL_IS_DEFAULT_TEMPLATE
80
            : 'Can\'t uninstall this template <b>{{name}}</b> because it\'s the standardtemplate!');
77 81
// check whether the template is used as default wb theme
78 82
if($file == DEFAULT_THEME) {
79 83
	$temp = array ('name' => $file );
80
	$msg = replace_all( $MESSAGE['GENERIC_CANNOT_UNINSTALL_IS_DEFAULT_TEMPLATE'], $temp );
84
	$msg = replace_all( $sMsgTpl, $temp );
81 85
	$admin->print_error( $msg );
82 86
}
83 87

  
84 88
if ($file == DEFAULT_TEMPLATE) {
85 89
	$temp = array ('name' => $file );
86
	$msg = replace_all( $MESSAGE['GENERIC_CANNOT_UNINSTALL_IS_DEFAULT_TEMPLATE'], $temp );
90
	$msg = replace_all( $sMsgTpl, $temp );
87 91
	$admin->print_error( $msg );
88 92

  
89 93
} else {
......
91 95
	/**
92 96
	*	Check if the template is still in use by a page ...
93 97
	*/
94
	$info = $database->query("SELECT page_id, page_title FROM ".TABLE_PREFIX."pages WHERE template='".$file."' order by page_title");
95

  
96
	if ($info->numRows() > 0) {
97
		/**
98
		*	Template is still in use, so we're collecting the page-titles
99
		*/
100

  
101
		/**
102
		*	The base-message template-string for the top of the message
103
		*/
104
		if (!array_key_exists("CANNOT_UNINSTALL_IN_USE_TMPL", $MESSAGE['GENERIC'])) {
105
			$add = $info->numRows() == 1 ? "this page" : "these pages";
106
			$msg_template_str  = "<br /><br />{{type}} <b>{{type_name}}</b> could not be uninstalled because it is still in use by {{pages}}";
107
			$msg_template_str .= ":<br /><i>click for editing.</i><br /><br />";
108
		} else {
109
			$msg_template_str = $MESSAGE['GENERIC_CANNOT_UNINSTALL_IN_USE_TMPL'];
110
			$temp = explode(";",$MESSAGE['GENERIC_CANNOT_UNINSTALL_IN_USE_TMPL_PAGES']);
111
			$add = $info->numRows() == 1 ? $temp[0] : $temp[1];
112
		}
113
		/**
114
		*	The template-string for displaying the Page-Titles ... in this case as a link
115
		*/
116
		$page_template_str = "- <b><a href='../pages/settings.php?page_id={{id}}'>{{title}}</a></b><br />";
117

  
118
		$values = array ('type' => 'Template', 'type_name' => $file, 'pages' => $add);
119
		$msg = replace_all ( $msg_template_str,  $values );
120

  
121
		$page_names = "";
122

  
123
		while ($data = $info->fetchRow() ) {
124

  
125
			$page_info = array(
126
				'id'	=> $data['page_id'],
127
				'title' => $data['page_title']
128
			);
129

  
130
			$page_names .= replace_all ( $page_template_str, $page_info );
131
		}
132

  
133
		/**
134
		*	Printing out the error-message and die().
135
		*/
136
		$admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL_IN_USE'].$msg.$page_names);
137
	}
98
	$sql = 'SELECT `page_id` `id`, `page_title` `title` FROM `'.$oDb->TablePrefix.'pages` '
99
         . 'WHERE `template`=\''.$file.'\' '
100
         . 'ORDER BY `page_title`';
101
	if (($info = $oDb->doQuery($sql))) {
102
        if (($iNumberOfRows = $info->numRows())) {
103
            /**
104
            *	Template is still in use, so we're collecting the page-titles
105
            *	The base-message template-string for the top of the message
106
            */
107
            if (!isset($oTrans->MESSAGE_GENERIC_CANNOT_UNINSTALL_IN_USE_TMPL)) {
108
                $add = ($iNumberOfRows == 1 ? 'this page' : 'these pages');
109
                $msg_template_str  = '<br /><br />{{type}} <b>{{type_name}}</b> could not be uninstalled because it is still in use by {{pages}}';
110
                $msg_template_str .= ':<br /><i>click for editing.</i><br /><br />';
111
            } else {
112
                $msg_template_str = $oTrans->MESSAGE_GENERIC_CANNOT_UNINSTALL_IN_USE_TMPL;
113
                $temp = explode(";",$oTrans->MESSAGE_GENERIC_CANNOT_UNINSTALL_IN_USE_TMPL_PAGES);
114
                $add = $iNumberOfRows == 1 ? $temp[0] : $temp[1];
115
            }
116
            /**
117
            *	The template-string for displaying the Page-Titles ... in this case as a link
118
            */
119
            $page_template_str = "- <b><a href='../pages/settings.php?page_id={{id}}'>{{title}}</a></b><br />";
120
            $values = array ('type' => 'Template', 'type_name' => $file, 'pages' => $add);
121
            $msg = replace_all($msg_template_str, $values);
122
            $page_names = "";
123
            while ($page_info = $info->fetchRow(MYSQL_ASSOC) ) {
124
//                $page_info = array(
125
//                    'id'	=> $data['page_id'],
126
//                    'title' => $data['page_title']
127
//                );
128
                $page_names .= replace_all($page_template_str, $page_info);
129
            }
130
            /**
131
            *	Printing out the error-message and die().
132
            */
133
            $admin->print_error($oTrans->MESSAGE_GENERIC_CANNOT_UNINSTALL_IN_USE.$msg.$page_names);
134
        }
135
    }
138 136
}
139 137

  
140 138
// Check if we have permissions on the directory
141 139
if(!is_writable(WB_PATH.'/templates/'.$file)) {
142
	$admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL'].WB_PATH.'/templates/'.$file);
140
	$admin->print_error($oTrans->MESSAGE_GENERIC_CANNOT_UNINSTALL.WB_PATH.'/templates/'.$file);
143 141
}
144 142

  
145 143
// Try to delete the template dir
146 144
if(!rm_full_dir(WB_PATH.'/templates/'.$file)) {
147
	$admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL']);
145
	$admin->print_error($oTrans->MESSAGE_GENERIC_CANNOT_UNINSTALL);
148 146
} else {
149 147
	// Remove entry from DB
150
	$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE directory = '".$file."' AND type = 'template'");
148
	$sql = 'DELETE FROM `'.$oDb->TablePrefix.'addons` '
149
         . 'WHERE `directory`=\''.$file.'\' AND `type`=\'template\'';
150
	$oDb->doQuery($sql);
151 151
}
152

  
153 152
// Update pages that use this template with default template
154 153
// $database = new database();
155
$database->query("UPDATE ".TABLE_PREFIX."pages SET template = '".DEFAULT_TEMPLATE."' WHERE template = '$file'");
154
$sql = 'UPDATE `'.$oDb->TablePrefix.'pages` '
155
     . 'SET `template`=\''.DEFAULT_TEMPLATE.'\' '
156
     . 'WHERE `template`=\''.$file.'\'';
157
$oDb->doQuery($sql);
156 158

  
157 159
// Print success message
158
$admin->print_success($MESSAGE['GENERIC_UNINSTALLED']);
160
$admin->print_success($oTrans->MESSAGE_GENERIC_UNINSTALLED);
159 161

  
160 162
// Print admin footer
161 163
$admin->print_footer();
branches/2.8.x/wb/admin/templates/details.php
17 17

  
18 18
// Include the config file
19 19
require('../../config.php');
20
$mLang = Translate::getInstance();
21
$mLang->enableAddon('admin\addons');
20
$oTrans = Translate::getInstance();
21
$oTrans->enableAddon('admin\\addons');
22 22
require_once(WB_PATH .'/framework/functions.php');
23
require_once(WB_PATH.'/framework/class.admin.php');
24 23
// suppress to print the header, so no new FTAN will be set
25 24
$admin = new admin('Addons', 'templates_view', false);
26 25
if( !$admin->checkFTAN() )
27 26
{
28 27
	$admin->print_header();
29
	$admin->print_error($mLang->MESSAGE_GENERIC_SECURITY_ACCESS);
28
	$admin->print_error($oTrans->MESSAGE_GENERIC_SECURITY_ACCESS);
30 29
}
31 30

  
32 31
// After check print the header
33 32
$admin->print_header();
34 33
// Get template name
35 34
if(!isset($_POST['file']) OR $_POST['file'] == "") {
36
	$admin->print_error($mLang->MESSAGE_GENERIC_FORGOT_OPTIONS);
35
	$admin->print_error($oTrans->MESSAGE_GENERIC_FORGOT_OPTIONS);
37 36
} else {
38 37
	$file = preg_replace('/[^a-z0-9_-]/i', "", $_POST['file']);  // fix secunia 2010-92-2
39 38
}
40 39

  
41 40
// Check if the template exists
42 41
if(!is_dir(WB_PATH.'/templates/'.$file)) {
43
	$admin->print_error($mLang->MESSAGE_GENERIC_NOT_INSTALLED);
42
	$admin->print_error($oTrans->MESSAGE_GENERIC_NOT_INSTALLED);
44 43
}
45 44

  
46 45
// Check if the template exists
47 46
if(!is_readable(WB_PATH.'/templates/'.$file)) {
48
	$admin->print_error($mLang->MESSAGE_ADMIN_INSUFFICIENT_PRIVELLIGES);
47
	$admin->print_error($oTrans->MESSAGE_ADMIN_INSUFFICIENT_PRIVELLIGES);
49 48
}
50 49
// Print admin header
51 50
//$admin = new admin('Addons', 'templates_view');
......
56 55
// $template->debug = true;
57 56
$template->set_file('page', 'templates_details.htt');
58 57
$template->set_block('page', 'main_block', 'main');
58
/*-- insert all needed vars from language files ----------------------------------------*/
59
$template->set_var($oTrans->getLangArray());
59 60
$template->set_var('FTAN', $admin->getFTAN());
60 61

  
61 62
// Insert values
62
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND directory = '$file'");
63
$sql = 'SELECT * FROM `'.WbDatabase::getInstance()->TablePrefix.'addons` '
64
     . 'WHERE `type` = \'template\' AND directory = \''.$file.'\'';
65
$result = WbDatabase::getInstance()->doQuery($sql);
63 66
if($result->numRows() > 0) {
64 67
	$row = $result->fetchRow();
65 68
}
......
92 95
      'LICENSE' => $row['license'],
93 96
    )
94 97
);
95
/*-- insert all needed vars from language files ----------------------------------------*/
96
$template->set_var($mLang->getLangArray());
97 98

  
98
$template->set_var('TEXT_FUNCTION', ($row['function'] == 'theme' ? $mLang->TEXT_THEME : $mLang->TEXT_TEMPLATE));
99
$template->set_var('TEXT_FUNCTION', ($row['function'] == 'theme' ? $oTrans->TEXT_THEME : $oTrans->TEXT_TEMPLATE));
99 100
// Parse template object
100 101
$template->parse('main', 'main_block', false);
101 102
$template->pparse('output', 'page');
branches/2.8.x/wb/admin/templates/install.php
20 20

  
21 21
// Setup admin object
22 22
require('../../config.php');
23
$oTrans = Translate::getInstance();
24
$oTrans->enableAddon('admin\\addons');
23 25
require_once(WB_PATH.'/framework/class.admin.php');
24 26
// suppress to print the header, so no new FTAN will be set
25 27
$admin = new admin('Addons', 'templates_install', false);
26 28
if( !$admin->checkFTAN() )
27 29
{
28 30
	$admin->print_header();
29
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
31
	$admin->print_error($oTrans->MESSAGE_GENERIC_SECURITY_ACCESS);
30 32
}
31 33
// After check print the header
32 34
$admin->print_header();
......
47 49

  
48 50
// Try to upload the file to the temp dir
49 51
if(!move_uploaded_file($_FILES['userfile']['tmp_name'], $temp_file)) {
50
	$admin->print_error($MESSAGE['GENERIC_CANNOT_UPLOAD']);
52
	$admin->print_error($oTrans->MESSAGE_GENERIC_CANNOT_UPLOAD);
51 53
}
52 54

  
53 55
// Include the PclZip class file (thanks to
......
63 65
$list = $archive->extract(PCLZIP_OPT_PATH, $temp_unzip);
64 66

  
65 67
// Check if uploaded file is a valid Add-On zip file
66
if (!($list && file_exists($temp_unzip . 'index.php'))) $admin->print_error($MESSAGE['GENERIC_INVALID_ADDON_FILE']);
68
if (!($list && file_exists($temp_unzip . 'index.php'))) $admin->print_error($oTrans->MESSAGE_GENERIC_INVALID_ADDON_FILE);
67 69

  
68 70
// Include the templates info file
69 71
require($temp_unzip.'info.php');
......
78 80
// Check if the file is valid
79 81
if(!isset($template_directory)) {
80 82
	if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file
81
	$admin->print_error($MESSAGE['GENERIC_INVALID']);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff