This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO users (username, password, name, valid, ROLE) VALUES ('eminetto',md5('teste'),'Elton Minetto', 1, 'admin'); | |
INSERT INTO users (username, password, name, valid, ROLE) VALUES ('steve',md5('teste'),'Steve Jobs', 1, 'redator'); | |
INSERT INTO users (username, password, name, valid, ROLE) VALUES ('bill',md5('teste'),'Bill Gates', 1, 'visitante'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function init() { | |
//deve chamar o método init da classe pai, sempre | |
parent::init(); | |
$session = Zend_Registry::get('session'); | |
//verifica ACL | |
if(Zend_Registry::isRegistered('acl')) { | |
$request = $this->getRequest(); | |
//pega o nome do modulo, controlador e action | |
$controller = $request->getControllerName(); | |
$module = $request->getModuleName(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* navegacao | |
*/ | |
$container = new Zend_Navigation(array( | |
array( | |
'label' => 'Home', | |
'module' => 'default', | |
'controller' => 'index', | |
'action' => 'index', | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* navegacao | |
*/ | |
$container = new Zend_Navigation(array( | |
array( | |
'label' => 'Home', | |
'module' => 'default', | |
'controller' => 'index', | |
'action' => 'index', | |
'resource' => 'default_index', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$frontendOptions = array( | |
'lifetime' => 7200, // tempo de vida de 2 horas | |
'automatic_serialization' => true | |
); | |
$backendOptions = array( | |
'cache_dir' => CACHE_PATH // | |
); | |
// criando uma instancia do cache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$cache = Zend_Registry::get('cache'); | |
//busca os posts | |
$posts = new Posts(); //cria um novo objeto Posts | |
//verifica se já está no cache o resultado | |
if(!$result = $cache->load('cachePosts')) { | |
//não existe no cache, processar e salvar | |
$result = $posts->fetchAll();//pega todos os posts | |
$cache->save($result, 'cachePosts'); | |
} | |
$this->view->data = $result; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$cache = Zend_Registry::get('cache'); | |
if(!$form = $cache->load('LoginForm')) { | |
$form = new LoginForm; | |
//salva o form renderizado no cache | |
$cache->save($form->render(), 'LoginForm'); | |
} | |
$this->view->form = $form; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* cache para metadados das tabelas. Usado pelos Models para salvar os detalhes da tabela (campos,chaves) | |
*/ | |
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache); | |
/* | |
* Configura o cache para a traducao | |
*/ | |
Zend_Translate::setCache($cache); | |
/* coloca o zend_date e o zend_locale em cache */ | |
Zend_Locale::setCache($cache); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Xorna_Session_Handler implements Zend_Session_SaveHandler_Interface{ | |
private $maxlifetime = 3600; | |
public $cache = ''; | |
public function __construct($cacheHandler) { | |
$this->cache = $cacheHandler; | |
} | |
public function open($save_path, $name) { | |
return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
isEmpty;O campo deve ser preenchido | |
stringLengthTooShort;O valor do campo deve ter no minimo %min% caracteres | |
stringLengthTooLong;O valor do campo deve ter no máximo %max% caracteres | |
notSame;Os valores fornecidos são diferentes | |
missingToken;Nenhuma senha foi fornecida | |
emailAddressInvalid;Endereço de e-mail inválido | |
hostnameInvalidHostname;Endereço inválido | |
notDigits;Valor inválido | |
hostnameUnknownTld;'%value%' é um domínio desconhecido | |
hostnameLocalNameNotAllowed;'%value%' é um domínio não permitido |