Saturday, November 30, 2013

Re: Access Request Object data



On Thursday, 21 November 2013 22:33:39 UTC+1, advantage+ wrote:

How do you access CakeResponse object data in __construct() ?


AppController::__construct? 

You don't - what are you trying to do?

AD

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Production and Development Environment



On Friday, 29 November 2013 05:45:50 UTC+1, advantage+ wrote:

Hmm sounds like the exact thing I said……..and if you do

Beforefilter::parent () in the controller what was the point of asking if there is an easy way to no go thur every controller!

 

And that would not solve the problem either and if you took a few seconds to read the question Its clearly states no to go thru every controller
@simon - rookie ass fool


Please keep replies/posts professional - I don't think pointing out a tool related to environment management, for a question about environment problems warrants a noxious response.

FWIW if your app is environment aware at all, you're probably doing it wrong (especially if you apparently need to edit all your controllers to do what you're asking).

AD

 

 

 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Friday, November 29, 2013

RE: Production and Development Environment

I did think of that, but every controller calls  other functions which would over-ride the AppController such as:

 

public function beforeFilter() {

              parent::beforeFilter(); //so this would say production

              $this->Auth->deny(); // then this would kick in

             

             

              //Allow Security to allow ajax request for these actions

              $ajax_request = array('manage_add', 'manage_edit', 'manage_delete');

              if(in_array($this->params['action'], $ajax_request)){

                    

                     $this->Security->unlockedActions = $ajax_request;

                     $this->Security->csrfCheck = false;

              }

       }

 

Dave Maharaj

Freelance Designer | Developer

www.movepixels.com  |  dave@movepixels.com  |  709.800.0852

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Reuben Helms
Sent: Friday, November 29, 2013 11:52 AM
To: cake-php@googlegroups.com
Subject: Re: Production and Development Environment

 

You don't have to go through every controller.  Just on the one controller, the AppController, for the default deny, and the code that will skip that deny if you have a config that suggests you're in a development environment.  The only other Controller to touch will be the controller that looks after your login action, for which you'll want an accept after parent::beforeFilter().

 

On Fri, Nov 29, 2013 at 2:45 PM, Advantage+ <movepixels@gmail.com> wrote:

Hmm sounds like the exact thing I said……..and if you do

Beforefilter::parent () in the controller what was the point of asking if there is an easy way to no go thur every controller!

 

And that would not solve the problem either and if you took a few seconds to read the question Its clearly states no to go thru every controller
@simon - rookie ass fool

 

 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to a topic in the Google Groups "CakePHP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cake-php/qY0yLORk4MM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Production and Development Environment

You don't have to go through every controller.  Just on the one controller, the AppController, for the default deny, and the code that will skip that deny if you have a config that suggests you're in a development environment.  The only other Controller to touch will be the controller that looks after your login action, for which you'll want an accept after parent::beforeFilter().


On Fri, Nov 29, 2013 at 2:45 PM, Advantage+ <movepixels@gmail.com> wrote:

Hmm sounds like the exact thing I said……..and if you do

Beforefilter::parent () in the controller what was the point of asking if there is an easy way to no go thur every controller!

 

And that would not solve the problem either and if you took a few seconds to read the question Its clearly states no to go thru every controller
@simon - rookie ass fool

 

 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to a topic in the Google Groups "CakePHP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cake-php/qY0yLORk4MM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Thursday, November 28, 2013

RE: Production and Development Environment

Hmm sounds like the exact thing I said……..and if you do

Beforefilter::parent () in the controller what was the point of asking if there is an easy way to no go thur every controller!

 

And that would not solve the problem either and if you took a few seconds to read the question Its clearly states no to go thru every controller
@simon - rookie ass fool

 

 

Re: Production and Development Environment

For that, you set up a deny by default in the AppController, and then override with specific allows in specific controllers.

