Marcel Stäheli
Members-
Posts
56 -
Joined
-
Last visited
Everything posted by Marcel Stäheli
-
PrivacyWire - Cookie Management & async external asset loading
Marcel Stäheli replied to joshua's topic in Modules/Plugins
Thank you for your reply. I had a look at the instructions in the comments of the module file and I'm afraid I dont know enough about modules or PHP to get it to work. I added the 4 module functions in step 2-5 to my template like this head: body: and commented them out in the module file. However I still get Notice: Undefined variable: nonce in \site\modules\PrivacyWire\PrivacyWire.module on line 108 What am I doing wrong? -
PrivacyWire - Cookie Management & async external asset loading
Marcel Stäheli replied to joshua's topic in Modules/Plugins
Hello I am using the great module PrivacyWire, it worked fine so far. However, a new website I am working on will use Content Security Policy (CSP) and this blocks the script created by PrivacyWire. The CSP for scripts looks like this: script-src 'self' https: 'unsafe-inline' 'nonce-" . $nonce . "' 'strict-dynamic; Every script tag needs the nonce value. It is created in the _init.php template and used by every page. How do I add the nonce to the script tag in the module? I found the part that writes it, but I don't know how to access the $nonce variable from the module. -
I finally figured it out. IIS uses a web.config file instead of a .htaccess file. In it there is the following code block: <denyUrlSequences> <add sequence="inc" /> <add sequence="info" /> <!--<add sequence="module" /> --> <add sequence="sh" /> <add sequence="sql" /> <add sequence="\..*" /> </denyUrlSequences> I commented out the info line, and the page loads as it should. I commented out the module line years ago, because I got an error when installing modules. I assume the other errors I got through the years were, because some page names contained one of these terms. This thread reminded me of it:
-
Sorry for the late reply. I did check for folders in the webroot. There are no folders with that name there, or in any other directory. Thanks for the suggestion though. I exported the site profile and installed it locally on my machine using XAMPP 3.2.2 and here the renamed page gets displayed without a problem. It could be an IIS database problem. But I don't know how to go about diagnosing it. Any ideas?
-
Hello I have a page where I need to change the page name (Settings-Tab -> Name). I can save the page with the new name but when I try to view it, I get an 404 server error (not a Processwire 404 error). I can change the page name to some other names and they work, but this particular one doesn't: The old name is "systemsicherheit" (system security) and I need to change it to "informationssicherheit" (information security). Variations of "informationssicherheit" also do not work. I had this problem before a few time going back to processwire 2.8 with PHP5. I also tried creating a new page, instead of renaming one. but with the same result: I can create the page just fine, but when I try to view it, I get an error. If i rename the same page to just, for exampl, "p" with the same content, it gets displayed. Right now, I'm using processwire 3.0.123 on IIS10 with PHP 7.2 I activated site->config.php->debug, but since it's a server error, it doesn't help. A similar renaming problem happened to me before a few times with images that I uploaded. After the upload it would just display a blank tile in the image field (but no error of any kind, the image was just empty). I exported the image in different formats, nothing helped. Then I changed the filename to just a.jpg and it worked fine. Could it be a some kind of general database error? I have no Idea.
-
[SOLVED] Console Error when uploading larger files
Marcel Stäheli replied to Marcel Stäheli's topic in General Support
That was it. The default max upload size of IIS10 is 28.3MB as stated here: https://stackoverflow.com/a/40085473 I followed the instructions on stackoverflow and manually edited the web.config-file and now the upload works. I also found instructions on how to change it using the IIS manager: https://www.inflectra.com/Support/KnowledgeBase/KB306.aspx (I haven't tried this method myself though) Thanks, I didn't know about those settings before. -
[SOLVED] Console Error when uploading larger files
Marcel Stäheli replied to Marcel Stäheli's topic in General Support
Thank you for your reply. I looked through these posts, but nothing helped so far. There are no errors in the PW-Logs. I run PHP 7.2.7 so there is no "always_populate_raw_post_data" Option to look for. It seems like an error on the client side. It happens in every browser. I had a look at the network tab, and it seems the request itself is corrupt already, it has a length of 73 compared to 741 with a successful upload (see screenshot). The response with the error upload is: The page was not displayed, because the request unit is too big. (Die Seite wurde nicht angezeigt, da die Anforderungseinheit zu groß ist.) -
Hello I had to increase the php-upload file size limit from the standard 2mb to 50mb to upload some pdfs (it's set to unlimited in PW). I edited the php.ini file accordingly. I can now upload files to a size of about 27mb but anything bigger doesn't work. The upload bar takes about 3 seconds to reach 100% and then stays there in Chrome, in Firefox it doesn't move at all. Both browsers throw a console error: Firefox: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON dataJqueryCore.js:2:13589 parseJSON jQuery q https://www.globalsystem.ch/wire/modules/Inputfield/InputfieldFile/InputfieldFile.min.js?v=125-1545384648:1 Chrome: Uncaught SyntaxError: Unexpected token D in JSON at position 0 at JSON.parse (<anonymous>) at Function.parseJSON (JqueryCore.js?v=1545384648:2) at XMLHttpRequest.<anonymous> (InputfieldFile.min.js?v=125-1545384648:1) It happens with other files too, I tested it with a couple .mp4-files. Since the uploads up to 27mb take about 2-3 seconds, i don't think it's a timeout problem. But just to be sure I massively increased some values in the php.ini: upload_max_filesize 600M post_max_size 700M max_input_time 90 memory_limit 800M Still the same errors with anything bigger than 27mb . Has anybody had these console errors before, when uploading files? I'm running PW 3.0.123 on IIS10
-
I just learned about this: https://github.com/DivineOmega/password_exposed This PHP package provides a password_exposed helper function, that uses the haveibeenpwned.com API to check if a password has been exposed in a data breach.
-
I have Parent-Pages that have Child-Pages. The parents function as an overview-page and store basic information that is used by all child pages. The child pages have some of the parents fields (in case the data differs from the parent) and additional fields that store child-specific data. Something like this: Parent "car-Overview": - field 1 maker (page reference-field) - field 2 description (textfield) - field 3 dimensions (multiplier-field) - field 4 image (image-field) Child "car-configuration": - field 2 description (overwrites value of parent->field 1) - field 4 image (overwrites value of parent->field 4) - field 5 maxSpeed (number-field) Now for easier manipulation I thought, when a user loads one of the child pages I create a new object that has all the fields from the parent, overwrites the data that is also present in the child-page and adds the new fields that only the child has. But I'm having major troubles with fields that are not just a number or text like multiplier-fields, image-fields and page reference-fields. How do you got about doing that?
-
[Solved] Looping through every field of a page
Marcel Stäheli replied to Marcel Stäheli's topic in General Support
Thanks using the term fieldgroup I also found it in the new doc http://processwire.com/api/ref/page/ under the advanced section. I didn't check that part, my bad. -
I have a car template that contains dozens of fields. The collection of cars is growing and now I have different configurations for the same car type. To save work and time I created a "general" car page for every car where I enter data that fits every car configuration. Both the general car page and the car configuration have the same template and identical fields. The idea is that for every car I start with the general page and if a field is empty I get the data from the corresponding car configuration field. Is there a way to loop through every field of a page? I don't want to write a compare function for every single field.
-
I found a solution. In case someone else has this problem in the future: One has to explicitly use an apache server for it to work. Processwire requires "mod_rewrite" which is not present in php build-in and it seems neither it is with IIS-express. So in the "project settings->server" choose "custom" as server and enter the project url. I used xampp to run the apache server and mysql database. Make sure xdebug is installed in the php-installation of xampp. Now php tools reads all PW variables and functions properly, no need for page() (still good to know that it exists).
-
We recently got the Visual Studio 2017 plugin PHP Tools for Visual Studio by Devense for php development. Unfortunately the plugin does not recognize processwire. I imported all website files into the PHP-Project so there is no file missing. But files are not being prepended, variables like $page are undefined. The plugin works fine with regular PHP code. I'm not sure where the error lies. Do I have to configure PW specifically or are the two simply incompatible? Has anybody experience with this plugin?
-
Selector operator *= does not always find a match
Marcel Stäheli replied to Marcel Stäheli's topic in General Support
I overlooked that part of the documentation somehow, sorry. Thanks for the help. -
I have a search-page that searches through pages using a search term with the selector operator *= . My problem is that sometimes it finds no results eventhough the term I'm looking for is clearly on several pages. It depends on the search term and I can't find no pattern when it finds something and when not. If instead of *= I use the operator %= it always find the results as expected with the same search term. so: body*=zoe finds no results body%=zoe finds every page why is that? What exactly is the difference between the two? The documentation just mentions that %= is slower. I'm running the site on PW 3.0.95, but I also tested it on 3.0.88 with the same behaviour.
-
Thank you for your input. I know about the checkbox, but I don't know what it does. Because my language selector code still listed the deactivated language. Also I could still load every page in that language. That's why I deleted it, to me the checkbox has no effect. I deactivated xdebug per your suggestion and tried to install the module tracyDebugger. But i get this error in PW: Failed to init module: TracyDebugger - Tracy\Debugger::dispatch() called after some output has been sent. Try Tracy\OutputDebugger to find where output started. And now, instead of the nesting level error, when I load a page I get this error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65488 bytes) in C:\xampp\htdocs\site15\wire\core\Functions.php on line 296
-
I've been working on a multi-language website using xampp. I was preparing the site to be uploaded and wanted to delete my temporary second language, since the site initially will only be in one language. But since I deleted the language I get this error on many pages of the website: Error: Maximum function nesting level of '250' reached, aborting! (line 653 of C:\xampp\htdocs\site15\wire\core\Functions.php) I'm aware that I can set the xdebug maximum nesting level. That's why it says 250, and not the standard 100. I had to increase it before, for something completly unrelated to this (as fas as I can tell) . I increased the value up to 1000 and still get the same error. Whem I add a new second language again, everything works fine. The deletion of the language breaks something. Does anybody have any idea?
-
"published" and "modified" always have the same value
Marcel Stäheli replied to Marcel Stäheli's topic in API & Templates
Thank you both for your reply. I tried it on a fresh installation of processwire and it worked fine as you stated. So it had to be something specific in my project. It couldn't be my templates, I never did anything with the modified and published values besides echoing them. So I had a look at my installed modules. And it turned out that some of them used those values. The module "batch child editor" had the most hits when I searched for the term "published" and after I uninstalled it and edited one of the articles, the two values were diffrent. So I assume something in that modules overwrites the published value every time I edit a page (I never edited those particular articles via that module). I either configurated it wrong (I haven't seen any option that could explain this behaviour though) or it is a bug in the module. I contacted the autor of the module, so he can check it out just in case. I will probably still add a custom date field to be more flexible, thanks for the input. -
I'm trying to create a news page. I ran into a problem with the sorting of the pages that are being displayed. I want to sort them by publishing date and it works, but whenever I edit one of the pages, the published and modified values get set to the new date and because of that the sorting order changes. Is this a bug? Do I have to activate something so the the publishing date stays unchanged?
-
Inputfield Repeater error after PW update to 2.8.35
Marcel Stäheli replied to Marcel Stäheli's topic in General Support
The problem was with that particular repeater field. It caused an error in the backend no matter on what page I tried to use it. I recreated the repeater-field with a new name using the same fields as before and populated it with the same content as before. Now it works. No idea what caused that error, I didn't find anything suspicious in the settings of that repeater field. -
Inputfield Repeater error after PW update to 2.8.35
Marcel Stäheli replied to Marcel Stäheli's topic in General Support
Thanks for your correction, I did not notice. I updated the site to PW 2.8.62 but the error persists, it is on line 222 now though. -
Inputfield Repeater error after PW update to 2.8.35
Marcel Stäheli posted a topic in General Support
Hello there I recently updated a website running PW 2.6.1 to PW 2.8.35. I followed the instructions and everything went fine. The website is being displayed as it should. However if I try to edit the home-page (ID=1) I get this error: Error: Call to a member function getInputfield() on null (line 204 of C:\inetpub\wwwroot\www.globalsystem.ch\wire\modules\Fieldtype\FieldtypeRepeater\InputfieldRepeater.module) the code in the file on that line is: /** * Determine if the request is one we should handle (internal) or one that another * script coming after this (external) will handle. * */ $internal = isset($_SERVER['HTTP_HOST']) && realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME']); if(!$internal) register_shutdown_function('ProcessWireExternalShutdown'); The site is running on IIS8. There is another page that uses a (diffrent) repeater field and it can be edited just fine. Is the error cause because the repeater is on the home-page? Any idea how to fix it?