/* 2006/10 by Volker Augustin, multi.art.studio Hanau */ /* Contact/Kontakt: info@tellmatic.org */ /* 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 */ /*******************************************************************************/ #$nl_id_index="nl_id_doptin"; #$nl_id_index="nl_id_greeting"; #$nl_id_index="nl_id_update"; $use_nl_mail = FALSE; if (DEBUG) { $MESSAGE .= tm_debugmessage("nl_id index is " . $nl_id_index); } if (check_dbid($FRM[0][$nl_id_index])) { if (DEBUG) { $MESSAGE .= tm_debugmessage("nl_id for mail found " . $nl_id_index . "=" . $FRM[0][$nl_id_index]); } //get newsletter $NLSubscribeMail = $NEWSLETTER->getNL($FRM[0][$nl_id_index]); //check / validate newsletter, must be active, personalized and template if (isset($NLSubscribeMail[0])) { if ($NLSubscribeMail[0]['massmail'] == 0) { if ($NLSubscribeMail[0]['aktiv'] == 1) { if ($NLSubscribeMail[0]['is_template'] == 1) { if (DEBUG) { $MESSAGE .= tm_debugmessage("valid newsletter found, send as mail"); } $use_nl_mail = TRUE; } else {
function delBL($id) { $Return = false; if (check_dbid($id)) { if (TM_LOG) { $this->LOG->log(array("data" => array("id" => $id), "object" => "bl", "action" => "delete")); } $Query = "DELETE FROM " . TM_TABLE_BLACKLIST . " WHERE siteid='" . TM_SITEID . "' AND id=" . checkset_int($id); if ($this->DB->Query($Query)) { $Return = true; } else { $Return = false; return $Return; } } return $Return; }
/********************************************************************************/ /* this file is part of: / diese Datei ist ein Teil von: */ /* tellmatic, the newslettermachine */ /* tellmatic, die Newslettermaschine */ /* 2006/7 by Volker Augustin, multi.art.studio Hanau */ /* Contact/Kontakt: info@tellmatic.org */ /* 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 */ /********************************************************************************/ ///////////////////////////////////// //Statistik fuer Adressgruppe ///////////////////////////////////// if ($set == "adrg" && check_dbid($adr_grp_id)) { $showadrURLPara = tmObjCopy($mSTDURL); $showadrURLPara->addParam("act", "adr_list"); $showadrURLPara->addParam("adr_grp_id", $adr_grp_id); $showadrURLPara->addParam("s", "s_menu_adr,s_menu_st"); //prepare graph $chart = new HorizontalChart(640, 200); $chart->setLogo(TM_IMGPATH . "/blank.png"); //tellmatic_logo_256.png //adr_grp_id $AG = $ADDRESS->getGroup($adr_grp_id); $_MAIN_OUTPUT .= sprintf(___("Statistik für Adressgruppe %s"), "<b>" . display($AG[0]['name']) . "</b>"); //////////////////////////////////////////////////////////////////////////////////////// //Gesamtstatus, anzahl per adr-status //////////////////////////////////////////////////////////////////////////////////////// $ac = $ADDRESS->countADR($adr_grp_id);
function markRecheck($id, $recheck = 0, $search = array()) { $Query = "\n\t\t\t\t\t\tUPDATE " . TM_TABLE_ADR . "\n\t\t\t\t\t"; if (isset($search['group']) && !empty($search['group'])) { $group_id = checkset_int($search['group']); } else { $group_id = 0; } if (check_dbid($group_id)) { $Query .= "LEFT JOIN " . TM_TABLE_ADR_GRP_REF . " ON " . TM_TABLE_ADR . ".id = " . TM_TABLE_ADR_GRP_REF . ".adr_id"; } $Query .= " SET " . TM_TABLE_ADR . ".recheck=" . checkset_int($recheck); $Query .= " WHERE " . TM_TABLE_ADR . ".siteid='" . TM_SITEID . "'\n\t\t\t\t\t"; if (check_dbid($group_id)) { $Query .= " AND " . TM_TABLE_ADR_GRP_REF . ".siteid='" . TM_SITEID . "'\n\t\t\t\t\t\t AND " . TM_TABLE_ADR_GRP_REF . ".grp_id = " . checkset_int($group_id); } if (isset($search['email']) && !empty($search['email'])) { $Query .= " AND lcase(" . TM_TABLE_ADR . ".email) like lcase('" . dbesc($search['email']) . "')"; } //check for status, OR if (isset($search['status']) && $search['status'] > 0) { //if is no array, let first array entry be the string, so we always have an array if (!is_array($search['status'])) { $search_status = $search['status']; $search['status'] = array(); $search['status'][0] = $search_status; } //create query $ssc = count($search['status']); $Query .= " AND ("; for ($sscc = 0; $sscc < $ssc; $sscc++) { $Query .= TM_TABLE_ADR . ".status=" . checkset_int($search['status'][$sscc]); if ($sscc + 1 < $ssc) { $Query .= " OR"; } } $Query .= " )"; } if (isset($search['aktiv']) && ($search['aktiv'] === "1" || $search['aktiv'] === "0")) { //!!! we have to compare strings, weird php! argh. $Query .= " AND " . TM_TABLE_ADR . ".aktiv = " . checkset_int($search['aktiv']); } if (check_dbid($id)) { $Query .= " AND " . TM_TABLE_ADR . ".id=" . checkset_int($id); } $this->DB2->Query($Query); }
$check = true; if ($set == "save") { //checkinput if (empty($name)) { $check = false; $_MAIN_MESSAGE .= "<br>" . ___("Name sollte nicht leer sein."); } if (!check_dbid($nl_id_doptin)) { $check = false; $_MAIN_MESSAGE .= "<br>" . ___("Wählen Sie ein Newsletter für die Double-Opt-In Mail."); } if (!check_dbid($nl_id_greeting)) { $check = false; $_MAIN_MESSAGE .= "<br>" . ___("Wählen Sie ein Newsletter für die Bestätigungsmail."); } if (!check_dbid($nl_id_update)) { $check = false; $_MAIN_MESSAGE .= "<br>" . ___("Wählen Sie ein Newsletter für Updates."); } if ($check) { $FORMULAR = new tm_FRM(); $FORMULAR->updateForm(array("id" => $frm_id, "name" => $name, "action_url" => $action_url, "descr" => $descr, "aktiv" => $aktiv, "created" => $created, "author" => $author, "use_captcha" => $use_captcha, "digits_captcha" => $digits_captcha, "double_optin" => $double_optin, "subscribe_aktiv" => $subscribe_aktiv, "check_blacklist" => $check_blacklist, "proof" => $proof, "force_pubgroup" => $force_pubgroup, "overwrite_pubgroup" => $overwrite_pubgroup, "multiple_pubgroup" => $multiple_pubgroup, "nl_id_doptin" => $nl_id_doptin, "nl_id_greeting" => $nl_id_greeting, "nl_id_update" => $nl_id_update, "message_doptin" => $message_doptin, "message_greeting" => $message_greeting, "message_update" => $message_update, "submit_value" => $submit_value, "reset_value" => $reset_value, "host_id" => $host_id, "email" => $email, "f0" => $f0, "f1" => $f1, "f2" => $f2, "f3" => $f3, "f4" => $f4, "f5" => $f5, "f6" => $f6, "f7" => $f7, "f8" => $f8, "f9" => $f9, "f0_type" => $f0_type, "f1_type" => $f1_type, "f2_type" => $f2_type, "f3_type" => $f3_type, "f4_type" => $f4_type, "f5_type" => $f5_type, "f6_type" => $f6_type, "f7_type" => $f7_type, "f8_type" => $f8_type, "f9_type" => $f9_type, "f0_required" => $f0_required, "f1_required" => $f1_required, "f2_required" => $f2_required, "f3_required" => $f3_required, "f4_required" => $f4_required, "f5_required" => $f5_required, "f6_required" => $f6_required, "f7_required" => $f7_required, "f8_required" => $f8_required, "f9_required" => $f9_required, "f0_value" => $f0_value, "f1_value" => $f1_value, "f2_value" => $f2_value, "f3_value" => $f3_value, "f4_value" => $f4_value, "f5_value" => $f5_value, "f6_value" => $f6_value, "f7_value" => $f7_value, "f8_value" => $f8_value, "f9_value" => $f9_value, "email_errmsg" => $email_errmsg, "captcha_errmsg" => $captcha_errmsg, "blacklist_errmsg" => $blacklist_errmsg, "pubgroup_errmsg" => $pubgroup_errmsg, "f0_errmsg" => $f0_errmsg, "f1_errmsg" => $f1_errmsg, "f2_errmsg" => $f2_errmsg, "f3_errmsg" => $f3_errmsg, "f4_errmsg" => $f4_errmsg, "f5_errmsg" => $f5_errmsg, "f6_errmsg" => $f6_errmsg, "f7_errmsg" => $f7_errmsg, "f8_errmsg" => $f8_errmsg, "f9_errmsg" => $f9_errmsg, "f0_expr" => $f0_expr, "f1_expr" => $f1_expr, "f2_expr" => $f2_expr, "f3_expr" => $f3_expr, "f4_expr" => $f4_expr, "f5_expr" => $f5_expr, "f6_expr" => $f6_expr, "f7_expr" => $f7_expr, "f8_expr" => $f8_expr, "f9_expr" => $f9_expr), $adr_grp, $adr_grp_pub); //+öffentliche gruppen $_MAIN_MESSAGE .= "<br>" . sprintf(___("Formular %s wurde bearbeitet."), "'<b>" . display($name) . "</b>'"); $action = "form_list"; include_once TM_INCLUDEPATH . "/form_list.inc.php"; } else { require_once TM_INCLUDEPATH . "/form_form.inc.php"; require_once TM_INCLUDEPATH . "/form_form_show.inc.php"; } } else {
/********************************************************************************/ /* this file is part of: / diese Datei ist ein Teil von: */ /* tellmatic, the newslettermachine */ /* tellmatic, die Newslettermaschine */ /* 2006/7 by Volker Augustin, multi.art.studio Hanau */ /* Contact/Kontakt: info@tellmatic.org */ /* 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 */ /********************************************************************************/ ///////////////////////////////////// //Statistik fuer Newsletter ///////////////////////////////////// if ($set == "nl" && check_dbid($nl_id)) { //nl_id $N = $NEWSLETTER->getNL($nl_id); $_MAIN_OUTPUT .= sprintf(___("Statistik für Newsletter %s"), "<b>" . display($N[0]['subject']) . "</b>"); //////////////////////////////////////////////////////////////////////////////////////// //allg. infos //////////////////////////////////////////////////////////////////////////////////////// $_MAIN_OUTPUT .= "<br><br>" . sprintf(___("Erstellt am: %s von %s"), "<b>" . $N[0]['created'] . "</b>", "<b>" . $N[0]['author'] . "</b>"); $_MAIN_OUTPUT .= "<br>" . sprintf(___("Bearbeitet am: %s von %s"), "<b>" . $N[0]['created'] . "</b>", "<b>" . $N[0]['editor'] . "</b>"); $_MAIN_OUTPUT .= "<br>" . sprintf(___("Inhalt-Typ: %s"), ""); if ($N[0]['content_type'] == "text/html") { $_MAIN_OUTPUT .= tm_icon("page_white_office.png", ___("TEXT/HTML")) . " "; $_MAIN_OUTPUT .= "<b>" . ___("TEXT/HTML") . "</b>"; } if ($N[0]['content_type'] == "html") { $_MAIN_OUTPUT .= tm_icon("page_white_h.png", ___("HTML")) . " ";
/********************************************************************************/ /* this file is part of: / diese Datei ist ein Teil von: */ /* tellmatic, the newslettermachine */ /* tellmatic, die Newslettermaschine */ /* 2006/7 by Volker Augustin, multi.art.studio Hanau */ /* Contact/Kontakt: info@tellmatic.org */ /* 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 */ /********************************************************************************/ ///////////////////////////////////// //Statistik fuer Adressen ///////////////////////////////////// if ($set == "adr" && check_dbid($adr_id)) { //nl_id $ADR = $ADDRESS->getADR($adr_id); //////////////////////////////////////////////////////////////////////////////////////// //allg. Infos //////////////////////////////////////////////////////////////////////////////////////// $_MAIN_OUTPUT .= sprintf(___("Statistik fuer Adresse %s"), "<b>" . display($ADR[0]['email']) . "</b>"); $_MAIN_OUTPUT .= "<br>ID: " . $ADR[0]['id'] . " / " . $ADR[0]['d_id'] . " "; if ($ADR[0]['aktiv'] == 1) { $_MAIN_OUTPUT .= "<br>" . tm_icon("tick.png", ___("aktiv")) . " "; $_MAIN_OUTPUT .= ___("(aktiv)"); } else { $_MAIN_OUTPUT .= "<br>" . tm_icon("cancel.png", ___("inaktiv")) . " "; $_MAIN_OUTPUT .= ___("(inaktiv)"); } $_MAIN_OUTPUT .= "" . ___("Gespeicherte Daten:") . "";
$OUTPUT .= tm_debugmessage("use template " . $Form_Success_Filename); } //set new tpl path $_Tpl_FRM->setTemplatePath($tm_formpath); } //get default smtp host, default, as fallback if (DEBUG) { $MESSAGE .= tm_debugmessage("fetch default smtp host"); } $HOST = $HOSTS->getStdSMTPHost(); $use_frm_smtphost = FALSE; //get host form valid form if ($use_form) { // && !$doptin_check //get host if (check_dbid($FRM[0]['host_id'])) { //valid host id found $HOST_FRM = $HOSTS->getHost($FRM[0]['host_id']); if ($HOST_FRM[0]['aktiv'] == 1 && $HOST_FRM[0]['type'] == 'smtp') { $use_frm_smtphost = TRUE; if (DEBUG) { $MESSAGE .= tm_debugmessage("found valid smtp host for this form"); } } else { if (DEBUG) { $MESSAGE .= tm_debugmessage("found no valid smtp host for this form, continue use default host"); } } } } if ($use_frm_smtphost) {
function makeMap(&$img, &$gi, $frm_id, $width, $height) { $Query = "SELECT ip FROM " . TM_TABLE_FRM_S . "\n\t\t\t\t\tWHERE siteid='" . TM_SITEID . "'"; $Query .= " AND ip!='0.0.0.0' AND ip!=''"; if (check_dbid($frm_id)) { $Query .= " AND frm_id=" . checkset_int($frm_id); } if ($this->DB->Query($Query)) { $Color1 = imagecolorallocate($img, 255, 255, 0); $Color2 = imagecolorallocate($img, 255, 0, 0); while ($this->DB->next_Record()) { $geoip = geoip_record_by_addr($gi, $this->DB->Record['ip']); if (isset($geoip->latitude, $geoip->longitude)) { $pt = getlocationcoords($geoip->latitude, $geoip->longitude, $width, $height); imagefilledrectangle($img, $pt["x"] - 1, $pt["y"] - 1, $pt["x"] + 1, $pt["y"] + 1, $Color1); imagerectangle($img, $pt["x"] - 4, $pt["y"] - 4, $pt["x"] + 4, $pt["y"] + 4, $Color2); } } //while } //if query }
$MESSAGE .= tm_debugmessage("invalid email!"); } if ($use_form) { $OUTPUT .= $FRM[0]['email_errmsg'] . "<br>"; } else { $OUTPUT .= "ERR 3<br>"; } } if ($doptin_check && $check_mail[0]) { if (DEBUG) { $MESSAGE .= tm_debugmessage("validating email"); } //adresse pruefen: //double optin bestaetigung: //adr suchen, code vergleichen, wenn ok, weiter, sonst ...... leere seite! -? $search['email'] = $email; $search['code'] = $code; $search['email_exact_match'] = true; //harte pruefung, nur wenn noch nicht bestaetigt: $search['status']=5; oder touch //limit=1: adr holen $ADR = $ADDRESS->getAdr(0, 0, 1, 0, $search); if (isset($ADR[0]) && check_dbid($ADR[0]['id']) && $ADR[0]['code'] == $code) { //ja, code muesste man nicht nochmal pruefen, wird ja in search bereits in der db gesucht.... //setstatus adr_id = 3 if (DEBUG) { $MESSAGE .= tm_debugmessage("email found, now setting status to 3: confirmed"); } $ADDRESS->setStatus($ADR[0]['id'], 3); $doptin_success = true; } }
//ok, if we have a valid h record, lets do some tracking and logging } //isset H } //check_dbid h_id && personalized if ($valid_h) { if (DEBUG) { echo "h is valid<br>"; } } else { if (DEBUG) { echo "h is invalid<br>"; } } //check for valid address record if (check_dbid($a_id) && $personalized) { $ADDRESS = new tm_ADR(); $ADR = $ADDRESS->getAdr($a_id); //check if adr isset , active and not unsubscribed, status !=11 if (isset($ADR[0]) && $ADR[0]['aktiv'] == 1 && $ADR[0]['status'] != 11) { $valid_adr = TRUE; } if (DEBUG) { echo "adr isset, aktiv==1, status !=11<br>"; } } //isset ADR && aktiv //but wait :) //we checked for valid h record before, so if we maybe now have a new adr id if none was set, we will check again if the adr id is still the same as the given a_id if we have a valid h record! hehe if ($valid_adr && $valid_h && $H[0]['adr_id'] != $a_id) { $valid_adr = FALSE;
function setHostStd($id = 0) { $Return = false; if (check_dbid($id)) { $Query = "UPDATE " . TM_TABLE_HOST . "\n\t\t\t\t\t\tSET standard=0\n\t\t\t\t\t\tWHERE standard=1\n\t\t\t\t\t\tAND siteid='" . TM_SITEID . "'"; //log $HOSTSTD = $this->getStdSMTPHost(); if ($this->DB->Query($Query)) { //log if (TM_LOG) { $this->LOG->log(array("data" => array("standard" => 0, "id" => $HOSTSTD[0]['id']), "object" => "host", "action" => "edit")); } $Return = true; } else { $Return = false; return $Return; } $Query = "UPDATE " . TM_TABLE_HOST . "\n\t\t\t\t\t\tSET standard=1\n\t\t\t\t\t\tWHERE id=" . checkset_int($id) . "\n\t\t\t\t\t\tAND siteid='" . TM_SITEID . "'"; if ($this->DB->Query($Query)) { //log if (TM_LOG) { $this->LOG->log(array("data" => array("standard" => 1, "id" => $id), "object" => "host", "action" => "edit")); } $Return = true; } else { $Return = false; return $Return; } } return $Return; }
function setManager($id, $manager = 0) { $Return = false; if (check_dbid($id)) { $Query = "UPDATE " . TM_TABLE_USER . " SET `manager`=" . checkset_int($manager) . " WHERE siteid='" . TM_SITEID . "' AND id=" . checkset_int($id); if ($this->DB->Query($Query)) { if (TM_LOG) { $this->LOG->log(array("data" => array("manager" => $manager, "id" => $id), "object" => "usr", "action" => "edit")); } $Return = true; } } return $Return; }
/********************************************************************************/ /* this file is part of: / diese Datei ist ein Teil von: */ /* tellmatic, the newslettermachine */ /* tellmatic, die Newslettermaschine */ /* 2006/7 by Volker Augustin, multi.art.studio Hanau */ /* Contact/Kontakt: info@tellmatic.org */ /* 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 */ /********************************************************************************/ ///////////////////////////////////// //Statistik fuer Formulare ///////////////////////////////////// if ($set == "frm" && check_dbid($frm_id)) { $FRM = $FORMULAR->getForm($frm_id); //////////////////////////////////////////////////////////////////////////////////////// //allg. Infos //////////////////////////////////////////////////////////////////////////////////////// $_MAIN_OUTPUT .= sprintf(___("Statistik für Formular %s"), "<b>" . display($FRM[0]['name']) . "</b>"); $_MAIN_OUTPUT .= "<br>" . display($FRM[0]['descr']); $_MAIN_OUTPUT .= "<br><br>ID: " . $FRM[0]['id']; $created_date = $FRM[0]['created']; $updated_date = $FRM[0]['updated']; $author = $FRM[0]['author']; $editor = $FRM[0]['editor']; if ($FRM[0]['aktiv'] == 1) { $_MAIN_OUTPUT .= "<br>" . tm_icon("tick.png", ___("Aktiv")) . " "; $_MAIN_OUTPUT .= ___("(aktiv)"); } else {
function restart_failed($q_id = 0) { $Return = false; if (check_dbid($q_id)) { $Query = "UPDATE " . TM_TABLE_NL_H . " " . "SET status=1 " . "WHERE " . "q_id=" . checkset_int($q_id) . " " . "AND (status=4 OR status=6) " . "AND siteid='" . TM_SITEID . "'"; if ($this->DB->Query($Query)) { //log if (TM_LOG) { $this->LOG->log(array("data" => array("restart_failed" => 1, "id" => $q_id), "object" => "q", "action" => "edit")); } $Return = true; } } return $Return; //anzahl affected rows etc zurueckgeben, siehe addHQ }
#$q_arr=$QUEUE->getQID($nl_id);//nl_id $q_arr = $QUEUE->getQ(0, 0, 0, $nl_id); //nl_id if (DEBUG) { $_MAIN_MESSAGE .= "<br>Fall 2: newsletter<br>"; } } //wenn keine neue q, und q_id, dann q[0] = q_id if (check_dbid($q_id)) { #$q_arr[0]=$q_id; $q_arr[0]['id'] = $q_id; if (DEBUG) { $_MAIN_MESSAGE .= "<br>Fall 3: queue<br>"; } } if (check_dbid($grp_id)) { $q_arr = $QUEUE->getQ(0, 0, 0, 0, $grp_id); //grp_id if (DEBUG) { $_MAIN_MESSAGE .= "<br>Fall 4: group<br>"; } } } $qc = count($q_arr); //wieviel q eintraege gibt es? $_MAIN_MESSAGE .= "<br>" . ___("Empfängerliste wird generiert."); $ac_total_ok = 0; //gesamtanzahl adressen die eingetragen werden/wurden $ac_total_ok = 0; //gesamtanzahl adressen die eingetragen werden/wurden if (DEBUG) {
if (check_dbid($FRM[$acc]['nl_id_update'])) { $NLUpdate = $NEWSLETTER->getNL($FRM[$acc]['nl_id_update']); $_MAIN_OUTPUT .= "<br>" . display($NLUpdate[0]['subject']); } else { $_MAIN_OUTPUT .= ___("-- STANDARD --"); } $_MAIN_OUTPUT .= "<br><br>" . sprintf(___("Anmeldungen: %s"), $FRM[$acc]['subscriptions']); $_MAIN_OUTPUT .= "</font>"; $_MAIN_OUTPUT .= "</td><td valign=\"top\" align=\"left\">"; $_MAIN_OUTPUT .= "<font size=-1>"; $_MAIN_OUTPUT .= "<br><br>email= " . display($FRM[$acc]['email']) . " [] <em>" . display($FRM[$acc]['email_errmsg']) . "</em>" . "<br><br>f0= " . display($FRM[$acc]['f0']) . " [" . display($FRM[$acc]['f0_value']) . "] <em>" . display($FRM[$acc]['f0_errmsg']) . "</em>" . "<br>f1= " . display($FRM[$acc]['f1']) . " [" . display($FRM[$acc]['f1_value']) . "] <em>" . display($FRM[$acc]['f1_errmsg']) . "</em>" . "<br>f2= " . display($FRM[$acc]['f2']) . " [" . display($FRM[$acc]['f2_value']) . "] <em>" . display($FRM[$acc]['f2_errmsg']) . "</em>" . "<br>f3= " . display($FRM[$acc]['f3']) . " [" . display($FRM[$acc]['f3_value']) . "] <em>" . display($FRM[$acc]['f3_errmsg']) . "</em>" . "<br>f4= " . display($FRM[$acc]['f4']) . " [" . display($FRM[$acc]['f4_value']) . "] <em>" . display($FRM[$acc]['f4_errmsg']) . "</em>" . "<br>f5= " . display($FRM[$acc]['f5']) . " [" . display($FRM[$acc]['f5_value']) . "] <em>" . display($FRM[$acc]['f5_errmsg']) . "</em>" . "<br>f6= " . display($FRM[$acc]['f6']) . " [" . display($FRM[$acc]['f6_value']) . "] <em>" . display($FRM[$acc]['f6_errmsg']) . "</em>" . "<br>f7= " . display($FRM[$acc]['f7']) . " [" . display($FRM[$acc]['f7_value']) . "] <em>" . display($FRM[$acc]['f7_errmsg']) . "</em>" . "<br>f8= " . display($FRM[$acc]['f8']) . " [" . display($FRM[$acc]['f8_value']) . "] <em>" . display($FRM[$acc]['f8_errmsg']) . "</em>" . "<br>f9= " . display($FRM[$acc]['f9']) . " [" . display($FRM[$acc]['f9_value']) . "] <em>" . display($FRM[$acc]['f9_errmsg']) . "</em>"; $_MAIN_OUTPUT .= "</font>"; $_MAIN_OUTPUT .= "</td><td valign=\"top\" align=\"left\">"; $_MAIN_OUTPUT .= "<font size=-1>"; $_MAIN_OUTPUT .= "<br>" . ___("SMTP") . ": "; if (check_dbid($FRM[$acc]['host_id'])) { $HOST = $HOSTS->getHost($FRM[$acc]['host_id']); $_MAIN_OUTPUT .= display($HOST[0]['name']) . " (ID:" . $FRM[$acc]['host_id'] . ")"; } else { $_MAIN_OUTPUT .= ___("-- STANDARD --"); } $_MAIN_OUTPUT .= "<br>" . sprintf(___("Erstellt am: %s von %s"), $created_date, $author) . "<br>" . sprintf(___("Bearbeitet am: %s von %s"), $updated_date, $editor); $_MAIN_OUTPUT .= "<br><br>" . ___("Anmeldungen über dieses Formular werden in die folgenden Gruppen eingeordnet:") . "<br>"; $GRP = $ADDRESS->getGroup(0, 0, $FRM[$acc]['id'], 0, array("public_frm_ref" => 0)); $acg = count($GRP); for ($accg = 0; $accg < $acg; $accg++) { $_MAIN_OUTPUT .= "" . display($GRP[$accg]['name']) . "<br>"; } $_MAIN_OUTPUT .= "<br><br>" . ___("Der Abonnent kann aus folgenden Gruppen wählen:") . "<br>"; $GRP = $ADDRESS->getGroup(0, 0, $FRM[$acc]['id'], 0, array("public_frm_ref" => 1)); $acg = count($GRP);
function parseNL($data, $type) { //$data=Array( nl => $NL(Array) , adr => $ADR(Array)) //e.g. pass NL[0] as $data['nl'] //e.g. pass ADR[0] as $data['adr'] //ouch, another global global $tm_URL_FE; //should become a constant global $tm_nldir, $tm_nlattachdir, $tm_nlimgdir, $tm_nlimgpath, $tm_nlpath; //should become a constant too $Log = array(); $AGroups = array(); //groups the adr belongs to $Return = ""; $nl_id = 0; $a_id = 0; $q_id = 0; $h_id = 0; $frm_id = 0; $email = ""; $code = ""; $memo = ""; $f0 = $f1 = $f2 = $f3 = $f4 = $f5 = $f6 = $f7 = $f8 = $f9 = ""; #$personalized=false; if (isset($data['nl']) && isset($data['nl']['id']) && check_dbid($data['nl']['id'])) { $nl_id = $data['nl']['id']; //we can assume that all in ['nl']is set } //at first we need a nl_id, if not set, exit and return empty string! if (!check_dbid($nl_id)) { $Return = "!nl_id"; return $Return; } //next we need to know the type, parse html or testpart? if not set, exit and return empty string! if ($type != "text" && $type != "html") { $Return = "!type"; return $Return; } $data['text'] = $data['nl']['subject']; $NLSUBJECT = $this->parseSubject($data); //if isset $data['adr'] we assume that the newsletter is personalized and need personalized parsing with all parameters and variables, unles personalized tracking is disabled, then do not track h_id and adr_id if (isset($data['adr']) && isset($data['adr']['id']) && check_dbid($data['adr']['id'])) { $ADDRESS = new tm_ADR(); #$personalized=true; $a_id = $data['adr']['id']; $email = $data['adr']['email']; $code = $data['adr']['code']; $memo = $data['adr']['memo']; $f0 = $data['adr']['f0']; $f1 = $data['adr']['f1']; $f2 = $data['adr']['f2']; $f3 = $data['adr']['f3']; $f4 = $data['adr']['f4']; $f5 = $data['adr']['f5']; $f6 = $data['adr']['f6']; $f7 = $data['adr']['f7']; $f8 = $data['adr']['f8']; $f9 = $data['adr']['f9']; $AGroups = $ADDRESS->getGroup(0, $a_id, $frm_id, 0, array("aktiv" => 1, "public" => 1)); //fetch only public groups! dont show internal groups, "public_frm_ref"=>1, to show only pub groups with ref to form! } if (isset($data['q']) && isset($data['q']['id']) && check_dbid($data['q']['id'])) { $q_id = $data['q']['id']; } if (isset($data['h']) && isset($data['h']['id']) && check_dbid($data['h']['id'])) { $h_id = $data['h']['id']; } //parse date //if valid q id, then use send_at date! and convert to format for nl //if not valid q_id given, use now $QUEUE = new tm_Q(); $Q = $QUEUE->getQ($q_id); if (isset($Q[0])) { $DATE = strftime(TM_NL_DATEFORMAT, mk_microtime($Q[0]['send_at'])); } else { $DATE = date(TM_NL_DATEFORMAT); } //filenames //html datei//template for html parts $NL_Filename_N = "nl_" . date_convert_to_string($data['nl']['created']) . "_n.html"; //text datei//template for textparts $NL_Filename_T = "nl_" . date_convert_to_string($data['nl']['created']) . "_t.txt"; //image1 $NL_Imagename1 = "nl_" . date_convert_to_string($data['nl']['created']) . "_1.jpg"; //use view.php (1088) if ($data['nl']['massmail'] != 1) { $NLONLINE_URL = $tm_URL_FE . "/view.php?1=1&nl_id=" . $nl_id . "&q_id=" . $q_id . "&a_id=" . $a_id . "&h_id=" . $h_id; } else { $NLONLINE_URL = $tm_URL_FE . "/view.php?1=1&nl_id=" . $nl_id . "&q_id=" . $q_id; } $NLONLINE = "<a href=\"" . $NLONLINE_URL . "\" target=\"_blank\">"; //template values $IMAGE1 = ""; $IMAGE1_URL = ""; $LINK1 = ""; $LINK1_URL = ""; $ATTACHEMENTS = ""; $ATTACHEMENTS_TEXT = ""; $GROUP = ""; foreach ($AGroups as $AGroup) { $GROUP .= display($AGroup['name']) . "<br>"; } //IMAGE1 if (file_exists($tm_nlimgpath . "/" . $NL_Imagename1)) { #send_log("NL Image:".$tm_URL_FE."/".$tm_nlimgdir."/".$NL_Imagename1); $Log[] = "NL Image:" . $tm_URL_FE . "/" . $tm_nlimgdir . "/" . $NL_Imagename1; $IMAGE1_URL = $tm_URL_FE . "/" . $tm_nlimgdir . "/" . $NL_Imagename1; $IMAGE1 = "<img src=\"" . $IMAGE1_URL . "\" border=0 alt=\"Image1\">"; } //Attachements! $attachements = $data['nl']['attachements']; $atc = count($attachements); if ($atc > 0) { foreach ($attachements as $attachfile) { $ATTACHEMENTS .= "<a href=\"" . $tm_URL_FE . "/" . $tm_nlattachdir . "/" . $attachfile['file'] . "\" target=\"_blank\" title=\"" . $attachfile['file'] . "\">"; $ATTACHEMENTS .= $attachfile['file']; $ATTACHEMENTS .= "</a><br>\n"; $ATTACHEMENTS_TEXT .= $attachfile['file'] . ": " . $tm_URL_FE . "/" . $tm_nlattachdir . "/" . $attachfile['file']; $ATTACHEMENTS_TEXT .= "\n"; } //foreach } //if count/atc //Blindimage if ($data['nl']['track_personalized'] == 1) { $BLINDIMAGE_URL = $tm_URL_FE . "/news_blank.png.php?nl_id=" . $nl_id . "&q_id=" . $q_id . "&a_id=" . $a_id . "&h_id=" . $h_id; } else { //tracking nicht personalisiert, wie massmail! //koennte auch ggf oben global gesetzt werden, hier doppelt! $BLINDIMAGE_URL = $tm_URL_FE . "/news_blank.png.php?nl_id=" . $nl_id . "&q_id=" . $q_id; } $BLINDIMAGE = "<img src=\"" . $BLINDIMAGE_URL . "\" border=0 alt=\"\">"; //no alt! #send_log("NL track personalized: ".$data['nl']['track_personalized']); $Log[] = "NL track personalized: " . $data['nl']['track_personalized']; #send_log("Blindimage: ".$BLINDIMAGE_URL); $Log[] = "Blindimage: " . $BLINDIMAGE_URL; //link to unsubscribe $UNSUBSCRIBE_URL = $tm_URL_FE . "/unsubscribe.php?nl_id=" . $nl_id . "&q_id=" . $q_id . "&a_id=" . $a_id . "&h_id=" . $h_id . "&code=" . $code; $UNSUBSCRIBE = "<a href=\"" . $UNSUBSCRIBE_URL . "\" target=\"_blank\">"; //subscribe link for touch optin or subscribe $SUBSCRIBE_URL = $tm_URL_FE . "/subscribe.php?doptin=1&email=" . $email . "&code=" . $code; //."&touch=1" //optional fid form id parameter! for optin mails etc //check if we have a valid form id, used in subscribe url e.g. for doptin mails! if (isset($data['frm']) && isset($data['frm']['id']) && check_dbid($data['frm']['id'])) { //add frm_id of form, needed to send subscribe mail and get greeting nl id! $SUBSCRIBE_URL .= "&fid=" . $data['frm']['id']; } $SUBSCRIBE = "<a href=\"" . $SUBSCRIBE_URL . "\" target=\"_blank\">"; #send_log("Unsubscribe: ".$UNSUBSCRIBE_URL); $Log[] = "Unsubscribe: " . $UNSUBSCRIBE_URL; #send_log("Subscribe (touch/double optin): ".$SUBSCRIBE_URL); $Log[] = "Subscribe (touch/double optin): " . $SUBSCRIBE_URL; if (!empty($data['nl']['link'])) { if ($data['nl']['track_personalized'] == 1) { $LINK1_URL = $tm_URL_FE . "/click.php?nl_id=" . $nl_id . "&q_id=" . $q_id . "&a_id=" . $a_id . "&h_id=" . $h_id; } else { $LINK1_URL = $tm_URL_FE . "/click.php?nl_id=" . $nl_id . "&q_id=" . $q_id; } } $LINK1 = "<a href=\"" . $LINK1_URL . "\" target=\"_blank\">"; #send_log("Link1: ".$LINK1_URL); $Log[] = "Link1: " . $LINK1_URL; //set template vars #send_log("parse Template - Massmailing"); $Log[] = "parse Template"; $_Tpl_NL = new tm_Template(); $_Tpl_NL->setTemplatePath($tm_nlpath); $_Tpl_NL->setParseValue("IMAGE1", $IMAGE1); $_Tpl_NL->setParseValue("LINK1", $LINK1); $_Tpl_NL->setParseValue("ATTACH1", ""); $_Tpl_NL->setParseValue("CLOSELINK", "</a>"); $_Tpl_NL->setParseValue("BLINDIMAGE", $BLINDIMAGE); $_Tpl_NL->setParseValue("UNSUBSCRIBE", $UNSUBSCRIBE); $_Tpl_NL->setParseValue("SUBSCRIBE", $SUBSCRIBE); $_Tpl_NL->setParseValue("NLONLINE", $NLONLINE); $_Tpl_NL->setParseValue("IMAGE1_URL", $IMAGE1_URL); $_Tpl_NL->setParseValue("LINK1_URL", $LINK1_URL); $_Tpl_NL->setParseValue("ATTACH1_URL", ""); $_Tpl_NL->setParseValue("NLONLINE_URL", $NLONLINE_URL); $_Tpl_NL->setParseValue("BLINDIMAGE_URL", $BLINDIMAGE_URL); $_Tpl_NL->setParseValue("UNSUBSCRIBE_URL", $UNSUBSCRIBE_URL); $_Tpl_NL->setParseValue("SUBSCRIBE_URL", $SUBSCRIBE_URL); $_Tpl_NL->setParseValue("DATE", $DATE); $_Tpl_NL->setParseValue("EMAIL", $email); $_Tpl_NL->setParseValue("CODE", $code); $_Tpl_NL->setParseValue("F0", $f0); $_Tpl_NL->setParseValue("F1", $f1); $_Tpl_NL->setParseValue("F2", $f2); $_Tpl_NL->setParseValue("F3", $f3); $_Tpl_NL->setParseValue("F4", $f4); $_Tpl_NL->setParseValue("F5", $f5); $_Tpl_NL->setParseValue("F6", $f6); $_Tpl_NL->setParseValue("F7", $f7); $_Tpl_NL->setParseValue("F8", $f8); $_Tpl_NL->setParseValue("F9", $f9); $_Tpl_NL->setParseValue("MEMO", $memo); $_Tpl_NL->setParseValue("TITLE", $data['nl']['title']); $_Tpl_NL->setParseValue("TITLE_SUB", $data['nl']['title_sub']); $_Tpl_NL->setParseValue("SUMMARY", $data['nl']['summary']); $_Tpl_NL->setParseValue("GROUP", $GROUP); $_Tpl_NL->setParseValue("SUBJECT", $NLSUBJECT); $_Tpl_NL->setParseValue("TM_VERSION", TM_VERSION); $_Tpl_NL->setParseValue("TM_APPNAME", TM_APPNAME); $_Tpl_NL->setParseValue("TM_APPDESC", TM_APPDESC); $_Tpl_NL->setParseValue("TM_APPURL", TM_APPURL); $_Tpl_NL->setParseValue("TM_APPTEXT", TM_APPTEXT); $_Tpl_NL->setParseValue("TM_DISCLAIMER", TM_DISCLAIMER); //add htmlpart! if ($type == "html") { #if ($data['nl']['content_type']=="html" || $data['nl']['content_type']=="text/html") { #send_log("render HTML Template: ".$NL_Filename_N); $Log[] = "render HTML Template: " . $NL_Filename_N; //attachements html code $_Tpl_NL->setParseValue("ATTACHEMENTS", $ATTACHEMENTS); //Template rendern und body zusammenbauen //create header: //1st parse header: $HTML_Head = $this->parseHeader(array("text" => TM_NL_HTML_START)); $HTML_Foot = $this->parseHeader(array("text" => TM_NL_HTML_END)); //replacement array $HTML_search = array("{TITLE}", "{TITLE_SUB}", "{SUBJECT}"); $HTML_replace = array(display($data['nl']['title']), display($data['nl']['title_sub']), $NLSUBJECT); //replace nl vars, title subttle, subject $HTML_Head = str_replace($HTML_search, $HTML_replace, $HTML_Head); $HTML_Foot = str_replace($HTML_search, $HTML_replace, $HTML_Foot); $Return = $HTML_Head . $_Tpl_NL->renderTemplate($NL_Filename_N) . $HTML_Foot; } //add textpart! //use body_text, if body_text is empty or "" or so, convert body to text, this is a fallback, the converting is broken due to wysiwyg and reconverting of e.g. german umlauts to html entitites :O if ($type == "text") { #if ($data['nl']['content_type']=="text" || $data['nl']['content_type']=="text/html") { #if (!empty($NL[0]['body_text']) && $NL[0]['body_text']!="") { //attachements text code $_Tpl_NL->setParseValue("ATTACHEMENTS", $ATTACHEMENTS_TEXT); #$NLBODY_TEXT=$NL[0]['body_text']; #send_log("render Text Template: ".$NL_Filename_T); $Log[] = "render Text Template: " . $NL_Filename_T; $Return = $_Tpl_NL->renderTemplate($NL_Filename_T); //text! #} else { # $NLBODY_TEXT=$NEWSLETTER->convertNL2Text($NLBODY,$NL[0]['content_type']); #} } //if text text/html //finally parse links $LINK = new tm_LNK(); //filter for linkparsing, if text then text, else "" for html version of parsed links $filter = ""; if ($type == "text") { $filter = $type; } if ($data['nl']['track_personalized'] == 1) { $Return = $LINK->parseLinks($Return, $filter, array("nl_id" => $nl_id, "q_id" => $q_id, "a_id" => $a_id, "h_id" => $h_id)); } else { $Return = $LINK->parseLinks($Return, $filter, array("nl_id" => $nl_id, "q_id" => $q_id)); } //return string, later on we will return array [0] is text and [1] is log, containing all logmessages as array #$Return[0]=$parsedNL Array (subject,body); #$Return[1]=$Log; return $Return; }
$ADR = $ADDRESS->getAdr($a_id); //check if adr isset , active and not unsubscribed, status !=11 if (isset($ADR[0]) && $ADR[0]['aktiv'] == 1 && $ADR[0]['status'] != 11) { $valid_adr = TRUE; } } //isset ADR && aktiv //but wait :) //we checked for valid h record before, so if we maybe now have a new adr id if none was set, we will check again if the adr id is still the same as the given a_id if we have a valid h record! hehe if ($valid_adr && $valid_h && $H[0]['adr_id'] != $a_id) { $valid_adr = FALSE; } } //a_id && personalized //check for a valid link id, if set, this link, if valid, will replace the internal fixed LINK1 if (check_dbid($l_id)) { $LINK = new tm_LNK(); $LNK = $LINK->get($l_id); //link must be valid and active! if (isset($LNK[0]) && $LNK[0]['aktiv'] == 1) { $valid_lnk = TRUE; } } //l-id //set status and count click of adr record if ($valid_adr) { //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 }
function createSearchQuery($search) { $Query = " \n\t\t\t\t"; //site_id ist obligatorisch $Query .= " WHERE " . TM_TABLE_LOG . ".siteid='" . TM_SITEID . "'"; if (isset($search['object']) && !empty($search['object'])) { $Query .= " AND (\n\t\t\t\t\t\t" . TM_TABLE_LOG . ".object LIKE '" . str_replace("*", "%", dbesc($search['object'])) . "'\n\t\t\t\t\t)"; } if (isset($search['action']) && !empty($search['action'])) { $Query .= " AND (\n\t\t\t\t\t\t" . TM_TABLE_LOG . ".action='" . dbesc($search['action']) . "'\n\t\t\t\t\t)"; } if (isset($search['author_id']) && check_dbid($search['author_id'])) { $Query .= " AND (\n\t\t\t\t\t\t" . TM_TABLE_LOG . ".author_id='" . checkset_int($search['author_id']) . "'\n\t\t\t\t\t)"; } if (isset($search['edit_id']) && check_dbid($search['edit_id'])) { $Query .= " AND " . TM_TABLE_LOG . ".edit_id=" . checkset_int($search['edit_id']); } if (isset($search['id']) && check_dbid($search['id'])) { $Query .= " AND " . TM_TABLE_LOG . ".id=" . checkset_int($search['id']); } return $Query; }
$LINK = new tm_LNK(); if ($set == "save") { //checkinput if (empty($short)) { $check = false; $_MAIN_MESSAGE .= "<br>" . ___("Kürzel sollte nicht leer sein."); } if (!empty($short) && is_numeric($short)) { $check = false; $_MAIN_MESSAGE .= "<br>" . ___("Kürzel sollte nicht numerisch sein."); } if (empty($name)) { $check = false; $_MAIN_MESSAGE .= "<br>" . ___("Name sollte nicht leer sein."); } if (!check_dbid($lnk_grp[0])) { $check = false; $_MAIN_MESSAGE .= "<br>" . ___("Bitte mindestens eine Gruppe wählen."); } //dublettencheck, kuerzel sollte eindeutig sein! $LNK = $LINK->get(0, array("short" => $short)); if (count($LNK) > 0) { $check = false; $_MAIN_MESSAGE .= "<br>" . ___("Eine Eintrag mit diesem Kürzel existiert bereits. Das Kürzel muss eindeutig sein."); } if ($check) { $LINK->add(array("short" => $short, "name" => $name, "url" => $url, "descr" => $descr, "aktiv" => $aktiv, "created" => $created, "author" => $author), $lnk_grp); $_MAIN_MESSAGE .= "<br>" . sprintf(___("Neuer Eintrag %s (%s) wurde erstellt."), "'<b>" . display($name) . "</b>'", "<em>" . display($short) . "</em>"); $action = "link_list"; require_once TM_INCLUDEPATH . "/link_list.inc.php"; } else {
#$HOST=$HOSTS->getStdSMTPHost(); 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 {
function createLinkGroup($lnkgrp, $filter = "", $data = array()) { $Return = ""; $lnkgrp_arr = preg_split("/,/", $lnkgrp); //preg_split("/[,]+/", $lnk);//splitWithEscape ($lnk, ',', '"'); $lnkgrp_id = str_replace(",", "", $lnkgrp_arr[0]); //we have to remove comma $lnkgrp_params = count($lnkgrp_arr) > 1 ? $lnkgrp_arr[1] : ""; if (!is_numeric($lnkgrp_id)) { $LNKGRP = $this->getGroup(0, array("short" => $lnkgrp_id)); if (count($LNKGRP) > 0) { $Return = $this->createLinkGroup($LNKGRP[0]['id'] . "," . $lnkgrp_params, $filter, $data); } //count } //!numeric if (check_dbid($lnkgrp_id) && is_numeric($lnkgrp_id)) { $LNKGRP = $this->getGroup($lnkgrp_id); if (isset($LNKGRP[0]) && $LNKGRP[0]['aktiv'] == 1) { if ($filter == "text") { $Return = "* " . $LNKGRP[0]['name']; $Return .= "\n" . $LNKGRP[0]['descr']; } else { $Return = "<strong>" . display($LNKGRP[0]['name']) . "</strong>"; $Return .= "<br><font size=-1>" . display($LNKGRP[0]['descr']) . "</font>"; } //get links by groupid $LNK = $this->get(0, array("group" => $lnkgrp_id)); $c = count($LNK); if ($c > 0) { for ($cc = 0; $cc < $c; $cc++) { if ($filter == "text") { $Return .= "\n -- " . $this->createLink($LNK[$cc]['id'], $filter, $data); } else { $Return .= "<br>" . $this->createLink($LNK[$cc]['id'] . "," . $lnkgrp_params, $filter, $data); } } //for } //count } //count } //numeric return $Return; }