예제 #1
0
 /**
  * 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_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>");
$Form->set_InputSize($FormularName, $InputName_Limit, 0, 1);
예제 #3
0
//aktiv single
if ($set == "delete" && $doit == 1) {
    if (!DEMO) {
        $LINK->del($lnk_id);
    }
    $_MAIN_MESSAGE .= "<br>" . ___("Eintrag wurde gelöscht.");
}
//del single
$search['offset'] = $offset;
$search['limit'] = $limit;
$search['sortIndex'] = $sortIndex;
$search['sortType'] = $sortType;
if ($lnk_grp_id > 0) {
    $search['group'] = $lnk_grp_id;
    $LNK = $LINK->get(0, $search);
    $lnk_grp = $LINK->getGroup($lnk_grp_id);
    $_MAIN_OUTPUT .= "<br>" . sprintf(___("gewählte Gruppe: %s"), "<b>" . display($lnk_grp[0]['name']) . "</b>");
} else {
    $LNK = $LINK->get(0, $search);
}
$ac = count($LNK);
$entrys = $ac;
// fuer pager.inc!!! // aktuelle anzahl angezeigter eintraege
$entrys_total = $LINK->count($lnk_grp_id, $search);
//anzahl eintraege aktuell gewaehlt mit filter
//globale parameter die angefuegt werden sollen!
$mSTDURL->addParam("offset", $offset);
$mSTDURL->addParam("limit", $limit);
if (isset($s_name)) {
    $mSTDURL->addParam("s_name", $s_name);
}
예제 #4
0
$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
$Form->new_Input($FormularName, $InputName_Descr, "textarea", display(${$InputName_Descr}));
예제 #5
0
$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;
        $_MAIN_MESSAGE .= "<br>" . ___("Name sollte nicht leer sein.");
예제 #6
0
    $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.");
    }
    //dublettencheck, kuerzel sollte eindeutig sein!
    $G = $LNKGRP->getGroup(0, array("short" => $short));
    if (count($G) > 0) {
        $check = false;
        $_MAIN_MESSAGE .= "<br>" . ___("Eine Gruppe mit diesem Kürzel existiert bereits. Das Kürzel muss eindeutig sein.");
    }
    if ($check) {
        $LNKGRP->addGrp(array("short" => $short, "name" => $name, "descr" => $descr, "aktiv" => $aktiv, "created" => $created, "author" => $author));
        $_MAIN_MESSAGE .= "<br>" . sprintf(___("Neue Gruppe %s (%s) wurde erstellt."), "'<b>" . display($name) . "</b>'", "<em>" . display($short) . "</em>");
        $action = "link_grp_list";
        require_once TM_INCLUDEPATH . "/link_grp_list.inc.php";
    } else {
        require_once TM_INCLUDEPATH . "/link_grp_form.inc.php";
        require_once TM_INCLUDEPATH . "/link_grp_form_show.inc.php";
    }
} else {
    ${$InputName_Aktiv} = 1;