" . $plugin_tx[$plugin]['contact_us'] . "\n"; $o .= contactUs(); } } /**************************************************************************** * Function Definitions * ****************************************************************************/ /* * Create HTML contact us email form. */ function contactUsEmailForm($mode, $code, $name, $email, $subject, $content) { GLOBAL $plugin_tx,$plugin_cf,$PHP_SELF; $plugin = basename(dirname(__FILE__),"/"); $o = "
\n" . "" . $plugin_tx[$plugin]['contact_us'] . "\n" . '' . "\n" . '' . '' . "\n"; if($mode == "logged_in") { $o .= '' . "\n" . '' . "\n"; } else { $o .= '' . "\n". '' . "\n". ' ' . "\n". ' ' . "\n". '' . "\n" . '' . "\n". ' ' . "\n". ' ' . "\n". '' . "\n"; } $o .= '' . "\n". ' ' . "\n". ' ' . "\n". '' . "\n". '' . "\n". ' ' . "\n". ' ' . "\n". '' . "\n"; if($mode == "secure" && $plugin_cf[$plugin]['captcha_mode'] != "none") $o .= '' . "\n". ' ' . "\n". ' ' . "\n". ' ' . "\n". '' . "\n"; $o .= '' . "\n". ' ' . "\n". '
' . $plugin_tx[$plugin]['name'] . '
' . $plugin_tx[$plugin]['email'] . '
' . $plugin_tx[$plugin]['subject'] . '
' . $plugin_tx[$plugin]['text'] . '
' . $plugin_tx[$plugin]['code'] . '' . getCaptchaHtml("contactus_captcha", $code, (int)$plugin_cf[$plugin]['captcha_image_width'], (int)$plugin_cf[$plugin]['captcha_image_height'], $plugin_cf[$plugin]['captcha_crypt'], $plugin_cf[$plugin]['captcha_mode']) . '
' . "\n"; return $o; } /* * Function to create and handle contact form (Top Level Function). * */ function contactUs() { GLOBAL $plugin_tx,$plugin_cf,$sn,$pth,$_SESSION; $plugin = basename(dirname(__FILE__),"/"); checkGD(); if(isset($_SESSION['username'],$_SESSION['fullname'], $_SESSION['email'], $_SESSION['sessionnr']) && $_SESSION['sessionnr'] == session_id()) $mode = "logged_in"; else $mode = "secure"; $ERROR = ""; $o = ""; // Get form data if available $action = isset($_POST['action']) ? $_POST['action'] : ""; $name = htmlspecialchars(isset($_POST['name']) ? $_POST['name'] : ""); $email = htmlspecialchars(isset($_POST['email']) ? $_POST['email'] : ""); $subject = htmlspecialchars(isset($_POST['subject']) ? $_POST['subject'] : ""); $content = htmlspecialchars(isset($_POST['text']) ? $_POST['text'] : ""); $captcha = isset($_POST['captcha']) ? $_POST['captcha'] : ""; $validate = isset($_POST['validate']) ? $_POST['validate'] : ""; // Form Handling if($action == "contact_us") { if($mode == "secure" && $plugin_cf[$plugin]['captcha_mode'] != "none") { if($plugin_cf[$plugin]['captcha_mode'] == "image") $code = md5_decrypt($captcha, $plugin_cf[$plugin]['captcha_crypt']); elseif($plugin_cf[$plugin]['captcha_mode'] == "formula") eval('$code=' . md5_decrypt($captcha, $plugin_cf[$plugin]['captcha_crypt']) . ";"); if($validate == "" || strtolower($validate) != $code) $ERROR .= "
  • " . $plugin_tx[$plugin]['err_validation'] . "
  • "; } if($name == "") $ERROR .= "
  • " . $plugin_tx[$plugin]['err_name'] . "
  • \n"; if($email == "") $ERROR .= "
  • " . $plugin_tx[$plugin]['err_email'] . "
  • \n"; elseif (!preg_match("/^[^\s()<>@,;:\"\/\[\]?=]+@\w[\w-]*(\.\w[\w-]*)*\.[a-z]{2,}$/i",$email)) $ERROR .= "
  • " . $plugin_tx[$plugin]['err_email_invalid'] . "
  • \n"; if($subject == "") $ERROR .= "
  • " . $plugin_tx[$plugin]['err_subject'] . "
  • \n"; if($content == "") $ERROR .= "
  • " . $plugin_tx[$plugin]['err_text'] . "
  • \n"; if($ERROR != "") $o .= '' . $plugin_tx[$plugin]['error'] . "\n" . "\n"; else { // prepare email content for contact email $content = $content . "\n"; // send email mail( $plugin_cf[$plugin]['email'], $subject, $content, 'From: ' . $name . " <" . $email . ">\r\n" . 'Cc: ' . $email . "\r\n" . 'Reply-To: ' . $email ); $o .= "" . $plugin_tx[$plugin]['contactussent'] . ""; return $o; } } // Form Creation if($mode == "secure") { if($captcha == "" || md5_decrypt($captcha, $plugin_cf[$plugin]['captcha_crypt']) == "") { if($plugin_cf[$plugin]['captcha_mode'] == "image") $code = generateRandomCode((int)$plugin_cf[$plugin]['captcha_chars']); else if($plugin_cf[$plugin]['captcha_mode'] == "formula") $code = generateCaptchaFormula((int)$plugin_cf[$plugin]['captcha_chars']); else $code = ""; } else $code = md5_decrypt($captcha, $plugin_cf[$plugin]['captcha_crypt']); $o .= contactUsEmailForm($mode, $code, $name, $email, $subject, $content); } else $o .= contactUsEmailForm($mode, "", $_SESSION['fullname'], $_SESSION['email'], $subject, $content); return $o; } /* * This function creates a link for a secure email form (Top Level Function). */ function contactuslink() { GLOBAL $plugin_cf, $plugin_tx, $sn, $su; $plugin = basename(dirname(__FILE__),"/"); if(isset($su) && urldecode($su) == html_entity_decode(preg_replace("/ /", "_", $plugin_tx[$plugin]['contact_us']))) $o .= "\n" . $plugin_tx[$plugin]['contact_us'] . "\n"; else $o .= "\n' . $plugin_tx[$plugin]['contact_us'] . "\n"; return $o; } ?> Dansk Kirkemusiker Tidende - Forside