//eigene errorhandler funktion
 set_error_handler("userErrorHandler");
 /***********************************************************/
 //htmlparser, convert html to text
 /***********************************************************/
 require_once TM_INCLUDEPATH . "/phphtmlparser/html2text.inc";
 /***********************************************************/
 //klassen
 /***********************************************************/
 require_once TM_INCLUDEPATH . "/Classes.inc.php";
 #require_once (TM_INCLUDEPATH."/phphtmlparser/html2text.inc");
 //wird bisher nur beim versenden in send_it.php benoetigt, und deshalb auch nur dort eingebunden!
 /***********************************************************/
 //config aus db holen
 /***********************************************************/
 $CONFIG = new tm_CFG();
 $C = $CONFIG->getCFG(TM_SITEID);
 //eMail prueflevel!
 $EMailcheck_Intern = $C[0]['emailcheck_intern'];
 $EMailcheck_Subscribe = $C[0]['emailcheck_subscribe'];
 $EMailcheck_Sendit = $C[0]['emailcheck_sendit'];
 $EMailcheck_Checkit = $C[0]['emailcheck_checkit'];
 /***********************************************************/
 //eigene gettext emulation:
 /***********************************************************/
 #define("DEFAULT_LOCALE", 'de');
 define("DEFAULT_LOCALE", $C[0]['lang']);
 require_once TM_INCLUDEPATH . "/GetText.inc.php";
 /***********************************************************/
 //array mit verfuegbaren sprachen
 /***********************************************************/
 /**
  * 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;
 }
/********************************************************************************/
/* this file is part of: / diese Datei ist ein Teil von:                        */
/* tellmatic, the newslettermachine                                             */
/* tellmatic, die Newslettermaschine                                            */
/* 2006/11 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 = ___("Benutzer/Authoren verwalten");
$_MAIN_MESSAGE .= "";
$USERS = new tm_CFG();
$u_id = getVar("u_id");
$set = getVar("set");
$val = getVar("val");
$doit = getVar("doit");
//wird per js an url angefuegt!!! confirm()
if ($set == "aktiv") {
    if (!DEMO) {
        $USERS->setUSERAktiv($u_id, $val);
    }
    if ($val == 1) {
        $_MAIN_MESSAGE .= "<br>" . ___("Benutzer wurde aktiviert.");
    } else {
        $_MAIN_MESSAGE .= "<br>" . ___("Benutzer wurde de-aktiviert.");
    }
}
 define("TM_TABLE_NL_ATTM", $tm_tablePrefix . "nl_attm");
 define("TM_TABLE_FRM", $tm_tablePrefix . "frm");
 define("TM_TABLE_FRM_GRP_REF", $tm_tablePrefix . "frm_grp_ref");
 define("TM_TABLE_FRM_S", $tm_tablePrefix . "frm_s");
 define("TM_TABLE_HOST", $tm_tablePrefix . "hosts");
 define("TM_TABLE_BLACKLIST", $tm_tablePrefix . "blacklist");
 define("TM_TABLE_LNK", $tm_tablePrefix . "lnk");
 define("TM_TABLE_LNK_GRP", $tm_tablePrefix . "lnk_grp");
 define("TM_TABLE_LNK_GRP_REF", $tm_tablePrefix . "lnk_grp_ref");
 define("TM_TABLE_LNK_CLICK", $tm_tablePrefix . "lnk_click");
 /***********************************************************/
 //add user
 /***********************************************************/
 if (!DEMO) {
     $pass_hash = md5(TM_SITEID . $name . $pass);
     $CONFIG = new tm_CFG();
     $CONFIG->addUSER(array("siteid" => TM_SITEID, "name" => $name, "passwd" => $pass_hash, "crypt" => crypt($pass, CRYPT_EXT_DES), "email" => $email, "aktiv" => 1, "admin" => 1, "manager" => 1, "style" => "default", "lang" => $lang, "startpage" => "Welcome", "expert" => 0));
 }
 //demo
 $MESSAGE .= "<br>" . sprintf(___("Benutzer '%s' wurde angelegt."), $name);
 /***********************************************************/
 //add config
 /***********************************************************/
 if (!DEMO) {
     //insert config
     $CONFIG->addCFG(array("siteid" => TM_SITEID, "name" => "Tellmatic_0", "lang" => $lang, "style" => "default", "notify_mail" => $email, "notify_subscribe" => 0, "notify_unsubscribe" => 0, "max_mails_retry" => 5, "emailcheck_intern" => 2, "emailcheck_subscribe" => 2, "emailcheck_sendit" => 1, "emailcheck_checkit" => 3, "check_version" => 1, "rcpt_name" => "Newsletter", "track_image" => '_blank', "unsubscribe_use_captcha" => 0, "unsubscribe_digits_captcha" => 4, "unsubscribe_sendmail" => 1, "unsubscribe_action" => "unsubscribe", "unsubscribe_host" => 1, "checkit_limit" => 25, "checkit_from_email" => '', "checkit_adr_reset_error" => 1, "checkit_adr_reset_status" => 1, "bounceit_limit" => 10, "bounceit_host" => 0, "bounceit_action" => 'auto', "bounceit_search" => 'header', "bounceit_filter_to" => 0, "bounceit_filter_to_email" => '', "proof" => 1, "proof_url" => 'http://proof.tellmatic.org', "proof_trigger" => 10, "proof_pc" => 10));
     //add mailservers, use default settings for config and create smtp/pop3 host entries...
     $HOSTS = new tm_HOST();
     //add smtp host
     $Add_Host = $HOSTS->addHost(array("siteid" => TM_SITEID, "name" => "default smtp", "aktiv" => 1, "host" => $smtp_host, "port" => $smtp_port, "options" => "novalidate-cert", "smtp_auth" => $smtp_auth, "smtp_domain" => $smtp_domain, "smtp_ssl" => 0, "smtp_max_piped_rcpt" => 1, "type" => "smtp", "user" => $smtp_user, "pass" => $smtp_pass, "max_mails_atonce" => 25, "max_mails_bcc" => 1, "sender_name" => "Tellmatic", "sender_email" => $email, "return_mail" => $email, "reply_to" => $email, "delay" => 100000));
     //make default smtp host!
${$InputName_Admin} = getVar($InputName_Admin);
$InputName_Manager = "manager";
${$InputName_Manager} = getVar($InputName_Manager);
$InputName_Startpage = "startpage";
${$InputName_Startpage} = getVar($InputName_Startpage);
$InputName_Style = "style";
${$InputName_Style} = getVar($InputName_Style);
$InputName_Lang = "lang";
${$InputName_Lang} = getVar($InputName_Lang);
$InputName_Pass = "******";
//
${$InputName_Pass} = getVar($InputName_Pass);
$InputName_Pass2 = "pass2";
//
${$InputName_Pass2} = getVar($InputName_Pass2);
$USERS = new tm_CFG();
$USER = $USERS->getUsers("", $u_id);
if ($set == "save") {
    $check = true;
    $change_pw = true;
    //checkinput
    if (empty($name)) {
        $check = false;
        $_MAIN_MESSAGE .= "<br>" . ___("Der Name darf nicht leer sein.");
    }
    if (empty($email)) {
        $check = false;
        $_MAIN_MESSAGE .= "<br>" . ___("Die E-Mail-Adresse darf nicht leer sein.");
    }
    //email auf gueltigkeit pruefen
    $check_mail = checkEmailAdr($email, $EMailcheck_Intern);
     $check = false;
     $_MAIN_MESSAGE .= "<br>" . ___("Der Name darf nicht leer sein.");
 }
 if (empty($email)) {
     $check = false;
     $_MAIN_MESSAGE .= "<br>" . ___("Die E-Mail-Adresse darf nicht leer sein.");
 }
 //email auf gueltigkeit pruefen
 $check_mail = checkEmailAdr($email, $EMailcheck_Intern);
 if (!$check_mail[0]) {
     $check = false;
     $_MAIN_MESSAGE .= "<br>" . ___("Die E-Mail-Adresse ist nicht gültig.") . " " . $check_mail[1];
 }
 if ($check) {
     if (!DEMO) {
         $USERS = new tm_CFG();
         $pass_hash = md5(TM_SITEID . $name . $pass);
         $USERS->addUSER(array("siteid" => TM_SITEID, "name" => $name, "passwd" => $pass_hash, "crypt" => crypt($pass, CRYPT_EXT_DES), "email" => $email, "aktiv" => $aktiv, "admin" => $admin, "manager" => $manager, "startpage" => $startpage, "style" => $style, "lang" => $lang, "expert" => 0));
         //neue .htpasswd schreiben!
         $tm_htpasswd = "";
         //userliste holen
         $ALL_USERS = $USERS->getUsers();
         $uc = count($ALL_USERS);
         for ($ucc = 0; $ucc < $uc; $ucc++) {
             $tm_htpasswd .= $ALL_USERS[$ucc]['name'] . ":" . $ALL_USERS[$ucc]['crypt'] . "\n";
         }
         //for
         //neue .htpasswd schreiben!
         write_file(TM_INCLUDEPATH, ".htpasswd", $tm_htpasswd);
         unset($ALL_USERS);
     }
Exemple #7
0
     $usr_message .= "<br>" . ___("Kein Passwort angegeben.");
 }
 if (strlen($pass) < $minlength_pw) {
     $check = false;
     $usr_message .= "<br>" . sprintf(___("Passwort sollte mindestens %s Zeichen haben."), $minlength_pw);
 }
 if ($pass != $pass2) {
     $check = false;
     $usr_message .= "<br>" . ___("Bitte geben Sie zweimal das gleiche Passwort an.");
 }
 $check_mail = checkEmailAdr($email, $EMailcheck_Intern);
 if (!$check_mail[0]) {
     $check = false;
     $usr_message .= "<br>" . ___("E-Mail-Adresse ist nicht gültig.") . " " . $check_mail[1];
 }
 $USER = new tm_CFG();
 if ($check) {
     if (!DEMO) {
         $pass_hash = md5(TM_SITEID . $LOGIN->USER['name'] . $pass);
         $USER->setPasswd($LOGIN->USER['name'], $pass_hash, crypt($pass, CRYPT_EXT_DES));
         $_SESSION['user_pw_md5'] = $pass_hash;
         //neue .htpasswd schreiben!
         $tm_htpasswd = "";
         //userliste holen
         $USERS = $USER->getUsers();
         $uc = count($USERS);
         for ($ucc = 0; $ucc < $uc; $ucc++) {
             $tm_htpasswd .= $USERS[$ucc]['name'] . ":" . $USERS[$ucc]['crypt'] . "\n";
         }
         //neue .htpasswd schreiben!
         write_file(TM_INCLUDEPATH, ".htpasswd", $tm_htpasswd);
 ${$InputName_BounceitAction} = getVar($InputName_BounceitAction);
 $InputName_BounceitSearch = "bounceit_search";
 ${$InputName_BounceitSearch} = getVar($InputName_BounceitSearch);
 $InputName_BounceitFilterTo = "bounceit_filter_to";
 ${$InputName_BounceitFilterTo} = getVar($InputName_BounceitFilterTo);
 $InputName_BounceitFilterToEmail = "bounceit_filter_to_email";
 ${$InputName_BounceitFilterToEmail} = getVar($InputName_BounceitFilterToEmail);
 $InputName_Proof = "proof";
 ${$InputName_Proof} = getVar($InputName_Proof);
 $InputName_ProofURL = "proof_url";
 ${$InputName_ProofURL} = getVar($InputName_ProofURL);
 $InputName_ProofTrigger = "proof_trigger";
 ${$InputName_ProofTrigger} = getVar($InputName_ProofTrigger);
 $InputName_ProofPc = "proof_pc";
 ${$InputName_ProofPc} = getVar($InputName_ProofPc);
 $CONFIG = new tm_CFG();
 $HOSTS = new tm_HOST();
 //read css directories and check for stylesheets and template directories
 $CSSDirs = array();
 $CSSDirsTmp = getCSSDirectories(TM_PATH . "/css");
 $css_c = count($CSSDirsTmp);
 $css_i = 0;
 for ($css_cc = 0; $css_cc < $css_c; $css_cc++) {
     $css_file = TM_PATH . "/css/" . $CSSDirsTmp[$css_cc] . "/tellmatic.css";
     $tpl_dir = TM_TPLPATH . "/" . $CSSDirsTmp[$css_cc];
     if (file_exists($css_file)) {
         if (is_dir($tpl_dir)) {
             $CSSDirs[$css_i]["dir"] = $CSSDirsTmp[$css_cc];
             $CSSDirs[$css_i]["name"] = $CSSDirsTmp[$css_cc];
             $css_i++;
         }