<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 QuickTagsLib extends TikiLib {
	function QuickTagsLib($db) {
		# this is probably uneeded now
		if (!$db) {
			die ("Invalid db object passed to AdminLib constructor");
		}
		$this->db = $db;
	}

	function list_quicktags($offset, $maxRecords, $sort_mode, $find, $category=null) {
		
		$bindvars=array();
		if ($find) {
			$findesc = '%' . $find . '%';
			$mid = " where (`tagname` like ?)";
			$bindvars[]=$findesc;
		} else {
			$mid = "";
		}
		if ($category) {
			if ($mid) {
				$mid = " and (`tagcategory` like ?)";
			} else {
			   $mid = " where (`tagcategory` like ?)";
			}
			$bindvars[]=$category;
	   }
		$query = "select * from `tiki_quicktags` $mid order by ".$this->convert_sortmode($sort_mode);
		$query_cant = "select count(*) from `tiki_quicktags` $mid";
		$result = $this->query($query,$bindvars,$maxRecords,$offset);
		$cant = $this->getOne($query_cant,$bindvars);
		$ret = array();
		while ($res = $result->fetchRow()) {
			$res['iconpath'] = $res['tagicon'];
			if (!is_file($res['tagicon'])) $res['tagicon'] = 'images/ed_html.gif';
			$ret[] = $res;<commit_msg>[FIX] no such field tagname in tiki_quicktags, changed for taglabel<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 QuickTagsLib extends TikiLib {
	function QuickTagsLib($db) {
		# this is probably uneeded now
		if (!$db) {
			die ("Invalid db object passed to AdminLib constructor");
		}
		$this->db = $db;
	}

	function list_quicktags($offset, $maxRecords, $sort_mode, $find, $category=null) {
		
		$bindvars=array();
		if ($find) {
			$findesc = '%' . $find . '%';
			$mid = " where (`taglabel` like ?)";
			$bindvars[]=$findesc;
		} else {
			$mid = "";
		}
		if ($category) {
			if ($mid) {
				$mid = " and (`tagcategory` like ?)";
			} else {
			   $mid = " where (`tagcategory` like ?)";
			}
			$bindvars[]=$category;
	   }
		$query = "select * from `tiki_quicktags` $mid order by ".$this->convert_sortmode($sort_mode);
		$query_cant = "select count(*) from `tiki_quicktags` $mid";
		$result = $this->query($query,$bindvars,$maxRecords,$offset);
		$cant = $this->getOne($query_cant,$bindvars);
		$ret = array();
		while ($res = $result->fetchRow()) {
			$res['iconpath'] = $res['tagicon'];
			if (!is_file($res['tagicon'])) $res['tagicon'] = 'images/ed_html.gif';
			$ret[] = $res;
{'fraction_non_alphanumeric': 0.19729425028184894, 'fraction_numerical': 0.0, 'mean_word_length': 3.966417910447761, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '2244040', 'n_tokens_mistral': 1055, 'n_tokens_neox': 948, 'n_words': 222}