%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/nailstv/public_html/es.nails.tv/
Upload File :
Create Path :
Current File : /home/nailstv/public_html/es.nails.tv/kuldes_emailben.php

<?php

require_once 'config/config.php';

$p['pagename'] = '';

$page = new Page(Registry::get('site'), false, $p);
$v = new Inputvalidator;

if($_SESSION['video_sent'] === true) {
    $page->assign('msg', 1);
    $_SESSION['video_sent'] = false;
}

if($_POST) {
    $rec = validate($_POST, $v);

    if($v->isError) {
        $page->assign('error', $v->printError());
        $page->assign('edit', $rec);
    }
    else {
        sendUzenet($rec);

        $_SESSION['video_sent'] = true;
        header("Location: " . Registry::get('wwwroot') . "/kuldes_emailben");
        die;
    }
}

$page->display('kuldes_emailben.tpl.html');

////////////////////////////////////////////////////////////////////////////////

function validate($rec, $v)
{
    if(empty($rec['nev']) || empty($rec['email']) || empty($rec['cimzett']) || empty($rec['cimzett_email'])) {
        $v->addError('Todos las casillas deben ser rellenadas');
    }

    if(!$v->isError) {
        $msg = array('El e-mail del remitente es incorrecto.');
        $rec['email'] = $v->v($rec['email'], 'email', $msg);

        $msg = array('El e-mail del destinatario es incorrecto.');
        $rec['cimzett_email'] = $v->v($rec['cimzett_email'], 'email', $msg);
    }

    return $rec;
}

function sendUzenet($rec)
{
    $db = Registry::get('db');
    $c = new Content;

    settype($rec['video_id'], 'integer');
    $bind = array($rec['video_id']);
    $sql = "SELECT k.url AS kategoria_url, v.id, v.cim
            FROM video v
            LEFT JOIN kategoria k ON k.id = v.kategoria_id
            WHERE v.id = ?";
    $row = $db->GetRow($sql, $bind);

	$r_url = explode('.', $row['kategoria_url']);
	$rec['link'] = Registry::get('wwwroot') . '/' . $r_url[0] . '/' . String2::fancyurl($row['cim']) . '-' . $row['id'];;

    $c->assign('rec', $rec);

    $email['subject'] = 'Es.nails.tv - Videos Recomendacdos';
    $email['from'] = $rec['email'];
    $email['fromname'] = $rec['nev'];
    $email['to'] = $rec['cimzett_email'];

    $email['body'] = $c->fetch('mail_kuldes_emailben.tpl.html');

    Page::sendEmail($email);
}

?>

Zerion Mini Shell 1.0