Fix owner-scope query bug returning the wrong qr code by id

qr_apply_owner_scope() used where('id_owner', X) + orWhere('id_owner', NULL,
'IS'). Any caller that had already added its own where('id', $id) before
calling it (qrcode_image.php, bulk_action.php's download path) ended up
with "WHERE id = ? AND id_owner = ? OR id_owner IS NULL" - AND binds
tighter than OR in SQL, so this was actually "(id = ? AND id_owner = ?) OR
(id_owner IS NULL)", which silently detaches the id filter and returns an
arbitrary null-owner row instead (or nothing, if that row's file is
missing) whenever the intended row didn't have a null owner. This is what
broke qr code thumbnails/downloads on qr.ensembia.com for scoped (non-super)
accounts, old and newly-created codes alike - reproduced and confirmed
fixed with a local before/after query dump, then with a live HTTP request
scenario (two accounts, two codes, one null-owner).

Fixed by building the scope as a single parenthesized raw condition
instead of two separate where() calls, so it can't be split apart by
whatever the caller already added to the query.

Also this session, per user feedback on the OSS rebrand review:
- Format moved back next to Filename in both qr-creation forms (was
  separated from it when Filename got grouped with Owner last session).
- README/About now mention the temporary admin/admin demo account instead
  of the not-yet-built self-registration flow.
This commit is contained in:
2026-07-11 05:04:51 +02:00
parent ad5a5df81e
commit 164872de4d
5 changed files with 41 additions and 33 deletions
+17 -17
View File
@@ -114,23 +114,6 @@ if (QRCODE_GENERATOR === "internal-chillerlan.qrcode") {
<div class="col-sm-12 mb-2">
<div class="row">
<div class="col-6 col-md-1">
<label for="format">Format</label>
<select name="format" class="form-control">
<option value="png">PNG</option>
<option value="gif">GIF</option>
<option value="jpeg">JPEG</option>
<option value="jpg">JPG</option>
<option value="svg">SVG</option>
<?php
if (QRCODE_GENERATOR === "internal-chillerlan.qrcode") {
echo ' <option value="svgbw">SVG (BW)</option>';
}
?>
<option value="eps">EPS</option>
</select>
</div>
<div class="col-sm-4">
<div class="form-group">
<label for="frame_text">Frame text</label>
@@ -179,6 +162,23 @@ if (QRCODE_GENERATOR === "internal-chillerlan.qrcode") {
</div>
</div>
<div class="col-6 col-md-1">
<label for="format">Format</label>
<select name="format" class="form-control">
<option value="png">PNG</option>
<option value="gif">GIF</option>
<option value="jpeg">JPEG</option>
<option value="jpg">JPG</option>
<option value="svg">SVG</option>
<?php
if (QRCODE_GENERATOR === "internal-chillerlan.qrcode") {
echo ' <option value="svgbw">SVG (BW)</option>';
}
?>
<option value="eps">EPS</option>
</select>
</div>
<?php if ($_SESSION['type'] === 'super') { ?>
<div class="col-sm-4">
<div class="form-group">