When to use appcontroller
I'm wanting to make certain variables (counts of various records) to be used on most views in my app. Currently I'm both loading each relevant model and doing the count operation to create the variable I want to pass to my views within the appcontroller as it will then be available to every view. Is this the best way to do it or is there a better way to do it that keeps the code out of the appcontroller. For context, I'm showing user statistics on each page of the users part of the site. Thanks! -- 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.
Grouping Api controllers in a seperate sub directory
Hi, I have an app which requires some Api to expose its services. I am trying to group all the Api related controllers in a directory as explained in the doc here : http://book.cakephp.org/2.0/en/development/configuration.html So : 1- I created a /app/Controller/Api folder and moved the controllers in it. 2- added this code to my bootstrap.php : *App::build(array('Controller' = array( DS . 'app' . DS . 'Controller', DS . 'app' . DS . 'Controller' . DS . 'Api',), ));* When I try to call one of the actions I get an error saying the controller cannot be found : *http://localhost:/X/api/articles.json* returns *{code:404,name:Controller class ArticlesController could not be found.,message:Controller class ArticlesController could not be found.,url:\/\/api\/articles.json}* Anyone can help me figuring out what is missing please? The doc seems so clear... Thanks! -- 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: Grouping Api controllers in a seperate sub directory
Thank you Jeremy, I'll give it a try the way it is explained in the article. But more generally, do you have any idea why this subdirectory structure is not working? I did exactly what is mentioned in the doc. On Wednesday, July 2, 2014 11:10:18 AM UTC+1, Jeremy Burns wrote: It’s simpler than that. Each controller function can act as an API method, so leave the folder structure as it is.You can detect the json extension by using the RequestHandler component and adding Router::setExtensions(array('json')); near the bottom of routes.php. Then you can call /controller/action/variable.json and it’ll be handled as json - et voila you have an api. If you want to reach them using a separate URL (/api/function_name.json) then using admin routing with an ‘api’ route. Then you api methods would have an api prefix (e.g. api_index) and would be reached via /api/controller/action/variable.json. Here’s a good article that explains it much better: http://www.dereuromark.de/2014/01/09/ajax-and-cakephp/. It’s actually about ajax, but the set up and principles are very close. On 2 Jul 2014, at 10:49, Hatem Ben Raïs hatem@gmail.com javascript: wrote: Hi, I have an app which requires some Api to expose its services. I am trying to group all the Api related controllers in a directory as explained in the doc here : http://book.cakephp.org/2.0/en/development/configuration.html So : 1- I created a /app/Controller/Api folder and moved the controllers in it. 2- added this code to my bootstrap.php : *App::build(array('Controller' = array( DS . 'app' . DS . 'Controller', DS . 'app' . DS . 'Controller' . DS . 'Api',), ));* When I try to call one of the actions I get an error saying the controller cannot be found : *http://localhost:/X/api/articles.json http://localhost:/X/api/articles.json* returns *{code:404,name:Controller class ArticlesController could not be found.,message:Controller class ArticlesController could not be found.,url:\/\/api\/articles.json}* Anyone can help me figuring out what is missing please? The doc seems so clear... Thanks! -- 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+u...@googlegroups.com javascript:. To post to this group, send email to cake...@googlegroups.com javascript:. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout. -- 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.
CakePHP Ajax login
I've started using Cakephp for a new project that I'm doing and I've become stuck on how to login using client side technologies. The application will be accessing cake via restful api calls and I'm trying to get the login working using ajax but am unsure of how to write the request. This is my login function in the UsersController: public function login() { if ((AuthComponent::user('id'))) { $this-Session-setFlash(__('Warning: You are already logged in as ' . AuthComponent::user('username'))); } if ($this-request-is('post')) { if ($this-Auth-login()) { return $this-redirect($this-Auth-redirect()); } $this-Session-setFlash(__('Invalid username or password, try again')); } else if ($this-RequestHandler-isAjax()) { $tmpUser['User']['username'] = $this-request-params['username']; $tmpUser['User']['password'] = $this-request-params['password']; if($this-Auth-login($tmpUser)) { $this-Session-setFlash('Login Passed'); } else { $this-Session-setFlash('Login Failed'); } } if ($this-request-is('ajax')) { $this-layout = 'ajax'; if ($this-Auth-login()) { $message = Logged in successfully; $this-set(array( 'message' = $message, '_serialize' = array('message') )); return $this-redirect($this-Auth-redirect()); } $this-Session-setFlash(__('Invalid username or password, try again')); $message = Invalid username or password, try again; $this-set(array( 'message' = $message, '_serialize' = array('message') )); } } Any ideas? -- 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.
Help! Auth Component in Lib directory
Hi all, I'm struggling getting this code working, wondering if anyone had any insights I've written an application that has a lot of web services, It used Zend to create a server and loads classes from my lib folder So my structure is like this: app/Controller/WebServicesController.php app/Lib/WebServices/SomeService.php The controller loads the requested service and passes it as an argument to the Zend SOAP server code. It works fine, except where I need the response from the Auth Component. I want a partner site to be able to validate a username/password as part of a unified login. So if a user tries logging in to site X, that site will call my web service with the username and password and return the result of Auth:identify. This is the relevant code in my SomeService.php file, I've attempted to initialize the Auth Component as I do in the standard login procedure, but it ALWAYS returns false, even if the credentials are correct: function check_credentials($username, $password) { $userObj = new CakeRequest(); $userObj-data['User'] = array('username'=$username, 'password'=$password); $resp = new CakeResponse(); App::import('Component', 'Auth'); $Auth = new AuthComponent(new ComponentCollection()); $Auth::initialize(); $Auth-authenticate = array( 'all' = array('userModel' = 'User'), ); $result = $Auth-identify($userArr,$resp); return $result; } Any help would be greatly appreciated! -- 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/groups/opt_out.
Re: Help! Auth Component in Lib directory
Can't edit my first post, so just be aware that this line: $result = $Auth-identify($userArr,$resp); should be : $result = $Auth-identify($userObj,$resp); And I'm using Cake 2.4.4 -- 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/groups/opt_out.
FormHelper minimized Boolean attributes being dicarded
Morning all, CakePHP 2.4.1 seems to drop boolean html attributes in some cases and not others. If I use $this-Form-create(Recipe, array('data-attribute'='')); Then Cakephp (2.4.1) will correctly output form action='..' data-attribute If I try the same on an input, for example: $this-Form-input('name', array('type'='text', 'data-param'='')); Then in this case the input will be created without the data-param attribute. Is this expected behaviour? I have been through the book and API and can't find any mention of creating boolean attributes (i.e. no value), maybe I'm trying to create them the wrong way? Regards -- 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/groups/opt_out.
Authorization throwing a notFound exception
I have created a custom authorize component as per the book (I have some very complex permissions that are pulled from existing data sources). Everything works as planned, however whenever the component returns false (access not allowed), I get the following output: You are not authorized to access that location. *Error: *The requested address *'/xxx/yyy'* was not found on this server. I'm not throwing a NotFoundException anywhere. Is this expected? Is there something I can do to suppress the Not found message? Regards -- 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/groups/opt_out.
Re: CakePHP 2.4.0-RC2 released
Thanks Simon, I did indeed give it a go and it all went fine (apart from DebugKit moaning, but I found the relevant fixes on Github). I found the 2.4 migration guide also, but simple people like me need DO THIS instructions =] -- 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/groups/opt_out.
Re: Blowfish password hashing in 2.4.0-RC2 issues
Okay, I've finally managed to resolve the issue - but I'm not sure *why* it resolves the issue. I'd appreciate any input. Here's what I did: Note: my users table is named customer_users (with a habtm relationship with customer_orgs associated by 'customer_orgs_customer_users') In app/Model/User.php I have I debugged the post data and saw that in $this-request-data, my login fields were under the key -- 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/groups/opt_out.
Re: Blowfish password hashing in 2.4.0-RC2 issues
Okay, I've finally managed to resolve this, it was a basic mistake. Here's what I did: I debugged the post data and saw that in $this-request-data, my login fields were under the key 'customer_users' (which is the name of my users table) Array ( [customer_users] = Array ( [username] = u...@domain.com [password] = abcdefg1234567 ) ) I had assumed that so long as there was a username and password field in my POST data, the login would work. In my login.ctp, I have the following code to generate my login form: echo $this-Form-create(), $this-Form-input('username'), $this-Form-password('password'), $this-Form-end(Log In); I changed it to the following: echo $this-Form-create('User'), $this-Form-input('username'), $this-Form-password('password'), $this-Form-end(Log In); .. and the logins now work. I didn't see any error specifying that the Auth component couldn't see any credentials in the post - it'd have saved me a lot of time. My users table has a habtm relationship with customer_orgs, is there a way to have the Auth component return data from linked tables? -- 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/groups/opt_out.
Re: Blowfish password hashing in 2.4.0-RC2 issues
In response to my own question, setting recursive to 1 in the AppController Auth definition allowed me to pull in associated customer_orgs rows in the Auth-login() call. -- 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/groups/opt_out.
Blowfish password hashing in 2.4.0-RC2 issues
Hi all, I'm new here and in the process of building my first CakePHP app, using a recently upgraded 2.3.5 2.4.0-RC2. I've managed to get the new BlowfishPasswordHasher working with my User model beforeSave() function, and can verify in the database that users are created with a blowfish hash in the password field. My issue is that the User model's login function is failing when trying to log in with the correct credentials. Here is my $components variable from AppController: public $components = array( 'Session', 'Security', 'Cookie', 'DebugKit.Toolbar', 'Auth' = array( 'loginAction' = array( 'controller' = 'users', 'action' = 'login' ), 'authError' = 'You must be logged in to view this page', 'loginError' = 'Invalid username/password combination', 'authenticate' = array( 'Form' = array( 'userModel' = 'User', 'passwordHasher' = 'Blowfish', ), ), 'loginRedirect' = array('controller' = 'DevelopmentPages', 'action' = 'index'), 'logoutRedirect' = array('controller' = 'users', 'action' = 'login'), ), ); This is my beforeSave from the User model: public function beforeSave($options = array()) { if(isset($this-data[$this-alias]['password'])) { $passwordHasher = new BlowfishPasswordHasher(); $this-data[$this-alias]['password'] = $passwordHasher-hash($this-data[$this-alias]['password']); } return true; } Is there something obvious that I am missing? Any pointers appreciated :) -- 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/groups/opt_out.
Re: CakePHP 2.4.0-RC2 released
Hi Mark, If I were to update my (in development, non-live 2.3.5) to 2.4.0-RC2, is it just a case of replacing the lib folder with the one from the new package, or are there some deeper changes that require more file modifications/console scripts? I'm particularly keen to use the new passwordHasher functionality in the Auth component. Regards, Ben -- 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/groups/opt_out.
Re: The request has been black-holed
Hi, I didn't say the security component was on by default, I said the black hole thing happens by default. So if you have the security thingy turned on, it starts throwing that blackhole thing all over the place. The irony is if you google the black hole issue its packed full of results from pissed off people who are simply told to turn it off with that cfrs setting. Hence, turn it off by default. I installed a 2.3 fresh and put my 1.3 app into it, and it was throwing teh security blackhole left right and centre while as on 1.3 it wasn't. so I'm inclined to think that it is on by default. On Tuesday, April 2, 2013 4:58:42 PM UTC+1, rchavik wrote: On Tuesday, April 2, 2013 9:41:59 PM UTC+7, b...@articad.cc wrote: To save people form themselves? To save the world? I really don't care. Bottom line: That blackholed request thing is a usability nightmare. You merely have to reload the page Okay, That came out wrong. My question would be better phrased as: What makes you think that CakePHP turns on SecurityComponent by default? CakePHP does not turn on Security component by default. AFAIK, the core will _not_ enable SecurityComponent until explicitly asked to. Further, baked applications do not have have them by default. On Monday, April 1, 2013 6:41:44 AM UTC+1, rchavik wrote: On Thursday, March 28, 2013 4:57:38 PM UTC+7, b...@articad.cc wrote: Security features like this that cause issues with basic flow, should be OFF by default. CakePHP is it's own worst enemy for leaving it in. Why do you think CakePHP turns SecurityComponent on by default? -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: The request has been black-holed
To save people form themselves? To save the world? I really don't care. Bottom line: That blackholed request thing is a usability nightmare. You merely have to reload the page On Monday, April 1, 2013 6:41:44 AM UTC+1, rchavik wrote: On Thursday, March 28, 2013 4:57:38 PM UTC+7, b...@articad.cc wrote: Security features like this that cause issues with basic flow, should be OFF by default. CakePHP is it's own worst enemy for leaving it in. Why do you think CakePHP turns SecurityComponent on by default? -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: The request has been black-holed
True, but should it be behaving so badly on installation. Noone really knows what black holed means, it sounds a lot worse than it actually is. Its confusing and somewhat terrifying for it to appear off the bat after a fresh install. csrfUseOnce should be false by default. That's all I'm saying. On Tuesday, April 2, 2013 3:58:37 PM UTC+1, Jeremy Burns wrote: When setting up the Security component there are settings that can help (although I am not entirely certain what risks - if any - these introduce): 'Security' = array( 'csrfUseOnce' = false, 'unlockedActions' = array( 'your_action' ) ) Setting csrfUseOnce to false means it will reuse the existing tokens, which in turn means you can refresh the page without a black hole. The unlockedActions setting is clearly more risky as it effectively disables the component for that action - but in some cases it can be useful. Jeremy Burns Class Outfit http://www.classoutfit.com On 2 Apr 2013, at 15:41:59, b...@articad.cc javascript: wrote: To save people form themselves? To save the world? I really don't care. Bottom line: That blackholed request thing is a usability nightmare. You merely have to reload the page On Monday, April 1, 2013 6:41:44 AM UTC+1, rchavik wrote: On Thursday, March 28, 2013 4:57:38 PM UTC+7, b...@articad.cc wrote: Security features like this that cause issues with basic flow, should be OFF by default. CakePHP is it's own worst enemy for leaving it in. Why do you think CakePHP turns SecurityComponent on by default? -- 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+u...@googlegroups.com javascript:. To post to this group, send email to cake...@googlegroups.comjavascript: . Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: The request has been black-holed
So you didn't turn it off? So when people are browsing the site they are constantly hassled with you have been blackholed?? On Tuesday, April 2, 2013 4:12:49 PM UTC+1, Jeremy Burns wrote: I disagree, I'm afraid. The Security component is there to save your 4r53; so by default it is tight - you have to loosen it if you want to. If it were the other way around you'd deploy it thinking you were safe and then find out you weren't (and would shout louder). I too had a learning curve with the Security component but in the end it does what it say it will on the tin. The guide is also useful if you take the tine to read it. Jeremy Burns Class Outfit http://www.classoutfit.com On 2 Apr 2013, at 16:06:35, b...@articad.cc javascript: wrote: True, but should it be behaving so badly on installation. Noone really knows what black holed means, it sounds a lot worse than it actually is. Its confusing and somewhat terrifying for it to appear off the bat after a fresh install. csrfUseOnce should be false by default. That's all I'm saying. On Tuesday, April 2, 2013 3:58:37 PM UTC+1, Jeremy Burns wrote: When setting up the Security component there are settings that can help (although I am not entirely certain what risks - if any - these introduce): 'Security' = array( 'csrfUseOnce' = false, 'unlockedActions' = array( 'your_action' ) ) Setting csrfUseOnce to false means it will reuse the existing tokens, which in turn means you can refresh the page without a black hole. The unlockedActions setting is clearly more risky as it effectively disables the component for that action - but in some cases it can be useful. Jeremy Burns Class Outfit http://www.classoutfit.com On 2 Apr 2013, at 15:41:59, b...@articad.cc wrote: To save people form themselves? To save the world? I really don't care. Bottom line: That blackholed request thing is a usability nightmare. You merely have to reload the page On Monday, April 1, 2013 6:41:44 AM UTC+1, rchavik wrote: On Thursday, March 28, 2013 4:57:38 PM UTC+7, b...@articad.cc wrote: Security features like this that cause issues with basic flow, should be OFF by default. CakePHP is it's own worst enemy for leaving it in. Why do you think CakePHP turns SecurityComponent on by default? -- 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+u...@googlegroups.com. To post to this group, send email to cake...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- 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+u...@googlegroups.com javascript:. To post to this group, send email to cake...@googlegroups.comjavascript: . Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: The request has been black-holed
Security features like this that cause issues with basic flow, should be OFF by default. CakePHP is it's own worst enemy for leaving it in. The way a framework should work is that it gets you up and gong quickly, we should not be expected to have read one line on one of the many pages in it's documentation in order ot get a half reasonable functionality. This read the docs comment is all very well, but if you have to sift through security (thats assuming you know that it is a security issue and what blackhole means), then it's annoying. On Friday, July 20, 2012 4:10:53 PM UTC+1, Steve Found wrote: Have a go at reading the Security component documentation before insulting the framework ;) http://api.cakephp.org/class/security-component#method-SecurityComponentblackHole This was actually the FIRST link from the google search 'cakephp security component black hole' On 14/06/12 14:56, jmail wrote: anyone? � That drives me crazy. Completly clean application with one form doing me that thing. How can I live? I am so mad that I am thinking about throwing away that CaShitPHP forever � � W dniu czwartek, 14 czerwca 2012 15:20:49 UTC+2 u�ytkownik jmail napisa�: Hi all! � I've got a stupid problem :/ � I am building small chat. I need that for my customer - it's not importand � I've got: � AppController: � ?php App::uses('Controller', 'Controller'); class AppController extends Controller { �var $uses = array('Config', 'Chat', 'User'); �var $helpers = array('Form', 'Html', 'Session'); �var $components = array('Session', 'RequestHandler'); �var $nonLoginActions = array( ��'chat' = array('login') �); �public function beforeFilter() { ������� parent::beforeFilter(); ��$this-getConfig(); ��$this-checkSession(); �} � �function getConfig(){ ��$config = $this-Config-find('all'); ��foreach($config as $element){ ���Configure::write('config.'.$element['Config']['name'], $element['Config']['value']); ��} �} � �function checkSession(){ ��if(isset($this-nonLoginActions[$this-request-params[controller]])){ ���if(!in_array($this-request-params[action], $this-nonLoginActions[$this-request-params[controller]])){ ����if(CakeSession::read(user) === null || CakeSession::read(user) === false){ �����$this-redirect(array('controller' = 'chat', 'action' = 'login')); ����} ���} ��} �} � } � � Controller - ChatController � ?php /* �* To change this template, choose Tools | Templates �* and open the template in the editor. �*/ /** �* Description of ChatController �* �* @author jmail �*/ class ChatController extends AppController{ �var $components = array('Session', 'RequestHandler', 'Security'); � �function login(){ �� �} � } � View - login.ctp � Logowanie ?php echo $this-Form-create('User', array('inputDefaults' = array('label' = false,'div' = false)));? ?php echo $this-Form-input('login', array('type' = 'text', 'label' = 'Login'));? ?php echo $this-Form-input('pass', array('type' = 'password', 'label' = 'Has�o'));? ?php echo $this-Form-end(array('value' = 'Zaloguj si�', 'label' = 'Zaloguj si�',� 'div' = false));? � Layout�- default.ctp � !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head �meta http-equiv=Content-Type content=text/html; / �?php ��echo $this-Html-css('cake.generic'); �? /head body �div id=container ��div id=header ���h1MiniChat/h1 ��/div ��div id=content ���?php echo $this-fetch('content'); ? ��/div �/div /body /html � And my problem is: � When i go to the http://site/chat/login and press submit button I get � The request has been black-holed *Error: * The requested address *'/chat/login'* was not found on this server. � Everything is empty. What the hell I am doing wrong? cakephp-cakephp-2.1.3-28-g645e981 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. � � To unsubscribe from this group, send email to cake-php+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/cake-php -- 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
Re: Email Component, cc and bcc not working?
Hi, A long time has passed, but can you show me more code? I cant get this working. Ben On Wednesday, May 13, 2009 2:37:31 PM UTC+10, Louie Miranda wrote: It worked! thanks a lot. $ccArray = array('lmir...@example.com javascript:', 'us...@example.comjavascript: '); -- Louie Miranda (lmir...@gmail.com javascript:) http://www.louiemiranda.net Quality Web Hosting - www.axishift.com Pinoy Web Hosting, Web Hosting Philippines On Wed, May 13, 2009 at 12:17 PM, Graham Weldon gra...@grahamweldon.comjavascript: wrote: Hi Louie, I believe the cc and bcc variables need to be arrays. Try wrapping them in an array and see how that goes for you. Cheers, Graham Weldon http://grahamweldon.com Louie Miranda wrote: Hi, I have setup the email component properly on cakephp. I can send and it's ok for both html and text. I tried adding the cc and bcc option, however. It seems to be not working. http://api.cakephp.org/class/email-component $this-Email-to = 'us...@example.com javascript:, lmir...@example.comjavascript: '; $this-Email-cc = 'us...@example.com javascript:'; $this-Email-bcc = 'bcc...@example.com javascript:'; I am using CakePHP... cat VERSION.txt /// // +---+ // // + $Id: VERSION.txt 7962 2008-12-25 23:30:33Z gwoo $ // + Last Modified: $Date: 2008-12-25 17:30:33 -0600 (Thu, 25 Dec 2008) $ // + Modified By: $LastChangedBy: gwoo $ // +---+ // /// *1.2.0.7962* any ideas? -- Louie Miranda (lmir...@gmail.com javascript:) http://www.louiemiranda.net Quality Web Hosting - www.axishift.com Pinoy Web Hosting, Web Hosting Philippines -- 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: Parse error: syntax error, unexpected T_ELSE error?
I know this is a long time ago but this is a personal project to learn CakePHP. However after an extremely stressful tenure at my last job I am now back to it. I just wanted to say thank you to all of you for your comments and solutions. It open minded, generous people who respond to ignorant queries like mine that keep people learning and trying... ...unlike my last manager! May he rot in hell. So from all of the newbs thanks to the gurus... cheers ben. -- 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
Cakephp 2.0 Missing Database Connection Solved
This took me hours to figure out. When I started a new CakePHP 2.0 app. I couldn't connect to the mysql database. I finally figured out you have to enable the php_pdo_extension in php.ini. This was posted no where in the new cakephp 2.0 book. I hope this helps other people aswell. Here is a reference link: http://stackoverflow.com/questions/6212290/cake-is-not-able-to-connect-to-the-database -- 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: Is cakephp 2 beta ready for small web development?
I agree with the above opinions about 2.0--I haven't run into any showstoppers when using it for my own personal projects, and I sigh every time I have to go back to work on one of my clients' 1.x projects now :) If you use a lot of plugins, however, note that most of them are still only for CakePHP 1.x and require sometimes substantial work to make them compatible with 2.0. Ben -- 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: third level domain and cakephp
Cpanel makes it slightly difficult to change the document root last time I checked--it's almost always set to /public_html You can sometimes symlink app/webroot to /public_html and all might work fine. Otherwise you can rename 'webroot' to 'public_html' and replace your old public_html directory with it. If you change the location of the 'webroot' folder, you'll have to edit index.php and test.php within it to point to the app and cake folders properly. Check this page for tips about where you can/should put the CakePHP folders, and what to change if you want to move them: http://book.cakephp.org/view/915/Advanced-Installation -- 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: Scalable CakePHP Architecture
Certainly a valid approach, but why do you need the overhead of multiple applications when you could simply have one application with several plugins? The plugin concept also allows you to run it in as many different apps as you'd like, but doesn't require that they remain as separate applications if you no longer want the overhead of managing several apps at once. I can't figure out a single downside, if truth be told, to splitting it out into plugins, even if you do plan to run every plugin in a separate application, heh. Ben -- 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: Scalable CakePHP Architecture
I don't know, whether spread out over several installations or in one (or several) installations utilizing plugins, the various components are going to need to talk to each other and share data anyway... Developing in separate applications is the ultimate in separation of code, I suppose, but I still don't see any benefit--you're going to need to do extra work to get those applications communicating with each other without really any benefit from developing them separately as plugins and combining them to work together later. Wanting separation of the code for development purposes was mostly what I gathered from the original post, and developing with separate plugins doesn't do any worse a job at that than developing it with separate applications. The obvious benefit with plugins, of course, is that down the road you can change up which applications your plugins are in. Maybe you initially put all of the plugins in your main installation, and eventually you find that there's just too much going in there--no problem! It would be as simple as moving a plugin directory to a new app and you've got that same functionality elsewhere. You can't quite get that level of flexibility without utilizing Cake's wonderful Plugin architecture, which are themselves much like a self-contained applications, but with a lot of flexibility and reusability. Ben -- 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: third level domain and cakephp
First, your line: RewriteCond %{REQUEST_URI} !img/ That should be: RewriteCond %{REQUEST_URI} !^/img/ (in other words, don't forget the opening ^ and first forward slash to make it match properly) I'm going to run some tests on it on my server to see if I can figure out a pattern that works properly. I have a hunch that we should be putting these rules in app/webroot/.htaccess instead, but I'll let you know that as well ASAP :) Ben -- 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: third level domain and cakephp
Question for you: Is your entire CakePHP application inside your web root, or just the app/webroot folder? Ideally your webroot should be pointing to CakePHP's app/webroot folder If that is the case, then the main .htaccess file wouldn't even get called because the .htaccess file from app/webroot/.htaccess is the real one--the others just forward requests to the webroot. I'm still testing a proper solution for you, however, and will post it ASAP. Ben -- 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: Creating AuthComponent in 2.0-beta
Brilliant, thanks for the tips, Perry! I have been trying to wrap my mind around how to make SAML authentication work through the Auth component, but just like I figured, I was thinking too hard about it when it turns out it's probably already set up just about properly :) I've already got an SamlAuth component, which is basically a wrapper for SimpleSAML_Auth_Simple, so I'll just call $this-SamlAuth-login(array('ReturnURL' = $this-referer())) from my login function and everything should be good to go, it sounds like (once I implement ACL, at least). Thanks again, that saves me a lot of work! Ben -- 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: third level domain and cakephp
I think I finally have a solution for you. It works for me, but I have my webroot set to app/webroot/ so if you don't I'm not positive if it will work or not. Put this block right before the existing CakePHP rewrite rules in your app/webroot/.htaccess file IfModule mod_rewrite.c RewriteCond %{HTTP_HOST} =img.corsilezioni.com RewriteCond %{PATH_INFO} !^/img/.* RewriteRule ^(.*)$ index.php/img/$1 [QSA,L] /IfModule You'll need a block just like that for every subdomain you want to support. All it does is redirect anything after the subdomain (as long as it doens't already start with /img/) to the ImgController. The first RewriteCond makes the rule only active if we are on the right subdomain The second RewriteCond makes the rule only active if we don't already have /img/ in the path The RewriteRule mimics the default CakePHP rewrite rule, but changes the path sent to index.php to include /img/ For example: http://img.corsilezioni.com/some_action should return the same page as: http://corselezioni.com/img/some_action For example, here are the relevant lines from my app/webroot/.htaccess file that I was using for testing purposes: IfModule mod_rewrite.c RewriteCond %{HTTP_HOST} =test2.mydomain.com RewriteCond %{PATH_INFO} !^/tests/.* RewriteRule ^(.*)$ index.php/tests/$1 [QSA,L] /IfModule # Direct all URLs that don't actually exist to CakePHP IfModule mod_rewrite.c RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,L] /IfModule The first block is the new rules I added, the second are my default CakePHP rewrite rules. With the above, I was able to visit: http://test2.mydomain.com/ and I was served the page from http://test2.mydomain.com/tests/ (the index page of the tests controller). Will something like that work for you? Thanks, Ben -- 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
CakePHP 2.0 - PHP files within plugin's webroot directory
I've tried in the past, and the best I can get is an output of the PHP code on the page (yikes!) I assume this is because CakePHP is only designed to serve static assets from alternate webroots (since Apache doesn't know about them and can't display static assets from them). Would it be possible to tell Cake to pass *.php files to the PHP executable so that it can display the output, or wouldn't that work anyway? My plugin uses a Vendor directory containing a library which has its own webroot. I figured I'd just copy that webroot into the plugin's 'webroot' folder, but obviously that doesn't work--I had to copy the directory to my app's webroot directory, which sort of defeats the purpose of using a plugin to add the functionality. Any other ways to serve a third-party library's PHP files from within a plugin somewhere under the webroot? Thanks, Ben -- 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: Scalable CakePHP Architecture
I would agree that splitting the code into plugins would make the most sense as far as extensibility goes--each developer you outsource to gets the code for the plugin(s) they are working on, and they shouldn't need anything else. For scalability regarding the number of users you can support and server performance, Varnish can help a lot in cases such as this (Steam, Twitter, Facebook, LinedIn and others all use Varnish). You can run Varnish on all your web servers, and they'll cache and serve the actual content from your main web server as if it were static content from wherever you're running Varnish... with all the speed and performance benefits of serving static content. You don't *have* to touch your CakePHP code to get Varnish working, it's completely non-intrusive--although by default it won't cache any page having a cookie or session in it. However, you *can* modify your CakePHP code to take advantage of some of Varnish's more powerful caching features to reportedly increase your website performance by orders of magnitude. Anyway, I just wanted to expand on the previous poster who mentioned Varnish--in my experience it has been a powerful tool for websites which have a lot of traffic. Thanks, Ben -- 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
CakePHP 2 - HABTM saving issue
I have a 'users' table, an 'auth_sources' table, and an 'auth_sources_users' table to join them. I added an extra field, 'unique_value' to the auth_sources_users table which stores a unique value to identify that user against the chosen auth source. In my User model, I have this: var $hasMany = array( 'AuthSourcesUser' ); In my AuthSource model I have this: public $hasMany = array( 'AuthSourcesUser' ); In my AuthSourcesUser model I have this: public $belongsTo = array( 'AuthSource' = array( 'className' = 'AuthSource', 'foreignKey' = 'auth_source_id', 'conditions' = '', 'fields' = '', 'order' = '' ), 'User' = array( 'className' = 'User', 'foreignKey' = 'user_id', 'conditions' = '', 'fields' = '', 'order' = '' ) ); But Cake isn't treating this anything like a HABTM relationship... I have a normal HABTM relationship relating users and roles, (without a join model manually being created) and that one works fine. In my /users/add form, I create hidden fields populated with the data for AuthSourcesUser, and after the form submits I manually add the Role id (for security). Here's what the array looks like which gets submitted: Array ( [User] = Array ( [email] = (my email here) [first_name] = Ben [last_name] = McClure ) [AuthSourcesUser] = Array ( [auth_source_id] = 1 [unique_value] = (my unique value here) ) [Role] = Array ( [id] = 2 ) ) When I use saveAll($this-request-data) I get something weird, though: The User record is created properly, the RolesUser record gets created properly, but the AuthSourcesUser record does not. I get two records created in the auth_sources_users table, both having auth_source_id, user_id, and unique_value all empty. Then, when I delete the User record, the associated record is deleted from roles_users, but neither record is deleted from auth_sources_users. What am I doing wrong? Thanks, Ben -- 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 2 - HABTM saving issue
Well, I realized as soon as I posted that the reason the auth_sources_users records aren't getting deleted is that their user_id fields are blank... so I don't know if there's going to be a problem deleting the records or not... But what am I doing wrong when saving the data using the manually-created join table? Thanks, Ben -- 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 2 - HABTM saving issue
Ok, I'm getting a little closer. Some digging in more documentation brought me to this array to use instead: Array ( [User] = Array ( [email] = (my email here) [first_name] = Ben [last_name] = McClure ) [AuthSource] = Array ( [id] = 1 ) [AuthSourcesUser] = Array ( [unique_value] = (my unique value here) ) [Role] = Array ( [id] = 2 ) ) Not sure if that's right, but it at least only creates one new row on the auth_sources_users table. The problem is that the auth_source_id, user_id, and unique_value are all unset. Not sure if this is better or worse, but neither result is what I'd expect. Ben -- 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 come this isn't a safe way to store username and passwords
Good point! While it's true that something like Zend Encoder / Zend Guard can encrypt PHP code, it's also far from a perfect solution for individuals or anyone running on shared hosting, because usually server changes are required to make it work (and sometimes not free ones). It's true that it *is* an excellent way to protect PHP scripts, however! Per the CodeEclipse page I linked to yesterday: Some products out there (like Zend Encoder) actually encrypt your code. This is good and bad. It's good because your code is further protected against theft. It's bad because encrypted code requires special modules to run, and, while those modules are usually free they are not installed on the majority of servers, which means administrator intervention will be required to get it running. If you have the means, code encryption could potentially be an excellent way to go. Thanks, Ben -- 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: Creating AuthComponent in 2.0-beta
Thanks, Mark! So what would best practice be if trying to utilize off-site authentication along with Cake's access control? I'm trying to build all Saml functionality into a plugin so that I can utilize it in my other applications, so while I'm still not sure what the best method is, I'm thinking perhaps: - If a page requires authentication, AuthComponent seems to send them to my /users/login function, so based on that: - /users/login uses my CakeSaml plugin's SamlAuth component to initiate SAML login (and redirect the user to the identity provider), as well as passes a ReturnURL for the user to return to - User authenticates and returns to the ReturnURL (somewhere in a controller within my plugin) - Plugin controller calls $this-Auth-login(), providing the user record returned from the identity provider - AuthComponent will call my SimpleSamlAuthenticate module's authenticate() method which will verify that the user record in the session is valid and either return the record, or false if it is invalid. Is that a decent flow for such a login procedure, or am I overlooking something? I'm unfortunately fairly new to CakePHP's AuthComponent--in the past it didn't allow me to do what I needed for some of my sites, so I never ended up using it for *any* of my sites. With the changes in 2.0, however, I think that it just might be able to do everything I need, thanks to its extensibility. Anyway, thanks again! I'm loving working in CakePHP 2.0 beta so far! Ben McClure -- 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: third level domain and cakephp
Something like this might work for you, if you replace the lines you posted with this slightly longer version: RewriteCond %{REMOTE_HOST} = test.domain.com RewriteRule ^$ app/webroot/test/ [L] RewriteCond %{REMOTE_HOST} = test.domain.com RewriteRule (.*) app/webroot/test/$1 [L] RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] There might be a way to do it with less rewrite conditions, and this is untested, but I don't see why it wouldn't work... You could also duplicate the first two blocks of code and change the REMOTE_HOST value to support any other subdomains you need to work like this. The important thing is that those rules are BEFORE the normal CakePHP rewrite rules, and that they have the [L] at the end, or they won't work properly. Thanks, Ben -- 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: Creating AuthComponent in 2.0-beta
Perry, I don't know if I fully understand your reply, but it sounds like you might be onto something. I have already set the session name in both SimpleSAMLphp and CakePHP to be the same, and in my custom code in SimpleSAMLphp, I am already pulling the user record from the database with PDO:MySQL and putting the array in the 'Auth.User' attribute within the session. So you're saying I wouldn't even need to create a custom authentication module for AuthComponent to make it work properly in this scenario? ReturnURL is a setting you can provide to SimpleSAML_Auth_Simple::login() which defines where you will be redirected back to after the login completes. Normally that return URL would be the page the user was trying to view in the first place, but it seems like I need to have some step in-between there to let AuthComponent know that an authentication has just occurred. Or does AuthComponent not care if an authentication has occurred as long as there is a valid user record in the session under Auth.User? I'm slightly confused, but it sounds like maybe it's easier than I'm making it out to be. Thanks a lot for the response! Ben -- 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: Creating AuthComponent in 2.0-beta
After re-reading, I think I understand a little bit better: So my login method on the site should redirect to SimpleSAML for authentication, specifying whatever page the user was trying to access that required authentication ($this-referer() I suppose) as the ReturnURL, then in my AppController's beforeFilter I set AuthComponent's loginAction to false which should skip directly to checking the user record in the session for authorization to the current page? Correct me if that's not what you meant, however. Thanks! Ben -- 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: third level domain and cakephp
I should have thought a little bit harder before writing that... don't try to make my previously posted .htaccess code work, those paths aren't valid. This might work a little bit better instead, but I still haven't had a chance to actually test it: RewriteCond %{REMOTE_HOST} = test.domain.com RewriteCond %{SCRIPT_URL} !^/test/ RewriteRule (.*) /test/$1 [L] RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] As long as I'm not making another bone-headed mistake, the above should add /test/ to the URL if you are on the test.domain.com subdomain and if /test/ is not already in the URL... I'm not sure what other side effects this might introduce, however any URL not on the test subdomain should not be affected by the new rules at all. Ben -- 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 come this isn't a safe way to store username and passwords
Jens, You are absolutely correct; I was only referring to the fact that via FTP, one cannot directly run mysql commands like they could via shell, however someone who breaks in via FTP *could* potentially create a script which queries MySQL and outputs the data or something similar, and then call that script from the website by URL. All the more reason that the data stored, even in the database, should be secured somehow. What it all boils down to is that a website unfortunately needs to know how to access certain sensitive information, which usually means storing credentials in a location where the web server can read them. If you are concerned about the security of the data (probably a wise concern, depending on the data), steps should be taken to make it as difficult as possible for anyone but your website code to decrypt and read the data. Someone else may have better ideas, but the most common factors I have found recommended when securing API keys (or any other sensitive data, really) are: 1. Don't store the data on the web server. If you have the ability to use a 3-tiered structure (web server, application server, database server) then the problem becomes more simple because the database server does not have direct access to the web server, and compromising the web server does not compromise the security of the application server. For most webapps, onle one or two servers are used, however, so this becomes more difficult. At a minimum, store the key in the database. 2. Encrypt the data in the database. If someone breaks into your database, don't give them the opportunity to simply view your API keys in plain text. 3. Protect the related application code which decrypts and uses your unencrypted API key. Obfuscation using a (free) service like http://www.codeeclipse.com/ could make the code look more like gibberish and make it more difficult to reverse-engineer. 4. Don't create functions on your web server which simply return the unencrypted API key. If someone got access to your web server, they could simply use that PHP function to retrieve your key without having to figure out your encryption mechanism at all. The application should unencrypt the key, use it, and then discard it all within obfuscated code and without having to return that sensitive information back to the caller of the function. I know that is probably a bit obscure, and will require some work to implement--and there very well might be better or more standardized ways to secure the information. Without big budgets and large network infrastructures, however, it's hard to keep data that your web server needs to be able to access without user interaction completely secure. Sorry for the long-winded reply again :) Ben -- 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
Creating AuthComponent in 2.0-beta
I'm working on an Authentication module to work with the AuthComponent to log users in via SimpleSAMPphp (single sign-on via SAML) I understand how to create auth modules and have created one named SimpleSamlAuthenticate, but I am a bit stuck on implementing the authenticate(CakeRequest $request, CakeResponse $response) function. The docs indicate the function should either return false if the user cannot be identified, or a user array if they can. To actually initiate a SimpleSAMLphp authentication, however, the SimpleSAML_Auth_Simple class gets loaded and its requireAuth() or login() function gets called, which redirects the user to the registered SAML Identity Provider where they authenticate and are returned back to the application. This doesn't seem compatible with the AuthComponent... It seems like maybe what I need to do is authenticate outside of the Auth component, and then utilize the AuthComponent after authentication to verify that it succeeded and that the user session is valid, but that seems to defeat most of the purpose of the AuthComponent in general. But if so, would it make more sense for me to stop using the AuthComponent entirely and create a new method component which ties SAML authentication sessions in with one of the available Authorization modules? When I read about the AuthComponent changes in 2.0, I thought that maybe I could finally utilize the CakePHP Auth component for something, but now I'm not so sure :) Ben -- 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 2.0 beta - AppController issue
That was the first thing I changed--the problem turned out to be that I wasn't enabling the module in bootstrap.php. Whoops! Thanks, Ben -- 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: Component causing AppController to fail in 2.0 beta
Debug was already set to the highest level listed (2). I get errors for everything else, but apparently in CakePHP 2.0 Beta, there is some strange behavior if you don't enable a plugin but try to use it: 1. Component added to AppController for a non-enabled plugin made the entire AppController not run, but did not display any error messages. It simply acted as if I did not have a custom AppController defined. 2. Helper added to AppController for a non-enabled plugin was less catastrophic--it simply didn't work until I enabled the plugin. I find it odd that if you try to use a model from a disabled plugin, you get a nice exception in CakePHP, but if you try to use a component or helper from a disabled plugin, it silently fails. Ben -- 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: Media Plugin Tutorial
Here's a simple tutorial to help get you started: http://sopix.wordpress.com/2010/12/28/media-plugin-of-cakephp-tutorial/ Ben -- 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 come this isn't a safe way to store username and passwords
Sarah, Regarding point 1, if they got into your web server via FTP, they would have no way of initiating a database connection to get at the data. If they actually broke into your web server directly, then it is true that they could look up your database connection details and run MySQL queries against it. However, if they broke into your web server as such, They would have access to a lot more information than that. Regarding point 2, you're absolutely right--if the file is outside of the webroot, then only point 1 applies to it. If the file were in the webroot and the web server were misconfigured, then all PHP code in the files in the webroot would be displayed exactly as it was typed by the developer--obviously not a good situation when sensitive information is at stake :) I think the database is the way to go. You have the option of getting a bit clever with how you store the information... you could use a two-way encryption method to encrypt the key for storage in the database, and encrypt/decrypt it using a random hash value that you set in your config file. The obvious hole in this setup is that the web server HAS to know how to decrypt and view the API key, so someone who has access to your web server has the ability to perform those same actions if they know how. One possible way around this is creating a complex algorithm for modifying the hash based on some other value(s) and encrypting and decrypting the information, and then obfuscating the PHP code so that it's not obvious what it is doing. You could use a freely available PHP obfuscator for this. In this scenario, to get access to your API key, someone would have to: 1. Break into your web server (FTP wouldn't work) 2. Get your database connection details and encryption/decryption hash 3. Find the obfuscated code which performs the decryption 4. De-obfuscate the code so they can figure out the procedure 5. Query the database for the encrypted key 6. Decrypt the key So while not 100% secure, everything you do to secure the key adds another layer of protection that makes it more likely to be safe. Unfortunately, there is no way to 100% securely store secure information that your web server knows how to read automatically. You can keep making it more and more secure, but someone will always be able to trace those steps back to your secure information if they know how. Either way, the key is to add some additional layers between the API key and your application--the database is one layer that goes a long way toward that goal. I hope that was of some assistance, and let me know if I can try to help any further. Thanks, Ben -- 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: debug level on ajax request
Fixing warnings and notices is not the answer to his question--With debug mode off, he should not be getting such messages displayed. At worse, he should be seeing formatted Cake errors or simply a blank page if something is wrong. Perhaps the warnings/notices/errors are being thrown before you call Configure::write('debug', 0); ? If so, try calling it earlier in your code. Or perhaps something else is changing the value of debug back to 1 or greater? You could echo something from inside that if() block to make sure it is actually hitting the code which sets the debug value to 0. Beyond that, I don't know what else to have you try :) Ben -- 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
CakePHP 2.0 beta - AppController issue
I'm having a hard time getting CakePHP 2.0 to use my AppController. It's located in app/Controller/AppController.php It defines components and helpers (which do not actually get defined) and has a beforeFilter with a die() statement which never gets called. Is that not the right place for CakePHP 2.0? I was following the documents available in github. Thanks all! Ben -- 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 2.0 beta - AppController issue
Hmm... actually I guess it is called but I have some sort of problem with one of my components that was preventing AppController from being used apparently (although no errors were output). I will try disabling my custom components and troubleshooting them one by one to see which one's doing it. Ben -- 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
Component causing AppController to fail in 2.0 beta
I have a simple (and likely poorly written, sorry) component that I was using in CakePHP 1.3 which I wanted to use in my new 2.0 beta app called AssetGathererComponent. It is inside a plugin called 'AutoAsset'. The file is now located at app/Plugin/AutoAsset/Controller/Component/AssetGathererComponent.php I updated the constructor per the core components for how it should look in 2.0. I also made sure it extends Component Here is my current code: https://gist.github.com/1167325 I am including it in my AppController's $components array like this: 'AutoAsset.AssetGatherer' = array( 'mainJs' = 'app', 'requireJs' = array('libs/modernizr-1.7-custom.min', 'libs/selectivizr'), ), Whenever I include it in my AppController, the entire AppController goes unused in my application. When I take it back out, the AppController works fine. What have I done wrong? Thanks! Ben -- 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: Component causing AppController to fail in 2.0 beta
Ok, getting closer. First, I made a minor typo above, 'requireJs' should have been 'requiredJs', but that doesn't really matter for this issue. It turned out I just needed to open up Config/bootstrap.php to realize I need to manually enable my plugins in CakePHP 2.0. Face ... meet palm. Ben -- 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 come this isn't a safe way to store username and passwords
You have to store your API key somewhere, and your site needs to know how to retrieve it. There are two main issues with storing it directly in the file: 1. As already stated, if someone gets access to your web server or FTP information, they'll have your PayPal API information as well. 2. If your web server ever gets misconfigured and displays the actual PHP code on the browser (not uncommon), your API key will be shown to anyone who views that URL. It might make more sense to store those details in your application's database, which, as also mentioned previously, should not be accessible from anywhere but your web server. Ben -- 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
Stop an AJAX call keeping a CakePHP session alive
Hello all, I have an authentication system on my site using CakePHP. It uses PHP Sessions for this. What i have in place is an AJAX call to a function which checks if the user is still logged in. If it returns false, then the Javascript takes the current URL and attempts to redirect them, which in turn redirects them to the login page. In theory this works because it actively asks the user to re-login instead of holding a stale session which will just ask them to login as soon as they click something. My problem is that my AJAX call is keeping the session alive. So they never get logged out (which we don't want) Is there ANYTHING i can do within CakePHP or any other methods i can use to stop this happening? -- 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 on godaddy
Rather than make it an absolute path (putting '/' before index.php) couldn't you just reset RewriteBase to '/'? -- 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 on godaddy
I know this is an old topic, but just wanted to provide an update. I just set up the latest CakePHP in GoDaddy and wanted to post my experience. First, they are using PHP5 as the default now. Second, you still get 500 errors on any path. I fixed it by adding the following at the start of the rewrite code in the .htaccess file under the webroot directory: RewriteBase / -- 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
Best way to set up database tables for shared user access?
I am writing an application that will allow two different types of Users (tenant and manager) to create different linked objects (properties, leases, and User), which they will be able to share. Here is an example of how I want it to work: 1. A tenant creates and account and adds his Property and Lease. 2. He adds his landlord (a User, alias as Manager) and links the Manager to the Property and Lease. 3. Manager signs up and effectively takes over the User account that tenant created for him earlier. 4. Manager now has the ability to use the Property (created by tenant) in other Leases (once the tenant lease expires, for example) My problem isn't with the logic of doing all this, but rather how should I set up my database tables to avoid creating more headaches when I'm writing the app? Right now, I'm thinking of giving the Lease table the following fields: tenant_user_id (the tenant's user id, if created by tenant) manager_user_id (the manager's user id, if created by manager) tenant_leases_id (a way to link multiple tenants to multiple leases; the relationship between tenants and leases is HABTM) Any pitfalls I'm missing? Does anyone have a better or simpler way? Thanks! 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
my login program is not working
Notice (8): Undefined index: RorSubscriber [APP\controllers \Ror_subscribers_controller.php, line 61] Code it bringing if(empty($this-data) == false) { if(($rorSubscriber = $this-RorSubscriber- validateLogin($this-data['RorSubscriber'])) == true) RorSubscribersController::login() - APP\controllers \Ror_subscribers_controller.php, line 61 Object::dispatchMethod() - CORE\cake\libs\object.php, line 116 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194 [main] - APP\webroot\index.php, line 88 (default) 6 queries took 52 ms Nr Query Error AffectedNum. rows Took (ms) 1 DESCRIBE `ror_subscribers` 14 14 19 2 DESCRIBE `posts`5 5 5 3 DESCRIBE `comments` 5 5 5 4 DESCRIBE `tags` 3 3 5 5 DESCRIBE `posts_tags` 3 3 5 6 SELECT `RorSubscriber`.`id`, `RorSubscriber`.`email` FROM `ror_subscribers` AS `RorSubscriber` WHERE `email` IS NULL AND `password` IS NULL LIMIT 1 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: baking 1.3.0 problems?
Same problem for me as well. I didn't have 'libs' on my file path. Seems like a Windows install might be the common denominator... On May 25, 5:24 pm, Evangelos dia...@gmail.com wrote: Same problem here. I updated my app with 1.3.0 stable and the baking console is not working any more! Same errors as above. See image attached. http://www.screencast.com/users/Sarpidon/folders/Jing/media/b588b42c-... On May 25, 10:53 pm, CrotchFrog crotchf...@gmail.com wrote: @invisibleman: Did you ever resolve this problem? I'm having the same issue. On Apr 27, 6:18 am, invisibleman daveyjones...@gmail.com wrote: i can't seem to bake my models, views or controllers in the stable of cakephp 1.3.0 is anyone else having this problem? It just seems to create empty files for me. For example if i have a table called groups and i bake it it just creates an empty group.php file for me even though i defined relationships and validation etc. Can anyone help? Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 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 athttp://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: baking 1.3.0 problems?
Fixed. Move 'templates' folder up into 'libs'. Or copy. Worked for me. On May 25, 3:53 pm, CrotchFrog crotchf...@gmail.com wrote: @invisibleman: Did you ever resolve this problem? I'm having the same issue. On Apr 27, 6:18 am, invisibleman daveyjones...@gmail.com wrote: i can't seem to bake my models, views or controllers in the stable of cakephp 1.3.0 is anyone else having this problem? It just seems to create empty files for me. For example if i have a table called groups and i bake it it just creates an empty group.php file for me even though i defined relationships and validation etc. Can anyone help? Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 athttp://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
odd form field behavior when implementing auth
hello - I am trying to figure out why a form page for login refuses to display a field with the name employee_id. code is as follows: model: class User extends AppModel { var $useTable = 'employees'; var $primaryKey = 'employee_id'; } controller: class UsersController extends AppController { var $name = 'Users'; var $helpers = array('Html', 'Form'); var $components = array('Auth'); function beforeFilter() { Security::setHash(md5); $this-Auth-fields = array('password' = 'employee_password','username' = 'employee_id'); $this-Auth-loginAction = array('controller' = 'users', 'action' = 'login'); $this-Auth-loginRedirect = array('controller' = 'dashboard', 'action' = 'index'); $this-Auth-loginError = 'No username and password was found with that combination.'; $this-Auth-logoutRedirect = '/'; } function login() { } function logout() { $this-redirect($this-Auth-logout()); } } view: $session-flash('auth'); echo $form-create('User', array('action' = 'login')); echo $form-input('employee_id'); echo $form-input('employee_password'); echo $form-end('Login'); Yet the result is http://dl.dropbox.com/u/178319/cake-arg.jpeg Any ideas why it refuses to show the input form field employee_id ? Thanks 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, reply using remove me as the subject.
Intergrating PHPCake into CMS
Hello Has everyone had any experience using PHPCake with an Open Source CMS such as silverstripe? Any recommendations you have would be appreciated. Regards Ben 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: create a link with conditions to filter index action
That's great, thanks for your help! I guess if I wanted the option of additional parameters I could do something like: $html-link($category_name,array('controller'='Blogs', 'action'='index', null, 5)); function index($category_id = null, $tag_id = null) Does that look right? Also, do you know if this will work with pagination and habtm relationships? After some googling this morning around my problem, I came across this a few times as a kind of known issue, so wondered if perhaps it was related? My categories and tags are in habtm reference tables. Thanks again for the advice. -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of Jeremy Burns Sent: 14 January 2010 14:20 To: cake-php@googlegroups.com Subject: Re: create a link with conditions to filter index action If you are only ever going to filter for category_id, you could do this: $html-link($category_name,array('controller'='Blogs', 'action'='index', 3)); Then change you index function to: function index($category_id = null) ...and then check for a non null value later in your code when you do your data extraction. Jeremy Burns jeremybu...@me.com (Skype) +44 208 123 3822 (jeremy_burns) (m) +44 7973 481949 (h) +44 208 530 7573 On 14 Jan 2010, at 10:47, nyahoo wrote: Hi All, I hope someone can help me with what I think is a simple question that I just haven't wrapped my head round yet. (I'm new to CakePHP). I want to create a link that requests the index action of my blog (which is paginated), but at the same time passes it a condition, like category_id=2 or something like that, so that I can have a list of categories to the right of my blog index that reloads the page with just that categories blogs. This seems like a straightforward idea to me, but I don't seem to be able to get the syntax right. I can do limits and orders but not conditions. Can anyone help me please? Some examples: This works: $html-link($category_name,array('controller'='Blogs', 'action'='index', 'limit'=2)); This doesn't work: $html-link($category_name,array('controller'='Blogs', 'action'='index', 'conditions'='Blog.category_id=3')); My controller code: function index() { $this-Blog-recursive = 0; $this-set('blogs', $this-paginate()); } Thanks for any advice in advance! 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 cake-php+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: create a link with conditions to filter index action
Thanks, Jon, that's perfect. -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of Jon Bennett Sent: 14 January 2010 15:07 To: cake-php@googlegroups.com Subject: Re: create a link with conditions to filter index action hi Ben, Used named parameters: $html-link($category_name, array( 'controller'='Blogs', 'action'='index', 'category_id'=3, 'tag_id'=4 )); public function index() { extract($this-params['named']); $conditions = array(); if (isset($category_id)) $conditions['Blog']['category_id'] = $category_id; if (isset($tag_id)) $conditions['Blog']['tag_id'] = $tag_id; // etc } hth Jon -- jon bennett - www.jben.net - blog.jben.net 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: Auth component bug
I have the same exact issue and have been searching for a solution for several days now... On Sep 26, 4:06 am, Marcelo marcel...@gmail.com wrote: I'm using Auth component and this is one of the settings in my AppController's beforeFilter() method: $this-Auth-loginAction = array( 'controller' = 'users', 'action' = 'login', Configure::read('Routing.admin') = false ); When i access: -- todos/view/5 redirects to - users/login GOOD -- admin/todos/edit/5 redirects to users/login GOOD -- admin/users/add redirects to admin/users/login BAD, WHY THIS HAPPENS?!? -- I have no admin_login() action. My login action is NOT under admin routing. It should redirect to users/login since i've disabled admin prefix within my loginAction configuration. It only happens with Users controller! I would appreciate an explanation for this strange behavior. Thanks in advance, Marcelo Kanzaki --~--~-~--~~~---~--~~ 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: Auth component bug
I was able to overcome this behavior by setting this in my routes.php Router::connect('/admin/users/login', array('controller' = 'users', 'action' = 'login')); It did the trick for me. My only issue now is that once the user is logged in they do not go back to the page they were attempting to access but instead are redirected to the root of the site. -Ben http://www.benhavilland.com On Oct 8, 8:37 am, ben b...@havilland.net wrote: I have the same exact issue and have been searching for a solution for several days now... On Sep 26, 4:06 am, Marcelo marcel...@gmail.com wrote: I'm using Auth component and this is one of the settings in my AppController's beforeFilter() method: $this-Auth-loginAction = array( 'controller' = 'users', 'action' = 'login', Configure::read('Routing.admin') = false ); When i access: -- todos/view/5 redirects to - users/login GOOD -- admin/todos/edit/5 redirects to users/login GOOD -- admin/users/add redirects to admin/users/login BAD, WHY THIS HAPPENS?!? -- I have no admin_login() action. My login action is NOT under admin routing. It should redirect to users/login since i've disabled admin prefix within my loginAction configuration. It only happens with Users controller! I would appreciate an explanation for this strange behavior. Thanks in advance, Marcelo Kanzaki --~--~-~--~~~---~--~~ 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: Paginate Routing
No, not yet. If I find it I'll ping you. Its weird as symfony has a very clear way of routing the paging. -Original Message- From: Dave Maharaj :: WidePixels.com d...@widepixels.com Date: Fri, 4 Sep 2009 19:33:06 To: cake-php@googlegroups.com Subject: RE: Paginate Routing No I never got a response or found a solution. Any luck on your end? Dave -Original Message- From: bing [mailto:benjamin.ingm...@gmail.com] Sent: September-04-09 7:24 PM To: CakePHP Subject: Re: Paginate Routing Hi, Did you ever get an answer on this? I'm having the same issue. Thanks, Ben On Aug 17, 11:38 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Ok I managed to get all my pagination up and running the way I needed. The only thing left is removing /page:3 to only display /3 Router::connect('/bookmarks/index/:id_key/*', array('controller' = 'bookmarks', 'action' = 'index'),array('id_key' = '[-_A-Za-z0-9]+','pass' = array('id_key'))); How do I remove page from the URL? Thanks again everyone 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: Tagging system in Cake - hasAndBelongsToMany problems
Thanks for the input I've tried everything suggested, and none of them work. The strange thing is my save/create/update behaviour is working, so Tags and Games are getting created and linked properly during updates deletes - I infer from this that my associations models are set up OK. With the debug level set to 3 I can see that cake does two queries rather than an actual SQL JOIN, e.g. SELECT `Tag`.`id` FROM `tags` AS `Tag` WHERE `Tag`.`name` = 'foo' LIMIT 1 Followed by SELECT blahblah FROM `games` AS `Game` JOIN `games_tags` AS `GamesTag` ON (`GamesTag`.`tag_id` = 13 AND `GamesTag`.`game_id` = `Game`.`id`) Which seems a very odd way of going about things... In the end I've used my own SQL statement using the query() function where I have proper control over the joins.- this is the only time in using cake I've had to resort to this. Oh well Thanks again. On Apr 4, 11:07 am, Ben Coleman benc...@gmail.com wrote: Hi, I've been using Cake for some time, but recently hit a problem with hasAndBelongsToMany. I have a videogame database, I'm trying to add a tagging system to it. I'm storing my tags in 3NF. So I have a model for games which is binding Games to Tags with hasAndBelongsToMany and also my Tag model binds back to Games with a hasAndBelongsToMany. The Games model is also bound to some other tables with belongsTo (e.g. Genre, Region, System etc,). Naturally I have a join table called games_tags linking the many-to-many relationship. I want to query my system and get all games with a specific tag, and this is where it falls down If I do: $this-Game-Tag-find('all', array('conditions' = array('Tag.name =' = 'foo'))); It works but it doesn't join the other tables to Game, so I can't get the Game's genre or system $this-Tag-Game-find('all', array('conditions' = array('Tag.name =' = 'foo'))); This fails with an error Unknown column 'Tag.name' in 'where clause Either way it's not joining all the tables properly, it seems to do two separate queries This is so frustrating because if I was writing the SQL by hand I would have this solved in a matter of minutes, but Cake removes any of this freedom. What am I doing wrong??? this is such an obvious thing to do Thanks in advance Ben --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Tagging system in Cake - hasAndBelongsToMany problems
Hi, I've been using Cake for some time, but recently hit a problem with hasAndBelongsToMany. I have a videogame database, I'm trying to add a tagging system to it. I'm storing my tags in 3NF. So I have a model for games which is binding Games to Tags with hasAndBelongsToMany and also my Tag model binds back to Games with a hasAndBelongsToMany. The Games model is also bound to some other tables with belongsTo (e.g. Genre, Region, System etc,). Naturally I have a join table called games_tags linking the many-to-many relationship. I want to query my system and get all games with a specific tag, and this is where it falls down If I do: $this-Game-Tag-find('all', array('conditions' = array('Tag.name =' = 'foo'))); It works but it doesn't join the other tables to Game, so I can't get the Game's genre or system $this-Tag-Game-find('all', array('conditions' = array('Tag.name =' = 'foo'))); This fails with an error Unknown column 'Tag.name' in 'where clause Either way it's not joining all the tables properly, it seems to do two separate queries This is so frustrating because if I was writing the SQL by hand I would have this solved in a matter of minutes, but Cake removes any of this freedom. What am I doing wrong??? this is such an obvious thing to do Thanks in advance Ben --~--~-~--~~~---~--~~ 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: Rendering non-HTML: templates vs. elements
I think I've figured it out: 1) the requestAction call in the page element is not neccessary - the data is already available from the first pass through the controller 2) the reason my code was not completing was that the iCalcreator's returnCalendar() method ends in die() (why would this be a good thing?) Once I: removed the requestAction call in the element file; rewrote the calendar rendering helper to use iCalcreator::createCalendar which doesn't die at the end; and set the layout in my controller ($this- layout = ical;); then all seems well. On Jan 26, 2:52 pm, BenL benjamin.d@gmail.com wrote: My app uses ical-like events and I'd like to make these events available for subscription from Google Calendar, Apple iCal, etc. The guide athttp://www.365webapplications.com/2009/01/09/cakephp-calendar/ helped me set up iCalcreator as a Helper. However I'm confused on use of a view template vs. element: from the Cake doc, I would have expected to use a template that defines the overall layout (in this case, it would be empty as iCalcreator's render takes care of everything); then the view would create an iCalcreator object from the data provided by the controller and render it to $content_for_layout. However, the 365webapplications approach invokes the controller action via a requestAction in an element, the element then creates the iCalcreator object renders it. No template is used. When I do this, I find that the controller action gets called twice, and seems to get cut off prematurely: i.e. my controller and element (simplified): controllers/events_controller.php: ? class EventsController extends AppController { function ical() { $this-helpers[] = 'ICal'; // pull in the i_cal helper $this-Event-recursive = 0; // don't need associated data $events = $this-Event-find('all'); // called via a requestAction? if (isset($this-params['requested'])) { echo controllers/events_controller: requestedp; return $events; } echo controllers/events_controller, setting eventsp; $this-set('events', $events); echo controllers/events_controller, donep; }} ? views/elements/events.ctp ?php echo views/elements/events.ctp 1p; $events = $this-requestAction('events/ical'); echo views/elements/events.ctp 2p; $iCal-create(); echo views/elements/events.ctp 3p; foreach($events as $e) { $iCal-addEvent( $e['Event']['datestart'], $e['Event']['dateend'], $e['Event']['summary'], $e['Event']['description'] ); } $iCal-render(); echo pviews/elements/events.ctp 4p; ? views/events/ical.ctp: ?php echo views/events/ical.ctp startp; //echo $this-element('events', array('cache'='+1 hour')); echo $this-element('events'); echo views/events/ical.ctp endp; ? Now, when I call the action, I get: controllers/events_controller, setting events controllers/events_controller, done views/events/ical.ctp start views/elements/events.ctp 1 controllers/events_controller: requested views/elements/events.ctp 2 views/elements/events.ctp 3 then some warnings about cannot modify header - which is fine as I'm just debugging now, and the output of iCal-render BEGIN:VCALENDAR METHOD:PUBLISH ... :VEVENT END:VCALENDAR and that's it: the line in the element after the render doesn't get called, nor does the line after the 'echo $this-element('events');' in the view Is the above the best way to output non-HTML? --~--~-~--~~~---~--~~ 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: Help w/ DebugKit - no toolbar
I don't have any requestAction calls, and my debug level is 2. $ grep -r requestAction app $ grep -r Configure::write('debug', app/config/ app/config/core.php:Configure::write('debug', 2); I'll keep at it... On Jan 27, 3:00 am, Samuel DeVore sdev...@gmail.com wrote: I have seen this with pages (or templates) that have requestAction used in them. I'm not sure if it the result of clearing of the output buffer in requestAction or something else. Sam D On Mon, Jan 26, 2009 at 6:24 AM, BenL benjamin.d@gmail.com wrote: I'm attempting to use DebugKit perhttp://thechaw.com/debug_kit/wiki, with cake_1.2.1.8004. I've downloaded debug_kit from http://github.com/cakephp/debug_kit/tree/masterand placed it into my app/plugins directory. After an initial hiccup with file permissions, I've hit a stumbling block in that I don't have the toolbar on my DebugKit-enabled page. My controller: ? class EventsController extends AppController { var $scaffold; var $components = array('DebugKit.Toolbar'); ? http://.../events/returns the same content regardless of the $components line. I have the default debug level, 2 (i.e. I can see the SQL log), I'm using Firefox 3 w/ Firebug and FirePHP installed. What am I missing? --~--~-~--~~~---~--~~ 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: Help w/ DebugKit - no toolbar
You are using a scaffold. ... the view class from the scaffold is replacing the debug view Ah, indeed - I'm still fiddling with that part of my app's schema, and am very new to Cake/PHP/web apps, so am relying heavily on scaffolding. I have tried the debugkit component in a bake-created controller (no scaffolding) and the debugkit toolbar stuff is showing up, but inline on the page (after my content but before the SQL log). (sorry for cross-posting this on your blog, I need to practice more patience :-) Rgds, Ben --~--~-~--~~~---~--~~ 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: Help w/ DebugKit - no toolbar
I've found if I explicitly include the debug_toolbar CSS to views/ layouts/default.ctp, and make a symlink from webroot/css/ debug_toolbar.css to ../../plugins/debug_kit/vendors/css/debug_toolbar.css, the toolbar is rendered as a toolbar at the top of the page. i.e. html head titleMy App/title ?=$html-css('cake.generic');? ?=$html-css('debug_toolbar');? /head ... Are those two steps as expected? Now on to getting FireCake working :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ajax-link after ajax.updater
Hello Cake-World, i red allready the threats about this discussion but nothing helped for me... My Problem: I got an AJAX-Link on my Page. It's placed in a table which is in an AJAX-Form. The Link works fine. BUT if i submit the form and the page reloaded by the form, the AJAX-Link is dead. On click nothing happens anymore. The Form just load a different action which view is loaded in a hidden iframe. This Page validates the form from above with Javascript (just fills in error messages by element.innerHTML). So i tried to change the rand() to mt_rand() in the AJAX-Helper. Problem persists... So i tried to make my own id for the link with options['id']. Problem still persists... Is there any solution to this? Or will it be fixed in future releases? Thanks. Ben --~--~-~--~~~---~--~~ 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: ajax-link after ajax.updater
If you trace the net traffic with firebug, does the server answer with the correct javascript? and does the browser include the javascript next to the anchor?. I'm experiencing some similar situation. Hello Pere. Firebug doesn't even want to response anything in net traffic by clicking the AJAX-link at the second time. The Javascript is placed in both time after the link and looks exactly the same (excepts the id but is correct from link to event). Any more? Thanks. Ben --~--~-~--~~~---~--~~ 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: ajax-link after ajax.updater
As expected by Pere it was a similar situation. The mainpage was reloaded by an AJAX.Updater. This one was the reason for the problem. After adding the option 'evalScripts : true' everything works fine. Thanks for all activated brain waves at all! Ben P.S.: If someone got this problem and don't understand all this here, feel free to contact me. --~--~-~--~~~---~--~~ 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: BelongsTo at DatabaseTable
Yeah, it was just a bad day. For sure, there is no problem to make a modelfile. On that day i just come up with a little panic: AAAH! Too many files in this fu*$§!g project! So, thanks for replay at all. Ben --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
paginate and belongsTo at a belongsTo-Model
My problem: I have a belongsTo relation, like Cars belongsTo Wheels. And there is a belonsTo relation like Wheels belongsTo Tires. Now i want to paginate the Cars und Filter by Wheels.type. But i can't beacause pagination didn't find the Wheels belongsTo (and so didn't join the Wheels table) at the moment of filtering. Is there a way to get it? Ben --~--~-~--~~~---~--~~ 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: paginate and belongsTo at a belongsTo-Model
@grigri: Thanks a lot for the detailed answer. I will try it on weekend and give some response next week. @Smelly_Eddi: The Relations were just an example. I like your way of inspecting details but in this case i have to appreciate with grigri... Just cakephp relations... @all: Sunny weekend !!! Ben --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
BelongsTo at DatabaseTable
Hello World, i just tried to search, but can't find what i'm looking for. I want to bind a table to a model, so that associated entrys will shown at pagination. BUT i don't want to create a model-file just to get it. Some source for explanation: class Car extends AppModel{ var $name = 'Car'; var $uses = 'Cars'; var $belongsTo = 'Engines'; // BUT there shoudn't be a Model named 'Engine', just a Table called 'Engines' function index(){ [...] $this-Car-paginate('Cars'); // Should find Car1 - Engine1, Car2 - Engine2, ... } } Is there a way to get it work? Ben --~--~-~--~~~---~--~~ 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: Radio with single onclick
If you really want to do an onclick action inline (within the HTML), I'd recommend taking the CakePHP form input code—as seen in this snippet:http://bin.cakephp.org/view/1820783667—and customize the radio element HTML code by removing the onclick attributes from those you don't want. Thanks Lance, i already thought about that. I know Prototype a little, but i guess the inline method should be good enough. Could be a kind of this feature in future realeses? Ben --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Radio with single onclick
Hello there. I created a form with a radio section. But i just can't figured out how to put an onclick funktion to one single Button... I red this post http://groups.google.com/group/cake-php/browse_thread/thread/838c12d3bbeb873/75739688579656a1?lnk=gstq=radio+onclick#75739688579656a1 and in fact of it's form 2006 i hope there is a way to do this. A code snip: echo $form-input('category', array( 'type' = 'radio', 'name' = 'data[Category] [id]', 'options' = $cat_array)); $cat_array looks like this: [0]= string(12) new category [1]= string(11) that's life [2]= string(9) knowledge And ideas? Ben --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Section Navigation
I am (very) new to CakePHP and I am working on a site where I will have sub navigation depending on which section a user is visiting. Right now I have it setup as follows: /answers/ renders /views/answers/index.thtml /answers/ask/ renders /views/answers/ask.thtml /answers/answer/ renders /views/answers/answer.thtml So answers will have a subnavigation that I currently have setup as an element in /views/elements/answers_nav.thtml which I then call in each /answers/ view. The code in the element is: div id=section_nav ul li ? if ($this-action == index) echo 'class=active'; ?a href=.Overview/a/li li ? if ($this-action == ask) echo 'class=active'; ?a href=askAsking a Question/a/li li ? if ($this-action == Answer) echo 'class=active'; ?a href=answerAnswering a Question/a/li /ul /div My question is: Is this the best practice or solution? Could I make this much simpler? I will have ~10-15 of these subnavigation elements in the /elements/ folder at this rate... --~--~-~--~~~---~--~~ 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: database naming convention boggle
Thanks, Joel, the simplicity of cakephp never ceases to amaze! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
database naming convention boggle
I'll bet there's an easy solution for this one: I am using aMember to bill for subscriptions to my site. Unfortunately the users table in aMember has the primary key set to member_id instead of they key id which is called for in the cakephp naming conventions and opens up a world of ease. Is there any way to tell cakephp that for this one table member_id should be treated as id? --~--~-~--~~~---~--~~ 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: Changing Kids in HasMany (like an Adoption) . . .
On Feb 10, 2008 4:36 AM, AD7six [EMAIL PROTECTED] wrote: On Feb 10, 3:47 am, Ben Wilson [EMAIL PROTECTED] wrote: I'm not getting this from the documentation, so could somebody point me to an example that shows this? I have a Parent that hasMany Children. I also have children belongsTo Parent. I want to change a handful of Children so they have a different Parent. How is that different from simply 'calling save'? Dunno. I don't see an example that clearly states that calling save will change the kids like that. My present solution is to send the form to the kids' controller and processing them individually. We're talking a lot of kids. -- Ben Wilson Words are the only thing which will last forever Churchill --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
history...
I am storing a row's history in a json_encoded hx field, where each change is a timestamped key. How do I go about putting this behavior in save() so I don't have to do it in every action? -- Ben Wilson Words are the only thing which will last forever Churchill --~--~-~--~~~---~--~~ 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: history...
On Feb 9, 2008 8:45 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I see. Not the way I would do it to be honest, but it's possible... What you really want to do is avoid overriding the save method in the model and use either a beforeSave hook in the model, or writing a behaviour (1.2) that has similar beforeSave hooks in it. I would watch that column quite carefully if I were you, a few updates and, and you could quickly find yourself with very sub-optimal database row lengths. Thanks, the data does not change often, and after (say) 30 days the history is truncated. Were I to use beforeSave, roughly how would I got about it? I mean, what do I need to do before/after the history logic? -- Ben Wilson Words are the only thing which will last forever Churchill --~--~-~--~~~---~--~~ 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: history...
On Feb 9, 2008 6:31 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: if you add created and modified columns to your table, cake will automagically fill them in for you. But, when I submit a changed record, I want it to do something like the following: save($orig, $new) { $hx = json_decode($orig['hx'], 1); $key = time(); unset($orig['hx']); $hx[$key] = $orig; $new['hx'] = json_encode($hx); Model::save($new); } However, I don't know the right way to call the parent class that will recognize the model described. -- Ben Wilson Words are the only thing which will last forever Churchill --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Changing Kids in HasMany (like an Adoption) . . .
I'm not getting this from the documentation, so could somebody point me to an example that shows this? I have a Parent that hasMany Children. I also have children belongsTo Parent. I want to change a handful of Children so they have a different Parent. -- Ben Wilson Words are the only thing which will last forever Churchill --~--~-~--~~~---~--~~ 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: SQL error with ACL ARO
On Jan 29, 2008 10:44 AM, david_setwise [EMAIL PROTECTED] wrote: Hi, I am running the 1.2 beta with mysql. I am trying to setup ACL and have been following all the common tutorials out there like http://bakery.cakephp.org/articles/view/how-to-use-acl-in-1-2-x When I run the setupAcl function, as detailed in the Bakery article, I get a SQL error about the aro.parent_id field: SQL Error: 1054: Unknown column 'Aro.parent_id' in 'field list' My aro table definitely does not have a parent_id field, but I thought I had the table structure correct. Does anyone have any idea what I am doing wrong? David, you're carping about the same thing I've raised. It seems that the script that creates the database neglects the correct schema. Nobody seems interested in addressing or resolving this. -- Ben Wilson Words are the only thing which will last forever Churchill --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
cake acl create aco ROOT Members... problem
below is the result I get trying to set acos. what am I doing wrong? [EMAIL PROTECTED] [~/cake/AstroEmpires]# cake acl initdb Hello daushan, Welcome to CakePHP v1.2.0.6311 beta Console --- Error: This command is deprecated. Please use, cake schema run create DbAcl [EMAIL PROTECTED] [~/cake/AstroEmpires]# cake schema run create DbAcl Hello daushan, Welcome to CakePHP v1.2.0.6311 beta Console --- Cake Schema Shell --- The following tables will drop. acos aros aros_acos Are you sure you want to drop the tables? (y/n) [n] y Dropping tables. The following tables will create. acos aros aros_acos Are you sure you want to create the tables? (y/n) [y] y Creating tables. End create. [EMAIL PROTECTED] [~/cake/AstroEmpires]# cake acl create aco / ROOT Hello daushan, Welcome to CakePHP v1.2.0.6311 beta Console --- New Aco 'ROOT' created. [EMAIL PROTECTED] [~/cake/AstroEmpires]# cake acl create aco ROOT Members Hello daushan, Welcome to CakePHP v1.2.0.6311 beta Console --- Error: Could not find parent node using reference ROOT The table: id object_id alias lft rght 1 NULLROOT1 2 -- Ben Wilson Words are the only thing which will last forever Churchill --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Too Much Noise Auth/ACL 1.2
I've been beating my head into the wall on Auth/ACL for over a week now. Yesterday, I got SimpleACL Component to work,[1] but this morning I was suddenly unable to authenticate; nor is anybody else. I used to be pretty good at digging through spaghetti code and finding problems, but I cannot figure out where the authentication is failing---yes, the username/password are correct. I got SimpleACL to work out of the box, until this morning when everything stopped authenticating. I cannot find one truly authoritative reference that clearly explains Auth/ACL. I find documents that discuss the 1.1 table structure, but nothing that explains 1.2 in a way that clearly makes sense to me. I even tried that ACL Management plugin and threw it away. I need a solution that works vanilla. -- Ben Wilson Words are the only thing which will last forever Churchill [1]: http://wiki.kabturek.info/simpleaclcomponent --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Auth 1.2 infinite redirect...
Could somebody clue me into why I'm encountering an infinite redirection loop? I'm using the latest Beta 1.2 series. My browser allows cookies. I am following what appears to be a pretty-good tutorial---and have made my users/groups table comply.[1] The only way to keep it from looping is to allow '*', which defeats the purpose. [1]: http://www.webdevelopment2.com/cakephp-auth-component-tutorial-1/ -- Ben Wilson Words are the only thing which will last forever Churchill --~--~-~--~~~---~--~~ 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: Auth in 1.2
On Jan 20, 2008 11:43 AM, b logica [EMAIL PROTECTED] wrote: Change back to where you had a blank screen and look in the error log for any FATAL errors. I think I found the problem. I created a site-wide menu element that is in the default. It calls the action below. Because the action is not in the 'allow' list, calls to it result in the loop. $menus = $this-requestAction('menus/getMenus/header'); -- Ben Wilson Words are the only thing which will last forever Churchill --~--~-~--~~~---~--~~ 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: Auth 1.2 infinite redirect...
On Jan 20, 2008 9:11 AM, Ben Wilson [EMAIL PROTECTED] wrote: Could somebody clue me into why I'm encountering an infinite redirection loop? I'm using the latest Beta 1.2 series. My browser allows cookies. I am following what appears to be a pretty-good tutorial---and have made my users/groups table comply.[1] The only way to keep it from looping is to allow '*', which defeats the purpose. [1]: http://www.webdevelopment2.com/cakephp-auth-component-tutorial-1/ I think I've found the problem. I was using an element to create a site-wide menu. In that element, a call was made to an action that was not on the allow list. However, since it occurs on every page, including /users/login, any attempt to call it resulted in a redirect to /users/login. This resulted in the infinite loop. The culprit code follows: $menus = $this-requestAction('menus/getMenus/header'); The solution was to add the action getMenus to the allow. This corrected the problem. The solution code follows: $this-Auth-allow('getMenus'); -- Ben Wilson Words are the only thing which will last forever Churchill --~--~-~--~~~---~--~~ 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: Auth in 1.2
On Jan 16, 2008 5:05 PM, Baz [EMAIL PROTECTED] wrote: Yep, Took me a while too. lol Okay, I bit. I'm trying to get authentication/authorization going for a site and am trying your tutorial. Although, I have a table in place and need to make a few mods. However, with the original table and your code, I'm getting a blank display on the browser. -- Ben Wilson Words are the only thing which will last forever Churchill --~--~-~--~~~---~--~~ 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: Auth in 1.2
On Jan 19, 2008 10:55 PM, Ben Wilson [EMAIL PROTECTED] wrote: On Jan 16, 2008 5:05 PM, Baz [EMAIL PROTECTED] wrote: Yep, Took me a while too. lol Okay, I bit. I'm trying to get authentication/authorization going for a site and am trying your tutorial. Although, I have a table in place and need to make a few mods. However, with the original table and your code, I'm getting a blank display on the browser. Now I'm in an infinite redirection loop, unless I set $this-Auth-allow('*'); This sort of defeats the purpose. :-) -- Ben Wilson Words are the only thing which will last forever Churchill --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Pagination of multiple models in 1.2
I'm trying to use the pagination helper in 1.2 I'm following the example given here http://bakery.cakephp.org/articles/view/basic-pagination-overview-3 I set the following in my controller var $paginate = array('Game' = array('limit'=5), 'System' = array('limit'=5)); in my action I call paginate and pass the results to my view $res = $this-paginate(); $this-set('games', $res); In my view I have the following ?php echo $paginator-sort('Name', 'name', array('model'='Game'));? ?php echo $paginator-sort('System', 'name', array('model'='System'));? However this results in a lot of warnings and errors about array_merge in CORE\cake\libs\view\helpers\paginator.php How can I do this? I need to have sort column headers for multiple items and they are all stored in different models. I've tried using $paginator-sort('System', 'System.name') but link is still sorting on Game.name which is wrong Is this a bug in 1.2? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Building an action list bar
Okay, I realize this is probably a softball pitch for the more experienced Cake users. I just started tinkering with CakePHP yesterday, having never used a framework before. I web programmed in Perl (professional) for a few years, then drifted into PHP (as a hobby) after I moved on to being a PM. So, I'm not exactly a knuckle dragger, but not immediately knowledgeable in some of the more recent innovations. My foray into CakePHP is an effort to correct that. So far, I've been pleased with the organization of the tool. I got a little frustrated when I moved the core Cake code and the app-specific code out of the 'standard' area---the documentation was disorganized enough that I ended up throwing up a few print strings in the core code until I figured out where things should go. But, I digress. That's just me being confused. I would like to build an action bar that lists all that a user can do (e.g. login/logout, view, edit) for display at the top of the page. I figured there would be a short tutorial somewhere, or a ready-baked solution in the tool itself. Would somebody mind pointing me in the right direction? Regards, Ben Wilson --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---