die; } } else { # Campaign Continues # Reset All Data and Update New Cron Date # New Launch Date $genDate = date('Y-m-d H:i:s', strtotime(date("Y-m-d H:i:s") . " +" . $opArDataRs['ar_time'] . " " . $opArDataRs['ar_time_type'] . "")); # New Finish Date $difference = dateDiff(strtotime($opCampRs['launch_date']), strtotime($opArDataRs['ar_end_date'])); $genFinDate = date('Y-m-d H:i:s', strtotime(date("Y-m-d H:i:s") . " +" . $difference . "")); $myconn->query("UPDATE " . db_table_pref . "campaigns SET campaign_pos=0,launch_date='" . $genDate . "' WHERE OID=" . $orgSets['set_ID'] . " AND ID = " . $opCampRs['ID'] . "") or die(mysqli_error($myconn)); $myconn->query("UPDATE " . db_table_pref . "campaign_ar SET ar_end_date='" . $genFinDate . "' WHERE OID=" . $orgSets['set_ID'] . " AND CID = " . $opCampRs['ID'] . "") or die(mysqli_error($myconn)); # Remove Old Cron $myconn->query("UPDATE " . db_table_pref . "chronos SET pos=1 WHERE OID=" . $orgSets['set_ID'] . " AND CID = " . $opCampRs['ID'] . "") or die(mysqli_error($myconn)); # Add New Cron $buildCron = new lethe(); $buildCron->chronosMin = "*"; $buildCron->chronosURL = "'" . lethe_root_url . 'chronos/lethe.tasks.php?ID=' . $opCampRs['ID'] . "' > /dev/null 2>&1"; $genComm = $buildCron->buildChronos(); $addCron = $myconn->prepare("INSERT INTO " . db_table_pref . "chronos SET OID=" . $orgSets['set_ID'] . ", CID=" . $opCampRs['ID'] . ", pos=0, cron_command=?, launch_date=?"); $addCron->bind_param('ss', $genComm, $genDate); $addCron->execute(); $addCron->close(); # Remove Datas $myconn->query("DELETE FROM " . db_table_pref . "tasks WHERE OID=" . $orgSets['set_ID'] . " AND CID = " . $opCampRs['ID'] . "") or die(mysqli_error($myconn)); $myconn->query("DELETE FROM " . db_table_pref . "reports WHERE OID=" . $orgSets['set_ID'] . " AND CID = " . $opCampRs['ID'] . "") or die(mysqli_error($myconn)); # Close Phase For New Settings die; } # AR 2 Settings End }
# | Copyright (c) Artlantis Design Studio 2014. All rights reserved. | # | Version 2.0 | # | Last modified 01.01.2015 | # | Email developer@artlantis.net | # | Web http://www.artlantis.net | # +------------------------------------------------------------------------+ if (!isset($pgnt)) { die('You are not authorized to view this page!'); } /* Demo Check */ if (!isDemo('saveSets')) { $errText = errMod(letheglobal_demo_mode_active, 'danger'); } /* Save Settings */ if (isset($_POST['saveSets'])) { $letheSets = new lethe(); $letheSets->letheSettings(); $errText = $letheSets->errPrint; } echo $errText; ?> <form name="genSets" id="genSets" action="" method="POST"> <div role="tabpanel"> <!-- Nav tabs --> <ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active"><a href="#general" aria-controls="general" role="tab" data-toggle="tab"><?php echo letheglobal_general_settings; ?> </a></li>
function rss_filter($v) { $v = showIn($v, 'page'); $v = clearSCs($v); # Short Code Formatting $scr = new lethe(); $rss_str = $scr->shortReplaces(array($v)); $rss_str = '<![CDATA[' . $rss_str[0] . ']]>'; return $rss_str; }
$errText = errMod(letheglobal_demo_mode_active, 'danger'); } $ID = !isset($_GET['ID']) || intval($_GET['ID']) == 0 ? 0 : intval($_GET['ID']); /* Actions */ if (isset($_POST['addUser'])) { # New User $myLethe = new lethe(); $myLethe->OID = 0; $myLethe->isMaster = 1; $myLethe->auth_mode = 2; $myLethe->addUser(); $errText = $myLethe->errPrint; } if (isset($_POST['editUser'])) { # Edit User $myLethe = new lethe(); $myLethe->OID = 0; $myLethe->UID = $ID; $myLethe->isMaster = 1; $myLethe->auth_mode = 2; $myLethe->editUser(); $errText = $myLethe->errPrint; } ?> <?php if ($page_sub2 == 'add') { echo '<h1>' . $pg_title . '<span class="help-block"><span class="text-primary">' . settings_add_user . '</span></span></h1><hr>' . $pg_nav_buts . $errText; ?> <!-- ADD USER START --> <form name="addNewUser" method="POST" action=""> <div class="form-group">
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']); } else { $OSMID = $subAccList; } } # Start $sendMail = new lethe(); $sendMail->OID = set_org_id; $sendMail->OSMID = $OSMID; $sendMail->sub_from_title = showIn($_POST['campaign_sender_title'], 'page'); $sendMail->sub_reply_mail = showIn($_POST['campaign_reply_mail'], 'page'); $sendMail->sub_test_mail = showIn(set_org_test_mail, 'page'); $sendMail->sub_mail_attach = $_POST['attach']; $sendMail->orgSubInit(); # Load Submission Settings $sendMail->sub_mail_id = md5(set_org_test_mail); /* Short Code Replace */ $replaced = $sendMail->shortReplaces(array($_POST['subject'], $_POST['details'], $_POST['alt_details'])); $_POST['subject'] = $replaced[0]; $_POST['details'] = $replaced[1]; $_POST['alt_details'] = $replaced[2]; /* Design Receiver Data */
$ID = LETHE_AUTH_ORG_PRIVATE; } if ($page_sub2 == 'add') { if (!PRO_MODE) { header('Location: ?p=organizations/organization/edit'); } } /* Add */ if (isset($_POST['addOrganization'])) { $lethe = new lethe(); $lethe->addOrganization(); $errText = $lethe->errPrint; } /* Edit */ if (isset($_POST['editOrganization'])) { $lethe = new lethe(); $lethe->OID = LETHE_AUTH_MODE != 2 ? set_org_id : $ID; $lethe->editOrganization(); $errText = $lethe->errPrint; } $pg_nav_buts = '<div class="nav-buts"> <a href="?p=organizations/organization" class="btn btn-primary">' . letheglobal_list . '</a> </div> '; ?> <?php if ($page_sub2 == '') { #List /* Super Admin Check */ if (LETHE_AUTH_MODE != 2) {
# Campaign data will get by key if (empty($id)) { $id = 'NULL'; } $opCamp = $myconn->prepare("SELECT * FROM " . db_table_pref . "campaigns WHERE campaign_key=?") or die(mysqli_error($myconn)); $opCamp->bind_param('s', $id); if ($opCamp->execute()) { $opCamp->store_result(); if ($opCamp->num_rows != 0) { $sr = new Statement_Result($opCamp); $opCamp->fetch(); $campID = $sr->Get('ID'); $subArray = getSubscriber($sid, 2); if (is_array($subArray) && count($subArray) != 0) { # Add Report $addRpt = new lethe(); $addRpt->OID = $subArray['subscriber_OID']; $addRpt->reportCID = $campID; $addRpt->reportPos = 0; # Click $addRpt->reportIP = $_SERVER['REMOTE_ADDR']; $addRpt->reportMail = $subArray['subscriber_mail']; $addRpt->reportBounceType = 'unknown'; $addRpt->reportExtraInfo = 'URL: ' . $redu . PHP_EOL; $addRpt->addReport(); # Redirect URL header('Location: ' . $redu); } else { die('Error Occurred'); } } else {
$bounceActs = json_decode($opAccRs['bounce_actions'], true); # Connection if ($opAccRs['bounce_acc'] == 0) { $inst = pop3_login($opAccRs['pop3_host'], $opAccRs['pop3_port'], $opAccRs['pop3_user'], $opAccRs['pop3_pass'], $folder = 'INBOX', $conn_security[$opAccRs['pop3_secure']]); } else { $inst = pop3_login($opAccRs['imap_host'], $opAccRs['imap_port'], $opAccRs['imap_user'], $opAccRs['imap_pass'], $folder = 'INBOX', $conn_security[$opAccRs['imap_secure']]); } if (!$inst) { $errRes[] = '* Cannot Connect to Mailbox!'; } else { $cTotal = @imap_num_msg($inst); $list = @pop3_list($inst); $stat = @pop3_stat($inst); $errRes[] = '* Mailbox Connection OK!'; $errRes[] = '* Total Record: ' . $cTotal; $bounceApp = new lethe(); if (!isset($stat['Unread']) || $stat['Unread'] <= 0 || !isset($stat) || !isset($list)) { $stat['Unread'] = 0; $errRes[] = '* Mailbox Empty or There No Unread Mail Found!'; } # Fetch if ($stat['Unread'] > 0) { foreach ($list as $row) { $msgHead = imap_fetchheader($inst, $row['msgno'], FT_UID); $msgBody = imap_fetchbody($inst, $row['msgno'], FT_UID); $emailParser = new PlancakeEmailParser($msgHead); # Check Encoding $chkEnc = $emailParser->getHeader('Content-Transfer-Encoding'); if (!empty($chkEnc)) { $msgBody = bodyDecoding($msgBody, $emailParser->getHeader('Content-Transfer-Encoding')); }
# Start /* Design Receiver Data (Mail body could be used with system template) */ $rndPassEnc = encr('myLethe' . time() . rand() . uniqid(true)); $newPass = substr($rndPassEnc, 1, 12); $newPassEnc = encr($newPass); $mailBody = '<p>Hello ' . $srm->Get('real_name') . ',</p>'; $mailBody .= '<p><strong>Your new password:</strong> ' . $newPass . '</p>'; $mailBody .= '<p>Do not forget to change your password after logged in.</p>'; $mailBody .= '<p>Thank you!</p>'; $rcMail = showIn($srm->Get('mail'), 'page'); $rcName = showIn($srm->Get('real_name'), 'page'); $rcSubject = showIn(letheglobal_password_recovery, 'page'); $rcBody = $mailBody; $rcAltBody = $mailBody; $recData = array($rcMail => array('name' => $rcName, 'subject' => $rcSubject, 'body' => $rcBody, 'altbody' => $rcAltBody)); $sendMail = new lethe(); $sendMail->sub_mail_id = md5($rcMail . time()); $sendMail->sub_mail_receiver = $recData; $sendMail->sysSubInit(); if ($sendMail->sendPos) { # Change Password $upPass = $myconn->prepare("UPDATE " . db_table_pref . "users SET pass=? WHERE ID=" . (int) $srm->Get('ID') . "") or die(mysqli_error($myconn)); $upPass->bind_param('s', $newPassEnc); $upPass->execute(); $upPass->close(); $pwrm_res = mysql_prep(errMod(subscribers_e_mail_sent_successfully, 'success')); } else { $pwrm_res = mysql_prep(errMod(letheglobal_error_occured . '<br>ERROR:' . $sendMail->sendingErrors, 'danger')); } # End }
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; $blist->addBlacklist(); /* Init Limits */ $sourceLimit = calcSource(set_org_id, 'subscriber.blacklist'); $errText = errMod(letheglobal_recorded_successfully, 'success'); } else { $errText = errMod($errText, 'danger'); } } else { $errText = errMod(letheglobal_limit_exceeded, 'danger'); } } /* Edit Blacklist */ if (isset($_POST['editBlacklist'])) { if (isset($_POST['del'])) {
</div> '; echo $sbrMailForm; } } /* Subscriber Details */ if ($pos == 'sbrfulldata') { $opSub = $myconn->prepare("SELECT \n\t\t\t\t\t\t\t\t\t\tS.*,\n\t\t\t\t\t\t\t\t\t\tSG.ID AS SGID, SG.group_name\n\t\t\t\t\t\t\t\t FROM \n\t\t\t\t\t\t\t\t\t\t" . db_table_pref . "subscribers AS S,\n\t\t\t\t\t\t\t\t\t\t" . db_table_pref . "subscriber_groups AS SG\n\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\t\t\tS.OID=" . set_org_id . " \n\t\t\t\t\t\t\t\t AND \n\t\t\t\t\t\t\t\t\t\tS.ID=?\n\t\t\t\t\t\t\t\t AND\n\t\t\t\t\t\t\t\t\t\t(SG.ID = S.GID)\n\t\t\t\t\t\t\t\t\t") or die(mysqli_error($myconn)); $opSub->bind_param('i', $ID); $opSub->execute(); $opSub->store_result(); if ($opSub->num_rows == 0) { echo errMod(letheglobal_record_not_found, 'danger'); } else { $sr = new Statement_Result($opSub); $jsonBld = new lethe(); $jsonBld->OID = set_org_id; $opSub->fetch(); $buildJSON = $jsonBld->buildJSON($sr->Get('ID')); $dataCont = ' <table class="footable"> <thead> <tr> <th colspan="2">' . $sr->Get('subscriber_mail') . '</th> </tr> </thead> <tbody> <tr> <td width="200"><strong>' . subscribers_groups . '</strong></td> <td>' . showIn($sr->Get('group_name'), 'page') . '</td> </tr>
public function addSubAccount() { global $myconn; global $LETHE_BOUNCE_TYPES; /* General */ if (!isset($_POST['acc_title']) || empty($_POST['acc_title'])) { $this->errPrint .= '* ' . settings_please_enter_a_account_title . '<br>'; } if (!isset($_POST['daily_limit']) || !is_numeric($_POST['daily_limit'])) { $this->errPrint .= '* ' . settings_please_enter_a_daily_limit . '<br>'; } if (!isset($_POST['spec_limit_range']) || !is_numeric($_POST['spec_limit_range'])) { $_POST['spec_limit_range'] = 1440; } if (!isset($_POST['send_per_conn']) || !is_numeric($_POST['send_per_conn'])) { $this->errPrint .= '* ' . settings_please_enter_a_per_connection_limit . '<br>'; } if (!isset($_POST['standby_time']) || !is_numeric($_POST['standby_time'])) { $this->errPrint .= '* ' . settings_please_enter_a_standby_limit . '<br>'; } if (isset($_POST['systemAcc']) && $_POST['systemAcc'] == 'YES') { $systemAcc = 1; } else { $systemAcc = 0; } if (isset($_POST['debug']) && $_POST['debug'] == 'YES') { $isDebug = 1; } else { $isDebug = 0; } if (isset($_POST['active']) && $_POST['active'] == 'YES') { $isActive = 1; } else { $isActive = 0; } /* Sending */ if (!isset($_POST['from_title']) || empty($_POST['from_title'])) { $this->errPrint .= '* ' . settings_please_enter_a_sender_title . '<br>'; } if (!isset($_POST['from_mail']) || !mailVal($_POST['from_mail'])) { $this->errPrint .= '* ' . settings_invalid_sender_mail . '<br>'; } if (!isset($_POST['reply_mail']) || !mailVal($_POST['reply_mail'])) { $this->errPrint .= '* ' . settings_invalid_reply_mail . '<br>'; } if (!isset($_POST['test_mail']) || !mailVal($_POST['test_mail'])) { $this->errPrint .= '* ' . settings_invalid_test_mail . '<br>'; } if (!isset($_POST['mail_type']) || !is_numeric($_POST['mail_type'])) { $this->errPrint .= '* ' . settings_please_choose_a_mail_content_type . '<br>'; } if (!isset($_POST['send_method']) || !is_numeric($_POST['send_method'])) { $this->errPrint .= '* ' . settings_please_choose_a_sending_method . '<br>'; } if (!isset($_POST['mail_engine']) || empty($_POST['mail_engine'])) { $this->errPrint .= '* ' . settings_please_choose_a_mail_engine . '<br>'; } /* Connection SMTP */ if (isset($_POST['send_method']) && intval($_POST['send_method']) == 0) { if (!isset($_POST['smtp_host']) || empty($_POST['smtp_host'])) { $this->errPrint .= '* ' . settings_please_enter_a_smtp_server . '<br>'; } if (!isset($_POST['smtp_port']) || empty($_POST['smtp_port'])) { $this->errPrint .= '* ' . settings_please_enter_a_smtp_port . '<br>'; } if (!isset($_POST['smtp_user']) || empty($_POST['smtp_user'])) { $this->errPrint .= '* ' . settings_please_enter_a_smtp_username . '<br>'; } if (!isset($_POST['smtp_pass']) || empty($_POST['smtp_pass'])) { $this->errPrint .= '* ' . settings_please_enter_a_smtp_password . '<br>'; } if (!isset($_POST['smtp_secure']) || !is_numeric($_POST['smtp_secure'])) { $this->errPrint .= '* ' . settings_please_choose_a_smtp_encryption . '<br>'; } } else { $_POST['smtp_host'] = ''; $_POST['smtp_port'] = 0; $_POST['smtp_user'] = ''; $_POST['smtp_pass'] = ''; $_POST['smtp_secure'] = 0; } # PHP Mail if (isset($_POST['send_method']) && intval($_POST['send_method']) == 1) { if (!function_exists('mail')) { $this->errPrint .= '* Server does not support PHP mail() !<br>'; } } # AWS if (isset($_POST['send_method']) && intval($_POST['send_method']) == 2) { if (!isset($_POST['aws_acc_key']) || empty($_POST['aws_acc_key'])) { $this->errPrint .= '* ' . settings_please_enter_aws_access_key . '<br>'; } if (!isset($_POST['aws_sec_key']) || empty($_POST['aws_sec_key'])) { $this->errPrint .= '* ' . settings_please_enter_aws_secret_key . '<br>'; } } else { $_POST['aws_acc_key'] = ''; $_POST['aws_sec_key'] = ''; } # Mandrill if (isset($_POST['send_method']) && intval($_POST['send_method']) == 3) { if (!isset($_POST['mandrill_user']) || empty($_POST['mandrill_user'])) { $this->errPrint .= '* ' . settings_please_enter_a_mandrill_username . '<br>'; } if (!isset($_POST['mandrill_key']) || empty($_POST['mandrill_key'])) { $this->errPrint .= '* ' . settings_please_enter_a_mandrill_key . '<br>'; } } else { $_POST['mandrill_user'] = ''; $_POST['mandrill_key'] = ''; } # SendGrid if (isset($_POST['send_method']) && intval($_POST['send_method']) == 4) { if (!isset($_POST['sendgrid_user']) || empty($_POST['sendgrid_user'])) { $this->errPrint .= '* ' . settings_please_enter_a_sendgrid_username . '<br>'; } if (!isset($_POST['sendgrid_pass']) || empty($_POST['sendgrid_pass'])) { $this->errPrint .= '* ' . settings_please_enter_a_sendgrid_password . '<br>'; } } else { $_POST['sendgrid_user'] = ''; $_POST['sendgrid_pass'] = ''; } if (!isset($_POST['pop3_host']) || empty($_POST['pop3_host'])) { $this->errPrint .= '* ' . settings_please_enter_a_pop3_server . '<br>'; } if (!isset($_POST['pop3_port']) || empty($_POST['pop3_port'])) { $this->errPrint .= '* ' . settings_please_enter_a_pop3_port . '<br>'; } if (!isset($_POST['pop3_user']) || empty($_POST['pop3_user'])) { $this->errPrint .= '* ' . settings_please_enter_a_pop3_username . '<br>'; } if (!isset($_POST['pop3_pass']) || empty($_POST['pop3_pass'])) { $this->errPrint .= '* ' . settings_please_enter_a_pop3_password . '<br>'; } if (!isset($_POST['pop3_secure']) || !is_numeric($_POST['pop3_secure'])) { $this->errPrint .= '* ' . settings_please_choose_a_pop3_encryption . '<br>'; } if (!isset($_POST['imap_host']) || empty($_POST['imap_host'])) { $this->errPrint .= '* ' . settings_please_enter_a_imap_server . '<br>'; } if (!isset($_POST['imap_port']) || empty($_POST['imap_port'])) { $this->errPrint .= '* ' . settings_please_enter_a_imap_port . '<br>'; } if (!isset($_POST['imap_user']) || empty($_POST['imap_user'])) { $this->errPrint .= '* ' . settings_please_enter_a_imap_username . '<br>'; } if (!isset($_POST['imap_pass']) || empty($_POST['imap_pass'])) { $this->errPrint .= '* ' . settings_please_enter_a_imap_password . '<br>'; } if (!isset($_POST['imap_secure']) || !is_numeric($_POST['imap_secure'])) { $this->errPrint .= '* ' . settings_please_choose_a_imap_encryption . '<br>'; } if (isset($_POST['smtp_auth']) && $_POST['smtp_auth'] == 'YES') { $smtp_auth = 1; } else { $smtp_auth = 0; } if (!isset($_POST['bounce_acc']) || !is_numeric($_POST['bounce_acc'])) { $this->errPrint .= '* ' . settings_please_choose_a_bounce_connector . '<br>'; } /* DKIM */ if (isset($_POST['dkimactive']) && $_POST['dkimactive'] == 'YES') { $dkimactive = 1; if (!isset($_POST['dkimdomain']) || empty($_POST['dkimdomain'])) { $this->errPrint .= '* ' . settings_please_enter_a_dkim_domain . '<br>'; } if (!isset($_POST['dkimprivate']) || empty($_POST['dkimprivate'])) { $this->errPrint .= '* ' . settings_please_enter_a_dkim_private_key . '<br>'; } if (!isset($_POST['dkimselector']) || empty($_POST['dkimselector'])) { $this->errPrint .= '* ' . settings_please_enter_a_dkim_selector . '<br>'; } if (!isset($_POST['dkimpassphrase']) || empty($_POST['dkimpassphrase'])) { $this->errPrint .= '* ' . settings_please_enter_a_dkim_passphrase . '<br>'; } } else { $dkimactive = 0; $_POST['dkimdomain'] = ''; $_POST['dkimprivate'] = ''; $_POST['dkimselector'] = ''; $_POST['dkimpassphrase'] = ''; } /* Bounce Actions */ $bounceActions = array(); foreach ($LETHE_BOUNCE_TYPES as $k => $v) { if ($this->onInstall) { $frmAct = 1; } else { $frmAct = isset($_POST['bounces_' . $k]) && is_numeric($_POST['bounces_' . $k]) ? $_POST['bounces_' . $k] : 0; } $bounceActions[$k] = $frmAct; } $bounceActions = json_encode($bounceActions); if ($this->errPrint == '') { $account_id = encr(uniqid('lethe', true) . time() . rand()); $daily_date = date("Y-m-d H:i:s"); $daily_date = strtotime(date("Y-m-d H:i:s", strtotime($daily_date)) . " +" . $_POST['spec_limit_range'] . " minutes"); if ($systemAcc) { $myconn->query("UPDATE " . db_table_pref . "submission_accounts SET systemAcc=0 WHERE ID>0"); } $LTH = $myconn->prepare("INSERT INTO \n\t\t\t\t\t\t\t\t\t\t\t\t\t" . db_table_pref . "submission_accounts \n\t\t\t\t\t\t\t\t\t\t\t SET\n\t\t\t\t\t\t\t\t\t\t\t\t\tacc_title=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdaily_limit=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tsend_per_conn=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tstandby_time=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tsystemAcc=" . $systemAcc . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\tisDebug=" . $isDebug . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\tisActive=" . $isActive . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\tfrom_title=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tfrom_mail=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\treply_mail=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttest_mail=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tmail_type=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tsend_method=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tmail_engine=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tsmtp_host=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tsmtp_port=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tsmtp_user=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tsmtp_pass=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tsmtp_secure=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tpop3_host=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tpop3_port=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tpop3_user=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tpop3_pass=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tpop3_secure=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\timap_host=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\timap_port=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\timap_user=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\timap_pass=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\timap_secure=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tsmtp_auth=" . $smtp_auth . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\tbounce_acc=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\taws_access_key=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\taws_secret_key=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdkim_active=" . $dkimactive . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\tdkim_domain=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdkim_private=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdkim_selector=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdkim_passphrase=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\taccount_id='" . $account_id . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\tdaily_reset='" . date("Y-m-d H:i:s", $daily_date) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\tlimit_range=?,\n\t\t\t\t\t\t\t\t\t\t\t\t\tbounce_actions=?\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t") or die(mysqli_error($myconn)); $LTH->bind_param('siiissssiississisissisissiissssssis', $_POST['acc_title'], $_POST['daily_limit'], $_POST['send_per_conn'], $_POST['standby_time'], $_POST['from_title'], $_POST['from_mail'], $_POST['reply_mail'], $_POST['test_mail'], $_POST['mail_type'], $_POST['send_method'], $_POST['mail_engine'], $_POST['smtp_host'], $_POST['smtp_port'], $_POST['smtp_user'], $_POST['smtp_pass'], $_POST['smtp_secure'], $_POST['pop3_host'], $_POST['pop3_port'], $_POST['pop3_user'], $_POST['pop3_pass'], $_POST['pop3_secure'], $_POST['imap_host'], $_POST['imap_port'], $_POST['imap_user'], $_POST['imap_pass'], $_POST['imap_secure'], $_POST['bounce_acc'], $_POST['aws_acc_key'], $_POST['aws_sec_key'], $_POST['dkimdomain'], $_POST['dkimprivate'], $_POST['dkimselector'], $_POST['dkimpassphrase'], $_POST['spec_limit_range'], $bounceActions); if ($LTH->execute()) { $subAccID = $myconn->insert_id; # Add Bounce Cron $buildCron = new lethe(); # Check every 5 min $buildCron->chronosMin = "*/5"; $buildCron->chronosURL = "'" . lethe_root_url . 'chronos/lethe.bounce.php?ID=' . $subAccID . "' > /dev/null 2>&1"; $genComm = $buildCron->buildChronos(); $genDate = date('Y-m-d H:i:s'); $addCron = $myconn->prepare("INSERT INTO " . db_table_pref . "chronos SET OID=" . set_org_id . ", SAID=" . $subAccID . ", pos=0, cron_command=?, launch_date=?"); $addCron->bind_param('ss', $genComm, $genDate); $addCron->execute(); $addCron->close(); } $LTH->close(); if (!$this->onInstall) { unset($_POST); } $this->errPrint = errMod('' . letheglobal_recorded_successfully . '!', 'success'); } else { $this->errPrint = errMod($this->errPrint, 'danger'); } }
/* Actions */ if (isset($_POST['editSubList'])) { if (isset($_POST['sbr'])) { if (isset($_POST['selOpt']) && $_POST['selOpt'] != 'action') { $movGrp = !isset($_POST['selOptGrp']) || !is_numeric($_POST['selOptGrp']) ? 0 : intval($_POST['selOptGrp']); $movStatus = false; $movePrep = $myconn->prepare("UPDATE " . db_table_pref . "subscribers SET GID=? WHERE OID=" . set_org_id . " AND ID=?") or die(mysqli_error($myconn)); $moveGrpOwnerPrep = $myconn->prepare("SELECT ID FROM " . db_table_pref . "subscriber_groups WHERE OID=" . set_org_id . " AND ID=? " . (LETHE_AUTH_VIEW_TYPE ? ' AND UID=' . LETHE_AUTH_ID . '' : '') . "") or die(mysqli_error($myconn)); $moveGrpOwnerPrep->bind_param('i', $movGrp); $moveGrpOwnerPrep->execute(); $moveGrpOwnerPrep->store_result(); if ($moveGrpOwnerPrep->num_rows > 0) { $movStatus = true; } $moveGrpOwnerPrep->close(); $opRemCls = new lethe(); $opRemCls->OID = set_org_id; foreach ($_POST['sbr'] as $k => $v) { /* Delete */ if ($_POST['selOpt'] == 'delete') { $selSubMail = getSubscriber($v, 0); $opRemCls->removeSubscription($selSubMail); } else { if ($_POST['selOpt'] == 'move') { if ($movStatus) { $movePrep->bind_param('ii', $movGrp, $v); $movePrep->execute(); } } } }
} # Update Settings $setLethe = new lethe(); $setLethe->onInstall = true; $setLethe->letheSettings(); # Organization if (cntData("SELECT ID FROM " . $db_prefix . "organizations") == 0) { $orgLethe = new lethe(); $orgLethe->onInstall = true; $orgLethe->addOrganization(); } # User if (cntData("SELECT ID FROM " . $db_prefix . "users") == 0) { $opOr = $myconn->query("SELECT ID FROM " . $db_prefix . "organizations"); $opOrRs = $opOr->fetch_assoc(); $usrLethe = new lethe(); $usrLethe->onInstall = true; $usrLethe->isMaster = 1; $usrLethe->auth_mode = 2; $usrLethe->isPrimary = 1; $usrLethe->OID = $opOrRs['ID']; $usrLethe->addUser(); } # Main Cron $letChr = new Crontab(); $mainCroner = "* * * * * curl -s '" . lethe_root_url . "chronos/lethe.php' >/dev/null 2>&1"; $letChr->addJob($mainCroner); die('<script>$("#myLethe").attr("disabled",true);</script>' . errMod('Lethe Successfully Installed on Your System!<br>Dont Forget to Remove <strong>install.php</strong> File!', 'success')); } else { die('<script>$("#myLethe").attr("disabled",false);</script>' . errMod($errors, 'danger')); }
$ID = intval($_GET['ID']); } /* Demo Check */ if (!isDemo('addAccount,editAccount')) { $errText = errMod(letheglobal_demo_mode_active, 'danger'); } if (isset($_POST['addAccount'])) { # Add Submission Account $myLethe = new lethe(); $myLethe->auth_mode = 2; $myLethe->addSubAccount(); $errText = $myLethe->errPrint; } if (isset($_POST['editAccount'])) { # Edit Submission Account $myLethe = new lethe(); $myLethe->ID = (int) $ID; $myLethe->editSubAccount(); $errText = $myLethe->errPrint; } ?> <?php if ($page_sub2 == 'add') { echo $errText; ?> <!-- Add Submission Account Start --> <form action="" method="POST"> <div role="tabpanel"> <!-- Nav tabs -->
$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); $opOrg->fetch(); $opOrg->close(); if ($sr->Get('isActive') == 0) { jsonRet(false, 'INVALID_ORG'); } else { # LOAD ORG SETTINGS $opSC = new lethe(); $orgSets = array(); if (!$opSC->loadOrg($sr->Get('ID'))) { jsonRet(false, 'INVALID_ORG'); } # ACTIONS START ******************************************************************************************************* # Add if ($act == 'add') { /* Limit Controller */ $sourceLimit = calcSource($sr->Get('ID'), 'subscribers'); if (!limitBlock($sourceLimit, $orgSets['set_org_max_subscriber'])) { jsonRet(false, 'SUBSCRIBING_LIMIT_EXCEEDED'); } $chkAPI = $myconn->prepare("SELECT ID FROM " . db_table_pref . "subscribers WHERE OID=" . $sr->Get('ID') . " AND subscriber_mail=?") or die(mysqli_error($myconn)); $chkAPI->bind_param('s', $lmail); $chkAPI->execute();
/* Add New */ if (limitBlock($sourceLimit, set_org_max_subscriber_group)) { if (isset($_POST['new_group']) && !empty($_POST['new_group'])) { $addGrp = $myconn->prepare("INSERT INTO " . db_table_pref . "subscriber_groups SET OID=" . set_org_id . ",UID=" . LETHE_AUTH_ID . ",group_name=?,isUnsubscribe=0") or die(mysqli_error($myconn)); $addGrp->bind_param('s', $_POST['new_group']); $addGrp->execute(); $addGrp->close(); $succText .= '* ' . subscribers_new_group_added_successfully . '<br>'; } } /* Update */ if (isset($_POST['group_datas'])) { @set_time_limit(0); $dgrp = $myconn->prepare("DELETE FROM " . db_table_pref . "subscriber_groups WHERE OID=" . set_org_id . " AND isUnsubscribe=0 AND ID=? " . (LETHE_AUTH_VIEW_TYPE ? ' AND UID=' . LETHE_AUTH_ID . '' : '') . "") or die(mysqli_error($myconn)); $ugrp = $myconn->prepare("UPDATE " . db_table_pref . "subscriber_groups SET group_name=? WHERE OID=" . set_org_id . " AND ID=? " . (LETHE_AUTH_VIEW_TYPE ? ' AND UID=' . LETHE_AUTH_ID . '' : '') . "") or die(mysqli_error($myconn)); $callLethe = new lethe(); $callLethe->OID = set_org_id; foreach ($_POST['group_datas'] as $k => $v) { /* Delete */ if (isset($_POST['del_' . $v]) && $_POST['del_' . $v] == 'YES') { /* Check System Groups */ if (cntData("SELECT ID FROM " . db_table_pref . "subscriber_groups WHERE OID=" . set_org_id . " AND ID=" . intval($v) . " AND (isUnsubscribe=1 OR isUngroup=1)") == 0) { $dgrp->bind_param('i', $v); $dgrp->execute(); # Remove Subscribers $opSubs = $myconn->query("SELECT * FROM " . db_table_pref . "subscribers WHERE GID=" . intval($v) . "") or die(mysqli_error($myconn)); while ($opSubsRs = $opSubs->fetch_assoc()) { $callLethe->removeSubscription($opSubsRs['subscriber_mail']); } $opSubs->free(); # Remove Campaign Groups