<?php
class Analyze {

	private $analyze = 'analyze=';

	public function __construct($registry) {
		$this->config  = $registry->get('config');
		$this->db 		 = $registry->get('db');
	  $this->request = $registry->get('request');
		$this->validateAnalyze();
	}

	public function validateAnalyze() {

		if(isset($this->request->get['analyze'])){
				 $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "analyze WHERE codigo in('&".$this->db->escape($this->analyze.$this->request->get['analyze'])."','&amp;".$this->db->escape($this->analyze.$this->request->get['analyze'])."')");
         
				 if($query->rows){
				 	$quantidade = $query->row['quantidade']+1;
				 	$this->db->query("UPDATE " . DB_PREFIX . "analyze SET quantidade = '" . $quantidade . "' WHERE analyze_id = '". $query->row['analyze_id']."' ");
				 }
		}

	}


}
