<commit_before><?php

class ThumbsController extends BrownieAppController{

	var $uses = array();
	var $autoRender = false;


	function beforeFilter() {
		$this->Auth->allow('*');
	}


	function view($model = '', $recordId = '', $sizes = '', $category_code = '', $file = '') {
		$BrwImage = ClassRegistry::init('BrwImage');
		$cachedFile = $BrwImage->resizedVersions($model, $recordId, $sizes, $category_code, $file);
		if (is_file($cachedFile)) {
			$isPublic = (substr($cachedFile, 0, strlen(WWW_ROOT)) === WWW_ROOT);
			if (!$isPublic and !AuthComponent::user()) {
				$this->response->statusCode('404');
			}
			$cachedImage = getimagesize($cachedFile);
			header('Content-Type: '.$cachedImage['mime']);
			readfile($cachedFile);
			exit;
		}
    }<commit_msg>call brwAfterThumbnail method if exists in model<commit_after><?php

class ThumbsController extends BrownieAppController{

	var $uses = array();
	var $autoRender = false;


	function beforeFilter() {
		$this->Auth->allow('*');
	}


	function view($model = '', $recordId = '', $sizes = '', $category_code = '', $file = '') {
		$BrwImage = ClassRegistry::init('BrwImage');
		$cachedFile = $BrwImage->resizedVersions($model, $recordId, $sizes, $category_code, $file);
		if (is_file($cachedFile)) {
			$isPublic = (substr($cachedFile, 0, strlen(WWW_ROOT)) === WWW_ROOT);
			if (!$isPublic and !AuthComponent::user()) {
				$this->response->statusCode('404');
			}
			$cachedImage = getimagesize($cachedFile);
			header('Content-Type: ' . $cachedImage['mime']);
			readfile($cachedFile);
			$Model = ClassRegistry::init($model);
			if (method_exists($Model, 'brwAfterThumbnail')) {
				$Model->brwAfterThumbnail($recordId, $sizes, $category_code, $file);
			}
			exit;
		}
    }
{'fraction_non_alphanumeric': 0.19055843408175013, 'fraction_numerical': 0.004605641911341394, 'mean_word_length': 5.013840830449827, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '6414502', 'n_tokens_mistral': 649, 'n_tokens_neox': 580, 'n_words': 107}