Revision 1460
Added by Luisehahne over 13 years ago
branches/2.8.x/CHANGELOG | ||
---|---|---|
11 | 11 |
! = Update/Change |
12 | 12 |
|
13 | 13 |
------------------------------------- 2.8.2 ------------------------------------ |
14 |
29 Jun-2011 Build 1460 Dietmar Woellbrink (Luisehahne) |
|
15 |
# Ticket 1101, phtml|php5|php4|php|cgi|pl|exe|com|bat|src| will be hardcoded |
|
16 |
additional you can set more extension in settings extended in field rename_file_types |
|
17 |
rename_file_types now is a blacklist and will no longer be renamed to .txt |
|
18 |
! update admintools modules to work with SecureForm Patch from NorHei |
|
14 | 19 |
26 Jun-2011 Build 1459 Dietmar Woellbrink (Luisehahne) |
15 | 20 |
# Ticket 1099: change title for add_child_page in page tree |
16 | 21 |
26 Jun-2011 Build 1458 Dietmar Woellbrink (Luisehahne) |
branches/2.8.x/wb/admin/media/browse.php | ||
---|---|---|
151 | 151 |
// $filename = $currentdir; |
152 | 152 |
if(!empty($currentdir)) { |
153 | 153 |
$usedFiles = $Dse->getMatchesFromDir( $currentdir, DseTwo::RETURN_USED); |
154 |
/* */
|
|
154 |
/* |
|
155 | 155 |
print '<pre><strong>function '.__FUNCTION__.'();</strong> basename: '.basename(__FILE__).' line: '.__LINE__.' -> <br />'; |
156 | 156 |
print_r( $usedFiles ); print '</pre>'; // flush ();sleep(10); die(); |
157 |
|
|
157 |
*/ |
|
158 | 158 |
} |
159 | 159 |
|
160 | 160 |
if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory)) { |
... | ... | |
253 | 253 |
'DATE' => $date, |
254 | 254 |
'PREVIEW' => $preview, |
255 | 255 |
'IMAGE_TITLE' => $name, |
256 |
// 'IMAGE_EXIST' => search_image($directory.'/',$name) |
|
257 |
'IMAGE_EXIST' => (in_array($name, $usedFiles) ? 'view_16.png' : 'pic_16.png') |
|
256 |
'IMAGE_EXIST' => 'blank_16.gif' |
|
258 | 257 |
) |
259 | 258 |
); |
260 | 259 |
$template->parse('list', 'list_block', true); |
branches/2.8.x/wb/admin/media/upload.php | ||
---|---|---|
66 | 66 |
$file_extension_string=$fetch_result['value']; |
67 | 67 |
} |
68 | 68 |
$file_extensions=explode(",",$file_extension_string); |
69 |
|
|
69 |
// get from settings and add to forbidden list |
|
70 |
$rename_file_types = str_replace(',','|',RENAME_FILES_ON_UPLOAD); |
|
71 |
// hardcodet forbidden filetypes |
|
72 |
$forbidden_file_types = 'phtml|php5|php4|php|cgi|pl|exe|com|bat|src|'.$rename_file_types; |
|
70 | 73 |
// Loop through the files |
71 | 74 |
$good_uploads = 0; |
72 | 75 |
for($count = 1; $count <= 10; $count++) { |
73 | 76 |
// If file was upload to tmp |
74 | 77 |
if(isset($_FILES["file$count"]['name'])) { |
75 | 78 |
// Remove bad characters |
76 |
$filename = media_filename($_FILES["file$count"]['name']);
|
|
79 |
$filename = trim(media_filename($_FILES["file$count"]['name']),'.') ;
|
|
77 | 80 |
// Check if there is still a filename left |
78 |
if($filename != '') { |
|
79 |
// Check for potentially malicious files and append 'txt' to their name |
|
81 |
// if($filename != '') { |
|
82 |
$info = pathinfo($filename); |
|
83 |
$ext = isset($info['extension']) ? $info['extension'] : ''; |
|
84 |
|
|
85 |
if ( ($filename != '') && !preg_match("/\." . $forbidden_file_types . "$/i", $ext) ) { |
|
86 |
/* |
|
87 |
// Check for potentially malicious files and append 'txt' to their name |
|
80 | 88 |
foreach($file_extensions as $file_ext) { |
81 | 89 |
$file_ext_len=strlen($file_ext); |
82 | 90 |
if (substr($filename,-$file_ext_len)==$file_ext) { |
83 | 91 |
$filename.='.txt'; |
84 | 92 |
} |
85 |
} |
|
93 |
} |
|
94 |
*/ |
|
86 | 95 |
// Move to relative path (in media folder) |
87 |
if(file_exists($relative.$filename) AND $overwrite == true) {
|
|
96 |
if(file_exists($relative.$filename) AND $overwrite == true) { |
|
88 | 97 |
if(move_uploaded_file($_FILES["file$count"]['tmp_name'], $relative.$filename)) { |
89 | 98 |
$good_uploads++; |
90 | 99 |
// Chmod the uploaded file |
91 |
change_mode($relative.$filename, 'file');
|
|
100 |
change_mode($relative.$filename); |
|
92 | 101 |
} |
93 | 102 |
} elseif(!file_exists($relative.$filename)) { |
94 | 103 |
if(move_uploaded_file($_FILES["file$count"]['tmp_name'], $relative.$filename)) { |
... | ... | |
97 | 106 |
change_mode($relative.$filename); |
98 | 107 |
} |
99 | 108 |
} |
100 |
|
|
109 |
|
|
101 | 110 |
if(file_exists($relative.$filename)) { |
102 | 111 |
if ($pathsettings[$resizepath]['width'] || $pathsettings[$resizepath]['height'] ) { |
103 | 112 |
$rimg=new RESIZEIMAGE($relative.$filename); |
... | ... | |
105 | 114 |
$rimg->close(); |
106 | 115 |
} |
107 | 116 |
} |
108 |
|
|
117 |
|
|
109 | 118 |
// store file name of first file for possible unzip action |
110 | 119 |
if ($count == 1) { |
111 | 120 |
$filename1 = $relative . $filename; |
... | ... | |
113 | 122 |
} |
114 | 123 |
} |
115 | 124 |
} |
125 |
/* |
|
126 |
* Callback function to skip files in black-list |
|
127 |
*/ |
|
128 |
function pclzipCheckValidFile($p_event, &$p_header) |
|
129 |
{ |
|
130 |
// return 1; |
|
131 |
$rename_file_types = str_replace(',','|',RENAME_FILES_ON_UPLOAD); |
|
132 |
// hardcodet forbidden filetypes |
|
133 |
$forbidden_file_types = 'phtml|php5|php4|php|cgi|pl|exe|com|bat|src|'.$rename_file_types; |
|
134 |
$info = pathinfo($p_header['filename']); |
|
135 |
$ext = isset($info['extension']) ? $info['extension'] : ''; |
|
136 |
$dots = (substr($info['basename'], 0, 1) == '.') || (substr($info['basename'], -1, 1) == '.'); |
|
137 |
if( !preg_match('/'.$forbidden_file_types.'$/i', $ext) && $dots != '.' ) |
|
138 |
{ // ----- allowed file types are extracted |
|
139 |
return 1; |
|
140 |
}else |
|
141 |
{ // ----- all other files are skiped |
|
142 |
return 0; |
|
143 |
} |
|
144 |
} |
|
145 |
/* ********************************* */ |
|
116 | 146 |
|
117 | 147 |
// If the user chose to unzip the first file, unzip into the current folder |
118 | 148 |
if (isset($_POST['unzip']) && isset($filename1) && file_exists($filename1) ) { |
119 | 149 |
$archive = new PclZip($filename1); |
120 |
$list = $archive->extract(PCLZIP_OPT_PATH, $relative); |
|
150 |
|
|
151 |
$list = $archive->extract(PCLZIP_OPT_PATH, $relative,PCLZIP_CB_PRE_EXTRACT, 'pclzipCheckValidFile'); |
|
152 |
|
|
121 | 153 |
if($list == 0) { |
122 | 154 |
// error while trying to extract the archive (most likely wrong format) |
123 | 155 |
$admin->print_error('UNABLE TO UNZIP FILE' . $archive -> errorInfo(true)); |
124 | 156 |
} |
125 |
|
|
157 |
|
|
158 |
$sum_dirs = 0; |
|
159 |
$sum_files = 0; |
|
160 |
|
|
126 | 161 |
// rename executable files! |
127 |
foreach ($list as $val) { |
|
128 |
$fn = $val['filename']; |
|
129 |
$fnp = pathinfo($fn); |
|
130 |
if (isset($fnp['extension'])) { |
|
131 |
$fext = $fnp['extension']; |
|
132 |
if (in_array($fext, $file_extensions)) { |
|
133 |
rename($fn, $fn.".txt"); |
|
134 |
} |
|
162 |
foreach ($list as $key => $val) { |
|
163 |
if( ($val['folder'] ) && change_mode($val['filename']) ) { |
|
164 |
$sum_dirs++; |
|
165 |
} elseif( is_writable($val['filename']) && ($val['status'] == 'ok') && change_mode($val['filename']) ) { |
|
166 |
$sum_files++; |
|
135 | 167 |
} |
136 | 168 |
} |
169 |
if (isset($_POST['delzip'])) { unlink($filename1); } |
|
137 | 170 |
} |
138 |
|
|
171 |
unset($list); |
|
139 | 172 |
if($good_uploads == 1) { |
140 |
$admin->print_success($good_uploads.' '.$MESSAGE['MEDIA']['SINGLE_UPLOADED'] ); |
|
141 |
if (isset($_POST['delzip'])) { |
|
142 |
unlink($filename1); |
|
143 |
} |
|
173 |
$admin->print_success($sum_files.' '.$MESSAGE['MEDIA']['SINGLE_UPLOADED'] ); |
|
144 | 174 |
} else { |
145 | 175 |
$admin->print_success($good_uploads.' '.$MESSAGE['MEDIA']['UPLOADED'] ); |
146 | 176 |
} |
branches/2.8.x/wb/admin/interface/version.php | ||
---|---|---|
52 | 52 |
|
53 | 53 |
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled) |
54 | 54 |
if(!defined('VERSION')) define('VERSION', '2.8.2.RC6'); |
55 |
if(!defined('REVISION')) define('REVISION', '1459');
|
|
55 |
if(!defined('REVISION')) define('REVISION', '1460');
|
|
56 | 56 |
|
57 | 57 |
?> |
branches/2.8.x/wb/admin/admintools/tool.php | ||
---|---|---|
29 | 29 |
$tool = $array[0]; |
30 | 30 |
} |
31 | 31 |
|
32 |
$list = array(); |
|
32 |
$ModulesList = array(); |
|
33 |
$admin_header = true; |
|
33 | 34 |
if(isset($_POST['save_settings'])) { |
34 | 35 |
$ModulesUsingFTAN = ADMIN_PATH.'/admintools/modules.inc'; |
35 | 36 |
if(file_exists($ModulesUsingFTAN)){ |
36 |
if(($list = file($ModulesUsingFTAN, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES)) !== false)
|
|
37 |
if(($ModulesList = file($ModulesUsingFTAN, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES)) !== false)
|
|
37 | 38 |
{ |
38 | 39 |
// remove remark-lines |
39 |
$list = preg_grep('/^\s*?[^#;]/', $list);
|
|
40 |
$ModulesList = preg_grep('/^\s*?[^#;]/', $ModulesList);
|
|
40 | 41 |
} |
41 | 42 |
} |
42 | 43 |
} |
43 | 44 |
|
44 |
$admin_header = (in_array($tool, $list) ? false : true);
|
|
45 |
$admin = new admin('admintools', 'admintools',$admin_header ); |
|
46 |
unset($list);
|
|
45 |
$admin_header = (!in_array($tool, $ModulesList));
|
|
46 |
$admin = new admin('admintools', 'admintools', $admin_header );
|
|
47 |
unset($ModulesList);
|
|
47 | 48 |
|
48 | 49 |
// Check if tool is installed |
49 | 50 |
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'tool' AND directory = '".preg_replace("/\W/", "", $tool)."'"); |
... | ... | |
51 | 52 |
header("Location: index.php"); |
52 | 53 |
exit(0); |
53 | 54 |
} |
54 |
$tool = $result->fetchRow(); |
|
55 |
$tools = $result->fetchRow();
|
|
55 | 56 |
if(!isset($_POST['save_settings'])) { |
56 | 57 |
|
57 | 58 |
?> |
58 | 59 |
<h4> |
59 | 60 |
<a href="<?php echo ADMIN_URL; ?>/admintools/index.php"><?php echo $HEADING['ADMINISTRATION_TOOLS']; ?></a> |
60 | 61 |
» |
61 |
<?php echo $tool['name']; ?> |
|
62 |
<?php echo $tools['name']; ?>
|
|
62 | 63 |
</h4> |
63 | 64 |
<?php |
64 | 65 |
} |
65 |
require(WB_PATH.'/modules/'.$tool['directory'].'/tool.php'); |
|
66 |
require(WB_PATH.'/modules/'.$tools['directory'].'/tool.php');
|
|
66 | 67 |
|
67 | 68 |
$admin->print_footer(); |
branches/2.8.x/wb/modules/captcha_control/tool.php | ||
---|---|---|
42 | 42 |
if(isset($_POST['save_settings'])) { |
43 | 43 |
if (!$admin->checkFTAN()) |
44 | 44 |
{ |
45 |
$admin->print_header();
|
|
45 |
if(!$admin_header) { $admin->print_header(); }
|
|
46 | 46 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $js_back ); |
47 | 47 |
} |
48 | 48 |
|
... | ... | |
67 | 67 |
} |
68 | 68 |
|
69 | 69 |
// check if there is a database error, otherwise say successful |
70 |
$admin->print_header();
|
|
70 |
if(!$admin_header) { $admin->print_header(); }
|
|
71 | 71 |
if($database->is_error()) { |
72 | 72 |
$admin->print_error($database->get_error(), $js_back); |
73 | 73 |
} else { |
... | ... | |
75 | 75 |
} |
76 | 76 |
|
77 | 77 |
} else { |
78 |
} |
|
78 | 79 |
|
79 | 80 |
// include captcha-file |
80 | 81 |
require_once(WB_PATH .'/include/captcha/captcha.php'); |
... | ... | |
200 | 201 |
<input type="submit" name="save_settings" style="margin-top:10px; width:140px;" value="<?php echo $TEXT['SAVE']; ?>" /> |
201 | 202 |
</form> |
202 | 203 |
<?php |
203 |
} |
|
204 | 204 |
|
205 | 205 |
?> |
branches/2.8.x/wb/modules/jsadmin/tool.php | ||
---|---|---|
39 | 39 |
|
40 | 40 |
// Check if user selected what add-ons to reload |
41 | 41 |
if(isset($_POST['save_settings'])) { |
42 |
|
|
42 | 43 |
if (!$admin->checkFTAN()) |
43 | 44 |
{ |
44 |
$admin->print_header();
|
|
45 |
if(!$admin_header) { $admin->print_header(); }
|
|
45 | 46 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$_SERVER['REQUEST_URI']); |
46 | 47 |
} |
47 |
$admin->print_header(); |
|
48 | 48 |
|
49 | 49 |
// Include functions file |
50 | 50 |
require_once(WB_PATH.'/framework/functions.php'); |
... | ... | |
53 | 53 |
save_setting('mod_jsadmin_ajax_order_sections', isset($_POST['ajax_order_sections'])); |
54 | 54 |
// echo '<div style="border: solid 2px #9c9; background: #ffd; padding: 0.5em; margin-top: 1em">'.$MESSAGE['SETTINGS']['SAVED'].'</div>'; |
55 | 55 |
// check if there is a database error, otherwise say successful |
56 |
if(!$admin_header) { $admin->print_header(); } |
|
56 | 57 |
if($database->is_error()) { |
57 | 58 |
$admin->print_error($database->get_error(), $js_back); |
58 | 59 |
} else { |
branches/2.8.x/wb/modules/output_filter/tool.php | ||
---|---|---|
33 | 33 |
|
34 | 34 |
if (!$admin->checkFTAN()) |
35 | 35 |
{ |
36 |
$admin->print_header();
|
|
36 |
if(!$admin_header) { $admin->print_header(); }
|
|
37 | 37 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$_SERVER['REQUEST_URI'],false); |
38 | 38 |
} |
39 | 39 |
// get overall output filter settings |
... | ... | |
51 | 51 |
mailto_filter = '$mailto_filter', at_replacement = '$at_replacement', dot_replacement = '$dot_replacement'"); |
52 | 52 |
|
53 | 53 |
// check if there is a database error, otherwise say successful |
54 |
$admin->print_header();
|
|
54 |
if(!$admin_header) { $admin->print_header(); }
|
|
55 | 55 |
if($database->is_error()) { |
56 | 56 |
$admin->print_error($database->get_error(), $js_back); |
57 | 57 |
} else { |
... | ... | |
59 | 59 |
} |
60 | 60 |
|
61 | 61 |
} else { |
62 |
} |
|
62 | 63 |
// write out heading |
63 | 64 |
echo '<h2>' .$MOD_MAIL_FILTER['HEADING'] .'</h2>'; |
64 | 65 |
|
... | ... | |
109 | 110 |
<input type="submit" name="save_settings" style="margin-top:10px; width:140px;" value="<?php echo $TEXT['SAVE']; ?>" /> |
110 | 111 |
</form> |
111 | 112 |
<?php |
112 |
} |
|
113 | 113 |
|
114 | 114 |
?> |
Also available in: Unified diff
Ticket 1101, phtml|php5|php4|php|cgi|pl|exe|com|bat|src| will be hardcoded
additional you can set more extension in settings extended in field rename_file_types
rename_file_types now is a blacklist and will no longer be renamed to .txt
update admintools modules to work with SecureForm Patch from NorHei