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); }
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); }