Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ Document all changes in `CHANGELOG.md`; use descriptive commit messages referenc
## Internationalization (i18n)

- Translatable strings are managed with GNU gettext via `locales/build_gettext.sh`. `locales/po/cacti.pot` is the source template; Weblate owns syncing the per-language `.po`/`.mo` files from it.
- When a pull request adds or changes a string wrapped in `__()`/`__n()`/`__esc()`/`__x()`/`__xn()`/`__gettext()`, run `locales/build_gettext.sh` before pushing and add the resulting change to `locales/po/cacti.pot` only. Do not commit the regenerated per-language `.po`/`.mo` files in the same PR — Weblate takes care of the rest.
- **Never commit the per-language `.po` or compiled `.mo` files** (`locales/po/*.po`, `locales/LC_MESSAGES/*.mo`) in a plugin PR. Weblate is the sole owner of those catalogs, and regenerating them here produces spurious diffs and merge conflicts. `locales/po/cacti.pot` is the ONLY translation artifact a PR may add or modify.
- When a pull request adds or changes a string wrapped in `__()`/`__n()`/`__esc()`/`__x()`/`__xn()`/`__gettext()`, run `locales/build_gettext.sh` before pushing and stage `locales/po/cacti.pot` only. `build_gettext.sh` also rewrites the `.po`/`.mo` files as a side effect; revert those before committing (`git checkout -- locales/po/*.po locales/LC_MESSAGES`), or run only the `xgettext` step that targets `cacti.pot`.

## References

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

--- develop ---

* security: Add a version-safe CSP nonce (`plugin_flowview_csp_nonce()`) to every inline `<script>` tag so pages stay compatible with Cacti's Content-Security-Policy nonce enforcement, while falling back cleanly on older Cacti releases that lack the `CactiSecureHeaders` class
* chore: Harmonize CI workflow, issue/PR templates, and PHP-compatibility test structure with the shared Cacti plugin baseline
* issue#261: Cacti 1.2.x flowview 5.0 update of 16.09 error on call db_check_reconnect inside flow_capture
* issue#240: Call to db_table_exists is incorrect in some cases
Expand Down
6 changes: 3 additions & 3 deletions flowview_databases.php
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ function view_db_table($tab, &$tabs) {
</tr>
</table>
</form>
<script type='text/javascript'>
<script type='text/javascript' <?php print plugin_flowview_csp_nonce(); ?>>

var tab='<?php print $tab;?>';
var myTimer;
Expand Down Expand Up @@ -1331,7 +1331,7 @@ function view_dns_cache() {
</tr>
</table>
</form>
<script type='text/javascript'>
<script type='text/javascript' <?php print plugin_flowview_csp_nonce(); ?>>

function applyFilter() {
strURL = 'flowview_databases.php?header=false';
Expand Down Expand Up @@ -1626,7 +1626,7 @@ function view_routes($tab) {
</tr>
</table>
</form>
<script type='text/javascript'>
<script type='text/javascript' <?php print plugin_flowview_csp_nonce(); ?>>

var tab='<?php print $tab;?>';
var myTimer;
Expand Down
4 changes: 2 additions & 2 deletions flowview_devices.php
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ function edit_device() {
</tr>
</table>
</form>
<script type='text/javascript'>
<script type='text/javascript' <?php print plugin_flowview_csp_nonce(); ?>>
function applyFilter() {
strURL = 'flowview_devices.php?action=edit&id=<?php print get_filter_request_var('id'); ?>&tab=templates&header=false';
strURL += '&template=' + $('#template').val();
Expand Down Expand Up @@ -878,7 +878,7 @@ function show_devices () {
</tr>
</table>
</form>
<script type='text/javascript'>
<script type='text/javascript' <?php print plugin_flowview_csp_nonce(); ?>>
function applyFilter() {
strURL = 'flowview_devices.php?header=false';
strURL += '&filter='+escape($('#filter').val());
Expand Down
2 changes: 1 addition & 1 deletion flowview_filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ function show_filters() {
</tr>
</table>
</form>
<script type='text/javascript'>
<script type='text/javascript' <?php print plugin_flowview_csp_nonce(); ?>>
function applyFilter() {
strURL = 'flowview_filters.php?header=false';
strURL += '&filter='+escape($('#filter').val());
Expand Down
8 changes: 4 additions & 4 deletions flowview_schedules.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ function edit_log($header_label, $report) {
</tr>
</table>
</form>
<script type='text/javascript'>
<script type='text/javascript' <?php print plugin_flowview_csp_nonce(); ?>>
var id = '<?php print get_filter_request_var('id'); ?>';

function applyFilter() {
Expand Down Expand Up @@ -716,7 +716,7 @@ function clearFilter() {

?>
<div id='reportDiv'></div>
<script type='text/javascript'>
<script type='text/javascript' <?php print plugin_flowview_csp_nonce(); ?>>
var log_id='<?php print get_filter_request_var('id'); ?>';

function exportLog() {
Expand Down Expand Up @@ -762,7 +762,7 @@ function edit_general($header_label, $report) {
html_end_box();

?>
<script type='text/javascript'>
<script type='text/javascript' <?php print plugin_flowview_csp_nonce(); ?>>
var startOpen = false;

$(function() {
Expand Down Expand Up @@ -877,7 +877,7 @@ function show_schedules() {
</tr>
</table>
</form>
<script type='text/javascript'>
<script type='text/javascript' <?php print plugin_flowview_csp_nonce(); ?>>
function applyFilter() {
strURL = 'flowview_schedules.php?header=false';
strURL += '&filter='+escape($('#filter').val());
Expand Down
4 changes: 2 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function edit_filter() {
form_save_button($page, 'return');

?>
<script type='text/javascript'>
<script type='text/javascript' <?php print plugin_flowview_csp_nonce(); ?>>
var date1Open = false;
var date2Open = false;
var returnPage = '<?php print $page;?>';
Expand Down Expand Up @@ -1001,7 +1001,7 @@ function flowview_display_filter() {
</td>
</tr>
<tr><td>
<script type='text/javascript'>
<script type='text/javascript' <?php print plugin_flowview_csp_nonce(); ?>>

var height = $(window).height() - 200;
var date1Open = false;
Expand Down
Loading
Loading