Hello,
Im using auth component and cofiguring it in my AppController, just cake documentain say.
class AppController extends Controller {
public $components = array(
'Session',
'Auth' => array(
'loginRedirect' => array('controller' => 'Sps', 'action' => 'index'),
'logoutRedirect' => array('controller' => 'Users', 'action' => 'index')
)
);
public function beforeFilter() {
$this->Auth->allow('login', 'index', 'forgotPassword');
}
}
So, when an user join the aplication, they go to Sps/index, with session data, goes to another controller for example, Clients, and still having Session, but when he goes to Category, they lose all the data and i get a white screen with no error and no debug info (trying debug to 2 - 3 and still no info). Im using a hoting, so its hard to access to apache log ... but local debuging it, when i delete the Auth Component from my appController, all works fine. And i dont get White Screen.
So basically my problem is that when i go to CategorysController, the user session data is deleted and get a white screen that doesnt spit any info.
Pasting my controller:
<?php
class CategorysController extends AppController {
public $helpers = array('Html', 'Form');
public $uses = array ('Category', 'Sp', 'SpsSpsPart', 'SpsPart');
// public $components = array('Session', 'Auth');
public function beforeFilter() {
parent::beforeFilter();
$this->layout = 'login';
pr ($this->Session->read('Auth.User'));
}
public function index () {
}
public function addCategory ($sp, $spPart, $parent = 0) {
if ($this->request->is('post')) {
$this->Category->set($this->data);
if ($this->Category->validates()) {
$category = array (
'sp_id' => $sp,
'parent_id' => $parent,
'sps_part_id' => $spPart,
'name' => $this->data['Category']['nombre'],
'l_name' => $this->data['Category']['nombrelatin'],
'description' => $this->data['Category']['descripcion']
);
if ($this->Category->save ($category)) {
$this->Session->setFlash ('Categoría guardada con éxito.');
$this->redirect(array('controller' => 'Categorys', 'action' => 'showCategory', $sp, $spPart));
}
}
}
}
public function showCategory ($sp, $spPart, $parent = null) {
if ($parent == null) {
$category = $this->Category->find('all', array (
'fields' => array('Category.id', 'Category.sp_id', 'Category.parent_id', 'Category.sps_part_id', 'Category.name', 'Category.l_name', 'Category.description'),
'conditions' => array('Category.sp_id = ' .$sp . ' AND Category.sps_part_id = ' . $spPart.' AND Category.parent_id = 0'),
'recursive' => 0)
);
}else {
$category = $this->Category->find('threaded', array (
'conditions' => array('Category.parent_id = ' .$parent)
));
}
$this->set('category', $category);
}
public function edit ($sp, $spPart, $id) {
$category = $this->Category->find('first', array (
'fields' => array('Category.id, Category.sp_id, Category.sps_part_id, Category.parent_id, Category.name, Category.l_name, Category.description'),
'conditions' => array (
'Category.sp_id' => $sp,
'Category.sps_part_id' => $spPart,
'Category.id' => $id
))
);
$this->set('category', $category);
if ($this->request->is('post')) {
$this->Category->set($this->data);
if ($this->Category->validates()) {
if ($this->Category->updateAll (
array('name' => "'". $this->data['Category']['nombre'] . "'",
'l_name' => "'". $this->data['Category']['nombrelatin']."'",
'description' => "'". $this->data['Category']['descripccion']."'"),
array('Category.id' => $id))) {
$this->Session->setFlash ('Se ha editado el nombre con éxito.');
$this->redirect(array('controller' => 'Categorys', 'action' => 'showCategory', $category['Category']['sp_id'],
$category['Category']['sps_part_id'],
$category['Category']['parent_id']));
}
}
}
}
public function result ($sp, $part, $parent = 0) {
$category = $this->Category->find('all', array (
'fields' => array('Category.id', 'Category.sp_id', 'Category.parent_id', 'Category.sps_part_id', 'Category.name', 'Category.l_name', 'Category.description'),
'conditions' => array('Category.sp_id = ' .$sp . ' AND Category.sps_part_id = ' . $part.' AND Category.parent_id = '. $parent),
'recursive' => 0)
);
}
}
Im using cakephp 2.1, php 5.2.1
Any idea?
Thanks you for your time and sorry for my English.
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
Thursday, January 3, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment