gebeer

Members
  • Content count

    720
  • Joined

  • Last visited

  • Days Won

    6

gebeer last won the day on January 2

gebeer had the most liked content!

Community Reputation

626 Excellent

About gebeer

  • Rank
    Distinguished Member

Profile Information

  • Gender
    Male
  • Location
    Thailand/Germany

Recent Profile Visitors

7,113 profile views
  1. Hello, having the same problem as described by @Ivan Gretsky. Inside a namespaced module I have this method with a try catch block: public function addJson($pages, $filename) { $tmpPath = $this->files->tempDir('json'); try { $start = microtime(true); $jsondata = $this->getGeoJsonCollection($pages); $time = microtime(true) - $start; va_dump($time); // Note the intentional typo $filePath = $tmpPath . $filename; if($tmpPath && $jsondata) { //write json data into geojson.json file if(file_put_contents($filePath, $jsondata)) { $jsonPage = $this->jsonPage; $jsonPage->of(false); $file = $jsonPage->jsonfiles->getFile($filename); if($file) $jsonPage->jsonfiles->remove($file); $jsonPage->save(); $jsonPage->jsonfiles->add($filePath); $jsonPage->save(); if(!unlink($filePath)) $this->message("Error deleting temporary $filePath"); $this->message("$filename created and saved"); $this->log->save('json', "$filename created in $time seconds and saved"); return true; } else{ return false; } } } catch (\Exception $e) { $this->log->save('json', $e->getMessage()); } } I'm calling the module via command line from a worker php script that bootstraps PW. I get this ouput from my script and nothing logged to my custom json.text log file: PHP Fatal error: Call to undefined function ProcessWire\va_dump() in /var/www/uhtinew.dev/site/modules/SaveJson/SaveJson.module on line 208 Fatal error: Call to undefined function ProcessWire\va_dump() in /var/www/uhtinew.dev/site/modules/SaveJson/SaveJson.module on line 208 Error: Call to undefined function ProcessWire\va_dump() (line 208 of /var/www/uhtinew.dev/site/modules/SaveJson/SaveJson.module) This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged. So it seems that WireException is catching this before my try catch.
  2. @BitPoet Thank you very much for the heads-up. Also to @Robin S. I finally ended up with this hook function in a module context which does exactly what I need, also in ajax mode: $this->addHookAfter('Field::getInputfield', $this, "lockConfirmedItems"); public function lockConfirmedItems(HookEvent $event) { if($this->user->isSuperuser() || $this->user->hasRole('certificationadmin')) return; $thisPage = wire('page'); // // Only run our locking logic if we are editing a user in the backend if($thisPage->process != "ProcessUser") return; $repeaterPage = $event->arguments(0); $context = $event->arguments(1); if($context != "_repeater" . $repeaterPage->id) return; if(!$repeaterPage->confirmed) return; $event->return->collapsed = 7; } Setting collapsed with the Inputfield constants like in BitPoet's code didn't work for me.
  3. Hello, I would like to prevent future editing of a repeater item once a checkbox in the repeater item has been checked. Either the form inputs of the repeater item should be read only or only the field values should be rendered. Looking at the module code I can't seem to figure out where to hook for that functionality. Any ideas would be much appreciated.
  4. @Pierre-Luc is there still no way to get feedback on success/errors when sending through the Mailgun API? I would like to build a Lister(Pro) Action around your module and for that I would like to show results after sending. Something like $mail->getResult(); in WireMailSMTP. EDIT: Guess I would need to use Mailgun Events for tracking emails. Right?
  5. Thank you for your suggestions. It is not that many mails, maybe a total of 100 a day and max 10-30 per hour. So I will stay with Gmail for the time being.
  6. @flydev That info is enlightening. Thank you! So I would have to extend the WireMailSmtp module to get that functionality, right? @horst
  7. I am experiencing problems when sending through Gmail on a site that is sending out quite a lot of emails to different recipients. It used to work for about a month and now suddenly Google is blocking my app. It seems that Google regards the app as less secure. I am wondering if someone has had similar issues with Gmail? I know there is a setting in Gmail to allow less secure apps. But I would like to know why Google thinks the app is less secure. Does it have something to do with headers being sent by WireMail that Google disqualifies as insecure? Here is the data array from the WireMailSmtp object (sensitive data has been replaced by xxx): default_charset => "UTF-8" (5) localhost => "dev.xxxtors.com" (31) smtp_host => "smtp.gmail.com" (14) smtp_port => 587 smtp_ssl => "" smtp_start_tls => 1 smtp_user => "info@xxxtors.com" (32) smtp_password => "xxx" (11) smtp_password2 => "" clear_smtp_password => "" realm => "" workstation => "" authentication_mechanism => "" smtp_debug => 0 smtp_html_debug => 0 sender_name => "xxx" (24) sender_email => "info@xxxtors.com" (32) sender_reply => "" sender_errors_to => "" sender_signature => "" sender_signature_html => "" send_sender_signature => "1" extra_headers => "" valid_recipients => "" smtp_certificate => "" And here the mail object data to => array (2) "xxx@gmail.com" => "xxx@gmail.com" (26) "xxx@mailbox.org" => "xxx@mailbox.org" (28) toName => array (2) "xxx@gmail.com" => "" "xxx@mailbox.org" => "" cc => array () ccName => array () bcc => array () from => "info@xxxtors.com" (32) fromName => "xxx" (24) priority => "" dispositionNotification => "" subject => "xxx" (51) body => "This is an automatically created email. Please do not reply. xxx" (139) bodyHTML => "xxx" (183) addSignature => NULL attachments => array () header => array (1) "X-Mailer" => "ProcessWire/WireMailSmtp" (24) sendSingle => FALSE sendBulk => FALSE useSentLog => FALSE wrapText => FALSE Does anyone have an idea why Gmail thinks these mails are less secure?
  8. Hi, I had the same situation as the OP described: URL sent by email to go to a specific page after login. I solved it with 2 small hooks that I added to a module. You could also add them to your admin.php or ready.php My URL looks like .../?member=1222 where 1222 is the id of a user 1. hook adds a session variable before Login $this->addHookBefore('ProcessLogin::execute', $this, 'setRedirectId'); public function setRedirectId(HookEvent $event) { if($this->input->get('member')) { $this->session->set('goToMember', $this->sanitizer->int($this->input->get('member')); } } 2. hook has the redirect logic and removes the session variable $this->addHookAfter('Session::login', $this, 'loginRedirects'); public function loginRedirects(HookEvent $event) { if($this->user->hasRole('certificationadmin') && $this->session->get('goToMember')) { $member = $this->pages->get($this->session->get('goToMember')); if($member && $member->id) { $this->session->remove('goToMember'); $this->session->redirect($member->statusPageUrl); // statusPageUrl is a custom property for users that I added via another hook } } }
  9. The problem in my case is that this project will have more than 2000 users that will logon from all over the world. So I guess I will have to disable session fingerprinting to make sure that everyone can connect without issues.
  10. @bernhard I'll see what I can do with the $config->sessionFingerprint settings to avoid these problems. Although I don't feel comfortable messing with security features...
  11. thank you both for your feedback. Is there anything we can do to work around those security restrictions? EDIT: guess it has something to do with $config->sessionFingerprint setting. I'll play around with that.
  12. Hello, I have a situation were a user cannot logon to several different PW installs fromdifferent machines on his workplace network. Sometimes the initial logon is working but when navigating the PW backend he gets thrown out. Sometimes even the initial logon is not working and he is redirected too many times and the browser throws a redirection error. This points to PW loosing it's session. But the same sites are working fine when accessed from within other network environments. The user's workplace network has some pretty tight security (firewall) restrictions in place that prevent PW keeping it's session. I don't know enough about network security so I can't tell what exactly could cause that problem. I checked in the browser settings to make sure session cookies are allowed and there. Has anyone ever experienced issues like that and would there be a way to make PW keep it's session under these circumstances?
  13. @adrian unfortunately I couldn't find the reason for this. My workaround with the new user is still working, though. The install where the error occured is running on 3.0.42. I can't say if it was related to an update. Really stepping in the dark on this one...
  14. Update: working with this setup for a few months, I had quite a few permission related issues which were frustrating. So I decided to do some more research on existing docker projects that are well maintained and bring the features I need. Finally I found http://laradock.io/. I've been using it for 3 months now and I am really happy with it. Very flexible and well maintained set of docker containers. I'm totally happy and can recommend it to devs who are interested in this topic.
  15. @Robin S thank you! I didn't find this in my search. Great that it is being taken care of