And then in development, where you seem to want unfettered access, just remove the global deny, so everything is allowed. (or used a config to denote it's the development environment, and by pass the global deny if it is).


On Thu, Nov 28, 2013 at 7:47 PM, Advantage+ <movepixels@gmail.com> wrote:

I want to say mode= production so no access but login

 

And not go thru every controller and deny() that's what I am asking. Nothing to do with ajax

 

 

 

Dave Maharaj

Freelance Designer | Developer

www.movepixels.com  |  dave@movepixels.com  |  709.800.0852

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Reuben
Sent: Thursday, November 28, 2013 12:53 AM
To: cake-php@googlegroups.com
Subject: Re: Production and Development Environment

 

I'm assuming that's some sort of Ajax API that you're doing?

 

You could make your Javascript aware that it's in a development environment, and pass the Authorization token, as per http://coderseye.com/2007/how-to-do-http-basic-auth-in-ajax.html.

 

If you're using jQuery.ajax, you can pass the username and password for Basic Authentication, but that leaves you a bit open.  Also, it only sends the info when challenged with a 401, so explicit header setting might be your only option. [http://stackoverflow.com/questions/5507234/how-to-use-basic-auth-and-jquery-and-ajax]

 

You could update the programming to only require authentication for non-ajax requests, but that might be defeating the purposes as well.

 

Of course, I'm assuming that your application would normally use Form authorization in production, but you've got the added layer of Basic authentication in development.

 

This issue should only happen when calling the API from a different domain.  If the browser that is already authorized, is calling the APIs on the same domain, then the Authorization token <b>should</b> be sent automatically. I'm emphasizing that "should", because it would just seem screwy if it didn't.

On Thursday, 28 November 2013 09:48:42 UTC+10, advantage+ wrote:

Building a site on client's server and password protected but now adding in API functionality and the htaccess is blocking responses back from the API calls since they can't reach the site.

 

Is there a simply way to define production / development to allow access without password protecting the site.

I do not want to go thru all 65 controllers and re-code $this->Auth->deny() / allow();.

 

Thanks

 

Dave

 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.

To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to a topic in the Google Groups "CakePHP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cake-php/qY0yLORk4MM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Production and Development Environment



On Thu, Nov 28, 2013 at 5:47 PM, Advantage+ <movepixels@gmail.com> wrote:

I want to say mode= production so no access but login

 

And not go thru every controller and deny() that's what I am asking. Nothing to do with ajax

 

 

 

Dave Maharaj

Freelance Designer | Developer

www.movepixels.com  |  dave@movepixels.com  |  709.800.0852

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Reuben
Sent: Thursday, November 28, 2013 12:53 AM
To: cake-php@googlegroups.com
Subject: Re: Production and Development Environment

 

I'm assuming that's some sort of Ajax API that you're doing?

 

You could make your Javascript aware that it's in a development environment, and pass the Authorization token, as per http://coderseye.com/2007/how-to-do-http-basic-auth-in-ajax.html.

 

If you're using jQuery.ajax, you can pass the username and password for Basic Authentication, but that leaves you a bit open.  Also, it only sends the info when challenged with a 401, so explicit header setting might be your only option. [http://stackoverflow.com/questions/5507234/how-to-use-basic-auth-and-jquery-and-ajax]

 

You could update the programming to only require authentication for non-ajax requests, but that might be defeating the purposes as well.

 

Of course, I'm assuming that your application would normally use Form authorization in production, but you've got the added layer of Basic authentication in development.

 

This issue should only happen when calling the API from a different domain.  If the browser that is already authorized, is calling the APIs on the same domain, then the Authorization token <b>should</b> be sent automatically. I'm emphasizing that "should", because it would just seem screwy if it didn't.

On Thursday, 28 November 2013 09:48:42 UTC+10, advantage+ wrote:

Building a site on client's server and password protected but now adding in API functionality and the htaccess is blocking responses back from the API calls since they can't reach the site.

 

Is there a simply way to define production / development to allow access without password protecting the site.

I do not want to go thru all 65 controllers and re-code $this->Auth->deny() / allow();.

 

Thanks

 

Dave

 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.



--
Simon Males

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

RE: Production and Development Environment

I want to say mode= production so no access but login

 

And not go thru every controller and deny() that’s what I am asking. Nothing to do with ajax

 

 

 

Dave Maharaj

Freelance Designer | Developer

www.movepixels.com  |  dave@movepixels.com  |  709.800.0852

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Reuben
Sent: Thursday, November 28, 2013 12:53 AM
To: cake-php@googlegroups.com
Subject: Re: Production and Development Environment

 

I'm assuming that's some sort of Ajax API that you're doing?

 

You could make your Javascript aware that it's in a development environment, and pass the Authorization token, as per http://coderseye.com/2007/how-to-do-http-basic-auth-in-ajax.html.

 

If you're using jQuery.ajax, you can pass the username and password for Basic Authentication, but that leaves you a bit open.  Also, it only sends the info when challenged with a 401, so explicit header setting might be your only option. [http://stackoverflow.com/questions/5507234/how-to-use-basic-auth-and-jquery-and-ajax]

 

You could update the programming to only require authentication for non-ajax requests, but that might be defeating the purposes as well.

 

Of course, I'm assuming that your application would normally use Form authorization in production, but you've got the added layer of Basic authentication in development.

 

This issue should only happen when calling the API from a different domain.  If the browser that is already authorized, is calling the APIs on the same domain, then the Authorization token <b>should</b> be sent automatically. I'm emphasizing that "should", because it would just seem screwy if it didn't.

On Thursday, 28 November 2013 09:48:42 UTC+10, advantage+ wrote:

Building a site on client's server and password protected but now adding in API functionality and the htaccess is blocking responses back from the API calls since they can't reach the site.

 

Is there a simply way to define production / development to allow access without password protecting the site.

I do not want to go thru all 65 controllers and re-code $this->Auth->deny() / allow();.

 

Thanks

 

Dave

 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Wednesday, November 27, 2013

RE: Production and Development Environment

No no. Just site acces. Nothing to do with ajax.

 

Dave Maharaj

Freelance Designer | Developer

www.movepixels.com  |  dave@movepixels.com  |  709.800.0852

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Reuben
Sent: Thursday, November 28, 2013 12:53 AM
To: cake-php@googlegroups.com
Subject: Re: Production and Development Environment

 

I'm assuming that's some sort of Ajax API that you're doing?

 

You could make your Javascript aware that it's in a development environment, and pass the Authorization token, as per http://coderseye.com/2007/how-to-do-http-basic-auth-in-ajax.html.

 

If you're using jQuery.ajax, you can pass the username and password for Basic Authentication, but that leaves you a bit open.  Also, it only sends the info when challenged with a 401, so explicit header setting might be your only option. [http://stackoverflow.com/questions/5507234/how-to-use-basic-auth-and-jquery-and-ajax]

 

You could update the programming to only require authentication for non-ajax requests, but that might be defeating the purposes as well.

 

Of course, I'm assuming that your application would normally use Form authorization in production, but you've got the added layer of Basic authentication in development.

 

This issue should only happen when calling the API from a different domain.  If the browser that is already authorized, is calling the APIs on the same domain, then the Authorization token <b>should</b> be sent automatically. I'm emphasizing that "should", because it would just seem screwy if it didn't.

On Thursday, 28 November 2013 09:48:42 UTC+10, advantage+ wrote:

Building a site on client's server and password protected but now adding in API functionality and the htaccess is blocking responses back from the API calls since they can't reach the site.

 

Is there a simply way to define production / development to allow access without password protecting the site.

I do not want to go thru all 65 controllers and re-code $this->Auth->deny() / allow();.

 

Thanks

 

Dave

 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Production and Development Environment

I'm assuming that's some sort of Ajax API that you're doing?

You could make your Javascript aware that it's in a development environment, and pass the Authorization token, as per http://coderseye.com/2007/how-to-do-http-basic-auth-in-ajax.html.

If you're using jQuery.ajax, you can pass the username and password for Basic Authentication, but that leaves you a bit open.  Also, it only sends the info when challenged with a 401, so explicit header setting might be your only option. [http://stackoverflow.com/questions/5507234/how-to-use-basic-auth-and-jquery-and-ajax]

You could update the programming to only require authentication for non-ajax requests, but that might be defeating the purposes as well.

Of course, I'm assuming that your application would normally use Form authorization in production, but you've got the added layer of Basic authentication in development.

This issue should only happen when calling the API from a different domain.  If the browser that is already authorized, is calling the APIs on the same domain, then the Authorization token <b>should</b> be sent automatically. I'm emphasizing that "should", because it would just seem screwy if it didn't.

On Thursday, 28 November 2013 09:48:42 UTC+10, advantage+ wrote:

Building a site on client's server and password protected but now adding in API functionality and the htaccess is blocking responses back from the API calls since they can't reach the site.

 

Is there a simply way to define production / development to allow access without password protecting the site.

I do not want to go thru all 65 controllers and re-code $this->Auth->deny() / allow();.

 

Thanks

 

Dave

 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Production and Development Environment

Building a site on client's server and password protected but now adding in API functionality and the htaccess is blocking responses back from the API calls since they can't reach the site.

 

Is there a simply way to define production / development to allow access without password protecting the site.

I do not want to go thru all 65 controllers and re-code $this->Auth->deny() / allow();.

 

Thanks

 

Dave

 

Re: CakePHP 2.x running on Lighttpd

Did you found any solution for that?

Τη Δευτέρα, 11 Νοεμβρίου 2013 2:35:16 μ.μ. UTC+2, ο χρήστης Riccardo Trombini έγραψε:
Hi

Did someone successfully manage to run CakePHP 2.x on a lighttp server? I am having troubles accessing javascript and css-files. I run into an error 404. 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Tuesday, November 26, 2013

Re: send contact form to email in cakephp

Your missing a lot of CakePHP utility functions to make your life easier. What your doing at the moment has nothing to do with CakePHP as it is purely PHP.

Spend some time reading:
http://book.cakephp.org/2.0/en/controllers/request-response.html#cakerequest
http://book.cakephp.org/2.0/en/core-utility-libraries/email.html


On Fri, Nov 15, 2013 at 3:05 PM, Afiq Rashid <afiqrashid91@gmail.com> wrote:
this is my contact.ctp

<form name="contactform" method="post" action="send_form_email">
<table width="450px">
<tr>
 <td valign="top">
  <label for="first_name">First Name *</label>
 </td>
 <td valign="top">
  <input  type="text" name="first_name" maxlength="50" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="email">Email Address *</label>
 </td>
 <td valign="top">
  <input  type="text" name="email" maxlength="80" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="comments">Comments *</label>
 </td>
 <td valign="top">
  <textarea  name="comments" maxlength="1000" cols="25" rows="6"></textarea>
 </td>
</tr>
<tr>
 <td colspan="2" style="text-align:center">
  <input type="submit" value="Submit">   
 </td>
</tr>
</table>
</form>


and this is my send_form_email
  
<?php
if(isset($_POST['email'])) {
     
    // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = "afiqrashid91@gmail.com.my";
    $email_subject = "contactform";
     
     
    function died($error) {
        // your error code can go here
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go <a href=\"https://localhost/mall/pages/contact\">back</a> and fix these errors.<br /><br />";
        die();
    } 
     
 
    // validation expected data exists
    if(!isset($_POST['first_name']) ||
        !isset($_POST['email']) ||
        !isset($_POST['comments'])) {
        died('We are sorry, but there appears to be a problem with the form you submitted.');       
    }
     
    $first_name = $_POST['first_name']; // required
    $email_from = $_POST['email']; // required
    $comments = $_POST['comments']; // required
     
    $error_message = "";
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  if(!preg_match($email_exp,$email_from)) {
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  }
    $string_exp = "/^[A-Za-z .'-]+$/";
  if(!preg_match($string_exp,$first_name)) {
    $error_message .= 'The First Name you entered does not appear to be valid.<br />';
  }
  if(strlen($comments) < 2) {
    $error_message .= 'The Comments you entered do not appear to be valid.<br />';
  }
  if(strlen($error_message) > 0) {
    died($error_message);
  }
    $email_message = "Form details below.\n\n";
     
    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }
     
    $email_message .= "First Name: ".clean_string($first_name)."\n";
    $email_message .= "Email: ".clean_string($email_from)."\n";
    $email_message .= "Comments: ".clean_string($comments)."\n";
     
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email_to, $email_subject, $email_message, $headers);  
?>



