$QUEUE->setHIP($H[0]['id'], getIP()); //save ip } if ($H[0]['status'] != 7) { //7:unsubscribed $QUEUE->setHStatus($h_id, 3); //view } } //isset H[0] } //checkid h_id //adressid? wenn ja status aendern und view zaehlen if (checkid($a_id)) { $ADDRESS = new tm_ADR(); $ADR = $ADDRESS->getAdr($a_id); if (isset($ADR[0])) { //https://sourceforge.net/tracker/?func=detail&aid=3114571&group_id=190396&atid=933192 //only set view status if not waiting status or unsubscribed // !5 && !11 if ($ADR[0]['status'] != 5 && $ADR[0]['status'] != 11) { $ADDRESS->setStatus($a_id, 4); //view } //adr view counter ++ $ADDRESS->addView($a_id); //view //save memo $created = date("Y-m-d H:i:s"); $memo = "viewed (" . $NL[0]['subject'] . ")"; $ADDRESS->addMemo($a_id, $memo); }
if ($val == 1) { $_MAIN_MESSAGE .= "<br>" . ___("Eintrag wurde aktiviert."); } else { $_MAIN_MESSAGE .= "<br>" . ___("Eintrag wurde de-aktiviert."); } } //aktiv single if ($set == "delete" && $doit == 1) { if (!DEMO) { $ADDRESS->delAdr($adr_id); } $_MAIN_MESSAGE .= "<br>" . ___("Eintrag wurde gelöscht."); } //del single if ($set == "check") { $ADR_check = $ADDRESS->getAdr($adr_id); $_MAIN_MESSAGE .= "<br>" . ___("Eintrag wird geprüft:") . " <br><em>" . display($ADR_check[0]['email']) . "</em>"; $check_mail = checkEmailAdr($ADR_check[0]['email'], $EMailcheck_Intern); if (!$check_mail[0]) { $_MAIN_MESSAGE .= "<br><font color=\"red\">" . ___("Die E-Mail-Adresse ist nicht gültig.") . "</font>"; $_MAIN_MESSAGE .= "<br><font color=\"red\">" . ___("E-Mail wurde als fehlerhaft markiert.") . "</font>"; $_MAIN_MESSAGE .= " " . tm_icon($STATUS['adr']['statimg'][9], display($STATUS['adr']['status'][9])) . " \"<b>" . display($STATUS['adr']['status'][9]) . "</b>\""; $ADDRESS->setStatus($adr_id, 9); $ADDRESS->addMemo($adr_id, $check_mail[1]); } else { $_MAIN_MESSAGE .= "<br><font color=\"green\">" . ___("OK") . "</font>"; } $ADDRESS->markRecheck($adr_id, 0); $_MAIN_MESSAGE .= "<br><pre><em>" . display($check_mail[1]) . "</em></pre>"; } //check single
$fc = count($FRM); for ($fcc = 0; $fcc < $fc; $fcc++) { if (!empty($FRM[$fcc]['subscriptions'])) { $showformURLPara->addParam("frm_id", $FRM[$fcc]['id']); $showformURLPara_ = $showformURLPara->getAllParams(); $_MAIN_OUTPUT .= "<br>" . ($fcc + 1) . ".) <a href=\"" . $tm_URL . "/" . $showformURLPara_ . "\">" . $FRM[$fcc]['name'] . "</a> (" . $FRM[$fcc]['subscriptions'] . ")"; } } //////////////////////////////////////////////////////////////////////////////////////// //LESER - Views //////////////////////////////////////////////////////////////////////////////////////// $_MAIN_OUTPUT .= "</td></tr><tr><td valign=top align=left>"; // width=50% $_MAIN_OUTPUT .= "<h2>" . sprintf(___("TOP %s - Abonnenten"), $show_top_x) . "</h2>"; $_MAIN_OUTPUT .= "<b>" . ___("Views") . "</b>"; $ADR = $ADDRESS->getAdr(0, 0, $show_top_x, 0, array(), "views", 1); $ac = count($ADR); for ($acc = 0; $acc < $ac; $acc++) { if (!empty($ADR[$acc]['views'])) { $showadrURLPara->addParam("email", $ADR[$acc]['email']); $showadrURLPara->addParam("adr_id", $ADR[$acc]['id']); $showadrURLPara_ = $showadrURLPara->getAllParams(); $_MAIN_OUTPUT .= "<br>" . ($acc + 1) . ".) <a href=\"" . $tm_URL . "/" . $showadrURLPara_ . "\">" . $ADR[$acc]['email'] . "</a> (" . $ADR[$acc]['views'] . ")"; } } //////////////////////////////////////////////////////////////////////////////////////// //LESER - Clicks //////////////////////////////////////////////////////////////////////////////////////// $_MAIN_OUTPUT .= "<br><b>" . ___("Klicks") . "</b>"; $ADR = $ADDRESS->getAdr(0, 0, $show_top_x, 0, array(), "clicks", 1); $ac = count($ADR);
if (DEBUG) { $FMESSAGE .= tm_debugmessage("select smtp host with id " . $C[0]['unsubscribe_host']); } $HOST = $HOSTS->getHost($C[0]['unsubscribe_host']); $check = true; $InputName_Name = "email"; //email ${$InputName_Name} = getVar($InputName_Name); $InputName_Captcha = "fcpt"; //einbgegebener Captcha Code ${$InputName_Captcha} = getVar($InputName_Captcha); $cpt = getVar("cpt"); //zu pruefender captchacode, hidden field, $captcha_code //if isset $a_id and adr exists and adr code=c, then prefill email! if (check_dbid($a_id)) { $ADR_TMP = $ADDRESS->getAdr($a_id); //found entry? if (count($ADR_TMP) > 0) { if (DEBUG) { $FMESSAGE .= tm_debugmessage("Found entry with id {$a_id}"); } //additionally check code! if ($ADR_TMP[0]['code'] == $code) { if (DEBUG) { $FMESSAGE .= tm_debugmessage("Code OK"); $FMESSAGE .= tm_debugmessage("email: " . display($ADR_TMP[0]['email'])); } //ok, prefill value with email fetched from db via adr_id ${$InputName_Name} = $ADR_TMP[0]['email']; } else { if (DEBUG) {
//standard name aus datum fuer export generieren $created = date("Y-m-d H:i:s"); //default: $Export_Filename = "bounce_" . date_convert_to_string($created) . ".csv"; $fp = fopen($tm_datapath . "/" . $Export_Filename, "w"); } if ($ac > 0) { $_MAIN_MESSAGE .= "<br>" . sprintf(___("%s Adressen zum Bearbeiten ausgewählt."), $ac); for ($acc = 0; $acc < $ac; $acc++) { $search['email'] = $adr[$acc]; $search['email_exact_match'] = true; if ($export == 1) { $CSV = "\"" . $adr[$acc] . "\"\n"; fputs($fp, $CSV, strlen($CSV)); } $A = $ADDRESS->getAdr(0, 0, 0, 0, $search, "", 0, 0); if (isset($A[0]['id'])) { if ($val2 == "delete") { if (!DEMO) { $ADDRESS->delAdr($A[0]['id']); } $_MAIN_MESSAGE .= "<br>" . sprintf(___("Die Adresse %s wurde gelöscht."), $A[0]['email']); } if ($val2 == "error") { $ADDRESS->setStatus($A[0]['id'], 9); $_MAIN_MESSAGE .= "<br>" . sprintf(___("Die Adresse %s wurde als Fehlerhaft markiert."), $A[0]['email']); } if ($val2 == "aktiv") { $ADDRESS->setAktiv($A[0]['id'], 0); $_MAIN_MESSAGE .= "<br>" . sprintf(___("Die Adresse %s wurde deaktiviert."), $A[0]['email']); }
/** * save log * @param * @return boolean */ function log($arr) { //indexes: //author_id = given author id, if not given, check data array for author id, if not given, check login, if not given, set to 0=system //action = text = new/edit/delete //object = contact/ticket/contact_group/object/contact_type etc //data = array with data, e.g. from $contact array addContact Method etc. $Return = false; //check values //set log date $this->LOG['date'] = date("Y-m-d H:i:s"); //chekc for author id $this->LOG['author_id'] = 0; //default is 0=system if (isset($arr['author_id']) && check_dbid($arr['author_id'])) { //if valid author_id in arr $this->LOG['author_id'] = $arr['author_id']; } else { //else check for author_id in data array if (isset($arr['data']['author_id']) && check_dbid($arr['data']['author_id'])) { $this->LOG['author_id'] = $arr['data']['author_id']; } else { // else, if not set at all get author id from logged in user global $LOGIN; if (isset($LOGIN->USER['id']) && check_dbid($LOGIN->USER['id'])) { $this->LOG['author_id'] = $LOGIN->USER['id']; } } } //action //action should always be set, default is -- $this->LOG['action'] = "--"; if (isset($arr['action']) && !empty($arr['action'])) { //wenn aktion definiert $this->LOG['action'] = $arr['action']; } //object //object should always be set, default is -- $this->LOG['object'] = "--"; if (isset($arr['object']) && !empty($arr['object'])) { //wenn aktion definiert $this->LOG['object'] = $arr['object']; } //edit_id, die id des geaenderten datensatzes! oder neuen datensatzes, defakto muss log() erst am ende einer add methode aufgerufen werden wenn die id bekannt ist! //edit_id should always be set, default is 0 $this->LOG['edit_id'] = 0; if (isset($arr['data']['id']) && !empty($arr['data']['id'])) { //wenn id $this->LOG['edit_id'] = $arr['data']['id']; } $this->LOG['memo'] = ""; if (isset($arr['memo'])) { $this->LOG['memo'] = $arr['memo']; } $this->LOG['s_data'] = serialize($arr['data']); //hmmm, falls loeschung, daten aus altem datensatz anhand id ermitteln.... hmmmm if ($this->LOG['action'] == "delete" && check_dbid($this->LOG['edit_id'])) { switch ($this->LOG['object']) { //default: #no default, default : require_once (TM_INCLUDEPATH."/Welcome.inc.php"); break; case 'usr': $LINK = new tm_CFG(); $DATA = $LINK->getUser("", $this->LOG['edit_id']); $this->LOG['s_data'] = serialize($DATA); break; case 'adr': $LINK = new tm_ADR(); $DATA = $LINK->getAdr($this->LOG['edit_id']); $this->LOG['s_data'] = serialize($DATA[0]); break; case 'adr_grp': $LINK = new tm_ADR(); $DATA = $LINK->getGroup($this->LOG['edit_id']); $this->LOG['s_data'] = serialize($DATA[0]); break; case 'nl': $LINK = new tm_NL(); $DATA = $LINK->getNL($this->LOG['edit_id']); $this->LOG['s_data'] = serialize($DATA[0]); break; case 'nl_grp': $LINK = new tm_NL(); $DATA = $LINK->getGroup($this->LOG['edit_id']); $this->LOG['s_data'] = serialize($DATA[0]); break; case 'bl': $LINK = new tm_BLACKLIST(); $DATA = $LINK->getBL($this->LOG['edit_id']); $this->LOG['s_data'] = serialize($DATA[0]); break; case 'frm': $LINK = new tm_FRM(); $DATA = $LINK->getForm($this->LOG['edit_id']); $this->LOG['s_data'] = serialize($DATA[0]); break; case 'host': $LINK = new tm_HOST(); $DATA = $LINK->getHost($this->LOG['edit_id']); $this->LOG['s_data'] = serialize($DATA[0]); break; case 'q': $LINK = new tm_Q(); $DATA = $LINK->getQ($this->LOG['edit_id']); $this->LOG['s_data'] = serialize($DATA[0]); break; case 'lnk': $LINK = new tm_LNK(); $DATA = $LINK->get($this->LOG['edit_id']); $this->LOG['s_data'] = serialize($DATA[0]); break; case 'lnk_grp': $LINK = new tm_LNK(); $DATA = $LINK->getGroup($this->LOG['edit_id']); $this->LOG['s_data'] = serialize($DATA[0]); break; } //switch } //if action=delete //serialisierte werte speichern, ein eintrag in die db pro aktion! $Query = "INSERT INTO " . TM_TABLE_LOG . " (\n\t\t\t\t\t\tdate,\n\t\t\t\t\t\tauthor_id,\n\t\t\t\t\t\taction,\n\t\t\t\t\t\tobject,\n\t\t\t\t\t\tproperty,\n\t\t\t\t\t\tx_value,\n\t\t\t\t\t\tedit_id,\n\t\t\t\t\t\tdata,\n\t\t\t\t\t\tmemo,\n\t\t\t\t\t\tsiteid\n\t\t\t\t\t\t)\n\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t'" . dbesc($this->LOG["date"]) . "',\n\t\t\t\t\t\t" . checkset_int($this->LOG["author_id"]) . ",\n\t\t\t\t\t\t'" . dbesc($this->LOG["action"]) . "',\n\t\t\t\t\t\t'" . dbesc($this->LOG["object"]) . "',\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t" . checkset_int($this->LOG["edit_id"]) . ",\n\t\t\t\t\t\t'" . dbesc($this->LOG['s_data']) . "',\n\t\t\t\t\t\t'" . dbesc($this->LOG['memo']) . "',\n\t\t\t\t\t\t'" . TM_SITEID . "')"; if ($this->DB->Query($Query)) { $Return = true; } else { $Return = FALSE; return $Return; } /* //jeden wert einzeln speichern, ist aber unsinnn!!!! //iterate data array, fetch all indexes and values and save...... yes, it becomes a very very big table!!!!! anders gehts halt nicht! foreach ($arr['data'] as $data_key => $data_val) { if (DEBUG) $_MAIN_MESSAGE.= "$data_key => $data_val\n, "; $Query ="INSERT INTO ".TM_TABLE_LOG." ( date, author_id, action, object, property, x_value, edit_id, siteid ) VALUES ( '".dbesc($this->LOG["date"])."', '".checkset_int($this->LOG["author_id"])."', '".dbesc($this->LOG["action"])."', '".dbesc($this->LOG["object"])."', '".dbesc($data_key)."', '".dbesc($data_val)."', '".checkset_int($this->LOG["edit_id"])."', '".TM_SITEID."')"; if (DEBUG_SQL) $_MAIN_MESSAGE.="\n".$Query."<br>"; if ($this->DB->Query($Query)) { $Return=true; } else { $Return=FALSE; return $Return; } }//foreach */ return $Return; }
//Array A fuellen mit AddressIDs aus der DB //syntax: function getAdrID($group_id=0,$search=Array()) $A = $ADR->getAdrID(); echo print_r($A, TRUE); echo "<hr>"; //Array durchwandern und jede Adresse pruefen foreach ($A as $adr_id) { $G = array(); //temporaeres Array //Gruppen fuer Adresse holen //syntax: function getGroupID($id=0,$adr_id=0,$frm_id=0,$search=Array()) $G = $ADR->getGroupID(0, $adr_id); //wenn mehr als 1 Gruppe!, dann speichere ID der Adresse in B und erhoehe den Counter bn if (count($G) > 1) { $B[$bn] = $adr_id; $bn++; } } echo print_r($B, TRUE); echo "<hr>"; //ergebnis anzeigen, IDs von Adressen mit mehr als 1 Gruppe sind in $B abgelegt foreach ($B as $adr_id) { //Addressdetails auslesen //syntax: getAdr($id=0,$offset=0,$limit=0,$group_id=0,$search=Array(),$sortIndex="",$sortType=0,$Details=1) $A = $ADR->getAdr($adr_id); //Gruppen f.d. Addresse auslesen $G = $ADR->getGroup(0, $adr_id); echo print_r($A, TRUE); echo print_r($G, TRUE); echo "<hr>"; }
} //adr already exists, update if ($adr_exists) { /********************************************************************************/ //update adr record if (DEBUG) { $MESSAGE .= tm_debugmessage("adr record already exists, initiate update: subscribe_update"); } require_once TM_INCLUDEPATH . "/subscribe_update.inc.php"; /********************************************************************************/ } //next we fetch current new adr record (again) if (DEBUG) { $MESSAGE .= tm_debugmessage("fetch adr record again:"); } $ADR = $ADDRESS->getAdr($newADRID); if (DEBUG) { $MESSAGE .= tm_debugmessage(print_r($ADR, TRUE)); } //now send mails and show messages if (!$adr_exists && $FRM[0]['double_optin'] == 1) { /********************************************************************************/ //send double optin confirmation mail with subscribe/confirmation link $nl_id_index = "nl_id_doptin"; if (DEBUG) { $MESSAGE .= tm_debugmessage("new record, send double optin confirmation email: subscribe_doptin_mail, nl_id_index=" . $nl_id_index); } require_once TM_INCLUDEPATH . "/subscribe_mail.inc.php"; /********************************************************************************/ //show double optin message #$MESSAGE.=display($FRM[0]['message_doptin']);
$check = false; $_MAIN_MESSAGE .= "<br>" . ___("Die E-Mail-Adresse darf nicht leer sein."); } //email auf gueltigkeit pruefen $check_mail = checkEmailAdr($email, $EMailcheck_Intern); if (!$check_mail[0]) { $check = false; $_MAIN_MESSAGE .= "<br>" . ___("Die E-Mail-Adresse ist nicht gültig.") . " " . $check_mail[1]; } if ($check) { $ADDRESS = new tm_ADR(); /////////////////////////// //dublettencheck $search['email'] = $email; //auf existenz pruefen und wenn email noch nicht existiert dann eintragen. $ADR = $ADDRESS->getAdr(0, 0, 0, 0, $search); $ac = count($ADR); //oh! adresse ist bereits vorhanden! //wir diffen die gruppen und fuegen nur die referenzen hinzu die noch nicht existieren! $new_adr_grp = $adr_grp; $adr_exists = false; if ($ac > 0) { //gruppen denen die adr bereits angehoert $old_adr_grp = $ADDRESS->getGroupID(0, $ADR[0]['id'], 0); //neue gruppen nur die die neu sind, denen die adr noch nicht angehoert! //adr_grp=gruppen aus dem formular $new_adr_grp = array_diff($adr_grp, $old_adr_grp); $all_adr_grp = array_merge($old_adr_grp, $new_adr_grp); $adr_exists = true; } //////////////////////
//ok $send_it = true; //wird gebraucht um versenden abzufangen wenn aktuell bearbeiteter eintrag send_log("OK: HID: " . $H[$bcc]['id']); //vor der pruefung auf valide email status schon auf 5 setzen, //ist ggf doppelt gemobbelt, kann aber ggf. unter bestimmten Umstaenden dazu fuehren // das eine validierung auf gueltigen mx etwas laenger dauert, //der job mit einem anderen konkurriert und waehrend die //pruefung und mx abfrage laeuft der konkurrierende job sich die adresse krallt, man weiss nix genaues nich ;) //h eintrag wird zum bearbeiten gesperrt, status 5! send_log("setHStatus 5"); $QUEUE->setHStatus($H[$bcc]['id'], 5); send_log("adr_id: " . $H[$bcc]['adr_id']); //adresse holen send_log("getAdr()"); $ADR = $ADDRESS->getAdr($H[$bcc]['adr_id']); //nur senden wenn korrekte emailadr! und fehlerrate < max errors //erstmal ok, kein fehler //fehler beim senden? adresse ok? $a_error = false; $h_error = false; $a_status = $ADR[0]['status']; ////todo optimierung: check errors vor blacklist und vor mx, spart ggf zeit und abfragen von adressen die eh zu viele fehler haben oder geblacklisted wurden! //BLACKLIST prüfen if ($Q[$qcc]['check_blacklist']) { send_log("checking blacklist"); if ($BLACKLIST->isBlacklisted($ADR[0]['email'])) { //wenn adr auf blacklist steht, fehler setzen und abbrechen send_log("email " . $ADR[0]['email'] . " matches the active blacklist"); //statt a_error setzen wir h_error! #$a_error=true;
/* Homepage: www.tellmatic.org */ /* leave this header in file! */ /* diesen Header nicht loeschen! */ /* check Homepage for Updates and more Infos */ /* Besuchen Sie die Homepage fuer Updates und weitere Infos */ /********************************************************************************/ exit; #include config file: edit line if you run this script via cronjob, add full path to tellmatic config file require_once "./tm_config.inc.php"; /********************************************************************************/ if (DEMO) { exit; } $ADDRESS = new tm_ADR(); $search['recheck'] = 1; $ADR = $ADDRESS->getAdr(0, 0, $C[0]['checkit_limit'], 0, $search, "", 0, 0); $ac = count($ADR); if ($ac > 0) { echo sprintf(___("Limit: %s Found: %s"), $C[0]['checkit_limit'], $ac) . "\n"; for ($acc = 0; $acc < $ac; $acc++) { $protocol = ""; $protocol .= $ADR[$acc]['email'] . "\n"; $ADR_C = $ADDRESS->getAdr($ADR[$acc]['id']); //nochmal kurz pruefen ob recheck noch 1 ist, sonst pruefen wir ggf. doppelt if ($ADR_C[0]['recheck'] == 1) { //recheck auf 0 setzen $ADDRESS->markRecheck($ADR[$acc]['id'], 0); //pruefen $check_mail = checkEmailAdr($ADR[$acc]['email'], $C[0]['emailcheck_checkit'], $C[0]['checkit_from_email']); if (!$check_mail[0]) { $protocol .= ___("Error, e-mail marked as failed.") . "\n";
} if ($set == "check") { $_MAIN_MESSAGE .= "<br>" . ___("Ausgewählte Adressen werden zur automatischen Prüfung vorgemerkt."); } //adressids holen ud in adr_id_arr speichern //function getAdrID($group_id=0,$search=Array()) $adr_id_arr = $ADDRESS->getAdrID(0, $search); //adrarray durchwandern for ($acc_m = 0; $acc_m < $ac; $acc_m++) { //blacklist? MUSS vor anderen aktionen stehen wegen getAdr!! if ($blacklist == 1) { //hier wird naemlich auch nich $set abgefragt! sondern eben $blacklist als eigenes flag! (checkbox), soll aber auch verfuegbar sein wenn set==delete //ist.... sonst muesste man zum blacklisten alle anderen aktionen kombinieren :O //andere loesung waere checkboxen, die aber per js auf gueltigkeit geprueft werden muessen da verschieben und loeschen nix bringt! //get adr $ADR_BL = $ADDRESS->getAdr($adr_id_arr[$acc_m]); //checkblacklist if (!$BLACKLIST->isBlacklisted($ADR_BL[0]['email'], "email")) { //blacklist adr $BLACKLIST->addBL(array("siteid" => TM_SITEID, "expr" => $ADR_BL[0]['email'], "aktiv" => 1, "type" => "email")); } } //activate adr if ($set == "aktiv_1") { $ADDRESS->setAktiv($adr_id_arr[$acc_m], 1); } //deactivate adr if ($set == "aktiv_0") { $ADDRESS->setAktiv($adr_id_arr[$acc_m], 0); } //set status
if (DEBUG) { $_MAIN_MESSAGE .= "<br>new export_limit_run ({$export_limit_run}) = export_total ({$export_total}) - (export_run({$export_run}) * export_limit_run({$export_limit_run_prev}))"; } } if ($export_limit_run > 0) { if (DEBUG) { $_MAIN_MESSAGE .= "<br>export_limit_run ({$export_limit_run}) >0"; } //hole adressen //get(offset,limit_run) // getAdr($id=0,$offset=0,$limit=0,$group_id=0,$search=Array(),$sortIndex="",$sortType=0) //adressen auslesen if (DEBUG) { $_MAIN_MESSAGE .= "<br>get({$export_offset},{$export_limit_run})"; } $ADR = $ADDRESS->getAdr(0, $export_offset, $export_limit_run, $adr_grp_id, $search); //id,offset,limit,group $ac = count($ADR); //aktuelle anzahl ermittelte adressen if ($ac > 0) { if (DEBUG) { $_MAIN_MESSAGE .= "<br>export_run {$export_run} von {$export_run_max} , Found: {$ac} Adr: {$export_offset} - " . ($export_offset + $ac) . " , Total: {$adc} Adr, Limit: {$export_limit_run}, Offset: {$export_offset}<br>"; } //loop 2 for ($acc = 0; $acc < $ac; $acc++) { //blacklist einstellungen pruefen //wenn "alle" exportieren, oder "blacklisted" und isblacklisted=true oder nur not_blacklisted und isblacklisted=false $blacklisted = false; if ($check_blacklist == "blacklisted" || $check_blacklist == "not_blacklisted") { $blacklisted = $BLACKLIST->isBlacklisted($ADR[$acc]['email'], "email"); }