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 | |
/** | |
* App Controller | |
* | |
* @link http://book.cakephp.org/pt/view/957/A-classe-AppController | |
*/ | |
class AppController extends Controller | |
{ |
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
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 ; |
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 Publication extends AppModel { | |
var $name = 'Publication'; | |
var $validate = array( | |
'uid' => array( | |
'notempty' => array( | |
'rule' => array('notempty'), | |
), | |
), | |
'account_id' => array( |
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 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')))); |
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 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'); |
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
/** | |
* 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 |
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
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)); |
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 | |
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 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
<VirtualHost *:80> | |
ServerAdmin webmaster@localhost | |
DocumentRoot /home/svilar/www | |
<Directory /> | |
Options FollowSymLinks | |
AllowOverride None | |
</Directory> |
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 | |
query_posts( array( 'posts_per_page' => '5', 'cat' => get_query_var('cat'), 'paged' => get_query_var('paged') ) ); | |
?> |
OlderNewer