set_file ("page", $path . "/content/friend/friend-" . $language . ".html"); $data = array( 'name' => '', 'email' => '', 'friend' => '', 'friend_email' => ''); foreach ($data as $key => $value) $tpl->set_block('page', $key . '_required', $key . '_required_placeholder'); $tpl->set_block ("page", "error_captcha_empty", "error_captcha_empty_placeholder"); $tpl->set_block ("page", "error_captcha_wrong", "error_captcha_wrong_placeholder"); $captcha_empty = false; $captcha_wrong = false; if (isset($_POST['set']) && is_array($_POST['set'])) { include ($path . '/captcha/php-captcha.inc.php'); $captcha_empty = !isset($_POST['captcha']) || !$_POST['captcha']; $captcha_wrong = !PhpCaptcha::Validate($_POST['captcha']); $error = ($captcha_empty || $captcha_wrong); foreach ($data as $key => $value) { if (isset($_POST['set'][$key]) && $_POST['set'][$key]) { $data[$key] = $_POST['set'][$key]; $tpl->set_var(strtoupper($key), zoo_htmlspecialchars($data[$key], ENT_QUOTES)); } else { $error = true; $tpl->parse($key . '_required_placeholder', $key . '_required'); } } if (!$error) { /* E-mail versturen */ $etpl = new Template(); $etpl->set_file ("page", $path . "/content/friend/friend-email-" . $language . ".html"); $etpl->set_var("NAME", $data['name']); $etpl->set_var("FRIEND", $data['friend']); $etpl->parse("out", "page"); $body = $etpl->get_var("out"); include($path . '/libraries/lib-mail.php'); $subjects = array( 1 => 'ZooEasy website', 2 => 'ZooEasy website', 3 => 'Website von ZooEasy' ); $mail = new MailTemplate($data['email'], $data['friend_email'], $subjects[$language]); $mail->set_body($body); $mail->submit(); $tpl = new Template(); $tpl->set_file ("page", $path . "/content/friend/friend-confirm-" . $language . ".html"); } } if ($captcha_empty) $tpl->parse ("error_captcha_empty_placeholder", "error_captcha_empty"); elseif ($captcha_wrong) $tpl->parse ("error_captcha_wrong_placeholder", "error_captcha_wrong"); $tpl->parse("out", "page"); $tpl->p("out"); exit; ?>