<commit_before><?php

//this script may only be included - so its better to die if called directly.
if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== false) {
  header("location: index.php");
  exit;
}

class BannerLib extends TikiLib {
	function BannerLib($db) {
		$this->TikiLib($db);
	}

	function select_banner($zone) {
		// Things to check
		// UseDates and dates
		// Hours
		// weekdays
		// zone
		// maxImpressions and impressions
		# TODO localize
		$dw = "`".strtolower($this->date_format("%a"))."`";

		$hour = $this->date_format("%H"). $this->date_fomat("%M");
		$raw = '';
		//
		//
		$query = "select count(*) from `tiki_banners` where $dw = ? and  `hourFrom`<=? and `hourTo`>=? and
    		( ((`useDates` = ?) and (`fromDate`<=? and `toDate`>=?)) or (`useDates` = ?) ) and
    		`impressions`<`maxImpressions` and `zone`=?";
    		$bindvars=array('y',$hour,$hour,'y',(int) $this->now,(int) $this->now,'n',$zone);
		$rows=$this->getOne($query,$bindvars);

		if (!$rows)<commit_msg>[FIX] banners: typo<commit_after><?php

//this script may only be included - so its better to die if called directly.
if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== false) {
  header("location: index.php");
  exit;
}

class BannerLib extends TikiLib {
	function BannerLib($db) {
		$this->TikiLib($db);
	}

	function select_banner($zone) {
		// Things to check
		// UseDates and dates
		// Hours
		// weekdays
		// zone
		// maxImpressions and impressions
		# TODO localize
		$dw = "`".strtolower($this->date_format("%a"))."`";

		$hour = $this->date_format("%H"). $this->date_foirmat("%M");
		$raw = '';
		//
		//
		$query = "select count(*) from `tiki_banners` where $dw = ? and  `hourFrom`<=? and `hourTo`>=? and
    		( ((`useDates` = ?) and (`fromDate`<=? and `toDate`>=?)) or (`useDates` = ?) ) and
    		`impressions`<`maxImpressions` and `zone`=?";
    		$bindvars=array('y',$hour,$hour,'y',(int) $this->now,(int) $this->now,'n',$zone);
		$rows=$this->getOne($query,$bindvars);

		if (!$rows)
{'fraction_non_alphanumeric': 0.2199602780536246, 'fraction_numerical': 0.0, 'mean_word_length': 3.9508599508599507, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3689062', 'n_tokens_mistral': 810, 'n_tokens_neox': 755, 'n_words': 159}