Fügt per Default alle Whitelist Properties der Tabelle hinzu
321598
protected function initGridPanel(\Psc\CMS\EntityGridPanel $panel) {
    if ($this instanceof SortingController) {
      $panel->setSortable(TRUE);
      $panel->setSortableName($this->getSortField());
    }
    
    $panel->addControlColumn();
    $panel->addControlButtons();
    
    foreach ($this->getWhiteListProperties($panel->getEntityMeta(), 'grid') as $property) {
      $panel->addProperty($property, $panel->getEntityMeta()->getTCIColumn() === $property ? EntityGridPanel::TCI_BUTTON : NULL);
    }
  }
332698
function getDefaultOpts(simple) {
  'use strict';

  var defaultOptions = {
    omitExtraWLInCodeBlocks: {
      default: false,
      describe: 'Omit the default extra whiteline added to code blocks',
      type: 'boolean'
    },
    noHeaderId: {
      default: false,
      describe: 'Turn on/off generated header id',
      type: 'boolean'
    },
    prefixHeaderId: {
      default: false,
      describe: 'Specify a prefix to generated header ids',
      type: 'string'
    },
    headerLevelStart: {
      default: false,
      describe: 'The header blocks level start',
      type: 'integer'
    },
    parseImgDimensions: {
      default: false,
      describe: 'Turn on/off image dimension parsing',
      type: 'boolean'
    },
    simplifiedAutoLink: {
      default: false,
      describe: 'Turn on/off GFM autolink style',
      type: 'boolean'
    },
    literalMidWordUnderscores: {
      default: false,
      describe: 'Parse midword underscores as literal underscores',
      type: 'boolean'
    },
    strikethrough: {
      default: false,
      describe: 'Turn on/off strikethrough support',
      type: 'boolean'
    },
    tables: {
      default: false,
      describe: 'Turn on/off tables support',
      type: 'boolean'
    },
    tablesHeaderId: {
      default: false,
      describe: 'Add an id to table headers',
      type: 'boolean'
    },
    ghCodeBlocks: {
      default: true,
      describe: 'Turn on/off GFM fenced code blocks support',
      type: 'boolean'
    },
    tasklists: {
      default: false,
      describe: 'Turn on/off GFM tasklist support',
      type: 'boolean'
    },
    smoothLivePreview: {
      default: false,
      describe: 'Prevents weird effects in live previews due to incomplete input',
      type: 'boolean'
    }
  };
  if (simple === false) {
    return JSON.parse(JSON.stringify(defaultOptions));
  }
  var ret = {};
  for (var opt in defaultOptions) {
    if (defaultOptions.hasOwnProperty(opt)) {
      ret[opt] = defaultOptions[opt].default;
    }
  }
  return ret;
}
1006486
public function listInvalidProperties()
    {
        $invalid_properties = [];

        if ($this->container['region'] === null) {
            $invalid_properties[] = "'region' can't be null";
        }
        $allowed_values = $this->getRegionAllowableValues();
        if (!in_array($this->container['region'], $allowed_values)) {
            $invalid_properties[] = sprintf(
                "invalid value for 'region', must be one of '%s'",
                implode("', '", $allowed_values)
            );
        }

        if ($this->container['machineType'] === null) {
            $invalid_properties[] = "'machineType' can't be null";
        }
        $allowed_values = $this->getMachineTypeAllowableValues();
        if (!in_array($this->container['machineType'], $allowed_values)) {
            $invalid_properties[] = sprintf(
                "invalid value for 'machineType', must be one of '%s'",
                implode("', '", $allowed_values)
            );
        }

        if ($this->container['size'] === null) {
            $invalid_properties[] = "'size' can't be null";
        }
        if ($this->container['billingType'] === null) {
            $invalid_properties[] = "'billingType' can't be null";
        }
        $allowed_values = $this->getBillingTypeAllowableValues();
        if (!in_array($this->container['billingType'], $allowed_values)) {
            $invalid_properties[] = sprintf(
                "invalid value for 'billingType', must be one of '%s'",
                implode("', '", $allowed_values)
            );
        }

        if ($this->container['machineName'] === null) {
            $invalid_properties[] = "'machineName' can't be null";
        }
        if ($this->container['templateId'] === null) {
            $invalid_properties[] = "'templateId' can't be null";
        }
        return $invalid_properties;
    }
601955
private static Map whitelistJsonObject(JsonObject unfiltered, Set<String> whitelist) {
    // If we create a new JsonObject here and serialize it the key/value pairs are inside
    // a superflouous "members" object, so create a Map instead.
    JsonObject filtered = new JsonObject();

    Set<Map.Entry<String,JsonElement>> entries = unfiltered.entrySet();
    for (Map.Entry<String,JsonElement> entry : entries) {
      String key = entry.getKey();

      if (whitelist.contains(key))
        filtered.add(key, entry.getValue());
    }
    return gson.fromJson(gson.toJson(filtered), Map.class);
  }
