Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by jploch

  1. Hey @Robin S thanks for your advice! I think you are right, it's not really possible to protect against a malicious superuser account (e.g. If it got hacked). Since the code is saved as a string anyway, I don't think it would cause harm, even if there would be php or javascript code in the field right? But I feel better to use the hook you mentioned. Here is the code, wich works nicely: public function __construct() { $this->addHookBefore('InputfieldTextarea::processInput', $this, 'sanitizeValue'); } public function sanitizeValue(HookEvent $event) { $input = $event->arguments(0); $input->customStyles = strip_tags($input->customStyles, ''); $event->arguments(0, $input); }
  2. Hey folks, I am currently building a module where the user can input css code inside a InputfieldTextArea on the module configuration. Normally I would just let the user insert a path to a file, but in this case I want the user to be able to insert css code. I am outputting the value of the field like this: <style> <?= $this->sanitizer->purify($myModule->customStyles); ?> </style> How would you guys prevent malicious code getting saved to the database? Or is ProcessWire sanitizing the value automatically on save? (The module setting will only be available to superusers).
  3. I just stumbled across this post and wanted to share a very simple solution if you create a InputfieldTextArea with the API and want it to automatically resize based on the content: $f = $this('modules')->get('InputfieldTextArea'); $f->name = 'myText'; $f->label = 'Text'; $f->attr("oninput", "this.style.height = ''; this.style.height = this.scrollHeight +'px'"); // this line
  4. @horst sorry for the late reply. I Just updated the client server to php 8.0 and so far the new module version works great! Thx!
  5. I can replicate the install error with the configuration "utf8mb4". Using "utf8" with either "MyISAM" or "InnoDB" works for me. Deleting the line "COLLATE=utf8mb4_0900_ai_ci" in install.sql is not working for me. I will have to investigate further. For now please use "utf8" instead of "utf8mb4".
  6. @Andy Thanks for reporting back! I just pushed an update (0.8) which should fix the issue with the file uploader. The file uploader now respect the extensions setting of the corresponding file field and shows an allert for unsupported file types. By default the video file field that comes with the profile (pg_video) only allows the extension mp4 (See screenshot). But you can add webm here if you want.
  7. Hi @Gideon So Thanks! This will be fixed in the next version, you can ignore them for now, these errors should not break anything. This file is not needed anymore, I will remove the call for the next version. The rest of the errors are webpack related. I must have used the wrong build command, so should be an easy fix..
  8. Just updated the first post with a new preview video for the Style Panel feature. Let me know what you think.
  9. @alexm Sorry for that! Not sure what is causing this. Can you please redownload the files and try again (in your gumroad mail click "View content" and than the button "View content" on the product). Also make sure to unzip the folder first and than upload the content to the location were you want to install the profile. The profile already comes with the wire folder included so no need to include ProcessWire yourself.
  10. Thats a great concept! I have to think about this. You can also use a page reference field in a PAGEGRID block template to store a reference to a PAGEGRID item page. This allows you to render a PAGEGRID item on multiple pages (e.g. useful for headers or footers). If you change the content or styling of the referenced page it will update across your whole site.
  11. @MarkE More options/tools are always great. But there might be some overlapping between our modules, I will send you a test version and you can see for yourself. PAGEGRID is no longer limited to CSS grid, it also supports flexbox and most common CSS properties. It's like ProcessWire and webflow had a baby, but that baby is still very young ? Maybe this?
  12. The PAGEGRID beta will be released next week! If you want to help testing this module and try it yourself for free, please apply for the beta test.
  13. Dear beta testers, thanks for your help! PAGEGRID is now available here:
  14. @thausmann Thanks for your quick reply! This was very helpful! It seems like filePutContents works great, but you have to give it the full path: <?php //create ics file $icsgen = wire()->modules->IcsGenerator; $icsgen->set('date', '2033-12-24 12:00'); $icsgen->set('dateEnd', '2033-12-24 14:00'); $icsFileContent = $icsgen->getString(); $icsFilePath = wire()->config->paths->assets.'files/'.$page->id.'/event.ics'; // use full path to create the file $icsFileUrl = wire()->config->urls->assets.'files/'.$page->id.'/event.ics'; // use relativ url to set the link target wire()->files->filePutContents($icsFilePath, $icsFileContent); ?> <!-- Link to file --> <a href="<?= $icsFileUrl ?>">ICS File</a>
  15. Hi! This is exactly what I need for a project I am working on. But the module is not generating any files for me. Maybe I am doing something wrong? Here is my code (testet locally on laravel valet and on a shared hosting server): function icsLink() { $icsgen = wire()->modules->IcsGenerator; // set single properties (date strings) $icsgen->setArray(array( 'date' => '2033-12-24 12:00', 'dateEnd' => '2033-12-24 14:00', 'summary' => 'Event title', 'description' => 'Event description', )); $icsPath = $icsgen->getFile(); $out = '<a href="' . $icsPath . '">Merken</a>'; return $out; } The function returns the link successfully, but when I click the link I get a 404. While the link points to a file (site/assets/cache/WireTempDir/.icsgenerator/0/ics-1663226011-413791867.ics), it seems like the file is never created. Any ideas?
  16. Another thing with this module is, that it's not triggering a module resfreh automatically after installation. Depending on the module this can crash the installer at the last step. When I put this code in my template file it works (not a good fix): if ( !$modules->isInstalled('InputfieldPageGrid') ) { $modules->refresh(); } I also tried to put this code in the finish.php file inside the exportet site->install folder, but this seems to be called to late. @ryan can you please look into this, as I would like to share my site profile for my new module Iam working on. Would be awesome if this can be fixed, as others also seem to struggle with this.
  17. Thanks! @Jan Romero and @zoeck. Berhards hook worked for me! Nice! It doesn't really matter now, but this was not working somehow: $this->addHookAfter('ProcessPageAdd::processQuickAdd', function (HookEvent $event) { $page = $event->arguments(0); $page->removeStatus('statusTemp'); $page->save(); });
  18. Hey folks. I have set the familiy tab to only allow one template for chldren and also set the childNameFormat. Now the user can create a page in one step. However the new page is unpublished by default and the user needs to press the "publish" button to publish, wich is usually what you want. But for my usecase I want to force the client to allways publish without the need to press the button. Is there a way to auto publish the new page? I tried it with an after save hook, and the page is then published but has a strange flash icon and seems to be corrupted.
  19. @MarkE I just found out, that it's easy to create permissions that are template based. The permission name must start with "page-". After you check the box on a template "Mangage edit access" (screenshot above), it becomes selectable under Access->Roles->Yourrole. You just have to click on the little arrow to open the settings first. Nice!
  20. Is ist possible to make locked pages editable for superusers? If a page ist locked I want to prevent the client to edit it, but would like to make changes myselft without unlocking and then locking the page again.
  21. @MarkE It's a little complicated to explain ? I Am working on a pagebuilder module, that makes it possible to visualy compose a page. The page structure is defined by the items you add to your page. PageGrid creates a hidden page for every item that gets added to it (similar to how PageTable or Repeater Matrix work). Each item (a page) is based on a block template. A template can have multiple fields to hold your data (native ProcessWire templates and fields). Each item has an edit link that opens that page in an overlay, some fields also have inline edit capacity. Now I want to be able to have my own permissions beside page-edit to control if the edit link of that item is visible or not to certain users. The page-edit permission would enable inline editing (or editing in general) und my new permission would display the edit link. Hope that makes sense. I think this could also be achived with multiple roles, so if use has role "edit-items" and the page-edit permission for that item template it will display the edit link. But I was just curoius if I could create those template permissions myself.
  22. @MarkE Thanks for your answer. I was looking for a way to create a new permission that the user can than enable per template in the backend. But I don't think it's possible. See Screenshot:
  23. Hi folks, is it possible to add custom template permissions like page-edit, e.g. page-edit-mymodule? For a module I am buildinmg I want to be able to fine tune some functionalities on template level.
  24. @Jan Romero that made it clearer thanks! It looks like LoginRegisterPro could work well. It also handles the unsubscribe funtionality.
  25. this module is still a great time saver. Today I tried to use the feature to automatically load the script. But it's not working, even if I have the markup with the data-srcset rendered on the page. It's working if I load it manually.
  • Create New...