stocker un tableau avec l'option serialize() cakephp
Bonjour, <https://lh3.googleusercontent.com/-HjI1kOgHZv4/VXFsJa5QsuI/ASg/fRNVvWHhx3M/s1600/Capture%2Bd%25E2%2580%2599e%25CC%2581cran%2B2015-06-05%2Ba%25CC%2580%2B10.29.46.png> est ce que quelqu'un peut m aidé pour stocker un tableau qui contient une colonne date par mois et des lignes de type d'absence , j'utilise cakephp , j'ai réussie de stocker une seul colonne, mais j'arrive pas de stocker tout le tableau . merci voila mon code de mon controleur public function edit($id = null) { if (!$this->Clas->exists($id)) { throw new NotFoundException(__('Invalid clas')); } if ($this->request->is(array('post', 'put'))) { if ($this->Clas->saveAll($this->request->data)) { $_POST['data']['Clas']= mysql_escape_string(serialize($_POST['data']['Clas'])); var_dump($_POST['data']['Clas']); $this->Session->setFlash(__('The clas has been saved.')); return $this->redirect(array('action' => 'index')); } else { debug($this->request->data); $this->Session->setFlash(__('The clas could not be saved. Please, try again.')); } } else { $options = array('conditions' => array('Clas.' . $this->Clas->primaryKey => $id)); $this->request->data = $this->Clas->find('first', $options); } } -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
problema al cargar un div mediante ajax.
Estimados. primero explicare lo que estoy tratando de hacer. tengo una pagina index, que contiene una grilla. en cada linea de la grilla tengo un boton ver la idea es que cuando presiono en el boton ver recargue un div en la misma pagina, con infromacion traida desde una funcion en el controlador. lo primero que se me vino a la mente fue hacerlo con ajax+jquery. entonces lo hice de la forma clasica $.ajax({ url: 'la direccion del controlador/la funcion', type: 'post', data: 'arreglo con los datos a enviar', success: function (result) { proceso que llena el div .. } }); y funciono correctamente. pero por motivos de la empresa, no me sirve tengo que hacerlo de la forma nativa en cakephp ahora para seguir con el estandar de cakephp estoy trabajando con un element el element se encuentra en mi carpeta "app\View\Elements" ahora tengo un codigo que me funciona pero no es ajax *en el controlador* public function mi_funcion($id=5) { $posts = $this->Post->find('all', array('fields'=>array('Post.id', 'Post.title', 'Post.Created'), 'recursive'=>0, 'order'=>array('Post.created desc'), 'limit'=>$id)); if(isset($this->params['requested'])) { return $posts; } $this->set('exs', $posts); $this->layout = 'ajax'; } en la vista si pongo esta llamada la funcion me carga los datos en el div $exs = $this->requestAction('mi_controlador/mi_funcion'); ahora necesito hacerlo mediante ajax. intente algo como esto pero no me funciono echo $this->Js->request ( array( 'controller' => 'mi_controlador', 'action' => ',i_funcion' ), array( 'update' => '#vistaParcial', 'async' => true, 'dataExpression' => true, 'method' => 'get', 'data' => array('id'=>'5') ) ); alguna ayuda porfavor -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
un
un -- 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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
RE: Un-related models / functions
Thanks man :) Good looking out. -Original Message- From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of lowpass Sent: Tuesday, December 11, 2012 3:35 PM To: cake-php@googlegroups.com Subject: Re: Un-related models / functions keep "last" On Tue, Dec 11, 2012 at 1:53 PM, Advantage+ wrote: > Running nGinx on Ubuntu. No htaccess files used on nGinx. > > In my sites-available conf: > > if (!-e $request_filename) { > rewrite ^/(.+)$ /index.php?url=$1 last; > break; > } > > So remove the ?url=$1 or ?url=$1 last ? > > Thanks, > > Dave > -Original Message- > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On > Behalf Of lowpass > Sent: Tuesday, December 11, 2012 3:09 PM > To: cake-php@googlegroups.com > Subject: Re: Un-related models / functions > > On Mon, Dec 10, 2012 at 2:50 PM, Advantage+ wrote: >> >> Forbidden >> >> Error: The requested address >> '/products/feature?url=products%2Ffeature' was not found on this server. > > Cake throws a 404 on internal errors when debug = 0. Set debug to 2 to > see what the problem is. > >> And whats with the crazy url? > > It looks like you're running 2.x with 1.x mod_rewrite rules. Update > your webserver config or .htaccess, whichever you're using. Remove the "?url=$1" > part. > > -- > 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+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > > > -- > 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+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Un-related models / functions
keep "last" On Tue, Dec 11, 2012 at 1:53 PM, Advantage+ wrote: > Running nGinx on Ubuntu. No htaccess files used on nGinx. > > In my sites-available conf: > > if (!-e $request_filename) { > rewrite ^/(.+)$ /index.php?url=$1 last; > break; > } > > So remove the ?url=$1 or ?url=$1 last ? > > Thanks, > > Dave > -Original Message- > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf > Of lowpass > Sent: Tuesday, December 11, 2012 3:09 PM > To: cake-php@googlegroups.com > Subject: Re: Un-related models / functions > > On Mon, Dec 10, 2012 at 2:50 PM, Advantage+ wrote: >> >> Forbidden >> >> Error: The requested address >> '/products/feature?url=products%2Ffeature' was not found on this server. > > Cake throws a 404 on internal errors when debug = 0. Set debug to 2 to see > what the problem is. > >> And whats with the crazy url? > > It looks like you're running 2.x with 1.x mod_rewrite rules. Update your > webserver config or .htaccess, whichever you're using. Remove the "?url=$1" > part. > > -- > 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+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > > > -- > 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+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
RE: Un-related models / functions
Running nGinx on Ubuntu. No htaccess files used on nGinx. In my sites-available conf: if (!-e $request_filename) { rewrite ^/(.+)$ /index.php?url=$1 last; break; } So remove the ?url=$1 or ?url=$1 last ? Thanks, Dave -Original Message- From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of lowpass Sent: Tuesday, December 11, 2012 3:09 PM To: cake-php@googlegroups.com Subject: Re: Un-related models / functions On Mon, Dec 10, 2012 at 2:50 PM, Advantage+ wrote: > > Forbidden > > Error: The requested address > '/products/feature?url=products%2Ffeature' was not found on this server. Cake throws a 404 on internal errors when debug = 0. Set debug to 2 to see what the problem is. > And whats with the crazy url? It looks like you're running 2.x with 1.x mod_rewrite rules. Update your webserver config or .htaccess, whichever you're using. Remove the "?url=$1" part. -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Un-related models / functions
On Mon, Dec 10, 2012 at 2:50 PM, Advantage+ wrote: > > Forbidden > > Error: The requested address '/products/feature?url=products%2Ffeature' was > not found on this server. Cake throws a 404 on internal errors when debug = 0. Set debug to 2 to see what the problem is. > And whats with the crazy url? It looks like you're running 2.x with 1.x mod_rewrite rules. Update your webserver config or .htaccess, whichever you're using. Remove the "?url=$1" part. -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
RE: Un-related models / functions
Ok I copied exactly as described in the book. My default layout has : element('footer_feature_product', array('cache' => '+1 hour'));?> The element is: requestAction(array('controller' => 'products' ,'action' => 'feature'));?> Html->image('footer_block_1.jpg', array('alt' => 'Featured Product'));?> Featured Product Text->truncate($product['Product']['description'],$length=100,array ()));?> read more Controller: public function feature() { if (empty($this->request->params['requested'])) { throw new ForbiddenException(); } return $this->Product->find('first', array( 'Product.featured' => 1, 'contain' => false)); } Now on the index page no issues. Click login (hover over the link => users/login) but when I click login I get directed to products/feature with error message Forbidden Error: The requested address '/products/feature?url=products%2Ffeature' was not found on this server. And whats with the crazy url? From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Piotr Beschel Sent: Monday, December 10, 2012 5:31 AM To: cake-php@googlegroups.com Subject: Re: Un-related models / functions read about Controller::requestAction(string $url, array $options) http://book.cakephp.org/2.0/en/controllers.html W dniu poniedziałek, 10 grudnia 2012 03:35:05 UTC+1 użytkownik advantage+ napisał: I have a footer which has a featured product and recent news. What is the best way to call these actions getFeatured(), and getNews() when there is no related model to use as they are permanent "blocks" in the footer in default.ctp layout? Thanks, Dave -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Un-related models / functions
read about Controller::requestAction(*string $url*, *array $options*) http://book.cakephp.org/2.0/en/controllers.html W dniu poniedziałek, 10 grudnia 2012 03:35:05 UTC+1 użytkownik advantage+ napisał: > > I have a footer which has a featured product and recent news. > > What is the best way to call these actions getFeatured(), and getNews() > when there is no related model to use as they are permanent "blocks" in the > footer in default.ctp layout? > > > > Thanks, > > Dave > -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Un-related models / functions
I have a footer which has a featured product and recent news. What is the best way to call these actions getFeatured(), and getNews() when there is no related model to use as they are permanent "blocks" in the footer in default.ctp layout? Thanks, Dave -- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Comment convertir un templates wordpress pour cakephp
Bonjour à tous j'ai un templates wordpress que j'aimerai convertir pour l'intégré à cakephp ? -- Like Us on FacekBook 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Console 2.1 génére un code non valable ?
Salut Je travail sur windows XP et je commence à utliser cakephp (2.1 )et j'ai essayer de générer une petite application(deux table ) en utlisant la console. mais je rencontre une erreur: Code: php 1. Fatal error: Call to a member function find() on a non-object in C:\wamp\www\cakephp2.1Console\app\Controller\OperationsController.php on line 51 Vous pouvez trouver sur ce lien le dossier "app" de l'application avec le code sql de la base zippé : http://www.afak-m.com/cakephp/app.zip Je ne sais pas d'ou vient cette error surtout que le code est généré par la console! Merci pour votre aide -- -- -- Cordialement -- Mamdouh DAHAN www.afak-m.com -- 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
Console 2.1 génére un code non valable ?
Salut Je travail sur windows XP et je commence à utliser cakephp (2.1 )et j'ai essayer de générer une petite application(deux table ) en utlisant la console. mais je rencontre une erreur: Code: php 1. Fatal error: Call to a member function find() on a non-object in C:\wamp\www\cakephp2.1Console\app\Controller\OperationsController.php on line 51 Vous pouvez trouver sur ce lien le dossier "app" de l'application avec le code sql de la base zippé : http://www.afak-m.com/cakephp/app.zip Je ne sais pas d'ou vient cette error surtout que le code est généré par la console! Merci pour votre aide -- Cordialement -- Mamdouh DAHAN www.afak-m.com -- 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: (un)conventional associations
After a sleep, you were right. Thank you. Il 05/03/2012 21:41, José Lorenzo ha scritto: $belongsTo = array('Upload' => array('foreignKey' => 'foreign_key', 'conditions' => array('Upload.model' => 'photo'))) On Monday, March 5, 2012 12:12:10 PM UTC-4:30, muka wrote: Hi, I've made a nice mess with some tables.. I got a uploads table with two fields (model, foreign_key) which serve many models, so "Upload.model = 'photo' AND Upload.foreign_key = Photo.id" give me all the uploads Photo "out of the box". I can't figure out how to define the back association from Photo model (hasOne), I got no more foreignKey! Should I alter the query in the model callback ? Thanks in advance. Luca -- 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 -- 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: (un)conventional associations
Thank you, this works fine for Photo->Upload but my problem actually is to link back to the Photo model: Upload hasOne Photo //Upload.php 'Photo' => array( 'className' => 'Photo', 'foreignKey' => ' ? ', // would be what ? 'conditions' => '', 'fields' => '', 'order' => '' ), Luca Il 05/03/2012 21:41, José Lorenzo ha scritto: $belongsTo = array('Upload' => array('foreignKey' => 'foreign_key', 'conditions' => array('Upload.model' => 'photo'))) On Monday, March 5, 2012 12:12:10 PM UTC-4:30, muka wrote: Hi, I've made a nice mess with some tables.. I got a uploads table with two fields (model, foreign_key) which serve many models, so "Upload.model = 'photo' AND Upload.foreign_key = Photo.id" give me all the uploads Photo "out of the box". I can't figure out how to define the back association from Photo model (hasOne), I got no more foreignKey! Should I alter the query in the model callback ? Thanks in advance. Luca -- 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 -- 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: (un)conventional associations
$belongsTo = array('Upload' => array('foreignKey' => 'foreign_key', 'conditions' => array('Upload.model' => 'photo'))) On Monday, March 5, 2012 12:12:10 PM UTC-4:30, muka wrote: > > Hi, > I've made a nice mess with some tables.. > > I got a uploads table with two fields (model, foreign_key) which serve > many models, so "Upload.model = 'photo' AND Upload.foreign_key = > Photo.id" give me all the uploads Photo "out of the box". > > I can't figure out how to define the back association from Photo model > (hasOne), I got no more foreignKey! > > Should I alter the query in the model callback ? > > Thanks in advance. > Luca > > > -- 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
(un)conventional associations
Hi, I've made a nice mess with some tables.. I got a uploads table with two fields (model, foreign_key) which serve many models, so "Upload.model = 'photo' AND Upload.foreign_key = Photo.id" give me all the uploads Photo "out of the box". I can't figure out how to define the back association from Photo model (hasOne), I got no more foreignKey! Should I alter the query in the model callback ? Thanks in advance. Luca -- 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: Getting CakePHP to return a 50x HTTP response when an un-handled exception occurs
If you're looking for a solution to this, its already been completely implemented for 2.0 in the ErrorHandler and ExceptionRenderer classes. And because 2.0 uses PDO for the connections database errors become exceptions. You could always use a custom error handler that converts errors into exceptions, which will make things like warnings from mysql become halting exceptions. -Mark On Jul 2, 6:46 am, euromark wrote: > i have similar problems with an incorrect status code for MYSQL > errorshttp://groups.google.com/group/cake-php/browse_thread/thread/70b6a8b2... > > seems like there is a lot to do concerning correct response codes > > On 30 Jun., 14:37, lsiden wrote: > > > > > > > > > I am writing a CakePHP (cakephp.org) controller. One of the actions, > > "myAction", responds to AJAX requests. I find it annoying that if > > anything goes wrong in the action handler, Cake always responds with > > an error page and an HTTP status of 200, meaning that it fails > > silently, so I have to open a new window and run the AJAX request > > directly from the address bar to see the output and find out what went > > wrong. > > > Please see my question to StackOverflow.com for the rest of the > > details:http://stackoverflow.com/questions/6529588/getting-cakephp-to-return-... -- 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: Getting CakePHP to return a 50x HTTP response when an un-handled exception occurs
i have similar problems with an incorrect status code for MYSQL errors http://groups.google.com/group/cake-php/browse_thread/thread/70b6a8b241ab0948# seems like there is a lot to do concerning correct response codes On 30 Jun., 14:37, lsiden wrote: > I am writing a CakePHP (cakephp.org) controller. One of the actions, > "myAction", responds to AJAX requests. I find it annoying that if > anything goes wrong in the action handler, Cake always responds with > an error page and an HTTP status of 200, meaning that it fails > silently, so I have to open a new window and run the AJAX request > directly from the address bar to see the output and find out what went > wrong. > > Please see my question to StackOverflow.com for the rest of the > details:http://stackoverflow.com/questions/6529588/getting-cakephp-to-return-... -- 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
Getting CakePHP to return a 50x HTTP response when an un-handled exception occurs
I am writing a CakePHP (cakephp.org) controller. One of the actions, "myAction", responds to AJAX requests. I find it annoying that if anything goes wrong in the action handler, Cake always responds with an error page and an HTTP status of 200, meaning that it fails silently, so I have to open a new window and run the AJAX request directly from the address bar to see the output and find out what went wrong. Please see my question to StackOverflow.com for the rest of the details: http://stackoverflow.com/questions/6529588/getting-cakephp-to-return-a-50x-http-response-when-an-un-handled-exception-occurs -- 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: Multiple models from un-normalized table
If it was up to me, I would just go through the process of normalizing the table so that I had a "products", "categories" and "stores" table each with its corresponding Model. Unfortunately, I didn't have any say in the table design, so I'm stuck with it. In the interest of time, I may just stick with option #2 and have one big "Prices" model with all of the table's fields. I guess what I was hoping was that there would be some way to set up the model/table mappings so that I could still use models that made sense (Product, Category and Store) and were all related to each other like they should be, but still use the "abnormal" table as it currently is. On Mar 27, 12:05 pm, Akeda Bagus wrote: > On Sun, Mar 28, 2010 at 12:33 AM, bmcelhany wrote: > > Hello, > > > I've done some searching and can't quite seem to find what I'm looking > > for. I have an existing php app that I've inherited that I'd like to > > migrate to CakePHP. The problem I'm running into is that this app is > > driven by a single un-normalized table...definitely not a db structure > > that works well with Cake out of the box. What I'd like to know is the > > best way to approach setting up my models for this type of situation. > > Here are some of the fields in the table (named "Prices"): > > > id (int), category (varchar), item (varchar), brand (varchar), store > > (varchar), price, size, etc ... > > > As it stands, I can obviously just use the "Prices" table as is and > > have a single "Price" model in my app with all of the above fields. In > > a perfect world, however, I'd like to be able to split everything into > > several more logical models (i.e. Category, Brand, Store, etc), each > > with the appropriate relationships (i.e. Category has many Products) > > as well as refer to the main record as "Product" instead of the > > default table name/model of "Price". > > > Is this type of customized table/model mapping possible in Cake? Am I > > better off just sticking with a single "Price" model? Thanks in > > advance for any direction you can provide! > > > -Brian > > Sure, you can still use cakePHP with your current table's structure. > Several things to notice: > > 1. Sometime using abnormal table is good to gain performance, > especially when you have bottleneck in you database. > 2. Looking at your Prices table, you can use one Price Model, though. > But, it sacrifices modularity in your application, you'll end up with > Price Model getting fat as your application grows. > 3. To expect your products tagged with defined category, you can use > Model's callback. And you'll save having find all products that belong > to particular category you have defined. But, this is not a good > practice, you still have to touch Price Model again and again when > feature is added. > > The abnormal table way to gain performance is so old. There are much > better ways than abnormal table when database hit your performance > (e.g., using memcached, static file caching, etc). I'd prefer to > separate category and product Models so you can benefit CakePHP's > Model association. > > -- > regards, > gedex > > blog:http://gedex.web.id Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: Multiple models from un-normalized table
On Sun, Mar 28, 2010 at 12:33 AM, bmcelhany wrote: > Hello, > > I've done some searching and can't quite seem to find what I'm looking > for. I have an existing php app that I've inherited that I'd like to > migrate to CakePHP. The problem I'm running into is that this app is > driven by a single un-normalized table...definitely not a db structure > that works well with Cake out of the box. What I'd like to know is the > best way to approach setting up my models for this type of situation. > Here are some of the fields in the table (named "Prices"): > > id (int), category (varchar), item (varchar), brand (varchar), store > (varchar), price, size, etc ... > > As it stands, I can obviously just use the "Prices" table as is and > have a single "Price" model in my app with all of the above fields. In > a perfect world, however, I'd like to be able to split everything into > several more logical models (i.e. Category, Brand, Store, etc), each > with the appropriate relationships (i.e. Category has many Products) > as well as refer to the main record as "Product" instead of the > default table name/model of "Price". > > Is this type of customized table/model mapping possible in Cake? Am I > better off just sticking with a single "Price" model? Thanks in > advance for any direction you can provide! > > -Brian Sure, you can still use cakePHP with your current table's structure. Several things to notice: 1. Sometime using abnormal table is good to gain performance, especially when you have bottleneck in you database. 2. Looking at your Prices table, you can use one Price Model, though. But, it sacrifices modularity in your application, you'll end up with Price Model getting fat as your application grows. 3. To expect your products tagged with defined category, you can use Model's callback. And you'll save having find all products that belong to particular category you have defined. But, this is not a good practice, you still have to touch Price Model again and again when feature is added. The abnormal table way to gain performance is so old. There are much better ways than abnormal table when database hit your performance (e.g., using memcached, static file caching, etc). I'd prefer to separate category and product Models so you can benefit CakePHP's Model association. -- regards, gedex blog: http://gedex.web.id Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Multiple models from un-normalized table
Hello, I've done some searching and can't quite seem to find what I'm looking for. I have an existing php app that I've inherited that I'd like to migrate to CakePHP. The problem I'm running into is that this app is driven by a single un-normalized table...definitely not a db structure that works well with Cake out of the box. What I'd like to know is the best way to approach setting up my models for this type of situation. Here are some of the fields in the table (named "Prices"): id (int), category (varchar), item (varchar), brand (varchar), store (varchar), price, size, etc ... As it stands, I can obviously just use the "Prices" table as is and have a single "Price" model in my app with all of the above fields. In a perfect world, however, I'd like to be able to split everything into several more logical models (i.e. Category, Brand, Store, etc), each with the appropriate relationships (i.e. Category has many Products) as well as refer to the main record as "Product" instead of the default table name/model of "Price". Is this type of customized table/model mapping possible in Cake? Am I better off just sticking with a single "Price" model? Thanks in advance for any direction you can provide! -Brian Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: Un expected Logout in cakephp session
Hi Bailey , Thanks for replay. Is this the line to comment in core.php ("Configure::write('Session.checkAgent', true);") ?. Also Firefox3 and ie8 have the same issues. Regards, Malu On Sun, Mar 14, 2010 at 1:30 AM, Bailey wrote: > Hi Malu, > > I had exactly the same issue, i kept on loosing the session (which was > causing the logout) every few minutes... i found that this was only > happening in Internet Explorer though and not when using Firefox. Is > this the same case as you? > > I seem to remember by commenting out the check on the browser type (or > something similar.. cant remember exactly but its in the core.php > file) stopped the session being kill as often as it did... maybe that > might work for you? > > Regards, > Bailey > > On Mar 13, 5:43 pm, malu star wrote: > > Hi, > > > > I have used cakephp Auth for Login purpose. But the user is logout > > every 2 minutes. I have set the security level low in config/ > > core.php(ie Configure::write('Security.level', 'low'). But the user is > > logout every 2 minutes. Also i have increased Session.timeout . But > > there is no result. Please help me to solve this issue.Expecting your > > reply soon. > > > > Regards, > > Malu > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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+unsubscr...@googlegroups.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Un expected Logout in cakephp session
Hi Malu, I had exactly the same issue, i kept on loosing the session (which was causing the logout) every few minutes... i found that this was only happening in Internet Explorer though and not when using Firefox. Is this the same case as you? I seem to remember by commenting out the check on the browser type (or something similar.. cant remember exactly but its in the core.php file) stopped the session being kill as often as it did... maybe that might work for you? Regards, Bailey On Mar 13, 5:43 pm, malu star wrote: > Hi, > > I have used cakephp Auth for Login purpose. But the user is logout > every 2 minutes. I have set the security level low in config/ > core.php(ie Configure::write('Security.level', 'low'). But the user is > logout every 2 minutes. Also i have increased Session.timeout . But > there is no result. Please help me to solve this issue.Expecting your > reply soon. > > Regards, > Malu Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Un expected Logout in cakephp session
Hi, I have used cakephp Auth for Login purpose. But the user is logout every 2 minutes. I have set the security level low in config/ core.php(ie Configure::write('Security.level', 'low'). But the user is logout every 2 minutes. Also i have increased Session.timeout . But there is no result. Please help me to solve this issue.Expecting your reply soon. Regards, Malu Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Recherche un composant Date (calendrier)
I don't think most people on this list speak French, so please post in English in the future. As far as I know there is no Date component , but since Cake is a PHP framework you can use the Zend_Date component inside Cake ? 2009/10/6 Bouti > > Bonjour à tous, > > Existe t-il un composant date pour cakephp équivalent au composant > "Zend_Date" du framework Zend Framework. > > Je souhaite aller plus loin avec les calculs sur les dates, par > exemple : > - récupérer tous les 3éme vendredi du mois à partir du 01/10/2009 > jusqu'au 02/05/2010 > - enlever de mon calendrier toutes les séances prévue sur un jour > férié > - inscrire des périodes de congés et si une séance y est inscrite la > reporter > - > j'ai besoin d'un composant qui va pouvoir gérer un calendrier de > séances en prenant en compte les jour fériés et les périodes de > congés. > > merci d'avance > > > > --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Recherche un composant Date (calendrier)
Bonjour à tous, Existe t-il un composant date pour cakephp équivalent au composant "Zend_Date" du framework Zend Framework. Je souhaite aller plus loin avec les calculs sur les dates, par exemple : - récupérer tous les 3éme vendredi du mois à partir du 01/10/2009 jusqu'au 02/05/2010 - enlever de mon calendrier toutes les séances prévue sur un jour férié - inscrire des périodes de congés et si une séance y est inscrite la reporter - j'ai besoin d'un composant qui va pouvoir gérer un calendrier de séances en prenant en compte les jour fériés et les périodes de congés. merci d'avance --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Un-needed Controllers
you might also want to have a look at bindModel http://book.cakephp.org/view/86/Creating-and-Destroying-Associations-on-the-Fly On May 21, 10:27 am, "Dave Maharaj :: WidePixels.com" wrote: > I have 5 or 6 empty controllers. I merged all the admin functions to the > app_controller and these controllers now have no functions inside them. > > For example my bookmarks controller is simply > class BookmarksController extends AppController > { > var $name = 'Bookmarks'; > var $helpers = array('Html', 'Form'); > var $uses = array('Bookmark'); > > function beforeFilter() > { > parent::beforeFilter(); > $this->Auth->autoRedirect = false; > }} > > ?> > > These controllers all have models that are needed but can remove these > controllers from the app? > > Dave --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Un-needed Controllers
I like Grigri's generic controller approach for eliminating empty controllers: http://groups.google.com/group/cake-php/browse_thread/thread/7638b690ae0545ff/1845d3c1c30d3a03?lnk=gst&q=generic+controller#1845d3c1c30d3a03 disclaimer - although it's on my list to implement, I haven't gotten to it yet, so can't tell you if there are any gotchas (sorry), but it seems pretty straightforward. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Un-needed Controllers
No, you can't. If you remove them you will get a controller not found error when you go to your bookmarks pages On a side note, you can remove the $uses line as CakePHP automatically adds the model associated with the controller (unless your AppController explicitly sets $uses = array() ) On May 21, 3:27 pm, "Dave Maharaj :: WidePixels.com" wrote: > I have 5 or 6 empty controllers. I merged all the admin functions to the > app_controller and these controllers now have no functions inside them. > > For example my bookmarks controller is simply > class BookmarksController extends AppController > { > var $name = 'Bookmarks'; > var $helpers = array('Html', 'Form'); > var $uses = array('Bookmark'); > > function beforeFilter() > { > parent::beforeFilter(); > $this->Auth->autoRedirect = false; > }} > > ?> > > These controllers all have models that are needed but can remove these > controllers from the app? > > Dave --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Un-needed Controllers
I have 5 or 6 empty controllers. I merged all the admin functions to the app_controller and these controllers now have no functions inside them. For example my bookmarks controller is simply Auth->autoRedirect = false; } } ?> These controllers all have models that are needed but can remove these controllers from the app? Dave --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Insertar un archivo en la carpeta app del cake
try putting it in your app/webroot folder. garza2002 wrote: > Buenas. > Querria insertar un archivo html independiente del cake en la carpeta > app del cake. El problema es que me da erro como de no conexion con la > base de datos cuando intento acceder a el: por ej: localhost/cake/app/ > prueba.htm. Es como si tuviese que darle permiso desde algun sitio del > cake...como si estuviese capado la opcion de acceder a archivos > independientes de cake. > Sabeis si hay algun sitio q controle esto? > > Un saludo y gracias > > > > > --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Insertar un archivo en la carpeta app del cake
Buenas. Querria insertar un archivo html independiente del cake en la carpeta app del cake. El problema es que me da erro como de no conexion con la base de datos cuando intento acceder a el: por ej: localhost/cake/app/ prueba.htm. Es como si tuviese que darle permiso desde algun sitio del cake...como si estuviese capado la opcion de acceder a archivos independientes de cake. Sabeis si hay algun sitio q controle esto? Un saludo y gracias --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Intégrer un outil dans mon application
maldini3 a écrit : > Salut tout le monde, > > Je suis un nouveau membre de ce groupe :) > > Alors, Je suis un nouveau apprentit de cakephp. Là je dois intégrer un > outil qui permet de gérer un album photo. Il est ecrit en php. Je vous > demande où je dois le placer et qu'il est Url que je dois mettre pour > y accèder. > > Merci pour votre accueil Bonjour et bienvenue. Je n'ai pas de réponse a ta question. Par contre un petit conseil. Pose tes questions en anglais... La ML est en anglais donc tu aura plus de réponses je penses... - Hi and welcome. I have no answer to your question. But a little advise. Ask your questions in english... The ML is in english, then you would probably have more answers... -- Simon COURTOIS {EPITECH.} tek4 | (LINAGORA) Developer | [ADITAM] Project Manager 10, rue Brillat-Savarin 75013 Paris | 01 45 42 72 30 - 06 72 44 67 81 http://www.happynoff.fr --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Intégrer un outil dans mon application
Salut tout le monde, Je suis un nouveau membre de ce groupe :) Alors, Je suis un nouveau apprentit de cakephp. Là je dois intégrer un outil qui permet de gérer un album photo. Il est ecrit en php. Je vous demande où je dois le placer et qu'il est Url que je dois mettre pour y accèder. Merci pour votre accueil. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
retrieving data from un-linked table?
I have a table in my database, simply called level, with 2 fields per row, lvl(primary key, auto_increment), and min_xp. This is for a game that I've been working on, and I was wondering how I would go about accessing this table from my User model, where I would be placing the add_xp and check_level functions. The purpose being that when a user gains exp, it's A)added to their exp field in the associated Profile table, and B)the level table is queried, and if they meet the minimum exp requirement for the next level up, the level field in their profile is also updated The alternative way of doing this would be to query the level table for a certain amount of experience when viewing a user's profile, but I have a feeling that this would cause issues in the long run as the number of users increased.. Does anyone have any ides as to how to do this? -- In the name of Life, Liberty, and the pursuit of my sanity. Siebren Bakker(Aevum Decessus) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Un-escaping sanitized data for display
On Feb 1, 1:52 pm, AD7six <[EMAIL PROTECTED]> wrote: > On Feb 1, 6:51 am, "R.RajeshJebaAnbiah" > > <[EMAIL PROTECTED]> wrote: > > On Jan 31, 5:55 pm, AD7six <[EMAIL PROTECTED]> wrote: > >> Cake automatically escapes data in db queries - you are already > > > protected against sql injection. xss etc is a different matter, and is > > > an example of where sanitize fits in. > > > > > > Having checked your codes in UploadBehavior and impressed with > > your tricks, may I know how do you handle HTML inputs? I know, cake's > > default scaffolding add, edit interfaces handle HTML inputs; but not > > view and index. > > I'm not sure what aspect of accepting html you are asking about. > > How to store it? html in the db > How to avoid malicious content? Sanitize::stripScripts (or other as > appropriate) beforeSave > How to display it? echo $html->clean($stuff) * Many thanks for your input. I was talking about the following situation: 1. Use bake script to create controller, model and views. 2. When creating controller with bake script choose no for scaffolding and choose basic methods (index, add,..) option 3. When creating view with bake script choose scaffolding view option. a. In the generated view page, /foo/add Enter a HTML content, say "alert('cake'); b. Check the entered content with /foo/edit/id Here the HTML content is escaped and so there is no JavaScript alert window. c. Check the entered content with /foo/view/id Here the HTML content is not escaped; so getting alert window. It is/was quite difficult to manage the form handling--need to set validation rule in model, other stuffs in views (like classes, etc). Some cases, the HTML content shouldn't be escaped (when admin posts some HTML) but has to be escaped when users post it. I'm thought of moving validation things to a new behavior code and handling forms and user data with another helper (ref http://groups.google.com/group/cake-php/msg/06deff28435aacb7 ) I was just wondering, how globally you control the user content. I understand that you're taking project based approach--not generalized approach as you've done in your UploadBehavior kit. -- Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Un-escaping sanitized data for display
On Feb 1, 6:51 am, "R. Rajesh Jeba Anbiah" <[EMAIL PROTECTED]> wrote: > On Jan 31, 5:55 pm, AD7six <[EMAIL PROTECTED]> wrote: >> Cake automatically escapes data in db queries - you are already > > protected against sql injection. xss etc is a different matter, and is > > an example of where sanitize fits in. > > > > Having checked your codes in UploadBehavior and impressed with > your tricks, may I know how do you handle HTML inputs? I know, cake's > default scaffolding add, edit interfaces handle HTML inputs; but not > view and index. I'm not sure what aspect of accepting html you are asking about. How to store it? html in the db How to avoid malicious content? Sanitize::stripScripts (or other as appropriate) beforeSave How to display it? echo $html->clean($stuff) * The last 2 should have the same effect: preventing displaying undesired js. The first makes sure it doesn't get into the db in the first place and the second removes it before display even if it does. hth, AD * https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/view/helper.php?rev=6356#L207 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Un-escaping sanitized data for display
On Jan 31, 5:55 pm, AD7six <[EMAIL PROTECTED]> wrote: > Cake automatically escapes data in db queries - you are already > protected against sql injection. xss etc is a different matter, and is > an example of where sanitize fits in. Having checked your codes in UploadBehavior and impressed with your tricks, may I know how do you handle HTML inputs? I know, cake's default scaffolding add, edit interfaces handle HTML inputs; but not view and index. (p.s. I may not access internet till Monday; so if I'm not replying for your follow-up, please don't get offended). -- Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Un-escaping sanitized data for display
On Feb 1, 10:50 am, José Pablo Orozco Marín <[EMAIL PROTECTED]> wrote: > Cake automatically escapes data in db queries - you are already> protected > against sql injection. xss etc is a different matter, and is > > an example of where sanitize fits in. > > Just a few questions: > > 1. If create a search form that is searching for user input, in the > controller do i needt to sanitize the data befor to use findAll? > > 2. Do i have to use the following code before to save, delete or > find?http://bin.cakephp.org/saved/20459 No, cake automatically handles/escapes. But, make sure, your "conditions" params are in array format; otherwise sanitize doesn't apply (AFA*I*K) -- Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Un-escaping sanitized data for display
Cake automatically escapes data in db queries - you are already > protected against sql injection. xss etc is a different matter, and is > an example of where sanitize fits in. > Just a few questions: 1. If create a search form that is searching for user input, in the controller do i needt to sanitize the data befor to use findAll? 2. Do i have to use the following code before to save, delete or find? http://bin.cakephp.org/saved/20459 Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Un-escaping sanitized data for display
On Jan 31, 12:48 pm, senseBOP <[EMAIL PROTECTED]> wrote: > Thanks for your reply. I am actually more interested in a discussion > about the subject, rather than actual code, unless one can provide a > complete "undo" method for the $sanitize->clean() method... :) If you remove something - you can't later un-remove it. Sanitizing is not the same as escaping. > So, you're saying I don't have to sanitize my forms against HTML and > SQL injections because Cake does it for me? Cake automatically escapes data in db queries - you are already protected against sql injection. xss etc is a different matter, and is an example of where sanitize fits in. > That doesn't make any sense. Otherwise, what's the point of the Sanitize > class? Other circumstances. Like removing malicious js, or undesired formatting etc. > Also, if that was in deed the case, wouldn't the Sanitize class also include > an > unclean() method which would have been used automatically by Cake once > data is pulled by a model? Escaping is not the same as sanitizing, so no. Some useful reading: http://www.google.es/search?q=filter+input+escape+output hth, AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Un-escaping sanitized data for display
Thanks for your reply. I am actually more interested in a discussion about the subject, rather than actual code, unless one can provide a complete "undo" method for the $sanitize->clean() method... :) So, you're saying I don't have to sanitize my forms against HTML and SQL injections because Cake does it for me? That doesn't make any sense. Otherwise, what's the point of the Sanitize class? Also, if that was in deed the case, wouldn't the Sanitize class also include an unclean() method which would have been used automatically by Cake once data is pulled by a model? On Jan 31, 7:06 am, brian_gaff <[EMAIL PROTECTED]> wrote: > But, as far as I understand Cake already handles Sanitize::SQL for > you. So you shouldn't need to do that again. That might be why you > think you're getting stuff back in an unreadable format, you're likely > sanitizing twice. > > Brian > > On Jan 30, 9:04 pm, brian_gaff <[EMAIL PROTECTED]> wrote: > > > Maybe something like this: > > > var $swaps = array('\n','\r','\\'); > > > function unSanitize($str) > > { > > foreach($swaps in $item) > > { > > /* search for the item as \n or \r then put it in quotes for php > > to evaluate it and replace it back in */ > > $str = str_replace($item, "{$item}", $str); > > } > > > } > > > Something like that might work. I haven't tested it, but it might get > > you started. > > > Brian > > > On Jan 29, 1:05 am, senseBOP <[EMAIL PROTECTED]> wrote: > > > > Hey guys, hope I'm posting this in the right group and all... > > > > Unless there's another way to go about this, shouldn't the Sanitize > > > class also include a method to un-escape sanitized data back into a > > > readable, user-friendly, format? Otherwise, what's the point of having > > > it sanitized? > > > > I'm no big expert, and there's probably a way for me to un-escape data > > > from the database before displaying it back to the user, but so far, I > > > have failed to find such a way. And to me, it only makes sense that > > > the class that is responsible for re-formatting the data going into > > > the DB will also be responsible to format it back to readable form > > > once it is pulled from the DB. > > > > BWhat's your take on this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Un-escaping sanitized data for display
But, as far as I understand Cake already handles Sanitize::SQL for you. So you shouldn't need to do that again. That might be why you think you're getting stuff back in an unreadable format, you're likely sanitizing twice. Brian On Jan 30, 9:04 pm, brian_gaff <[EMAIL PROTECTED]> wrote: > Maybe something like this: > > var $swaps = array('\n','\r','\\'); > > function unSanitize($str) > { > foreach($swaps in $item) > { > /* search for the item as \n or \r then put it in quotes for php > to evaluate it and replace it back in */ > $str = str_replace($item, "{$item}", $str); > } > > } > > Something like that might work. I haven't tested it, but it might get > you started. > > Brian > > On Jan 29, 1:05 am, senseBOP <[EMAIL PROTECTED]> wrote: > > > Hey guys, hope I'm posting this in the right group and all... > > > Unless there's another way to go about this, shouldn't the Sanitize > > class also include a method to un-escape sanitized data back into a > > readable, user-friendly, format? Otherwise, what's the point of having > > it sanitized? > > > I'm no big expert, and there's probably a way for me to un-escape data > > from the database before displaying it back to the user, but so far, I > > have failed to find such a way. And to me, it only makes sense that > > the class that is responsible for re-formatting the data going into > > the DB will also be responsible to format it back to readable form > > once it is pulled from the DB. > > > BWhat's your take on this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Un-escaping sanitized data for display
Maybe something like this: var $swaps = array('\n','\r','\\'); function unSanitize($str) { foreach($swaps in $item) { /* search for the item as \n or \r then put it in quotes for php to evaluate it and replace it back in */ $str = str_replace($item, "{$item}", $str); } } Something like that might work. I haven't tested it, but it might get you started. Brian On Jan 29, 1:05 am, senseBOP <[EMAIL PROTECTED]> wrote: > Hey guys, hope I'm posting this in the right group and all... > > Unless there's another way to go about this, shouldn't the Sanitize > class also include a method to un-escape sanitized data back into a > readable, user-friendly, format? Otherwise, what's the point of having > it sanitized? > > I'm no big expert, and there's probably a way for me to un-escape data > from the database before displaying it back to the user, but so far, I > have failed to find such a way. And to me, it only makes sense that > the class that is responsible for re-formatting the data going into > the DB will also be responsible to format it back to readable form > once it is pulled from the DB. > > What's your take on this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Un-escaping sanitized data for display
Hey guys, hope I'm posting this in the right group and all... Unless there's another way to go about this, shouldn't the Sanitize class also include a method to un-escape sanitized data back into a readable, user-friendly, format? Otherwise, what's the point of having it sanitized? I'm no big expert, and there's probably a way for me to un-escape data from the database before displaying it back to the user, but so far, I have failed to find such a way. And to me, it only makes sense that the class that is responsible for re-formatting the data going into the DB will also be responsible to format it back to readable form once it is pulled from the DB. What's your take on this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
lo que da de si el ip ungry y un programa sencillo de macros del teclado y mouse
soy leyenda http://groups.google.es/group/el-gallo-de-la-maxima/browse_thread/thread/6e296d002e9a1058?hl=es --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Error al editar un registro
Iam trying to edit a Cliente an i have this in my model 'Cliente': var $name = 'Cliente'; var $hasOne = array('Naturale' => array('className'=> 'Naturale', 'conditions' => '', 'order'=> '', 'dependent'=> true, 'foreignKey' => 'CLI_ID' ) ); when i try to save an insert statement is create and an error of duplicate entry is shown. But i need to edit i do not know why this is happening, i tested it with a simplier model and it works fine, please help!! function edit($id = null) { if (empty($this->data['Cliente'])) { $this->Cliente->id = $id; $this->data = $this->Cliente->read(); } else { $this->data['Naturale']['CLI_ID'] = $this->data['Cliente'] ['ID']; if($this->Cliente->Naturale->save($this->data['Naturale'])) if($this->Cliente->save($this->data['Cliente'])) { $this->flash('El cliente fue modificado.','/Clientes/'); } } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Crearte un Crack o Descargartelo ¿?¿?
Los Cracks se los puede hacer uno mismo ? ( Ahora entiendo en parte al Barça ) Entonces no me extraña que haiga buen futbol, si cualquiera se puede hacer un Ronaldinho, Messi & CIA. Tan mal esta no crackear ?¿? No creo que sea pecado descargar un crack, si ya te has descargado el juego ( programa o lo que sea ) Seguramente esta gente no tiene tiempo para ponerse a crackear... Pero la solucion es bien simple existen bastantes paginas con Seriales y Cracks HTTP://WWW.Continue.To/Telefonica http://www.TelefonicaOnline.TK --~--~-~--~~~---~--~~ Ha recibido este mensaje porque está suscrito a Grupos de Google "Cake PHP" grupo. Si quiere publicar en este grupo, mande un correo electrónico a cake-php@googlegroups.com Para anular la suscripción a este grupo, envíe un mensaje a [EMAIL PROTECTED] Para visualizar más opciones, visite este grupo enhttp://groups.google.com/group/cake-php -~--~~~~--~~--~--~---