An untested oversight in e_tree_model::multiFieldCmp() where $sort_field
could be a string has now been corrected.
$sort_field now accepts a string to prevent infinite recursion.
Fixes: #3044
e_tree_model::prepareSimulatedPagination() did not correctly handle the
count-only condition because of an incorrectly written emptiness check.
Fixes: #3034
This is the least intrusive solution I could come up with.
Anything else I tried to reduce technical debt would break the very
tangled dependency web, so I settled for this.
Fixes: #3033
Subclasses may forget to run code to do a total record count, which
leads to output showing "Total Records: 0" on some pages with lists,
like `/e107_admin/links.php`.
This commit cuts out the record counting from the getList() method of
any e_admin_form_ui subclasses and the base class so that subclasses do
not have to reimplement record counting.
The caveat with this implementation is that it violates the Law of
Demeter, as evidenced by the new chained method call:
$this->getController()->getTreeModel()->getTotal()
Jumping through two objects to get a value is not ideal, but this is the
code we have to work with at the moment.
In #3025, e_tree_model sorting was reimplemented in pure PHP, but this
broke custom sorting (like `?field=cat_name&asc=desc`).
This commit introduces a hack that simulates a subset of MySQL/MariaDB
ORDER BY clauses, which should be sufficient for all known custom
sorting that can be requested.
Tree formatting is always preserved, but custom sorting will apply for
all items at a certain depth under the same parent.
This commit also contains some minor formatting fixes and makes a minor
change to some regex to make use of non-capturing groups.
Fixes: #3029
This is a workaround to make the output of xmlClass::xml2array() in PHP
7.2 equal to that of prior PHP versions.
Consider this fix to be a part 2 of #3026.
PHP 7.2 changed the behavior of how we extract tags from
SimpleXMLElement resources. This hack adds a toleration for either the
PHP 7.2 behavior and the past behavior, which allows consistent parsing
of XML files.
One side effect of this change is the fixing of an innocuous bug that
provided blank values in some "@value" keys that should not have existed
in the first place. This should hopefully have no practical effect on
current uses of the modified method.
Fixes: #3027
Since PHP 7.2, running get_object_vars() on a SimpleXMLElement object
may return sequential arrays rather than nothing if there were no
children.
This commit introduces a sanity check in xmlClass::xml2array() that
ensures child tags are processed rather than sequential array keys.
This sanity check does not affect past major versions of PHP.
Fixes: #3018
Supersedes: #3019
Implementation parses db_query parameter and extracts the offset and/or
count from `LIMIT {offset} OFFSET {count}` or syntactically similar
Fixes: #3015
Supersedes: #3016
Eliminated e107 dependency on the MySQL/MariaDB CREATE PROCEDURE permission
As a bonus, any attempt to use e107's native custom sorting (e.g.
`?field=cat_name&asc=desc`) will preserve the correct tree hierarchy. The past
behavior was to sort as requested but keep showing depth, even though the
apparent tree hierarchy would be wrong.
Fixes: #3015
Supercedes: #2929