Re: The request has been black-holed
Oh yes. Another importand information. That is only happen on Internet Explorer. jmail W dniu czwartek, 14 czerwca 2012 15:20:49 UTC+2 użytkownik jmail napisał: > Hi all! > > I've got a stupid problem :/ > > I am building small chat. I need that for my customer - it's not importand > > I've got: > > AppController: > > App::uses('Controller', 'Controller'); > class AppController extends Controller { > var $uses = array('Config', 'Chat', 'User'); > var $helpers = array('Form', 'Html', 'Session'); > var $components = array('Session', 'RequestHandler'); > var $nonLoginActions = array( > 'chat' => array('login') > ); > public function beforeFilter() { > parent::beforeFilter(); > $this->getConfig(); > $this->checkSession(); > } > > function getConfig(){ > $config = $this->Config->find('all'); > foreach($config as $element){ >Configure::write('config.'.$element['Config']['name'], > $element['Config']['value']); > } > } > > function checkSession(){ > if(isset($this->nonLoginActions[$this->request->params["controller"]])){ >if(!in_array($this->request->params["action"], > $this->nonLoginActions[$this->request->params["controller"]])){ > if(CakeSession::read("user") === null || CakeSession::read("user") === > false){ > $this->redirect(array('controller' => 'chat', 'action' => 'login')); > } >} > } > } > > } > > > Controller - ChatController > > /* > * To change this template, choose Tools | Templates > * and open the template in the editor. > */ > /** > * Description of ChatController > * > * @author jmail > */ > class ChatController extends AppController{ > var $components = array('Session', 'RequestHandler', 'Security'); > > function login(){ > > } > > } > > View - login.ctp > > Logowanie > Form->create('User', array('inputDefaults' => > array('label' => false,'div' => false)));?> > Form->input('login', array('type' => 'text', 'label' => > 'Login'));?> > Form->input('pass', array('type' => 'password', 'label' > => 'Hasło'));?> > Form->end(array('value' => 'Zaloguj się', 'label' => > 'Zaloguj się', 'div' => false));?> > > Layout - default.ctp > > http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> > http://www.w3.org/1999/xhtml";> > > > echo $this->Html->css('cake.generic'); > ?> > > > > >MiniChat > > >fetch('content'); ?> > > > > > > And my problem is: > > When i go to the http://site/chat/login and press submit button I get > > The request has been black-holed > > *Error: * The requested address *'/chat/login'* was not found on this > server. > > > > Everything is empty. What the hell I am doing wrong? > > cakephp-cakephp-2.1.3-28-g645e981 > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: The request has been black-holed
anyone? That drives me crazy. Completly clean application with one form doing me that thing. How can I live? I am so mad that I am thinking about throwing away that CaShitPHP forever W dniu czwartek, 14 czerwca 2012 15:20:49 UTC+2 użytkownik jmail napisał: > Hi all! > > I've got a stupid problem :/ > > I am building small chat. I need that for my customer - it's not importand > > I've got: > > AppController: > > App::uses('Controller', 'Controller'); > class AppController extends Controller { > var $uses = array('Config', 'Chat', 'User'); > var $helpers = array('Form', 'Html', 'Session'); > var $components = array('Session', 'RequestHandler'); > var $nonLoginActions = array( > 'chat' => array('login') > ); > public function beforeFilter() { > parent::beforeFilter(); > $this->getConfig(); > $this->checkSession(); > } > > function getConfig(){ > $config = $this->Config->find('all'); > foreach($config as $element){ >Configure::write('config.'.$element['Config']['name'], > $element['Config']['value']); > } > } > > function checkSession(){ > if(isset($this->nonLoginActions[$this->request->params["controller"]])){ >if(!in_array($this->request->params["action"], > $this->nonLoginActions[$this->request->params["controller"]])){ > if(CakeSession::read("user") === null || CakeSession::read("user") === > false){ > $this->redirect(array('controller' => 'chat', 'action' => 'login')); > } >} > } > } > > } > > > Controller - ChatController > > /* > * To change this template, choose Tools | Templates > * and open the template in the editor. > */ > /** > * Description of ChatController > * > * @author jmail > */ > class ChatController extends AppController{ > var $components = array('Session', 'RequestHandler', 'Security'); > > function login(){ > > } > > } > > View - login.ctp > > Logowanie > Form->create('User', array('inputDefaults' => > array('label' => false,'div' => false)));?> > Form->input('login', array('type' => 'text', 'label' => > 'Login'));?> > Form->input('pass', array('type' => 'password', 'label' > => 'Hasło'));?> > Form->end(array('value' => 'Zaloguj się', 'label' => > 'Zaloguj się', 'div' => false));?> > > Layout - default.ctp > > http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> > http://www.w3.org/1999/xhtml";> > > > echo $this->Html->css('cake.generic'); > ?> > > > > >MiniChat > > >fetch('content'); ?> > > > > > > And my problem is: > > When i go to the http://site/chat/login and press submit button I get > > The request has been black-holed > > *Error: * The requested address *'/chat/login'* was not found on this > server. > > > > Everything is empty. What the hell I am doing wrong? > > cakephp-cakephp-2.1.3-28-g645e981 > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
The request has been black-holed
Hi all! I've got a stupid problem :/ I am building small chat. I need that for my customer - it's not importand I've got: AppController: array('login') ); public function beforeFilter() { parent::beforeFilter(); $this->getConfig(); $this->checkSession(); } function getConfig(){ $config = $this->Config->find('all'); foreach($config as $element){ Configure::write('config.'.$element['Config']['name'], $element['Config']['value']); } } function checkSession(){ if(isset($this->nonLoginActions[$this->request->params["controller"]])){ if(!in_array($this->request->params["action"], $this->nonLoginActions[$this->request->params["controller"]])){ if(CakeSession::read("user") === null || CakeSession::read("user") === false){ $this->redirect(array('controller' => 'chat', 'action' => 'login')); } } } } } Controller - ChatController Form->create('User', array('inputDefaults' => array('label' => false,'div' => false)));?> Form->input('login', array('type' => 'text', 'label' => 'Login'));?> Form->input('pass', array('type' => 'password', 'label' => 'Hasło'));?> Form->end(array('value' => 'Zaloguj się', 'label' => 'Zaloguj się', 'div' => false));?> Layout - default.ctp http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml";> Html->css('cake.generic'); ?> MiniChat fetch('content'); ?> And my problem is: When i go to the http://site/chat/login and press submit button I get The request has been black-holed *Error: * The requested address *'/chat/login'* was not found on this server. Everything is empty. What the hell I am doing wrong? cakephp-cakephp-2.1.3-28-g645e981 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: [Cake 2.1.1] AJAX POST with jQuery cross Controller - Bad Request
After search and making lot of tests I have decided to do this by other way. 1. I have removed Security component from AppController 2. I have added Security component to every Controller 3. I have added AjaxController to my app without Security component 4. No I am creating functions controller_action_name in AjaxController to give easy search of required methods. Everything is working perfectly. Now I am just thinking if I don't have to make more Ajax controllers for example UserAjaxController. I think tha I have got about 200 functions to do this way so I am just thinking - but that is just a problem which I like to have ^^ My projects are on the run again ;) Thanks for help jmail W dniu piątek, 4 maja 2012 13:58:16 UTC+2 użytkownik jmail napisał: > > Hi! > > I've got application which I am translating from other technology to > CakePHP. Application is in about 60% written with AJAX.There are a lot of > cross controller sends :/ So I've got a problem because when I am trying to > make something similar with Cake I get error 400 - bad request. Of course I > am using Security component and I would like to use this component. App > it's quite secure with that component. Of course when I am using GET > request everything is OK, but when try to use POST request there is a > problem. > > I've got Controller MainController with function start > > class MainController extends AppController{ > function start(){ > $this->set('contests', $this->Contest->find('all', array('conditions' => > array('Contest.start <= now()', 'Contest.finish > now()', 'Contest.active' > => 1, 'Board.status' => 1; > if(CakeSession::read('user') === null){ > $this->layout = 'nonloginlayout'; > } > else{ > $this->render('startlogged'); > } > } > } > > Then in startlogged.ctp I've got script: > > function moreChances(){ > $.prompt.close(); > $.prompt(states, {zIndex: 11000}); > $.ajax({ > url: "/user/invite/" > ,async: true > ,dataType: "html" > ,type: "GET" > ,success: function(data){ > $.prompt.close(); > $.prompt(data, {buttons:{}, zIndex: 11000}) > } > > }); > } > function sendInvite(){ > mail = document.getElementById('inviteMail').value; > message = document.getElementById('inviteMessage').value; > $.prompt.close(); > $.prompt(states, {zIndex: 11000}); > $.ajax({ > url: "/user/send_invite?tmp="+Math.random() > ,async: false > ,data: {test:'doopa'} > ,type: "POST" > ,dataType: "html" > ,success: function(data){ > $('#deb').html(data); > } > ,error: function(jqXHR, textStatus, errorThrown){ > $('#deb').html(errorThrown); > } > }); >} > > > user/invite just loading a form into a prompt window > > > Email address: > > > Message: > > > > send > > > and User controller look like this > > class UserController extends AppController{ > > function beforeFilter() { > parent::beforeFilter(); > $json_actions = array('send_invite'); > if(in_array($this->action, $json_actions)){ > $this->Security->validatePost = false = array('Session', 'RequestHandler', > 'ImageConverter'); > } > } > function invite(){ > $this->layout = ''; > } > function send_invite(){ > $this->autoRender = false; > var_dump($_POST); > } > } > > And I don't know what to do more. Every POST request generating error: > > 2012-05-04 13:54:27 Error: [BadRequestException] The request has been > black-holed > #0 > !!!Path_to_root!!!\lib\Cake\Controller\Component\SecurityComponent.php(227): > SecurityComponent->blackHole(Object(UserController), 'csrf') > > > Can some please help me? I don't know what to do to not get black-holed. I > am desperate because of that three of my projects are stoped :( > > Thanks for all. > W dniu piątek, 4 maja 2012 13:58:16 UTC+2 użytkownik jmail napisał: > > Hi! > > I've got application which I am translating from other technology to > CakePHP. Application is in about 60% written with AJAX.There are a lot of > cross controller sends :/ So I've got a problem because when I am trying to > make something similar with Cake I get error 400 - bad request. Of course I > am using Security component and I would like to use this component. App > it's quite secure with that component. Of course when I am using GET > request everyth
[Cake 2.1.1] AJAX POST with jQuery cross Controller - Bad Request
Hi! I've got application which I am translating from other technology to CakePHP. Application is in about 60% written with AJAX.There are a lot of cross controller sends :/ So I've got a problem because when I am trying to make something similar with Cake I get error 400 - bad request. Of course I am using Security component and I would like to use this component. App it's quite secure with that component. Of course when I am using GET request everything is OK, but when try to use POST request there is a problem. I've got Controller MainController with function start class MainController extends AppController{ function start(){ $this->set('contests', $this->Contest->find('all', array('conditions' => array('Contest.start <= now()', 'Contest.finish > now()', 'Contest.active' => 1, 'Board.status' => 1; if(CakeSession::read('user') === null){ $this->layout = 'nonloginlayout'; } else{ $this->render('startlogged'); } } } Then in startlogged.ctp I've got script: function moreChances(){ $.prompt.close(); $.prompt(states, {zIndex: 11000}); $.ajax({ url: "/user/invite/" ,async: true ,dataType: "html" ,type: "GET" ,success: function(data){ $.prompt.close(); $.prompt(data, {buttons:{}, zIndex: 11000}) } }); } function sendInvite(){ mail = document.getElementById('inviteMail').value; message = document.getElementById('inviteMessage').value; $.prompt.close(); $.prompt(states, {zIndex: 11000}); $.ajax({ url: "/user/send_invite?tmp="+Math.random() ,async: false ,data: {test:'doopa'} ,type: "POST" ,dataType: "html" ,success: function(data){ $('#deb').html(data); } ,error: function(jqXHR, textStatus, errorThrown){ $('#deb').html(errorThrown); } }); } user/invite just loading a form into a prompt window Email address: Message: send and User controller look like this class UserController extends AppController{ function beforeFilter() { parent::beforeFilter(); $json_actions = array('send_invite'); if(in_array($this->action, $json_actions)){ $this->Security->validatePost = false = array('Session', 'RequestHandler', 'ImageConverter'); } } function invite(){ $this->layout = ''; } function send_invite(){ $this->autoRender = false; var_dump($_POST); } } And I don't know what to do more. Every POST request generating error: 2012-05-04 13:54:27 Error: [BadRequestException] The request has been black-holed #0 !!!Path_to_root!!!\lib\Cake\Controller\Component\SecurityComponent.php(227): SecurityComponent->blackHole(Object(UserController), 'csrf') Can some please help me? I don't know what to do to not get black-holed. I am desperate because of that three of my projects are stoped :( Thanks for all. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Generating sitemap
I have all ready found articles in Bakery about generating sitemap and robots in CakePHP. But all of them are connected with Cake 1.x Can someone explain me how to generate sitemap and robots in cake 2.x or just give me an advice how to find those information regards jmail -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Problem with Security
H. That is strange. Why is that working on other controller for admin? Where should I put this App::uses? Can I put this somwhere in AppController? I have added that into the login function and now that is working. jmail On 11 Sty, 03:28, Miles J wrote: > Add this to the top: > > App::uses('Security', 'Utility'); > > On Jan 10, 6:25 pm, jmail wrote: > > > > > Hi all! > > > I am preparing some login action in my app. I have made view > > > <%=$this->Form->create('User', array('action' => > > 'login','inputDefaults' => array('label' => false,'div' => false)));%> > > <%=$this->Form->input('mail', array('type' => 'text', > > 'label' => > > 'Email:'));%> > > <%=$this->Form->input('pass', array('type' => 'password', > > 'label' => > > 'Pass:'));%> > > <%=$this->Form->end(array('value' => 'Login', 'label' => > > 'Login', > > 'class' => 'searchsubmit', 'div' => array('class' => 'floatRight'))); > > %> > > > I have build function in UsersController > > > class UsersController extends AppController{ > > > public function login(){ > > if ($this->request->is('post')) { > > $user = > > $this->User->findByMailAndPass($this->request->data["User"]["mail"], > > Security::hash($this->request->data["User"] > > > ["pass"], null, true)); > > if ($user === false) { > > $this->Session->setFlash('Nieprawidłowe dane > > logowania.'); > > $this->request->data["User"]["mail"] = ''; > > $this->request->data["User"]["pass"] = ''; > > } else { > > CakeSession::write('user.id', $user["User"]["id"]); > > CakeSession::write('user.mail', $user["User"] > > ["mail"]); > > $this->redirect(array('controller' => 'users', > > 'action' => 'profile')); > > } > > } > > } > > > public function logout(){ > > CakeSession::delete("user"); > > $this->redirect('/'); > > } > > > } > > > So. When I go to the HOST/users/login everything is ok, but when I try > > to submit login form I get an error > > > Fatal error: Class 'Security' not found in > > > and of course I've got > > > var $helpers = array('Form', 'Html', 'Session', 'Cycle'); > > > in AppController > > > Can anyone please help me what should I do? > > > Please do not tell me to change my login to the Cake model - I need > > that this way done. > > > For end I will add info tha the same action is working good for admin > > login :( > > > thank's for tips > > > regards > > > jmail- Ukryj cytowany tekst - > > - Pokaż cytowany tekst - -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Problem with Security
Hi all! I am preparing some login action in my app. I have made view <%=$this->Form->create('User', array('action' => 'login','inputDefaults' => array('label' => false,'div' => false)));%> <%=$this->Form->input('mail', array('type' => 'text', 'label' => 'Email:'));%> <%=$this->Form->input('pass', array('type' => 'password', 'label' => 'Pass:'));%> <%=$this->Form->end(array('value' => 'Login', 'label' => 'Login', 'class' => 'searchsubmit', 'div' => array('class' => 'floatRight'))); %> I have build function in UsersController class UsersController extends AppController{ public function login(){ if ($this->request->is('post')) { $user = $this->User->findByMailAndPass($this->request- >data["User"]["mail"], Security::hash($this->request->data["User"] ["pass"], null, true)); if ($user === false) { $this->Session->setFlash('Nieprawidłowe dane logowania.'); $this->request->data["User"]["mail"] = ''; $this->request->data["User"]["pass"] = ''; } else { CakeSession::write('user.id', $user["User"]["id"]); CakeSession::write('user.mail', $user["User"] ["mail"]); $this->redirect(array('controller' => 'users', 'action' => 'profile')); } } } public function logout(){ CakeSession::delete("user"); $this->redirect('/'); } } So. When I go to the HOST/users/login everything is ok, but when I try to submit login form I get an error Fatal error: Class 'Security' not found in and of course I've got var $helpers = array('Form', 'Html', 'Session', 'Cycle'); in AppController Can anyone please help me what should I do? Please do not tell me to change my login to the Cake model - I need that this way done. For end I will add info tha the same action is working good for admin login :( thank's for tips regards jmail -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Problem with relations
Hi! I've got question how can I make HABTM relation? I've got table shops with pk id column I've got table couriers with pk id column I've got table shops_couriers with pk id column and with shop_id and courier_id columns So I have provided into my Shop model class Shop extends AppModel{ public $hasMany = array('Offer'); public $hasAndBelongsToMany = array( 'Courier' => array( 'className' => 'Courier' ,'joinTable' => 'shops_couriers' ,'foreignKey' => 'shop_id' ,'associationForeignKey' => 'courier_id' ) ); public $belongsTo = array('User'); } and now when I try to go any fuction that using Shop model for example public function index(){ $this->set('shops', $this->Shop->find('all')); $this->layout = 'admlayout'; } I get error: 2011-12-27 22:08:25 Error: [MissingActionException] Action XXXController::index() could not be found. #0 XXX\lib\Cake\Routing\Dispatcher.php(104): Controller- >invokeAction(Object(CakeRequest)) #1 XXX\lib\Cake\Routing\Dispatcher.php(86): Dispatcher- >_invoke(Object(AdmshopsController), Object(CakeRequest), Object(CakeResponse)) #2 XXX\app\webroot\index.php(96): Dispatcher- >dispatch(Object(CakeRequest), Object(CakeResponse)) #3 {main} Can someone help me? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Question about routing
No there is no reason - I didn't knew about it. So if I understand I can do something like that Configure::write('Routing.prefixes', array('admin')); Router::connect('/{$prefix}/:controller/:action', array('controller' => "{$prefix}".:controller)); right? I am new to CakePHP but I've got experience with Rails, Wheels and Grails. And I was wondering how can I do that. I want to put admin functionalities into seperate controller. The system will be quite hughe and I don't want to mix functionalities from one role to another. regards jmail On 20 Gru, 08:31, Geoff Douglas wrote: > Is there a reason you aren't using the prefix_routing functionality? > > http://book.cakephp.org/view/950/Prefix-Routing (1.3) > > http://book.cakephp.org/2.0/en/development/routing.html#prefix-routing(2.0) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Question about routing
Hi! I am preparing some application with expanded rights system. And I have a problem with routing - I would like to know if it's possible to make something like this Router::connect('/admin/:controller/:action', array('controller' => 'adm'.:controller)); I need to add this adm or mod or usr to the controller Is it possible? Thanks for raplies jmail -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php