when i click the submit button there is no error..but there is nothing when i check my email..

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.



--
Simon Males

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

RE: Best Practise - beforeValidate()

Yes I agree after thinking about it the only edits I will make is like you say formatting data like a phone number or making names, city uppercase for consistency.

 

Dave

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Reuben
Sent: Tuesday, November 26, 2013 8:45 PM
To: cake-php@googlegroups.com
Subject: Re: Best Practise - beforeValidate()

 

Usually, it's better to report the validation error, and leave it at that.  Altering the data to suite a validation rule could lead to issues down the line.

 

There are some cases where you might want to manipulate data before validation.  

 

For example, a controller that accepts a phone number, and stores it in a model.  The model may validate on one specific format (lets say, no spaces, and an international format), however, the controller may accept a variety of formats (spaces, local formats, parenthesis, dashes, etc).  Then you have the issue of automatic transformation, and if that transformation will be reflected to the user if the form should not validated.

 

For these steps, you may want to transform the value in the controller (though have the transform function on the model), and save the altered value to the request, before calling validate on the specific format.

 

For this particular example, you could also use a behaviour to automatically convert the phone number to different formats, depending on system requirements (either via a stored field indicating the format on the model, or simply attaching the behaviour to the model from the controller).

 

But that's a lot of messing around, and far removed your example.  For me, the best practice is to keep it simple, and not to alter the data, unless specifically requested by the key user or project requirements.

 

