Squashed commit of the following:

commit 7190866ccf15033f27095d635546e46dacbb755e
Author: plegall <plg@piwigo.org>
Date:   Thu Jul 12 10:52:33 2018 +0200

    Revert "Replace not maintained cssmin with fork from github https://github.com/natxet/CssMin"

    This reverts commit c8b12a2ed0.

commit 1dac11ecb6783d0d5353c3d250388f018c30fc5c
Author: plegall <plg@piwigo.org>
Date:   Thu Jul 12 10:52:24 2018 +0200

    Revert "Update Smarty to 3.1.3"

    This reverts commit db684f6151.

commit 3ac752dc93912ba5701d22dadd9bb3b81e5bb383
Merge: d1c2e71 8d58256
Author: plegall <plg@piwigo.org>
Date:   Thu Jul 12 10:50:43 2018 +0200

    Merge branch 'php72' of https://github.com/Infern1/Piwigo into Infern1-php72

commit 8d58256c45
Author: Rob Lensen <rob@bsdfreaks.nl>
Date:   Wed Mar 21 23:40:36 2018 +0100

    new feedcreator version for PHP7

commit bb0fcc3a30
Author: Rob Lensen <rob@bsdfreaks.nl>
Date:   Wed Mar 21 23:26:27 2018 +0100

    php72 fixes, replaces each() function

commit 3db22c0d33
Author: Rob Lensen <rob@bsdfreaks.nl>
Date:   Wed Mar 21 23:02:46 2018 +0100

    More fixes for PHP7.2

commit 50d8aafc77
Author: Rob Lensen <rob@bsdfreaks.nl>
Date:   Mon Mar 19 23:55:21 2018 +0100

    Some more replacements of create_function

commit 8263335c42
Author: Rob Lensen <rob@bsdfreaks.nl>
Date:   Mon Mar 19 22:54:54 2018 +0100

    Fixed indents

commit 8d58b637c6
Merge: c8b12a2 8a57d77
Author: Rob Lensen <rob@bsdfreaks.nl>
Date:   Tue Feb 27 13:51:32 2018 +0100

    Merge remote-tracking branch 'upstream/master' into php72

commit c8b12a2ed0
Author: Rob Lensen <rob@bsdfreaks.nl>
Date:   Thu Jan 18 00:32:46 2018 +0100

    Replace not maintained cssmin with fork from github https://github.com/natxet/CssMin

commit db684f6151
Author: Rob Lensen <rob@bsdfreaks.nl>
Date:   Thu Jan 18 00:23:24 2018 +0100

    Update Smarty to 3.1.3

commit 6a3f8f3e76
Author: Rob Lensen <rob@bsdfreaks.nl>
Date:   Wed Jan 17 23:40:27 2018 +0100

    Initial work to support PHP 7.2
This commit is contained in:
plegall 2018-07-12 10:52:55 +02:00
parent d1c2e71a56
commit 063711240a
13 changed files with 1762 additions and 1573 deletions

View file

