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
<?php | |
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap | |
{ | |
/** | |
* Salva o config no registry | |
* @return void | |
* @author Elton Minetto | |
*/ | |
public function _initConfig() |
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
<?php | |
class AuthController extends Blog_Controller_Action | |
{ | |
public function init() | |
{ | |
/* Initialize action controller here */ | |
} |
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
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
</head> | |
<body> | |
<h2>Blog do Minetto</h2> | |
<?php | |
//mensagens de erro | |
$session = Zend_Registry::get('session'); | |
if(isset($session->erro)) |
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
;roles | |
acl.roles.visitante = null | |
acl.roles.redator = visitante | |
acl.roles.admin = redator | |
acl.resources[] = index | |
acl.resources[] = post | |
acl.resources[] = auth | |
;definir as acls no formato acl.permissao.role[] = controller.action | |
acl.allow.visitante[] = index.index | |
acl.allow.visitante[] = post.retrieve |
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
/** | |
* inicializa a acl | |
* | |
* @return void | |
* @author Elton Minetto | |
**/ | |
protected function _initAcl() | |
{ | |
$acl = new Zend_Acl; | |
$config = Zend_Registry::get('config'); |
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
<?php | |
class Blog_Controller_Action extends Zend_Controller_Action | |
{ | |
public function init() | |
{ | |
$session = Zend_Registry::get('session'); | |
//verifica ACL | |
if(Zend_Registry::isRegistered('acl')) { | |
$request = $this->getRequest(); | |
//pega o nome do modulo, controlador e action |
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
/** | |
* inicializa a navegação | |
* | |
* @return void | |
* @author Elton Minetto | |
**/ | |
public function _initNavigation() | |
{ | |
/* | |
* navegacao |
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
/** | |
* inicializa a navegação | |
* | |
* @return void | |
* @author Elton Minetto | |
**/ | |
public function _initNavigation() | |
{ | |
/* | |
* navegacao |
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
<?php | |
class Application_Form_Login extends Zend_Form | |
{ | |
public function init() | |
{ | |
//nome do formulário | |
$this->setName('Login'); | |
//elemento para o campo username | |
$username = new Zend_Form_Element_Text('username'); | |
//configurar o label, dizer q é obrigatório, adicionar um filtro e um validador |
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
<?php | |
class Application_Form_Album extends Zend_Form | |
{ | |
public function init() | |
{ | |
$this->setName('Foto'); | |
$title = new Zend_Form_Element_Text('title'); | |
$title->setLabel('Título')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty'); |