Skip to content
Permalink
Browse files

fixes #8 replace create_function to be compatible with PHP 7.2+

  • Loading branch information
plegall committed Nov 15, 2019
1 parent e4ec6b1 commit d9416928408182044b7b8ee6b6754f81783c0f3c
Showing with 4 additions and 4 deletions.
  1. +4 −4 main.inc.php
@@ -106,10 +106,10 @@ function dlsize_getFilename($row, $filesize=array())
$filename = str_replace($search, $replace, $conf['download_by_size_file_pattern']);
// functions
$filename = preg_replace_callback('#\$escape\((.*?)\)#', create_function('$m', 'return str2url($m[1]);'), $filename);
$filename = preg_replace_callback('#\$upper\((.*?)\)#', create_function('$m', 'return str2upper($m[1]);'), $filename);
$filename = preg_replace_callback('#\$lower\((.*?)\)#', create_function('$m', 'return str2lower($m[1]);'), $filename);
$filename = preg_replace_callback('#\$strpad\((.*?),(.*?),(.*?)\)#', create_function('$m', 'return str_pad($m[1],$m[2],$m[3],STR_PAD_LEFT);'), $filename);
$filename = preg_replace_callback('#\$escape\((.*?)\)#', function ($m) {return str2url($m[1]);}, $filename);
$filename = preg_replace_callback('#\$upper\((.*?)\)#', function ($m) {return str2upper($m[1]);}, $filename);
$filename = preg_replace_callback('#\$lower\((.*?)\)#', function ($m) {return str2lower($m[1]);}, $filename);
$filename = preg_replace_callback('#\$strpad\((.*?),(.*?),(.*?)\)#', function ($m) {return str_pad($m[1],$m[2],$m[3],STR_PAD_LEFT);}, $filename);
// cleanup
$filename = preg_replace(

0 comments on commit d941692

Please sign in to comment.
You can’t perform that action at this time.