[ticket/571] Fix incorrect cast to integer in database_handler
B3P-571
This commit is contained in:
@@ -97,6 +97,9 @@ class database_handler
|
|||||||
*/
|
*/
|
||||||
public function move_module_vertical($module_id, $module_data, $direction, $step = 1)
|
public function move_module_vertical($module_id, $module_data, $direction, $step = 1)
|
||||||
{
|
{
|
||||||
|
$direction = (int) $direction;
|
||||||
|
$step = (int) $step;
|
||||||
|
|
||||||
if ($direction == self::MOVE_DIRECTION_DOWN)
|
if ($direction == self::MOVE_DIRECTION_DOWN)
|
||||||
{
|
{
|
||||||
$current_increment = ' + ' . $step;
|
$current_increment = ' + ' . $step;
|
||||||
@@ -109,15 +112,15 @@ class database_handler
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||||
SET module_order = module_order' . (int) $other_increment . '
|
SET module_order = module_order' . $other_increment . '
|
||||||
WHERE module_order = ' . (int) ($module_data['module_order'] + ($direction * $step)) . '
|
WHERE module_order = ' . ($module_data['module_order'] + ($direction * $step)) . '
|
||||||
AND module_column = ' . (int) $module_data['module_column'];
|
AND module_column = ' . (int) $module_data['module_column'];
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
$updated = (bool) $this->db->sql_affectedrows();
|
$updated = (bool) $this->db->sql_affectedrows();
|
||||||
if ($updated)
|
if ($updated)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||||
SET module_order = module_order' . (int) $current_increment . '
|
SET module_order = module_order' . $current_increment . '
|
||||||
WHERE module_id = ' . (int) $module_id;
|
WHERE module_id = ' . (int) $module_id;
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -393,6 +393,6 @@ class manager
|
|||||||
*/
|
*/
|
||||||
public function get_module_link($mode, $module_id)
|
public function get_module_link($mode, $module_id)
|
||||||
{
|
{
|
||||||
return preg_replace(array('/i=[0-9]+/', '/mode=[a-zA-Z0-9_]+/'), array('i=%5C' . str_replace('\\', '-', $this->acp_class), 'mode=' . $mode), $this->u_action) . (($module_id) ? '&module_id=' . $module_id : '');
|
return preg_replace(array('/i=[0-9]+/', '/mode=[a-zA-Z0-9_]+/'), array('i=-' . str_replace('\\', '-', $this->acp_class), 'mode=' . $mode), $this->u_action) . (($module_id) ? '&module_id=' . $module_id : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ class modules_manager_confirm_box_test extends \board3\portal\tests\testframewor
|
|||||||
$this->assertNull($this->modules_manager->reset_module(15, 'barfoo', 6, array()));
|
$this->assertNull($this->modules_manager->reset_module(15, 'barfoo', 6, array()));
|
||||||
$this->assertEquals(array(
|
$this->assertEquals(array(
|
||||||
'seconds' => 3,
|
'seconds' => 3,
|
||||||
'link' => 'adm/index.php?i=%5Cfoo%5Cbar&mode=config&module_id=6',
|
'link' => 'adm/index.php?i=-foo-bar&mode=config&module_id=6',
|
||||||
), self::$meta_refresh);
|
), self::$meta_refresh);
|
||||||
$this->assertEquals(phpbb_acp_move_module_test::$error_type, E_USER_NOTICE);
|
$this->assertEquals(phpbb_acp_move_module_test::$error_type, E_USER_NOTICE);
|
||||||
$this->assertEquals(phpbb_acp_move_module_test::$error, 'adm/index.php?i=15&mode=foobar&module_id=6');
|
$this->assertEquals(phpbb_acp_move_module_test::$error, 'adm/index.php?i=15&mode=foobar&module_id=6');
|
||||||
|
|||||||
Reference in New Issue
Block a user