public function ask_confirmation($info, $mode) { $info["email"] = strtolower($info["email"]); $query = "select count(*) as count from subscriptions where email=%s"; if (($result = $this->db->execute($query, $info["email"])) === false) { return false; } $count = $result[0]["count"]; if ($mode == "subscribe") { /* Subscribe */ if ($count == 1) { return true; } $title = "subscription"; $action = "subscribe to"; } else { if ($mode == "unsubscribe") { /* Unsubscribe */ if ($count == 0) { return true; } $title = "unsubscription"; $action = "unsubscribe from"; } else { return false; } } $data = array("mode" => $mode, "email" => $info["email"], "expires" => date("YmdHis", strtotime("+" . $this->settings->newsletter_code_timeout))); $data["signature"] = $this->signature($data); $code = base64_encode(json_encode($data)); $code = strtr($code, "/+", "_-"); $subject = "Confirm " . $this->settings->head_title . " newsletter " . $title; $newsletter = new newsletter($subject, $this->settings->newsletter_email, $this->settings->newsletter_name); $url = $_SERVER["HTTP_SCHEME"] . "://" . $_SERVER["SERVER_NAME"] . "/newsletter/" . $code; $message = "You recieve this e-mail because your e-mail address has been entered at the newsletter " . "form at the " . $this->settings->head_title . " website. Subscribing to or unsubscribing from this " . "newsletter requires confirmation. So, if you do want to " . $action . " the " . $this->settings->head_title . " " . "newsletter, confirm by following <a href=\"" . $url . "\">this link</a>. If that's not " . "what you want, just ignore this e-mail.\n"; $newsletter->message($message); return $newsletter->send($info["email"]); }
<?php $moduleRoot = dirname(__FILE__); require $moduleRoot . '/class.phpmailer.php'; require $moduleRoot . '/class.newsletter.php'; require $moduleRoot . '/easy-mysql-class.php'; $mysql = new mysql('localhost', 'mysqlUser', 'mysqlPass', 'mysqlDB'); $mysql->connect(); $newsletter = new newsletter(); $newsletter->addMysqlObg($mysql); $sendAttempt = $newsletter->Sendmail(); if ($sendAttempt === false) { echo $newsletter->errorMsg; } else { echo $newsletter->emailSent . ' mailuri trimise.'; }
function getProfileNewsletterList($userId) { $retVal = '<fieldset style="padding: 8px"><legend>My Newsletters</legend>'; global $urlRequestRoot, $cmsFolder, $sourceFolder, $moduleFolder, $templateFolder; include_once "{$sourceFolder}/{$moduleFolder}/newsletter.lib.php"; $subscribableLists = newsletter::getSubscribableLists($userId); $subscribedLists = ''; $unsubscribedLists = ''; for ($i = 0; $i < count($subscribableLists); ++$i) { if ($subscribableLists[$i][2] === true) { $subscribedLists .= '<span class="newsletterlistitem"><a href="' . $subscribableLists[$i][1] . '" />' . $subscribableLists[$i][0] . '</a></span>'; } else { $unsubscribedLists .= '<span class="newsletterlistitem"><a href="' . $subscribableLists[$i][1] . '" />' . $subscribableLists[$i][0] . '</a></span>'; } } $imageDir = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/icons/16x16/actions/"; $retVal .= '<table border="0" cellpadding="4" cellspacing="4"><tr><th>Available Lists</th><th></th><th>Lists I\'ve subscribed to</th><tr><td width="45%">'; $retVal .= '<span class="newsletterlist" style="float: left" id="unsubscribedLists">' . $unsubscribedLists . '</span>'; $retVal .= '</td><td style="vertical-align: center; text-align: center"><img src="' . $imageDir . 'go-next.gif" /><br /><br /><img src="' . $imageDir . 'go-previous.gif" /></td><td width="45%">'; $retVal .= '<span class="newsletterlist" style="float: right" id="subscribedLists">' . $subscribedLists . '</span>'; $retVal .= '</td></tr></table>'; $retVal .= '</fieldset>'; return $retVal; }
date_default_timezone_set('Europe/Vienna'); // Datenbank Connection File einbinden // ******************************************************* require_once 'inc/db_connect.inc.php'; // Allgemeine CMS Funktionen Klasse einbinden // ******************************************************* require_once 'inc/functionsAll.inc.php'; require_once 'inc/hp_functions.inc.php'; $cmsHpObj = new hpFunctions(); // CMS Homepage Daten Array // ******************************************************* $hpCms = $cmsHpObj->getHpDataArray(); // CMS Funktionen Klasse einbinden // ******************************************************* require_once 'admin/inc/klassen/newsletter.inc.php'; $newsObj = new newsletter(); $data = $newsObj->getElemtData(2853); $xml = $newsObj->getXmlData(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" /> <title>*|MC:SUBJECT|*</title> <link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css' /> <style type="text/css"> html { width: 100%;
function add($VAR) { if (!$this->checkLimits()) { return false; } // check account limits $this->account_construct(); global $C_list, $C_translate, $C_debug, $VAR, $smarty; $this->validated = true; ### Set the hidden values: $VAR['account_date_orig'] = time(); $VAR['account_date_last'] = time(); if (defined("SESS_LANGUAGE")) { @($VAR['account_language_id'] = SESS_LANGUAGE); } else { @($VAR['account_language_id'] = DEFAULT_LANGUAGE); } if (defined("SESS_AFFILIATE")) { @($VAR['account_affiliate_id'] = SESS_AFFILIATE); } else { @($VAR['account_affiliate_id'] = DEFAULT_AFFILIATE); } if (defined("SESS_RESELLER")) { @($VAR['account_reseller_id'] = SESS_RESELLER); } else { @($VAR['account_reseller_id'] = DEFAULT_RESELLER); } if (defined("SESS_CURRENCY")) { @($VAR['account_currency_id'] = SESS_CURRENCY); } else { @($VAR['account_currency_id'] = DEFAULT_CURRENCY); } if (defined("SESS_THEME")) { @($VAR['account_theme_id'] = SESS_THEME); } else { @($VAR['account_theme_id'] = DEFAULT_THEME); } if (defined("SESS_CAMPAIGN")) { @($VAR['account_campaign_id'] = SESS_CAMPAIGN); } else { @($VAR['account_campaign_id'] = 0); } if (!isset($VAR['account_email_type']) && @$VAR['account_email_type'] != "1") { @($VAR['account_email_type'] = '0'); } ### Determine the proper account status: if (DEFAULT_ACCOUNT_STATUS != '1') { $status = '1'; } else { $status = '0'; } ## Single field login: if (defined('SINGLE_FIELD_LOGIN') && SINGLE_FIELD_LOGIN == true && empty($VAR['account_password'])) { $VAR['account_password'] = '******'; $VAR['confirm_password'] = '******'; } #################################################################### ### loop through the field list to validate the required fields #################################################################### $type = 'add'; $this->method["{$type}"] = split(",", $this->method["{$type}"]); $arr = $this->method["{$type}"]; include_once PATH_CORE . 'validate.inc.php'; $validate = new CORE_validate(); $this->validated = true; while (list($key, $value) = each($arr)) { # get the field value $field_var = $this->module . '_' . $value; $field_name = $value; #################################################################### ### perform any field validation... #################################################################### # check if this value is unique if (isset($this->field["{$value}"]["unique"]) && isset($VAR["{$field_var}"])) { if (!$validate->validate_unique($this->table, $field_name, "record_id", $VAR["{$field_var}"])) { $this->validated = false; $this->val_error[] = array('field' => $this->table . '_' . $field_name, 'field_trans' => $C_translate->translate('field_' . $field_name, $this->module, ""), 'error' => $C_translate->translate('validate_unique', "", "")); } } # check if the submitted value meets the specifed requirements if (isset($this->field["{$value}"]["validate"])) { if (isset($VAR["{$field_var}"])) { if ($VAR["{$field_var}"] != '') { if (!$validate->validate($field_name, $this->field["{$value}"], $VAR["{$field_var}"], $this->field["{$value}"]["validate"])) { $this->validated = false; $this->val_error[] = array('field' => $this->module . '_' . $field_name, 'field_trans' => $C_translate->translate('field_' . $field_name, $this->module, ""), 'error' => $validate->error["{$field_name}"]); } } else { $this->validated = false; $this->val_error[] = array('field' => $this->module . '_' . $field_name, 'field_trans' => $C_translate->translate('field_' . $field_name, $this->module, ""), 'error' => $C_translate->translate('validate_any', "", "")); } } else { $this->validated = false; $this->val_error[] = array('field' => $this->module . '_' . $field_name, 'field_trans' => $C_translate->translate('field_' . $field_name, $this->module, ""), 'error' => $C_translate->translate('validate_any', "", "")); } } } #################################################################### ### Validate the password #################################################################### if (isset($VAR['account_password']) && $VAR['account_password'] != "") { if (isset($VAR['confirm_password']) && $VAR['account_password'] == $VAR['confirm_password']) { $password = $VAR['account_password']; $smarty->assign('confirm_account_password', $VAR["account_password"]); } else { ### ERROR: The passwords provided do not match! $smarty->assign('confirm_account_password', ''); $this->validated = false; $this->val_error[] = array('field' => 'account_confirm_password', 'field_trans' => $C_translate->translate('field_confirm_password', $this->module, ""), 'error' => $C_translate->translate('password_change_match', "account", "")); } } else { $smarty->assign('confirm_account_password', ''); } #################################################################### ### Validate that the user's IP & E-mail are not banned! #################################################################### if ($this->validated) { require_once PATH_MODULES . 'blocked_email/blocked_email.inc.php'; $blocked_email = new blocked_email(); if (!$blocked_email->is_blocked($VAR['account_email'])) { $this->val_error[] = array('field' => 'account_email', 'field_trans' => $C_translate->translate('field_email', $this->module, ""), 'error' => $C_translate->translate('validate_banned_email', "", "")); } require_once PATH_MODULES . 'blocked_ip/blocked_ip.inc.php'; $blocked_ip = new blocked_ip(); if (!$blocked_ip->is_blocked(USER_IP)) { $this->val_error[] = array('field' => 'IP Address', 'field_trans' => $C_translate->translate('ip_address', $this->module, ""), 'error' => $C_translate->translate('validate_banned_ip', "", "")); } } // validate the tax_id require_once PATH_MODULES . 'tax/tax.inc.php'; $taxObj = new tax(); $tax_arr = @$VAR['account_tax_id']; if (is_array($tax_arr)) { foreach ($tax_arr as $country_id => $tax_id) { if ($country_id == $VAR['account_country_id']) { $exempt = @$VAR["account_tax_id_exempt"][$country_id]; if (!$taxObj->TaxIdsValidate($country_id, $tax_id, $exempt)) { $this->validated = false; $this->val_error[] = array('field' => 'account_tax_id', 'field_trans' => $taxObj->errField, 'error' => $C_translate->translate('validate_general', "", "")); } if ($exempt) { $VAR['account_tax_id'] = false; } else { $VAR['account_tax_id'] = $tax_id; } } } } #################################################################### ### Get required static_Vars and validate them... return an array ### w/ ALL errors... #################################################################### require_once PATH_CORE . 'static_var.inc.php'; $static_var = new CORE_static_var(); if (!isset($this->val_error)) { $this->val_error = false; } $all_error = $static_var->validate_form($this->module, $this->val_error); if ($all_error != false && gettype($all_error) == 'array') { $this->validated = false; } else { $this->validated = true; } #################################################################### ### If validation was failed, skip the db insert & ### set the errors & origonal fields as Smarty objects, ### and change the page to be loaded. #################################################################### if (!$this->validated) { global $smarty; # set the errors as a Smarty Object $smarty->assign('form_validation', $all_error); # set the page to be loaded if (!defined("FORCE_PAGE")) { define('FORCE_PAGE', $VAR['_page_current']); } # Stripslashes global $C_vars; $C_vars->strip_slashes_all(); return; } # Get default invoice options $db =& DB(); $invopt = $db->Execute(sqlSelect($db, "setup_invoice", "*", "")); if ($invopt && $invopt->RecordCount()) { $invoice_delivery = $invopt->fields['invoice_delivery']; $invoice_format = $invopt->fields['invoice_show_itemized']; } /* hash the password */ if (defined('PASSWORD_ENCODING_SHA')) { $password_encoded = sha1($password); } else { $password_encoded = md5($password); } #################################################################### ### Insert the account record #################################################################### $this->account_id = $db->GenID(AGILE_DB_PREFIX . 'account_id'); $validation_str = time(); /** get parent id */ $this->account_id; if (empty($this->parent_id)) { $this->parent_id = $this->account_id; } $sql = ' INSERT INTO ' . AGILE_DB_PREFIX . 'account SET id = ' . $db->qstr($this->account_id) . ', site_id = ' . $db->qstr(DEFAULT_SITE) . ', date_orig = ' . $db->qstr($validation_str) . ', date_last = ' . $db->qstr(time()) . ', language_id = ' . $db->qstr($VAR["account_language_id"]) . ', country_id = ' . $db->qstr($VAR["account_country_id"]) . ', parent_id = ' . $db->qstr($this->parent_id) . ', affiliate_id = ' . $db->qstr(@$VAR["account_affiliate_id"]) . ', campaign_id = ' . $db->qstr(@$VAR["account_campaign_id"]) . ', reseller_id = ' . $db->qstr(@$VAR["account_reseller_id"]) . ', currency_id = ' . $db->qstr($VAR["account_currency_id"]) . ', theme_id = ' . $db->qstr($VAR["account_theme_id"]) . ', username = '******', password = '******', status = ' . $db->qstr($status) . ', first_name = ' . $db->qstr($VAR["account_first_name"], get_magic_quotes_gpc()) . ', middle_name = ' . $db->qstr($VAR["account_middle_name"], get_magic_quotes_gpc()) . ', last_name = ' . $db->qstr($VAR["account_last_name"], get_magic_quotes_gpc()) . ', company = ' . $db->qstr($VAR["account_company"], get_magic_quotes_gpc()) . ', title = ' . $db->qstr($VAR["account_title"], get_magic_quotes_gpc()) . ', email = ' . $db->qstr($VAR["account_email"], get_magic_quotes_gpc()) . ', address1 = ' . $db->qstr($VAR["account_address1"], get_magic_quotes_gpc()) . ', address2 = ' . $db->qstr($VAR["account_address2"], get_magic_quotes_gpc()) . ', city = ' . $db->qstr($VAR["account_city"], get_magic_quotes_gpc()) . ', state = ' . $db->qstr($VAR["account_state"], get_magic_quotes_gpc()) . ', zip = ' . $db->qstr($VAR["account_zip"], get_magic_quotes_gpc()) . ', email_type = ' . $db->qstr($VAR["account_email_type"], get_magic_quotes_gpc()) . ', invoice_delivery= ' . $db->qstr(@$invoice_delivery) . ', invoice_show_itemized=' . $db->qstr(@$invoice_format) . ', invoice_advance_gen = ' . $db->qstr(MAX_INV_GEN_PERIOD) . ', invoice_grace = ' . $db->qstr(GRACE_PERIOD) . ', tax_id = ' . $db->qstr(@$VAR['account_tax_id']); $result = $db->Execute($sql); #################################################################### ### error reporting: #################################################################### if ($result === false) { global $C_debug; $C_debug->error('account.inc.php', 'add', $db->ErrorMsg()); if (isset($this->trigger["{$type}"])) { include_once PATH_CORE . 'trigger.inc.php'; $trigger = new CORE_trigger(); $trigger->trigger($this->trigger["{$type}"], 0, $VAR); } return; } /* password logging class */ if ($C_list->is_installed('account_password_history')) { include_once PATH_MODULES . 'account_password_history/account_password_history.inc.php'; $accountHistory = new account_password_history(); $accountHistory->setNewPassword($this->account_id, $password_encoded); } #################################################################### ### Add the account to the default group: #################################################################### $group_id = $db->GenID(AGILE_DB_PREFIX . 'account_group_id'); $sql = ' INSERT INTO ' . AGILE_DB_PREFIX . 'account_group SET id = ' . $db->qstr($group_id) . ', site_id = ' . $db->qstr(DEFAULT_SITE) . ', date_orig = ' . $db->qstr(time()) . ', group_id = ' . $db->qstr(DEFAULT_GROUP) . ', account_id = ' . $db->qstr($this->account_id) . ', active = ' . $db->qstr('1'); $db->Execute($sql); #################################################################### ### Insert the static vars: #################################################################### $static_var->add($VAR, $this->module, $this->account_id); #################################################################### ### Mail the user the new_account email template #################################################################### require_once PATH_MODULES . 'email_template/email_template.inc.php'; $my = new email_template(); if ($status == "1") { $my->send('account_registration_active', $this->account_id, $this->account_id, '', ''); } else { $validation_str = strtoupper($validation_str . ':' . $this->account_id); $my->send('account_registration_inactive', $this->account_id, '', '', $validation_str); } #################################################################### ### Add the newsletters #################################################################### if (NEWSLETTER_REGISTRATION == "1") { @($VAR['newsletter_html'] = $VAR['account_email_type']); $VAR['newsletter_email'] = $VAR['account_email']; $VAR['newsletter_first_name'] = $VAR['account_first_name']; $VAR['newsletter_last_name'] = $VAR['account_last_name']; require_once PATH_MODULES . '/newsletter/newsletter.inc.php'; $newsletter = new newsletter(); $newsletter->subscribe($VAR, $this); } #################################################################### ### Log in the user & display the welcome message #################################################################### if ($status == "1") { if ($this->parent_id == $this->account_id || empty($this->parent_id)) { $C_debug->alert($C_translate->translate("user_add_active_welcome", "account", "")); if (SESSION_EXPIRE == 0) { $exp = 99999; } else { $exp = SESSION_EXPIRE; } $date_expire = time() + SESSION_EXPIRE * 60; # update the session $db =& DB(); $q = "UPDATE " . AGILE_DB_PREFIX . "session\n\t\t\t\t\t\tSET\n\t\t\t\t\t\tip= " . $db->qstr(USER_IP) . ",\n\t\t\t\t\t\tdate_expire = " . $db->qstr($date_expire) . ",\n\t\t\t\t\t\tlogged = " . $db->qstr('1') . ",\n\t\t\t\t\t\taccount_id = " . $db->qstr($this->account_id) . "\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\tid = " . $db->qstr(SESS) . "\n\t\t\t\t\t\tAND\n\t\t\t\t\t\tsite_id = " . $db->qstr(DEFAULT_SITE); $result = $db->Execute($q); ### constants define('FORCE_SESS_ACCOUNT', $this->account_id); define('FORCE_SESS_LOGGED', 1); ### Reload the session auth cache if (CACHE_SESSIONS == '1') { $force = true; $C_auth = new CORE_auth($force); global $C_auth2; $C_auth2 = $C_auth; } if (isset($VAR['_page_next'])) { define('REDIRECT_PAGE', '?_page=' . $VAR['_page_next']); } elseif (isset($VAR['_page'])) { define('REDIRECT_PAGE', '?_page=' . $VAR['_page']); } } #################################################################### ### Do any db_mapping #################################################################### if ($C_list->is_installed('db_mapping')) { include_once PATH_MODULES . 'db_mapping/db_mapping.inc.php'; $db_map = new db_mapping(); if (!empty($password)) { $db_map->plaintext_password = $password; } else { $db_map->plaintext_password = false; } $db_map->account_add($this->account_id); $db_map = new db_mapping(); $db_map->login($this->account_id); } #################################################################### ### Affiliate Auto Creation #################################################################### if (AUTO_AFFILIATE == 1 && $C_list->is_installed("affiliate")) { $VAR['affiliate_account_id'] = $this->account_id; $VAR['affiliate_template_id'] = DEFAULT_AFFILIATE_TEMPLATE; include_once PATH_MODULES . 'affiliate/affiliate.inc.php'; $affiliate = new affiliate(); $affiliate->add($VAR, $affiliate); } } else { $C_debug->alert($C_translate->translate("user_add_inactive_welcome", "account", "")); define('FORCE_PAGE', 'core:blank'); } }
public static function getSubscribableLists($userId) { $newsletterListQuery = 'SELECT `page_id`, `page_modulecomponentid` FROM `' . MYSQL_DATABASE_PREFIX . 'pages` WHERE `page_module` = \'newsletter\' ORDER BY `page_modulecomponentid`'; $newsletterListResult = mysql_query($newsletterListQuery); $subscribableLists = array(); while ($newsletterListRow = mysql_fetch_row($newsletterListQuery)) { if (getPermissions($userId, $newsletterListRow[0], 'view', 'newsletter')) { $listName = getNewsletterName($newsletterListRow[1]); $listPath = getNewsletterPath($newsletterListRow[0]); $subscribed = newsletter::isUserRegistered($userId, $newsletterListRow[1]); $subscribableLists[] = array($listName, $listPath, $subscribed); } } $subscribableLists[] = array('newsletter1', 'newsletter1', 0); $subscribableLists[] = array('newsletter2', 'newsletter3', 1); $subscribableLists[] = array('newsletter3', 'newsletter2', 1); return $subscribableLists; }
function view_subscribers($p_id) { $ns = e107::getRender(); $mes = e107::getMessage(); $frm = e107::getForm(); $nl_sql = new db(); $_nl_sanatized = ''; if (!$nl_sql->db_Select('newsletter', '*', 'newsletter_id=' . $p_id)) { $mes->addError(NLLAN_56); $vs_text .= "<div class='buttons-bar center'>\n\t\t\t\t\t\t\t<input class='btn btn-default button' type=button value='" . LAN_BACK . "' onClick=\"window.location='" . e_SELF . "'\">\n\t\t\t\t\t\t</div>"; $ns->tablerender(NLLAN_65 . ' ' . $p_id, $mes->render() . $vs_text); return; } else { $vs_text .= "\n\t\t\t<form action='" . e_SELF . "' id='newsletterform' method='post'>\n\t\t\t<table class='table adminlist'>\n\t\t\t<colgroup>\n\t\t\t\t<col style='width: 5%; text-align: center;' />\n\t\t\t\t<col style='width: 35%;' />\n\t\t\t\t<col style='width: 45%;' />\n\t\t\t\t<col style='width: 15%; text-align: center;' />\n\t\t\t</colgroup>\n\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . LAN_ID . "</td>\n\t\t\t\t\t<td>" . LAN_NAME . "</td>\n\t\t\t\t\t<td>" . LAN_EMAIL . "</td>\n\t\t\t\t\t<td>" . LAN_OPTIONS . "</td>\n\t\t\t\t</tr>"; if ($nl_row = $nl_sql->db_Fetch()) { $subscribers_list = explode(chr(1), trim($nl_row['newsletter_subscribers'])); sort($subscriber_list); $subscribers_total_count = count($subscribers_list) - 1; // Get a null entry as well } if ($subscribers_total_count < 1) { header("location:" . e_SELF); exit; } // Loop through each user in the array subscribers_list & sanatize $_last_subscriber = ''; foreach ($subscribers_list as $val) { $val = trim($val); if ($val) { if ($val != $_last_subscriber) { $nl_sql->db_Select("user", "*", "user_id=" . $val); if ($nl_row = $nl_sql->db_Fetch()) { $vs_text .= "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . $val . "</td>\n\t\t\t\t\t\t\t\t<td><a href='" . e_BASE . "user.php?id.{$val}'>" . $nl_row['user_name'] . "</a></td>\n\t\t\t\t\t\t\t\t<td>" . $nl_row['user_email'] . "</td>\n\t\t\t\t\t\t\t\t<td><a href='" . e_SELF . "?remove.{$p_id}.{$val}'>" . ADMIN_DELETE_ICON . "</a>" . ($nl_row['user_ban'] > 0 ? NLLAN_62 : "") . "</td>\n\t\t\t\t\t\t\t</tr>"; $_last_subscriber = $val; } } else { // Duplicate user id found in the subscribers_list array! newsletter::remove_subscribers($p_id, $val); // removes all entries for this user id $newsletterArray[$p_id]['newsletter_subscribers'] = chr(1) . $val; // keep this single value in the list $nl_sql->db_Update("newsletter", "newsletter_subscribers='" . $newsletterArray[$p_id]['newsletter_subscribers'] . "' WHERE newsletter_id='" . intval($p_id) . "'"); $subscribers_total_count--; $_nl_sanatized = 1; } } } } $vs_text .= "\n\t\t<tr>\n\t\t\t<td colspan='4'>" . NLLAN_63 . ": " . $subscribers_total_count . "</td>\n\t\t</tr>\n\t\t </table>\n\t\t\t <div class='buttons-bar center'>\n\t\t\t \t" . $frm->admin_button('submit', LAN_BACK, 'submit') . "\n\t\t\t </div>\t\t\t\n\t\t </form>\n\t\t "; if ($_nl_sanatized == 1) { $mes->addInfo(NLLAN_66); } $ns->tablerender(NLLAN_65 . ' ' . $p_id, $mes->render() . $vs_text); }
public function preview_newsletter($info) { $newsletter = new newsletter($info["title"], $this->settings->newsletter_email, $this->settings->newsletter_name); $newsletter->message($info["content"]); return $newsletter->send($this->user->email); }
</script> </div> <div class="tab-pane col-md-6 col-md-offset-3" id="newsletter"> <table class="table table-striped"> <thead> <tr> <th></th> <th>Nom</th> <th>Cognoms</th> <th>Correu</th> </tr> </thead> <tbody> <?php include_once '../classes/newsletter.php'; $news = new newsletter(); $news->llistar(); ?> </tbody> </table> </div> </div> </div> <script src="js/moment.js" type="text/javascript"></script> <script src="js/bootstrap-datetimepicker.min.js" type="text/javascript"></script> <script src="js/bootstrap-datetimepicker.ca.js" type="text/javascript"></script> </body> </html> <?php } else { echo '<h1 style="color:red;">' . $lang['NO_LOGIN'] . '</h1>';
// campaign tracking if (isset($_SESSION['tracking']['refID'])) { $refID = $leads = 0; $campaign_check = xtc_db_query("SELECT campaigns_id, campaigns_leads\n FROM " . TABLE_CAMPAIGNS . "\n WHERE campaigns_refID = '" . $_SESSION['tracking']['refID'] . "'"); if (xtc_db_num_rows($campaign_check) > 0) { $campaign = xtc_db_fetch_array($campaign_check); $refID = $campaign['campaigns_id']; $leads = $campaign['campaigns_leads']; } $leads++; xtc_db_query("UPDATE " . TABLE_CUSTOMERS . "\n\t SET refferers_id = '" . $refID . "'\n WHERE customers_id = '" . (int) $_SESSION['customer_id'] . "'"); xtc_db_query("UPDATE " . TABLE_CAMPAIGNS . "\n SET campaigns_leads = '" . $leads . "'\n WHERE campaigns_id = '" . $refID . "'"); } if ($newsletter == 1) { require_once DIR_WS_CLASSES . 'class.newsletter.php'; $newsletter = new newsletter(); $newsletter->AddUserAuto($email_address); } xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); } } $breadcrumb->add(NAVBAR_TITLE_CREATE_GUEST_ACCOUNT, xtc_href_link(FILENAME_CREATE_GUEST_ACCOUNT, '', 'SSL')); require DIR_WS_INCLUDES . 'header.php'; if ($messageStack->size('create_account') > 0) { $smarty->assign('error', $messageStack->output('create_account')); } $smarty->assign('FORM_ACTION', xtc_draw_form('create_account', xtc_href_link(FILENAME_CREATE_GUEST_ACCOUNT, '', 'SSL'), 'post') . xtc_draw_hidden_field('action', 'process')); if (ACCOUNT_GENDER == 'true') { $smarty->assign('gender', '1'); $smarty->assign('INPUT_MALE', xtc_draw_radio_field(array('name' => 'gender', 'suffix' => MALE), 'm')); $smarty->assign('INPUT_FEMALE', xtc_draw_radio_field(array('name' => 'gender', 'suffix' => FEMALE, 'text' => xtc_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>' : ''), 'f'));
function view_subscribers($p_id) { $nl_sql = new db(); $_nl_sanatized = ''; if (!$nl_sql->db_Select('newsletter', '*', 'newsletter_id=' . $p_id)) { // Check if newsletter id is available $vs_text .= "<br /><br /><span style='text-align:center'>" . NLLAN_56 . "<br /><br/>\n\t\t\t\t\t <input class='button' type=button value='" . NLLAN_57 . "' onClick=\"window.location='" . e_SELF . "'\"></span>"; $ns->tablerender(NLLAN_58, $vs_text); return; } else { $vs_text .= "\n\t\t\t\t<form action='" . e_SELF . "' id='newsletterform' method='post'>\n\t\t\t<table style='" . ADMIN_WIDTH . "' class='fborder'>\n\t\t\t\t<tr>\n\t\t\t\t<td style='width:5%; text-align: center;' class='forumheader'>" . NLLAN_55 . "</td>\n\t\t\t\t<td style='width:35%' class='forumheader'>" . NLLAN_59 . "</td>\n\t\t\t\t<td style='width:45%;' class='forumheader'>" . NLLAN_60 . "</td>\n\t\t\t\t<td style='width:15%; text-align: center;' class='forumheader'>" . NLLAN_61 . "</td>\n\t\t\t\t</tr>"; if ($nl_row = $nl_sql->db_Fetch()) { $subscribers_list = explode(chr(1), trim($nl_row['newsletter_subscribers'])); sort($subscriber_list); $subscribers_total_count = count($subscribers_list) - 1; // Get a null entry as well } if ($subscribers_total_count < 1) { header("location:" . e_SELF); exit; } // Loop through each user in the array subscribers_list & sanatize $_last_subscriber = ''; foreach ($subscribers_list as $val) { $val = trim($val); if ($val) { if ($val != $_last_subscriber) { $nl_sql->db_Select("user", "*", "user_id=" . $val); if ($nl_row = $nl_sql->db_Fetch()) { $vs_text .= "<tr>\n\t\t\t\t\t\t\t\t<td style='text-align: center;' class='forumheader3'>{$val}\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class='forumheader3'><a href='" . e_BASE . "user.php?id.{$val}'>" . $nl_row['user_name'] . "</a>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class='forumheader3'>" . $nl_row['user_email'] . "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td style='text-align: center;' class='forumheader3'><a href='" . e_SELF . "?remove.{$p_id}.{$val}'>" . ADMIN_DELETE_ICON . "</a>\n\t\t\t\t\t\t\t" . ($nl_row['user_ban'] > 0 ? NLLAN_62 : "") . "\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>"; $_last_subscriber = $val; } } else { // Duplicate user id found in the subscribers_list array! newsletter::remove_subscribers($p_id, $val); // removes all entries for this user id $newsletterArray[$p_id]['newsletter_subscribers'] = chr(1) . $val; // keep this single value in the list $nl_sql->db_Update("newsletter", "newsletter_subscribers='" . $newsletterArray[$p_id]['newsletter_subscribers'] . "' WHERE newsletter_id='" . intval($p_id) . "'"); $subscribers_total_count--; $_nl_sanatized = 1; } } } } $vs_text .= "\n\t\t <tr>\n\t\t <td colspan='4' class='forumheader'>" . NLLAN_63 . ": " . $subscribers_total_count . "</td>\n\t\t </tr>\n\t\t <tr><td colspan='4' style='text-align:center;'><br /><input class='button' type='submit' value='" . NLLAN_64 . "' /></td></tr>\n\t\t </table></form>\n\t\t "; if ($_nl_sanatized == 1) { $vs_text .= "<br /><div style='text-align:center;'>" . NLLAN_66 . "</div>"; } $this->e107->ns->tablerender(NLLAN_65 . ' ' . $p_id, $vs_text); }
function add_newsletter($data) { $sm = vivvo_lite_site::get_instance(); if ($sm->user) { if ($sm->user->is_admin()) { array_walk($data, 'array_htmlspecialchars'); if ($data['test'] == 1) { if ($data['test_email'] != '') { if (!preg_match("/^[-_a-z0-9]+(\\.[-_a-z0-9]+)*@[-a-z0-9]+(\\.[-a-z0-9]+)*\\.[a-z]{2,6}\$/", $data['test_email'])) { $this->set_error_code(10207); return false; } } else { $this->set_error_code(10208); return false; } } else { if ($data['test_email'] != '') { if (!preg_match("/^[-_a-z0-9]+(\\.[-_a-z0-9]+)*@[-a-z0-9]+(\\.[-a-z0-9]+)*\\.[a-z]{2,6}\$/", $data['test_email'])) { $this->set_error_code(10209); return false; } } } if (!empty($data['groups'])) { $data['groups'] = implode(',', $data['groups']); } elseif ($data['test'] != 1) { $this->set_error_code(10210); return false; } $newsletter = new newsletter(); if ($newsletter->populate($data, true) === false) { return false; } $this->_post_master->set_data_object($newsletter); if ($this->_post_master->sql_insert()) { return $this->_post_master->get_work_id(); } else { $this->set_error_code(10211); return false; } } else { $this->set_error_code(10212); return false; } } else { $this->set_error_code(10213); return false; } }
<?php $nom = filter_input(INPUT_POST, 'nom'); $cognoms = filter_input(INPUT_POST, 'cognoms'); $correu = filter_input(INPUT_POST, 'correu'); $g = filter_input(INPUT_POST, 'g-recaptcha-response'); $response = json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6LfcYgoTAAAAAFbmB7_XbispuYUU6_-ivRyIC5Yq&response=" . $g . "&remoteip=" . $_SERVER['REMOTE_ADDR']), true); if ($response['success'] == false) { echo '<h2>You are spammer ! Get the @$%K out</h2>'; } else { require_once 'classes/newsletter.php'; $u = new newsletter(); if ($u->afegir(utf8_decode($nom), utf8_decode($cognoms), $correu, $_SERVER['REMOTE_ADDR']) != 0) { header('Location: felicitats.php'); } else { echo "Fallo"; } }
<?php require_once 'include/newsletter_model.php'; $mail = new newsletter(); if (isset($_POST['submit'])) { $mail->email = $_POST['email']; $mail->addEmail(); header("location:" . $_SERVER['HTTP_REFERER']); } ?> <section id="newsletter" > <div class="container"> <div class="row "> <div class="col-sm-12 to_animate" data-animation="pullDown"> <h2 class="head-title text-center " >Join Our Newsletter</h2> <p>Sign up to our newsletter and get exclusive deals you wont find anywhere else straight to your inbox!</p> <form method="post" action="newsletter.php"> <input style="width: 50%; margin-left: 0" name="email" type="email" value="enter your email" onfocus="this.value = ''" onblur="this.value = this.value == '' ? 'enter your email' : this.value;" > <p align="center"><input type="submit" value="submit" name="submit" > </p> </form> </div> </div> </div> </section>
<?php $moduleRoot = dirname(__FILE__); require $moduleRoot . 'class.phpmailer.php'; require $moduleRoot . 'class.newsletter.php'; require $moduleRoot . 'easy-mysql-class.php'; $mysql = new mysql('localhost', 'mysqlUser', 'mysqlPassw', 'mysqlDB'); $mysql->connect(); $newsletter = new newsletter(); $newsletter->addMysqlObg($mysql); $data = array('method' => 'SMTP', 'From' => '*****@*****.**', 'FromName' => 'My Name', 'Host' => 'mail.domain.com', 'SMTPAuth' => true, 'Username' => '*****@*****.**', 'Password' => 'password', 'recepientMail' => '*****@*****.**', 'recepientName' => 'Joe Silva', 'subject' => 'Hello friend', 'body' => 'How are you !', 'ContentType' => 'text/html', 'priority' => '3', 'SendDate' => time()); $add = $newsletter->addMail($data); if ($add === false) { echo $newsletter->errorMsg; }