Jump to content

alexpi

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by alexpi

  1. Ψάχνω back-end dev για project #WordPress / #WooCommerce σχετικό με πώληση εισιτηρίων για συναυλίες. Αν ενδιαφέρεται κανείς ας μιλήσει!

  2. Thanks LostKobrakai, It makes sense now, and it works as expected!
  3. I used the WireMailSMPT module, signed up to an SMTP service (Mailjet), got SPF and DKIM authentications but the service prompts me to validate every email I receive! I am not sure if I am using $mail correctly, the docs are a little sparse. Do I need to add additional headers or something else?
  4. Ok, I signed up for a similar service. It works now, but I have a concern: Since my site's contact form receives emails from various people (the WireMail->from() value is different every time), I am asked to validate every single one before it passes. Is this the way these services work?
  5. Hello all, I am trying to setup WireMailSMTP with the Gmail SMTP server, trying everything I read in this topic with no success. The error I get that seems to say something (but I don't know what!) is => WireMailSmtpConfig: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbt0 The settings I am using are: (I think I entered every combination possible!) local hostname: the site's domain (is this wrong? I don't know if it's relevant but this domain is an addon domain) SMTP hostname: smtp.gmail.com SMTP port: 587 use START_TLS SMTP user: my email from Google SMTP password: my above email password Am I doing something wrong?
  6. Hello, I have a Processwire site that was made some years ago, and I got a complaint that the emails originating from it, ended up in Gmail's spam folder. I updated Processwire to 2.8, and changed the PHP mail() function I used before, to the newer $mail helper. In the beginning I used a Gmail email for the recipient, but later changed to an info@site.com type, thinking that this could be the problem. Still, the emails are marked as spam. I used the following code (simplified): $name = $input->post['name']; $emailFrom = $input->post['email']; $message = $input->post['message']; $form = array( 'name' => $sanitizer->text($name), 'email' => $sanitizer->email($emailFrom), 'message' => $sanitizer->textarea($message), ); $message = "Name: $form[name]\n" . "Email: $form[email]\n" . "Message: $form[message]"; $email = $mail->new(); $email->subject("Subject") ->to($pages->get('/settings/')->main_email) ->from($form['email']) ->body($message); $email->send(); Should I use email header parameters? I can't find what to do in the docs. Thanks
  7. Sad to hear about Don Buchla passing away.

  8. https://t.co/PWl204hYbD seems nice

  9. A class of .wine

  10. I want a lighter, minimally built acoustic piano..

  11. My RSS feed after a week of vacation.. :O

  12. Web design in 4 minutes! https://t.co/GfnJTTiNpP

  13. Wow.. I thought Twitter changed fonts to something unreadable, but it's just the Helvetica Neue - Chrome on Windows bug..

  14. Is it possible to have page names with non-latin characters? I tried renaming a page to contain Greek characters in PWs admin, but It wasn't allowed. In my particular case all I needed was the page title, not a url, so I used a random number to store page names. $name = $wire->input->post['guest_name']; $message = $wire->input->post['guest_message']; $p->name = rand(); $p->title = $wire->sanitizer->text($name); $p->body = $wire->sanitizer->textarea($message); I am not sure if this code is good, but it works.
  15. Hello, I developed a guestbook for a hotel site, that creates a page with a name and a small message for each person who writes. I used the following code which I found in these forums, and it works but only if the page name is written in English. $name = $wire->input->post['guest_name']; $message = $wire->input->post['guest_message']; $p = new Page(); // create new page object $p->template = 'testimonial'; // set template $p->parent = wire('pages')->get('/guestbook/'); // set the parent $p->name = $wire->sanitizer->text($name); // give it a name used in the url for the page $p->body = $wire->sanitizer->textarea($message); $p->status = Page::statusUnpublished; $p->save(); If a guest writes a name in Greek for example, I get the following error: Fatal error: Uncaught exception 'WireException' with message 'Can't save page 0: /guestbook//: It has an empty 'name' field' in (etc) The strange thing is that the textarea part can be in any language. Isn't $sanitizer->text() safe for any character sets?
  16. No photographs of subjects against white backgrounds allowed anymore.. O.o http://t.co/xq0M6TaYC1 via @verge

  17. I found out that $sanitizer->name() only accepts latin characters. I changed to $sanitizer->text() and it works in any language.
  18. Although bootstrapping PW on a file outside PW's directories and calling it with AJAX worked, I am not able to get multi-language field values from it. So, I am trying to include the contact validation code in a PW template as suggested here: https://processwire.com/talk/topic/4665-accessing-pagetitlelanguage-when-bootstrapped/ The problem is that I can't find how to do that! The following is the code I am using, which works, but is not fetching the various validation messages. <?php $emailTo = 'an email'; $name = $input->post['name']; $email = $input->post['email']; $message = $input->post['message']; $form = array( 'name' => $sanitizer->name($name), 'email' => $sanitizer->email($email), 'message' => $sanitizer->textarea($message) ); $email = "Full name: $form[name]\n" . "Email: $form[email]\n" . "Message: $form[message]"; $errors = array(); $data = array(); if (empty($form['name'])) $errors['name'] = $out = __('Name is required'); if (empty($form['email'])) $errors['email'] = $out = __('Email is required.'); if (empty($form['message'])) $errors['message'] = $out = __('Message is required.'); if ( ! empty($errors)) { $data['success'] = false; $data['errors'] = $errors; } else { mail($emailTo, "Thassos homes - Επικοινωνία", $email, "From: $form[email]"); $data['success'] = true; $data['success_message'] = $out = __('Your message has been send! We will reply to you soon.'); } json_encode($data); ?> <form action='./' method='post'> <div> <input type="text" id="name" name="name" placeholder="name" /> <input type="email" id="email" name="email" placeholder="email" required /> <input type="submit" name="submit" value="send" /> </div> <textarea id="message" name="message" placeholder="your message" required ></textarea> <div class="contact_message"></div> <div class="loading hidden"></div> </form> <script>window.jQuery || document.write('<script src="<?php echo $root_dir ?>js/jquery-1.11.0.min.js"><\/script>')</script> <script> $(document).ready(function() { var contact_message = $('.contact_message'); contact_form.submit(function(event) { contact_message.innerHTML = ""; var contactData = { 'name' : $('input[name=name]').val(), 'email' : $('input[name=email]').val(), 'message' : $('textarea[name=message]').val() }; $.ajax({ type : 'POST', url : '<?php echo $page->url ?>', data : contactData, dataType : 'json' }) .done(function(data) { console.log(data); if ( ! data.success) { if (data.errors.name) { contact_message.text(data.errors.name); } if (data.errors.email) { contact_message.text(data.errors.email); } if (data.errors.message) { contact_message.text(data.errors.message); } } else { $('.contact_form div, .contact_form textarea, .loading').addClass('hidden'); $(contact_form).append('<div class="success">' + data.success_message + '</div>'); setTimeout(function(){ contact_form.toggleClass('hidden visible'); }, 3000); // window.location = 'index.php'; // redirect a user to another page } }) .fail(function(data) { // show any errors // remove for production console.log(data); }); event.preventDefault(); }); }) </script>
  19. The mb_strlen() does not throw an error.
  20. Sorry, this must have been vague! I have a contact.php file with PW bootstrapped, called via AJAX that contains the following code: include('../index.php'); $contact = $wire->pages->get('/settings/contact/'); $contact->of(true); $language = $wire->user->language; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $emailTo = 'an email'; $name = $wire->input->post['name']; $email = $wire->input->post['email']; $message = $wire->input->post['message']; $form = array( 'name' => $wire->sanitizer->name($name), 'email' => $wire->sanitizer->email($email), 'message' => $wire->sanitizer->textarea($message) ); // below is some form validation code that is irrelevant The form code is: <form action='<?php echo $root->url ?>includes/contact.php' method='post'> <div> <input type="text" id="name" name="name" placeholder="name" required /> <input type="email" id="email" name="email" placeholder="email" required /> <input type="submit" name="submit" value="send" /> </div> <textarea id="message" name="message" placeholder="your message" required ></textarea> <div class="contact_message"></div> <div class="loading hidden"></div> </form> If I enter information in the form in English, the form works as expected. If I type in Greek, the form submission does not occur. If I remove the sanitizer functions, the Greek data pass and the form works again.
  21. Is it possible to get the user language on a page called with AJAX, that has PW bootstrapped? I am using this code: $language = $wire->user->language; but it doesn't seem to work.
  22. Hello, I have a problem with a multi-language site and sanitization. When I sanitize the inputs that are entered in other languages than english, I get no return value. Everything on the site is in utf-8. Any insights?
  23. I didn't reference the field. I changed the code to this foreach ($settings->music as $piece) { echo "<audio src='$piece->song'></audio>"; } and now I am getting the filename. But I need the path also. If I write $piece->song->path, the '->path' part is written to the src also.
×
×
  • Create New...