430218
public function listInvalidProperties()
    {
        $invalidProperties = [];

        $allowedValues = $this->getAuthTypeAllowableValues();
        if (!is_null($this->container['auth_type']) && !in_array($this->container['auth_type'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'auth_type', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        $allowedValues = $this->getAuthSecondFactorTypeAllowableValues();
        if (!is_null($this->container['auth_second_factor_type']) && !in_array($this->container['auth_second_factor_type'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'auth_second_factor_type', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        return $invalidProperties;
    }
681115
protected static function usertable()
	{
		if ( ! \DBUtil::table_exists(static::$data['ormauth_table']))
		{
			if ( ! \DBUtil::table_exists(static::$data['simpleauth_table']))
			{
				// table users
				\DBUtil::create_table(static::$data['ormauth_table'], array(
					'id' => array('type' => 'int', 'constraint' => 11, 'auto_increment' => true),
					'username' => array('type' => 'varchar', 'constraint' => 50),
					'password' => array('type' => 'varchar', 'constraint' => 255),
					'group_id' => array('type' => 'int', 'constraint' => 11, 'default' => 1),
					'email' => array('type' => 'varchar', 'constraint' => 255),
					'last_login' => array('type' => 'varchar', 'constraint' => 25),
					'previous_login' => array('type' => 'varchar', 'constraint' => 25, 'default' => 0),
					'login_hash' => array('type' => 'varchar', 'constraint' => 255),
					'user_id' => array('type' => 'int', 'constraint' => 11, 'default' => 0),
					'created_at' => array('type' => 'int', 'constraint' => 11, 'default' => 0),
					'updated_at' => array('type' => 'int', 'constraint' => 11, 'default' => 0),
				), array('id'));

				// add a unique index on username and email
				\DBUtil::create_index(static::$data['ormauth_table'], array('username', 'email'), 'username', 'UNIQUE');
			}
			else
			{
				\DBUtil::rename_table(static::$data['simpleauth_table'], static::$data['ormauth_table']);
			}
		}

		// run a check on required fields, and deal with missing ones. we might be migrating from simpleauth
		if (\DBUtil::field_exists(static::$data['ormauth_table'], 'group'))
		{
			\DBUtil::modify_fields(static::$data['ormauth_table'], array(
				'group' => array('name' => 'group_id', 'type' => 'int', 'constraint' => 11),
			));
		}
		if ( ! \DBUtil::field_exists(static::$data['ormauth_table'], 'group_id'))
		{
			\DBUtil::add_fields(static::$data['ormauth_table'], array(
				'group_id' => array('type' => 'int', 'constraint' => 11, 'default' => 1, 'after' => 'password'),
			));
		}
		if ( ! \DBUtil::field_exists(static::$data['ormauth_table'], 'previous_login'))
		{
			\DBUtil::add_fields(static::$data['ormauth_table'], array(
				'previous_login' => array('type' => 'varchar', 'constraint' => 25, 'default' => 0, 'after' => 'last_login'),
			));
		}
		if ( ! \DBUtil::field_exists(static::$data['ormauth_table'], 'user_id'))
		{
			\DBUtil::add_fields(static::$data['ormauth_table'], array(
				'user_id' => array('type' => 'int', 'constraint' => 11, 'default' => 0, 'after' => 'login_hash'),
			));
		}
		if (\DBUtil::field_exists(static::$data['ormauth_table'], 'created'))
		{
			\DBUtil::modify_fields(static::$data['ormauth_table'], array(
				'created' => array('name' => 'created_at', 'type' => 'int', 'constraint' => 11),
			));
		}
		if ( ! \DBUtil::field_exists(static::$data['ormauth_table'], 'created_at'))
		{
			\DBUtil::add_fields(static::$data['ormauth_table'], array(
				'created_at' => array('type' => 'int', 'constraint' => 11, 'default' => 0, 'after' => 'user_id'),
			));
		}
		if (\DBUtil::field_exists(static::$data['ormauth_table'], 'updated'))
		{
			\DBUtil::modify_fields(static::$data['ormauth_table'], array(
				'updated' => array('name' => 'updated_at', 'type' => 'int', 'constraint' => 11),
			));
		}
		if ( ! \DBUtil::field_exists(static::$data['ormauth_table'], 'updated_at'))
		{
			\DBUtil::add_fields(static::$data['ormauth_table'], array(
				'updated_at' => array('type' => 'int', 'constraint' => 11, 'default' => 0, 'after' => 'created_at'),
			));
		}
	}
412800
public function listInvalidProperties()
    {
        $invalidProperties = [];

        if ($this->container['id'] === null) {
            $invalidProperties[] = "'id' can't be null";
        }
        if ($this->container['name'] === null) {
            $invalidProperties[] = "'name' can't be null";
        }
        if ($this->container['email'] === null) {
            $invalidProperties[] = "'email' can't be null";
        }
        if ($this->container['order'] === null) {
            $invalidProperties[] = "'order' can't be null";
        }
        if ($this->container['fields'] === null) {
            $invalidProperties[] = "'fields' can't be null";
        }
        if ($this->container['metadata'] === null) {
            $invalidProperties[] = "'metadata' can't be null";
        }
        if ($this->container['state'] === null) {
            $invalidProperties[] = "'state' can't be null";
        }
        $allowedValues = $this->getStateAllowableValues();
        if (!is_null($this->container['state']) && !in_array($this->container['state'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'state', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        $allowedValues = $this->getAuthTypeAllowableValues();
        if (!is_null($this->container['auth_type']) && !in_array($this->container['auth_type'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'auth_type', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        $allowedValues = $this->getAuthSecondFactorTypeAllowableValues();
        if (!is_null($this->container['auth_second_factor_type']) && !in_array($this->container['auth_second_factor_type'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'auth_second_factor_type', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        return $invalidProperties;
    }
75026
public function defaultAttributeLabels()
    {
        return [
            'id' => Yii::t('hipanel', 'ID'),
            'remoteid' => Yii::t('hipanel', 'Remote ID'),
            'client' => Yii::t('hipanel', 'Client'),
            'client_id' => Yii::t('hipanel', 'Client'),
            'seller' => Yii::t('hipanel', 'Reseller'),
            'seller_id' => Yii::t('hipanel', 'Reseller'),
            'domain' => Yii::t('hipanel', 'Domain name'),
            'hdomain' => Yii::t('hipanel', 'Domain name'),
            'ns' => Yii::t('hipanel', 'Name Server'),
            'nss' => Yii::t('hipanel', 'Name Servers'),
            'server' => Yii::t('hipanel', 'Server'),
            'account' => Yii::t('hipanel', 'Account'),
            'service' => Yii::t('hipanel', 'Service'),
            'tariff' => Yii::t('hipanel', 'Tariff'),
            'contact' => Yii::t('hipanel', 'Contact'),
            'article' => Yii::t('hipanel', 'Article'),
            'host' => Yii::t('hipanel', 'Host'),
            'bill' => Yii::t('hipanel', 'Bill'),
            'backup' => Yii::t('hipanel', 'Backup'),
            'backuping' => Yii::t('hipanel', 'Backuping'),
            'crontab' => Yii::t('hipanel', 'Crontab'),
            'ip' => Yii::t('hipanel', 'IP'),
            'ips' => Yii::t('hipanel', 'IPs'),
            'mail' => Yii::t('hipanel', 'Mail'),
            'request' => Yii::t('hipanel', 'Request'),
            'db' => Yii::t('hipanel', 'Database'),
            'state' => Yii::t('hipanel', 'Status'),
            'status' => Yii::t('hipanel', 'Status'),
            'states' => Yii::t('hipanel', 'Statuses'),
            'type' => Yii::t('hipanel', 'Type'),
            'types' => Yii::t('hipanel', 'Types'),
            'note' => Yii::t('hipanel', 'Note'),
            'descr' => Yii::t('hipanel', 'Description'),
            'comment' => Yii::t('hipanel', 'Comment'),
            'created_date' => Yii::t('hipanel', 'Registered'),
            'updated_date' => Yii::t('hipanel', 'Last update'),
        ];
    }
19422
protected function checkUserAgent()
	{
	    if ( \Environment::get('httpUserAgent') )  
	    {
	        $UserAgent = trim(\Environment::get('httpUserAgent'));
	    } 
	    else 
	    {
	        return false; // Ohne Absender keine Suche
	    }
	    $arrUserAgents = explode(",", $this->banner_useragent);
	    if (strlen(trim($arrUserAgents[0])) == 0) 
	    {
	        return false; // keine Angaben im Modul
	    }
	    array_walk($arrUserAgents, array('self','trimBannerArrayValue'));  // trim der array values
	    // grobe Suche
	    $CheckUserAgent = str_replace($arrUserAgents, '#', $UserAgent);
	    if ($UserAgent != $CheckUserAgent) 
	    {   // es wurde ersetzt also was gefunden
	        //DEBUG log_message('CheckUserAgent Filterung; Treffer!','Banner.log');
	        return true;
	    }
	    return false;
	}
417873
protected function getDefaultBanner()
	{
		$arrImageSize = array();
		//CSS-ID/Klasse(n) je Banner, für den wrapper
		$banner_cssID   = '';
		$banner_class   = ' banner_default';
				
		//BannerDefault gewünscht und vorhanden?
		if ( $this->arrCategoryValues['banner_default'] == '1' 
            && strlen($this->arrCategoryValues['banner_default_image']) > 0 
	       ) 
		{
			//Template setzen
			if ( ($this->banner_template != $this->strTemplate) 
			  && ($this->banner_template != '') ) 
			{
			    $this->strTemplate = $this->banner_template;
			    $this->Template = new \FrontendTemplate($this->strTemplate);
			}
			//Link je nach Ausgabeformat
			if ($this->strFormat == 'xhtml') 
			{
			    $banner_default_target = ($this->arrCategoryValues['banner_default_target'] == '1') ? LINK_BLUR : LINK_NEW_WINDOW;
			} 
			else 
			{
			    $banner_default_target = ($this->arrCategoryValues['banner_default_target'] == '1') ? '' : ' target="_blank"';
			}
			//BannerImage Class
			$this->BannerImage = new \Banner\BannerImage();
			 
			//Banner Art bestimmen
			$arrImageSize = $this->BannerImage->getBannerImageSize($this->arrCategoryValues['banner_default_image'], self::BANNER_TYPE_INTERN);
			// 1 = GIF, 2 = JPG, 3 = PNG
			// 4 = SWF, 13 = SWC (zip-like swf file)
			// 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order)
			// 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF

			//fake the Picture::create
			$picture['img']   = array
			(
			    'src'    => $this->urlEncode($this->arrCategoryValues['banner_default_image']),
			    'width'  => $arrImageSize[0],
			    'height' => $arrImageSize[1],
			    'srcset' => $this->urlEncode($this->arrCategoryValues['banner_default_image'])
			);
			$picture['alt']   = specialchars(ampersand($this->arrCategoryValues['banner_default_name']));
			$picture['title'] = '';
			
			ModuleBannerLog::writeLog(__METHOD__ , __LINE__ , 'Fake Picture: '. print_r($picture,true));
			
			switch ($arrImageSize[2]) 
			{
			    case 1:
			    case 2:
			    case 3:
			        $arrBanners[] = array
							        (
							        'banner_key'     => 'defbid=',
							        'banner_wrap_id'    => $banner_cssID,
							        'banner_wrap_class' => $banner_class,
							        'banner_id'      => $this->arrCategoryValues['id'],
							        'banner_name'    => specialchars(ampersand($this->arrCategoryValues['banner_default_name'])),
							        'banner_url'     => $this->arrCategoryValues['banner_default_url'],
							        'banner_target'  => $banner_default_target,
							        'banner_comment' => specialchars(ampersand($this->arrCategoryValues['banner_default_name'])),
							        'src'            => $this->urlEncode(      $this->arrCategoryValues['banner_default_image']),
							        'alt'            => specialchars(ampersand($this->arrCategoryValues['banner_default_name'])),
							        'size'     		 => '',
							        'banner_pic'     => true,
							        'banner_flash'   => false,
							        'banner_text'    => false,
							        'banner_empty'   => false,	// issues 733
							        'picture'        => $picture
							        );
			        break;
			    case 4:  // Flash swf
			    case 13: // Flash swc
			        list($usec, ) = explode(" ", microtime());
			        $arrBanners[] = array
							        (
					                'banner_key'     => 'defbid=',
						            'banner_wrap_id'    => $banner_cssID,
						            'banner_wrap_class' => $banner_class,
					                'banner_id'      => $this->arrCategoryValues['id'],
					                'banner_name'    => specialchars(ampersand($this->arrCategoryValues['banner_default_name'])),
					                'banner_url'     => $this->arrCategoryValues['banner_default_url'],
					                'banner_target'  => $banner_default_target,
					                'banner_comment' => specialchars(ampersand($this->arrCategoryValues['banner_default_name'])),
					                'swf_src'        => $this->arrCategoryValues['banner_default_image'],
					                'swf_width'      => $arrImageSize[0],
					                'swf_height'     => $arrImageSize[1],
					                'swf_id'         => round((float)$usec*100000,0).'_'.$this->arrCategoryValues['id'],
					                'alt'            => specialchars(ampersand($this->arrCategoryValues['banner_default_name'])),
					                'banner_pic'     => false,
					                'banner_flash'   => true,
					                'banner_text'    => false,
					                'banner_empty'   => false	// issues 733
							        );
			        break;
			}
			$arrResults[] = $arrBanners[0];
			$this->Template->banners = $arrResults;
			return true;
		}
		//Kein BannerDefault
		$NoBannerFound = ($GLOBALS['TL_LANG']['MSC']['tl_banner']['noBanner']) ? $GLOBALS['TL_LANG']['MSC']['tl_banner']['noBanner'] : 'no banner, no default banner';
		$arrBanners[] = array
		(
		        'banner_key'  => 'bid=',
    		    'banner_wrap_id'    => $banner_cssID,
    		    'banner_wrap_class' => $banner_class,
		        'banner_id'   => 0,
		        'banner_name' => specialchars(ampersand($NoBannerFound)),
		        'banner_url'  => '',
		        'banner_target'  => '',
		        'banner_comment' => '',
		        'src' 			=> '',
		        'alt' 			=> '',
		        'size'     		=> '',
		        'banner_pic' 	=> false,
		        'banner_flash'  => false,
		        'banner_text'   => false,
		        'banner_empty'  => true	// issues 733
		);
		$arrResults[] = $arrBanners[0];
		//Ausblenden wenn leer?
		if ($this->banner_hideempty == 1)
		{
		    // auf Leer umschalten
		    $this->strTemplate='mod_banner_empty';
		    $this->Template->arrCategoryValues = $this->arrCategoryValues; // #176
		    $this->Template = new \FrontendTemplate($this->strTemplate);
		}
		$this->Template->banners = $arrResults;
		
		return true;
	}
516057
function readStrucPerm(on, req, res, next) {
	//console.log('readStrucPerm: req.session.user_id = ' + req.session.user_id);
	//solo nel caso di favicon.ico non ha le session impostate, non so perchè,
	//quindi bypasso il controllo, perchè su favicon non ho nessuna restrizione
	if ( !req.session )
	{
		next();
	}
	else
	{
		//azzero i permessi
		req.session.loggedIn = false;
		req.session.canCreate = false;
		req.session.canModify = false;
		req.session.canModifyMyself = false; //questo è un permesso che vale solo per l'elemento "users"
		//controllo se sono loggato
		if (req.session.user_id) {
			//l'utente risulta loggato
			//controllo se i suoi dati di login sono validi
			//(questo controllo va fatto ogni volta, perchè se dall'ultimo conrollo l'utente fosse stato cancellato, non me ne accorgerei senza controllo
			req.app.jsl.sess.checkValidUser(req, function(result, user_id) { 
				if ( result )
				{
					//i dati di login sono validi
					req.session.loggedIn = true;
					if ( user_id == 'superadmin' )
					{
						//se sono super admin, ho sempre permesso di modify su tutti i contenuti, ma non ho il create (a parte sugli users)
						//questo perchè quando si crea un contenuto, questo è strettamente legato all'utente che lo crea, e il superadmin
						//non è un utente vero è proprio (non è presente nel db, non ha id). il super admin serve solo per poter vedere e modificare tutto, ma non può creare nulla
						req.session.canModify = true;
						req.session.canModifyMyself = true; //questo serve per permettere al super admin di modificare gli utenti (il form di modifica lo richiede)
						//solo nel caso degli users, il superadmin ha il create, anche se usersCanRegister = false
						if ( on == 'user' )
						{
							req.session.canCreate = true;
						}
						//la request puo essere processata
						next();
					}
					else
					{
						//non sono superadmin
						//siccome si tratta di permessi su elementi della struttura, chiunque (loggato) ha sempre il permesso di create nuovi elementi
						//(tranne per il caso degli "user" in cui si creano altri utenti con il bottone "registrati", che però non prevede di essere loggati)
						if ( on != 'user' )
						{
							req.session.canCreate = true;
						}
						//differenzio i permessi di modify in base all'oggetto trattato
						switch (on)
						{
							case 'user':
								//user è un elemento della struttura particolare, perchè, a differenza di tutti gli altri elementi di struttura, ogni utente può solo modificare
								//se stesso. inoltre user non ha un "author" poichè un utente è creato da se stesso tramite il bottone "register"
								//nel caso di modifica di users, ho modify solo per modificare me stesso
								if ( req.params.id == req.session.user_id ) //controllo se l'id dell'utente da modificare è quello dell'utente loggato, cioè se modifico me stesso
								{
									//lo user id nella route richiesta corrisponde al mio, quindi posso modificare me stesso (il mio profilo)
									req.session.canModifyMyself = true; 
								}
								break;
							default:
								//ora come ora per tutti gli altri elementi della struttura chiunque ha permesso di modify, ma solo sui propri elementi
								req.session.canModify = true; 
								break;
						}
						//continuo
						next();
						
					}
				}
				else
				{
					//i dati di login non sono validi
					//console.log('readStrucPerm: login NON valido');
					//forzo un logout (potrebbe verificarsi il caso in cui un utente è loggato, e viene cancellato dal db. in quel caso deve avvenire anche il suo logout)
					setSignedOut(req);
					//vengo mandato in home
					res.redirect('/');
				}
			});
			
		} else {
			//console.log('readStrucPerm: utente non loggato');			
			//non sono loggato. l'unica cosa che posso fare è di registrarmi, ovvero creare un nuovo user
			//ma solo se è stato previsto nel config
			if ( on == 'user' && req.app.jsl.config.usersCanRegister )
			{
				req.session.canCreate = true;
			}
			//non ho nessun permesso, continuo
			next();
		}
	}
}
312230
public function checkUserAgent($visitors_category_id)
	{
   	    if (\Environment::get('httpUserAgent')) 
   	    { 
	        $UserAgent = trim(\Environment::get('httpUserAgent')); 
	    } 
	    else 
	    { 
	        return false; // Ohne Absender keine Suche
	    }
	    $arrUserAgents = array();
	    $objUserAgents = \Database::getInstance()
	            ->prepare("SELECT 
                                `visitors_useragent` 
                            FROM 
                                `tl_module` 
                            WHERE 
                                `type` = ? AND `visitors_categories` = ?")
                ->execute('visitors',$visitors_category_id);
		if ($objUserAgents->numRows) 
		{
			while ($objUserAgents->next()) 
			{
				$arrUserAgents = array_merge($arrUserAgents,explode(",", $objUserAgents->visitors_useragent));
			}
		}
	    if (strlen(trim($arrUserAgents[0])) == 0) 
	    {
	    	return false; // keine Angaben im Modul
	    }
        // Suche
        $CheckUserAgent=str_replace($arrUserAgents, '#', $UserAgent);
        if ($UserAgent != $CheckUserAgent) 
        { 	// es wurde ersetzt also was gefunden
            ModuleVisitorLog::writeLog( __METHOD__ , __LINE__ , ': True' );
            return true;
        }
        ModuleVisitorLog::writeLog( __METHOD__ , __LINE__ , ': False' );
        return false; 
	}
1023908
public function run( )
    {
        @set_time_limit( 600 );
        \System::loadLanguageFile('tl_backupdb');                                           // Modultexte laden

        $user     = \BackendUser::getInstance();                                            // Backend-User

        $filename = \Environment::get('host');                                                                  // Dateiname = Domainname
        if( isset($GLOBALS['TL_CONFIG']['websiteTitle']) ) $filename = $GLOBALS['TL_CONFIG']['websiteTitle'];   // IF( Exiat WbsiteTitle ) Dateiname für Template-Dateien
        $filename = \StringUtil::generateAlias( $filename );                                                    // Dateiname = Alias für Template-Dateien

        $arrExclude = Array (                       // Diese Datenbank-Tabellen gehören nicht in ein WS-Template
                                'tl_cache',
                                'tl_cron',
                                'tl_lock',
                                'tl_log',
                                'tl_runonce',
                                'tl_search',
                                'tl_search_index',
                                'tl_session',
                                'tl_undo',
                                'tl_version'
                            );

        $arrResults = array();

        $headertext  = "#================================================================================\r\n";
        $headertext .= "# Website-Template : " . $filename . ".sql\r\n";
        $headertext .= BackupDbCommon::getHeaderInfo( false, 'Saved by User    : ' . $user->username . ' (' . $user->name . ')' );

        //--- Zielverzeichnis für Website-Templates ---
        $zielVerz = 'templates';
        if( isset( $GLOBALS['BACKUPDB']['WsTemplatePath'] ) && is_dir(TL_ROOT . '/' . trim($GLOBALS['BACKUPDB']['WsTemplatePath'], '/')) ) {
            $zielVerz = trim($GLOBALS['BACKUPDB']['WsTemplatePath'], '/');
        }
        if( isset( $GLOBALS['TL_CONFIG']['WsTemplatePath'] ) && is_dir(TL_ROOT . '/' . trim($GLOBALS['TL_CONFIG']['WsTemplatePath'], '/')) && (trim($GLOBALS['TL_CONFIG']['WsTemplatePath']) != '') ) {
            $zielVerz = trim($GLOBALS['TL_CONFIG']['WsTemplatePath'], '/');
        }

        $tempdir = '/system/tmp/';                  // temporäre Datei anlegen, dann wird das vorige Template nur überschrieben, wenn die runtime ausreicht
        $fileSQL = $filename . '.sql';              // Datenbank-Datei
        $fileTXT = $filename . '.txt';              // Info-Datei
        $fileSTR = $filename . '.structure';        // Struktur-Datei

        $datei = new \File( $tempdir . $fileSQL );
        $datei->write( $headertext );
        $datei->write( 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";' . "\r\n"
                     . "\r\n"
                     . "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\r\n"
                     . "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\r\n"
                     . "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\r\n"
                     . "/*!40101 SET NAMES utf8 */;\r\n" );

        $arrSavedDB = array( 'tl_' );               // Default, Verhalten wie in den Vorversionen von BackupDB
        if( isset( $GLOBALS['TL_CONFIG']['backupdb_saveddb'] ) && (trim($GLOBALS['TL_CONFIG']['backupdb_saveddb']) != '') ) {
            $arrSavedDB = trimsplit( ',', strtolower($GLOBALS['TL_CONFIG']['backupdb_saveddb']) );
        }

        $arrBlacklist = BackupDbCommon::get_blacklist( );
        $sqlarray = BackupDbCommon::getFromDB( );

        $arrEntries = array( );
        if( count($sqlarray) == 0 ) {
            $datei->write( "\r\nNo tables found in database." );
        }
        else {
            foreach( array_keys($sqlarray) as $table ) {
                if( in_array( $table, $arrExclude ) ) continue;             // Exclude-Tabellen überspringen
                if( in_array( $table, $arrBlacklist ) ) continue;           // Blacklisten-Tabellen überspringen

                $found = false;
                for( $i=0; $i<count($arrSavedDB); $i++ ) {
                    if( (strlen($arrSavedDB[$i]) <= strlen($table)) && ($arrSavedDB[$i] === substr($table, 0, strlen($arrSavedDB[$i]))) ) {
                        $found = true;
                    }
                }
                if( !$found ) continue;                                     // nur die angegebenen Datentabellen sichern

                $arrEntries[] = BackupDbCommon::get_table_content( $table, $datei, true );  // Dateninhalte in Datei schreiben
            }
        }
        $arrResults['entries'] = $arrEntries;

        $datei->write( "\r\n# --- End of Backup ---\r\n" );                 // Endekennung
        $datei->close();

        $datei = new \File( $tempdir . $fileSTR );                          // Strukturdatei öffnen
        $datei->write( BackupDbCommon::getHeaderInfo( true, 'Saved by User    : ' . $user->username . ' (' . $user->name . ')' ));

        $sqlarray = BackupDbCommon::getFromDB( );
        if( count($sqlarray) == 0 ) {
            $datei->write( 'No tables found in database.' );
        }
        else {
            foreach( array_keys($sqlarray) as $table ) {
                $datei->write( BackupDbCommon::get_table_structure($table, $sqlarray[$table]) );
            }
        }
        $datei->write( "\r\n/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\r\n"
                      ."/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\r\n"
                      ."/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\r\n"
                      ."\r\n# --- End of Backup ---\r\n" );                            // Endekennung
        $datei->close();

        $datei = new \File( $tempdir . $fileTXT );                          // Textdatei öffnen
        $datei->write( $headertext );
        $datei->close();

        //--- alte Dateien löschen, neue ans Ziel verschieben ---
        if( file_exists(TL_ROOT . '/' . $zielVerz . '/' . $fileSQL) ) {     // Delete old files if exist
            unlink(TL_ROOT . '/' . $zielVerz . '/' . $fileSQL);
        }
        if( file_exists(TL_ROOT . '/' . $zielVerz . '/' . $fileSTR) ) {
            unlink(TL_ROOT . '/' . $zielVerz . '/' . $fileSTR);
        }
        if( file_exists(TL_ROOT . '/' . $zielVerz . '/' . $fileTXT) ) {
            unlink(TL_ROOT . '/' . $zielVerz . '/' . $fileTXT);
        }
        rename( TL_ROOT . $tempdir . $fileSQL, TL_ROOT . '/' . $zielVerz . '/' . $fileSQL );        // Move new files
        rename( TL_ROOT . $tempdir . $fileSTR, TL_ROOT . '/' . $zielVerz . '/' . $fileSTR );
        rename( TL_ROOT . $tempdir . $fileTXT, TL_ROOT . '/' . $zielVerz . '/' . $fileTXT );

        //--- Ergebnisausgabe ---
        $arrResults['header']['text']    = $GLOBALS['TL_LANG']['tl_backupdb']['tplhead'];
        $arrResults['entry']['text']     = array( $GLOBALS['TL_LANG']['tl_backupdb']['tplentry'], $GLOBALS['TL_LANG']['tl_backupdb']['tplentriesd'] );

        $arrResults['footer']['result']  = $GLOBALS['TL_LANG']['tl_backupdb']['tplresult'];
        $arrResults['footer']['legend']  = $GLOBALS['TL_LANG']['tl_backupdb']['tpllegend'];
        $arrResults['footer']['fileSQL'] = '/' . $zielVerz . '/' . $fileSQL;
        $arrResults['footer']['fileTXT'] = '/' . $zielVerz . '/' . $fileTXT;
        $arrResults['footer']['fileSTR'] = '/' . $zielVerz . '/' . $fileSTR;
        $arrResults['footer']['text']    = $GLOBALS['TL_LANG']['tl_backupdb']['tplfooter'];
        $arrResults['footer']['button']  = $GLOBALS['TL_LANG']['tl_backupdb']['tplbutton'];

        return $arrResults;
    }
1062220
protected function setStatViewUpdate()
	{
	    if ($this->bannerCheckBot() === true)
	    {
	        return; //Bot gefunden, wird nicht gezaehlt
	    }
	    if ($this->checkUserAgent() === true)
	    {
	        return ; //User Agent Filterung
	    }
	    
	    // Blocker
	    $lastBanner = array_pop($this->arrBannerData);
	    $BannerID = $lastBanner['banner_id'];
	    if ($BannerID==0)
	    { // kein Banner, nichts zu tun
	        return;
	    }
	    
	    if ( $this->getStatViewUpdateBlockerId($BannerID) === true )
	    {
	        // Eintrag innerhalb der Blockzeit
	        return; // blocken, nicht zählen, raus hier
	    }
	    else
	    {
	        // nichts geblockt, also blocken fürs den nächsten Aufrufs
	        $this->setStatViewUpdateBlockerId($BannerID);
	    }
	    
	    //Zählung, Insert
	    $arrSet = array
	    (
            'id' => $BannerID,
            'tstamp' => time(),
            'banner_views' => 1
	    );
	    $objInsert = \Database::getInstance()->prepare("INSERT IGNORE INTO tl_banner_stat %s")
                                             ->set($arrSet)
                                             ->executeUncached();
	    if ($objInsert->insertId == 0)
	    {
	        //Zählung, Update
	        \Database::getInstance()->prepare("UPDATE 
                                                    `tl_banner_stat` 
                                               SET 
                                                    `tstamp`=?
                                                  , `banner_views` = `banner_views`+1 
                                               WHERE 
                                                    `id`=?")
                                    ->executeUncached(time(), $BannerID);
	    }
	    
	}
966591
protected static function define_properties() {
        return [
            'name' => [
                'type' => PARAM_TEXT,
                'default' => '',
            ],
            'type' => [
                'type' => PARAM_INT,
                'choices' => [
                    self::TYPE_SITE,
                    self::TYPE_PRIVACY,
                    self::TYPE_THIRD_PARTY,
                    self::TYPE_OTHER,
                ],
                'default' => self::TYPE_SITE,
            ],
            'audience' => [
                'type' => PARAM_INT,
                'choices' => [
                    self::AUDIENCE_ALL,
                    self::AUDIENCE_LOGGEDIN,
                    self::AUDIENCE_GUESTS,
                ],
                'default' => self::AUDIENCE_ALL,
            ],
            'archived' => [
                'type' => PARAM_BOOL,
                'default' => false,
            ],
            'policyid' => [
                'type' => PARAM_INT,
            ],
            'agreementstyle' => [
                'type' => PARAM_INT,
                'choices' => [
                    self::AGREEMENTSTYLE_CONSENTPAGE,
                    self::AGREEMENTSTYLE_OWNPAGE,
                ],
                'default' => self::AGREEMENTSTYLE_CONSENTPAGE,
            ],
            'optional' => [
                'type' => PARAM_INT,
                'choices' => [
                    self::AGREEMENT_OPTIONAL,
                    self::AGREEMENT_COMPULSORY,
                ],
                'default' => self::AGREEMENT_COMPULSORY,
            ],
            'revision' => [
                'type' => PARAM_TEXT,
                'default' => '',
            ],
            'summary' => [
                'type' => PARAM_RAW,
                'default' => '',
            ],
            'summaryformat' => [
                'type' => PARAM_INT,
                'default' => FORMAT_HTML,
                'choices' => [
                    FORMAT_PLAIN,
                    FORMAT_HTML,
                    FORMAT_MOODLE,
                    FORMAT_MARKDOWN,
                ],
            ],
            'content' => [
                'type' => PARAM_RAW,
                'default' => '',
            ],
            'contentformat' => [
                'type' => PARAM_INT,
                'default' => FORMAT_HTML,
                'choices' => [
                    FORMAT_PLAIN,
                    FORMAT_HTML,
                    FORMAT_MOODLE,
                    FORMAT_MARKDOWN,
                ],
            ],
        ];
    }
419156
function defaultOptions(options) {
    const optionsDefault = {
        validateBeforeSave: true,
        explicitOnly: true,
        queries: {
            readAll: false,
            format: queries.formats.JSON,
        },
    };
    options = extend(true, {}, optionsDefault, options);
    if (options.joi) {
        const joiOptionsDefault = {
            options: {
                allowUnknown: options.explicitOnly !== true,
            },
        };
        if (is.object(options.joi)) {
            options.joi = extend(true, {}, joiOptionsDefault, options.joi);
        } else {
            options.joi = Object.assign({}, joiOptionsDefault);
        }
        if (!Object.prototype.hasOwnProperty.call(options.joi.options, 'stripUnknown')) {
            options.joi.options.stripUnknown = options.joi.options.allowUnknown !== true;
        }
    }
    return options;
}
137324
protected function compile()
    {
        \System::loadLanguageFile('tl_backupdb');

        switch( \Input::get('act') ) {
            case 'backup':          BackupDbRun::run( );
                                    die( );               // Beenden, da Download rausgegangen ist

            case 'webtemplate':     $objTemplate = new \BackendTemplate('be_backupdb_wstpl');
                                    $this->Template = $objTemplate;
                                    $this->Template->arrResults = BackupWsTemplate::run( );
                                    $this->Template->back = 'contao/main.php?do=BackupDB&ref' . TL_REFERER_ID;
                                    $this->Template->backupdb_version = 'BackupDB Version ' . BACKUPDB_VERSION . '.' . BACKUPDB_BUILD;
                                    return;
        }

        //--- Zielverzeichnis für Website-Templates ---
        $zielVerz = 'templates';
        if( isset( $GLOBALS['BACKUPDB']['WsTemplatePath'] ) && is_dir(TL_ROOT.'/'.trim($GLOBALS['BACKUPDB']['WsTemplatePath'], '/')) ) {
            $zielVerz = trim($GLOBALS['BACKUPDB']['WsTemplatePath'], '/');
        }
        if( isset( $GLOBALS['TL_CONFIG']['WsTemplatePath'] ) && is_dir(TL_ROOT.'/'.trim($GLOBALS['TL_CONFIG']['WsTemplatePath'], '/')) && (trim($GLOBALS['TL_CONFIG']['WsTemplatePath']) != '') ) {
            $zielVerz = trim($GLOBALS['TL_CONFIG']['WsTemplatePath'], '/');
        }

        $filename = \Environment::get('host');                                                                  // Dateiname = Domainname
        if( isset($GLOBALS['TL_CONFIG']['websiteTitle']) ) $filename = $GLOBALS['TL_CONFIG']['websiteTitle'];   // IF( Exiat WbsiteTitle ) Dateiname für Template-Dateien
        $filename = \StringUtil::generateAlias( $filename );                                                    // Dateiname = Alias für Template-Dateien

        $this->Template->ws_template_sqlfile = $zielVerz.'/' . $filename . '.sql';
        $this->Template->ws_template_txtfile = $zielVerz.'/' . $filename . '.txt';
        $this->Template->ws_template_strfile = $zielVerz.'/' . $filename . '.structure';


        $this->Template->settingslink    = $settingslink = 'contao/main.php?do=settings&amp;ref=' . TL_REFERER_ID;
        $this->Template->cronlink        = $cronlink     = 'contao/main.php?do=cron&amp;ref=' . TL_REFERER_ID;
        $this->Template->backuplink      = 'contao/main.php?do=BackupDB&amp;act=backup&amp;rt=' . REQUEST_TOKEN . '&amp;ref=' . TL_REFERER_ID;
        $this->Template->webtemplatelink = 'contao/main.php?do=BackupDB&amp;act=webtemplate&amp;rt=' . REQUEST_TOKEN . '&amp;ref=' . TL_REFERER_ID;

        $this->Template->database = $GLOBALS['TL_CONFIG']['dbDatabase'];
        $this->Template->texte    = array(
                                        'download'      => $GLOBALS['TL_LANG']['tl_backupdb']['download'],
                                        'startdownload' => $GLOBALS['TL_LANG']['tl_backupdb']['startdownload'],
                                        'database'      => $GLOBALS['TL_LANG']['tl_backupdb']['database'] . ': ',

                                        'backupdesc'    => $GLOBALS['TL_LANG']['tl_backupdb']['backupdesc'],
                                        'backupsetup'   => sprintf( $GLOBALS['TL_LANG']['tl_backupdb']['backupsetup'], $settingslink ),
                                        'backuplast'    => $GLOBALS['TL_LANG']['tl_backupdb']['backuplast'] . ': ',

                                        'croninfo'      => $GLOBALS['TL_LANG']['tl_backupdb']['croninfo'],
                                        'cronsetup'     => sprintf( $GLOBALS['TL_LANG']['tl_backupdb']['cronsetup'], $cronlink ),
                                        'cronlast'      => $GLOBALS['TL_LANG']['tl_backupdb']['cronlast'] . ': ',

                                        'maketpl'       => $GLOBALS['TL_LANG']['tl_backupdb']['maketpl'],
                                        'tpldesc'       => $GLOBALS['TL_LANG']['tl_backupdb']['tpldesc'],
                                        'tplfiles'      => $GLOBALS['TL_LANG']['tl_backupdb']['tplfiles'] . ':',
                                        'tplnobackup'   => $GLOBALS['TL_LANG']['tl_backupdb']['tplnobackup'],
                                        'tplwarning'    => $GLOBALS['TL_LANG']['tl_backupdb']['tplwarning']
                                    );

        //--- CRON Erweiterung einbeziehen, wenn vorhanden ---
        $this->Template->ws_cron = $this->checkCronExt();               // übergibt 0 (kein Cron), 1 (Cron ohne Job), 2 (Cron, Job inaktiv) oder 3 (Cron, Job aktiv)
        if( ($this->Input->get('op') == 'cron') && ($this->checkCron() == 1) ) {
            $sql = "INSERT INTO `tl_cron` "
                  ."(`id`, `tstamp`, `lastrun`, `nextrun`, `scheduled`, `title`, `job`, `t_minute`, `t_hour`, `t_dom`, `t_month`, `t_dow`, `runonce`, `enabled`, `logging`) "
                  ."VALUES ( 0, " . time() . ", 0, 0, 0, 'AutoBackupDB', 'system/modules/BackupDB/AutoBackupDB.php', '0', '2', '*', '*', '*', '', '', '1')";
            $this->Database->execute( $sql );                           // inaktiven Cronjob eintragen
            $this->reload();
        }

        //--- Letzte Backups ---
        $pfad = TL_ROOT . '/' . $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/';
        $this->Template->lastrun = file_exists($pfad . BACKUPDB_RUN_LAST) ? file_get_contents($pfad . BACKUPDB_RUN_LAST) : '--.--.---- --:--';
        $this->Template->lastcron = file_exists($pfad . BACKUPDB_CRON_LAST) ? file_get_contents($pfad . BACKUPDB_CRON_LAST) : '--.--.---- --:--';

        //--- Footer ---
        $this->Template->backupdb_icons = 'Icons from <a href="https://icons8.com" target="_blank">Icons8</a> (<a href="https://creativecommons.org/licenses/by-nd/3.0/" target="_blank">CC BY-ND 3.0</a>)';
        $this->Template->backupdb_version = '<a href="https://github.com/do-while/contao-BackupDB" target="_blank">BackupDB Version ' . BACKUPDB_VERSION . '.' . BACKUPDB_BUILD . '</a>';
    }