Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Parse Error in newsletter.php


Beezer2005

Recommended Posts

Posted

I'm receiving this error when I try to use the newsletter manager. Any help greatly appreciated

 

 

 

Parse error: parse error, unexpected ';', expecting T_FUNCTION

 

:thumbsup:

Posted
I'm receiving this error when I try to use the newsletter manager. Any help greatly appreciated

Parse error: parse error, unexpected ';', expecting T_FUNCTION

 

:thumbsup:

 

Well, that means there is an ; were it is not expecting one.

 

The code would be helpful.

My Contributions

 

Henry Smith

Posted

The error says it's line 119 which is the last line so I assume the error is near the bottom.

 

Here's the code:

 

<?php

/*

$Id: newsletter.php,v 1.1 2002/03/08 18:38:18 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

// ################# Contribution Newsletter v050 ##############

class newsletter {

var $show_choose_audience, $newsletters_id, $module_subscribers, $title, $header, $content, $unsubscribea, $unsubscribeb;

 

function newsletter($newsletters_id, $module_subscribers, $title, $header, $content, $unsubscribea, $unsubscribeb) {

$this->show_choose_audience = false;

$this->newsletters_id = $newsletters_id;

$this->module_subscribers = $module_subscribers;

$this->title = $title;

$this->header = $header;

$this->content = $content;

$this->unsubscribea = $unsubscribea;

$this->unsubscribeb = $unsubscribeb;

}

// ################# END - Contribution Newsletter v050 ##############

 

function choose_audience() {

return false;

}

 

function confirm() {

global $HTTP_GET_VARS;

 

$mail_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");

$mail = tep_db_fetch_array($mail_query);

 

// ################# Contribution Newsletter v050 ##############

$confirm_string = '<table border="0" cellspacing="0" cellpadding="2">' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><font color="#ff0000"><b>' . tep_draw_separator('pixel_trans.gif', '20', '1') . TEXT_TITRE_INFO . '</b></font></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main">' . sprintf(TEXT_COUNT_CUSTOMERS, $mail['count']) . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main">' . TEXT_BULLETIN_NUMB . " " . '<font color="#0000ff">' . $this->newsletters_id . '</font></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main">' . TEXT_MODULE . " " . '<font color="#0000ff">' . $this->module_subscribers . '</font></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main">' . TEXT_TITRE_MAIL . " " . '<font color="#0000ff">' . $this->title . '</font></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><font color="#ff0000"><b>' . tep_draw_separator('pixel_trans.gif', '20', '1') . TEXT_TITRE_VIEW . '</b></font></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><tt>' . $this->header . '</tt></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><tt>' . $this->content . '</tt></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><tt>' . $this->unsubscribea . '</tt></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><tt>' . $this->unsubscribeb . '</tt></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td align="right"><a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'] . '&action=confirm_send') . '">' . tep_image_button('button_send.gif', IMAGE_SEND) . '</a> <a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a></td>' . "\n" .

' </tr>' . "\n" .

'</table>';

// ################# END - Contribution Newsletter v050 ##############

 

// ################# Contribution Newsletter v050 ##############

function send($newsletter_id) {

$mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");

 

while ($mail = tep_db_fetch_array($mail_query)) {

$mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));

// Pr?paration de l'envoie du mail en HTML

$mimemessage->add_html_newsletter($this->header . "\n\n" . $this->content . "\n\n" . $this->unsubscribea . " " . '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '">' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '</a>' . "\n\n" . $this->unsubscribeb);

 

$mimemessage->build_message();

// ################# END - Contribution Newsletter v050 ##############

$mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);

}

 

$newsletter_id = tep_db_prepare_input($newsletter_id);

tep_db_query("update" . TABLE_NEWSLETTERS . "set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");

}

}

?>

Posted

That's different from mine, but I would look at two things

 

Make sure the VERY last line is only

?>

 

No psaces after it and no empty line following it

 

Second, something I would try is to remove the last } and see if it works. Without a code comparison I can't be of much more help, but an attempt is better than nothing.

 

 

 

The error says it's line 119 which is the last line so I assume the error is near the bottom.

 

Here's the code:

 

<?php

/*

$Id: newsletter.php,v 1.1 2002/03/08 18:38:18 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright ? 2002 osCommerce

 

Released under the GNU General Public License

*/

 

// ################# Contribution Newsletter v050 ##############

class newsletter {

var $show_choose_audience, $newsletters_id, $module_subscribers, $title, $header, $content, $unsubscribea, $unsubscribeb;

 

function newsletter($newsletters_id, $module_subscribers, $title, $header, $content, $unsubscribea, $unsubscribeb) {

$this->show_choose_audience = false;

$this->newsletters_id = $newsletters_id;

$this->module_subscribers = $module_subscribers;

$this->title = $title;

$this->header = $header;

$this->content = $content;

$this->unsubscribea = $unsubscribea;

$this->unsubscribeb = $unsubscribeb;

}

// ################# END - Contribution Newsletter v050 ##############

 

function choose_audience() {

return false;

}

 

function confirm() {

global $HTTP_GET_VARS;

 

$mail_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");

$mail = tep_db_fetch_array($mail_query);

 

// ################# Contribution Newsletter v050 ##############

$confirm_string = '<table border="0" cellspacing="0" cellpadding="2">' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><font color="#ff0000"><b>' . tep_draw_separator('pixel_trans.gif', '20', '1') . TEXT_TITRE_INFO . '</b></font></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main">' . sprintf(TEXT_COUNT_CUSTOMERS, $mail['count']) . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main">' . TEXT_BULLETIN_NUMB . " " . '<font color="#0000ff">' . $this->newsletters_id . '</font></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main">' . TEXT_MODULE . " " . '<font color="#0000ff">' . $this->module_subscribers . '</font></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main">' . TEXT_TITRE_MAIL . " " . '<font color="#0000ff">' . $this->title . '</font></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><font color="#ff0000"><b>' . tep_draw_separator('pixel_trans.gif', '20', '1') . TEXT_TITRE_VIEW . '</b></font></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><tt>' . $this->header . '</tt></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><tt>' . $this->content . '</tt></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><tt>' . $this->unsubscribea . '</tt></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><tt>' . $this->unsubscribeb . '</tt></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td align="right"><a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'] . '&action=confirm_send') . '">' . tep_image_button('button_send.gif', IMAGE_SEND) . '</a> <a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a></td>' . "\n" .

' </tr>' . "\n" .

'</table>';

// ################# END - Contribution Newsletter v050 ##############

 

// ################# Contribution Newsletter v050 ##############

function send($newsletter_id) {

$mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");

 

while ($mail = tep_db_fetch_array($mail_query)) {

$mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));

// Pr?paration de l'envoie du mail en HTML

$mimemessage->add_html_newsletter($this->header . "\n\n" . $this->content . "\n\n" . $this->unsubscribea . " " . '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '">' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '</a>' . "\n\n" . $this->unsubscribeb);

 

$mimemessage->build_message();

// ################# END - Contribution Newsletter v050 ##############

$mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);

}

 

$newsletter_id = tep_db_prepare_input($newsletter_id);

tep_db_query("update" . TABLE_NEWSLETTERS . "set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");

}

}

?>

My Contributions

 

Henry Smith

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...