<?php
class ControllerCommonFooter extends Controller {
	protected function index() {
		$this->language->load('common/footer');

		$version = $this->db->query("SELECT * FROM `parametros_efutura` WHERE 1 order by id desc limit 1")->row;

		if ($version){
			$this->data['text_footer'] = sprintf($this->language->get('text_footer'), $version['versao_atual'].' - Build: '.$version['build_exe'] );
		}else{
			$this->data['text_footer'] = sprintf($this->language->get('text_footer'), VERSION );
		}

		if (file_exists(DIR_SYSTEM . 'config/svn/svn.ver')) {
			$this->data['text_footer'] .= '.r' . trim(file_get_contents(DIR_SYSTEM . 'config/svn/svn.ver'));
		}

		$this->data['ambiente_teste'] = (defined('AMBIENTE_TESTE')) ? true : false;

        $this->template = 'common/footer.tpl';

        if (!$this->user->isLogged() || !isset($this->request->get['token']) || !isset($this->session->data['token']) || ($this->request->get['token'] != $this->session->data['token'])) {
            $this->data['logged'] = '';
        } else {
            $this->data['user'] = $this->getChild('common/user');
        }

        $this->render();

  	}
}