Regards

Reuben Helms

On Saturday, 23 November 2013 11:15:54 UTC+10, advantage+ wrote:

I know that.

I can simply set the validation to a-z and return the error to the user saying reason why error.

 

I am asking is it better to simply remove it in beforeValidate() then try to save it or simply skip beforeValidate() and send all the entered data direct to validation.

 

User enters $data['city'] = N3W Y0rk, now that’s not a real city so remove the 3 and the zero in before validate or just bypass it all together.

 

That’s all.

 

Thanks,

 

Dave

 

From: cake...@googlegroups.com [mailto:cake...@googlegroups.com] On Behalf Of Charles Blackwell
Sent: Friday, November 22, 2013 9:31 PM
To: cake...@googlegroups.com
Subject: Re: Best Practise - beforeValidate()

 

You could use validation and create a custom method to validate to your specification.

http://book.cakephp.org/2.0/en/models/data-validation.html#custom-validation-rules

On Friday, 22 November 2013 18:43:34 UTC-5, advantage+ wrote:

What is the best way when saving data for example take city or first name field.

You want it to only be a-z and a space - or.(period)

 

Should you in beforeValidate do a preg_replace and remove anything that you do not want then save(attempt) it or simply use the validation rules to check and save / return false explaining why?

 

Just curious as to how people approach this and reasons for doing it either way.

 

