Mój problem dotyczy wtyczki o nazwie Simple Modal Contact Form (http://www.ericmmartin.com/projects/simp...l-demos/). Obecnie jest to wtyczka do Wordpressa, lecz wcześniejsza wersja była przystosowania do zainstalowania w normalny sposób (poprzez wklejenie kodu w do odpowiednich plików)

Otóż, pobrałem sobie wcześniejszą wersję tej wtyczki i trochę ją zmodyfikowałem do swoich potrzeb. Można ją obejrzeć pod adresem:

http://allegro.designestore.pl/plugin/co...index.html

Jak widać, na testowej stronie wszystko działa dobrze. Problem pojawił się gdy chciałem zainstalować zmodyfikowaną wtyczkę na sklepie ClickShop (home.pl), a dokładnie tutaj:

http://www.designestore.pl/

Jak widać, na tej stronie nic się nie dzieje. Początkowo myślałem, że może to powodować konflikt z jakimś skryptem MooTools lub innym jQuery. Jednak nawet po pozbyciu się w praktycznie wszystkich skryptów JavaScript ze strony nic się nie zmieniło.


Poniżej przedstawiam działanie wtyczki i wklejam kod:
--------------------------------------------------------------

Za działanie wtyczki odpowiada plik JavaScript dostępny tutaj:

http://allegro.designestore.pl/plugin/co...contact.js
(dodam, że w ClickShopie nie ma bezpośredniego dotępu do plików sklepu, więc w taki sposób odnoszę się do plików .js i .php ze skryptu)

Po kliknięciu w zakładkę "Twoja Sugestia" uruchamia on oknom, do którego wczytuje zawartość pliku PHP (w tym pliku znajduje się właśnie wyświetlany formularz). A oto kod:

  1. <?php
  2.  
  3. // User settings
  4. $to = "tomaszkikowski@gmail.com";
  5. $subject = "SimpleModal Contact Form";
  6.  
  7. // Include extra form fields and/or submitter data?
  8. // false = do not include
  9. $extra = array(
  10. "form_subject" => true,
  11. "form_cc" => true,
  12. "ip" => true,
  13. "user_agent" => true
  14. );
  15.  
  16. // Process
  17. $action = isset($_POST["action"]) ? $_POST["action"] : "";
  18. if (empty($action)) {
  19. // Send back the contact form HTML
  20. $output = "<div style='display:none'>
  21. <div class='contact-top'></div>
  22. <div class='contact-content'>
  23. <h1 class='contact-title'>Twoja sugestia</h1>
  24. <div class='contact-loading' style='display:none'></div>
  25. <div class='contact-message' style='display:none'></div>
  26. <form action='#' style='display:none'>
  27. <p class='p-contact'>Czekamy na Twoje sugestie na temat działania sklepu Design eStore.</p>
  28. <label for='contact-name'>*Nadawca:</label>
  29. <input type='text' id='contact-name' class='contact-input' name='name' tabindex='1001' />
  30. <label for='contact-email'>*E-mail:</label>
  31. <input type='text' id='contact-email' class='contact-input' name='email' tabindex='1002' />";
  32.  
  33. if ($extra["form_subject"]) {
  34. $output .= "
  35. <label for='contact-subject'>Temat:</label>
  36.  
  37.  
  38. <select name='subject' id='contact-subject' class='contact-input' tabindex='1003'>
  39. <option value=''>wybierz...</option>
  40. <option value='Design eStore::MamPytanie'>Mam pytanie do Design eStore</option>
  41. <option value='Design eStore::MamPomysl'>Mam pomysł na zmiane</option>
  42. <option value='Design eStore::PropozycjaWspolpracy'>Mam propozycję współpracy</option>
  43. <option value='Design eStore::UwagaTechniczna'>Mam uwagę techniczną</option>
  44. <option value='Design eStore::Inne'>Inne</option>
  45. </select>";
  46. }
  47.  
  48. $output .= "
  49. <label for='contact-message'>*Treść:</label>
  50. <textarea id='contact-message' class='contact-input' name='message' cols='40' rows='4' tabindex='1004'></textarea>
  51. <br/>";
  52.  
  53. if ($extra["form_cc"]) {
  54. $output .= "
  55. ";
  56. }
  57.  
  58. $output .= "
  59. <label>&nbsp;</label>
  60. <button type='submit' class='contact-send contact-button' tabindex='1006'>Wyślij</button>
  61. <br/>
  62. <input type='hidden' name='token' value='" . smcf_token($to) . "'/>
  63. </form>
  64. </div>
  65. <div class='contact-bottom'></div>
  66. </div>";
  67.  
  68. echo $output;
  69. }
  70. else if ($action == "send") {
  71. // Send the email
  72. $name = isset($_POST["name"]) ? $_POST["name"] : "";
  73. $email = isset($_POST["email"]) ? $_POST["email"] : "";
  74. $subject = isset($_POST["subject"]) ? $_POST["subject"] : $subject;
  75. $message = isset($_POST["message"]) ? $_POST["message"] : "";
  76. $cc = isset($_POST["cc"]) ? $_POST["cc"] : "";
  77. $token = isset($_POST["token"]) ? $_POST["token"] : "";
  78.  
  79. // make sure the token matches
  80. if ($token === smcf_token($to)) {
  81. smcf_send($name, $email, $subject, $message, $cc);
  82. echo "<p style='color: #333; margin: 15px 0 0 0;'> Twoja wiadomość została wysłana. </p></br>
  83.  
  84. <button class='contact-button' tabindex='1007' onClick='$.modal.close();'>Zamknij</button>
  85.  
  86. ";
  87.  
  88.  
  89. }
  90. else {
  91. echo "Niestety, Twoja wiadomość nie może zostać zweryfikowana";
  92. }
  93. }
  94.  
  95. function smcf_token($s) {
  96. return md5("smcf-" . $s . date("WY"));
  97. }
  98.  
  99. // Validate and send email
  100. function smcf_send($name, $email, $subject, $message, $cc) {
  101. global $to, $extra;
  102.  
  103. // Filter and validate fields
  104. $name = smcf_filter($name);
  105. $subject = smcf_filter($subject);
  106. $email = smcf_filter($email);
  107. if (!smcf_validate_email($email)) {
  108. $subject .= " - błędny e-mail";
  109. $message .= "\n\nZły e-mail: $email";
  110. $email = $to;
  111. $cc = 0; // do not CC "sender"
  112. }
  113.  
  114. // Add additional info to the message
  115. if ($extra["ip"]) {
  116. $message .= "\n\nAdres IP: " . $_SERVER["REMOTE_ADDR"];
  117. }
  118.  
  119. // Set and wordwrap message body
  120. $body = "Nadawca: $name, $email\n\n";
  121. $body .= "Treść wiadomości: \n\n$message";
  122. $body = wordwrap($body, 70);
  123.  
  124. // Build header
  125. $headers = "Nadawca: $email\n";
  126. if ($cc == 1) {
  127. $headers .= "Wysłano również pod adres: $email\n";
  128. }
  129. $headers .= "X-Mailer: PHP/SimpleModalContactForm";
  130.  
  131. // UTF-8
  132. if (function_exists('mb_encode_mimeheader')) {
  133. $subject = mb_encode_mimeheader($subject, "UTF-8", "B", "\n");
  134. }
  135. else {
  136. // you need to enable mb_encode_mimeheader or risk
  137. // getting emails that are not UTF-8 encoded
  138. }
  139. $headers .= "MIME-Version: 1.0\n";
  140. $headers .= "Content-type: text/plain; charset=utf-8\n";
  141. $headers .= "Content-Transfer-Encoding: quoted-printable\n";
  142.  
  143. // Send email
  144. @mail($to, $subject, $body, $headers) or
  145. die("Niestety, wystąpił problem z serwerem. Twoja wiadomość nie została wysłana.");
  146. }
  147.  
  148. // Remove any un-safe values to prevent email injection
  149. function smcf_filter($value) {
  150. $pattern = array("/\n/","/\r/","/content-type:/i","/to:/i", "/from:/i", "/cc:/i");
  151. $value = preg_replace($pattern, "", $value);
  152. return $value;
  153. }
  154.  
  155. // Validate email address format in case client-side validation "fails"
  156. function smcf_validate_email($email) {
  157. $at = strrpos($email, "@");
  158.  
  159. // Make sure the at (@) sybmol exists and
  160. // it is not the first or last character
  161. if ($at && ($at < 1 || ($at + 1) == strlen($email)))
  162. return false;
  163.  
  164. // Make sure there aren't multiple periods together
  165. if (preg_match("/(\.{2,})/", $email))
  166. return false;
  167.  
  168. // Break up the local and domain portions
  169. $local = substr($email, 0, $at);
  170. $domain = substr($email, $at + 1);
  171.  
  172.  
  173. // Check lengths
  174. $locLen = strlen($local);
  175. $domLen = strlen($domain);
  176. if ($locLen < 1 || $locLen > 64 || $domLen < 4 || $domLen > 255)
  177. return false;
  178.  
  179. // Make sure local and domain don't start with or end with a period
  180. if (preg_match("/(^\.|\.$)/", $local) || preg_match("/(^\.|\.$)/", $domain))
  181. return false;
  182.  
  183. // Check for quoted-string addresses
  184. // Since almost anything is allowed in a quoted-string address,
  185. // we're just going to let them go through
  186. if (!preg_match('/^"(.+)"$/', $local)) {
  187. // It's a dot-string address...check for valid characters
  188. if (!preg_match('/^[-a-zA-Z0-9!#$%*\/?|^{}`~&\'+=_\.]*$/', $local))
  189. return false;
  190. }
  191.  
  192. // Make sure domain contains only valid characters and at least one period
  193. if (!preg_match("/^[-a-zA-Z0-9\.]*$/", $domain) || !strpos($domain, "."))
  194. return false;
  195.  
  196. return true;
  197. }
  198.  
  199.  
  200. ?>


Może ktoś z was pomoże mi znaleźć przyczynę tego błędu, lub wskaże gdzie szukać przyczyny problemem.