$lsweb = !isset($_GET['lsweb']) || empty($_GET['lsweb']) ? NULL : trim($_GET['lsweb']); # Subscriber Web $lsdate = !isset($_GET['lsdate']) || empty($_GET['lsdate']) ? NULL : trim($_GET['lsdate']); # Subscriber Date $lsphone = !isset($_GET['lsphone']) || empty($_GET['lsphone']) ? NULL : trim($_GET['lsphone']); # Subscriber Phone $lscomp = !isset($_GET['lscomp']) || empty($_GET['lscomp']) ? NULL : trim($_GET['lscomp']); # Subscriber Company /* Check Data */ if ($pkey == '') { jsonRet(false, 'INVALID_ORG_KEY'); } if ($akey == '') { jsonRet(false, 'INVALID_API_KEY'); } if ($lmail == '' || !mailVal($lmail)) { jsonRet(false, 'INVALID_EMAIL'); } if (!in_array($act, $actionList)) { jsonRet(false, 'INVALID_ACTION'); } /* Check Auth */ $opOrg = $myconn->prepare("SELECT * FROM " . db_table_pref . "organizations WHERE public_key=? AND BINARY api_key=?") or die(mysqli_error($myconn)); $opOrg->bind_param('ss', $pkey, $akey); $opOrg->execute(); $opOrg->store_result(); if ($opOrg->num_rows == 0) { $opOrg->close(); jsonRet(false, 'INVALID_ORG'); } else { $sr = new Statement_Result($opOrg);
if (!isset($_POST['subject']) || empty($_POST['subject'])) { $errText .= '* ' . autoresponder_please_enter_a_subject . '<br>'; } if (!isset($_POST['details']) || empty($_POST['details'])) { $errText .= '* ' . autoresponder_please_enter_details . '<br>'; } if (!isset($_POST['alt_details']) || empty($_POST['alt_details'])) { $_POST['alt_details'] = null; } if (!isset($_POST['attach']) || empty($_POST['attach'])) { $_POST['attach'] = null; } if (!isset($_POST['campaign_sender_title']) || empty($_POST['campaign_sender_title'])) { $errText .= '* ' . letheglobal_please_enter_a_sender_title . '<br>'; } if (!isset($_POST['campaign_reply_mail']) || !mailVal($_POST['campaign_reply_mail'])) { $errText .= '* ' . letheglobal_please_enter_a_reply_mail . '<br>'; } if ($errText == '') { /* Org Limit Check */ if (set_org_max_daily_limit != 0) { if (set_org_daily_sent >= set_org_max_daily_limit) { die(errMod(letheglobal_daily_limit_exceeded, 'danger')); } } # Control Submission Account $subAccList = explode(',', set_org_submission_account); $OSMID = 0; if (isset($_POST['subAcc']) && is_numeric($_POST['subAcc'])) { if (in_array(intval($_POST['subAcc']), $subAccList)) { $OSMID = intval($_POST['subAcc']);
$errors .= '* ' . organizations_please_choose_a_unsubscribe_action . '<br>'; } if (!isset($_POST['org_verification']) || !is_numeric($_POST['org_verification'])) { $errors .= '* ' . organizations_please_choose_a_verification_method . '<br>'; } if (!isset($_POST['org_random_load']) || empty($_POST['org_random_load'])) { $_POST['org_random_load'] = 1; } if (!isset($_POST['org_load_type']) || !is_numeric($_POST['org_load_type'])) { $errors .= '* ' . organizations_please_choose_a_load_type . '<br>'; } # Users if (!isset($_POST['usr_name']) || empty($_POST['usr_name'])) { $errors .= '* ' . letheglobal_please_enter_a_name . '<br>'; } if (!isset($_POST['usr_mail']) || !mailVal($_POST['usr_mail'])) { $errors .= '* ' . letheglobal_invalid_e_mail_address . '<br>'; } else { if (cntData("SELECT ID,mail FROM " . $db_prefix . "users WHERE mail='" . mysql_prep($_POST['usr_mail']) . "'") != 0) { $errors .= '* ' . letheglobal_e_mail_already_exists . '<br>'; } } if (!isset($_POST['usr_pass']) || empty($_POST['usr_pass'])) { $errors .= '* ' . letheglobal_please_enter_password . '<br>'; } else { $passLenth = isToo($_POST['usr_pass'], letheglobal_password . ' ', 5, 30); if ($passLenth != '') { $errors .= '* ' . $passLenth . '<br>'; } else { if (!isset($_POST['usr_pass2']) || $_POST['usr_pass2'] != $_POST['usr_pass']) { $errors .= '* ' . letheglobal_passwords_mismatch . '<br>';
} $errText = errMod($subThank, 'success'); } else { # Subscribe Error echo errMod($ads->errPrint, 'danger'); } } } else { if ($saveMod) { # Subscribe $errText = errMod($errText, 'danger'); } else { # Unsubscribe Error # Unsubscribing Action Does Not Require Other Field Validations # But Other Field Errors Will Not Appear! $smail = isset($_POST['LetheForm_Mail']) && mailVal($_POST['LetheForm_Mail']) ? trim($_POST['LetheForm_Mail']) : NULL; $rems = new lethe(); $rems->OID = $srOrg->Get('ID'); $res = $rems->getUnsubscribing($smail, 0, $LETHE_ORG_SETS['set_org_after_unsubscribe']); if ($res) { $errText = errMod(showIn($formErrors[4], 'page') . '!<script>$("#' . $sr->Get('form_id') . '")[0].reset();</script>', 'success'); } else { $errText = errMod('Unsubscribing Error!<script>$("#' . $sr->Get('form_id') . '")[0].reset();</script>', 'success'); } } } } $opForm->close(); } else { $errText = '<div class="alert alert-danger">' . letheglobal_subscribe_form_error . '</div>'; }
function replaceImportContent($fl, $mod, $sep) { $sepMod = array('sep1' => ',', 'sep2' => ';', 'sep3' => "\r\n"); $sep = $sepMod[$sep]; if ($mod == 'model4') { # name{SEPARATOR}mail $new_data = array(); $fl = set_org_resource . '/expimp/' . $fl; $f = file_get_contents($fl); $new_f = explode($sep, $f); $cn = 0; foreach ($new_f as $k => $v) { if (!mailVal($v)) { $new_data[$cn] = '"' . $v . '" '; } else { $new_data[$cn] = $new_data[$cn] . '<' . $v . '>'; $cn++; } } $nwf = implode($sep, $new_data); # Replace Content $myfile = fopen($fl, "w"); fwrite($myfile, $nwf); fclose($myfile); return true; } else { if ($mod == 'model5') { # mail{SEPARATOR}name{SEPARATOR}surname $new_data = array(); $fl = set_org_resource . '/expimp/' . $fl; $f = file_get_contents($fl); $new_f = explode($sep, $f); $cn = 0; $prs = 0; $tempD = ''; foreach ($new_f as $k => $v) { if (mailVal($v) && $prs == 0) { $new_data[$cn] = '<' . $v . '>'; $prs++; } else { if (!mailVal($v) && $prs == 1) { $tempD = $v; $prs++; } else { if (!mailVal($v) && $prs == 2) { $tempD = '"' . $tempD . ' ' . $v . '" '; $new_data[$cn] = $tempD . $new_data[$cn]; $prs = 0; $tempD = ''; $cn++; } } } } $nwf = implode($sep, $new_data); # Replace Content $myfile = fopen($fl, "w"); fwrite($myfile, $nwf); fclose($myfile); return true; } } }
# +------------------------------------------------------------------------+ $errText = ''; if (!isset($pgnt) || !$pgnt) { die; } /* Demo Check */ if (!isDemo('editBlacklist,addRecord')) { $errText = errMod(letheglobal_demo_mode_active, 'danger'); } $sourceLimit = calcSource(set_org_id, 'subscriber.blacklist'); /* Navigation */ $pg_nav_buts = ''; /* Add Record */ if (isset($_POST['addRecord'])) { if (limitBlock($sourceLimit, set_org_max_blacklist)) { if (!isset($_POST['new_rec_mail']) || !mailVal($_POST['new_rec_mail'])) { $errText .= '* ' . letheglobal_invalid_e_mail_address . '<br>'; } else { if (cntData("SELECT ID FROM " . db_table_pref . "blacklist WHERE email='" . mysql_prep($_POST['new_rec_mail']) . "'") != 0) { $errText .= '* ' . letheglobal_e_mail_already_exists . '<br>'; } } if (!isset($_POST['new_rec_ip']) || empty($_POST['new_rec_ip'])) { $_POST['new_rec_ip'] = '0.0.0.0'; } if (!isset($_POST['new_rec_reason']) || !is_numeric($_POST['new_rec_reason'])) { $errText .= '* ' . subscribers_please_choose_a_reason . '<br>'; } if ($errText == '') { $blist = new lethe(); $blist->OID = set_org_id;
$fetchData = $myconnx->query("SELECT * FROM `" . $dbl_pref . $dbl_data['table'] . "` LIMIT {$dtStart},{$limit}") or die(mysqli_error($myconn)); while ($fetchDataRs = $fetchData->fetch_assoc()) { $fname = isset($fetchDataRs[$dbl_data['field_name']]) && $fetchDataRs[$dbl_data['field_name']] != '' ? $fetchDataRs[$dbl_data['field_name']] : ''; $fname2 = isset($fetchDataRs[$dbl_data['field_name2']]) && $fetchDataRs[$dbl_data['field_name2']] != '' ? $fetchDataRs[$dbl_data['field_name2']] : ''; $sub_mail = isset($fetchDataRs[$dbl_data['field_email']]) && $fetchDataRs[$dbl_data['field_email']] != '' ? $fetchDataRs[$dbl_data['field_email']] : 'NULL'; $sub_name = $fname . ($fname != '' ? ' ' . $fname2 : ''); $fullData = array(); $jsonObject = null; # Limit Control if (!limitBlock($sourceCntTemp, set_org_max_subscriber)) { $progPer = 100; $limitExceeded = letheglobal_limit_exceeded; break; } /* Invalid Check */ if (!mailVal($sub_mail)) { $recInv++; } else { /* Check Blacklist */ $mailBLChk->bind_param('s', $sub_mail); $mailBLChk->execute(); $mailBLChk->store_result(); if ($mailBLChk->num_rows == 0) { /* Check Data */ $mailChk->bind_param('s', $sub_mail); $mailChk->execute(); $mailChk->store_result(); if ($mailChk->num_rows == 0) { /* Add Record */ $jsonObject = $sub_mail; /*
', 'success'); $loginSucc = true; } } $LTH->close(); } } } /* Password Reminder */ if (isset($_POST['sendPW'])) { if (DEMO_MODE) { $pwRem = true; $pwrm_res = mysql_prep(errMod(letheglobal_demo_mode_active, 'danger')); } else { $pwRem = true; if (!isset($_POST['pw_rem']) || !mailVal($_POST['pw_rem'])) { $pwrm_res = mysql_prep(errMod(letheglobal_invalid_e_mail_address, 'danger')); } else { $opUser = $myconn->prepare("SELECT * FROM " . db_table_pref . "users WHERE mail=?") or die(mysqli_error($myconn)); $opUser->bind_param('s', $_POST['pw_rem']); $opUser->execute(); $opUser->store_result(); if ($opUser->num_rows < 1) { $pwrm_res = mysql_prep(errMod(letheglobal_record_not_found, 'danger')); } else { $srm = new Statement_Result($opUser); $opUser->fetch(); # Load phpMailer basic mail sender # Start /* Design Receiver Data (Mail body could be used with system template) */ $rndPassEnc = encr('myLethe' . time() . rand() . uniqid(true));
} else { $sr = new Statement_Result($opSub); $opSub->fetch(); /* Update Subscriber */ if (!isDemo('uptSubscriber')) { die(errMod(letheglobal_demo_mode_active, 'danger')); } $errText = ''; if (isset($_POST['uptSubscriber'])) { if (!isset($_POST['group']) || !is_numeric($_POST['group'])) { $errText .= '* ' . subscribers_please_choose_a_group . '<br>'; } if (!isset($_POST['subscriber_name']) || empty($_POST['subscriber_name'])) { $_POST['subscriber_name'] = NULL; } if (!isset($_POST['subscriber_mail']) || !mailVal($_POST['subscriber_mail'])) { $errText .= '* ' . letheglobal_invalid_e_mail_address . '<br>'; } else { if (cntData("SELECT ID FROM " . db_table_pref . "subscribers WHERE OID=" . set_org_id . " AND subscriber_mail='" . mysql_prep($sr->Get('subscriber_mail')) . "' AND ID<>" . $sr->Get('ID') . "") != 0) { $errText .= '* ' . letheglobal_e_mail_already_exists . '<br>'; } } if (!isset($_POST['subscriber_web']) || empty($_POST['subscriber_web'])) { $_POST['subscriber_web'] = NULL; } if (!isset($_POST['subscriber_date']) || empty($_POST['subscriber_date'])) { $_POST['subscriber_date'] = NULL; } else { $_POST['subscriber_date'] = str_replace('/', '-', $_POST['subscriber_date']); $_POST['subscriber_date'] = date('Y-m-d H:i:s', strtotime($_POST['subscriber_date'])); }
public function getUnsubscribing($smail, $CID = 0, $typ) { global $myconn; # typ 0 - Mark It Inactive # typ 1 - Force Remove # typ 2 - Move to Unsubscribe $keyOrMail = !mailVal($smail) ? false : true; # true is mail control # Check Record Availability $chkRec = $myconn->prepare("SELECT * FROM " . db_table_pref . "subscribers WHERE OID=" . $this->OID . " AND " . ($keyOrMail ? 'subscriber_mail' : 'subscriber_key') . "=?") or die(mysqli_error($myconn)); $chkRec->bind_param('s', $smail); $chkRec->execute(); $chkRec->store_result(); if ($chkRec->num_rows == 0) { $chkRec->close(); return false; } else { $srUns = new Statement_Result($chkRec); $chkRec->fetch(); $chkRec->close(); } if ($typ == 0) { # If Action is Campaign, Subscriber Will Add to Unsubscribe Reports Table $myconn->query("UPDATE " . db_table_pref . "subscribers SET subscriber_active=0 WHERE ID=" . intval($srUns->Get('ID')) . "") or die(mysqli_error($myconn)); if ($CID != 0) { $chkTbl = $myconn->prepare("SELECT * FROM " . db_table_pref . "unsubscribes WHERE OID=" . $this->OID . " AND CID=? AND subscriber_mail=?") or die(mysqli_error($myconn)); $chkTbl->bind_param('is', $CID, $smail); $chkTbl->execute(); $chkTbl->store_result(); if ($chkTbl->num_rows == 0) { $addUns = $myconn->prepare("INSERT INTO " . db_table_pref . "unsubscribes SET OID=" . $this->OID . ", CID=?, subscriber_mail=?, add_date='" . date('Y-m-d H:i:s') . "'") or die(mysqli_error($myconn)); $addUns->bind_param('is', $CID, $smail); $addUns->execute(); $addUns->close(); } $chkTbl->close(); } return true; } else { if ($typ == 1) { # If Action is Campaign, Subscriber Will Add to Unsubscribe Reports Table $smail = $srUns->Get('subscriber_mail'); $this->removeSubscription($smail); if ($CID != 0) { $chkTbl = $myconn->prepare("SELECT * FROM " . db_table_pref . "unsubscribes WHERE OID=" . $this->OID . " AND CID=? AND subscriber_mail=?") or die(mysqli_error($myconn)); $chkTbl->bind_param('is', $CID, $smail); $chkTbl->execute(); $chkTbl->store_result(); if ($chkTbl->num_rows == 0) { $addUns = $myconn->prepare("INSERT INTO " . db_table_pref . "unsubscribes SET OID=" . $this->OID . ", CID=?, subscriber_mail=?, add_date='" . date('Y-m-d H:i:s') . "'") or die(mysqli_error($myconn)); $addUns->bind_param('is', $CID, $smail); $addUns->execute(); $addUns->close(); } $chkTbl->close(); } return true; } else { if ($typ == 2) { # If Action is Campaign, Subscriber Will Add to Unsubscribe Reports Table $opGrp = $myconn->query("SELECT * FROM " . db_table_pref . "subscriber_groups WHERE OID=" . $this->OID . " AND isUnsubscribe=1") or die(mysqli_error($myconn)); if (mysqli_num_rows($opGrp) == 0) { $opGrp->free(); return false; } else { $opGrpRs = $opGrp->fetch_assoc(); $GRP = $opGrpRs['ID']; $myconn->query("UPDATE " . db_table_pref . "subscribers SET GID=" . $GRP . " WHERE ID=" . intval($srUns->Get('ID')) . "") or die(mysqli_error($myconn)); if ($CID != 0) { $chkTbl = $myconn->prepare("SELECT * FROM " . db_table_pref . "unsubscribes WHERE OID=" . $this->OID . " AND CID=? AND subscriber_mail=?") or die(mysqli_error($myconn)); $chkTbl->bind_param('is', $CID, $smail); $chkTbl->execute(); $chkTbl->store_result(); if ($chkTbl->num_rows == 0) { $addUns = $myconn->prepare("INSERT INTO " . db_table_pref . "unsubscribes SET OID=" . $this->OID . ", CID=?, subscriber_mail=?, add_date='" . date('Y-m-d H:i:s') . "'") or die(mysqli_error($myconn)); $addUns->bind_param('is', $CID, $smail); $addUns->execute(); $addUns->close(); } $chkTbl->close(); } $opGrp->free(); return true; } } } } }