Example #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;
 }
Example #2
0
        $_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 {
        require_once TM_INCLUDEPATH . "/link_form.inc.php";
        require_once TM_INCLUDEPATH . "/link_form_show.inc.php";
    }
} else {
    srand((double) microtime() * 1000000);
Example #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);
Example #4
0
         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 ++
     $ADDRESS->addClick($a_id);
Example #5
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.");
    }