@ -377,7 +377,7 @@ SELECT
{
$tags_string = preg_replace_callback(
'/(\d+)/',
create_function('$m', 'global $name_of_tag; return isset($name_of_tag[$m[1]]) ? $name_of_tag[$m[1]] : $m[1];'),
function($m) use ($name_of_tag) { return isset($name_of_tag[$m[1]]) ? $name_of_tag[$m[1]] : $m[1];} ,
str_replace(
',',
', ',

View file

@ -675,7 +675,7 @@ SELECT id, id_uppercat, uppercats, rank, global_rank
$datas = array();
$cat_map_callback = create_function('$m', 'global $cat_map; return $cat_map[$m[1]]["rank"];');
$cat_map_callback = function($m) use ($cat_map) { return $cat_map[$m[1]]["rank"]; };
foreach( $cat_map as $id=>$cat )
{
@ -1051,7 +1051,7 @@ SELECT id, uppercats, site_id
$categories = query2array($query);
// filling $cat_fulldirs
$cat_dirs_callback = create_function('$m', 'global $cat_dirs; return $cat_dirs[$m[1]];');
$cat_dirs_callback = function($m) use ($cat_dirs) { return $cat_dirs[$m[1]]; };
$cat_fulldirs = array();
foreach ($categories as $category)

View file

@ -89,7 +89,7 @@ function check_sendmail_timeout()
*/
function quote_check_key_list($check_key_list = array())
{
return array_map(create_function('$s', 'return \'\\\'\'.$s.\'\\\'\';'), $check_key_list);
return array_map(function($s) { return '\''.$s.'\''; } , $check_key_list);
}
/*
@ -543,4 +543,4 @@ function subscribe_notification_by_mail($is_admin_request, $check_key_list = arr
return do_subscribe_unsubscribe_notification_by_mail($is_admin_request, true, $check_key_list);
}
?>
?>

View file

@ -181,10 +181,7 @@ if (!empty($_GET['keyword']))
'('.
implode(' AND ',
array_map(
create_function(
'$s',
'return "content LIKE \'%$s%\'";'
),
function($s) {return "content LIKE \'%$s%\'"; } ,
preg_split('/[\s,;]+/', $_GET['keyword'] )
)
).
@ -562,4 +559,4 @@ flush_page_messages();
if (count($comments) > 0) $template->assign_var_from_handle('COMMENT_LIST', 'comment_list');
$template->pparse('comments');
include(PHPWG_ROOT_PATH.'include/page_tail.php');
?>
?>

View file

@ -400,9 +400,9 @@ CREATE TABLE '.$temporary_tablename.'
mass_inserts($temporary_tablename, $all_fields, $datas);
if ($flags & MASS_UPDATES_SKIP_EMPTY)
$func_set = create_function('$s', 'return "t1.$s = IFNULL(t2.$s, t1.$s)";');
$func_set = function($s) { return "t1.$s = IFNULL(t2.$s, t1.$s)"; };
else
$func_set = create_function('$s', 'return "t1.$s = t2.$s";');
$func_set = function($s) { return "t1.$s = t2.$s"; };
// update of table by joining with temporary table
$query = '
@ -416,7 +416,7 @@ UPDATE '.$tablename.' AS t1, '.$temporary_tablename.' AS t2
implode(
"\n AND ",
array_map(
create_function('$s', 'return "t1.$s = t2.$s";'),
function($s) { return "t1.$s = t2.$s"; },
$dbfields['primary']
)
);

View file

@ -241,7 +241,7 @@ class Emogrifier {
$nodesWithStyleAttributes = $xpath->query('//*[@style]');
if ($nodesWithStyleAttributes !== FALSE) {
$callback = create_function('$m', 'return strtolower($m[0]);');
$callback = function($m) { return strtolower($m[0]); };
/** @var $nodeWithStyleAttribute \DOMNode */
foreach ($nodesWithStyleAttributes as $node) {

File diff suppressed because it is too large Load diff

View file

@ -1399,11 +1399,7 @@ function safe_json_decode($value)
*/
function prepend_append_array_items($array, $prepend_str, $append_str)
{
array_walk(
$array,
create_function('&$s', '$s = "'.$prepend_str.'".$s."'.$append_str.'";')
);
array_walk($array, function(&$value, $key) use($prepend_str,$append_str) { $value = "$prepend_str$value$append_str"; } );
return $array;
}
@ -2162,7 +2158,7 @@ SELECT COUNT(DISTINCT(com.id))
*/
function safe_version_compare($a, $b, $op=null)
{
$replace_chars = create_function('$m', 'return ord(strtolower($m[1]));');
$replace_chars = function($m) { return ord(strtolower($m[1])); };
// add dot before groups of letters (version_compare does the same thing)
$a = preg_replace('#([0-9]+)([a-z]+)#i', '$1.$2', $a);

View file

@ -123,7 +123,7 @@ function get_sql_search_clause($search)
array_walk(
$word_clauses,
create_function('&$s','$s="(".$s.")";')
function(&$s){ $s = "(".$s.")"; },
);
// make sure the "mode" is either OR or AND

View file

@ -290,7 +290,7 @@ class Template
return false;
}
reset($filename_array);
while(list($handle, $filename) = each($filename_array))
foreach ($filename_array as $handle => $filename)
{
if (is_null($filename))
{
@ -1102,7 +1102,7 @@ var s,after = document.getElementsByTagName(\'script\')[document.getElementsByTa
// replaces echo PHP_STRING_LITERAL; with the string literal value
$source = preg_replace_callback(
'/\\<\\?php echo ((?:\'(?:(?:\\\\.)|[^\'])*\')|(?:"(?:(?:\\\\.)|[^"])*"));\\?\\>\\n/',
create_function('$matches', 'eval(\'$tmp=\'.$matches[1].\';\');return $tmp;'),
function($matches) { eval('$tmp='.$matches[1].';');return $tmp; },
$source);
return $source;
}

View file

@ -617,7 +617,7 @@ Request format: ".@$this->_requestFormat." Response format: ".@$this->_responseF
static function ws_getMethodList($params, &$service)
{
$methods = array_filter($service->_methods,
create_function('$m', 'return empty($m["options"]["hidden"]) || !$m["options"]["hidden"];'));
function($m) { return empty($m["options"]["hidden"]) || !$m["options"]["hidden"];} );
return array('methods' => new PwgNamedArray( array_keys($methods),'method' ) );
}

View file

@ -32,7 +32,7 @@ function ws_tags_getList($params, &$service)
$tags = get_available_tags();
if ($params['sort_by_counter'])
{
usort($tags, create_function('$a,$b', 'return -$a["counter"]+$b["counter"];') );
usort($tags, function($a, $b) { return -$a["counter"]+$b["counter"]; });
}
else
{
@ -245,4 +245,4 @@ function ws_tags_add($params, &$service)
return $creation_output;
}
?>
?>

View file

@ -33,11 +33,11 @@ if( !@get_magic_quotes_gpc() )
{
if( is_array($_POST) )
{
while( list($k, $v) = each($_POST) )
foreach($_POST as $k => $v)
{
if( is_array($_POST[$k]) )
{
while( list($k2, $v2) = each($_POST[$k]) )
foreach($_POST[$k] as $k2 => $v2)
{
$_POST[$k][$k2] = addslashes($v2);
}
@ -53,11 +53,11 @@ if( !@get_magic_quotes_gpc() )
if( is_array($_GET) )
{
while( list($k, $v) = each($_GET) )
foreach($_GET as $k => $v )
{
if( is_array($_GET[$k]) )
{
while( list($k2, $v2) = each($_GET[$k]) )
foreach($_GET[$k] as $k2 => $v2)
{
$_GET[$k][$k2] = addslashes($v2);
}
@ -73,11 +73,11 @@ if( !@get_magic_quotes_gpc() )
if( is_array($_COOKIE) )
{
while( list($k, $v) = each($_COOKIE) )
foreach($_COOKIE as $k => $v)
{
if( is_array($_COOKIE[$k]) )
{
while( list($k2, $v2) = each($_COOKIE[$k]) )
foreach($_COOKIE[$k] as $k2 => $v2)
{
$_COOKIE[$k][$k2] = addslashes($v2);
}