Thanks,

Dave

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+u...@googlegroups.com.
To post to this group, send email to cake...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Best Practise - beforeValidate()

Usually, it's better to report the validation error, and leave it at that.  Altering the data to suite a validation rule could lead to issues down the line.

There are some cases where you might want to manipulate data before validation.  

For example, a controller that accepts a phone number, and stores it in a model.  The model may validate on one specific format (lets say, no spaces, and an international format), however, the controller may accept a variety of formats (spaces, local formats, parenthesis, dashes, etc).  Then you have the issue of automatic transformation, and if that transformation will be reflected to the user if the form should not validated.

For these steps, you may want to transform the value in the controller (though have the transform function on the model), and save the altered value to the request, before calling validate on the specific format.

For this particular example, you could also use a behaviour to automatically convert the phone number to different formats, depending on system requirements (either via a stored field indicating the format on the model, or simply attaching the behaviour to the model from the controller).

But that's a lot of messing around, and far removed your example.  For me, the best practice is to keep it simple, and not to alter the data, unless specifically requested by the key user or project requirements.

Regards
Reuben Helms

On Saturday, 23 November 2013 11:15:54 UTC+10, advantage+ wrote:

I know that.

I can simply set the validation to a-z and return the error to the user saying reason why error.

 

I am asking is it better to simply remove it in beforeValidate() then try to save it or simply skip beforeValidate() and send all the entered data direct to validation.

 

User enters $data['city'] = N3W Y0rk, now that's not a real city so remove the 3 and the zero in before validate or just bypass it all together.

 

That's all.

 

Thanks,

 

Dave

 

From: cake...@googlegroups.com [mailto:cake...@googlegroups.com] On Behalf Of Charles Blackwell
Sent: Friday, November 22, 2013 9:31 PM
To: cake...@googlegroups.com
Subject: Re: Best Practise - beforeValidate()

 

You could use validation and create a custom method to validate to your specification.

http://book.cakephp.org/2.0/en/models/data-validation.html#custom-validation-rules

On Friday, 22 November 2013 18:43:34 UTC-5, advantage+ wrote:

What is the best way when saving data for example take city or first name field.

You want it to only be a-z and a space - or.(period)

 

Should you in beforeValidate do a preg_replace and remove anything that you do not want then save(attempt) it or simply use the validation rules to check and save / return false explaining why?

 

Just curious as to how people approach this and reasons for doing it either way.

 

Thanks,

Dave

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+u...@googlegroups.com.
To post to this group, send email to cake...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Upgrade problem (1.3 to 2.4) - missing Controller.php

Has your APP/Config/core.php been updated correctly to include "Configure::write('Error', array(" and "Configure::write('Exception', array(", as would be found in a fresh install of CakePHP 2.4?

It would probably be best to review your APP/Config/core.php and APP/Config/bootstrap.php files, and compare with a fresh install of CakePHP 2.4, to make sure everything in the fresh install is at least present in the the upgraded files.

Regards
Reuben Helms

On Tuesday, 29 October 2013 20:30:45 UTC+10, Azad Gh wrote:
Hi all,

I have a problem after upgrading CakePHP from 1.3 to 2.4 (the actual upgrade was done by the Upgrade shell). 
The error I'm getting is:

Notice: Undefined index: Error in /volume1/web/jeeves3/lib/Cake/Core/Configure.php on line 102 Notice: Undefined index: Exception in /volume1/web/jeeves3/lib/Cake/Core/Configure.php on line 103
Missing Controller

Error: Controller could not be found.
Error: Create the class Controller below in file: app/Controller/Controller.php

Stack Trace
APP/webroot/index.php line 110 ? Dispatcher->dispatch(CakeRequest, CakeResponse)


I've done some tinkering and searching for this problem, but basically I'm out of ideas on how to solve this issue. Has anyone any pointers or helpful advice?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.