Ver Mensaje Individual
  #3 (permalink)  
Antiguo 28/06/2009, 08:43
Avatar de fanny0
fanny0
 
Fecha de Ingreso: noviembre-2004
Mensajes: 438
Antigüedad: 20 años, 1 mes
Puntos: 1
Respuesta: modulo para suscribirse

pero necesito que solo aparezca el campo del mail... como tengo que modificar el php


Cita:
<?php

// no direct access

defined( '_JEXEC' ) or die( 'Restricted access' );



$myNameLabel = $params->get('name_label', 'Name:');

$myEmailLabel = $params->get('email_label', 'Email:');



$recipient = $params->get('email_recipient', '');



$buttonText = $params->get('button_text', 'Subscribe to Newsletter');

$pageText = $params->get('page_text', 'Thank you for subscribing to our site.');

$errorText = $params->get('errot_text', 'Your subscription could not be submitted. Please try again.');



$subject = $params->get('subject', 'New subscription to your site!');

$fromName = $params->get('from_name', 'Newsletter Subscriber');

$fromEmail = $params->get('from_email', '[email protected]');

$sendingWithSetEmail = $params->get('sending_from_set', true);



$noName = $params->get('no_name', 'Please write your name');

$noEmail = $params->get('no_email', 'Please write your email');

$invalidEmail = $params->get('invalid_email', 'Please write a valid email');



$nameWidth = $params->get('name_width', '20');

$emailWidth = $params->get('email_width', '20');

$buttonWidth = $params->get('button_width', '100');



$saveList = $params->get('save_list', true);

$savePath = $params->get('save_path', 'mailing_list.txt');



$mod_class_suffix = $params->get('moduleclass_sfx', '');

$thanksTextColor = $params->get('thank_text_color', '#FF0000');

$pre_text = $params->get('pre_text', '');



$disable_https = $params->get('disable_https', false);



$exact_url = $params->get('exact_url', true);

if (!$exact_url) {

$url = JURI::current();

}

else {

if (!$disable_https) {

$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

}

else {

$url = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

}

}



$fixed_url = $params->get('fixed_url', true);

if ($fixed_url) {

$url = $params->get('fixed_url_address', "");

}



$unique_id = $params->get('unique_id', "");



$enable_anti_spam = $params->get('enable_anti_spam', true);

$myAntiSpamQuestion = $params->get('anti_spam_q', 'How many eyes has a typical person? (ex: 1)');

$myAntiSpamAnswer = $params->get('anti_spam_a', '2');



$myError = "";

$errors = 0;



if (isset($_POST["m_name".$unique_id])) {

if ($enable_anti_spam) {

if ($_POST["modns_anti_spam_answer".$unique_id] != $myAntiSpamAnswer) {

$myError = '<span style="color: #f00;">' . JText::_('Wrong anti-spam answer') . '</span><br/>';

}

}

if ($_POST["m_name".$unique_id] === "") {

$myError = $myError . '<span style="color: #f00;">' . $noName . '</span><br/>';

$errors = $errors + 1;

}

if ($_POST["m_email".$unique_id] === "") {

$myError = $myError . '<span style="color: #f00;">' . $noEmail . '</span><br/>';

$errors = $errors + 2;

}

else if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST["m_email".$unique_id])) {

$myError = $myError . '<span style="color: #f00;">' . $invalidEmail . '</span><br/>';

$errors = $errors + 2;

}



if ($myError == "") {



$myMessage = $myNameLabel . ' ' . $_POST["m_name".$unique_id] . ', ' .

$myEmailLabel . ' ' . $_POST["m_email".$unique_id] . ', ' .

date("r");



$mailSender = &JFactory::getMailer();

$mailSender->addRecipient($recipient);

if ($sendingWithSetEmail) {

$mailSender->setSender(array($fromEmail,$fromName));

}

else {

$mailSender->setSender(array($_POST["m_email".$unique_id],$_POST["m_name".$unique_id]));

}



$mailSender->setSubject($subject);

$mailSender->setBody($myMessage);



if (!$mailSender->Send()) {

$myReplacement = '<span style="color: #f00;">' . $errorText . '</span>';

print $myReplacement;

}

else {

$myReplacement = '<span style="color: '.$thanksTextColor.';">' . $pageText . '</span>';

print $myReplacement;

}

if ($saveList) {

$file = fopen($savePath, "a");

fwrite($file, $_POST["m_name".$unique_id]." (".$_POST["m_email".$unique_id]."); ");

fclose($file);

}

return true;

}

}



if ($recipient === "") {

$myReplacement = '<span style="color: #f00;">No recipient specified</span>';

print $myReplacement;

return true;

}



if ($recipient === "[email protected]") {

$myReplacement = '<span style="color: #f00;">Mail Recipient is specified as [email protected].<br/>Please change it from the Module parameters.</span>';

print $myReplacement;

return true;

}



if ($myError != "") {

print $myError;

}



print '<div class="modns"><form action="' . $url . '" method="post">' . "\n" .

'<div class="modnsintro">'.$pre_text.'</div>' . "\n";

print '<table>';

if ($enable_anti_spam) {

print '<tr><td colspan="2">' . $myAntiSpamQuestion . '</td></tr><tr><td></td><td><input class="modns inputbox ' . $mod_class_suffix . '" type="text" name="modns_anti_spam_answer'.$unique_id.'" size="' . $nameWidth . '"/></td></tr>' . "\n";

}

print '<tr><td>' . $myNameLabel . '</td><td><input class="modns inputbox ' . $mod_class_suffix . '" type="text" name="m_name'.$unique_id.'" size="' . $nameWidth . '"';

if (($errors & 1) != 1) {

print ' value="'.$_POST["m_name".$unique_id].'"';

}

print '/></td></tr>' . "\n";

print '<tr><td>' . $myEmailLabel . '</td><td><input class="modns inputbox ' . $mod_class_suffix . '" type="text" name="m_email'.$unique_id.'" size="' . $emailWidth . '"';

if (($errors & 2) != 2) {

print ' value="'.$_POST["m_email".$unique_id].'"';

}

print '/></td></tr>' . "\n";

print '<tr><td colspan="2"><input class="modns button ' . $mod_class_suffix . '" type="submit" value="' . $buttonText . '" style="width: ' . $buttonWidth . '%"/></td></tr></table></form></div>' . "\n";

return true;