classic ui: Fix incorrect behaviour of getcgivars() -- #5276

This commit attempts to fix an observed behaviour where the getcgivars()
routine was creating a single list rather than a list of key/value pairs.
One manifestation of this was a QUERY_STRING of "jsonoutput=csvoutput"
(which is technically illegal as both of those are booleans) producing
CSV rather than JSON.  This may also help correct the root-cause of the
off-by-one error in #5251.

refs: #5276
classic ui: Fix incorrect behaviour of getcgivars() -- #5276

Fixed a *very* embarrassing oversight having to do with pointers
to the key and value in cmd.cgi.

refs: #5276
whatthecommit: How on Earth did I miss this???
classic ui: Fix incorrect behaviour of getcgivars() -- #5276

fixed confusion between "key" and "value" in the large key-comparison
if/else if ladder that kept iamges from being generated correctly.

refs: #5276
whatthecommit: Asleep at the switch again, I see...
Merge branch 'fix/getcgivars-function-produces-incorrect-results-5276' into next

fixes: #5276