Jump to content

flydev

Members
  • Posts

    1,360
  • Joined

  • Last visited

  • Days Won

    49

Everything posted by flydev

  1. I also delegate this task to gulp v4 (and I am far to be a gulp guru). Basically, each process is divided in tasks, some to clean, minify and/or obfuscate. The final task is : gulp.task('build', gulp.series('clean-dist', gulp.series('minify-fontello', 'minify-css', 'minify-css-login', 'vendors-js', 'vendors-css', 'minify-js-login', 'minify-js-main', 'hash', 'main-tpl-css', 'main-tpl-js'))); The best tasks are 'hash', 'main-tpl-css' and 'main-tpl-js'. The 'hash' task generate filename with this pattern : {name}.{hash}.{size}{ext} and the last two tasks automatically parse the _main.tpl (_main.php in the intermediate site-profile) and replace the existing css/js call with the newly generated files : <html> <head></head> <body> [...] echo "<script id='main' src='{$assets_url}dist/mywebsite.main.min.7defab4250a4d9009987b26c8f68d50b.1337.js'></script>\n"; [...] </body> </html> If someone is interested I can paste the gulpfile.js here.
  2. Just an idea, is mysqli extension enabled ? Also, on your newly upgraded server, you could run the ProcessWire installer to check if everything required is installed. If you are tired, you can run the first step of the standalone Duplicator installer. You can delete folders in sites/assets, just keep the file and session folders, and empty the session folder manually.
  3. Another way if you would like to load arbitrary JavaScript file in your module is : Define an array with the files defined in it : protected $jsfiles = array( 'js/MyScript.js' ); Then in ready(), write : foreach ($this->jsfiles as $jsfile) { $this->config->scripts->add($this->config->urls->MyModule . $jsfile); } And, the question "Why my JS file are loaded before Jquery ? Should I call my script in init(), ready() or execute() ? @ryan answer :
  4. Ok guys, I get what you mean, so what about a module with this flow ? monitor and log HTTP error code for a period if an entry / request is superior of N then backup .htaccess file (versioning it) add new entries to the .htaccess file Does it make sense or I should let the user manage their .htaccess file manually with a FAQ or something ?
  5. hi try : $mail = WireMail(); $mail->header('Reply-To', 'foobar@example.com'); [...] https://processwire.com/api/ref/wire-mail/
  6. I was also thinking to add a new feature from where we could monitor 302/404 HTTP code and redirect the "guest" into the blackhole. For example, all those try : /phpMyAdmin/scripts/_setup.php /w00tw00t.at.ISC.SANS.DFind:) /blog/wp-login.php /wp-login.php etc. will be banned. I still don't know if I code all the feature or if I should hook into Jumplinks from @Mike Rockett.
  7. Hi @Juergen I completely agree. Even better, there will be a Process module to manage/view the blackhole data.
  8. You can simply do this : Form submit => POST request => verify($input->name, $input->email); Then in the verify function, you parse the name and check if it already exist in your system. If it exist, your return an error, else you create an new entry. Which difficulty are you encountering ?
  9. @Peter Knight this issue is known and fixed in the next version. The cause is that the ProcessModule try to load the log file but the file does not exist (the file is created on the first backup).
  10. Try to make a pw module for it ? ? I read their login widget page and I like the idea behind the bots ? Could be something pretty cool, and a cool use-case could be re-transmitting the live logs of the LoginHistory module from @teppo trough a telegram bot. Really it's exciting! If you wanna start it, I will be glad to help you !
  11. This message just to let people knowing that Google Invisible ReCaptcha is implemented and can be used in your form by checking the right feature in the module's options without modifying any code line. Now your beautiful formular design won't "break"
  12. from @Robin S $this->addHookAfter('FieldtypeRepeater::wakeupValue', function($event) { $field = $event->arguments('field'); if($field->name !== 'myrepeater') return; // repeater field name $pa = $event->return; $pa->sort("-created"); // or whatever sort you want $event->return = $pa; }); Will return : 2018 2017 2016 ...
  13. Okay, thanks @kongondo, you put me on the right track. The zip file can be extracted on Windows and Unix, but the "extension feature" doesn't work. Will find a workaround. Thanks again
  14. Yes, but there is a feature to exclude files by extension - not tested a wildcard in the core function - which can't work "as is" with this function. Maybe I should return an array of all files (from an extension provided) and passing this array to the function. This should work.
  15. yes, and I know I can exclude files directly in WireZipFile() but I can't apply a filter on the iterator. Now, writing this post, I have an idea which could work.
  16. Thanks @kongondo, from what I remember, the main reason I didn't used this function is because it doesn't work with the exclude feature. Maybe I am wrong, I will look more closer at the function's code.
  17. So, after multiple tries to code a function which could zip a folder and could lead to be extracted on both platforms (win/unix) failed. The function I built (which I think can work on both platforms) lead to a ZipArchive error: NO ERROR on Windows and thus the zip file is not finalized ?? it irks me, if someone has a function which work on both platform please post it here ✌️
  18. Hi and welcome, In the following thread you can also find 3 nice videos to get started :
  19. Just a small idea as I didn't understood all the post but it sound like something I have done recently. Access to the admin, with roles and permission set correctly, there is no issue (from my point of view). But, if you are giving them only the right to edit a page / their profile, I would build a frontend form and a module, but the job can be done in the backend easily too - if this is what you want- with a ProcessModule without the need to give the user the right to access the page tree/tabs or the rest of the backend. What I mean is, when the user log in to the backend, they will only see a form to edit their page and the profile menu; The rest is "blocked"/"denied"/"not visible". Anyway, you can keep the things simple, for the profile, you could just use the LoginRegister module. Add a page reference field to the User system template and be sure to remove this field from the editable fields list in the module configuration. The page reference field will be filled on the user creation with the page id created at the same time as the new user. Then to edit the page, just loop trough the fields of the page, pulling out the "confidential" fields and build a frontend form which will update the page associated with the user. How/when the user are created ? Who create them ? If it is on self-registration, its even more simpler and everything could be done by hooking the LoginRegister module for assigning the roles and creating the user associated page. Why ? When you will have more technical details, ping me on the forum :).
  20. Hi, check the doc : https://processwire.com/api/ref/pagefile/ https://processwire.com/api/ref/pagefile/url/ Your link markup should be something like that : <a href="{$page->myfilesfield->first->url}" download>download</a> A tutorial :
  21. Hi, As far as your webserver has write permission on a given folder outside the web directory, you can write your logic in a module which handle your upload thing - everything is possible inside ProcessWire. I personnaly would go with pages. Make a parent page "newsletters-upload" in your page tree then create a child page for each "year", then create a child page inside "year" for each uploaded newsletter. Each newsletter page have a fieldtype-secure-file field which give you the possibility to store your uploaded files outside the webfolder. In the process module, the author could create/select a "year" page (folder) and upload file by drag&drop in the admin. You can also pull files from an FTP server where authors create their folder tree, then do the logic in the module. This is just an idea from what I understand, more details needed ?
  22. Good and funny ! For example, on the site I deployed the module, it is a custom dashboard with sensible informations, I had to take care of hand crafted request which could retrieve data from other users. When this behavior is detected, the user is logged out, the role login-disabled is assigned and then the user is redirected into the blackhole to be banned. public function SecureParks() { if($this->input->post->park) { $ids = explode('-', $this->sanitizer->pageName($this->input->post->park)); $userroles = $this->getParkRoles(); $userhaveright = $this->searchForParkId($ids[2], $userroles); if ($userhaveright === null) { $this->user->addRole('login-disabled'); $this->user->save(); $this->session->logout(); $this->session->redirect($this->pages->get('/blackhole/')->url); // :) } } }
  23. I will try to do it, I never played with modules and multilanguage
  24. Module updated to version 1.0.2. The Whois information request is triggered accordingly to the module's option Thanks for the bug report @Juergen
  25. Hi everyone, [edit: do not loose your time reading this post, I solved it by disabling cache in the Pages2Pdf module... sorry ?] I do not know if I should post on the Pages2Pdf thread or here. Mods, feel free to move the post. Since three days I am scratching my head to understand a weird thing happening with $session and $config->debug used in conjunction with Pages2Pdf module. For information, I tested it on a fresh install of ProcessWire 3.0.96 with PHP-7.0.28 and Pages2Pdf-1.1.7 (domain: http://session.sites.sek/). I will try to explain what is going on. What I am trying to achieve : In a template, I need to set some sessions variables which are then echo'd in the PDF document. (on the test installation, the basic-page template (page /about/?pages2pdf) serve the PDF, the home and sitemap template set the session variable.) The problem : From the template sitemap, I set a variable: $session->setFor('pdf', 'myvar', 'Session set from Sitemap template'); From the template home, I set a variable: $session->setFor('pdf', 'myvar', 'Session set from Home template'); Then in the PDF default template, I echo the session variable: <p>Session: <?= $session->getFor('pdf', 'myvar'); ?></p> Now I turn ON debug mode ($config->debug = true) : Then I navigate to "http://session.sites.sek/home/" and the session variable "myvar" is set to "Session set from Home template". Then I navigate to "http://session.sites.sek/sitemap/" and the session variable "myvar" is set to "Session set from Sitemap template". Now I want my PDF document, so I navigate to "http://session.sites.sek/about/?pages2pdf=1" and I get my PDF document with the right session var : "Session set from Sitemap template" For the moment, nothing special happen. Everything work great. We are in debug mode. Now I turn OFF debug mode ($config->debug = false) : Then I navigate to "http://session.sites.sek/home/" and the session variable "myvar" is set to "Session set from Home template". Then I navigate to "http://session.sites.sek/sitemap/" and the session variable "myvar" is set to "Session set from Sitemap template". Then I navigate back to "http://session.sites.sek/home/" and the session variable "myvar" is set back to "Session set from Home template". Now I want my PDF document - as expected, the "myvar" should be set to "Session set from Home template" - so I navigate to "http://session.sites.sek/about/?pages2pdf=1" and here the problem happen. Instead of echoing "Session set from Home template" in the PDF document, the phrase "Session set from sitemap" is echo'd (the last value recorded before switching from debug ON). I made two small screencasts to show the issue : DEBUG ON (Everything is OK) DEBUG OFF I am missing something ? EDIT: YES, you are dumb! Why it is working with debug mode ON and not vice-versa ? Is there someone who already spotted this strange behavior ? Is there a PHP settings which should be modified ? ==================================================== Edit: I needed to post just to figure myself that Pages2Pdf cache the document when $config->debug is false. ???
×
×
  • Create New...