This file contains 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 MyModel extends AppModel | |
{ | |
/* | |
* Change MyModel to your Model | |
* Change status to your field in database | |
* $id is your primary key to registry in database | |
* |
This file contains 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 | |
App::uses('Security', 'Utility'); | |
class UsuariosController extends AppController { | |
function beforeFilter(){ | |
parent::beforeFilter(); | |
if ($this->action == 'admin_login'){ | |
$this->action = 'login'; | |
} | |
$this->Auth->allow(array('admin_add')); |
This file contains 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 | |
App::uses('Security', 'Utility'); | |
class UsuariosController extends AppController { | |
function beforeFilter(){ | |
parent::beforeFilter(); | |
if ($this->action == 'admin_login'){ | |
$this->action = 'login'; | |
} | |
$this->Auth->allow(); |
This file contains 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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.*)$ index.php/$1 [QSA,L] | |
</IfModule> |
This file contains 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
sudo add-apt-repository ppa:ondrej/php5-5.6 | |
sudo apt-get update && sudo apt-get upgrade | |
sudo apt-get install php5 |
This file contains 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 initialize() | |
{ | |
parent::initialize(); | |
$this->loadComponent('Auth', [ | |
'loginAction' => [ | |
'controller' => 'Usuarios', //aqui eu troco o controller | |
'action' => 'acesso' //aqui a action que vamos usar pra logar | |
], | |
'authenticate' => [ | |
'Form' => [ |
This file contains 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 | |
App::uses('Seo', 'Model'); | |
App::uses('Pagina', 'Model'); | |
class AppSchema extends CakeSchema { | |
public function before($event = array()) { | |
$db = ConnectionManager::getDataSource('default'); | |
$db->cacheSources = false; | |
return true; | |
} |
This file contains 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
SET NAMES utf8; | |
SET time_zone = '+00:00'; | |
SET foreign_key_checks = 0; | |
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; | |
DROP TABLE IF EXISTS `paginas`; | |
CREATE TABLE `paginas` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`menu` varchar(512) DEFAULT NULL, | |
`corpo` text, |
This file contains 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 beforeFilter(Event $event) | |
{ | |
$user = $this->Auth->user(); | |
$params = $this->request->params; | |
if ($user['admin'] != 1 and isset($params['prefix']) and $params['prefix'] == 'admin') | |
throw new ForbiddenException('Você não tem permissão'); | |
} |
This file contains 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
Mantenha o canal organizado | |
1. Poste cada assunto em seu devido canal | |
- #anuncios: Você deve postar apenas anúncios para serviços e produtos (pagos), como cursos por exemplo | |
- #dicas: Artigos, produtos e serviços (free), oportunidades, você nao pode promover promoções aqui, isso é anuncio | |
- #dúvidas: canal exclusivo para dúvidas sobre CakePHP | |
- #feeds: Integração com RSS de blogs, peça a um administrador cadastrar o seu | |
- #hospedagens: Para assuntos relacionados a hospedagem, vps, configurações, emfim... | |
- #repos: Integração com repositórios no GitHub, pela a um administrador para cadastrar o seu | |
- #off-topic: Assuntos diversos |
OlderNewer