Skip to content

Instantly share code, notes, and snippets.

Sergio Vilar sergiovilar

Block or report user

Report or block sergiovilar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View app_controller.php
<?php
/**
* App Controller
*
* @link http://book.cakephp.org/pt/view/957/A-classe-AppController
*/
class AppController extends Controller
{
View publications.sql
CREATE TABLE `publications` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` varchar(120) NOT NULL,
`account_id` int(11) NOT NULL,
`message` text NOT NULL,
`link` text NOT NULL,
`date` datetime NOT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
View publication.php
<?php
class Publication extends AppModel {
var $name = 'Publication';
var $validate = array(
'uid' => array(
'notempty' => array(
'rule' => array('notempty'),
),
),
'account_id' => array(
View painel_controller.php
<?php
class PainelController extends AppController {
var $name = "Painel";
var $uses = null;
function admin_index(){
$this->loadModel('Publication');
$this->set("publication", $this->Publication->find(array('uid'=>$this->Auth->User('id'))));
View painel_controller.php
<?php
class PainelController extends AppController {
var $name = "Painel";
var $components = array('Auth','Session','Cookie');
var $helpers = array('Html','Form','Session','Ajax','Paginator');
var $uses = array('Publication','Account');
function admin_index(){
$this->set('title', 'Painel');
@sergiovilar
sergiovilar / app_controller.php
Created Sep 25, 2011
Problema com Hash de senhas
View app_controller.php
/**
* App Controller
*
* @link http://book.cakephp.org/pt/view/957/A-classe-AppController
*/
class AppController extends Controller
{
/**
* Define os componentes disponíveis por padrão
View publicacoes_controller.php
function admin_delete($id = null){
$pub = $this->Publicacao->read(null,$id);
if($pub['Publicacao']['usuario_id']==$this->Auth->user('id')):
$this->Publicacao->set(array(
'id' => $id,
'state' => '0'
));
$this->Publicacao->save($this->data);
$this->Publicacao->deleteAll(array('Publicacao.parent' => $id));
View publicacoes_controller.php
<?php
function admin_delete($id = null){
$pub = $this->Publicacao->read(null,$id);
if($pub['Publicacao']['usuario_id']==$this->Auth->user('id')):
$this->Publicacao->set(array(
'id' => $id,
'state' => '0'
));
$this->Publicacao->save($this->data);
View 000-default
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/svilar/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
View category.php
<?php
query_posts( array( 'posts_per_page' => '5', 'cat' => get_query_var('cat'), 'paged' => get_query_var('paged') ) );
?>
You can’t perform that action at this time.