WBCE / WBCE_CMS

Core package of WBCE CMS. This package includes the core and the default addons. Visit https://wbce.org (DE) or https://wbce-cms.org (EN) to learn more or to join the WBCE CMS community.
https://wbce-cms.org
GNU General Public License v2.0
31 stars 22 forks source link

script_js_sysvars variable URL overrides URL Constructor #520

Closed noelli closed 1 year ago

noelli commented 1 year ago

I am experiencing an Issue with the Javascript Variables added by class.wb.php and am trying to understand why they are necessary.

To be precise, the vars var URL = WB_URL = 'https://.....'; because URL overrides a default Constructor named URL.

I stumbled upon this while trying to use PDFjs on my website, which uses this constructor to load the PDF Files.

When removing the URL from class.wb.php everything works as expected: $sJsSysvars = "\t\tvar WB_URL = '" . WB_URL . "';";

Is this Variable used somewhere by WBCE or are there known Issues when removing it?

mrbaseman commented 1 year ago

I didn't find any place where this is used in the WBCE core or the modules shipped with the core distribution. However, it might be used by some of the modules... on the other hand WB:URL is widely used for this purpose...

instantflorian commented 1 year ago

URL as JS variable is/was needed by the old colorbox snippet, which was part of the core until 1.4.0. It is not automatically removed on updates and might still be installed. If the URL variable is not set, a JS error is thrown and other JS might stop working, so we decided to keep the (indeed too generic named) variable. You can remove URL (but not WB_URL) without issues if the colorbox snippet is not installed.

noelli commented 1 year ago

Okay, since this is a new installation and not even in production i'll remove it and make a note to check the PDF-Page after updating WBCE in the Future.