Project

General

Profile

« Previous | Next » 

Revision 9dd708be

Added by Jim Pingle over 2 years ago

Fix PHP 8.x issues in separator functions. Fixes #14338

View differences:

src/etc/inc/filter.inc
4759 4759
function display_separator($separators, $nrules, $columns_in_table) {
4760 4760
	if (is_array($separators)) {
4761 4761
		foreach ($separators as $separator) {
4762
			if ($separator['row'][0] == "fr" . $nrules) {
4762
			if (empty($separator)) {
4763
				continue;
4764
			}
4765
			if (array_get_path($separator, 'row/0') == "fr" . $nrules) {
4763 4766
				$cellcolor = $separator['color'];
4764 4767
				print('<tr class="ui-sortable-handle separator">' .
4765 4768
					'<td class="' . $cellcolor . '" colspan="' . ($columns_in_table -1) . '">' . '<span class="' . $cellcolor . '">' . htmlspecialchars($separator['text']) . '</span></td>' .
......
4772 4775

  
4773 4776
/* Return a list of separator rows */
4774 4777
function separator_rows($separators) {
4778
	$seprows = [];
4775 4779
	if (is_array($separators)) {
4776 4780
		foreach ($separators as $separator) {
4777
			$seprows[substr($separator['row']['0'], 2)] = true;
4781
			if (empty($separator)) {
4782
				continue;
4783
			}
4784
			$seprows[substr(array_get_path($separator, 'row/0'), 2)] = true;
4778 4785
		}
4779 4786
	}
4780 4787
	return $seprows;
......
4784 4791
function move_separators(&$a_separators, $ridx, $mvnrows) {
4785 4792
	if (is_array($a_separators)) {
4786 4793
		foreach ($a_separators as $sepi => $separator) {
4787
			$seprow = substr($separator['row']['0'], 2);
4794
			if (empty($separator)) {
4795
				continue;
4796
			}
4797
			$seprow = substr(array_get_path($separator, 'row/0'), 2);
4788 4798
			if ($seprow > $ridx) {
4789
				$a_separators[$sepi]['row']['0'] = 'fr' . ($seprow + $mvnrows);
4799
				array_set_path($a_separators, "{$sepi}/row/0", 'fr' . ($seprow + $mvnrows));
4790 4800
			}
4791 4801
		}
4792 4802
	}

Also available in: Unified diff