Example #1
0
<?php

/**
 * @file header.php
 * Prints out the HTML structure.
 */
require_once "functions.php";
require_once "dataFunctions.php";
require_once "userFunctions.php";
$loginRequired = isset($loginRequired) ? $loginRequired : false;
if ($loginRequired && !$loginRequired) {
    header("Location: login");
}
if (isset($_POST["name"], $_POST["email"], $_POST["message"], $_POST["captcha"], $_POST["receiver"])) {
    exit(json_encode(sendContactMail($_POST["name"], $_POST["email"], $_POST["message"], $_POST["captcha"], $_POST["receiver"])));
}
/*
 * Note: Do not copy this file over on top of the current header file on Lichen.
 * There is a Google Analytics script installed on the server but not locally.
 */
?>
<!DOCTYPE html>
<html lang="en-us">
<head>
  <meta charset="UTF-8">
  <meta name="author" content="Center for Digital Humanities - University of South Carolina">
  <meta name="keywords" content="">
  <meta name="description" content="Index Iuris is a federation of digital projects that offer the original texts for the study of the legal history in western Europe, from Roman law to early modern civil codes, both secular and ecclesiastical.">

  <title><?php 
print isset($title) ? $title . " - " : "";
Example #2
0
});
$app->get('/home/contact', function () use($app) {
    $flash = $app->view()->getData('flash');
    $errors = isset($flash['errors']) ? $flash['errors'] : array();
    $app->render('home/contact.php', array('page_title' => 'Contact', 'errors' => $errors, 'current' => 'contact'));
});
$app->post('/home/contact', function () use($app, $config) {
    include BASE_URI . DS . 'routes' . DS . 'validators' . DS . 'contact.php';
    $data = $app->request()->post();
    $errors = validate($data);
    if ($errors) {
        $app->flash('errors', $errors);
        $app->flash('data', $data);
        $app->redirect($app->view()->url('/home/contact'));
    }
    $result = sendContactMail($data['name'], $data['email'], $data['website'], $data['message'], $config);
    if (!is_array($result)) {
        $app->flash('info', $result);
        $app->redirect($app->view()->url('/'));
    } else {
        $app->error(new \Exception($result['error']));
    }
});
$app->get('/home/faq', function () use($app) {
    $app->render('home/faq.php', array('page_title' => 'FAQ', 'current' => 'faq'));
});
function sendContactMail($name, $email, $website, $message, $config)
{
    $_body = $message;
    if ($website) {
        $_body .= "<br /><br />{$website}";
Example #3
0
    # END VALIDAR DUPLICADOS
    // create a new contact record, assigned to this account, and grab the contact ID
    $response = $client->set_entry($session_id, 'Opportunities', array(array("name" => 'viene_de_c', "value" => $vieneDe), array("name" => 'name', "value" => isset($_POST['field_name']) ? $_POST['field_name'] : ''), array("name" => 'email_c', "value" => isset($_POST['field_email']) ? $_POST['field_email'] : ''), array("name" => isset($_POST['field_phon_type']) && $_POST['field_phon_type'] == 'mobile' ? 'telfalternativo_c' : 'telf_c', "value" => isset($_POST['field_telefono']) ? $_POST['field_telefono'] : ''), array("name" => 'lada_c', "value" => isset($_POST['field_lada']) ? $_POST['field_lada'] : ''), array("name" => 'cursosinteres_c', "value" => isset($_POST['field_area']) ? $_POST['field_area'] : ''), array("name" => 'comentario_c', "value" => isset($_POST['field_questions']) ? $_POST['field_questions'] : ''), array("name" => 'pais_c', "value" => isset($_POST['field_lada']) ? isset($contriesByLada[(int) $_POST['field_lada']]) ? $contriesByLada[(int) $_POST['field_lada']] : '' : '')));
    echo $response->error->number == 0 ? 1 : 0;
    // SEND MAIL
    function sendContactMail($to, $subject, $fileContent, $vars = array())
    {
        //$sender_mail = '*****@*****.**';
        //$sender_name = 'GastronONOmica Internacional';
        $headers = array("MIME-Version: 1.0\r\n", "Content-Type: text/html; charset=UTF-8\r\n");
        $content = file_get_contents($fileContent);
        foreach ($vars as $var) {
            $content = str_replace(array_keys($vars), $vars, $content);
        }
        wp_mail($to, $subject, $content, implode('', $headers));
        // mail($to, $subject, $content, implode('',$headers));
        file_put_contents('mail.log', 'to:' . $to . "\tSubject:" . $subject . "\tContent:\n" . $content . "\n", FILE_APPEND | LOCK_EX);
        //mail($to, $subject, $content, implode('',$headers));
    }
    $sendmail = true;
    if ($sendmail) {
        // mail Admin
        $to = array('*****@*****.**');
        $vars = array('<%domain%>' => $_SERVER['SERVER_NAME'], '<%url%>' => get_bloginfo('template_url'), '<%name%>' => isset($_POST['field_name']) ? $_POST['field_name'] : '', '<%email%>' => isset($_POST['field_email']) ? $_POST['field_email'] : '', '<%mobile%>' => isset($_POST['field_phon_type']) && $_POST['field_phon_type'] == 'mobile' && isset($_POST['field_telefono']) ? $_POST['field_telefono'] : '', '<%phone%>' => isset($_POST['field_phon_type']) && $_POST['field_phon_type'] != 'mobile' && isset($_POST['field_telefono']) ? $_POST['field_telefono'] : '', '<%lada%>' => isset($_POST['field_lada']) ? $_POST['field_lada'] : '', '<%area%>' => isset($_POST['field_area']) ? $_POST['field_area'] : '', '<%description%>' => isset($_POST['field_questions']) ? $_POST['field_questions'] : '', '<%contry%>' => isset($_POST['field_lada']) ? isset($contriesByLada[$_POST['field_lada']]) ? $contriesByLada[$_POST['field_lada']] : '' : '');
        sendContactMail($to, 'Registro recibido - GastronĂ³mica Internacional', get_bloginfo('template_url') . '/mailers/contact-forAdmin.php', $vars);
        // mail User
        if (isset($_POST['field_email'])) {
            sendContactMail($_POST['field_email'], 'Gracias por contactarnos.', get_bloginfo('template_url') . '/mailers/contact-forUser.php', $vars);
        }
    }
}