/** * 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_InputOrder($FormularName, $InputName_Summary, 22); $Form->set_InputLabel($FormularName, $InputName_Summary, ""); //Gruppe $Form->new_Input($FormularName, $InputName_Group, "select", ""); $Form->set_InputJS($FormularName, $InputName_Group, " onChange=\"flash('submit','#ff0000');\" "); $Form->set_InputDefault($FormularName, $InputName_Group, $nl_grp_id); $Form->set_InputStyleClass($FormularName, $InputName_Group, "mFormSelect", "mFormSelectFocus"); $Form->set_InputDesc($FormularName, $InputName_Group, ___("Newsletter-Gruppe waehlen")); $Form->set_InputReadonly($FormularName, $InputName_Group, false); $Form->set_InputOrder($FormularName, $InputName_Group, 6); $Form->set_InputLabel($FormularName, $InputName_Group, ""); $Form->set_InputSize($FormularName, $InputName_Group, 0, 1); $Form->set_InputMultiple($FormularName, $InputName_Group, false); //add Data $NEWSLETTER = new tm_NL(); $GRP = $NEWSLETTER->getGroup(); $acg = count($GRP); for ($accg = 0; $accg < $acg; $accg++) { $Form->add_InputOption($FormularName, $InputName_Group, $GRP[$accg]['id'], $GRP[$accg]['name']); } //Select existing Trackimage $Form->new_Input($FormularName, $InputName_TrackImageExisting, "select", ""); $Form->set_InputJS($FormularName, $InputName_TrackImageExisting, " onChange=\"flash('submit','#ff0000');\" "); $Form->set_InputDefault($FormularName, $InputName_TrackImageExisting, basename(${$InputName_TrackImageExisting})); $Form->set_InputStyleClass($FormularName, $InputName_TrackImageExisting, "mFormSelect", "mFormSelectFocus"); $Form->set_InputDesc($FormularName, $InputName_TrackImageExisting, ___("Blind-/Tracking-Bild auswählen")); $Form->set_InputReadonly($FormularName, $InputName_TrackImageExisting, false); $Form->set_InputOrder($FormularName, $InputName_TrackImageExisting, 10); $Form->set_InputLabel($FormularName, $InputName_TrackImageExisting, ""); $Form->set_InputSize($FormularName, $InputName_TrackImageExisting, 0, 1); $Form->set_InputMultiple($FormularName, $InputName_TrackImageExisting, false);
//////////////////////////////////////////////////////////////////////////////////////// $_MAIN_OUTPUT .= "</td></tr><tr><td valign=\"top\" align=\"left\" style=\"border-top:1px solid #000000\">"; // width=50% //////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////// //Newsletter Queue: //////////////////////////////////////////////////////////////////////////////////////// //prepare chart #$chart = new PieChart(640,480); $chart = new HorizontalChart(640, 360); $chart->setLogo(TM_IMGPATH . "/blank.png"); //tellmatic_logo_256.png $_MAIN_OUTPUT .= "<br><img alt=\"Chart\" src=\"" . $tm_URL_FE . "/" . $tm_reportdir . "/status_q_total_" . TM_TODAY . ".png\"><br>"; $NG = $NEWSLETTER->getGroup(); $nlgc = count($NG); $N = $NEWSLETTER->getNLID(); //$group $nlc = count($N); $hc = $QUEUE->countH(); //add total value to graph $chart->addPoint(new Point(___("Summe", 0) . " (100%)", $hc)); $shownlURLPara->addParam("act", "nl_list"); $shownlURLPara->addParam("set", ""); $shownlURLPara->delParam("nl_id", ""); $shownlURLPara_ = $shownlURLPara->getAllParams(); $hsc = count($STATUS['h']['status']); $_MAIN_OUTPUT .= "<br><center>"; $_MAIN_OUTPUT .= "<table border=0 width=\"100%\" style=\"border:1px solid #eeeeee;\">"; $_MAIN_OUTPUT .= "<thead>";
} //art der sortierung, asc, desc $sortType = getVar("st", 1, 1); //varname, addslashes, default_if_not_set if ($sortType != 0 && $sortType != 1) { $sortType = 1; } //suchparameter setzen, erstmal nur wegen templates if (isset($is_template)) { $s_nl_istemplate = $is_template; } $search_nl['is_template'] = $s_nl_istemplate; if ($nl_grp_id != 0) { $NL = $NEWSLETTER->getNL(0, $offset, $limit, $nl_grp_id, 0, $sortIndex, $sortType, $search_nl); // $nl_grp = $NEWSLETTER->getGroup($nl_grp_id); $_MAIN_MESSAGE .= "<br>" . sprintf(___("Gewählte Gruppe: %s"), "<b>" . display($nl_grp[0]['name']) . "</b>"); } else { $NL = $NEWSLETTER->getNL(0, $offset, $limit, 0, 0, $sortIndex, $sortType, $search_nl); // } $nc = count($NL); $entrys = $nc; // fuer pager.inc!!! $entrys_total = $NEWSLETTER->countNL($nl_grp_id, $search_nl); $NL = sort_array($NL, $sortIndex, $sortType); //defaults $mSTDURL->addParam("act", "nl_list"); $mSTDURL->addParam("offset", $offset); $mSTDURL->addParam("limit", $limit); $mSTDURL->addParam("st", $sortType);
//field names for query $InputName_Name = "name"; //range from ${$InputName_Name} = getVar($InputName_Name); $InputName_Descr = "descr"; //range from ${$InputName_Descr} = getVar($InputName_Descr, 0); $InputName_Aktiv = "aktiv"; //range from ${$InputName_Aktiv} = getVar($InputName_Aktiv); $InputName_Color = "color"; ${$InputName_Color} = getVar($InputName_Color); $InputName_ColorView = "color_view"; //nur anzeige.... $NEWSLETTER = new tm_NL(); $GRP = $NEWSLETTER->getGroup($nl_grp_id, 0, 0); $standard = $GRP[0]['standard']; if ($set == "save") { $check = true; //checkinput if (empty($name)) { $check = false; $_MAIN_MESSAGE .= "<br>" . ___("Name der Gruppe sollte nicht leer sein."); } if ($check) { $NEWSLETTER->updateGrp(array("id" => $nl_grp_id, "name" => $name, "descr" => $descr, "aktiv" => $aktiv, "created" => $created, "author" => $author)); $_MAIN_MESSAGE .= "<br>" . sprintf(___("Newslettergruppe %s wurde aktualisiert."), "'<b>" . display($name) . "</b>'"); $action = "nl_grp_list"; require_once TM_INCLUDEPATH . "/nl_grp_list.inc.php"; } else { require_once TM_INCLUDEPATH . "/nl_grp_form.inc.php";
} else { $_MAIN_MESSAGE .= "<br>" . ___("Eintrag wurde de-aktiviert."); } } if ($set == "standard") { $NEWSLETTER->setGRPStd($nl_grp_id, $val); //val??? $_MAIN_MESSAGE .= "<br>" . ___("Neue Standardgruppe wurde definiert."); } if ($set == "delete" && $doit == 1) { if (!DEMO) { $NEWSLETTER->delGRP($nl_grp_id); } $_MAIN_MESSAGE .= "<br>" . ___("Eintrag wurde gelöscht."); } $GRP = $NEWSLETTER->getGroup(0, 0, 1); $ncg = count($GRP); $editURLPara = tmObjCopy($mSTDURL); $editURLPara->addParam("act", "nl_grp_edit"); $shownlURLPara = tmObjCopy($mSTDURL); $shownlURLPara->addParam("act", "nl_list"); $addnlURLPara = tmObjCopy($mSTDURL); $addnlURLPara->addParam("act", "nl_new"); $aktivURLPara = tmObjCopy($mSTDURL); $aktivURLPara->addParam("act", "nl_grp_list"); $aktivURLPara->addParam("set", "aktiv"); $delURLPara = tmObjCopy($mSTDURL); $delURLPara->addParam("act", "nl_grp_list"); $delURLPara->addParam("set", "delete"); $stdURLPara = tmObjCopy($mSTDURL); $stdURLPara->addParam("act", "nl_grp_list");