/** * 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; }
$Form->set_InputReadonly($FormularName, $InputName_URL, false); $Form->set_InputOrder($FormularName, $InputName_URL, 1); $Form->set_InputLabel($FormularName, $InputName_URL, "URL<br>"); //Gruppe $Form->new_Input($FormularName, $InputName_Group, "select", ""); $Form->set_InputJS($FormularName, $InputName_Group, " onChange=\"flash('submit','#ff0000');\" "); $Form->set_InputDefault($FormularName, $InputName_Group, $lnk_grp_id); $Form->set_InputStyleClass($FormularName, $InputName_Group, "mFormSelect", "mFormSelectFocus"); $Form->set_InputDesc($FormularName, $InputName_Group, ___("Suche nach Gruppenzugehörigkeit")); $Form->set_InputReadonly($FormularName, $InputName_Group, false); $Form->set_InputOrder($FormularName, $InputName_Group, 3); $Form->set_InputLabel($FormularName, $InputName_Group, "Gruppe<br>"); $Form->set_InputSize($FormularName, $InputName_Group, 0, 1); $Form->set_InputMultiple($FormularName, $InputName_Group, false); //add Data $LINK = new tm_LNK(); $GRP = $LINK->getGroup(0, array("count" => 1)); $acg = count($GRP); $Form->add_InputOption($FormularName, $InputName_Group, "", "-- alle"); for ($accg = 0; $accg < $acg; $accg++) { $Form->add_InputOption($FormularName, $InputName_Group, $GRP[$accg]['id'], $GRP[$accg]['name'] . " (" . $GRP[$accg]['item_count'] . ")"); } //Limit $Form->new_Input($FormularName, $InputName_Limit, "select", ""); $Form->set_InputJS($FormularName, $InputName_Limit, " onChange=\"flash('submit','#ff0000');\" "); $Form->set_InputDefault($FormularName, $InputName_Limit, $limit); $Form->set_InputStyleClass($FormularName, $InputName_Limit, "mFormSelect", "mFormSelectFocus"); $Form->set_InputDesc($FormularName, $InputName_Limit, ___("Maximale Anzahl Einträge die auf einmal angezeigt werden.")); $Form->set_InputReadonly($FormularName, $InputName_Limit, false); $Form->set_InputOrder($FormularName, $InputName_Limit, 10); $Form->set_InputLabel($FormularName, $InputName_Limit, ___("zeige max.") . "<br>");
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; }
$InputName_Descr = "descr"; ${$InputName_Descr} = getVar($InputName_Descr); $InputName_Aktiv = "aktiv"; ${$InputName_Aktiv} = getVar($InputName_Aktiv, 0, 1); ##werte aus sessions uebernehmen... oder uebergebene werte //nur wenn nicht gespeichert wird, also nur bei neuaufruf des formulares if ($set != "save") { if (!empty($s_url)) { $url = $s_url; } if (!empty($s_name)) { $name = $s_name; } } $check = true; $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])) {
//create a 2nd example group $example_nl_group_2_id = $NEWSLETTER->addGrp(array("name" => "Newsletter Group 2", "descr" => "zum testen / for testings", "aktiv" => 0, "author" => "install", "created" => $created, "editor" => "install", "updated" => $created)); //create a 3rd group used for templates (subscribe form) $example_nl_group_3_id = $NEWSLETTER->addGrp(array("name" => "Subscribe", "descr" => "templates for subscribe mails send by subscribe-forms", "aktiv" => 1, "author" => "install", "created" => $created, "editor" => "install", "updated" => $created)); //add a first testnewsletter in first group $example_nl_1_id = $NEWSLETTER->addNL(array("subject" => "{DATE} Newsletter 1", "body" => $example_nl_body_html, "body_text" => $example_nl_body_text, "aktiv" => 1, "status" => 1, "massmail" => 0, "link" => "http://www.tellmatic.org", "created" => date("Y-m-d H:i:s"), "author" => "install", "grp_id" => $example_nl_group_1_id, "rcpt_name" => "Newsletter", "track_image" => "_blank", "content_type" => "text/html", "attachements" => array(), "is_template" => 0, "title" => 'Titel', "title_sub" => 'Titel 2', "summary" => 'Zusammenfassender Text zBsp. zur Anzeige auf der Webseite etc.', "track_personalized" => 1)); //add a second testnewsletter in 2nd group $example_nl_2_id = $NEWSLETTER->addNL(array("subject" => "{DATE} Newsletter 2", "body" => $example_nl_body_html, "body_text" => $example_nl_body_text, "aktiv" => 1, "status" => 1, "massmail" => 0, "link" => "http://www.tellmatic.org", "created" => date("Y-m-d H:i:s"), "author" => "install", "grp_id" => $example_nl_group_2_id, "rcpt_name" => "Newsletter", "track_image" => "_blank", "content_type" => "text/html", "attachements" => array(), "is_template" => 0, "title" => 'Titel', "title_sub" => 'Titel 2', "summary" => 'Zusammenfassender Text zBsp. zur Anzeige auf der Webseite etc.', "track_personalized" => 1)); //add newsletter for doubleoptin message, use 3rd example group $example_nl_doptin_id = $NEWSLETTER->addNL(array("subject" => "Newsletteranmeldung / Subscribe {DATE}", "body" => $example_nl_doptin_body_html, "body_text" => $example_nl_doptin_body_text, "aktiv" => 1, "status" => 1, "massmail" => 0, "link" => "http://www.tellmatic.org", "created" => date("Y-m-d H:i:s"), "author" => "install", "grp_id" => $example_nl_group_3_id, "rcpt_name" => "Newsletter", "track_image" => "_blank", "content_type" => "text/html", "attachements" => array(), "is_template" => 1, "title" => '', "title_sub" => '', "summary" => '', "track_personalized" => 1)); //add newsletter for welcome/subscribe message, use 3rd example group $example_nl_welcome_id = $NEWSLETTER->addNL(array("subject" => "Willkommen / Welcome {DATE}", "body" => $example_nl_welcome_body_html, "body_text" => $example_nl_welcome_body_text, "aktiv" => 1, "status" => 1, "massmail" => 0, "link" => "http://www.tellmatic.org", "created" => date("Y-m-d H:i:s"), "author" => "install", "grp_id" => $example_nl_group_3_id, "rcpt_name" => "Newsletter", "track_image" => "_blank", "content_type" => "text/html", "attachements" => array(), "is_template" => 1, "title" => '', "title_sub" => '', "summary" => '', "track_personalized" => 1)); //add newsletter for update mail, use 3rd example group $example_nl_update_id = $NEWSLETTER->addNL(array("subject" => "Aktualisierung / Update {DATE}", "body" => $example_nl_update_body_html, "body_text" => $example_nl_update_body_text, "aktiv" => 1, "status" => 1, "massmail" => 0, "link" => "http://www.tellmatic.org", "created" => date("Y-m-d H:i:s"), "author" => "install", "grp_id" => $example_nl_group_3_id, "rcpt_name" => "Newsletter", "track_image" => "_blank", "content_type" => "text/html", "attachements" => array(), "is_template" => 1, "title" => '', "title_sub" => '', "summary" => '', "track_personalized" => 1)); //add link groups $LINKS = new tm_LNK(); $lnk_group_id_1 = $LINKS->addGrp(array("short" => "tellmatic", "name" => "Tellmatic", "descr" => "Tellmatic Links", "aktiv" => 1, "created" => date("Y-m-d H:i:s"), "author" => "install")); $lnk_group_id_2 = $LINKS->addGrp(array("short" => "index", "name" => "Index", "descr" => "Newsletter Index", "aktiv" => 1, "created" => date("Y-m-d H:i:s"), "author" => "install")); //add links $LINKS->add(array("short" => "tm.home", "name" => "Tellmatic Homepage", "url" => "http://www.tellmatic.org", "descr" => "Tellmatic Homepage", "aktiv" => 1, "created" => date("Y-m-d H:i:s"), "author" => "install"), array(0 => $lnk_group_id_1)); $LINKS->add(array("short" => "tm.doc", "name" => "Tellmatic Documentation", "url" => "http://doc.tellmatic.org", "descr" => "Tellmatic Online Documentation", "aktiv" => 1, "created" => date("Y-m-d H:i:s"), "author" => "install"), array(0 => $lnk_group_id_1)); $LINKS->add(array("short" => "tm.donate", "name" => "Donate to Tellmatic", "url" => "http://www.tellmatic.org/donate", "descr" => "Tellmatic Donation", "aktiv" => 1, "created" => date("Y-m-d H:i:s"), "author" => "install"), array(0 => $lnk_group_id_1)); $LINKS->add(array("short" => "tm.contact", "name" => "Contact / Kontakt", "url" => "http://www.tellmatic.org/contact&sendForm=1&name={F1} {F2}&email={EMAIL}&code={CODE}&adrid={ADRID}&subject=Test", "descr" => "Tellmatic Contact", "aktiv" => 1, "created" => date("Y-m-d H:i:s"), "author" => "install"), array(0 => $lnk_group_id_1)); $LINKS->add(array("short" => "idx.top", "name" => "Top", "url" => "#top", "descr" => "Jump to Top", "aktiv" => 1, "created" => date("Y-m-d H:i:s"), "author" => "install"), array(0 => $lnk_group_id_2)); $LINKS->add(array("short" => "idx.bottom", "name" => "Bottom", "url" => "#bottom", "descr" => "Jump to Bottom", "aktiv" => 1, "created" => date("Y-m-d H:i:s"), "author" => "install"), array(0 => $lnk_group_id_2)); //adr gruppe $ADDRESS = new tm_ADR(); $ADDRESS->addGrp(array("name" => "ADR Group 1", "descr" => "zum testen / for testings", "aktiv" => 1, "prod" => 1, "author" => "install", "created" => $created, "editor" => "install", "updated" => $created, "public" => 1, "public_name" => "Test 1")); $ADDRESS->setGRPStd(1, 1); $ADDRESS->addGrp(array("name" => "ADR Group 2", "descr" => "zum testen / for testings", "aktiv" => 0, "prod" => 0, "author" => "install", "created" => $created, "editor" => "install", "updated" => $created, "public" => 0, "public_name" => "Test 2")); //adr : ok, bounce
$_MAIN_MESSAGE .= ""; if (!isset($offset)) { $offset = getVar("offset"); } if (empty($offset) || $offset < 0) { $offset = 0; } if (!isset($limit)) { $limit = getVar("limit"); } if (empty($limit)) { $limit = 25; } $no_list = getVar("no_list"); //sort und sorttype nach search verschoben $LINK = new tm_LNK(); $lnk_grp_id = getVar("lnk_grp_id"); $lnk_id = getVar("lnk_id"); $set = getVar("set"); $val = getVar("val"); $doit = getVar("doit"); //wird per js an url angefuegt!!! confirm() if (!isset($search)) { $search = array(); } require_once TM_INCLUDEPATH . "/link_search.inc.php"; if ($set == "aktiv") { $LINK->setAktiv($lnk_id, $val); if ($val == 1) { $_MAIN_MESSAGE .= "<br>" . ___("Eintrag wurde aktiviert."); } else {
//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 } //adr click counter ++
$Form->set_InputDesc($FormularName, $InputName_Aktiv, ___("Aktiv")); $Form->set_InputReadonly($FormularName, $InputName_Aktiv, false); $Form->set_InputOrder($FormularName, $InputName_Aktiv, 2); $Form->set_InputLabel($FormularName, $InputName_Aktiv, ""); //Gruppe $Form->new_Input($FormularName, $InputName_Group, "select", ""); $Form->set_InputJS($FormularName, $InputName_Group, " onChange=\"flash('submit','#ff0000');\" "); $Form->set_InputStyleClass($FormularName, $InputName_Group, "mFormSelect", "mFormSelectFocus"); $Form->set_InputDesc($FormularName, $InputName_Group, ___("Gruppen wählen, STRG/CTRL gedrückt halten und klicken f. Mehrfachauswahl")); $Form->set_InputReadonly($FormularName, $InputName_Group, false); $Form->set_InputOrder($FormularName, $InputName_Group, 4); $Form->set_InputLabel($FormularName, $InputName_Group, ""); $Form->set_InputSize($FormularName, $InputName_Group, 0, 10); $Form->set_InputMultiple($FormularName, $InputName_Group, true); //add Data $LINK = new tm_LNK(); $LNKGRP = $LINK->getGroup(); $acg = count($LNKGRP); for ($accg = 0; $accg < $acg; $accg++) { $Form->add_InputOption($FormularName, $InputName_Group, $LNKGRP[$accg]['id'], $LNKGRP[$accg]['name']); } //short $Form->new_Input($FormularName, $InputName_Short, "text", display(${$InputName_Short})); $Form->set_InputJS($FormularName, $InputName_Short, " onChange=\"flash('submit','#ff0000');\" onkeyup=\"RemoveInvalidChars(this, '[^A-Za-z0-9\\_\\.\\-]'); ForceLowercase(this);\""); $Form->set_InputStyleClass($FormularName, $InputName_Short, "mFormText", "mFormTextFocus"); $Form->set_InputSize($FormularName, $InputName_Short, 48, 256); $Form->set_InputDesc($FormularName, $InputName_Short, ___("Kurzbezeichnung/Kürzel")); $Form->set_InputReadonly($FormularName, $InputName_Short, false); $Form->set_InputOrder($FormularName, $InputName_Short, 1); $Form->set_InputLabel($FormularName, $InputName_Short, ""); //Descr
$set = getVar("set"); $lnk_grp_id = getVar("lnk_grp_id"); //field names for query $InputName_Name = "name"; //range from ${$InputName_Name} = getVar($InputName_Name); $InputName_Descr = "descr"; //range from ${$InputName_Descr} = getVar($InputName_Descr); $InputName_Aktiv = "aktiv"; //range from ${$InputName_Aktiv} = getVar($InputName_Aktiv); $InputName_Short = "short"; //range from ${$InputName_Short} = getVar($InputName_Short); $LNKGRP = new tm_LNK(); $GRP = $LNKGRP->getGroup($lnk_grp_id); $standard = $GRP[0]['standard']; if ($set == "save") { $check = true; //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;
$lnk_grp[0] = 0; } $InputName_Name = "name"; // ${$InputName_Name} = getVar($InputName_Name); $InputName_Aktiv = "aktiv"; // ${$InputName_Aktiv} = getVar($InputName_Aktiv); $InputName_URL = "url"; // ${$InputName_URL} = getVar($InputName_URL); $InputName_Short = "short"; ${$InputName_Short} = getVar($InputName_Short); $InputName_Descr = "descr"; ${$InputName_Descr} = getVar($InputName_Descr); $LINK = new tm_LNK(); $LNK = $LINK->get($lnk_id); $check = true; 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.");
/********************************************************************************/ /* 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 */ /********************************************************************************/ $_MAIN_DESCR = ___("Linkgruppen verwalten"); $_MAIN_MESSAGE .= ""; $LINKS = new tm_LNK(); $lnk_grp_id = getVar("lnk_grp_id"); $set = getVar("set"); $val = getVar("val"); $doit = getVar("doit"); //wird per js an url angefuegt!!! confirm() if ($set == "aktiv") { $LINKS->setGRPAktiv($lnk_grp_id, $val); if ($val == 1) { $_MAIN_MESSAGE .= "<br>" . ___("Eintrag wurde aktiviert."); } else { $_MAIN_MESSAGE .= "<br>" . ___("Eintrag wurde de-aktiviert."); } } if ($set == "standard") { $LINKS->setGRPStd($lnk_grp_id, $val);
$_MAIN_MESSAGE .= ""; $created = date("Y-m-d H:i:s"); $author = $LOGIN->USER['name']; $set = getVar("set"); $lnk_grp_id = 0; $standard = 0; //field names for query $InputName_Short = "short"; ${$InputName_Short} = getVar($InputName_Short); $InputName_Name = "name"; ${$InputName_Name} = getVar($InputName_Name); $InputName_Descr = "descr"; ${$InputName_Descr} = getVar($InputName_Descr); $InputName_Aktiv = "aktiv"; ${$InputName_Aktiv} = getVar($InputName_Aktiv); $LNKGRP = new tm_LNK(); if ($set == "save") { $check = true; //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."); }