-
Posts
1,302 -
Joined
-
Last visited
-
Days Won
16
Everything posted by elabx
-
They way I've sort of done this is with New Relic, you install agents for php/apache/mysql in the server and does it's magic to monitor the relevant processes. And I say "sort of done this" is because I didn't really plan for anything, just wanted to test it out and got easily overwhelmed by all the features it has and concepts I don't really understand. I did manage to get alerts on spikes in memory and load, but that's about it and I'd say thats like 0.01% of what newrelic does, but kinda solved what I needed at that moment.
-
Hi @Focksbot! It would depend on how your site is rendering it's frontend output. Check output strategies. From most common to less common is: Direct output Delayed output Markup regions So first I'd check if there exists a home.php file in /site/templates and start from there to see if direct output is implemented. Also if you read the docs above its a good place to start too. If you still feel lost, maybe a screenshot of how your filesystem looks would help too, to see the organization of the template files. But almost 100% sure that what you're looking for is in /site/templates This is sort of ProcessWire's blessing and curse (for people unfamiliar with ProcessWire) as it doesn't have an output strategy tightly coupled with a specific set of data such as posts/pages like in Wordpress, in ProcessWire those would have to be built with templates/fields and eventually Page(s), the main building blocks of data in ProcessWire.
-
(Pretty) easy A+ Content Security Policy (CSP) for Processwire
elabx replied to Chris Bennett's topic in Tutorials
It's not exactly the same technique, but I have just got into this rabbit hole and after a bit of blood sweat and tears and help from a pal, this is working for me while using ProCache and using the nonce attribute on scripts. This configuration assumes you have mod_substitute and mod_cspnonce installed. <If "%{THE_REQUEST} !~ m# /processwire/?#"> Options +Includes AddOutputFilterByType SUBSTITUTE;INCLUDES text/html Substitute "s|--CSP-NONCE--|<!--#echo var=\"CSP_NONCE\" -->|i" # Customize to your needs Header add Content-Security-Policy "default-src 'self' 'nonce-%{CSP_NONCE}e'; </If> Place this at the end of the ProcessWire htaccess directives. This should swap on the fly the Apache response and replace any --CSP-NONCE-- script. Then on Apache you can also set the nonce headers like this: I do not use this because my server setup uses nginx as reverse proxy. For example: <script nonce="--CSP-NONCE--" src="https://totally-safe-website.com"></script> Will end up as: <!-- nonce swapped on every request! --> <script nonce="0O4I3O5nNFG/MVpqormzyIuH" src="https://totally-safe-website.com"></script> @ryan fyi In theory, this would be A LOT simpler in Apache 2.5, since you could put an expression within the Substitute directive instead of the server side includes to substitute the "--CSP-NONCE--" script, but right now I'm limited to Apache 2.4 in the setup where I need this since I don't have control of the stack versions. So this should work in Apache 2.4+- 7 replies
-
- 5
-
- content security policy
- csp
-
(and 3 more)
Tagged with:
-
Try pushing the max_input_vars value in the server.
-
That json parse error should have the info we need to know, it's probably appendind/prepending an error message and that's why the JSON.parse on the response. If you can get to the plain text response, let me know what it's got.
-
Hi @virtualgadjo! Is there any info on your logs? Are the ajax requests involving file upload returning anything at all or what status code?
-
It seems this got updated in the last few versions: Check this thread: https://github.com/processwire/processwire-issues/issues/1791 And also this commit which has new $config options: https://github.com/processwire/processwire/commit/013231acdabd7b42640c1a9975c9e54ecf366b45
- 1 reply
-
- 1
-
@ryan Out of curiosity, and of it's possible to share publicly, were you working in something in particular in the PW admin where you needed to add custom attributes?
-
How to structure Blog Posts, Categories, and Tags
elabx replied to ryangorley's topic in Getting Started
Hi @ryangorley! Not sure if you've taken at this old but still very relevant post: I'd say the best way is the one that fits your use case and in that sense ProcessWire has no rules about categorization. The tags can exist under their own parent separate from the "News > Blog Item 1" tree branch: /tags/tag-1 And be linked through the tags inputfield, it's pretty much the same case for categories. To my own personal taste I always tend to go with an structure like this: - ? News -- ? Tags ---- ? Tag 1 ---- ? Tag 2 -- ? Categories ---- ? Category 1 ---- ? Category 2 -- ? News Item 1 -- ? News Item 2 I like this because it keeps everything in the context of the "News" for the editors, and also the following URL structures which makes sense to me (not so sure about SEO but have had no complaints lol): /news/tags/tag-1 /news/categories/category-1 /news/news-item-1 The only part I'm not a huge fan of is that it requires a bit of code using hooks to keep the right sort underneath the "News" page, since the actual news items share a parent with the tag/categories parent, sorting the News children by published reversed, will (most likely) send the Tags and Categories to the bottom. But it ain't that big of a deal and if the problem arises to you I'll gladly share my solution. Also, to my own taste, I use a custom field for publish date, this lets me have more control over it and handle the visibility of the actual post with the hidden/unpublished status depending on what I want to achieve. Now for archive pages i'd suggest you take a look at what @ryan did in this old but also still relevant blog profile: https://github.com/ryancramerdesign/BlogProfile/blob/master/site-blog/templates/archives.php In all fairness this is not the clearest example and it's one of those part you'd expect to be built by default in a CMS, but I always think these details are worth the effort as a sacrifice for the flexibility PW gives you in terms of data structure/relation. -
Maybe this part should be: $form = $forms->render('kontakt', [ 'form_page' => $page->parent->title . " " . $page->title , 'page_with_contact_email' => $page->parent("contact_email!="); ]); So this part: $page->parent("contact_email!="); Should traverse upwards from the page where the form is rendering until it finds a page with the contact_email fileld.
-
My _init.php file is running multiple times (Regions?)
elabx replied to Jim Bailie's topic in General Support
Do you have the regions configuration set to true?? In site/config.php $config->useMarkupRegions = true; -
Stripe payment action for FormBuilder not working fine
elabx replied to Mohit's topic in Module/Plugin Development
Aha! gotcha! Do you mean the Stripe webhooks part or how FormBuilder handles the process? -
Stripe payment action for FormBuilder not working fine
elabx replied to Mohit's topic in Module/Plugin Development
Could you debug if the webhooks are correctly setup and working?? It's the first thing I'd think of, if i remember correctly, the entries will only show on successful payment. -
REST API without any modules or frameworks (pure ProcessWire)
elabx replied to Jonathan Lahijani's topic in API & Templates
About URL hooks Not sure it has change but once happened to me that I couldn't do optional segments, example: /get-images/{page}/{field}/ Request wouldn't reach if I tried to get to: /get-images/{page}/ Then I think the concept of middleware is not present? So say you want to block unauthenticated calls, check CSRF, etc, you'd have to make that check on every route hook. Probably AppApi is still the way to go, feature wise? Project seems very alive! Edit: Just reading AppApi actually uses path hooks to bootstrap its endpoints. -
Ok so the second part of the code, in the template needs a hook to actually work! If you debug $processor variable, it is most likely null! So, in the head.php set this up: <?php wire()->addHookBefore("FormBuilderProcessor::emailFormReady",function($e){ /** @var InputfieldForm **/ $form = $e->arguments(0); /** @var FormBuilderEmail **/ $email = $e->arguments(1); // is this the form where we want to change the behaviour? if($form->name !== "the_form_in_question") return; $page_id = $form->getChildByName('page_with_contact_email'); if($page_id){ $page_with_contact_email = wire('pages')->get($page_id); if($page_with_contact_email->id){ $email->to = $page_with_contact_email->contact_email; } } // Not really sure if this is necessary so try putting it on and off $event->arguments(1, $email); }) $form = $forms->render('kontakt', [ 'form_page' => $page->parent->title . " " . $page->title , 'page_with_contact_email' => $page->parent->id ]); The hook code is a bit different from the previous one I posted since I realised that the contact_ Then on your template: echo $form; Let me know how it goes!
-
Should we refactor the main RockMigrations.module.php
elabx replied to Ivan Gretsky's topic in RockMigrations
Me neither haha just thought it would be the most simple way to extend RocKMigrations. Install the plugin module and just assume now you can do this in migration code: $rm = $modules->get('RockMigrations'); $rm->migrate([...]); $rm->fooPluginNewMethod(); -
Should we refactor the main RockMigrations.module.php
elabx replied to Ivan Gretsky's topic in RockMigrations
Like this: https://processwire.com/docs/modules/hooks/#how-can-i-add-a-new-method-via-a-hook I just feel it might make sense for it to be decoupled like because @bernhard might not use some modules and would probably be better if the "migration utilities" of modules he doesn't use are maintained on the side. This comment was targeted more at a thought of a "plugin system". -
Should we refactor the main RockMigrations.module.php
elabx replied to Ivan Gretsky's topic in RockMigrations
Wouldn't it be enough to add methods to the class through hooks?? And have like: RockMigrationsProfieldsUtilities, instead of refactoring the main module? -
Hi @brandy! Could I take a look at a complete version of the hook code you are trying? If you feel like sharing the whole project with me you can DM me and maybe we'll sort it out with the real install.
-
Maybe this is a PHP version compatibility issue? Does the OVH version matches your development environment version?
-
Oh I see! I guess that could work! Did you try?? I hadn't noticed that property was set on the Processor object.
-
PW 3.0.228 – Core updates and Pro module updates
elabx replied to ryan's topic in News & Announcements
Thanks crew for jumping in! I know this situation is really really odd and I want to dive into what might be happening because I reproduced the same behaviour in live and on my local ddev environment. And went back and forth between 3.0.215 and 3.0.228 to confirm, it also caused issues in other parts where certain results where expected, so I'll dig in those too. Actually the issue is with 3.0228! Is this the moment where I learn not to upodate/deploy on friday? haha Will definitely do some detective work and come back to report. -
PW 3.0.228 – Core updates and Pro module updates
elabx replied to ryan's topic in News & Announcements
Is anyone having issues with selectors on the last few updates? I just had to rollback a big site which was showing issues in multiple parts. Unfortunately I don't have time right to make a clean install to reproduce the scenarios but just wanted to communicate in case someone else is having issues. For instance, I have this selector: 'template=ad, parent=1082, ad_status=1, sort=-verified, sort=-created, city_id|cities=11669,created_users_id!=41,title!=test|Test' Which worked just fine, but when updated the same find operation returned 0 pages found. I was able to debug this because the title field in the selector was only used with guest users so that the admin users copuld see these Test pages created, but guests do not. I had to change the selector to the following to make it work again: 'template=ad, parent=1082, ad_status=1, sort=-verified, sort=-created, city_id|cities=11669,created_users_id!=41' Notice that I removed: title!=test|Test So you can imagine my confused face on how would this cause an issue to not find any page at all. The site is on 3.0.215 and and important detail might be that it is using multilanguage. -
[SOLVED] Translation not show up in textinputfield
elabx replied to Angelino's topic in Multi-Language Support
I think this might be related to: https://github.com/processwire/processwire-issues/issues/1611 And it should be solved at least from 3.0.204 onward.