print '</p>'; if ($_GET['type'] == 'dl') { ob_end_clean(); Header("Content-type: text/plain"); $filename = 'Bounces on ' . listName($listid); header("Content-disposition: attachment; filename=\"{$filename}\""); } $currentlist = 0; $ls = new WebblerListing(''); while ($row = Sql_Fetch_Array($req)) { if ($currentlist != $row['listid']) { if ($_GET['type'] != 'dl') { print $ls->display(); } $currentlist = $row['listid']; flush(); $ls = new WebblerListing(listName($row['listid'])); } $userdata = Sql_Fetch_Array_Query(sprintf('select * from %s where id = %d', $GLOBALS['tables']['user'], $row['userid'])); if ($_GET['type'] == 'dl') { print $userdata['email'] . "\n"; } $ls->addElement($row['userid'], PageUrl2('user&id=' . $row['userid'])); $ls->addColumn($row['userid'], $GLOBALS['I18N']->get('email'), $userdata['email']); $ls->addColumn($row['userid'], $GLOBALS['I18N']->get('# bounces'), $row['numbounces']); } if ($_GET['type'] != 'dl') { print $ls->display(); } else { exit; }
} else { Sql_query(sprintf('delete from %s where userid = %d', $GLOBALS["tables"]["listuser"], $userid)); } $lists = ""; if (is_array($_POST["list"])) { while (list($key, $val) = each($_POST["list"])) { if ($val == "signup") { $result = Sql_query("replace into {$GLOBALS["tables"]["listuser"]} (userid,listid,entered) values({$userid},{$key},now())"); # $lists .= " * ".$_POST["listname"][$key]."\n"; } } } # check list membership $req = Sql_Query(sprintf('select * from %s listuser,%s list where listuser.userid = %d and listuser.listid = list.id and list.active', $GLOBALS['tables']['listuser'], $GLOBALS['tables']['list'], $userid)); while ($row = Sql_Fetch_Array($req)) { $lists .= " * " . listName($row['listid']) . "\n"; } if ($lists == "") { $lists = "No Lists"; } if ($lists == "") { $lists = "No Lists"; } $datachange .= "{$strEmail} : " . $email . "\n"; if ($subscribepagedata["htmlchoice"] != "textonly" && $subscribepagedata["htmlchoice"] != "htmlonly") { $datachange .= "{$strSendHTML} : "; $datachange .= $_POST["htmlemail"] ? "{$strYes}\n" : "{$strNo}\n"; } $rssfrequency = validateRssFrequency($_POST['rssfrequency']); if ($rssfrequency) { $datachange .= "{$strFrequency} : " . $rssfrequency . "\n";
$current_data = array_merge($current_data, getUserAttributeValues('', $userid)); foreach ($current_data as $key => $val) { if (!is_numeric($key)) { if (isset($old_data[$key]) && $old_data[$key] != $val && $key != 'modified') { $history_entry .= "{$key} = {$val}\nchanged from {$old_data[$key]}\n"; } } } if (!$history_entry) { $history_entry = "\n" . $GLOBALS['I18N']->get('No data changed'); } # check lists $listmembership = array(); $req = Sql_Query("select * from {$tables['listuser']} where userid = {$userid}"); while ($row = Sql_Fetch_Array($req)) { $listmembership[$row['listid']] = listName($row['listid']); } $history_entry .= "\n" . $GLOBALS['I18N']->get('List subscriptions:') . "\n"; foreach ($old_listmembership as $key => $val) { $history_entry .= $GLOBALS['I18N']->get('Was subscribed to:') . " {$val}\n"; } foreach ($listmembership as $key => $val) { $history_entry .= $GLOBALS['I18N']->get('Is now subscribed to:') . " {$val}\n"; } if (!count($listmembership)) { $history_entry .= $GLOBALS['I18N']->get('Not subscribed to any lists') . "\n"; } addUserHistory($email, $GLOBALS['I18N']->get('Import by ') . adminName(), $history_entry); } // end if }
Sql_query(sprintf('delete from %s where userid = %d', $GLOBALS['tables']['listuser'], $userid)); } $lists = ''; if (is_array($_POST['list'])) { while (list($key, $val) = each($_POST['list'])) { if ($val == 'signup') { $result = Sql_query("replace into {$GLOBALS['tables']['listuser']} (userid,listid,entered) values({$userid},{$key},now())"); # $lists .= " * ".$_POST["listname"][$key]."\n"; } } } # check list membership $subscriptions = array(); $req = Sql_Query(sprintf('select * from %s listuser,%s list where listuser.userid = %d and listuser.listid = list.id and list.active', $GLOBALS['tables']['listuser'], $GLOBALS['tables']['list'], $userid)); while ($row = Sql_Fetch_Array($req)) { $lists .= ' * ' . listName($row['listid']) . "\n"; array_push($subscriptions, $row['listid']); } if ($lists == '') { $lists = 'No Lists'; } if ($lists == '') { $lists = 'No Lists'; } # We want all these to be set, albeit to empty string foreach (array('datachange', 'htmlemail', 'information_changed', 'emailchanged') as $sUnsubscribeVar) { if (!isset(${$sUnsubscribeVar})) { ${$sUnsubscribeVar} = ''; } } $datachange .= "{$strEmail} : " . $email . "\n";
$history_entry .= "\nNo user details changed"; } addUserHistory($user["systemvalues"]["email"], "Import by " . adminName(), $history_entry); } #add this user to the lists identified, except when they are blacklisted $isBlackListed = isBlackListed($user["systemvalues"]["email"]); if (!$isBlackListed && is_array($_SESSION["lists"])) { reset($_SESSION["lists"]); $addition = 0; $listoflists = ""; while (list($key, $listid) = each($_SESSION["lists"])) { $query = "replace INTO " . $tables["listuser"] . " (userid,listid,entered) values({$userid},{$listid},now())"; $result = Sql_query($query, 1); # if the affected rows is 2, the user was already subscribed $addition = $addition || Sql_Affected_Rows() == 1; $listoflists .= " * " . listName($key) . "\n"; # $_SESSION["listname"][$key] . "\n"; } if ($addition) { $count["list_add"]++; } if (!TEST && $_SESSION["notify"] == "yes" && $addition) { $subscribemessage = str_replace('[LISTS]', $listoflists, getUserConfig("subscribemessage", $userid)); if (function_exists('sendmail')) { sendMail($user["systemvalues"]["email"], getConfig("subscribesubject"), $subscribemessage, system_messageheaders(), $envelope); if (isset($_SESSION["throttle_import"])) { sleep($_SESSION["throttle_import"]); } } } } elseif ($isBlackListed) {
Sql_query("delete from {$tables["listuser"]} where listid = {$id} and userid =\n {$user['0']}"); Sql_query("replace into {$tables["listuser"]} (listid,userid)\n values({$_POST["movedestination_all"]},{$user['0']})"); if (Sql_Affected_rows() == 1) { # 2 means they were already on the list $cnt++; } } $msg = $cnt . ' ' . $GLOBALS['I18N']->get("users were moved to") . ' ' . listName($_POST["movedestination_all"]); break; case "copy": $cnt = 0; while ($user = Sql_Fetch_Row($req)) { Sql_query("replace into {$tables["listuser"]} (listid,userid)\n values({$_POST["copydestination_all"]},{$user['0']})"); $cnt++; } $msg = $cnt . ' ' . $GLOBALS['I18N']->get("users were copied to") . ' ' . listName($_POST["copydestination_all"]); break; case "delete": Sql_Query(sprintf('delete from %s where listid = %d', $tables["listuser"], $id)); $msg = Sql_Affected_Rows() . ' ' . $GLOBALS['I18N']->get("users were deleted from this list"); break; default: # do nothing } } print '<font class="info">' . $msg . '</font><br/>'; } if (isset($_POST["add"])) { if ($_POST["new"]) { $result = Sql_query(sprintf('select * from %s where email = "%s"', $tables["user"], $_POST["new"])); if (Sql_affected_rows()) {
$current_data = Sql_Fetch_Array_Query(sprintf('select * from %s where id = %d', $tables["user"], $userid)); $current_data = array_merge($current_data, getUserAttributeValues('', $userid)); foreach ($current_data as $key => $val) { if (!is_numeric($key)) { if ($old_data[$key] != $val && $key != "modified") { $history_entry .= "{$key} = {$val}\nchanged from {$old_data[$key]}\n"; } } } if (!$history_entry) { $history_entry = "\n" . $GLOBALS['I18N']->get('no_data_changed'); } # check lists $req = Sql_Query("select * from {$tables["listuser"]} where userid = {$userid}"); while ($row = Sql_Fetch_Array($req)) { $listmembership[$row["listid"]] = listName($row["listid"]); } $history_entry .= "\n" . $GLOBALS['I18N']->get('lists_subscriptions') . "\n"; foreach ($old_listmembership as $key => $val) { $history_entry .= $GLOBALS['I18N']->get('was_subscribed') . " {$val}\n"; } foreach ($listmembership as $key => $val) { $history_entry .= $GLOBALS['I18N']->get('is_subscribed') . " {$val}\n"; } if (!sizeof($listmembership)) { $history_entry .= $GLOBALS['I18N']->get('not_subscribed') . "\n"; } addUserHistory($email, $GLOBALS['I18N']->get('import_by') . adminName(), $history_entry); } // end if }
} $listselect_where = ''; $listselect_and = ''; break; case 'none': default: $querytables = $GLOBALS['tables']['user'] . ' user'; $subselect = ' and user.id = 0'; $listselect_where = ' where owner = 0'; $listselect_and = ' and owner = 0'; break; } if (!$list) { $filename = $GLOBALS['I18N']->get('PHPList Users') . ' ' . date("Y-M-d") . '.csv'; } else { $filename = $GLOBALS['I18N']->get('PHPList Users') . ' ' . $GLOBALS['I18N']->get('on') . ' ' . listName($list) . ' ' . date("Y-M-d") . '.csv'; } ob_end_clean(); header("Content-type: " . $GLOBALS["export_mimetype"]); header("Content-disposition: attachment; filename=\"{$filename}\""); $cols = array(); while (list($key, $val) = each($DBstruct["user"])) { if (!ereg("sys:", $val[1])) { print $val[1] . "\t"; array_push($cols, $key); } elseif (ereg("sysexp:(.*)", $val[1], $regs)) { print $regs[1] . "\t"; array_push($cols, $key); } } $res = Sql_Query("select id,name,tablename,type from {$tables['attribute']}");
echo s('When they subscribed to'); ?> <?php if (empty($list)) { print '<select name="list">'; $req = Sql_Query(sprintf('select * from %s %s', $GLOBALS['tables']['list'], $listselect_where)); while ($row = Sql_Fetch_Array($req)) { printf('<option value="%d">%s</option>', $row['id'], $row['name']); } print '</select>'; } else { printf('<input type="hidden" name="list" value="%d" />', $list); print '<strong>' . listName($list) . '</strong><br/><br/>'; } ?> <div id="exportdates"> <?php echo $GLOBALS['I18N']->get('Date From:'); ?> <?php echo $from->showInput("", "", $fromdate); echo $GLOBALS['I18N']->get('Date To:'); ?> <?php echo $to->showInput("", "", $todate); ?> </div>
$start = empty($_GET['start']) ? 0 : sprintf('%d', $_GET['start']); if ($total > $numpp && !$download) { # print Paging2('listbounces&id='.$listid,$total,$numpp,'Page'); # $listing = sprintf($GLOBALS['I18N']->get("Listing %s to %s"),$s,$s+$numpp); $limit = "limit {$start}," . $numpp; print simplePaging('listbounces&id=' . $listid, $start, $total, $numpp); $query .= $limit; $req = Sql_Query($query); } if ($download) { ob_end_clean(); Header('Content-type: text/plain'); $filename = 'Bounces on ' . listName($listid); header("Content-disposition: attachment; filename=\"{$filename}\""); } $ls = new WebblerListing($GLOBALS['I18N']->get('Bounces on') . ' ' . listName($listid)); $ls->noShader(); while ($row = Sql_Fetch_Array($req)) { $userdata = Sql_Fetch_Array_Query(sprintf('select * from %s where id = %d', $GLOBALS['tables']['user'], $row['userid'])); if (!empty($userdata['email'])) { if ($download) { print $userdata['email'] . "\n"; } else { $ls->addElement($row['userid'], PageUrl2('user&id=' . $row['userid'])); $ls->addColumn($row['userid'], s('address'), $userdata['email']); $ls->addColumn($row['userid'], s('# bounces'), PageLink2('userhistory&id=' . $row['userid'], $row['numbounces'])); } } } if (!$download) { print $ls->display();
Sql_query(sprintf('delete from %s where listid = %d and userid = %d', $tables['listuser'], $id, $user[0])); Sql_query(sprintf('replace into %s (listid,userid) values(%d,%d)', $tables['listuser'], $_POST['movedestination_all'], $user[0])); if (Sql_Affected_rows() == 1) { # 2 means they were already on the list ++$cnt; } } $msg = $cnt . ' ' . $GLOBALS['I18N']->get('subscribers were moved to') . ' ' . listName($_POST['movedestination_all']); break; case 'copy': $cnt = 0; while ($user = Sql_Fetch_Row($req)) { Sql_query(sprintf('replace into %s (listid,userid) values(%d,%d)', $tables['listuser'], $_POST['copydestination_all'], $user[0])); ++$cnt; } $msg = $cnt . ' ' . $GLOBALS['I18N']->get('subscribers were copied to') . ' ' . listName($_POST['copydestination_all']); break; case 'delete': Sql_Query(sprintf('delete from %s where listid = %d', $tables['listuser'], $id)); $msg = Sql_Affected_Rows() . ' ' . $GLOBALS['I18N']->get('subscribers were deleted from this list'); break; default: # do nothing } } print '<div class="actionresult">' . $msg . '</div>'; } if ($listAll) { print '<p>' . s('The "list of all subscribers" is not a real list, but it gives you access to all subscribers in your system. There may be more subscribers in your system than are members of your lists.') . '</p>'; } if (isset($_POST['add'])) {
$history_entry .= "\nNo user details changed"; } addUserHistory($user['systemvalues']['email'], 'Import by ' . adminName(), $history_entry); } #add this user to the lists identified, except when they are blacklisted $isBlackListed = isBlackListed($user['systemvalues']['email']); if (!$isBlackListed && is_array($_SESSION['lists'])) { reset($_SESSION['lists']); $addition = 0; $listoflists = ''; while (list($key, $listid) = each($_SESSION['lists'])) { $query = 'replace INTO ' . $tables['listuser'] . " (userid,listid,entered) values({$userid},{$listid},now())"; $result = Sql_query($query, 1); # if the affected rows is 2, the user was already subscribed $addition = $addition || Sql_Affected_Rows() == 1; $listoflists .= ' * ' . listName($key) . "\n"; # $_SESSION["listname"][$key] . "\n"; } if ($addition) { ++$count['list_add']; } if (!TEST && $_SESSION['notify'] == 'yes' && $addition) { $subscribemessage = str_replace('[LISTS]', $listoflists, getUserConfig('subscribemessage', $userid)); if (function_exists('sendmail')) { sendMail($user['systemvalues']['email'], getConfig('subscribesubject'), $subscribemessage, system_messageheaders(), $envelope); if (isset($_SESSION['throttle_import'])) { sleep($_SESSION['throttle_import']); } } } } elseif ($isBlackListed) {
$user[0]"); Sql_query("replace into {$tables["listuser"]} (listid,userid) values($movedestination_all,$user[0])"); if (Sql_Affected_rows() == 1) # 2 means they were already on the list $cnt++; } $msg = $cnt . ' users were moved to '.listName($movedestination_all); break; case "copy": $cnt = 0; while ($user = Sql_Fetch_Row($req)) { Sql_query("replace into {$tables["listuser"]} (listid,userid) values($copydestination_all,$user[0])"); $cnt++; } $msg = $cnt .' users were copied to '.listName($copydestination_all); break; case "delete": Sql_Query(sprintf('delete from %s where listid = %d',$tables["listuser"],$id)); $msg = Sql_Affected_Rows().' users were deleted from this list'; break; default: # do nothing } } print '<font class="info">'.$msg.'</font><br/>'; } if (isset($add)) { if ($new) { $result = Sql_query("select * from {$tables["user"]} where email = \"$new\""); if (Sql_affected_rows()) {
} $value = implode(',', $newval); } else { $value = ''; } Sql_Query(sprintf('replace into %s (userid,attributeid,value) values(%d,%d,"%s")', $tables['user_attribute'], $id, $val, $value)); } } $new_lists = array_values($_POST['subscribe']); $new_subscriptions = array(); array_shift($new_lists); // remove dummy foreach ($new_lists as $list) { $listID = sprintf('%d', $list); $new_subscriptions[$listID] = listName($listID); } $subscribed_to = array_diff_assoc($new_subscriptions, $old_listmembership); $unsubscribed_from = array_diff_assoc($old_listmembership, $new_subscriptions); # submitting page now saves everything, so check is not necessary if ($subselect == '') { foreach ($unsubscribed_from as $listId => $listName) { Sql_Query(sprintf('delete from %s where userid = %d and listid = %d', $tables['listuser'], $id, $listId)); $feedback .= '<br/>' . sprintf(s('Subscriber removed from list %s'), $listName); } } elseif (count($unsubscribed_from)) { # only unsubscribe from the lists of this admin $req = Sql_Query("select id,name from {$tables['list']} {$subselect_where} and id in (" . implode(',', array_keys($unsubscribed_from)) . ')'); while ($row = Sql_Fetch_Row($req)) { Sql_Query("delete from {$tables['listuser']} where userid = {$id} and listid = {$row['0']}"); $feedback .= '<br/>' . sprintf(s('Subscriber removed from list %s'), $row[1]);