33018 Commits
Author SHA1 Message Date
Harsh Singh 31abd87b94 fix: a filter no longer throws a TypeError when a term field is a list, and a val or attr that cannot be read matches no event (#8498) 2026-11-29 19:01:06 -05:00
nic f4ca194f6b fix: filter and monitor views escape ExecuteInterval, Width, Height, Latitude and Longitude in attributes (#8509)
These values can come from the request (view=filter&filter[...],
view=monitor&newMonitor[...]) and were printed into value= and data-
attributes as they came.

fixes #8508
2026-11-29 18:57:07 -05:00
Harsh Singh 92c307677a fix: montage layout save refuses a list for the positions instead of saving Array (#8529) 2026-11-29 18:22:32 -05:00
Jash Ambaliya fa39b2f271 fix: auth hash login is refused while ZM_AUTH_HASH_SECRET is empty or the shipped default (#7643)
* fix: auth hash login is refused while ZM_AUTH_HASH_SECRET is empty or the shipped default refs #7642

* fix: zms and zmu refuse an auth hash made with an empty or default secret, fix the redaction test constant refs #7642
2026-11-29 18:13:12 -05:00
Harsh Singh c993ed0847 fix: event view shows a duration of more than a day in hours instead of wrapping at 24 (#8539) 2026-11-29 17:48:36 -05:00
Harsh Singh 11b4ad2610 fix: API saves refuse a group member, user role or user id that matches no row instead of a 500 (#8553) 2026-11-29 17:48:21 -05:00
nic 01a587438b fix-medium: hold per-monitor permissions in filterdebug, timeline, export, zone and monitor save (#8565)
* fix: filterdebug counts only events on monitors the user can view

The modal's "Matching events" count ran the filter's SQL as it is, with
no monitor restriction. A user limited to some monitors could build an
unsaved filter (a Notes LIKE term, say) and count, one character at a
time, the events of monitors they cannot view. The count now adds
monitorLimitSql(); the SQL and EXPLAIN shown stay what zmfilter runs.

* fix: timeline keeps the monitor restriction in the Monitors join

The timeline appended "AND E.MonitorId IN (viewable)" to its WHERE and
then the request filter's SQL. A filter term with "or" (Id < 0 or
MonitorId = N) put events of monitors the user cannot view on the
timeline. The restriction now goes in the join condition of the range,
events and event id queries, where no WHERE term reaches it.

test_viewable_monitors_empty.php checks the new variable.

* fix: zone save takes the zone's monitor and id from mid and zid only

The action checks that the user can edit monitor mid and that zid is one
of its zones, then passed every newZone[] field to getFormChanges().
newZone[MonitorId] in the form moved the zone to a monitor the user
cannot edit (UPDATE Zones SET ... MonitorId=N WHERE MonitorId=mid), and
newZone[Id] renumbered it. Both are dropped from the form fields.

* fix: monitor edit saves the monitor in mid, not newMonitor[Id]

An edit request checks canEdit('Monitors', mid), loads mid, then sets
the form on it. newMonitor[Id] in the form changed the loaded monitor's
Id, so Object::save() wrote the whole form over that other monitor
(UPDATE Monitors SET ... WHERE Id=newMonitor[Id]), one the user may not
be allowed to edit or view. The field is only for choosing the id of a
new monitor, so an edit drops it.

* fix: export view keeps the monitor restriction in the Monitors join

The export view built its events query as the timeline did: the
viewable monitor restriction in the WHERE, then the request filter's SQL
in brackets. A term's own ")" then "or (" closes those brackets, so the
view listed events of monitors the user cannot view. The restriction now
goes in the Monitors join condition. The timeline test covers this view
too and is renamed to test_views_monitor_limit_join.php.

fixes #8564
2026-11-29 17:46:10 -05:00
Harsh Singh 4191dd921f fix: tables sort a column of links by the text shown instead of the link address (#8561) 2026-11-29 17:39:35 -05:00
Harsh Singh b6ba2ee963 fix: console drag sort reports an order the server could not save instead of showing it as saved (#8557) 2026-11-29 17:39:32 -05:00
Harsh Singh 403b5ad655 fix: zmfilter upload refuses an event with no files instead of uploading an empty archive (#8555) 2026-11-29 17:39:28 -05:00
Harsh Singh 577927291f fix: API roles list answers its paging data as the users and logs lists do (#8551) 2026-11-29 17:39:24 -05:00
Harsh Singh 319e2e514e fix: API saves accept a JSON false for a number column as 0 (#8549) 2026-11-29 17:39:21 -05:00
Harsh Singh fe45d93acb fix: API filters answer 400 for a REGEXP pattern the database cannot compile instead of a 500 (#8547) 2026-11-29 17:39:17 -05:00
Harsh Singh bbbbc81faf fix: API tag and event edits keep the assignment date and user of the tag links that stay (#8545) 2026-11-29 17:39:12 -05:00
Harsh Singh 185c542356 fix: API zone add requires a Name and zone presets require a non-blank Name (#8543) 2026-11-29 17:39:08 -05:00
Harsh Singh 1cbe230713 fix: monitor probe opens without an undefined array key warning on a host with no default route (#8541) 2026-11-29 17:39:04 -05:00
Harsh Singh a0025281a0 fix: montage review keeps a fractional display interval instead of reading 70.2 as 702 (#8537) 2026-11-29 17:39:01 -05:00
Harsh Singh 959f5326c6 fix: Panasonic IP, NCS370 and IPCAMIOS accept the moveStop the web ui sends when a move button is released (#8535) 2026-11-29 17:38:58 -05:00
Harsh Singh 3f26005918 fix: FI8620 irisStop and the Foscam Y2k whiteStop stop the ptz and clear the OSD text (#8533) 2026-11-29 17:38:53 -05:00
Harsh Singh 911c9fcf5e fix: Dahua registers the credentials of an IPv6 camera address under the key LWP looks up (#8531) 2026-11-29 17:38:50 -05:00
Harsh Singh 08bc20d83a fix: options save refuses a list for an option or a new menu entry field instead of storing Array or dying (#8525) 2026-11-29 17:38:47 -05:00
Harsh Singh ec8f4f3c8a fix: event rename and detail refuse a list for the name, cause or notes instead of writing Array (#8523) 2026-11-29 17:38:43 -05:00
Harsh Singh e136b16f04 fix: console restart skips a WebSite monitor instead of starting a capture daemon for it (#8521) 2026-11-29 17:38:40 -05:00
Harsh Singh 9d5e7a8c51 fix: exporting a running event no longer raises a strtotime null deprecation (#8519) 2026-11-29 17:38:36 -05:00
Harsh Singh c69b5a5e4e fix: console footer event links match no events when no monitor is listed instead of every event (#8517) 2026-11-29 17:38:33 -05:00
Harsh Singh 2f9f658a9a fix: control capability delete skips an id that is not a whole number instead of deleting another (#8515) 2026-11-29 17:38:29 -05:00
Harsh Singh be73856784 fix: log view lists no rows when a filter value cannot be read instead of every row (#8513) 2026-11-29 17:38:26 -05:00
Harsh Singh 9d806cf65b fix: IP addresses sort by their numbers in the Add Monitors table and the ONVIF probe list (#8563) 2026-11-29 17:38:09 -05:00
4359319064 fix: zms command thread waits instead of spinning when its comms are not open refs #7534 (#7535)
Co-authored-by: Isaac Connor <isaac@zoneminder.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:20:37 -05:00
Harsh Singh 1e4700b9dd fix: zmrecover reads the event id from mkv and webm videos in deep event directories (#7674) 2026-11-28 23:58:20 -05:00
Harsh Singh 1cd0289998 fix: stream ajax refuses a non-numeric VARPLAY rate instead of dying on it (#8476) 2026-11-28 23:57:47 -05:00
Harsh Singh d2474aaaa7 fix: API events search treats a list in a named parameter as a list of values instead of dying on it (#8480) 2026-11-28 23:57:20 -05:00
Harsh Singh a113f7fd28 fix: API monitor add and edit answer a validation error for a list Device on a Local monitor instead of a 500 (#8486) 2026-11-28 23:56:03 -05:00
Harsh Singh 457470ea4e fix: trigger ajax refuses a list for cause, text or showtext instead of writing Array (#8488) 2026-11-28 23:55:39 -05:00
Harsh Singh fc2bb717f1 fix: log delete by ids ignores a nested list instead of deleting log row 1 (#8490) 2026-11-28 18:35:25 -05:00
nicandClaude Opus 5.5 090c318186 fix: zmupdate.pl no longer prints "Too late to run INIT block" from ConfigData (#8504)
ZoneMinder::Config has loaded ZoneMinder::ConfigData with a run-time
require since 24a75775d (refs #5547). ConfigData set itself up in an
INIT block, and Perl skips INIT blocks of code compiled after the INIT
phase, printing "Too late to run INIT block at .../ConfigData.pm line
72." zmupdate.pl reaches that through syncConfigFlags() at the end of
every upgrade, and through saveConfigToDB() with -f.

The options were still set up, because loadConfigData() calls
initialiseConfig() itself after the require, so only the warning goes.
ConfigData now calls initialiseConfig() at the end of the module, which
runs whether it is loaded with use or require. initialiseConfig() returns
early on a second call, so loadConfigData()'s call does nothing new.

config_lazy_load.t checks that loading ConfigData at run time prints
no INIT warning.

fixes #8503

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 18:34:40 -05:00
IgorA100 3193568a45 Chore: Refining the translation for OPTIONS_WALL_CLOCK_TIMESTAMPS (#8505)
* Refining the translation for OPTIONS_WALL_CLOCK_TIMESTAMPS (ru_ru.php)

* Refining the translation for OPTIONS_WALL_CLOCK_TIMESTAMPS (en_gb.php)
2026-11-28 18:34:06 -05:00
Harsh Singh 561b3810ce fix: API states are keyed on Id so an Id in the body no longer renumbers the state or gives a 500 (#8484) 2026-11-28 12:13:25 -05:00
Harsh Singh 49c5febd64 fix: options menu delete and sort order ignore a nested list instead of using entry 1 (#8492) 2026-11-28 11:08:19 -05:00
Harsh Singh 6d000ec263 fix: group save ignores a nested list among the monitor ids instead of adding monitor 1 (#8494) 2026-11-28 11:06:26 -05:00
Harsh Singh 65730848df fix: API saves refuse null and an empty list for a NOT NULL column instead of a 500 (#8496) 2026-11-28 11:06:11 -05:00
Harsh Singh 949483246f fix: status ajax answers an error for a list as a requested element instead of a TypeError (#8500) 2026-11-28 11:05:43 -05:00
Harsh Singh ecb7533962 fix: watch view ignores a list as mid instead of opening monitor 1 (#8502) 2026-11-28 11:05:29 -05:00
Harsh Singh 8a107cfef3 fix: API tag add requires a Name (#8472) 2026-11-28 11:04:52 -05:00
Harsh Singh 7397e5f593 fix: API frame edit validates the values before it updates the row (#8474) 2026-11-28 11:04:27 -05:00
Harsh Singh 7b832e3666 fix: API filters write a list given with = or <> as IN or NOT IN instead of a 500 (#8478) 2026-11-28 11:04:11 -05:00
Harsh Singh 0983385d33 test: ai action save and delete tests stub what ai_class.php now calls (#8470) 2026-11-28 11:03:54 -05:00
Jash Ambaliya 69196f3ae7 feat: console Restart button restarts the selected monitors' capture daemons refs #8226 (#8227) 2026-11-28 10:52:11 -05:00
Harsh Singh 8df02cd791 fix: a control module posting a form no longer leaves the form fields in the camera base url (#7676) 2026-11-27 21:17:03 -05:00
fec0999425 feat: ONVIF event notes and tags from what the camera detected (#7712)
* feat: name what an ONVIF camera detected in the event note refs #7688

The ONVIF event note was the raw topic plus the value of the first Data
SimpleItem, e.g. "tns1:RuleEngine/MyRuleDetector/PeopleDetect/true".
parse_event_message() dropped every other item, the item names and the
Source Rule, so cameras that name the detection in an item (Tapo
IsPeople=true under a generic TPSmartEvent topic) or in a value (Ajax
ClassTypes="Human Vehicle") produced notes that did not say what was
detected.

parse_event_message() now also returns every Data SimpleItem and the
Source Rule, and ONVIFEventNote() builds the note from them with rules
that hold across vendors rather than a per-camera list:

- strip the namespace prefix of every topic segment (tns1:, tnsajax:)
- drop a leading RuleEngine/, the root of every analytics topic
- leave out items that are empty or inactive, by the same words
  interpret_alarm_value() uses for the alarm state, and per-object ids,
  which would otherwise add a note per object as notes only accumulate
- leave out the value of items that say active, and State/LogicalState
  items that say active
- add the Rule in parentheses when the camera names one

  Reolink  MyRuleDetector/PeopleDetect
  Tapo     TPSmartEventDetector/TPSmartEvent IsPeople (MyTPSmartEventDetectorRule)
  Ajax     ObjectDetection/Object ClassTypes=Human Vehicle (AjaxObjectRule)

The word lists that drive this sit together, so a camera with other
vocabulary is handled by extending them. The inactive words move from
interpret_alarm_value() into that shared list unchanged. A value found
outside the Data SimpleItems (ElementItem, fallback search) still goes in
the note, and a topic that reduces to nothing is used as it is.

Alarm on/off decisions, the value they use, ONVIF_Alarm_Text matching and
the alarms map keys are unchanged; a test pins interpret_alarm_value() to
its previous results. parse_event_message() and interpret_alarm_value()
are now static, as they use no member state, so they can be tested.

Notes change format: filters matching the old text (e.g. Notes LIKE
"tns1:RuleEngine" or "/true") need updating.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: link existing tags to events and stop logging new ones as errors refs #7688

Event::AddPacket_ tagged events from object detections, but when the tag
name was already in Tags it neither linked it to the event nor cached it,
and leaked the Tag that Tag::find returned. Only a tag name created for the
first time was ever linked, so detections of person, car, ... after the
first never reached Events_Tags.

Move the tagging into Event::AddTag, which finds or creates the tag, links
it once per event and caches it. A mutex guards the cache so the analysis
thread can tag the event too. Event_Tag::save uses INSERT IGNORE so a link
another writer made first (zm_detect via pyzm) is not an error, and
Tag::find returns nullptr without logging two errors when the name is not
there yet, which is how callers learn a tag is new.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat: tag events with the objects an ONVIF camera reports refs #7688

Add a per-monitor "Tag Events From ONVIF" checkbox (Monitors.ONVIF_Event_Tags,
off by default). When set, events raised by the ONVIF event listener are
tagged with what the camera detected, through the existing Tags and
Events_Tags tables.

ONVIFEventTags() reads the object from wherever the camera puts it, using
the items parse_event_message() already collects for the note: the topic
(Reolink PeopleDetect), an active item name without its "Is" (Tapo
IsPeople) or the classes in an item value (Ajax ClassTypes="Human
Vehicle"). Camera names map to the names object detection uses, so one tag
means one thing: person, vehicle, animal, package, face, and doorbell for
a Visitor press. An alarm that names no object (motion, tamper, line
crossing, an unknown detector) is tagged with its last topic segment, e.g.
MotionAlarm. The names are a table next to the note vocabulary; items are
judged by the same helper the note uses (inactive, per-object id, generic
state).

Each alarm entry keeps its tags beside its note, SetTagSet() returns them
as SetNoteSet() returns notes, including for a pulse that has already
cleared, and Monitor::Analyse() hands them to Event::AddTag().

Schema: zm_update-1.39.55.sql adds the column, zm_create.sql.in matches,
version 1.39.55. Web: checkbox and help text next to ONVIF Event Listener,
unticked default for the save action. Perl: Monitor field list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat: map camera object names to AI object classes for ONVIF tags refs #7688

ONVIF event tags were mapped from a word list compiled into zmc, so a
camera using another word for an object needed a code change. Move the
mapping into the database, on the object classes ZM already has.

- Add AI_Object_Classes.Aliases, a comma separated list of what cameras
  call the class, editable in Options, AI Classes.
- Seed aliases on the COCO person class and add a Camera dataset for
  the objects COCO has no class for: vehicle, animal, package, face and
  doorbell. Aliases already set are kept when the migration reruns.
- zmc loads the class names and aliases when the ONVIF listener starts
  on a monitor with ONVIF_Event_Tags set. A class name maps to itself,
  so a camera reporting Car is tagged car, as object detection would.
- Without the classes (an older database) alarms are tagged with their
  topic, as for an alarm that names no object.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: address review of the ONVIF event tags refs #7688

- Event::AddTag tries each name once per event, so a tag that can't be
  saved is not looked up and logged on every frame, and cuts names to
  the 64 characters of Tags.Name. It no longer holds tags_mutex_ over
  the database work, and the Events_Tags row goes through dbQueue, so
  the analysis thread waits on at most the tag lookup.
- Tag::save returns the existing Id when another process created the
  same tag first, instead of failing on the unique Name.
- Event_Tag::save ignores only the duplicate key, not other errors.
- An ONVIF message whose first state item is inactive and a later one
  active (Tapo IsVehicle=false, IsPeople=true) raises the alarm.
- The Is prefix of an item name is matched in any case.
- load_tag_names leaves the error to zmDbFetch, which has logged it.
- The help text says to restart the monitor after changing aliases.
- Re-indent two lines in ProcessPullResponse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat: restart ONVIF tagging monitors when an AI class changes refs #7688

zmc reads the object class names and aliases when it starts listening
for ONVIF events, so an alias saved in Options, AI Classes did nothing
until the monitor was restarted by hand. Saving or deleting a class now
restarts the zmc of each monitor with ONVIF_Event_Listener and
ONVIF_Event_Tags set, as saving zones does for their monitor.

Add the Aliases label to en_gb so it can be translated like the other
strings, and say in the help text that saving restarts those monitors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: address Copilot review of the ONVIF event tags refs #7688

- Only a later alarm-state item (IsX, State, Alarm, ...) overrides an
  inactive first one. A later ObjectId or Count describes the object,
  so IsInside=false followed by ObjectId=3 stays an alarm-off.
- 1 is true for a flag item such as IsPeople, as it already was for
  State, so IsPeople=1 is tagged person rather than the topic.
- Cut tag names at 64 UTF-8 characters, the size of Tags.Name, without
  splitting a character, using a new Utf8Truncate helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat: leave ONVIF detections out of the note when they are tagged refs #7688

With ONVIF_Event_Tags on, the tags already say what the camera
detected, and name the topic when no object is named, so the note
repeated them: "Motion: MyRuleDetector/PeopleDetect, ONVIF" next to a
person tag. Such a monitor's note now just says ONVIF. With tags off
the note still names the detection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat: edit AI class aliases as tags refs #7688

A plain text field gave no hint that aliases are a comma list. Edit
them like an event's tags instead, with the same tag styles: each alias
is a removable tag, and Enter, space or comma adds the one typed. They
are still saved as the comma list zmc reads, so nothing else changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: split ONVIF class values on commas and drop the DogCat alias refs #7688

A camera listing its classes as ClassTypes="Human,Vehicle" was tagged
with neither, as values were split on spaces only. Split on commas too.

Drop DogCat from the animal aliases: no camera is known to send it,
Reolink sends DogCatDetect. Say in the seed where the starter aliases
come from, which of them have been seen from a camera, and that more
are added in Options, AI Classes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat: give a new AI class the next free index and refuse a taken one refs #7688

A class's index is the number its dataset's model gives it, which a
dataset with no model behind it (Camera) has no use for, yet the form
required one and took any number, so a second class could get 0.

Leave the index empty on a new class to get the next one in its
dataset, and refuse an index another class of the dataset already has,
naming that class.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: number the placeholders of ClassIndexInUse so translations can reorder them refs #7688

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor: source the camera class seed from the 1.39.55 migration refs #7688

The migration carried a copy of db/camera_classes.sql, so the starter
aliases lived in two places. Make it a .sql.in that sources the seed
file, as zm_update-1.39.26.sql.in does with triggers.sql, so fresh
installs and upgrades share one copy. Note in the seed that it must
keep working on a 1.39.55 database.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Isaac Connor <isaac@zoneminder.com>
2026-11-27 21:11:06 -05:00