giterlizzi / dokuwiki-template-bootstrap3

Bootstrap-based template for DokuWiki
https://dokuwiki.org/template:bootstrap3
GNU General Public License v2.0
220 stars 77 forks source link

When viewing source code of read-only pages, button css classes are unexpectedly added to the source code text #578

Open erieeru opened 1 year ago

erieeru commented 1 year ago

Description

In tpl/bootstrap3/EventHandlers.php, the formEditOutput() function did not check whether findPositionByAttribute() returned a non-false value. So when viewing read-only pages, it adds the css classes for the "save", "preview", and "cancel" buttons to the textarea containing source code, as it is not aware that these buttons are not present.

This causes the source code text to display incorrectly with broken word wrap as it is shown with the button css styles.

To fix this: simply add if ($form->findPositionByAttribute('name', 'do[save]') !== false) (and two others alike) before adding classes.

Steps to reproduce

  1. Install bootstrap 3 template
  2. (Unsure of potential influence by other plugins, but should be unlikely)
  3. View any read-only page

Expected behavior: Source code to be displayed normally (for example)

Actual behavior: Source code shows with css classes for buttons

Versions

Screenshots or Logs

https://wiki.crescb.com/lib/exe/fetch.php?media=screenshot.jpg

Sample page or snippet

Could not provide one as my own page is already fixed.