Пример #1
0
function GetLogonDetails($con, $username, $params = "", $roleclause = "1=1")
{
    $userrow = SqlResultArray($con, "\n            SELECT primaryEmail,firstName,lastName\n            FROM ctcweb9_ctc.members             m\n            LEFT JOIN ctcweb9_ctc.members_roles  mr  on mr.memberid = m.id\n            LEFT JOIN ctcweb9_ctc.roles          r   on r.id = mr.roleid\n            where loginname = " . SqlVal($username["name"]) . " and {$roleclause}");
    if (count($userrow)) {
        return array("userid" => $username["id"], "username" => $username["name"], "email" => $userrow[0]["primaryEmail"], "firstname" => $userrow[0]["firstName"], "lastname" => $userrow[0]["lastName"]);
    } else {
        die("You are either not logged on or not an authorised email moderator.");
    }
}
Пример #2
0
function MailChimpUpdateLists($con)
{
    $lists = MailChimpRequest("lists/list");
    $listids = array();
    foreach ($lists['data'] as &$list) {
        $id = $list['id'];
        $name = SqlVal($list['name']);
        $listids[] = "'{$id}'";
        SqlExecOrDie($con, "insert into ctcweb9_ctc.mailchimp_lists(listid,listname)\n                   values('{$id}',{$name})\n                   on duplicate key update listname = {$name} ");
    }
    $listids = implode(",", $listids);
    SqlExecOrDie($con, "delete from ctcweb9_ctc.mailchimp_subscriptions where listid not in ( {$listids} )");
    SqlExecOrDie($con, "delete from ctcweb9_ctc.mailchimp_lists         where listid not in ( {$listids} )");
}
Пример #3
0
 }
 $raw = "ctc-id: " . str_replace("-", "", MakeGuid()) . "\n" . file_get_contents("{$dir}/{$file}");
 $msg = new PlancakeEmailParser($raw);
 $msgid = preg_replace('/,.*$/', "", $file);
 $from = $msg->getHeader("From");
 $subject = $msg->getHeader("Subject");
 $ctcid = $msg->getHeader("ctc-id");
 $body = GetHtmlFromMessage($msg);
 $css = ModerationConfig::GetCss();
 $step2Url = $live_site . "/" . ModerationConfig::Step2Url;
 $step2ImageUrl = $live_site . "/" . ModerationConfig::Step2DirectUrl;
 $lists = SqlResultArray($con, "select listid, listname from ctcweb9_ctc.mailchimp_lists");
 $headers = "MIME-Version: 1.0\r\n" . "Content-type: text/html;charset=UTF-8\r\n" . "From: <" . ModerationConfig::SrcName . "@" . ModerationConfig::SrcDomain . ">\r\n";
 $sender = ModerationConfig::SrcName . "@" . ModerationConfig::SrcDomain;
 echo "\t<table>\n\t\t\t<tr><th>msgid</th><td>{$msgid}</td>\n\t\t\t<tr><th>ctcid</th><td>{$ctcid}</td>\n\t\t\t<tr><th>Body</th><td>{$body}</td>";
 $moderators = SqlResultArray($con, "\n\t\t\tselect memberid, primaryemail, firstname, lastname\n\t\t\tfrom ctcweb9_ctc.members m\n\t\t\tjoin ctcweb9_ctc.members_roles mr on mr.memberid = m.id \n\t\t\tjoin ctcweb9_ctc.roles r on r.id = mr.roleid and r.role = " . SqlVal(ModerationConfig::ModeratorRoleName) . "");
 foreach ($moderators as $moderator) {
     $modid = $moderator["memberid"];
     $modemail = $moderator["primaryemail"];
     $modname = "{$moderator['firstname']} {$moderator['lastname']}";
     $props = " width='" . $css[".action"]["width"] . "px' \n\t\t\t\t   height='" . $css[".action"]["height"] . "px' target='ctcwindow' ";
     $th = "th style='border:solid 1px gray;'";
     $td = "td style='border:solid 1px gray;'";
     $modbody = "\t<p>" . ModerationConfig::Step1Preamble . "</p>\n\t\t\t\t\t<table style='border-collapse:collapse'>\n\t\t\t\t\t<tr><{$th}>Original Sender</th><{$td}>" . htmlentities($from) . "</td></tr>\n\t\t\t\t\t<tr><{$th}>Original Subject</th><{$td}>" . htmlentities($subject) . "</td></tr>\n\t\t\t\t\t<tr><{$th}>Original Body</th><{$td}>{$body}</td></tr>\n\t\t\t\t\t<tr><{$th}>Options</th><{$td}>";
     foreach ($lists as $list) {
         $args = array("action" => "sending", "msgid" => $msgid, "ctcid" => $ctcid, "modid" => $modid, "listid" => $list["listid"]);
         $title = "Click to send to the " . $list["listname"] . " list";
         $modbody .= "<a href='{$step2Url}?" . http_build_query($args) . "'>\n\t\t\t\t                  <img src='{$step2ImageUrl}?img=1&" . http_build_query($args) . "' {$props} title='" . htmlentities($title) . "'/></a><br/>";
     }
     $args = array("action" => "edit", "msgid" => $msgid, "ctcid" => $ctcid, "modid" => $modid);
     $title = "Click to edit before sending";
Пример #4
0
require_once 'mailchimp.inc.php';
$getpost = $_GET["action"] == null ? $_POST : $_GET;
//var_dump($getpost);
$isImg = intval($getpost["img"]) == 1;
$action = strval($getpost["action"]);
$prevaction = strval($getpost["prevaction"]);
$msgid = strval($getpost["msgid"]);
$ctcid = strval($getpost["ctcid"]);
$modid = strval($getpost["modid"]);
$listid = strval($getpost["listid"]);
$editedsubject = strval($getpost["editedsubject"]);
$editedbody = strval($getpost["editedbody"]);
$editedfrom = strval($getpost["editedfrom"]);
if (!$isImg) {
    // Do this now before anything gets changed
    GetLogonDetails($con, $username, $params, "role = " . SqlVal(ModerationConfig::ModeratorRoleName));
}
$unmoderateddir = ModerationConfig::GetUnmoderatedDir() . "/cur/{$msgid},*";
$moderateddir = ModerationConfig::GetModeratedDir() . "/cur/{$msgid},*";
$files = array_merge(glob($unmoderateddir), glob($moderateddir));
$location = count($files) == 0 ? null : (strpos($files[0], ModerationConfig::GetUnmoderatedDir()) === 0 ? "unmoderated" : (strpos($files[0], ModerationConfig::GetModeratedDir()) === 0 ? "moderated" : null));
if ($location != null) {
    $raw = file_get_contents($files[0]);
    $msg = new PlancakeEmailParser($raw);
    //var_dump($ctcid, $msg);
    $ctcaction = $msg->getHeader("ctc-action");
    $msg = $msg == null || $ctcid != $msg->getHeader("ctc-id") ? null : $msg;
}
if ($listid != "") {
    $query = SqlResultArray($con, "select listname from ctcweb9_ctc.mailchimp_lists where listid = '{$listid}'");
    $listname = $query[0]["listname"];