mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 17:23:04 +02:00
fixes #1616 handle backticked rank column in conf.order_by setting
This commit is contained in:
@@ -178,7 +178,7 @@ if (isset($_POST['submit']))
|
|||||||
$order_by = $order_by_inside_category = array_slice($_POST['order_by'], 0, ceil(count($sort_fields)/2));
|
$order_by = $order_by_inside_category = array_slice($_POST['order_by'], 0, ceil(count($sort_fields)/2));
|
||||||
|
|
||||||
// there is no rank outside categories
|
// there is no rank outside categories
|
||||||
if ( ($i = array_search('rank ASC', $order_by)) !== false)
|
if ( ($i = array_search('`rank` ASC', $order_by)) !== false)
|
||||||
{
|
{
|
||||||
unset($order_by[$i]);
|
unset($order_by[$i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,6 +141,19 @@ ImageStdParams::load_from_db();
|
|||||||
session_start();
|
session_start();
|
||||||
load_plugins();
|
load_plugins();
|
||||||
|
|
||||||
|
// 2022-02-25 due to escape on "rank" (becoming a mysql keyword in version 8), the $conf['order_by'] might
|
||||||
|
// use a "rank", even if admin/configuration.php should have removed it. We must remove it.
|
||||||
|
// TODO remove this data update as soon as 2025 arrives
|
||||||
|
if (preg_match('/(, )?`rank` ASC/', $conf['order_by']))
|
||||||
|
{
|
||||||
|
$order_by = preg_replace('/(, )?`rank` ASC/', '', $conf['order_by']);
|
||||||
|
if ('ORDER BY ' == $order_by)
|
||||||
|
{
|
||||||
|
$order_by = 'ORDER BY id ASC';
|
||||||
|
}
|
||||||
|
conf_update_param('order_by', $order_by, true);
|
||||||
|
}
|
||||||
|
|
||||||
// users can have defined a custom order pattern, incompatible with GUI form
|
// users can have defined a custom order pattern, incompatible with GUI form
|
||||||
if (isset($conf['order_by_custom']))
|
if (isset($conf['order_by_custom']))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user