Validation!
Hi, I have to validate website whether a website is unique or not. http://www.example.com is unique but http://www.example.com/ is not unique http://example.com is not unique and http://example.com/ is not unique How to do such a validation? Users are allowed http://www.example.com/signup.php or something like this. But main domain should be unique. I did something and it was working in my old site. But i don't know what to do it in cakephp in model. Please help Thanks -- 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 in config routes
its $html->link('linkname', array('controller' => 'yourcontroller', 'action' => 'youraction')); -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/7/30 taqman filler > hi I'm have noob question > I try to create link to login page this > > $html->link('login',array('url'=>array('controller'=>'users','action'=>'login'))) > but output in > 127.0.0.1/cakephp/user_articles/users/login > > how to config it > > thank > taqman > > -- > 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
Problem in config routes
hi I'm have noob question I try to create link to login page this $html->link('login',array('url'=>array('controller'=>'users','action'=>'login'))) but output in 127.0.0.1/cakephp/user_articles/users/login how to config it thank taqman -- 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: Combos Country & Province
I have this in the view: create('Propiedad'); echo $form->input('pais_id', array('options' => $paises)); echo $form->input('provincia_id', array('options' => $provincias)); echo $form->input('ciudad_id', array('size' => '1')); echo $form->input('tipo_id', array('size' => '1')); echo $form->input('zona_id', array('size' => '1')); echo $form->input('ambientes', array('size' => '1')); echo $form->submit('Buscar'); ?> I have this in the controller. function search() { $this->layout = 'default'; // SE OBTIENEN LOS PAISES $pais = new Pais; $paises = $pais->find('list'); $this->set('paises', $paises); // SE OBTIENEN LAS PROVINCIAS $provincia = new Provincia; $provincias = $provincia->find('list'); $this->set('provincias', $provincias); } Can you help me to update the provinces according to country? era -- 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: cakephp 1.3 loading page is slow
I usually use firebug/webinspector to make sure its not a static asset blocking the page loading. If it isn't I profile the page with xdebug and find out where/why its slow. -Mark On Jul 27, 8:51 pm, leafchild wrote: > I notice loading page is extremely slow. > > Those pages are not connected to DB. Just simple static page. > How can I make it faster to load these pages? -- 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: Discussion: How can I protect images to view them only to logged in users?
Take a look at one solution I am using. All the heavy lifting is left to Apache, it's more than 10x faster compared with my previous solution using a controller to pass the file contents, and memory usage also drops to almost nothing. http://dtemes.blogspot.com/2011/05/secure-downloads-with-apache-and.html On 27 jul, 01:04, DigitalDude wrote: > Hey, > > today I was wondering on how to solve a specific task: I have a Cake > app where users can upload images. As most of us know the image folder > in the webroot is public and anyone could view these images, as long > as they know the filename (listing of index is prohibited). > > Another way is to put uploaded files on an image server via ftp and > save the filename to the database. > > The problem I have now is, let's say users terminate their account on > my app and still know a few filenames, they could just type in the > address with the filename and would still see the image! > > I guess the problem is the same when I have an image server... > > So when a file is called abc.jpg, and it was available > athttp://myapp/img/abc.jpg, > also not logged in users could still view this image. > > I'm looking for an idea or a way to protect this image so only logged > in users can view it. It may be ok when other logged in users could > view it when they know the address. But it would be very intersting if > anyone would have a clue if it would be possible to protect them from > a direct access via typing it into a browser as a url... > > Any ideas or hints for this? > > Regards, > > DD -- 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
Associated model select condition
Hello, I have a question about how to use conditions with associated models. I have a model namea A with this associated models model_a => array ( model_b => array( field_1 , field_2), model_c => array( array( model_d => array(field_3,field_4), model_e => array(field_4,field_6) ) ) ); I would like to select all the model_a where their model_e.field_8 == 'Hello Dolly', but it never works as I expect. I use something like: model_a => array ( model_b => array( field_1 , field_2), model_c => array( fields => array(field_3,field_4), model_d => array(field_5,field_6), model_e => array( fields=> array(field_7,field_8), conditions => array('model_e.field_8' => 'Hello Dolly') ) ); -- 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
Invalid fields when loading edit page
My app uses the native Auth component and my User model is doing something I've never seen before. I'm hoping someone here can offer some insight. The app offers a way to register (i.e. create a brand new user) or to be invited. The User::invite() action accepts a unique invite code, uses that to pull the invited user id and redirects to the User::register() method passing along the user_id. The User::register() method in this scenario is essential an edit form. On the face of it everything works great except that when the form displays, all of my inputs are marked as invalid even though I'm simply loading the form. Nothing has been submitted. If I don't populate the $this->data array, no fields are marked. If I do, however, the error messages appear like Christmas lights all over my form. As far as I can tell, there's nothing special about what I'm doing to populate the data array, but maybe I'm just blind to it at this point. In the event that we've been redirected to User::register() with a user id value, the data array gets populated as: # Populate existing data, if any $this->data = $this->User->find( 'first', array( 'contain'=> false, 'conditions' => array( 'User.id' => $user_id ), ) ); That's it. If I remove that, all is well. I've also tried tweaking it so that only those fields that I absolutely need for the form are retrieved, but that makes no difference. Any thoughts would be much appreciated. This has been going on for months and the only way I've found to get around it is to suppress validation all together by emptying the validate array in this scenario -- obviously a non-optimal solution. Thanks. Rob -- 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: Combos Country & Province
I developed and tested the code. I modified the models: array( 'className' => 'Provincia' ) ); var $validate = array( 'nombre' => array('rule' => 'notEmpty') ); } ?> array( 'className' => 'Pais' ) ); var $validate = array( 'nombre' => array('rule' => 'notEmpty') ); function getPais_id($id=null){ $provincia = $this->find('first', array('conditions' => array('id' => $id))); $pais_id=$provincia['Provincia']['pais_id']; return $pais_id; } } ?> Now I need the code of view and controller to have the dependents combos. Can you help with this? Thanks era -- 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: How do I typically migrate a CakePHP app?
There's 'cake upgrade all' utility shell that can assist upgrading your app code -- 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: Strange login problem
The tmp is writable (I tryied it with logs), about sessions... the only I know now is what I can see in the phpinfo function, and It looks correct :s . But, in any case, the sessions dir is empty, I can't find any file except the empty default file of Cake :( . I simplified the code of the login function, because the Auth->autoRedirect property allows me to do it (it still works on my local installation): public function login () { $this->set ('title_for_layout', 'ARE · Gestió de Pràctiques externes'); $this->set ('header_text', 'ARE · Gestió de Pràctiques externes'); if (isset ($this->data) && $this->Auth->login ($this->data) == 0) { $this->set ('cleanLogin', false); } else { $this->set ('cleanLogin', true); } } Thanks fo all! 2011/7/29 Jeremy Burns | Class Outfit > A few ideas. Is your session working correctly? Is your tmp directory and > its subfolders read/write? > > Jeremy Burns > Class Outfit > > http://www.classoutfit.com > > On 29 Jul 2011, at 10:12, CaStarCo wrote: > > Studying my problem, I can explain a part of what happens, but not all, and > not why: > > When I login with correct data, the Auth component does a correct login, I > can read the $this->Auth->user () data, but the next strange step is that my > cake app logout automatically my user :s (in my production server, but not > in my local installation). > > The phpinfo of my production server: > http://www.ub.edu/areintra/apps/info.php > > Anyone knows what happens? > > Thanks in advance. > > 2011/7/28 CaStarCo > >> >> >> 2011/7/28 castarco >> >>> Hello. I'm having strange problems with the login feature... but in a >>> strange way, while it runs on my local installation, it doesn't work >>> in the production server... >>> >>> What I expect of the code: the users fill the login form, click login >>> and then is called the login action of users controller. If the users >>> are logged before, then will be redirected to their dashboard, or... >>> in the special case that the users are not validated (the validation >>> is via email) then will logout automatically (once time, during the >>> register process). If the login data is not correct, then the variable >>> $cleanLogin will set to false, and the view of users login will show >>> an error message. >>> >>> My code works perfectly in my local installation. But in the >>> production server I have a "little problem", when i try to login, my >>> app redirects me another time to the login page (and I'm not logged >>> in), but without any error message (then, I suppose the login is well >>> done, but in some point I'm automatically logged out). The production >>> database is a clone of the local database. >>> >>> The code of the users login function: >>> http://pastebin.com/DuXfez8B >>> >>> Anyone can imagine where is the problem? Thanks in advance! >>> >>> >> It's very strange. I've simplified the code, now I'm using the >> Auth->userScope variable to avoid using my own specific validation in login. >> In any case, even with the simplification, the problem persists in the >> production server, but not in my local installation. >> >> I've logged what occurs and it's very strange! I'll tell us: >> >> This is a part of the login function: >> >> $userinfo = $this->Auth->user (); >> if ($userinfo) { >> $this->log('YA ESTABA LOGUEADO', LOG_DEBUG); >> $this->redirect($this->Auth->redirect()); >> } elseif (isset($this->data)) { >> $this->log('SET DATA!!!...', LOG_DEBUG); >> if ($this->Auth->login($this->data) == 0) { >> $this->log('ME LOGUEE MAL...', LOG_DEBUG); >> $this->set ('cleanLogin', false); >> } else { >> $this->log('ALGO RARO PASO!', LOG_DEBUG); >> } >> } else { >> print_r ($this->params); >> print_r ($this->data); >> $this->log('EN LOGIN (SIN + DATOS)', LOG_DEBUG); >> $this->set ('cleanLogin', true); >> } >> >> the strange thing: when the login is whith incorrect data, then enters in >> the 'elseif' statement, but when the data is correct... enters in the 'else' >> statement! Cake thinks that the $this->data variable is not defined!!! >> Anyone knows why? >> >> Thanks in advance. >> >> -- >> - Per la llibertat del coneixement - >> - Per la llibertat de la ment... - >> > > > > -- > - Per la llibertat del coneixement - > - Per la llibertat de la ment... - > > -- > 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, v
Re: Strange login problem
A few ideas. Is your session working correctly? Is your tmp directory and its subfolders read/write? Jeremy Burns Class Outfit http://www.classoutfit.com On 29 Jul 2011, at 10:12, CaStarCo wrote: > Studying my problem, I can explain a part of what happens, but not all, and > not why: > > When I login with correct data, the Auth component does a correct login, I > can read the $this->Auth->user () data, but the next strange step is that my > cake app logout automatically my user :s (in my production server, but not in > my local installation). > > The phpinfo of my production server: http://www.ub.edu/areintra/apps/info.php > > Anyone knows what happens? > > Thanks in advance. > > 2011/7/28 CaStarCo > > > 2011/7/28 castarco > Hello. I'm having strange problems with the login feature... but in a > strange way, while it runs on my local installation, it doesn't work > in the production server... > > What I expect of the code: the users fill the login form, click login > and then is called the login action of users controller. If the users > are logged before, then will be redirected to their dashboard, or... > in the special case that the users are not validated (the validation > is via email) then will logout automatically (once time, during the > register process). If the login data is not correct, then the variable > $cleanLogin will set to false, and the view of users login will show > an error message. > > My code works perfectly in my local installation. But in the > production server I have a "little problem", when i try to login, my > app redirects me another time to the login page (and I'm not logged > in), but without any error message (then, I suppose the login is well > done, but in some point I'm automatically logged out). The production > database is a clone of the local database. > > The code of the users login function: > http://pastebin.com/DuXfez8B > > Anyone can imagine where is the problem? Thanks in advance! > > > It's very strange. I've simplified the code, now I'm using the > Auth->userScope variable to avoid using my own specific validation in login. > In any case, even with the simplification, the problem persists in the > production server, but not in my local installation. > > I've logged what occurs and it's very strange! I'll tell us: > > This is a part of the login function: > > $userinfo = $this->Auth->user (); > > if ($userinfo) { > $this->log('YA ESTABA LOGUEADO', LOG_DEBUG); > > $this->redirect($this->Auth->redirect()); > } elseif (isset($this->data)) { > $this->log('SET DATA!!!...', LOG_DEBUG); > if ($this->Auth->login($this->data) == 0) { > $this->log('ME LOGUEE MAL...', LOG_DEBUG); > > $this->set ('cleanLogin', false); > } else { > $this->log('ALGO RARO PASO!', LOG_DEBUG); > } > } else { > print_r ($this->params); > print_r ($this->data); > > $this->log('EN LOGIN (SIN + DATOS)', LOG_DEBUG); > $this->set ('cleanLogin', true); > } > > the strange thing: when the login is whith incorrect data, then enters in the > 'elseif' statement, but when the data is correct... enters in the 'else' > statement! Cake thinks that the $this->data variable is not defined!!! Anyone > knows why? > > Thanks in advance. > > -- > - Per la llibertat del coneixement - > - Per la llibertat de la ment... - > > > > -- > - Per la llibertat del coneixement - > - Per la llibertat de la ment... - > > -- > 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: Strange login problem
Studying my problem, I can explain a part of what happens, but not all, and not why: When I login with correct data, the Auth component does a correct login, I can read the $this->Auth->user () data, but the next strange step is that my cake app logout automatically my user :s (in my production server, but not in my local installation). The phpinfo of my production server: http://www.ub.edu/areintra/apps/info.php Anyone knows what happens? Thanks in advance. 2011/7/28 CaStarCo > > > 2011/7/28 castarco > >> Hello. I'm having strange problems with the login feature... but in a >> strange way, while it runs on my local installation, it doesn't work >> in the production server... >> >> What I expect of the code: the users fill the login form, click login >> and then is called the login action of users controller. If the users >> are logged before, then will be redirected to their dashboard, or... >> in the special case that the users are not validated (the validation >> is via email) then will logout automatically (once time, during the >> register process). If the login data is not correct, then the variable >> $cleanLogin will set to false, and the view of users login will show >> an error message. >> >> My code works perfectly in my local installation. But in the >> production server I have a "little problem", when i try to login, my >> app redirects me another time to the login page (and I'm not logged >> in), but without any error message (then, I suppose the login is well >> done, but in some point I'm automatically logged out). The production >> database is a clone of the local database. >> >> The code of the users login function: >> http://pastebin.com/DuXfez8B >> >> Anyone can imagine where is the problem? Thanks in advance! >> >> > It's very strange. I've simplified the code, now I'm using the > Auth->userScope variable to avoid using my own specific validation in login. > In any case, even with the simplification, the problem persists in the > production server, but not in my local installation. > > I've logged what occurs and it's very strange! I'll tell us: > > This is a part of the login function: > > $userinfo = $this->Auth->user (); > if ($userinfo) { > $this->log('YA ESTABA LOGUEADO', LOG_DEBUG); > $this->redirect($this->Auth->redirect()); > } elseif (isset($this->data)) { > $this->log('SET DATA!!!...', LOG_DEBUG); > if ($this->Auth->login($this->data) == 0) { > $this->log('ME LOGUEE MAL...', LOG_DEBUG); > $this->set ('cleanLogin', false); > } else { > $this->log('ALGO RARO PASO!', LOG_DEBUG); > } > } else { > print_r ($this->params); > print_r ($this->data); > $this->log('EN LOGIN (SIN + DATOS)', LOG_DEBUG); > $this->set ('cleanLogin', true); > } > > the strange thing: when the login is whith incorrect data, then enters in > the 'elseif' statement, but when the data is correct... enters in the 'else' > statement! Cake thinks that the $this->data variable is not defined!!! > Anyone knows why? > > Thanks in advance. > > -- > - Per la llibertat del coneixement - > - Per la llibertat de la ment... - > -- - Per la llibertat del coneixement - - Per la llibertat de la ment... - -- 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: How do I typically migrate a CakePHP app?
I'm aware of that. Still my question is, how would I proceed with upgrading? Do I unpack a freshly downloaded 2.0 archive and bring back my app file by file? What are some best practices here? On Jul 29, 8:56 am, Johan wrote: > CakePHP 2.0 is not yet finished. If you migrate now to 2.0 you will probably > have to update your site with each release until they get to the stable > version. > > Cheers, > - Johan > > > > > > > > On Fri, Jul 29, 2011 at 1:37 AM, 24z wrote: > > Dear group, > > > I've just build my first CakePHP app (gpc.fm) and love the framework. > > Being such a newbie, I've got what might be a very basic question: > > What does upgrading, e.g. to 2.0, typically involve besides possible > > code changes in _my_ part of the code? > > > Do I basically just copy the /cake folder from the new distribution > > over my old /cake directory? > > > Any description of the process would be great. I do understand the > > part about possible breaking changes and the fact that I might have to > > revisit my app's code. > > > So my question is really related to the core first step of upgrading. > > What is a best practice to upgrade? Copying new files over the > > existing ones? > > > Or, Starting with the 2.0 cake archive and manually copying over all > > controllers, views etc. from the old project? > > > I'm somewhat lost but do want to move to 2.0 asap. > > > Thanks for taking the time. > > > -- > > Our newest site for the community: CakePHP Video Tutorials > >http://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd 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 > > athttp://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