RE: Weird caching issue
Yeah I have the same issues in different areas of my app with no success. Same with delete, need to refresh after the first delete, and on login. My login is on the index page. When you login it redirects you back to the index page showing login, hit refresh and it shows Logged in... If you find a solution please let me know. Thanks, Dave -Original Message- From: toby1kenobi [mailto:toby.math...@gmail.com] Sent: October-23-09 2:25 PM To: CakePHP Subject: Re: Weird caching issue Ooops, as I was saying In our admin pages we see some strange behaviour in IE. Broadly it goes like this: 1. Create new instance of model (controller/admin_add), which on success... 2. Redirects back to controller/admin_index 3. Delete new item using link to controller/admin_delete on the admin index page. 4. controller/admin_delete does delete model instance, and then... 5. Redirects to controller/admin_index. This all works fine, the message confirming deletion appears at the top of the index page, but...the just-deleted model instance is still listed. Refreshing the page causes it to finally disappear, but we can't figure out why it's there the first time. Anyone seen anything similar? Thanks, Toby --~--~-~--~~~---~--~~ 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: Is Ajax request
Yeah all links are the same. Same class and jquery grabs by the class to load it ajax. But I said screw it and just included 'all' into the filterByType function so it will pull it that way. -Original Message- From: John Andersen [mailto:j.andersen...@gmail.com] Sent: October-22-09 7:42 AM To: CakePHP Subject: Re: Is Ajax request How is the HTML looking? Does it look the same as the other links? Enjoy, John On Oct 21, 6:59 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I have this function where its first called normally by a link (http request). Once loaded the pagination links are done via Ajax. I have 'all', 'new', 'archive' links which all get called to paginate the result using Ajax and jquery. Problem is when i go to posts/index it works fine, click 'all' which loads index it loads the layout too. The other links all work fine and load the element except all function index() { if ($this-RequestHandler-isAjax()) { //code for view $this-layout = 'ajax'; $this-viewPath = 'elements/posts'; $this-render(paginate'); } if (!$this-RequestHandler-isAjax()) { //code for view $this-layout = 'default_left'; $this-render('index'); } } so this here will filter the posts depending on what the user clicked 'all', 'new', 'archive' But 'all' when clicked always returns the 'default_left' layout function filterByType($type = null) { if ($this-RequestHandler-isAjax()) { $this-paginate['Post'] = $this-Post-filterByTypePagination($this-auth_id, $this-rank, $type, $this-post_display); $this-set('posts', $this-paginate()); $this-layout = 'ajax'; $this-viewPath = 'elements/posts'; $this-render('paginate'); } else { $this-redirect(array('action' = 'index')); } } Cann someone point out where I am going wrong? I tried if ($this-RequestHandler-isAjax()) { //code for view $this-layout = 'ajax'; $this-viewPath = 'elements/posts'; $this-render(paginate'); } else { //code for view $this-layout = 'default_left'; $this-render('index'); } but same thing keeps happening. 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 -~--~~~~--~~--~--~---
Controller Question
I have moved a few of my functions to a new controller and trying to get them to work. I have my passwords_controller where User can update thier password / forgot or what not var $uses = array('User'); //does not have its own model now in my function function forgot() { $this-pageTitle = 'Forgot Password'; $this-layout = 'default_right'; //can not access this if they are logged in if (isset($_SESSION['Auth']['User']['username'])) { $this-redirect(array('controller' = 'jobs', 'action' = 'index')); } //forgot password function sends out email if (!empty($this-data)) { debug($this-data); debug($userInfo = $this-User-getUserInfo($this-data['User']['email'])); $this-User-unbindValidation('keep', array('email'), true); $this-User-set($this-data['User']['email']); if ($this-User-validates()) { if (!empty($userInfo)) { $userInfo['User']['reset'] = string::uuid(); $this-sendEmail($userInfo, 'Reset Password', 'forgot'); $this-User-id = $userInfo['User']['id']; $this-User-saveField('reset', $userInfo['User']['reset']); } } else { $errors = $this-User-invalidFields(); debug($errors); $this-data = null; } } } The User never validates $errors always comes back 'empty'. Array ( [email] = empty. ) Validation set: 'email' = array( 'email-notempty' = array( 'rule' = array('notempty'), 'required' = true, 'allowEmpty' = false, 'message' = 'empty.', 'last' = true,), 'email-validEmail' = array( 'rule' = array('email', true), 'last' = true, 'message' = 'not an email.'), ), Where am I going wrong here? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Pages Controller
I have my site index www.site/ go to Router::connect('/', array( 'controller' = 'pages', 'action' = 'display', 'home')); How can I set it to check if logged in to redirect somewhere, define template layout and general function stuff? Do you make a normal function home(){} just with no model interaction? Cant seem to find much info on the pages_controller setup. Thanks, 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 -~--~~~~--~~--~--~---
Is Ajax request
I have this function where its first called normally by a link (http request). Once loaded the pagination links are done via Ajax. I have 'all', 'new', 'archive' links which all get called to paginate the result using Ajax and jquery. Problem is when i go to posts/index it works fine, click 'all' which loads index it loads the layout too. The other links all work fine and load the element except all function index() { if ($this-RequestHandler-isAjax()) { //code for view $this-layout = 'ajax'; $this-viewPath = 'elements/posts'; $this-render(paginate'); } if (!$this-RequestHandler-isAjax()) { //code for view $this-layout = 'default_left'; $this-render('index'); } } so this here will filter the posts depending on what the user clicked 'all', 'new', 'archive' But 'all' when clicked always returns the 'default_left' layout function filterByType($type = null) { if ($this-RequestHandler-isAjax()) { $this-paginate['Post'] = $this-Post-filterByTypePagination($this-auth_id, $this-rank, $type, $this-post_display); $this-set('posts', $this-paginate()); $this-layout = 'ajax'; $this-viewPath = 'elements/posts'; $this-render('paginate'); } else { $this-redirect(array('action' = 'index')); } } Cann someone point out where I am going wrong? I tried if ($this-RequestHandler-isAjax()) { //code for view $this-layout = 'ajax'; $this-viewPath = 'elements/posts'; $this-render(paginate'); } else { //code for view $this-layout = 'default_left'; $this-render('index'); } but same thing keeps happening. 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: Help with validation
I posted the code for the view, model, controller in a reply to my original. But I did get it all figured out. Thanks, Dave -Original Message- From: John Andersen [mailto:j.andersen...@gmail.com] Sent: October-20-09 3:03 AM To: CakePHP Subject: Re: Help with validation Please show the code that delivers the input data to the model, so that we may be convinced that the data you receive from the form is also the data sent to the model for validation :) Also possibly the view code for the form. Enjoy, John On Oct 19, 5:15 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I mean when I hit submit the form gets sent and comes back invalid but nothing is marked as invalid (even when I leave it completely empty). Then same page without refreshing or anything just hit submit on that same returned form it comes back with errors. Even if I have letters / numbers in the field it says Can not be empty. Just weird. Dave -Original Message- From: WebbedIT [mailto:p...@webbedit.co.uk] Sent: October-19-09 5:08 AM To: CakePHP Subject: Re: Help with validation Firstly, you are trying very simple validation so there must be something very simple wrong with it that's easily fixed when identified. Have you got validation working anywhere else in your app? When you say hit submit and nothing do you mean it shows the form again and is this because it has failed to validate? You maybe want to echo $this-validationErrors in your view to see what errors you are getting, it may be that you are getting the errors but something is up with the form field naming that is stopping the automagic working. In my controllers I personally go for the following approach rather than validating first as save does that for you. if($this-Model-save($this-data)) { // Validated and saved, save a flash message and redirect to desired page } else { // Failed, show form again with errors } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Admin Controller
Can you, or suggest , reasons for or not to create an admin_controller and keep all admin functions separate from the other controllers? 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: Admin Controller
Yeah the added model strain I figured as much. Low down on my problem. User has 5 HABTM relations. Normally you edit all the user info in 1 call admin_edit in user controller. But I have broken the info into sections for each HABTM, I managed to write 1 function that will updated each HABTM so that made the code cleaner, but the User has for 1 specific example has User.email, if they edit the email is suspends the account until they confirm thier email again. So I need a separate form for just that function so I now need 2 additional admin functions, 1 to call the form, and 1 to save it. Same with the Users-Profile contact info. Profile is made up of lots of fields but I want a user to edit say just the contact info fields I need a admin_edit_contact and admin_index_contact and all these exra functions are making agiant mess. Just tossing ideas around to cleanit up and more readable / manageable Thoughts on how to combat this? -Original Message- From: Jamie [mailto:jamie@gmail.com] Sent: October-20-09 1:39 PM To: CakePHP Subject: Re: Admin Controller I don't think you should put your admin functions in their own controller. First, having a separate admin controller means that, instead of just loading one primary model per controller, you'll be stuck handling a ton of models within that one controller, which could get messy and almost certainly inefficient. Also, instead of being able to name your functions admin_edit, admin_index, etc., you'll need unique names for each model - admin_users_edit, admin_pages_edit, etc. Or, you could just have one massive admin_edit function. Or, your admin_edit function could just call a bunch of other internal functions. Any way you look at it, though, it'll be messy (again). Basically, if you keep a model's admin functions in that model's controller, you'll always know what you're working with. Why do you want to separate the functions, anyway? If you're worried about duplicate code (e.g. ten identical admin_edit functions), you could move some of your common functions that are the same in every controller to AppController. I did this for admin_delete and admin_edit, as well as some other ones I wrote (admin_publish, admin_unpublish, etc.). My 'stock' admin_delete in AppController, for example, looks like this: function admin_delete($id = null) { if (!$id) { $this-Session-setFlash(__('Invalid id for ' . $this-modelClass, true)); $this-redirect($this-referer()); } if ($this-{$this-modelClass}-del($id)) { $this-Session-setFlash(__($this-modelClass . ' deleted', true)); $this-redirect($this-referer()); } } If I need extra functionality for a certian controller I can just define admin_edit() in that individual controller. But most of the time, it works just fine. Anyway, hope this helps you decide. - Jamie On Oct 20, 8:28 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Can you, or suggest , reasons for or not to create an admin_controller and keep all admin functions separate from the other controllers? 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: Where request comes from?
I was wondering if this makes sense: if ($this-RequestHandler-isAjax()) { $request_from = $this-RequestHandler-getReferrer(); if ($request_from != 'www.mysite.com'){ //if not from my site then do something //$this-Session-destroy(); //echo 'nice try'; //$this-redirect('see_ya_later.com'); //$this-render('nice_try'); } } I put it in app_controller beforeFilter so no Ajax requests can be called externaly. Does anyone see a problem doing this? Thanks, Dave -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: October-03-09 4:45 PM To: CakePHP Subject: Re: Where request comes from? I never said it would work with Ajax in the way your thinking, simply you can have the Security component enabled and the Ajax handler will work regardless if its on or not. Additionally, just check the referrer in the Ajax to see if it comes from your domain, you dont need the Security tokens because most Ajax calls wont be a full forms data. On Oct 3, 8:00 am, Martin Westin martin.westin...@gmail.com wrote: Looks like a handy Ajax handler Miles. But I can't see where it makes SecurityComponent work with Ajax. All I see is form security being disabled (lines 85-87). Making Ajax work with SecurityComponent would involve actually validating that an ajax post came from the correct form. As with session ids, the problem again is the asynchronous part of Ajax. The only half-secure alternative I find remotely practical is to set a hash as a global javascript variable on each real page load and store that in the session. On Ajax requests you let that hash stick around and you require ajax to pass that hash along each call. This would require the session and the last full page to be hijacked to be able to post data via Ajax. /Martin On Oct 2, 6:02 pm, Miles J mileswjohn...@gmail.com wrote: Well you can use my ajax handler, it wraps the security component so it works with AJAX calls. http://www.milesj.me/resources/script/ajax-handler-component On Oct 2, 7:12 am, Martin Westin martin.westin...@gmail.com wrote: You CAN... but it is painful to say the least. Since you can't have your cake and eat it ;) your best bet is to look inside the Security Component to see what parts you want to use and then put that into your own component, extend the core component or something like that. You can also look at the Security class but it does not offer any turn-key solutions for you. At the risk of being misinterpreted, I am tempted to say that you should not care where requests comes from. Either a request is a public request like /posts/display/123 or a protected action like / posts/delete/123. Where the request comes from has little relevance in the first case. In the second case it really has little relevance too since you will be much more concerned about a valid session identifying an authorized user, right? If your security model needs to include has been posted from exactly my form on my page then ajax should not be used for those requests. IMHO. /Martin On Oct 1, 11:05 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: But no good for AJAX. I have AJAX forms in my app so I cant use the security component. Can I? I know it wont work for AJAX submitted forms. I was just curious. Dave -Original Message- From: Martin Westin [mailto:martin.westin...@gmail.com] Sent: October-01-09 5:45 PM To: CakePHP Subject: Re: Where request comes from? The Security Component does this kind of thing for you. For example, it will embed a hash value into the form which is a checksum of the form. If a field is missing or added it will be captured. If a hidden value is modified this will also be captured. Also sessions will be more secure and a lot harder to hijack since the session id is replaced for each request. And a buch more stuff. /Martin On Oct 1, 9:36 pm, Bert Van den Brande cyr...@gmail.com wrote: I believe the FormHelper has some 'secure' stuff available for this ... best to consult the documentation ... On Thu, Oct 1, 2009 at 8:50 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Is there a way to determine / ensure that any requested action comes from the server? I mean more towards the aspect of forms. That when a form is submitted the request is coming from the site and not someone who made a form and trying to submit it to your site. Just curious Thanks
RE: Help with validation
I mean when I hit submit the form gets sent and comes back invalid but nothing is marked as invalid (even when I leave it completely empty). Then same page without refreshing or anything just hit submit on that same returned form it comes back with errors. Even if I have letters / numbers in the field it says Can not be empty. Just weird. Dave -Original Message- From: WebbedIT [mailto:p...@webbedit.co.uk] Sent: October-19-09 5:08 AM To: CakePHP Subject: Re: Help with validation Firstly, you are trying very simple validation so there must be something very simple wrong with it that's easily fixed when identified. Have you got validation working anywhere else in your app? When you say hit submit and nothing do you mean it shows the form again and is this because it has failed to validate? You maybe want to echo $this-validationErrors in your view to see what errors you are getting, it may be that you are getting the errors but something is up with the form field naming that is stopping the automagic working. In my controllers I personally go for the following approach rather than validating first as save does that for you. if($this-Model-save($this-data)) { // Validated and saved, save a flash message and redirect to desired page } else { // Failed, show form again with errors } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Validation Help - All code Included
This is driving me crazy. User Model: var $validate = array( 'username' = array( 'usernameRule-1' = array( 'rule' = array( 'notEmpty'), 'message' = 'Please choose a Username', 'required' = true, 'allowEmpty' = false, 'last' = true), 'usernameRule-2' = array( 'rule' = array( 'minLength', 8), 'message' = 'Username must be 8 characters or more', 'required' = true, 'allowEmpty' = false, 'last' = true) ) ); View: ?php echo $form-create('User', array('controller' = 'user', 'action' = 'registration'));? ?php echo $form-input('User.username');? ?php echo $form-end('Submit');? /div Controller: function registration() { if (!empty($this-data)) { if ($this-User-validates()) { $this-Session-setFlash('All valid.'); } else { $errors = $this-User-invalidFields(); debug($errors); $this-Session-setFlash('There was an error signing up. Please, try again.'); } } } I removed everything but 1 field. No matter what I enter all I get is Please choose a Username. Enter 100 characters and same message. $errors returns: I have abcdefghijklmnop as a username, more than 8, not emptydoes not matter what I enter it always the same thing. Array ( [username] = Please choose a Username ) Please someone, anyone letmeknow what I am doing wrong? Thanks 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: Validation Help - All code Included - Figured Out
I got it working. Dave -Original Message- From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com] Sent: October-19-09 2:16 PM To: cake-php@googlegroups.com Subject: Validation Help - All code Included This is driving me crazy. User Model: var $validate = array( 'username' = array( 'usernameRule-1' = array( 'rule' = array( 'notEmpty'), 'message' = 'Please choose a Username', 'required' = true, 'allowEmpty' = false, 'last' = true), 'usernameRule-2' = array( 'rule' = array( 'minLength', 8), 'message' = 'Username must be 8 characters or more', 'required' = true, 'allowEmpty' = false, 'last' = true) ) ); View: ?php echo $form-create('User', array('controller' = 'user', 'action' = 'registration'));? ?php echo $form-input('User.username');? ?php echo $form-end('Submit');? /div Controller: function registration() { if (!empty($this-data)) { if ($this-User-validates()) { $this-Session-setFlash('All valid.'); } else { $errors = $this-User-invalidFields(); debug($errors); $this-Session-setFlash('There was an error signing up. Please, try again.'); } } } I removed everything but 1 field. No matter what I enter all I get is Please choose a Username. Enter 100 characters and same message. $errors returns: I have abcdefghijklmnop as a username, more than 8, not emptydoes not matter what I enter it always the same thing. Array ( [username] = Please choose a Username ) Please someone, anyone letmeknow what I am doing wrong? Thanks 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 -~--~~~~--~~--~--~---
Regular Expression
I have 'rule' = '/^[a-zA-Z]$/', to allow only letter characters but it does not seem to be working. Is there something wrong with this expression? Thanks, 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: Regular Expression
Right on, I ended up using 'rule' = array('custom', '/^[A-Za-z ]+$/'), and that seems to work. Thanks, Dave _ From: Maximillian Schwanekamp [mailto:anaxama...@gmail.com] Sent: October-19-09 4:32 PM To: cake-php@googlegroups.com Subject: Re: Regular Expression On Oct 19, 2009, at 10:41 AM, Dave Maharaj :: WidePixels.com wrote: I have 'rule' = '/^[a-zA-Z]$/', to allow only letter characters but it does not seem to be working. Is there something wrong with this expression? I think you need to specify how many characters you need. E.g. /^[a-zA-Z]+$/ for at least one alpha char. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Model Controller Question
I have my User which has 5 HABTM relations. Now normally all the HABTM info is displayed in User/edit after a normal bake. My question is, because I am setting it up so the User can edit each HABTM selection individually rather than the standard User/edit can i put the action / functions in each respective model /controller? For example: User HABTM Tools Is it possible to have the user/edit/tools in the tools controller/model? Not to edit the actual tools but to make selections from? I have them all in my User controller and its just a massive controller with all these functions in there. Just wondering if there would be a cleaner way to focus on each section rather than dumping them all into the User controller / Model. Thanks. 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 -~--~~~~--~~--~--~---
Help with validation
No matter what I try I cant get validation to work properly. (i am only trying to get it working so please no comments about numbers in a firstname :) simple validation on 1 field: 'firstname' = array( 'firstnameRule-1' = array( 'rule' = 'alphaNumeric', 'message' = 'Only alphabets and numbers allowed', 'required' = true, 'last' = true), 'firstnameRule-2' = array( 'rule' = array('minLength', 8), 'message' = 'Minimum length of 8 characters', 'last' = true), 'firstnameRule-3' = array( 'rule' = 'notEmpty', 'message' = 'Please enter your first name.', 'last' = true), ), When the page renders Firstname: is bold as its required. Hit submit and nothing...hit submit again(without refreshing the page) and then Only alphabets and numbers allowed. I tried if $this-user-validates(); save($this-data, true $fields) but nothing seems to be going as planned. What am i doing wrong here? Thanks, 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: Check Valid
Yeah I thought maybe it had to do with my query and the contain. Maybe if its just a straight model request. Will try something else or go back to my extra request. Thanks, Dave -Original Message- From: John Andersen [mailto:j.andersen...@gmail.com] Sent: October-17-09 4:27 AM To: CakePHP Subject: Re: Check Valid Hi Dave, Just tried it myself! It turns out that getNumRows() only works when there are no recursion! As soon as recursive is set to other than -1 or 0, the getNumRows() uses the wrong mysql resultset, returning the wrong number. So it turns out you can't use it in your case! The same applies to the other method, getAffectedRows(). Enjoy, John On Oct 17, 2:36 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Ok I am trying the getNumRows(); I have my query which has this in the sql debug at the bottom of the page WHERE `Post`.`id` = '34rfgn' AND `Post`.`rank` = 2 AND `Post`.`status` = 0 with Affected Num. rows Took (ms) beside the query 1 1 0 $post = $this-Post-getPostInfo($job_id, $this-Auth-user('id'), $rank); $affected = $this-Post-getNumRows(); debug($affected); returns zero? What am I doing wrong? Is the getNumRows() set up right? My test user can only view 1 Post. (that post os a 0 rank) I have 100 dummy posts with different ranks and for testing purposes ths user has the highest access lever so he should be able to see everything. Post.rank can be 0,1, or 2 this User has rank of 2 so it should work. It query has not changed as I ran my checkValid() but decided to go with the getNumRows to eliminate the extra query. Thanks, Dave -Original Message- From: John Andersen [mailto:j.andersen...@gmail.com] Sent: October-16-09 3:43 AM To: CakePHP Subject: Re: Check Valid That may be, but it seems to me that you then are performing two queries for each need to retrieve a record, first to ask if there is any records, and then to ask for the records! (Maybe I am wrong here!!) I think that querying for the records, checking for the number retrieved, should be the optimal way :) Then always pass the number to the view, and let the view show some message for the user to stop messing around :D or some kinder message like No information found. Enjoy, John On Oct 16, 9:03 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: There is another that I found. Model::hasAny Returns true if a record that meets given conditions exists. function hasAny($conditions = null) { return ($this-find('count', array('conditions' = $conditions, 'recursive' = -1)) != false); } Which I guess is pretty much the same as my validPost($id) except cleaner. public function validPost($id) { $valid = false; $params = array( 'contain' = false, 'conditions' = array( 'Post.id' = $id), 'fields' = array( 'Post.id')); $q = $this-find('first', $params); if (!empty($q)) { $valid = true; } return $valid; } Dave -Original Message- From: John Andersen [mailto:j.andersen...@gmail.com] Sent: October-16-09 2:57 AM To: CakePHP Subject: Re: Check Valid I think you can use the models method getNumRows() which returns the number of rows returned in the last query! Enjoy, John On Oct 16, 12:19 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: If you have posts 1, 2, and 3 for example and you type in view/4 and there is no 4 the page still renders but it has no data. How can you prevent this ? I have if ($this-Post-validPost($id) == true) { which checks the DB for that id if found then do as normal } else { return them back to index } Is there an easier way to do that that i over looked? Thanks, 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: Check Valid
There is another that I found. Model::hasAny Returns true if a record that meets given conditions exists. function hasAny($conditions = null) { return ($this-find('count', array('conditions' = $conditions, 'recursive' = -1)) != false); } Which I guess is pretty much the same as my validPost($id) except cleaner. public function validPost($id) { $valid = false; $params = array( 'contain' = false, 'conditions' = array( 'Post.id' = $id), 'fields' = array( 'Post.id')); $q = $this-find('first', $params); if (!empty($q)) { $valid = true; } return $valid; } Dave -Original Message- From: John Andersen [mailto:j.andersen...@gmail.com] Sent: October-16-09 2:57 AM To: CakePHP Subject: Re: Check Valid I think you can use the models method getNumRows() which returns the number of rows returned in the last query! Enjoy, John On Oct 16, 12:19 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: If you have posts 1, 2, and 3 for example and you type in view/4 and there is no 4 the page still renders but it has no data. How can you prevent this ? I have if ($this-Post-validPost($id) == true) { which checks the DB for that id if found then do as normal } else { return them back to index } Is there an easier way to do that that i over looked? Thanks, 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: Check Valid
Very right! Will give the getNumRows() a try andsee how it goes. Thanks again. Dave -Original Message- From: John Andersen [mailto:j.andersen...@gmail.com] Sent: October-16-09 3:43 AM To: CakePHP Subject: Re: Check Valid That may be, but it seems to me that you then are performing two queries for each need to retrieve a record, first to ask if there is any records, and then to ask for the records! (Maybe I am wrong here!!) I think that querying for the records, checking for the number retrieved, should be the optimal way :) Then always pass the number to the view, and let the view show some message for the user to stop messing around :D or some kinder message like No information found. Enjoy, John On Oct 16, 9:03 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: There is another that I found. Model::hasAny Returns true if a record that meets given conditions exists. function hasAny($conditions = null) { return ($this-find('count', array('conditions' = $conditions, 'recursive' = -1)) != false); } Which I guess is pretty much the same as my validPost($id) except cleaner. public function validPost($id) { $valid = false; $params = array( 'contain' = false, 'conditions' = array( 'Post.id' = $id), 'fields' = array( 'Post.id')); $q = $this-find('first', $params); if (!empty($q)) { $valid = true; } return $valid; } Dave -Original Message- From: John Andersen [mailto:j.andersen...@gmail.com] Sent: October-16-09 2:57 AM To: CakePHP Subject: Re: Check Valid I think you can use the models method getNumRows() which returns the number of rows returned in the last query! Enjoy, John On Oct 16, 12:19 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: If you have posts 1, 2, and 3 for example and you type in view/4 and there is no 4 the page still renders but it has no data. How can you prevent this ? I have if ($this-Post-validPost($id) == true) { which checks the DB for that id if found then do as normal } else { return them back to index } Is there an easier way to do that that i over looked? Thanks, 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: Check Valid
Ok I am trying the getNumRows(); I have my query which has this in the sql debug at the bottom of the page WHERE `Post`.`id` = '34rfgn' AND `Post`.`rank` = 2 AND `Post`.`status` = 0 with AffectedNum. rows Took (ms) beside the query 1 1 0 $post = $this-Post-getPostInfo($job_id, $this-Auth-user('id'), $rank); $affected = $this-Post-getNumRows(); debug($affected); returns zero? What am I doing wrong? Is the getNumRows() set up right? My test user can only view 1 Post. (that post os a 0 rank) I have 100 dummy posts with different ranks and for testing purposes ths user has the highest access lever so he should be able to see everything. Post.rank can be 0,1, or 2 this User has rank of 2 so it should work. It query has not changed as I ran my checkValid() but decided to go with the getNumRows to eliminate the extra query. Thanks, Dave -Original Message- From: John Andersen [mailto:j.andersen...@gmail.com] Sent: October-16-09 3:43 AM To: CakePHP Subject: Re: Check Valid That may be, but it seems to me that you then are performing two queries for each need to retrieve a record, first to ask if there is any records, and then to ask for the records! (Maybe I am wrong here!!) I think that querying for the records, checking for the number retrieved, should be the optimal way :) Then always pass the number to the view, and let the view show some message for the user to stop messing around :D or some kinder message like No information found. Enjoy, John On Oct 16, 9:03 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: There is another that I found. Model::hasAny Returns true if a record that meets given conditions exists. function hasAny($conditions = null) { return ($this-find('count', array('conditions' = $conditions, 'recursive' = -1)) != false); } Which I guess is pretty much the same as my validPost($id) except cleaner. public function validPost($id) { $valid = false; $params = array( 'contain' = false, 'conditions' = array( 'Post.id' = $id), 'fields' = array( 'Post.id')); $q = $this-find('first', $params); if (!empty($q)) { $valid = true; } return $valid; } Dave -Original Message- From: John Andersen [mailto:j.andersen...@gmail.com] Sent: October-16-09 2:57 AM To: CakePHP Subject: Re: Check Valid I think you can use the models method getNumRows() which returns the number of rows returned in the last query! Enjoy, John On Oct 16, 12:19 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: If you have posts 1, 2, and 3 for example and you type in view/4 and there is no 4 the page still renders but it has no data. How can you prevent this ? I have if ($this-Post-validPost($id) == true) { which checks the DB for that id if found then do as normal } else { return them back to index } Is there an easier way to do that that i over looked? Thanks, 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 -~--~~~~--~~--~--~---
Check Valid
If you have posts 1, 2, and 3 for example and you type in view/4 and there is no 4 the page still renders but it has no data. How can you prevent this ? I have if ($this-Post-validPost($id) == true) { which checks the DB for that id if found then do as normal } else { return them back to index } Is there an easier way to do that that i over looked? Thanks, 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 -~--~~~~--~~--~--~---
beforeRender / filter
How can i access session data in beforeRender or before Filter? i have $display = $this-Session-read('Auth.User.display'); and i have that all over the controller. Is there a way i can define that in a before function and access it from there instead of that long snip allover? I tried function beforeRender() { $display = $this-Session-read('Auth.User.display'); } or function beforeFilter() { $display = $this-Session-read('Auth.User.display'); } and in the controller $display comes up invalid variable 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: beforeRender / filter
Thanks for the info guys. Basically the idea is a User has a preference represented by a field in the table 'display' and they can select it as an option so in the site to either display or not display their information. Its only used in 1 controller but will try them out and see what works best. Thanks, Dave -Original Message- From: O.J. Tibi [mailto:ojt...@gmail.com] Sent: October-16-09 3:20 AM To: CakePHP Subject: Re: beforeRender / filter On that point, may what you want to do is declare $display as a class member (just inside your controller class, not inside a method/action/ callback) like so: var $_display; and when you need to set it: $this-_display = $this-Auth-user('display'); Take note I used the Auth component as it is more concise and fits the purpose of the code. Now, if you want to get or test its value: if ($this-_display) { // do something here } Cheers, OJ On Oct 16, 12:55 pm, Miles J mileswjohn...@gmail.com wrote: You cant set a variable within a function and expect it to be usable again somewhere else. Variables defined in functions are restricted to the functions scope. You have to set it to the object. $this-display = $this-Session-read('Auth.User.display'); On Oct 15, 8:20 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: How can i access session data in beforeRender or before Filter? i have $display = $this-Session-read('Auth.User.display'); and i have that all over the controller. Is there a way i can define that in a before function and access it from there instead of that long snip allover? I tried function beforeRender() { $display = $this-Session-read('Auth.User.display'); } or function beforeFilter() { $display = $this-Session-read('Auth.User.display'); } and in the controller $display comes up invalid variable 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 -~--~~~~--~~--~--~---
Fatal error: BehaviorCollection::trigger()
Anyone seen this? The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition 'ValidationBehavior' of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition It suddenly appears and not sure whats causing it? Controller? Model? Javascript? Any ideas where to start looking 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: Debug Error?
Nothing out of the ordinary. No there was none (Debugger::log(), Debugger::dump() anything like that added anywhere) Just the data sent back from the controller. Just weird how nothing was reported when debug was set to 1 or 2 but at 0 it just died. I just cleared the entire view and rebuilding it. And checking line by line to see where / if it break again. Thanks, Dave -Original Message- From: brian [mailto:bally.z...@gmail.com] Sent: October-14-09 1:54 PM To: cake-php@googlegroups.com Subject: Re: Debug Error? On Tue, Oct 13, 2009 at 4:16 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I ran a find and replace for all debug(); Still same thing. I meant the Debugger class, not debug(). Like Debugger::log(), Debugger::dump(), etc. If Configure's debug setting is 0 you'll get a fatal error if you have any code like that. So I stripped out the view file and it works now so Yeah looks like something in the actual view file was killing it. You didn't see anything suspicious in the view? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Refresh page on login / out
I have a login module on the side of each page if not logged in. Problem is when a user logs in or out from the home page which is the $this-Auth-loginRedirect and $this-Auth-logoutRedirect it still shows logged in or login. How can i refresh the page or something so the page updates correctly? If i manually refresh the page the correct look is there but that's not going to work in a live environment. Ideas how to fix this? 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: Session / Security
Thanks for the links I am on shared hosted server and found when reading If the cookie's path is set to '/' (the whole domain), then any website on the same domain (might be lots of websites) _will_ get the cookie through HTTP headers and could possibly hijack your session. How can this be avoided in this a situation with shared hosting or not? I have Webroot/ public_html/ /app1 /app2 Dave -Original Message- From: mark_story [mailto:mark.st...@gmail.com] Sent: October-04-09 1:57 PM To: CakePHP Subject: Re: Session / Security You also should read up on Session Fixation, Session hijacking, and http://en.wikipedia.org/wiki/Session_fixation http://en.wikipedia.org/wiki/Session_hijacking Which kind of reference each other but you get the idea. -Mark On Oct 3, 5:39 pm, Bert Van den Brande cyr...@gmail.com wrote: You might want to read this :http://be2.php.net/manual/en/session.security.php On Sat, Oct 3, 2009 at 11:35 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Right on. In my app nothing is passed in the url all my non-private areas are like /manage/profile or /manage/account as everything related to the user is obtained by auth ID of the logged in user and getting the info based on that. So i was just wondering if someone did get the session, how would they do it and ways to prevent it. Thanks Dave -- *From:* Bert Van den Brande [mailto:cyr...@gmail.com] *Sent:* October-03-09 6:40 PM *To:* cake-php@googlegroups.com *Subject:* Re: Session / Security I'm no expert on the subject, but I think session can be hijacked by : * 'stealing' a sessions id from the url. This is only possible if the user browser doesn't use cookies so the session id is visible in the url * stealing a session cookie In either cases, logging the user's ip would increase security imho. I'm interested in other opinions :) On Sat, Oct 3, 2009 at 10:08 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Not quite sure how this works but how does one steal a session? I have my session info stored in the database... if i added ip to the session so it also checks that the session ip matches the user ip would that increase the session sucurity? What a safe guards / good practsise to secure session data? Thanks 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: Session / Security
Hey AD, Maybe (probably) I am lost on what I read. I have my domain on a non dedicated hosting platform. But the only thing in my domain is my site. I thought what I read about If the cookie's path is set to '/' (the whole domain), then any website on the same domain (might be lots of websites) _will_ get the cookie through HTTP headers and could possibly hijack your session. Are thy referring to the server domain or my domain? My understanding is shared hosting all points to specific ips for that host and then they serve up the domain the user requested. So when someone requests my site they go to 123.123.12.12 for example and they send back my site to the user. The cookie set to '/' is that for mysite.com or 123.123.12.12. Maybe just lost n the trasnlation. Thanks, Dave -Original Message- From: AD7six [mailto:andydawso...@gmail.com] Sent: October-13-09 11:24 AM To: CakePHP Subject: Re: Session / Security On 13 oct, 15:48, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Thanks for the links I am on shared hosted server and found when reading If the cookie's path is set to '/' (the whole domain), then any website on the same domain (might be lots of websites) _will_ get the cookie through HTTP headers and could possibly hijack your session. How can this be avoided in this a situation with shared hosting or not? in what way is using shared hosting relevant to that question, you plan on/are sharing the same domain with servers/people you don't know? AD --~--~-~--~~~---~--~~ 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: Session / Security
Ok that’s all I wanted to know. Thanks. -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: October-13-09 1:40 PM To: CakePHP Subject: Re: Session / Security It only applies to the domain (name.com) not the whole shared vhosts grid server. On Oct 13, 8:42 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Hey AD, Maybe (probably) I am lost on what I read. I have my domain on a non dedicated hosting platform. But the only thing in my domain is my site. I thought what I read about If the cookie's path is set to '/' (the whole domain), then any website on the same domain (might be lots of websites) _will_ get the cookie through HTTP headers and could possibly hijack your session. Are thy referring to the server domain or my domain? My understanding is shared hosting all points to specific ips for that host and then they serve up the domain the user requested. So when someone requests my site they go to 123.123.12.12 for example and they send back my site to the user. The cookie set to '/' is that for mysite.com or 123.123.12.12. Maybe just lost n the trasnlation. Thanks, Dave -Original Message- From: AD7six [mailto:andydawso...@gmail.com] Sent: October-13-09 11:24 AM To: CakePHP Subject: Re: Session / Security On 13 oct, 15:48, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Thanks for the links I am on shared hosted server and found when reading If the cookie's path is set to '/' (the whole domain), then any website on the same domain (might be lots of websites) _will_ get the cookie through HTTP headers and could possibly hijack your session. How can this be avoided in this a situation with shared hosting or not? in what way is using shared hosting relevant to that question, you plan on/are sharing the same domain with servers/people you don't know? AD --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Debug Error?
I have one page that is blank when i turn debug to 0. Every page on the site works except the one. Set debug to 1 or 2 and i can access the page. But there are no errors reported anywhere, view is normal with all the info i need showing up. All that gets rendered with debug 0 is !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; charset=utf-8 /title Development: Teting/title link href=/favicon.ico type=image/x-icon rel=icon / type=image/x-icon rel=shortcut icon / Not sure where to go from here...there is obviously an error but how to find it when it works with debug on and no errors? 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: Debug Error! Makes no sense!
I stripped out the controller function leaving it like this function view($id) { $this-layout = 'default_right'; $this-set('reports', $this-Report-read(null, $id)); } And it still will not work. So comment out //$this-layout = 'default_right'; and it works. Makes no sense , the $this-layout = 'default_right'; is simple HTML and works on every other page on the site If i completely remove $this-layout the page loads using the default layout. Which is no good to me in this case. Even if I enter $this-layout = 'default'; it breaks once again default_right.ctp (just body to body..rest is regular baked template) body div id=wrap div id=header ?php echo $this-element('top_nav'); ? /div div id=content div id=left_side ?php echo $sidebar-getSidebar(); ?/div div id=right_full?php echo $content_for_layout; ?/div div class=clear/div /div /div div id=footer/div ?php echo $cakeDebug; ? ?php pr($_SESSION); ? /body Anyone have any idea where to start on this one? Thanks 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: Debug Error?
I ran a find and replace for all debug(); Still same thing. So I stripped out the view file and it works now so Yeah looks like something in the actual view file was killing it. Thanks, Dave -Original Message- From: brian [mailto:bally.z...@gmail.com] Sent: October-13-09 4:18 PM To: cake-php@googlegroups.com Subject: Re: Debug Error? What do you have in the layout file immediately after that? Also, do you have any code using Debugger class anywhere? That'll kill your app if debug is set to 0. On Tue, Oct 13, 2009 at 1:45 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I have one page that is blank when i turn debug to 0. Every page on the site works except the one. Set debug to 1 or 2 and i can access the page. But there are no errors reported anywhere, view is normal with all the info i need showing up. All that gets rendered with debug 0 is !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; charset=utf-8 /title Development: Teting/title link href=/favicon.ico type=image/x-icon rel=icon / type=image/x-icon rel=shortcut icon / Not sure where to go from here...there is obviously an error but how to find it when it works with debug on and no errors? 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 -~--~~~~--~~--~--~---
Help with advanced setup
I am trying to re-arrange the folders on the server I would like to place cake folder outside www directory i have: /cake /public_html /www(all public viewable files) /mysite /app /webroot index.php: Can someone point out what the corect structure would be? if (!defined('ROOT')) { define('ROOT', DS.'www.'.DS.'mysite.'); } /** * The actual directory name for the app. * */ if (!defined('APP_DIR')) { define('APP_DIR', 'app'); } /** * The absolute path to the cake directory, WITHOUT a trailing DS. * */ if (!defined('CAKE_CORE_INCLUDE_PATH')) { define('CAKE_CORE_INCLUDE_PATH', ROOT); } Thanks 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 -~--~~~~--~~--~--~---
Defining URL
How can you drop index off the url? li?php echo $html-link('Experience', array('controller' = 'experiences', 'action' = null, 'manage' =true));?/li Tried with null, '', or removing action completely but still shows manage/experiences/index Thanks 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: Defining URL
But when I hardcode it (not so cake-way) like this it works fine. li?php echo $html-link('Experience', '/manage/experiences/'); ?/li I just thought it could be done like a standard array(controller action) -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: October-12-09 4:31 PM To: CakePHP Subject: Re: Defining URL Well if you are using a prefix or a plugin, index is required to determine the correct route, else it will fail. On Oct 12, 11:28 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: How can you drop index off the url? li?php echo $html-link('Experience', array('controller' = 'experiences', 'action' = null, 'manage' =true));?/li Tried with null, '', or removing action completely but still shows manage/experiences/index Thanks 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: Defining URL
Yep that works perfect. Thanks man. Dave -Original Message- From: brian [mailto:bally.z...@gmail.com] Sent: October-12-09 5:28 PM To: cake-php@googlegroups.com Subject: Re: Defining URL Create a route for it: Router::connect( '/manage/experiences/', array('controller' = 'experiences', 'action' = 'index', 'manage' =true) ); $html-link('Experience', array('controller' = 'experiences', 'action' = 'index', 'manage' =true)); On Mon, Oct 12, 2009 at 3:05 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: But when I hardcode it (not so cake-way) like this it works fine. li?php echo $html-link('Experience', '/manage/experiences/'); ?/li I just thought it could be done like a standard array(controller action) -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: October-12-09 4:31 PM To: CakePHP Subject: Re: Defining URL Well if you are using a prefix or a plugin, index is required to determine the correct route, else it will fail. On Oct 12, 11:28 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: How can you drop index off the url? li?php echo $html-link('Experience', array('controller' = 'experiences', 'action' = null, 'manage' =true));?/li Tried with null, '', or removing action completely but still shows manage/experiences/index Thanks 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 -~--~~~~--~~--~--~---
Cookie Question
Just hoping for a little info here. I view my cookie set on my site and see content : 0444539fe23155487eb458458d7ef40f I have not written anything to it.But was wondering what would this info be? I know if i delete the cookie i get logged out of my site so some auth info is in there. But what other info might be in there if i have not added anything to it myself? Thanks, 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: Ajax Update Help
Something like this: $('#GaragePartAddfrompartlistForm').bind('submit', function() { var queryString = $('#GaragePartAddfrompartlistForm').formSerialize(); $(this).ajaxSubmit({ //beforeSubmit: validate, type: 'post', url: '/where/you/send/the/form', data: queryString, target: '#IWantToUpdateThis', //beforeSubmit: preSend, function before you sent but after submit //success: afterEffects, function after sent success }); return false; }); Target is the DIV id you want to update, Hope that gets you started. Dave -Original Message- From: hahmadi82 [mailto:hahmad...@gmail.com] Sent: October-11-09 5:46 AM To: cake-php@googlegroups.com Subject: Re: Ajax Update Help Can anyone please help me with this? hahmadi82 wrote: Hi, I have a question about how to get a div to update after an ajax form submission. I have a file index.ctp which displays a list of parts. When you click on add part, I use: $('a.js-ajax').live('click', function() { $('#ajax-test').load( $(this).attr('href'), function () { $(this).fadeIn(300); }); return false; }); to load addpart.ctp into index.ctp via ajax. The addpart.ctp file has a cake FormHelper form and I use: $(document).ready(function() { $('#GaragePartAddfrompartlistForm').ajaxForm(function() { alert(Part Added!); }); }); to submit that form via ajax/Jquery Form Plugin (http://malsup.com/jquery/form/). So inside index.ctp, the part is added with ajax (not causing page to reload) however, I have no idea how to get ajax to update the part list div inside my indext.ctp after addpart.ctp is loaded and submitted. Can someone please describe the best strategy for this? Please note that the part list div has a lot of php in it and its imperative I reconstruct the div with the php code. I was hoping to dynamically show the part list, with the new part, without reloading the page. Any help would be much appreciated. Thanks. -- View this message in context: http://www.nabble.com/Ajax-Update-Help-tp25812512p25841483.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Cache question
I have an element that when the user logs in says Welcome Test Account One (being my dummy user's name) I logout and login as a different user and it shows Welcome Test Account One until i hit refresh then it shows Test Account Two I have wrapped the element in a cake:nocache/cake:nocache block. Logout destroy session but same thing. It always shows the last logged in user info until i hit refresh. Same thing happens on the site where i delete a post, after succesful delete i redirect back to the page where i was deleting the post and its still there until i refresh. And it to is wrapped in a no cache block. Any ideas why? How to avoid this? Thanks, 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: Cache question
Firefox believe it or not. -Original Message- From: euromark (munich) [mailto:dereurom...@googlemail.com] Sent: October-11-09 2:15 PM To: CakePHP Subject: Re: Cache question did you experience that in the almighty crap-explorer IE? On 11 Okt., 18:33, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I have an element that when the user logs in says Welcome Test Account One (being my dummy user's name) I logout and login as a different user and it shows Welcome Test Account One until i hit refresh then it shows Test Account Two I have wrapped the element in a cake:nocache/cake:nocache block. Logout destroy session but same thing. It always shows the last logged in user info until i hit refresh. Same thing happens on the site where i delete a post, after succesful delete i redirect back to the page where i was deleting the post and its still there until i refresh. And it to is wrapped in a no cache block. Any ideas why? How to avoid this? Thanks, 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 -~--~~~~--~~--~--~---
Delay?
Not sure if this is even possible. Looked everywhere and tried many different things but still no luck. I am editing an image using jCrop, sumbit the request AJAX and the plan is to have the thumbnail update with the newly edited version. I have it all running fine except when i submit the form data its processed faster than the image editing. So the returned updated image is the same one that was there before. The form sends the info and says ok return the ajax view now but its getting the original image because I guess the new one has not been processed yet or still in the process. I have tried delaying the form but that does nothing, tried deleteing the old image from the server then replace it with the newly edited one, nocache. Does anyone have any ideas that i have not tried? Thanks 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 -~--~~~~--~~--~--~---
Clean Pagination
I hate all the pagination params in the controller so I did this To paginate all active users for an example controller: $this-paginate['User'] = $this-User-userPagination(); $this-set('users', $this-paginate('User', array('User.id' = $this-User-getActiveUsers(; model: Build pagination as normal: function userPagination() { $params = array( 'fields' = array( 'User.id', 'User.name', 'User.city'), 'limit' = 20, 'order' = array( 'User.name DESC'), 'contain' = array( 'State' = array( 'fields' = array('State.abrev')), 'Country' = array( 'fields' = array('Country.name'; return $params; } public function getActiveUsers() //this fetches all Users who have been admin approved { $params = array( 'conditions' = array( 'User.status' = '1'), 'fields' = array( 'User.id'), 'contain' = false); $q = $this-find('all', $params); //create an array of User.id's to pass to paginate $active = array(); //return only the id foreach ($q as $active_user) { array_push($active, $active_user['User']['id']); } return $active; } Has anyone found a cleaner or easier way to do this? I needed to paginate different sets in the same model and the configuration was driving me crazy so this way I found I can have different paginations for the same model with different params. getActiveUsers() usersByCountry($country_id) and so on 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: Use Set::sort
Try sort(); or another standard php sorting function. http://ca3.php.net/manual/en/function.sort.php -Original Message- From: albe [mailto:radialremo...@gmail.com] Sent: October-10-09 11:45 AM To: CakePHP Subject: Re: Use Set::sort Ok I have found the answer: in my cakephp version there's no sort function in the set class! How can I sort my array otherwise? Unfortunately I CAN'T update the cakePHP version for this specific job. On 10 Ott, 15:25, albe radialremo...@gmail.com wrote: Hi, I have to sort an array and I have found out this simple way: http://blogs.bigfish.tv/adam/2008/03/24/sorting-with-setsort-in-cakep... Unfortunately, when I put the sorting code in my apllication's got I got: Fatal error: Call to undefined method Set::sort() in C:\... \controller.php on line 818 Maybe the use of the Set class has to be declared... where? Thank you in advance! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Error question
Not sure if its a cake thing or not but maybe someone has seen this error somewhere along the way. In Firefox i see Warning: Expected ',' or '{' but found 'li'. But its on every page i go to and line 0. Any thoughts? 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 -~--~~~~--~~--~--~---
JS / CSS Compression
I have the asset helper up and running. Check y-slow and everything gets an A except Grade C on Compress components with gzip There are 2 plain text components that should be sent compressed * /styles_typography_125509.css * jquery_jqueryform_ofl_125509.js Apache 2.x uses mod_deflate. The htaccess is bits from all over from reading so maybe there is a problem in there somewhere? I check the y-slow Statistics: Empty Cache HTTP Requests - 14 Total Weight - 143.9K Primed Cache HTTP Requests - 2 Total Weight - 2.2K Looks like the scripts are not being cached either? my /webroot/htaccess: IfModule mod_deflate.c # compress content with type html, text, and css AddOutputFilterByType AddOutputFilterByType DEFLATE text/html text/plain text/xml IfModule mod_headers.c # properly handle requests coming from behind proxies Header append Vary User-Agent /IfModule /IfModule IfModule mod_expires.c ExpiresActive On ExpiresByType text/css access plus 10 years ExpiresByType text/js access plus 10 years ExpiresByType text/javascript access plus 10 years ExpiresByType application/x-javascript access plus 10 years ExpiresByType application/javascript access plus 10 years ExpiresByType image/png access plus 10 years ExpiresByType image/gif access plus 10 years ExpiresByType image/jpeg access plus 10 years /IfModule FileETag none Not sure why its not zipping these 2. Any ideas or help would be great. Thanks 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: JS / CSS Compression
Could you explain doing it the cake way? Cake combines the scripts just fine. but after that? -Original Message- From: robust solution [mailto:i...@robustsolution.net] Sent: October-09-09 12:20 PM To: CakePHP Subject: Re: JS / CSS Compression Dear Dave, What I recommend you is to never rely on apache, do it the cake way...please it is too easy On Oct 9, 5:41 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I have the asset helper up and running. Check y-slow and everything gets an A except Grade C on Compress components with gzip There are 2 plain text components that should be sent compressed * /styles_typography_125509.css * jquery_jqueryform_ofl_125509.js Apache 2.x uses mod_deflate. The htaccess is bits from all over from reading so maybe there is a problem in there somewhere? I check the y-slow Statistics: Empty Cache HTTP Requests - 14 Total Weight - 143.9K Primed Cache HTTP Requests - 2 Total Weight - 2.2K Looks like the scripts are not being cached either? my /webroot/htaccess: IfModule mod_deflate.c # compress content with type html, text, and css AddOutputFilterByType AddOutputFilterByType DEFLATE text/html text/plain text/xml IfModule mod_headers.c # properly handle requests coming from behind proxies Header append Vary User-Agent /IfModule /IfModule IfModule mod_expires.c ExpiresActive On ExpiresByType text/css access plus 10 years ExpiresByType text/js access plus 10 years ExpiresByType text/javascript access plus 10 years ExpiresByType application/x-javascript access plus 10 years ExpiresByType application/javascript access plus 10 years ExpiresByType image/png access plus 10 years ExpiresByType image/gif access plus 10 years ExpiresByType image/jpeg access plus 10 years /IfModule FileETag none Not sure why its not zipping these 2. Any ideas or help would be great. Thanks 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: JS / CSS Compression
I see this Response Headers DateFri, 09 Oct 2009 19:26:11 GMT Server Apache/2.2.13 (Unix) mod_ssl/2.2.13 OpenSSL/0.9.8k DAV/2 mod_auth_passthrough/2.1 FrontPage/5.0.2.2635 X-Powered-ByPHP/5.2.9 Cache-Control must-revalidate Accept-Encoding gzip, deflate Expires Fri, 09 Oct 2009 19:26:10 GMT P3P CP=NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM Content-Encodinggzip VaryAccept-Encoding Keep-Alive timeout=10, max=30 Connection Keep-Alive Transfer-Encoding chunked Content-Typetext/html; charset: UTF-8 -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: October-09-09 4:40 PM To: CakePHP Subject: Re: JS / CSS Compression Well look at your request/response headers. Is gzip compression even working? On Oct 9, 11:34 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Could you explain doing it the cake way? Cake combines the scripts just fine. but after that? -Original Message- From: robust solution [mailto:i...@robustsolution.net] Sent: October-09-09 12:20 PM To: CakePHP Subject: Re: JS / CSS Compression Dear Dave, What I recommend you is to never rely on apache, do it the cake way...please it is too easy On Oct 9, 5:41 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I have the asset helper up and running. Check y-slow and everything gets an A except Grade C on Compress components with gzip There are 2 plain text components that should be sent compressed * /styles_typography_125509.css * jquery_jqueryform_ofl_125509.js Apache 2.x uses mod_deflate. The htaccess is bits from all over from reading so maybe there is a problem in there somewhere? I check the y-slow Statistics: Empty Cache HTTP Requests - 14 Total Weight - 143.9K Primed Cache HTTP Requests - 2 Total Weight - 2.2K Looks like the scripts are not being cached either? my /webroot/htaccess: IfModule mod_deflate.c # compress content with type html, text, and css AddOutputFilterByType AddOutputFilterByType DEFLATE text/html text/plain text/xml IfModule mod_headers.c # properly handle requests coming from behind proxies Header append Vary User-Agent /IfModule /IfModule IfModule mod_expires.c ExpiresActive On ExpiresByType text/css access plus 10 years ExpiresByType text/js access plus 10 years ExpiresByType text/javascript access plus 10 years ExpiresByType application/x-javascript access plus 10 years ExpiresByType application/javascript access plus 10 years ExpiresByType image/png access plus 10 years ExpiresByType image/gif access plus 10 years ExpiresByType image/jpeg access plus 10 years /IfModule FileETag none Not sure why its not zipping these 2. Any ideas or help would be great. Thanks 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: JS / CSS Compression
Nope still no luck. But with htaccess files thruout the site...which one should I be editing I guess I should have asked first. Same message: Grade C on Compress components with gzip There are 2 plain text components that should be sent compressed * css/min/styles_typography_125509.css * js/min/jquery_jqueryform_ofl_125509.js I have changed my htaccess to: # BEGIN Compress text files IfModule mod_deflate.c FilesMatch \.(css|js|x?html?|php)$ SetOutputFilter DEFLATE /FilesMatch /IfModule # END Compress text files # BEGIN Expire headers IfModule mod_expires.c ExpiresActive On ExpiresDefault access plus 1 seconds ExpiresByType image/x-icon access plus 2592000 seconds ExpiresByType image/jpeg access plus 2592000 seconds ExpiresByType image/png access plus 2592000 seconds ExpiresByType image/gif access plus 2592000 seconds ExpiresByType application/x-shockwave-flash access plus 2592000 seconds ExpiresByType text/css access plus 604800 seconds ExpiresByType text/javascript access plus 216000 seconds ExpiresByType application/x-javascript access plus 216000 seconds ExpiresByType text/html access plus 600 seconds ExpiresByType application/xhtml+xml access plus 600 seconds /IfModule # END Expire headers # BEGIN Cache-Control Headers IfModule mod_headers.c FilesMatch \\.(ico|jpe?g|png|gif|swf)$ Header set Cache-Control max-age=2592000, public /FilesMatch FilesMatch \\.(css)$ Header set Cache-Control max-age=604800, public /FilesMatch FilesMatch \\.(js)$ Header set Cache-Control max-age=216000, private /FilesMatch FilesMatch \\.(x?html?|php)$ Header set Cache-Control max-age=600, private, must-revalidate /FilesMatch /IfModule # END Cache-Control Headers # BEGIN Turn ETags Off IfModule mod_headers.c Header unset ETag /IfModule FileETag None # END Turn ETags Off # BEGIN Remove Last-Modified Header IfModule mod_headers.c Header unset Last-Modified /IfModule # END Remove Last-Modified Header -Original Message- From: majna [mailto:majna...@gmail.com] Sent: October-09-09 5:53 PM To: CakePHP Subject: Re: JS / CSS Compression AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml application/rss+xml application/ json text/css text/javascript application/javascript application/x- javascript On Oct 9, 4:41 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I have the asset helper up and running. Check y-slow and everything gets an A except Grade C on Compress components with gzip There are 2 plain text components that should be sent compressed * /styles_typography_125509.css * jquery_jqueryform_ofl_125509.js Apache 2.x uses mod_deflate. The htaccess is bits from all over from reading so maybe there is a problem in there somewhere? I check the y-slow Statistics: Empty Cache HTTP Requests - 14 Total Weight - 143.9K Primed Cache HTTP Requests - 2 Total Weight - 2.2K Looks like the scripts are not being cached either? my /webroot/htaccess: IfModule mod_deflate.c # compress content with type html, text, and css AddOutputFilterByType AddOutputFilterByType DEFLATE text/html text/plain text/xml IfModule mod_headers.c # properly handle requests coming from behind proxies Header append Vary User-Agent /IfModule /IfModule IfModule mod_expires.c ExpiresActive On ExpiresByType text/css access plus 10 years ExpiresByType text/js access plus 10 years ExpiresByType text/javascript access plus 10 years ExpiresByType application/x-javascript access plus 10 years ExpiresByType application/javascript access plus 10 years ExpiresByType image/png access plus 10 years ExpiresByType image/gif access plus 10 years ExpiresByType image/jpeg access plus 10 years /IfModule FileETag none Not sure why its not zipping these 2. Any ideas or help would be great. Thanks 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 -~--~~~~--~~--~--~---
Paginate Options
Any idea how to remove page from the pagination? So it shows search/2 rather than search/page:2 I know its been asked and still no luck in this answer. Thanks 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 -~--~~~~--~~--~--~---
Layout Help
I have 2 layouts crated one with a left side menu other with a right. In the layout i have the standard ?php echo $content_for_layout; ? /div which loads the view. But how can i determine what to put on the sides? The side menu modeuls can be elements, but how do I call them so i can say on say index user login module sponsors element, and onview page use something else? Thanks, 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: Layout Help
Sweet! Exactly the idea I was looking for. Thanks, Dave _ From: Sam Sherlock [mailto:sam.sherl...@gmail.com] Sent: October-09-09 12:13 AM To: cake-php@googlegroups.com Subject: Re: Layout Help You can see Hannibal Lecter's answer to the question on stackoverflow http://stackoverflow.com/questions/1024518/cakephp-block-region http://stackoverflow.com/questions/1024518/cakephp-block-region hth - S 2009/10/8 Dave Maharaj :: WidePixels.com d...@widepixels.com I have 2 layouts crated one with a left side menu other with a right. In the layout i have the standard ?php echo $content_for_layout; ? /div which loads the view. But how can i determine what to put on the sides? The side menu modeuls can be elements, but how do I call them so i can say on say index user login module sponsors element, and onview page use something else? Thanks, 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 -~--~~~~--~~--~--~---
app_error
I have $this-cakeError('profile'); in the controller if a user does not have permission to view a specific profile so i have my function profile() in my app_error and the view in errors but all i get is a blank page. I simply want to display the error page. Is this what the app_error is for? Missing something? Doing something wrong? 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: Email error
Right on, Thanks for the info. Dave -Original Message- From: Ivars Grīnbergs [mailto:i.grinbe...@gmail.com] Sent: October-06-09 6:01 AM To: CakePHP Subject: Re: Email error Hello, I faced this problem, too. I was surprised that Email component expects ARRAYS ONLY in Cc and Bcc and simple STRINGS ONLY in To, From, Reply-to. According to RFC 2822 section 3.6.3 To, Cc and Bcc are comma- separated list of one or more addresses. As well, according to section 3.6.2, From and Reply-to fields also are comma-separated list of one or more addresses. So, in Email component not only Cc and Bcc should be expected as arrays, but also To, From and Reply-to. Moreover, more cakey style (as it is in many other places) would be to accept both the strings and arrays, and if necessary, seamlessly convert (explode) comma-separated strings into arrays. I did a little modifications to cake's core lib in order to meet my (quite narrow) needs (it works only in case of smtp delivery method and it is assumed that coma-separated string contains correctly formatted addresses) and I am ready to share those modifications, so that someone can use it in order to improve Email component. With best regards, Ivars On Oct 6, 7:26 am, Dr. Loboto drlob...@gmail.com wrote: $this-Email-bcc must be an array. On Oct 6, 10:10 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I get this error when sending an email with bcc Warning (2) javascript:void(0); : Invalid argument supplied for foreach() [CORE/cake/libs/controller/components/email.php, line 714] $this-Email-delivery = 'smtp'; $this-Email-to = $this-data['User']['email']; $this-Email-bcc = 'd...@widepixels.com'; The email gets the the user but the copy to myself does not come thru. Ideas why? Thanks 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 -~--~~~~--~~--~--~---
Users Scope
How can you redirct to a page explaining why a user can not login? $this-Auth-userScope = array('User.confirmed' = '1'); So if its not been confirmed redirect to a page explainng why...please confirm your email what not. 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: Users Scope
A crap solution I tried that works is in the login function. The user logins in then read the Auth and then log them out and re-direct if ($this-Auth-user('confirmed') == '0') { $this-Session-destroy(); $this-redirect(array('action' = 'pending_email_confirmation')); } Would be nice to not even log them in and re-direct but I cant find anything related. Dave -Original Message- From: Simon [mailto:simon_d...@hotmail.com] Sent: October-06-09 2:06 PM To: CakePHP Subject: Re: Users Scope i'm having the same question On Oct 6, 9:25 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: How can you redirct to a page explaining why a user can not login? $this-Auth-userScope = array('User.confirmed' = '1'); So if its not been confirmed redirect to a page explainng why...please confirm your email what not. 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 -~--~~~~--~~--~--~---
Email Function
My controller is getting out of control I have 3 different registration functions which all send emails such as: if ($this-User-save($this-data, true, array_intersect(array_keys($this-User-schema()), $white))) { $this-Email-smtpOptions = array(my info here); $this-Email-delivery = 'smtp'; $this-Email-to = $this-data['User']['email']; $this-Email-subject = 'Account Confirmation'; $this-Email-replyTo = 'noreply@; $this-Email-from = 'admin@; $this-Email-sendAs = 'html'; $this-Email-template = 'registration'; $this-set('data', $this-data); $this-set('ip_address', $_SERVER['REMOTE_ADDR']); $this-set('server_name', $_SERVER['SERVER_NAME']); if ($this-Email-send()) { do something here but each registration does something different } I need to turn this into a function which will return true or false if $this-Email-send() to continue on. Any ideas? I tred a few things but it never worked. function sendRegistrationEmail($data, $role) { $sendSuccess = false; /* SMTP Options */ ... if ($this-Email-send()) { $sendSuccess = true; //create the Freelancer page } return $sendSuccess; } 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: Users Scope
Yeah I tried that but it never worked for my situation. Plus I like the redirect page because if they have not confirmed the email it possible they never received it, only saying Please confirm your email is of little assistance to them if the email was lost out there somewhere. so the page I redirect to allows them to re-send confirmation. Dave -Original Message- From: Simon [mailto:simon_d...@hotmail.com] Sent: October-06-09 2:32 PM To: CakePHP Subject: Re: Users Scope have you looked at this http://bakery.cakephp.org/articles/view/authed-adds-rule-based-userscope-to- auth On Oct 6, 9:57 am, Simon simon_d...@hotmail.com wrote: that would be very nice the solution you came up with its good at least it works On Oct 6, 9:44 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: A crap solution I tried that works is in the login function. The user logins in then read the Auth and then log them out and re-direct if ($this-Auth-user('confirmed') == '0') { $this-Session-destroy(); $this-redirect(array('action' = 'pending_email_confirmation')); } Would be nice to not even log them in and re-direct but I cant find anything related. Dave -Original Message- From: Simon [mailto:simon_d...@hotmail.com] Sent: October-06-09 2:06 PM To: CakePHP Subject: Re: Users Scope i'm having the same question On Oct 6, 9:25 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: How can you redirct to a page explaining why a user can not login? $this-Auth-userScope = array('User.confirmed' = '1'); So if its not been confirmed redirect to a page explainng why...please confirm your email what not. Dave- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Proper way to validate related models?
In most of my case I am saving data for two or more related models but not sure if I am going about it the right way. I am using save() for each related model because I want to specify what fields can have data saved to them (using AJAX so I know about Security component and it wont work) Example if in the User controller save(); If I use saveAll there is no way for me to specify what fields per model I am allowing data to be saved is there? $white = array('id', 'firstname', 'lastname', 'password', 'username'); if ($this-User-save($this-data, true, array_intersect(array_keys($this-User-schema()), $white))) { $this-data['Model1']['id'] = $this-User-id; $model_1 = array('field_1','field_2'); $this-User-ModelOne-save($this-data, true, array_intersect(array_keys($this-User-ModelOne-schema()), $model_1)); $this-data['Addition']['id'] = $this-User-id; $model_2 = array('field_1','field_2','field_3'); $this-User-ModelTwo-save($this-data, true, array_intersect(array_keys($this-User-ModelTwo-schema()), $model_2)); $this-data['Model3']['id'] = $this-User-id; $model_3 = array('field_1','field_2','field_3'); $this-User-ModelThree-save($this-data, true, array_diff(array_keys($this-User-ModelThree-schema()), $model_3)); And when saving to the related data, true means validate them but is there a way to unbind validation from a related model? I know I can call it from in the controller Users like: $this-User-unbindValidation('keep', array('id', 'lastname', 'username', 'email', 'password', 'confirm', 'slug'), true); But do all validation methods run whenever model data is saved or just the fields being saved? I mean if I am only saving 'age' and 'location' in User-Profile model, yet there are 10 other validation rules all set required in the User-Profile Model will validation fail even if the 2 im am trying to save validate? 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: Proper way to validate related models?
I read the saveAll in the bookand it says define $fieldList but looking at the saveAll it fieldList: Equivalent to the $fieldList parameter in Model::save() saveAll(array $data = null, array $options = array()) Where do youput the $fieldlist array and how is it structured? Per model User = array('name', 'age') or all in one array('User.name', 'Profile.color') Thanks, Dave -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: October-06-09 9:32 PM To: CakePHP Subject: Re: Proper way to validate related models? Or you can use saveAll() and pass and option of validate = first. http://book.cakephp.org/view/75/Saving-Your-Data --~--~-~--~~~---~--~~ 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: Proper way to validate related models?
Yeah thanks, Not going to bother with it I think. Since what I have works now I will just stick with it. dave -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: October-06-09 11:36 PM To: CakePHP Subject: Re: Proper way to validate related models? $options = array('validate' = 'first', 'fieldList' = array()); Im not sure you it would be structured, you can of course just try and add multiple models to the field list. On Oct 6, 6:03 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I read the saveAll in the bookand it says define $fieldList but looking at the saveAll it fieldList: Equivalent to the $fieldList parameter in Model::save() saveAll(array $data = null, array $options = array()) Where do youput the $fieldlist array and how is it structured? Per model User = array('name', 'age') or all in one array('User.name', 'Profile.color') Thanks, Dave -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: October-06-09 9:32 PM To: CakePHP Subject: Re: Proper way to validate related models? Or you can use saveAll() and pass and option of validate = first. http://book.cakephp.org/view/75/Saving-Your-Data --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ACL Question
I have 2 groups which are added by their respectful controller/model (Agent, Scout) So whena Agent or Scout is created in the AROS Table is shows up id parent_id model foreign_key alias lft rght 92 3 Scout 4 NULL104 105 105 4 Agent 3 NULL196 197 BuildACL function and initDB But I know there is something wrong with my initDB setup because I get: Warning (512): AclNode::node() - Couldn't find Aro node identified by Array ( [Aro0.model] = User [Aro0.foreign_key] = 3 ) [CORE/cake/libs/model/db_acl.php, line 148] There is no User Model...not sure why its looking for User? How would you fix this initDB? function initDB() { $role = $this-User-Role; //Allow admins to everything $role-id = '1'; $this-Acl-allow($role, 'controllers'); //allow managers $role-id = '2'; $this-Acl-deny($role, 'controllers'); $this-Acl-allow($role, 'controllers/Experiences'); $this-Acl-allow($role, 'controllers/Notes'); $this-Acl-allow($role, 'controllers/Portfolios'); $this-Acl-allow($role, 'controllers/Teams'); //allow Agents to $role-id = '3'; $this-Acl-deny($role, 'controllers'); $this-Acl-allow($role, 'controllers/Experiences'); $this-Acl-allow($role, 'controllers/Notes'); $this-Acl-allow($role, 'controllers/Portfolios'); $this-Acl-allow($role, 'controllers/Teams'); //allow Scouts to $role-id = '4'; $this-Acl-deny($role, 'controllers'); $this-Acl-allow($role, 'controllers/Teams/scout_view'); } 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 -~--~~~~--~~--~--~---
Create / Insert / Save from Model
I have a rather large function during user registration. Depending on the role they are registering as i create records for that specific role populating their profile and additional required tables with id's for the new user. The 2 roles require different tables so i currently have an if (role_id = roleOne) { build role 1 table set up } else { build role 2 table set up } I was just wondering if i created 2 functions buildRole1($id, $data) { $this-data['User']['id'] = $this-Profile-id; create(); $q = getMyOtherInfo(); //fill the data into the profile save(); and so on } and build Role2($id) { } can i actually create new records from the model and save them? Or should it be kept in the controller? Dave Maharaj Freelance Designer d...@widepixels.com www.widepixels.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Fields in a form
Is there a way to get a list of fields in a form when a page is loaded? I would like to (try) to build my own custom component for AJAX forms to check form fields. I tried pulling code from the security component with no luck. Any ideas? Thanks 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: Are Hashed values unique?
You can use $this-data['User']['confirm_code'] = string::uuid(); The uuid is a 128bit string in the format of 485fc381-e790-47a3-9794-1337c0a8fe68 http://book.cakephp.org/view/573/uuid Dave -Original Message- From: Jas [mailto:mciver.ja...@gmail.com] Sent: October-05-09 11:15 PM To: CakePHP Subject: Are Hashed values unique? I've got an Email confirmation/validation process working for new users, the user receives an email with a link and this link has a hash value. I am just wondering if it were possible that one word could have the same hash as another? Using either of these hash methods sha1/sha256/md5? If so what are other people using to generate a unique code? apart from date/time as that would be guessable. Thanks --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Email error
I get this error when sending an email with bcc Warning (2) javascript:void(0); : Invalid argument supplied for foreach() [CORE/cake/libs/controller/components/email.php, line 714] $this-Email-delivery = 'smtp'; $this-Email-to = $this-data['User']['email']; $this-Email-bcc = 'd...@widepixels.com'; The email gets the the user but the copy to myself does not come thru. Ideas why? Thanks 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: showEmpty?
I had a same / similar question for input selects which is related to this. I have my echo $form-input('State'); which is populated by a find list...so I have all my States. How can I add so first option to be Select your State with no value? Right now Alabama shows up first and if a user does not select a State Alabama is automatically saved. $selected = array('option' = 'Select your State', 'value' = '0')? Thanks, Dave -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: October-04-09 7:35 AM To: CakePHP Subject: Re: showEmpty? You should only be using input(). echo $form-input('State', array('options' = array('NJ' = New Jersey', 'NY' = 'New York'), 'empty' = false)); On Oct 3, 7:33 pm, Gonzalo Servat gser...@gmail.com wrote: On Sun, Oct 4, 2009 at 7:21 AM, gimperdan...@gmail.comgimperdan...@gmail.com wrote: [..snip..] This is what I have: echo $form-select('State', array('NJ' = New Jersey', 'NY' = 'New York')); I want to remove the empty option of this select box. According to the API I need to add $showEmpty = false to the code above.. but where do I add it? I tried in several different locations and it won't work. The function's arguments are: select($fieldName, $options = array(), $selected = null, $attributes = array(), $showEmpty = '') You only supplied the first and second arguments so if you want to keep the defaults for the rest except for $showEmpty, you'd need to do something like the following: echo $form-select('State', array('NJ' = 'New Jersey', 'NY' = 'New York'), null, array(), false) (notice I kept the defaults null and array() for the arguments between $options and $showEmpty) - Gonzalo --~--~-~--~~~---~--~~ 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: showEmpty?
Thanks, Will give it a try. Dave -Original Message- From: brian [mailto:bally.z...@gmail.com] Sent: October-04-09 1:29 PM To: cake-php@googlegroups.com Subject: Re: showEmpty? I believe it's 'empty = 'Select your State'. If the param is false, null, or the empty string, Cake outputs an empty option. On Sun, Oct 4, 2009 at 8:13 AM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I had a same / similar question for input selects which is related to this. I have my echo $form-input('State'); which is populated by a find list...so I have all my States. How can I add so first option to be Select your State with no value? Right now Alabama shows up first and if a user does not select a State Alabama is automatically saved. $selected = array('option' = 'Select your State', 'value' = '0')? Thanks, Dave -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: October-04-09 7:35 AM To: CakePHP Subject: Re: showEmpty? You should only be using input(). echo $form-input('State', array('options' = array('NJ' = New Jersey', 'NY' = 'New York'), 'empty' = false)); On Oct 3, 7:33 pm, Gonzalo Servat gser...@gmail.com wrote: On Sun, Oct 4, 2009 at 7:21 AM, gimperdan...@gmail.comgimperdan...@gmail.com wrote: [..snip..] This is what I have: echo $form-select('State', array('NJ' = New Jersey', 'NY' = 'New York')); I want to remove the empty option of this select box. According to the API I need to add $showEmpty = false to the code above.. but where do I add it? I tried in several different locations and it won't work. The function's arguments are: select($fieldName, $options = array(), $selected = null, $attributes = array(), $showEmpty = '') You only supplied the first and second arguments so if you want to keep the defaults for the rest except for $showEmpty, you'd need to do something like the following: echo $form-select('State', array('NJ' = 'New Jersey', 'NY' = 'New York'), null, array(), false) (notice I kept the defaults null and array() for the arguments between $options and $showEmpty) - Gonzalo --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Session / Security
Not quite sure how this works but how does one steal a session? I have my session info stored in the database... if i added ip to the session so it also checks that the session ip matches the user ip would that increase the session sucurity? What a safe guards / good practsise to secure session data? Thanks 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: Session / Security
Right on. In my app nothing is passed in the url all my non-private areas are like /manage/profile or /manage/account as everything related to the user is obtained by auth ID of the logged in user and getting the info based on that. So i was just wondering if someone did get the session, how would they do it and ways to prevent it. Thanks Dave _ From: Bert Van den Brande [mailto:cyr...@gmail.com] Sent: October-03-09 6:40 PM To: cake-php@googlegroups.com Subject: Re: Session / Security I'm no expert on the subject, but I think session can be hijacked by : * 'stealing' a sessions id from the url. This is only possible if the user browser doesn't use cookies so the session id is visible in the url * stealing a session cookie In either cases, logging the user's ip would increase security imho. I'm interested in other opinions :) On Sat, Oct 3, 2009 at 10:08 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Not quite sure how this works but how does one steal a session? I have my session info stored in the database... if i added ip to the session so it also checks that the session ip matches the user ip would that increase the session sucurity? What a safe guards / good practsise to secure session data? Thanks 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 -~--~~~~--~~--~--~---
Advanced set up install
I have to install cake on a shared hosting server. The user has 4 domains so the server looks like /public_html /css /js /images ..all files for the hosting master domain1 /domain2 /all site files for domain12.com /domain3 /all site files for domain3.com /domain4 /all site files for domain4.com What is the best/most secure way to set cake up in this type of set up? Cake is only being used for domain4 but i can easily move files/folders around to suit the needs of cake. I currently have /domain4 /cake /app ... Thanks, 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 -~--~~~~--~~--~--~---
Still sort array help
No matter what i try I still cant sort an array. $merged = array_merge ($new_skills, $selected); debug($merged); Array ( [0] = Tree [1] = Zoo [2] = Hello [3] = Test [4] = Cool [5] = 3 Doors Down [6] = Yellow ) $sorted = natcasesort($merged); debug($sorted); Array ( 1 ) I simply want to sort the merged array alphbeticaly but everything just returns 1 Tried sort(); array_multisort() natsort(); Ideas? 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: Where request comes from?
Cool will def check it out. I cant use the security component with AJAX calls if I read the docs correct. But with your component I can include the security component and it will play nice with AJAX? Add the tokens and so on to the forms? Dave -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: October-02-09 1:33 PM To: CakePHP Subject: Re: Where request comes from? Well you can use my ajax handler, it wraps the security component so it works with AJAX calls. http://www.milesj.me/resources/script/ajax-handler-component On Oct 2, 7:12 am, Martin Westin martin.westin...@gmail.com wrote: You CAN... but it is painful to say the least. Since you can't have your cake and eat it ;) your best bet is to look inside the Security Component to see what parts you want to use and then put that into your own component, extend the core component or something like that. You can also look at the Security class but it does not offer any turn-key solutions for you. At the risk of being misinterpreted, I am tempted to say that you should not care where requests comes from. Either a request is a public request like /posts/display/123 or a protected action like / posts/delete/123. Where the request comes from has little relevance in the first case. In the second case it really has little relevance too since you will be much more concerned about a valid session identifying an authorized user, right? If your security model needs to include has been posted from exactly my form on my page then ajax should not be used for those requests. IMHO. /Martin On Oct 1, 11:05 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: But no good for AJAX. I have AJAX forms in my app so I cant use the security component. Can I? I know it wont work for AJAX submitted forms. I was just curious. Dave -Original Message- From: Martin Westin [mailto:martin.westin...@gmail.com] Sent: October-01-09 5:45 PM To: CakePHP Subject: Re: Where request comes from? The Security Component does this kind of thing for you. For example, it will embed a hash value into the form which is a checksum of the form. If a field is missing or added it will be captured. If a hidden value is modified this will also be captured. Also sessions will be more secure and a lot harder to hijack since the session id is replaced for each request. And a buch more stuff. /Martin On Oct 1, 9:36 pm, Bert Van den Brande cyr...@gmail.com wrote: I believe the FormHelper has some 'secure' stuff available for this ... best to consult the documentation ... On Thu, Oct 1, 2009 at 8:50 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Is there a way to determine / ensure that any requested action comes from the server? I mean more towards the aspect of forms. That when a form is submitted the request is coming from the site and not someone who made a form and trying to submit it to your site. Just curious Thanks, 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: Still sort array help
Got it! Thanks. Dave -Original Message- From: brian [mailto:bally.z...@gmail.com] Sent: October-02-09 10:27 PM To: cake-php@googlegroups.com Subject: Re: Still sort array help natcasesort() returns a boolean, not an array. debug(natcasesort($merged)); On Fri, Oct 2, 2009 at 6:07 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: No matter what i try I still cant sort an array. $merged = array_merge ($new_skills, $selected); debug($merged); Array ( [0] = Tree [1] = Zoo [2] = Hello [3] = Test [4] = Cool [5] = 3 Doors Down [6] = Yellow ) $sorted = natcasesort($merged); debug($sorted); Array ( 1 ) I simply want to sort the merged array alphbeticaly but everything just returns 1 Tried sort(); array_multisort() natsort(); Ideas? 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 -~--~~~~--~~--~--~---
Where request comes from?
Is there a way to determine / ensure that any requested action comes from the server? I mean more towards the aspect of forms. That when a form is submitted the request is coming from the site and not someone who made a form and trying to submit it to your site. Just curious Thanks, 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: Where request comes from?
But no good for AJAX. I have AJAX forms in my app so I cant use the security component. Can I? I know it wont work for AJAX submitted forms. I was just curious. Dave -Original Message- From: Martin Westin [mailto:martin.westin...@gmail.com] Sent: October-01-09 5:45 PM To: CakePHP Subject: Re: Where request comes from? The Security Component does this kind of thing for you. For example, it will embed a hash value into the form which is a checksum of the form. If a field is missing or added it will be captured. If a hidden value is modified this will also be captured. Also sessions will be more secure and a lot harder to hijack since the session id is replaced for each request. And a buch more stuff. /Martin On Oct 1, 9:36 pm, Bert Van den Brande cyr...@gmail.com wrote: I believe the FormHelper has some 'secure' stuff available for this ... best to consult the documentation ... On Thu, Oct 1, 2009 at 8:50 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Is there a way to determine / ensure that any requested action comes from the server? I mean more towards the aspect of forms. That when a form is submitted the request is coming from the site and not someone who made a form and trying to submit it to your site. Just curious Thanks, 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 -~--~~~~--~~--~--~---
Help with an array()
I have a merged array which produces $new = array_merge($newSelections[$model_table],$additional_options); Array ( [0] = Array ( [id] = 9 [name] = Confident [UsersOption] = Array ( [id] = 222 [user_id] = 4a5d323f-b9e8-416d-b34c-11cf4adcd75b [option_id] = 9 ) ) [0] thru [9] same as above structure [10] = ghjghjghj [11] = tet ) How can I make it so [10] = Array ( [name] = ghjghjghj ) So I can loop thru all the results in a foreach ['name'] Thanks 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: Help with an array() - SOLVED
Sorry to post...i figured it out. Dave -Original Message- From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com] Sent: September-30-09 3:23 PM To: cake-php@googlegroups.com Subject: Help with an array() I have a merged array which produces $new = array_merge($newSelections[$model_table],$additional_options); Array ( [0] = Array ( [id] = 9 [name] = Confident [UsersOption] = Array ( [id] = 222 [user_id] = 4a5d323f-b9e8-416d-b34c-11cf4adcd75b [option_id] = 9 ) ) [0] thru [9] same as above structure [10] = ghjghjghj [11] = tet ) How can I make it so [10] = Array ( [name] = ghjghjghj ) So I can loop thru all the results in a foreach ['name'] Thanks 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 -~--~~~~--~~--~--~---
Contain Problem
I have this: User Model $q = $this-find('first', array( 'conditions' = array( 'User.id' = $auth_id), //'fields' = array('User.id'), 'contain' = array( 'Addition' = array( 'conditions' = array('Addition.id' = $auth_id), 'fields' = array( 'Addition.id', 'Addition.a'.$field)), $skill = array( 'fields' = array( $skill.'.name'); debug($q); } User hasOne Addition related by id If I use 'fields' = array('User.id'), in the user no Addition shows up at all Remove the 'fields' = array('User.id'), and Addition shows up in the array but all the User fields show up, User has a load of info I dont need, hence the fact im using contain. I only want the Addition related to the User Ideas where this is going wrong? 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 -~--~~~~--~~--~--~---
Sort returns 1?
Anyone know why a sort returns 1? Model function: $merged = array_merge ($new_skills, $selected); //debug($merged); $sorted = sort($merged); //debug($sorted); $merged produces Array ( [0] = Cohghol [1] = Shit [2] = Thfghfdgh [3] = Zoo [4] = Alfred [5] = Michelle ) $sorted produces 1 ??? Ideas Thanks, 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 -~--~~~~--~~--~--~---
Change Password
I am trying to set up a change password section. password field and confirm field only. model: validation rules: 'password' = array( 'pass-notempty' = array( 'rule' = array('notempty'), 'required' = true, 'allowEmpty' = false, 'message' = 'Password cannot be empty.', 'last' = true), 'pass-length' = array( 'rule' = array('minLength', 8), 'message' = 'Password must be minimim 8 characters.', 'last' = true), 'pass-Similar' = array( 'rule' = 'checkPasswords', 'message' = 'Different password entered.', 'last' = true) ), 'confirm' = array( 'confirm-notempty' = array( 'rule' = array('notempty'), 'required' = true, 'allowEmpty' = false, 'message' = 'Pleae confirm your password.') ), function checkPasswords() { if($this-data['User']['password'] == $this-data['User']['confirm']) { return true; } } Now the password gets hashed automaticaly so I $this-data['User']['confirm'] = Security::hash($this-data['User']['confirm'], null, true); in the controller but still same message..Do Not Match. Am i missing something? I unbind the other validation in the model so its not checking anything other than password and confirm Thanks 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: Change Password
Ok cool will give it a try. Dave -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: September-29-09 3:40 PM To: CakePHP Subject: Re: Change Password I dont think hash() adds the security salt, you must use Auth-password (). --~--~-~--~~~---~--~~ 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: Change Password
Here is the controller function Maybe someone can see where I am going wrong? function changePassword() { $id = $this-Auth-user('id'); $this-User-unbindValidation('keep', array('password', 'confirm'), true); if (!empty($this-data)) { $this-data['User']['confirm'] = $this-Auth-password($this-data['User']['confirm']); //debug confirm and get gf456dg5rtert132erwr string $this-User-set($this-data); if ($this-User-validates()) { $this-User-id = $id; $white = array('password'); $this-User-save($this-data, true, array_intersect(array_keys($this-User-schema()), $white)); $this-Session-setFlash(__('Passwords Matched and saved', true)); } else { $this-Session-setFlash(__('Passwords Do not Match', true)); $this-data = null; } } } User Model Validation rules: ... 'password' = array( 'pass-notempty' = array( 'rule' = array('notempty'), 'required' = true, 'allowEmpty' = false, 'message' = 'Password cannot be empty.', 'last' = true), 'pass-length' = array( 'rule' = array('minLength', 8), 'message' = 'Password must be minimim 8 characters.', 'last' = true), 'pass-Similar' = array( 'rule' = 'checkPasswords', 'message' = 'Different password entered.', 'last' = true) ), 'confirm' = array( 'confirm-notempty' = array( 'rule' = array('notempty'), 'required' = true, 'allowEmpty' = false, 'message' = 'Pleae confirm your password.') ), ... function checkPasswords() { if($this-data['User']['password'] == $this-data['User']['confirm']) { // Passwords match return true; } } -Original Message- From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com] Sent: September-29-09 3:46 PM To: cake-php@googlegroups.com Subject: RE: Change Password Ok cool will give it a try. Dave -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: September-29-09 3:40 PM To: CakePHP Subject: Re: Change Password I dont think hash() adds the security salt, you must use Auth-password (). --~--~-~--~~~---~--~~ 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: Run a cron Job
Ok, thanks, I want the cron to run by its self at a specific time. SoI do not have to do it myself daily. Can this be done in your approach? New to cron set up. Will check into the shell approach. Dave -Original Message- From: Martin Westin [mailto:martin.westin...@gmail.com] Sent: September-28-09 9:33 AM To: CakePHP Subject: Re: Run a cron Job The cake shell is prefect for this. I do cron tasks by creating Cake shell tasks and from there I do a requestAction if I really need to call an action. This is what I tell cron: /ful/path/to/cake/console/cake -app /full/path/to/app shellname /dev/ null 21 The last bit (dev/null and that) makes the shell totally silent which is needed unless you want the cron to terminate unexpectedly. But when testing yourself you should leave that out so you can see the output. On Sep 27, 6:27 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Trying to set up an action to run at a specific time. Found a few sites saying replace require CORE_PATH.'cake'.DS.'bootstrap.php'; in index.php but no longer appears to be there. Any good places to look where to set this up? Thanks 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: Run a cron Job
Yeah the CP has basic and advanced. Basic you select days/month/min/time and so on and enter /path/to/cake/console/cake -app /path/to/your/app shell_task_name Advanced is the *** input Will give it another shot. But based on the set up above if I have my shell code (reports.php) in app/vendors/shell I would use something like /mypath/to/cake/console/cake -app /mypath/app reports (mypath being changed obviously) Dave -Original Message- From: brian [mailto:bally.z...@gmail.com] Sent: September-28-09 2:15 PM To: cake-php@googlegroups.com Subject: Re: Run a cron Job On Mon, Sep 28, 2009 at 12:24 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Yeah I set up a reports.php like they did in the Cookbook but even when I try to run it from the control panel I keep getting '/bin/sh: 15: command not found' It looks like you're trying to feed the shell the example I posted. The 15 being the first part, which the shell doesn't understand. The 15 0 * * * part of the line is what tells cron when to run the job. How does your control panel set up cron jobs? Does it have a widget for setting the time of day? If so, you probably want to do that and then provide just this part as the job: /path/to/cake/console/cake -app /path/to/your/app shell_task_name Those paths are from root. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Validate belongsTo
I am trying to validate Country and State models from there related models $belongsTo In the form users select Country and State which is populated from the db. So each has an id... Now I want to make sure someone is not messing with the values with Firebug. So in my Experience controller this is the debug($this-data); right before the save(); Array ( [Experience] = Array ( [company] = Sants Workshop [position] = Head Elf [city] = Secret [state_id] = 31 [country_id] = 3 [respons] = [start] = 2055 [finished] = ) ) So I change a State value to ABCD which is not in the DB as an ID Array ( [Experience] = Array ( [company] = Sants Workshop [position] = Head Elf [city] = Secret [state_id] = ABCD [country_id] = 3 [respons] = [start] = 2055 [finished] = ) ) State Model: function checkStateValues($data) { $valid = false; if (!empty($this-data)) { $san = new Sanitize(); $this-data = $san-paranoid($this-data); $results = array_diff($this-data, $this-find('list', array('fields' = 'id', 'order' = 'id ASC'))); if (empty($results)) $valid = true; } return $valid; } Do I need to set both State and Country to their models? I have in the controller: $black = array('id', 'user_id'); if ($this-Experience-save($this-data, true, array_diff(array_keys($this-Experience-schema()), $black))) { So it should be checking validation before save with 'true' no? Or does it only validate the Experience Model? Thanks 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: Validate belongsTo - SOLVED
I got it. Was using the State model in error as I am validating state_id in the Experience -Original Message- From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com] Sent: September-28-09 6:32 PM To: cake-php@googlegroups.com Subject: Validate belongsTo I am trying to validate Country and State models from there related models $belongsTo In the form users select Country and State which is populated from the db. So each has an id... Now I want to make sure someone is not messing with the values with Firebug. So in my Experience controller this is the debug($this-data); right before the save(); Array ( [Experience] = Array ( [company] = Sants Workshop [position] = Head Elf [city] = Secret [state_id] = 31 [country_id] = 3 [respons] = [start] = 2055 [finished] = ) ) So I change a State value to ABCD which is not in the DB as an ID Array ( [Experience] = Array ( [company] = Sants Workshop [position] = Head Elf [city] = Secret [state_id] = ABCD [country_id] = 3 [respons] = [start] = 2055 [finished] = ) ) State Model: function checkStateValues($data) { $valid = false; if (!empty($this-data)) { $san = new Sanitize(); $this-data = $san-paranoid($this-data); $results = array_diff($this-data, $this-find('list', array('fields' = 'id', 'order' = 'id ASC'))); if (empty($results)) $valid = true; } return $valid; } Do I need to set both State and Country to their models? I have in the controller: $black = array('id', 'user_id'); if ($this-Experience-save($this-data, true, array_diff(array_keys($this-Experience-schema()), $black))) { So it should be checking validation before save with 'true' no? Or does it only validate the Experience Model? Thanks 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 -~--~~~~--~~--~--~---
Validate non-existent Model
I upload an image using a component which produces this array [Image] = Array ( [image] = Array ( [name] = blue_self_shot_m057.jpg [type] = image/jpeg [tmp_name] = /var/tmp/phpZ0VP1f [error] = 0 [size] = 183628 ) ) Now I want to add validation to this but I have no Image model. How can I validate this? Thanks 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 -~--~~~~--~~--~--~---
Display Error
I need to place an error in a specific spot so I used the ?php echo $form-error($model . $field); ? But the error shows up in 2 places now. Where I have my error code and beside the field. How can I remove it from the field so it only displays in the spot i want? Thanks, 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 -~--~~~~--~~--~--~---
Run a cron Job
Trying to set up an action to run at a specific time. Found a few sites saying replace require CORE_PATH.'cake'.DS.'bootstrap.php'; in index.php but no longer appears to be there. Any good places to look where to set this up? Thanks 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 -~--~~~~--~~--~--~---
Im dumb...help!
I need to run an if on 2 conditions but I cant get it to work ?php if (!empty($user['Post']) || !empty($user['Favorite']['id'])) ? do something here if either is not empty would check if both are empty but I need if either is not empty. How can I do this or what have I got done wrong here? thanks, 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: Im dumb...help!
When I test it out I know there is no data for either. So in the view: ?php if (!empty($user['Post']) || !empty($user['Favorite']['id'])) ? h1Dummy title/h1 If info this should show up ?php endif ? But sure enough in the view: Dummy Title If info this should show up Cant figure out why the text is being rendered when both if conditions are emtpy Will try your suggestion. Thanks Dave -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: September-27-09 7:27 PM To: CakePHP Subject: Re: Im dumb...help! Thats correct, so what exactly is the problem? If not try: ?php if ((!empty($user['Post'])) || (!empty($user['Favorite'] ['id']))) { } ? On Sep 27, 2:51 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I need to run an if on 2 conditions but I cant get it to work ?php if (!empty($user['Post']) || !empty($user['Favorite']['id'])) ? do something here if either is not empty would check if both are empty but I need if either is not empty. How can I do this or what have I got done wrong here? thanks, 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: Im dumb...help!
When I debug all the info is there a lot of data for that function but the 2 im look at for the if are both empty. [Post] = Array ( ) [Favorite] = Array ( ) -Original Message- From: Gonzalo Servat [mailto:gser...@gmail.com] Sent: September-27-09 7:41 PM To: cake-php@googlegroups.com Subject: Re: Im dumb...help! On Mon, Sep 28, 2009 at 8:05 AM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: When I test it out I know there is no data for either. So in the view: ?php if (!empty($user['Post']) || !empty($user['Favorite']['id'])) ? h1Dummy title/h1 If info this should show up ?php endif ? But sure enough in the view: Dummy Title If info this should show up What's the output of: var_dump($user) ? - GS --~--~-~--~~~---~--~~ 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: Im dumb...help!
I have the same idea set up in the admin for the user but its in reverse and it works fine. ?php if (empty($user['Post']) empty($user['Favorite']['id'])): ? pYou have no favorites or Contributing Posts./p ?php else: One or both are not empty so show data Show the posts and favorites. But what I am working on now if its empty its just empty, show nothing ?php if (!empty($user['Post']) || !empty($user['Favorite']['id'])) ? Either or both have data so show the user their infoif both are empty do nothing. Dave -Original Message- From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com] Sent: September-27-09 7:46 PM To: cake-php@googlegroups.com Subject: RE: Im dumb...help! When I debug all the info is there a lot of data for that function but the 2 im look at for the if are both empty. [Post] = Array ( ) [Favorite] = Array ( ) -Original Message- From: Gonzalo Servat [mailto:gser...@gmail.com] Sent: September-27-09 7:41 PM To: cake-php@googlegroups.com Subject: Re: Im dumb...help! On Mon, Sep 28, 2009 at 8:05 AM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: When I test it out I know there is no data for either. So in the view: ?php if (!empty($user['Post']) || !empty($user['Favorite']['id'])) ? h1Dummy title/h1 If info this should show up ?php endif ? But sure enough in the view: Dummy Title If info this should show up What's the output of: var_dump($user) ? - GS --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Strip whitespaces
I am saving a field in a form and just messing around by entering A B C After the save the data is displayed as A B C ...ok fine Go back to edit what i entered and it shows up as AB C in my controller: $clean = new Sanitize(); // Sanitize the data $this-data = $clean-clean($this-data); How can i strip out all extra spaces only allowing 1 between words? Preferably before the save so it is cleaned up before the database. Thanks, 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: Strip whitespaces
Thanks! I am just getting to the point of testing saving data and trying to cleanup junk I attempt to save. Basically the app I went thru all the fields in forms and all of them all I want to allow is words and numbers so paranoid clean works but the forms are serialized so I have to use clean for that? Occasional email or url but the validation will take care of that or do you still need to check that data? Little lost on the whole sanitize...make the data safe to save, but when reading the cookbook 'odd_spaces' = true, 'encode' = true, 'dollar' = true, 'carriage' = true, 'unicode' = true, 'escape' = true, 'backslash' = true I have no clue what these would or would not beused for under what condition. Thanks again Dave -Original Message- From: brian [mailto:bally.z...@gmail.com] Sent: September-26-09 2:01 PM To: cake-php@googlegroups.com Subject: Re: Strip whitespaces preg_replace('/\s\s+/', ' ', $str) But, if you have a single whitespace character other than space (eg. tab), it'll be retained. On Sat, Sep 26, 2009 at 12:24 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I am saving a field in a form and just messing around by entering A B C After the save the data is displayed as A B C ...ok fine Go back to edit what i entered and it shows up as AB C in my controller: $clean = new Sanitize(); // Sanitize the data $this-data = $clean-clean($this-data); How can i strip out all extra spaces only allowing 1 between words? Preferably before the save so it is cleaned up before the database. Thanks, 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 -~--~~~~--~~--~--~---
Just curious question
Just wondering if anyone has an opinion or fact about this. When pulling model data, keep it simple so Users controller getting straight info from Users database. Users table has 15 fields. You may only need 5 fields data and in another case you may need all 15 fields. Is it best to specify the fields you need always? I guess the size of the data in the fields will make a difference. I am just thinking in regards to my app where i need a few fields, then i need all fields does it take more time to process a detailed request when you specify each individual field when you need info from 10 fields as opposed to *just and get them all. What is best practise? Or in this case its more of a try both and see what works best for each app? Thanks 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: Just curious question
Yeah that looks like a nifty approach, Will give that a shot! Thanks I am just cleaning up my app I have been playing round with over the last few months so as I learn to make things better and evolve I see functions I have made where some grab 3 fields, some grab all, other 10 or so. So there is a mess of functions grabbing specific data, all data, little data so was just wondering how other people do it. But you idea would allow me to use the same function and grab what I need / don’t need. I think I may expand on your idea and create it where you can choose to 'keep' or 'remove' fields rather than having to type 20 names to keep only type out the few you don’t need or what not and use something like array_diff_key or array_intersect_key to keep or remove based on $this-myFields = array('field_one, 'field_two', 'and_some_other'); Dave -Original Message- From: teknoid [mailto:teknoid.cake...@gmail.com] Sent: September-26-09 6:29 PM To: CakePHP Subject: Re: Just curious question ... haven't tested, but something like this should work: In the model: $this-myFields = array('field_one, 'field_two', 'and_some_other'); public function modifyRequiredFields($additionalFields) { array_push($this-myFields, $additionalFields); return $this-myFields; } In the controller: $this-ModelName-find('all', array('fields' = $this-ModelName- modifyRequiredFields(array('i_also_need_this', 'and_this')); ... or ... if it's a standard find() $this-ModelName-find('all', array('fields' = $this-ModelName- myFields)); On Sep 26, 3:14 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Just wondering if anyone has an opinion or fact about this. When pulling model data, keep it simple so Users controller getting straight info from Users database. Users table has 15 fields. You may only need 5 fields data and in another case you may need all 15 fields. Is it best to specify the fields you need always? I guess the size of the data in the fields will make a difference. I am just thinking in regards to my app where i need a few fields, then i need all fields does it take more time to process a detailed request when you specify each individual field when you need info from 10 fields as opposed to *just and get them all. What is best practise? Or in this case its more of a try both and see what works best for each app? Thanks 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 -~--~~~~--~~--~--~---
Style a Submit
How can you style a submit with a CSS style in directly in the echo $form-end('Save'); I want to use a CSS sprite which has the various states but when nothing i try works. Has anyone done this? Ideas? 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: Style a Submit
Yeah I went with button as the input. All is good. Thanks Dave _ From: Eber Freitas Dias [mailto:eber.frei...@gmail.com] Sent: September-25-09 11:29 PM To: cake-php@googlegroups.com Subject: Re: Style a Submit You also should consider using the button tag instead of the default input button. Take a look: http://www.w3schools.com/tags/tag_button.asp The button tag is much more flexible as it is totally customizable, and you can put orther elements inside of it, like images: buttonimg src=image.jpg alt=Ha! //button Then, you just close the form with $form-end(); Maybe this will help! On Fri, Sep 25, 2009 at 9:54 PM, brian bally.z...@gmail.com wrote: The form should have an ID. Just create a CSS rule for #form_id input[type='submit']. Also, Cake's default is to put the submit button in a div with class=submit so you can use that, also, for your CSS selector. On Fri, Sep 25, 2009 at 6:10 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: How can you style a submit with a CSS style in directly in the echo $form-end('Save'); I want to use a CSS sprite which has the various states but when nothing i try works. Has anyone done this? Ideas? Dave -- Éber Freitas Dias www.eberfdias.com www.dejamps.net --~--~-~--~~~---~--~~ 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: Search and Find all
Your telling it to find nothing. You need to tell it what to find. Like you had before $params = array('conditions' = array( 'AND' = array( 'OR' =array( 'Post.name LIKE' = '%' . $item . '%', 'Post.date LIKE' = '%' . $item . '%', 'Post.poster LIKE' = '%' . $item . '%'), 'NOT'=array('Post.active'= '0'))), 'order' = 'Post.name', 'recursive' = 1)); $this-set('results', $this-Post-find('all' , $params)); It will find ALL Posts that meet these PARAMS and whatever you define in the PARAMS Dave -Original Message- From: Simon [mailto:simon_d...@hotmail.com] Sent: September-24-09 11:09 AM To: CakePHP Subject: Re: Search and Find all hi thanks for you time i get parse erorr when i do this $this-set('results', $this-find(...)); i tried it without the dots $this-set('results', $this-find()); then i get Call to undefined method PostsController::find() thank you On Sep 23, 5:45 pm, brian bally.z...@gmail.com wrote: You're testing for $item but your controller setting a variable $search. lthough, on 2nd look, you have a problem there, also. You're assigning the result of your find() to $post but, further down, refer to $posts. Maybe you should simply do: $this-set('results', $this-find(...)); view: if (empty($results)) { ... On Wed, Sep 23, 2009 at 6:32 PM, Simon simon_d...@hotmail.com wrote: whats the best way to show the user if there is no items found any code i can use in my view this i used but didnt work i got error ?php if (!$item) { echo'p no items found found/p'; } ? this is in my post controller function search($item = null) { $item = $this-params['url']['q']; $post = $this-Post-find('all', array('conditions' = array( 'AND' = array( 'OR' =array( 'Post.name LIKE' = '%' . $item . '%', 'Post.date LIKE' = '%' . $item . '%', 'Post.poster LIKE' = '%' . $item . '%'), 'NOT'=array('Post.active'= '0'))), 'order' = 'Post.name', 'recursive' = 1)); if (!$item) { $this-Session-setFlash(__('No Search Items Found', true)); $this-redirect(array('action'='index')); } $this-set('search', $posts); }- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---