$QUEUE = new tm_Q(); $ADDRESS = new tm_ADR(); $_MAIN_MESSAGE .= "<br>" . sprintf(___("Ausgewählter Mail-Server: %s"), $HOST[0]['name']); if ($check_blacklist == 1) { $_MAIN_MESSAGE .= "<br>" . tm_icon("ruby.png", ___("Blacklist")) . " " . ___("Blacklist Überprüfung aktiv"); } //nur q eintraege hinzufügen die noch nicht vorhanden sind oder status gesendet haben //status gesendet=4, //NICHT: neu=1, gestartet/wait=2, running=3 //fuer jede gruppe im array adr_grp! for ($gcc = 0; $gcc < $gc; $gcc++) { $group_add = false; $grp_id = $adr_grp[$gcc]; $GRP = $ADDRESS->getGroup($grp_id); //function getQ($id=0,$offset=0,$limit=0,$nl_id=0,$grp_id=0,$status=0) $Qnew = $QUEUE->getQ(0, 0, 0, $nl_id, $grp_id, 1); $qc_new = count($Qnew); if ($qc_new != 0) { //gefunden ? nicht hinzufügen unset($adr_grp[$gcc]); $_MAIN_MESSAGE .= "<br><font color=\"red\">" . sprintf(___("Für die Gruppe %s existieren bereits %s neue Einträge. Nicht hinzugefügt!"), "'<b>" . display($GRP[0]['name']) . "</b>'", "<b>" . $qc_new . "</b>") . "</font>"; } else { //qnew!=0 $Qwait = $QUEUE->getQ(0, 0, 0, $nl_id, $grp_id, 2); $qc_wait = count($Qwait); if ($qc_wait != 0) { // unset($adr_grp[$gcc]); $_MAIN_MESSAGE .= "<br><font color=\"red\">" . sprintf(___("Für die Gruppe %s existieren bereits %s gestartete/wartende Einträge. Nicht hinzugefügt!"), "'<b>" . display($GRP[0]['name']) . "</b>'", "<b>" . $qc_wait . "</b>") . "</font>"; } else { //qwait!=0
//remove this line or add # in front of line //inclue tm config include "./include/tm_config.inc.php"; //change path to full path to tm_config if the script is not in tellmatic installation directory! //Beispielcode: letzte X Newsletter anzeigen, newsletter aber aus q holen! nur mit status versendet! //"Newsletter-Archiv" //This is just a very simple example! $nl_offset = 0; //offset, kann auch aus $_GET oder per getVar ermittelt werden.... $nl_limit = 10; //anzahl anzuzeigender newsletter $nl_content = 0; //do not return content $nl_grpid = 0; //nl group, 0=all groups $QUEUE = new tm_Q(); $NL = new tm_NL(); $search_nl['is_template'] = 0; $search_nl['aktiv'] = 1; $search_nl['status'] = array(3, 4, 5); //started, sent, archiv, see Stats.inc.php $Q = $QUEUE->getQ(0, 0, $nl_limit, 0, $nl_grpid, 4); foreach ($Q as $q) { $N = $NL->getNL($q['nl_id'], 0, 1, 0, 1, "", 1, $search_nl); $nl = $N[0]; $nl_image = "nl_" . date_convert_to_string($nl['created']) . "_1.jpg"; $nl_imageurl = $tm_URL_FE . "/" . $tm_nlimgdir . "/" . $nl_image; echo "created " . display($nl['created']) . " by " . display($nl['author']) . "\n<br>\n" . "last updated " . display($nl['updated']) . " by " . display($nl['editor']) . "\n<br>\n" . "<a href=\"" . $nl['link'] . "\" target=\"_blank\">" . display($nl['title']) . "<br>" . display($nl['title_sub']) . "</a>" . "\n<br>\n" . display($nl['summary']) . "\n<br>\n" . "<a href=\"" . $nl['link'] . "\" target=\"_blank\">" . "<img src=\"" . $nl_imageurl . "\" border=0 width=200 height=200>\n" . "\n<br>\n" . display($nl_imageurl) . "</a>" . "</font>\n"; echo "<hr>\n"; } //for / foreach
/** * 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; }
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; }
$grp_id = getVar("grp_id"); } //wenn neue q, nur neue q's checken if (isset($new_q_arr[0])) { //0 weil min. 1 id $start_queue = true; $q_arr = $new_q_arr; if (DEBUG) { $_MAIN_MESSAGE .= "<br>Fall 1: neue queue<br>"; } } //keine neue q, wenn nl_id und keine q_id, q's aus nl holen if (!isset($new_q_arr[0])) { if (check_dbid($nl_id) && !check_dbid($q_id)) { #$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);
$_MAIN_DESCR = ___("Newsletter Warteschlange (Q)"); $_MAIN_MESSAGE .= ""; $QUEUE = new tm_Q(); $HOSTS = new tm_HOST(); $ADDRESS = new tm_ADR(); $NEWSLETTER = new tm_NL(); $set = getVar("set"); $val = getVar("val"); $q_id = getVar("q_id"); $nl_id = getVar("nl_id"); $grp_id = getVar("grp_id"); $doit = getVar("doit"); //wird per js an url angefuegt!!! confirm() //logfile if (check_dbid($q_id)) { $Q = $QUEUE->getQ($q_id); $logfilename = "q_.log.html"; if (isset($Q[0]['id'])) { $logfilename = "q_" . $Q[0]['id'] . "_" . $Q[0]['grp_id'] . "_" . date_convert_to_string($Q[0]['created']) . ".log.html"; } } /* Actions */ //stop queue if ($set == "stop" && $doit == 1 && check_dbid($q_id)) { $QUEUE->setStatus($q_id, 5); $LOG = "[" . microtime(TRUE) . "][0]," . date("Y-m-d H:i:s") . ",q:" . $q_id . ",n:0,g:0,a:0,t: Q ID {$q_id} halted\n"; update_file($tm_logpath, $logfilename, $LOG); } //restart queue with failed or canceled/skipped records if ($set == "restart_failed" && $doit == 1 && check_dbid($q_id)) { $QUEUE->restart_failed($q_id);