The shared result image had one look, and it no longer matched the modern
frontend.
The renderer can now draw either design. The image follows the same
useNewDesign setting as the frontend, so a deployment has one switch rather
than two that can disagree, and classic remains the fallback.
- An explicit style query parameter overrides it, which is how the modern
frontend asks for the design it matches.
- The modern design reuses the frontend palette and shows the client, address
family and timestamp already present in the result data.
formatSpeedtestDataForImage() assigned the timestamp to itself, so the value
reached the image exactly as the database returned it. Every other field on
that list is passed through format(); this one reads like a placeholder that
was never filled in, and static analysis flags it as a self-assignment.
How much precision the column carries is decided by the backend, and the three
schemas shipped here disagree: MySQL's `timestamp` keeps none, PostgreSQL's
`timestamp without time zone DEFAULT now()` keeps microseconds and MSSQL's
`datetime` keeps milliseconds. A PostgreSQL deployment therefore drew
"2026-08-10 02:04:13.957789" where a MySQL one drew "2026-08-10 02:04:13".
* put code to insert and query data from database into separate file
* simplify obfuscation salt file handling
* use new DB interaction functions in telemetry.php
* use new DB interaction functions in stats.php
and fix indentation levels
* format telemetry settings file
* use new function for interacting with DB in index.php
* move drawing of the image into function and try to comment each section with what it does
* reorder lines for parts of the image to align with the order they appear on the image
* bugfix: display obfuscated and deobfuscated id in stats if id obfuscation is enabled
* improve error handling
* add missing PHPDocs to functions
* imageftbbox returns an array on success and false on failure so to check if the font is usable, check if we got an array
* fix dsn for postgres
* fix limit sql statement for postgresql
* remove obsolete require statement
* use require instead of require_once since the settings file might need to be loaded multiple times
because it just contains plain variables which will just get loaded into the current scope
* move require statements to the top of the file
* make sure files are readable before requiring them
* add constant to refer to the telemetry settings file and check if it is readable before loading it
* return null if no speedtest result was found for the given id and show according message to the user instead of just exiting
* use existing constant instead of string for telemetry settings file name
* uniformly use single quotes instead of double quotes as most code places already used single quotes
* somehow some tabs sneaked in, replace them to uniformly use spaces
* mysql now uses pdo, too, reflect that in the requirements documentation
* pass username and password as constructor parameters instead of via DSN