Re: Help with function Login()--using Auth (Redirecting issue)

2010-12-28 Thread Amit Badkas
Hi,

I think the problem is due to other thing(s). I can't advise much without
looking at all of the code. However, please refer
http://book.cakephp.org/view/1250/Authentication to check if you have set-up
authentication parameters correctly or not.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 29, 2010 at 11:49 AM, John Maxim  wrote:

> Hi Amit,
>
> I used your code:
>
>  $this->redirect(array('controller' => 'posts', 'action' => 'index'));
>
> but it still redirects me to the root directory...
>
> What can be wrong ?
>
>
>
> On Dec 29, 1:39 pm, Amit Badkas  wrote:
> > Hi,
> >
> > In CakePHP, the views don't display directly, you need to render them
> using
> > actions of controllers. From your description, it seems that you need to
> > redirect to /posts/index page, so use
> >
> > $this->redirect(array('controller' => 'posts', 'action' => 'index'));
> >
> > to go to that page.
> >
> > Hope this helps.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Wed, Dec 29, 2010 at 10:28 AM, John Maxim  wrote:
> > > Users_controllers.php:
> > > 
> >
> > > var $name = 'Users';
> >
> > > /*some codes in between*/
> >
> > > function login()
> > > {
> > > if(!empty($this->data))
> > >{
> > > // If the username/password match
> > > if($this->Auth->login($this->data))
> > > {
> > > $this->redirect(array('action' => 'index'), null,
> > > true);
> > > } else {
> > >$this->User->invalidate('username', 'Username and
> password
> > > combination is incorrect!');
> > > }
> > > }
> > >  }
> >
> > > -
> > > Hi,
> >
> > > After successful login, I want it to redirect to app/views/posts/
> > > index.ctp
> >
> > > Originally, the redirect code is like this:
> > > (1)
> > > ~~
> > > $this->redirect('/');
> > > ~~
> > > I changed to:
> > > (2)
> > > ~~
> > >  $this->redirect(array('action' => 'index'), null, true);
> > > ~~
> > > (3)
> > > ~~
> > > $this->redirect(array('action' => 'views/posts/index'), null, true);
> > > ~~
> >
> > > All failed to redirect to *app/views/posts/index.ctp
> > > ~~
> > > It consistently redirected me to my App/index.ctp which displays all
> > > my cakephp versions stuff (mod rewrite...etc the green page),
> > > regardless of the 3 redirect methods used above.
> >
> > > Is it something wrong with my Login() function instead ??
> >
> > > Thanks,
> >
> > > Maxim J.
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> >For
> more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Help with function Login()--using Auth (Redirecting issue)

2010-12-28 Thread John Maxim
Hi Amit,

I used your code:

 $this->redirect(array('controller' => 'posts', 'action' => 'index'));

but it still redirects me to the root directory...

What can be wrong ?



On Dec 29, 1:39 pm, Amit Badkas  wrote:
> Hi,
>
> In CakePHP, the views don't display directly, you need to render them using
> actions of controllers. From your description, it seems that you need to
> redirect to /posts/index page, so use
>
> $this->redirect(array('controller' => 'posts', 'action' => 'index'));
>
> to go to that page.
>
> Hope this helps.
>
> Amit Badkas
>
> PHP Applications for E-Biz:http://www.sanisoft.com
>
> On Wed, Dec 29, 2010 at 10:28 AM, John Maxim  wrote:
> > Users_controllers.php:
> > 
>
> > var $name = 'Users';
>
> > /*some codes in between*/
>
> > function login()
> > {
> >         if(!empty($this->data))
> >        {
> >                 // If the username/password match
> >                 if($this->Auth->login($this->data))
> >                 {
> >                 $this->redirect(array('action' => 'index'), null,
> > true);
> >                 } else {
> >                $this->User->invalidate('username', 'Username and password
> > combination is incorrect!');
> >                 }
> >         }
> >  }
>
> > -
> > Hi,
>
> > After successful login, I want it to redirect to app/views/posts/
> > index.ctp
>
> > Originally, the redirect code is like this:
> > (1)
> > ~~
> > $this->redirect('/');
> > ~~
> > I changed to:
> > (2)
> > ~~
> >  $this->redirect(array('action' => 'index'), null, true);
> > ~~
> > (3)
> > ~~
> > $this->redirect(array('action' => 'views/posts/index'), null, true);
> > ~~
>
> > All failed to redirect to *app/views/posts/index.ctp
> > ~~
> > It consistently redirected me to my App/index.ctp which displays all
> > my cakephp versions stuff (mod rewrite...etc the green page),
> > regardless of the 3 redirect methods used above.
>
> > Is it something wrong with my Login() function instead ??
>
> > Thanks,
>
> > Maxim J.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Help with function Login()--using Auth (Redirecting issue)

2010-12-28 Thread Amit Badkas
Hi,

In CakePHP, the views don't display directly, you need to render them using
actions of controllers. From your description, it seems that you need to
redirect to /posts/index page, so use

$this->redirect(array('controller' => 'posts', 'action' => 'index'));

to go to that page.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 29, 2010 at 10:28 AM, John Maxim  wrote:

> Users_controllers.php:
> 
>
> var $name = 'Users';
>
> /*some codes in between*/
>
> function login()
> {
> if(!empty($this->data))
>{
> // If the username/password match
> if($this->Auth->login($this->data))
> {
> $this->redirect(array('action' => 'index'), null,
> true);
> } else {
>$this->User->invalidate('username', 'Username and password
> combination is incorrect!');
> }
> }
>  }
>
> -
> Hi,
>
> After successful login, I want it to redirect to app/views/posts/
> index.ctp
>
> Originally, the redirect code is like this:
> (1)
> ~~
> $this->redirect('/');
> ~~
> I changed to:
> (2)
> ~~
>  $this->redirect(array('action' => 'index'), null, true);
> ~~
> (3)
> ~~
> $this->redirect(array('action' => 'views/posts/index'), null, true);
> ~~
>
> All failed to redirect to *app/views/posts/index.ctp
> ~~
> It consistently redirected me to my App/index.ctp which displays all
> my cakephp versions stuff (mod rewrite...etc the green page),
> regardless of the 3 redirect methods used above.
>
> Is it something wrong with my Login() function instead ??
>
>
>
> Thanks,
>
> Maxim J.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


RE: Owner Check

2010-12-28 Thread Dave Maharaj
Ok basically this is it.

Someone wants to access something ($id) how do YOU (yourself) or any other
Cake user check if it’s the owner. I'm doing it 1 way so I want to see how
others are doing it. That’s all.

The way I am doing it works sure but I want to know if what I am doing is
the right way, is there a better way, easier way..options I can use to make
it easier...better.

I have seen examples where $id is passed and then 

Function edit($id){
$data = $this->Model->read($id); 
//get the data from the db then 
if($data['Model']['user_id'] === $this->Auth->User('id') && $id ===
$data['Model']['id']){

//is owner

} else {

//is not owner

}

}

or what im doing simply forget the 'read' and do a find with $data =
$this->Model->someFunction( $id, $this->Auth->User('id)) and 
if $data (yes the function will only pull the record to the user check
ownership there I guess you could say because it will not pull records that
are not Auth->User id)

Because in the first example the $id will read from the db no matter what as
long as $id is passed and $id is in the db so your going to the db no matter
what and reading the data.
In my way with $data = $this->Model->someFunction( $id,
$this->Auth->User('id)); your only reading / finding / retrieving data if
the conditions exist.

In my head I think why pull the data if its not the owner with read? So pull
the data using a find and if anything is found then continue on with the
request.

Does that make sense...hope that pretty much sums it up.

Thanks again for your response.

Dave

-Original Message-
From: cricket [mailto:zijn.digi...@gmail.com] 
Sent: Wednesday, December 29, 2010 12:35 AM
To: cake-php@googlegroups.com
Subject: Re: Owner Check

On Tue, Dec 28, 2010 at 9:02 PM, Dave Maharaj  wrote:
> Sorry, this is getting away from the original question.
> Nothing to do with the actual function of getting the data just simply the
> hypothetical way to check if it's the owner or not. Just the way the code
is
> structured.
>
> 1.attempt to get data based on the $id requested (the function will either
> find something or not is all we are concerned about for the example)
> 2.if record found do something with data
> 2a. if no data found for whatever reason, no record exists, not correct
user
> requesting record, not logged inanything.
>
> How do you check if the request for a record belong to user?
> Im referring to the code how its written not the actual functionality of
if
> found / correct user / auth
>
> When you check your requests against user sure you check if the user owns
> the record, I'm interested in the flow process of how others go about it,
if
> im doing it right, if there is a better way, easier way?
>
> JUST THIS BELOW (THE STRUCTURE / WORK FLOW )
> 
>
> Function edit($id){
> $data = $this->User->somefunctionToReturnUserRecord( $id, $auth_id);
>
> If($data){
> //do something with data
> }
>  If (!$data){
> //something went wrong
>  }
> }
>

I'm not entirely sure what you're getting at. But, if the User hasMany
Record, and the method param is the Record.id, I guess it makes most
sense to first fetch the Record, then test if it's empty. If empty,
return not found error. If not, then check $data['Record']['user_id']
against $this->Auth->user('id') and respond accordingly.

Is that what you're asking?

Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Help with function Register--using Auth

2010-12-28 Thread John Maxim

Thanks Amit.

I understand now.

Regards,

Maxim
On Dec 29, 12:26 pm, Amit Badkas  wrote:
> Hi,
>
> The code posted by you in second mail is the most common way to validate and
> save data in a single go but it doesn't mean that you can't do it using
> validates() and save(). As you asked in the first mail about what's wrong in
> the code, I pointed you to the missing 'set' code, that's it.
>
> Amit Badkas
>
> PHP Applications for E-Biz:http://www.sanisoft.com
>
> On Wed, Dec 29, 2010 at 9:47 AM, John Maxim  wrote:
> > Hi Amit,
>
> > Thanks, crossed posted with your message..
>
> > Why is it we do the validation in Controller? instead of like the code
> > I provided for the second one.
>
> > On Dec 29, 12:08 pm, Amit Badkas  wrote:
> > > Hi,
>
> > > You need to set the data for the model to validate it, please
> > referhttp://book.cakephp.org/view/1182/Validating-Data-from-the-Controller
>
> > > Amit Badkas
>
> > > PHP Applications for E-Biz:http://www.sanisoft.com
>
> > > On Wed, Dec 29, 2010 at 9:36 AM, John Maxim  wrote:
> > > > function register()
> > > > {
> > > >         if(!empty($this->data))
> > > >        {
>
> > > >             if($this->User->validates())
> > > >               {
> > > >                 $this->User->save($this->data);
>
> > > >                 $data = $this->User->read();
>
> > > >                 $this->Auth->login($data);
>
> > > >                 $this->redirect('/');
> > > >                }
> > > >          }
> > > >   }
> > > > 
> > > > Hi,
>
> > > > My models/user.php validation scripts stopped working if I used the
> > > > above script in my controller. What's wrong with it?
>
> > > > Thanks,
>
> > > > Maxim J.
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > others
> > > > with their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com
> > >For
> > more options, visit this group at
> > > >http://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Help with function Login()--using Auth (Redirecting issue)

2010-12-28 Thread John Maxim
Users_controllers.php:


var $name = 'Users';

/*some codes in between*/

function login()
{
 if(!empty($this->data))
{
 // If the username/password match
 if($this->Auth->login($this->data))
 {
 $this->redirect(array('action' => 'index'), null,
true);
 } else {
$this->User->invalidate('username', 'Username and password
combination is incorrect!');
 }
 }
 }

-
Hi,

After successful login, I want it to redirect to app/views/posts/
index.ctp

Originally, the redirect code is like this:
(1)
~~
$this->redirect('/');
~~
I changed to:
(2)
~~
 $this->redirect(array('action' => 'index'), null, true);
~~
(3)
~~
$this->redirect(array('action' => 'views/posts/index'), null, true);
~~

All failed to redirect to *app/views/posts/index.ctp
~~
It consistently redirected me to my App/index.ctp which displays all
my cakephp versions stuff (mod rewrite...etc the green page),
regardless of the 3 redirect methods used above.

Is it something wrong with my Login() function instead ??



Thanks,

Maxim J.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Help with function Register--using Auth

2010-12-28 Thread Amit Badkas
Hi,

The code posted by you in second mail is the most common way to validate and
save data in a single go but it doesn't mean that you can't do it using
validates() and save(). As you asked in the first mail about what's wrong in
the code, I pointed you to the missing 'set' code, that's it.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 29, 2010 at 9:47 AM, John Maxim  wrote:

> Hi Amit,
>
> Thanks, crossed posted with your message..
>
> Why is it we do the validation in Controller? instead of like the code
> I provided for the second one.
>
>
>
> On Dec 29, 12:08 pm, Amit Badkas  wrote:
> > Hi,
> >
> > You need to set the data for the model to validate it, please
> referhttp://book.cakephp.org/view/1182/Validating-Data-from-the-Controller
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Wed, Dec 29, 2010 at 9:36 AM, John Maxim  wrote:
> > > function register()
> > > {
> > > if(!empty($this->data))
> > >{
> >
> > > if($this->User->validates())
> > >   {
> > > $this->User->save($this->data);
> >
> > > $data = $this->User->read();
> >
> > > $this->Auth->login($data);
> >
> > > $this->redirect('/');
> > >}
> > >  }
> > >   }
> > > 
> > > Hi,
> >
> > > My models/user.php validation scripts stopped working if I used the
> > > above script in my controller. What's wrong with it?
> >
> > > Thanks,
> >
> > > Maxim J.
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> >For
> more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Help with function Register--using Auth

2010-12-28 Thread John Maxim
Hi Amit,

Thanks, crossed posted with your message..

Why is it we do the validation in Controller? instead of like the code
I provided for the second one.



On Dec 29, 12:08 pm, Amit Badkas  wrote:
> Hi,
>
> You need to set the data for the model to validate it, please 
> referhttp://book.cakephp.org/view/1182/Validating-Data-from-the-Controller
>
> Amit Badkas
>
> PHP Applications for E-Biz:http://www.sanisoft.com
>
> On Wed, Dec 29, 2010 at 9:36 AM, John Maxim  wrote:
> > function register()
> > {
> >         if(!empty($this->data))
> >        {
>
> >             if($this->User->validates())
> >               {
> >                 $this->User->save($this->data);
>
> >                 $data = $this->User->read();
>
> >                 $this->Auth->login($data);
>
> >                 $this->redirect('/');
> >                }
> >          }
> >   }
> > 
> > Hi,
>
> > My models/user.php validation scripts stopped working if I used the
> > above script in my controller. What's wrong with it?
>
> > Thanks,
>
> > Maxim J.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Help with function Register--using Auth

2010-12-28 Thread John Maxim
Hence, I use Stephen Ninja Coder's script which he helped me with
earlier:

function register()
{
if(!empty($this->data))
{
$this->User->create();
if($this->User->save($this->data))
{
// Validated, Saved the new User.
// Auth component has automatically hashed the
password.
// Job Done :)

$this->Session->setFlash('Your account has been
created successfully');
$this->redirect(array('controller' => 'users',
'action' => 'login'));
 }
}
}
--

which is working fine. But why does the first one not work ? I'm
trying to understand better...

On Dec 29, 12:06 pm, John Maxim  wrote:
> function register()
> {
>          if(!empty($this->data))
>         {
>
>              if($this->User->validates())
>                {
>                  $this->User->save($this->data);
>
>                  $data = $this->User->read();
>
>                  $this->Auth->login($data);
>
>                  $this->redirect('/');
>                 }
>           }
>    }
> 
> Hi,
>
> My models/user.php validation scripts stopped working if I used the
> above script in my controller. What's wrong with it?
>
> Thanks,
>
> Maxim J.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Help with function Register--using Auth

2010-12-28 Thread Amit Badkas
Hi,

You need to set the data for the model to validate it, please refer
http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 29, 2010 at 9:36 AM, John Maxim  wrote:

> function register()
> {
> if(!empty($this->data))
>{
>
> if($this->User->validates())
>   {
> $this->User->save($this->data);
>
> $data = $this->User->read();
>
> $this->Auth->login($data);
>
> $this->redirect('/');
>}
>  }
>   }
> 
> Hi,
>
> My models/user.php validation scripts stopped working if I used the
> above script in my controller. What's wrong with it?
>
> Thanks,
>
> Maxim J.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Can we mix plain php,html and cakephp?

2010-12-28 Thread cricket
On Tue, Dec 28, 2010 at 3:27 PM, euromark  wrote:
> no, you can do that
> sometimes it is cleaner to use cake, sometimes you want the speedier
> html.
> you have to decide whats best for you.
>
> i usually use the helper for forms etc
> but tables and p/div blocks are easier with plain html - in my opinion
>
> in general, the helper syntax keeps your code "up to date"
> it wraps it, so in case the syntax changes, it can be switched
> automatically
> if you hard-code it, you need to do those things yourself.

I'll add that the only really important thing is that the form
element's name corresponds to what Cake would expect. If you're ever
unsure of what to use, have FormHelper create the element for you and
view source. Then use your HTML version using that name.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Help with function Register--using Auth

2010-12-28 Thread John Maxim
function register()
{
 if(!empty($this->data))
{

 if($this->User->validates())
   {
 $this->User->save($this->data);

 $data = $this->User->read();

 $this->Auth->login($data);

 $this->redirect('/');
}
  }
   }

Hi,

My models/user.php validation scripts stopped working if I used the
above script in my controller. What's wrong with it?

Thanks,

Maxim J.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Owner Check

2010-12-28 Thread cricket
On Tue, Dec 28, 2010 at 9:02 PM, Dave Maharaj  wrote:
> Sorry, this is getting away from the original question.
> Nothing to do with the actual function of getting the data just simply the
> hypothetical way to check if it's the owner or not. Just the way the code is
> structured.
>
> 1.attempt to get data based on the $id requested (the function will either
> find something or not is all we are concerned about for the example)
> 2.if record found do something with data
> 2a. if no data found for whatever reason, no record exists, not correct user
> requesting record, not logged inanything.
>
> How do you check if the request for a record belong to user?
> Im referring to the code how its written not the actual functionality of if
> found / correct user / auth
>
> When you check your requests against user sure you check if the user owns
> the record, I'm interested in the flow process of how others go about it, if
> im doing it right, if there is a better way, easier way?
>
> JUST THIS BELOW (THE STRUCTURE / WORK FLOW )
> 
>
> Function edit($id){
> $data = $this->User->somefunctionToReturnUserRecord( $id, $auth_id);
>
> If($data){
> //do something with data
> }
>  If (!$data){
> //something went wrong
>  }
> }
>

I'm not entirely sure what you're getting at. But, if the User hasMany
Record, and the method param is the Record.id, I guess it makes most
sense to first fetch the Record, then test if it's empty. If empty,
return not found error. If not, then check $data['Record']['user_id']
against $this->Auth->user('id') and respond accordingly.

Is that what you're asking?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Help on Routes, should we use it ?

2010-12-28 Thread cricket
On Tue, Dec 28, 2010 at 10:14 AM, John Maxim  wrote:
> Refer to link below:
> http://book.cakephp.org/view/1541/Routes
>
> I don't understand. What does it accomplish ??
>
> Do we normally change the route as shown from the link above ?


Cake's routes default to:

/controller/action/param

So, if you had a BookController, to view a specific Book, you'd have
something like:

/books/view/42

... where 42 is the $id of this Book. However, you might instead want
to have URLs like:

/books/alice-in-wonderland

... in which case, you'd want a route like so:

Router::connect(
'/books/:slug',
array(
'controller' => 'books',
'action' => 'view',
),
array(
'slug' => '[-a-z0-9]+',
'pass' => array('slug')
)
);

So, Book.slug must be contain only lowercase alpha chars, integers, or
hyphens. And your Book model would have:

public $actsAs = array(
'Sluggable' => array(
'translation' => 'utf-8',
'separator' => '-',
'label' => 'title',
'length' => 64,
'overwrite' => true
)
);

Note the separator is a hyphen. It can also be an underscore, or
whatever. Just ensure the route regexp is set up for that.

Your action would then be defined as:

public function view($slug = null) {

Meanwhile, to create a link in a view (other mark-up aside):

foreach ($data as $d)
{
echo $this->Html->link(
$d['Book']['title'],
array(
'controller' => 'books',
'action' => 'view',
'slug' => $d['Book']['slug']
),
array('title' => 'read this book')
);
}

Note that 'slug' is passed in the first array, whereas it's in the
second array in the route definition. If it's an admin route, you pass
'admin' => 1 in the first array for both link and route, and the URL
would be '/admin/...' inthe route.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


RE: Owner Check

2010-12-28 Thread Dave Maharaj
Sorry, this is getting away from the original question. 
Nothing to do with the actual function of getting the data just simply the
hypothetical way to check if it's the owner or not. Just the way the code is
structured.

1.attempt to get data based on the $id requested (the function will either
find something or not is all we are concerned about for the example)
2.if record found do something with data
2a. if no data found for whatever reason, no record exists, not correct user
requesting record, not logged inanything.

How do you check if the request for a record belong to user? 
Im referring to the code how its written not the actual functionality of if
found / correct user / auth

When you check your requests against user sure you check if the user owns
the record, I'm interested in the flow process of how others go about it, if
im doing it right, if there is a better way, easier way?

JUST THIS BELOW (THE STRUCTURE / WORK FLOW )


Function edit($id){
$data = $this->User->somefunctionToReturnUserRecord( $id, $auth_id);

If($data){
//do something with data
}
 If (!$data){
//something went wrong
 }
}

Thanks,

Dave

-Original Message-
From: cricket [mailto:zijn.digi...@gmail.com] 
Sent: Tuesday, December 28, 2010 10:30 PM
To: cake-php@googlegroups.com
Subject: Re: Owner Check

On Tue, Dec 28, 2010 at 2:44 PM, Dave Maharaj  wrote:
> So is that the best way to check owner against user? Well im sure there is
> no best way since every situation is different but doing it this way is
just
> as good?
> Simply try to get the request as normal and then process it. If $data then
> there is a record do whatever with the data, if no $data then the user is
> attempting to get something not theirs so $data will be empty tell user
they
> are an idiot :)
>
> Just curious since some of the function
>
> $data = $this->User->somefunctionToReturnUserRecord();
>
> If($data){
>
>
> }
> If (!$data){
>
> }

I think there are two separate issues here: whether the logged-in User
owns the Record; and whether the User has any Records at all. In the
first case, it comes down to getting $user_id =
$this->Auth->user('id') and then doing a find with the conditions that
the Record.id == $id and Record.user_id == $user_id.

Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Owner Check

2010-12-28 Thread cricket
On Tue, Dec 28, 2010 at 2:44 PM, Dave Maharaj  wrote:
> So is that the best way to check owner against user? Well im sure there is
> no best way since every situation is different but doing it this way is just
> as good?
> Simply try to get the request as normal and then process it. If $data then
> there is a record do whatever with the data, if no $data then the user is
> attempting to get something not theirs so $data will be empty tell user they
> are an idiot :)
>
> Just curious since some of the function
>
> $data = $this->User->somefunctionToReturnUserRecord();
>
> If($data){
>
>
> }
> If (!$data){
>
> }

I think there are two separate issues here: whether the logged-in User
owns the Record; and whether the User has any Records at all. In the
first case, it comes down to getting $user_id =
$this->Auth->user('id') and then doing a find with the conditions that
the Record.id == $id and Record.user_id == $user_id.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: File upload

2010-12-28 Thread cricket
On Tue, Dec 28, 2010 at 3:47 PM, Ryan Schmidt
 wrote:
>
> On Dec 28, 2010, at 09:44, Leandro Montero wrote:
>
>> In $this->data there is nothing!! I mean the file upload array doesn't
>> exist!
>
> If there's *nothing* in $this->data, i.e. no files, no other fields, then 
> that means the size of the file you uploaded exceeded PHP's maximum POST data 
> size. You can change this setting in your php.ini.

I think that's the likely issue, also. Note that  this is different
than the max upload size, though. If that were the case, $this->data
would be there but the upload error would show that the file upload
size was exceeded.

And you should start debugging this from the add action in your
controller. Make sure that $this->data has what you expect before
checking the downstream methods you're calling. Add
die(debug($this->data)) to your actions to see what (if anything) has
been received by the server.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Urgent Help needed: How to Correct this table so it doesn't have Composite Primary Key?

2010-12-28 Thread AD7six


On Dec 28, 3:55 am, John Maxim  wrote:
> Hi Jeremy, Thanks for your link will definitely look into that.
>
> ~~Continue my question~~
> I was going to ask about using this:http://book.cakephp.org/view/1027/query
>
> There are 2 options if I'm correct based on cookbook 1.3
> ~~
> Rather than using an auto-increment key as the primary key, you may
> also use char(36). Cake will then use a unique 36 character uuid
> (String::uuid) whenever you save a new record using the Model::save
> method.
>
> according to:http://book.cakephp.org/view/903/Model-and-Database-Conventions
> ~~
> What's the advantage of using char(36) ?

A uuid (a 36 char string) is unique - always. It's main purpose is to
be unique, nothing else. Obfuscation is a side effect, not the goal.

They are most relevant with distributed datastores whereby you need to
synchronize data and inserts across multiple servers. An insert on
server A can safely and without concern be replicated to server B
because a row with the same ID cannot exist originating from another
server.

http://en.wikipedia.org/wiki/Universally_unique_identifier

AD

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Urgent Help needed: How to Correct this table so it doesn't have Composite Primary Key?

2010-12-28 Thread Jeremy Burns | Class Outfit
I would also add that it can be difficult to work with if you need to transpose 
or retype/re-enter the ids at any time. Having said all that, I think UUIDs 
have a definite place in an app.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 28 Dec 2010, at 20:59, Ryan Schmidt wrote:

> 
> On Dec 28, 2010, at 04:39, Jeremy Burns | Class Outfit wrote:
> 
>> I *think* the main benefit is obfuscation - if you want to hide the fact 
>> that I am only the third user, for example. It also makes it more difficult 
>> to guess the id belonging to another row in the table (for example, a table 
>> that stores company records).
> 
> That's what I would think as well. Take for example Craig's List. Each ad has 
> an auto-increment id, which appears in the email address that you use to 
> respond to the ad, e.g. "sale-12345678 at craigslist dot org". I imagine they 
> were getting a lot of spam under that system, since if you can see what one 
> ad's id is, you can guess others. So now they insert a hash of some kind in 
> addition to that id, e.g. "sale-m4m92-12345678 at craigslist dot org". Now 
> even if you know the sequence of auto-increment ids they use, you can't guess 
> the hash. If they were redesigning the system today, maybe they would omit 
> the auto-increment id altogether and use only a hash (though it would have to 
> be much longer than 5 characters to avoid collisions).
> 
> Obfuscation shouldn't be your only security measure, but it can be a helpful 
> additional step in some situations.
> 
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Urgent Help needed: How to Correct this table so it doesn't have Composite Primary Key?

2010-12-28 Thread Ryan Schmidt

On Dec 28, 2010, at 04:39, Jeremy Burns | Class Outfit wrote:

> I *think* the main benefit is obfuscation - if you want to hide the fact that 
> I am only the third user, for example. It also makes it more difficult to 
> guess the id belonging to another row in the table (for example, a table that 
> stores company records).

That's what I would think as well. Take for example Craig's List. Each ad has 
an auto-increment id, which appears in the email address that you use to 
respond to the ad, e.g. "sale-12345678 at craigslist dot org". I imagine they 
were getting a lot of spam under that system, since if you can see what one 
ad's id is, you can guess others. So now they insert a hash of some kind in 
addition to that id, e.g. "sale-m4m92-12345678 at craigslist dot org". Now even 
if you know the sequence of auto-increment ids they use, you can't guess the 
hash. If they were redesigning the system today, maybe they would omit the 
auto-increment id altogether and use only a hash (though it would have to be 
much longer than 5 characters to avoid collisions).

Obfuscation shouldn't be your only security measure, but it can be a helpful 
additional step in some situations.


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: File upload

2010-12-28 Thread Ryan Schmidt

On Dec 28, 2010, at 09:44, Leandro Montero wrote:

> In $this->data there is nothing!! I mean the file upload array doesn't
> exist!

If there's *nothing* in $this->data, i.e. no files, no other fields, then that 
means the size of the file you uploaded exceeded PHP's maximum POST data size. 
You can change this setting in your php.ini.



Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: equalTo validation for booleans

2010-12-28 Thread Ryan Schmidt

On Dec 28, 2010, at 12:05, Jeremy Burns | Class Outfit wrote:

> Solved - this works:
> 
> 'rule' => array('equalTo', '1'),
> 
> ...oddly enough.

As you found, CakePHP's equalTo method doesn't use the equal-to operator (==) 
but the identical-to operator (===) which means you're checking not only the 
value of the variable but also its type. And form field values would tend to 
come through as strings. So you need to compare them to strings, not Booleans, 
not integers -- nonintuitive though I admit that is for checkboxes which we 
naturally think of as Boolean values.


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Can we mix plain php,html and cakephp?

2010-12-28 Thread euromark
no, you can do that
sometimes it is cleaner to use cake, sometimes you want the speedier
html.
you have to decide whats best for you.

i usually use the helper for forms etc
but tables and p/div blocks are easier with plain html - in my opinion

in general, the helper syntax keeps your code "up to date"
it wraps it, so in case the syntax changes, it can be switched
automatically
if you hard-code it, you need to do those things yourself.


On 28 Dez., 21:19, Taffarel de Lima  wrote:
> dave, i knew that. the question is there some problems if i want to use cake
> mix with php and html?
>
> 2010/12/28 Dave Maharaj 
>
>
>
>
>
>
>
>
>
> >  Cake can automatically add your selects so you do not need to manually do
> > that.
>
> > In controller:
>
> > $departments = $this->Employee->Department->find(‘list’);//get list of all
> > the departments
>
> > $this->set(compact(‘departments’));
>
> > Then in the form echo $this->Form->input('departments');
>
> > Read the book or API classes as there are options to set empty value =>
> > Find in the List, ‘type’,  $options. Whole slew of options available in
> > FormHelper
>
> > *From:* Taffarel de Lima [mailto:taffare...@gmail.com]
> > *Sent:* Tuesday, December 28, 2010 4:18 PM
> > *To:* cake-php@googlegroups.com
> > *Subject:* Re: Can we mix plain php,html and cakephp?
>
> > i don't see anything wrong with that. if there some wrong, someone can
> > explain
>
> > 2010/12/28 poor-grammar 
>
> > hello, i am new to cakephp, and still going thru the manual...
>
> > Is there a way to mix cakephp with plain php and HTML i mean
> > something like this in the code
>
> > --- 
> > -
> >  > echo $this->Form->create('Employee',array('action'=>'edit'));
> >    echo $this->Form->input('id',array('type'=>'hidden'));
> >    echo $this->Form->input('emp_name');
> >    echo $this->Form->input('emp_email');
> >    echo $this->Form->input('emp_phone');
> >    echo $this->Form->input('emp_address');
> >    echo $this->Form->input('emp_joindate');
> >   echo $this->Form->input('emp_dob');
> >  ?>
> > 
> > find in the list
> > finance
> > marketing
> > reserve
> > deployment
> > testing
> > research
> > 
> > Form->end('Save');?>
>
> > something like this... there must be a way to mix these 2 . after
> > all its the POWER of PHP
>
> > also can u please guide me to some links to read what can be done and
> > what can't be done while mixing cakephp and php and html...
>
> > thanks
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> > --
> > *Taffarel de Lima Oliveira (Taffarelo3)*
>
> > *Desenvolvedor Web*
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> --
> *Taffarel de Lima Oliveira (Taffarelo3)*
> *
> *
> *Desenvolvedor Web*

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Problem with Mail Component

2010-12-28 Thread vivid

Hello,
i have a problem with sending mails via the mail component.
German special characters like ä, ö, ü and so on are not displayed
correctly. Additionally attachments are shown as a base64 string.
Here is the source code of an email:

Return-Path: 
Received: from xxx (xxx [xxx.xx.xx.xxx])
by ds9 (Cyrus v2.2.13-Debian-2.2.13-19) with LMTPA;
Tue, 28 Dec 2010 18:30:41 +0100
X-Sieve: CMU Sieve 2.2
Received: by xxx (Postfix, from userid 23675)
   id 576E28362; Tue, 28 Dec 2010 18:30:39 +0100 (CET)
To: xxx
Subject: xxx
From: Max Mustermann 
Message-ID: 
Date: Tue, 28 Dec 2010 18:30:41 +0100

Reply-To: xxx
Message-ID: <4d1a1ebf-87b0-463b-b6b8-0e43d43e4...@xxx.de>
X-Mailer: CakePHP Email Component
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary=8f3e9de395be81a5a33aae8d0805d5d5
0: This part of the E-mail should never be seen. If
1: you are reading this, consider upgrading your e-mail
2: client to a MIME-compatible client.
Date: Tue, 28 Dec 2010 18:30:39 +0100 (CET)

--8f3e9de395be81a5a33aae8d0805d5d5
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Replaced Mail Content

--8f3e9de395be81a5a33aae8d0805d5d5
Content-Disposition: attachment; filename="hdfghgh.pdf"
Content-Type: application/pdf; name="hdfghgh.pdf"
Content-Transfer-Encoding: base64

JVBERi0xLjMKJcTl8uXrp/
Og0MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRmlsdGVyIC9G
IF0gPj4Kc3RhcnR4cmVmCjYzMjQKJSVFT0YK



--8f3e9de395be81a5a33aae8d0805d5d5--

Its not the complete base64 file part of the mail.

I hope someone can help me

Thanks,
nic
-- 
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Problem-with-Mail-Component-tp3320601p3320601.html
Sent from the CakePHP mailing list archive at Nabble.com.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Problem with Mail Component

2010-12-28 Thread vivid
Hello,
i have a problem with sending mails via the mail component.
German special characters like ä, ö, ü and so on are not displayed
correctly. Additionally attachments are shown as a base64 string.
Here is the source code of an email:

Return-Path: 
Received: from xxx (xxx [xxx.xx.xx.xxx])
 by ds9 (Cyrus v2.2.13-Debian-2.2.13-19) with LMTPA;
 Tue, 28 Dec 2010 18:30:41 +0100
X-Sieve: CMU Sieve 2.2
Received: by xxx (Postfix, from userid 23675)
id 576E28362; Tue, 28 Dec 2010 18:30:39 +0100 (CET)
To: xxx
Subject: xxx
From: Max Mustermann 
Message-ID: 
Date: Tue, 28 Dec 2010 18:30:41 +0100

Reply-To: xxx
Message-ID: <4d1a1ebf-87b0-463b-b6b8-0e43d43e4...@xxx.de>
X-Mailer: CakePHP Email Component
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary=8f3e9de395be81a5a33aae8d0805d5d5
0: This part of the E-mail should never be seen. If
1: you are reading this, consider upgrading your e-mail
2: client to a MIME-compatible client.
Date: Tue, 28 Dec 2010 18:30:39 +0100 (CET)

--8f3e9de395be81a5a33aae8d0805d5d5
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Replaced Mail Content

--8f3e9de395be81a5a33aae8d0805d5d5
Content-Disposition: attachment; filename="hdfghgh.pdf"
Content-Type: application/pdf; name="hdfghgh.pdf"
Content-Transfer-Encoding: base64

JVBERi0xLjMKJcTl8uXrp/
Og0MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRmlsdGVyIC9G
IF0gPj4Kc3RhcnR4cmVmCjYzMjQKJSVFT0YK



--8f3e9de395be81a5a33aae8d0805d5d5--

Its not the complete base64 file part of the mail.

I hope someone can help me

Thanks,
nic

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Can we mix plain php,html and cakephp?

2010-12-28 Thread Taffarel de Lima
dave, i knew that. the question is there some problems if i want to use cake
mix with php and html?

2010/12/28 Dave Maharaj 

>  Cake can automatically add your selects so you do not need to manually do
> that.
>
>
>
> In controller:
>
>
>
> $departments = $this->Employee->Department->find(‘list’);//get list of all
> the departments
>
> $this->set(compact(‘departments’));
>
>
>
> Then in the form echo $this->Form->input('departments');
>
>
>
> Read the book or API classes as there are options to set empty value =>
> Find in the List, ‘type’,  $options. Whole slew of options available in
> FormHelper
>
>
>
>
>
> *From:* Taffarel de Lima [mailto:taffare...@gmail.com]
> *Sent:* Tuesday, December 28, 2010 4:18 PM
> *To:* cake-php@googlegroups.com
> *Subject:* Re: Can we mix plain php,html and cakephp?
>
>
>
> i don't see anything wrong with that. if there some wrong, someone can
> explain
>
> 2010/12/28 poor-grammar 
>
> hello, i am new to cakephp, and still going thru the manual...
>
> Is there a way to mix cakephp with plain php and HTML i mean
> something like this in the code
>
>
> 
>  echo $this->Form->create('Employee',array('action'=>'edit'));
>echo $this->Form->input('id',array('type'=>'hidden'));
>echo $this->Form->input('emp_name');
>echo $this->Form->input('emp_email');
>echo $this->Form->input('emp_phone');
>echo $this->Form->input('emp_address');
>echo $this->Form->input('emp_joindate');
>   echo $this->Form->input('emp_dob');
>  ?>
> 
> find in the list
> finance
> marketing
> reserve
> deployment
> testing
> research
> 
> Form->end('Save');?>
>
> something like this... there must be a way to mix these 2 . after
> all its the POWER of PHP
>
> also can u please guide me to some links to read what can be done and
> what can't be done while mixing cakephp and php and html...
>
> thanks
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>
>
>
>
> --
> *Taffarel de Lima Oliveira (Taffarelo3)*
>
>
>
> *Desenvolvedor Web*
>
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
*Taffarel de Lima Oliveira (Taffarelo3)*
*
*
*Desenvolvedor Web*

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


RE: Can we mix plain php,html and cakephp?

2010-12-28 Thread Dave Maharaj
Cake can automatically add your selects so you do not need to manually do
that.

 

In controller:

 

$departments = $this->Employee->Department->find('list');//get list of all
the departments

$this->set(compact('departments'));

 

Then in the form echo $this->Form->input('departments');

 

Read the book or API classes as there are options to set empty value => Find
in the List, 'type',  $options. Whole slew of options available in
FormHelper

 

 

From: Taffarel de Lima [mailto:taffare...@gmail.com] 
Sent: Tuesday, December 28, 2010 4:18 PM
To: cake-php@googlegroups.com
Subject: Re: Can we mix plain php,html and cakephp?

 

i don't see anything wrong with that. if there some wrong, someone can
explain

2010/12/28 poor-grammar 

hello, i am new to cakephp, and still going thru the manual...

Is there a way to mix cakephp with plain php and HTML i mean
something like this in the code



Form->create('Employee',array('action'=>'edit'));
   echo $this->Form->input('id',array('type'=>'hidden'));
   echo $this->Form->input('emp_name');
   echo $this->Form->input('emp_email');
   echo $this->Form->input('emp_phone');
   echo $this->Form->input('emp_address');
   echo $this->Form->input('emp_joindate');
  echo $this->Form->input('emp_dob');
 ?>

find in the list
finance
marketing
reserve
deployment
testing
research

Form->end('Save');?>

something like this... there must be a way to mix these 2 . after
all its the POWER of PHP

also can u please guide me to some links to read what can be done and
what can't be done while mixing cakephp and php and html...

thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com
  For more options, visit
this group at http://groups.google.com/group/cake-php?hl=en




-- 
Taffarel de Lima Oliveira (Taffarelo3)

 

Desenvolvedor Web

 

Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


RE: Owner Check

2010-12-28 Thread Dave Maharaj
So is that the best way to check owner against user? Well im sure there is
no best way since every situation is different but doing it this way is just
as good?
Simply try to get the request as normal and then process it. If $data then
there is a record do whatever with the data, if no $data then the user is
attempting to get something not theirs so $data will be empty tell user they
are an idiot :) 

Just curious since some of the function

$data = $this->User->somefunctionToReturnUserRecord();

If($data){


}
If (!$data){

}

-Original Message-
From: cricket [mailto:zijn.digi...@gmail.com] 
Sent: Tuesday, December 28, 2010 3:51 PM
To: cake-php@googlegroups.com
Subject: Re: Owner Check

On Mon, Dec 27, 2010 at 9:51 PM, Dave Maharaj  wrote:
> For the example edit is a Auth only access function and User hasMany
XModel
> so there would need to be an $id to pull the correct record so passing the
> $id is needed. Unless I am not following what your saying?

Right, I read that wrong. Then I guess it comes down to whatever code
is in your __getUserRecord method to check that the $record has the
correct user_id.

Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Can we mix plain php,html and cakephp?

2010-12-28 Thread Taffarel de Lima
i don't see anything wrong with that. if there some wrong, someone can
explain

2010/12/28 poor-grammar 

> hello, i am new to cakephp, and still going thru the manual...
>
> Is there a way to mix cakephp with plain php and HTML i mean
> something like this in the code
>
>
> 
>  echo $this->Form->create('Employee',array('action'=>'edit'));
>echo $this->Form->input('id',array('type'=>'hidden'));
>echo $this->Form->input('emp_name');
>echo $this->Form->input('emp_email');
>echo $this->Form->input('emp_phone');
>echo $this->Form->input('emp_address');
>echo $this->Form->input('emp_joindate');
>   echo $this->Form->input('emp_dob');
>  ?>
> 
> find in the list
> finance
> marketing
> reserve
> deployment
> testing
> research
> 
> Form->end('Save');?>
>
> something like this... there must be a way to mix these 2 . after
> all its the POWER of PHP
>
> also can u please guide me to some links to read what can be done and
> what can't be done while mixing cakephp and php and html...
>
> thanks
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
*Taffarel de Lima Oliveira (Taffarelo3)*
*
*
*Desenvolvedor Web*

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Owner Check

2010-12-28 Thread cricket
On Mon, Dec 27, 2010 at 9:51 PM, Dave Maharaj  wrote:
> For the example edit is a Auth only access function and User hasMany XModel
> so there would need to be an $id to pull the correct record so passing the
> $id is needed. Unless I am not following what your saying?

Right, I read that wrong. Then I guess it comes down to whatever code
is in your __getUserRecord method to check that the $record has the
correct user_id.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: equalTo validation for booleans

2010-12-28 Thread Jeremy Burns | Class Outfit
Solved - this works:

'rule' => array('equalTo', '1'),

...oddly enough.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
(t) +44 (0) 208 123 3822
(m) +44 (0) 7973 481949
Skype: jeremy_burns
http://www.classoutfit.com

On 28 Dec 2010, at 17:11, Jeremy Burns wrote:

> I have a checkbox that users must tick to show they agree to the terms and 
> conditions. I am using this validation rule:
> 
> 'agree_terms' => array(
>   'rule' => array('equalTo', true),
>   'message' => 'You must indicate that you agree to the terms and 
> conditions of use.'
> )
> 
> I have also tried:
>   'rule' => array('equalTo', 1),
> 
> By placing debug statements in /cake/libs/validation.php I can see that 
> $check equals 1 and $comparedTo equals 1, yet the rule always fails:
> 
> function equalTo($check, $comparedTo) {
>   debug($check);
>   debug($comparedTo);
>   if ($check === $comparedTo):
>   die(debug('Yes'));
>   else:
>   die(debug('No'));
>   endif;
>   return ($check === $comparedTo);
> 
> 
> This always returns false, which means validation is failing. Anyone got any 
> tips?
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>  
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


equalTo validation for booleans

2010-12-28 Thread Jeremy Burns
I have a checkbox that users must tick to show they agree to the terms and 
conditions. I am using this validation rule:

'agree_terms' => array(
'rule' => array('equalTo', true),
'message' => 'You must indicate that you agree to the terms and conditions 
of use.'
)

I have also tried:
'rule' => array('equalTo', 1),

By placing debug statements in /cake/libs/validation.php I can see that 
$check equals 1 and $comparedTo equals 1, yet the rule always fails:

function equalTo($check, $comparedTo) {
debug($check);
debug($comparedTo);
if ($check === $comparedTo):
 die(debug('Yes'));
else:
 die(debug('No'));
endif;
return ($check === $comparedTo);


This always returns false, which means validation is failing. Anyone got any 
tips?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Help on Routes, should we use it ?

2010-12-28 Thread Vivi Vivi
It's simple,

If you want to have the the page: http://www.example.com/testpage.html which
goes to controller pages_controller and function check(). You need to do:

Router::parseExtensions('html');
Router::connect('/testpage', array('controller' => 'pages', 'action' =>
'check'));

or

Router::connect('/testpage.html', array('controller' => 'pages', 'action' =>
'check'));




On Tue, Dec 28, 2010 at 5:14 PM, John Maxim  wrote:

> Refer to link below:
> http://book.cakephp.org/view/1541/Routes
>
> I don't understand. What does it accomplish ??
>
> Do we normally change the route as shown from the link above ?
>
> Thanks,
>
> Maxim J.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Vivi
http://photos.vr-3d.net

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: File upload

2010-12-28 Thread Leandro Montero
Here it goes!
In $this->data there is nothing!! I mean the file upload array doesn't
exist!

This is my view

params['action'] == 'admin_add') { $postUrl = '/admin/
canciones/add'; }

elseif ($this->params['action'] == 'admin_edit'){ $postUrl = '/admin/
canciones/edit/'.$this->data['Cancion']['id'];$hidden = true; }

?>



create('Cancion', array('type' => 'file', 'url' =>
$postUrl));

echo $form->input('nombre', array('label' => 'Nombre',
'class' => 'required','escape' => false, 'size' => 50));
echo "Habilitar Emision";echo $form->checkbox('habilitada');echo '';

echo $form->hidden('parent_id');
echo $form->input('archivo', array('type' => 'file', 'label' =>
'Archivo (debe ser mp3)'));

if ($hidden) {

echo $form->hidden('id');

}



?>




 or

link('Cancelar', array('admin' => 
true, 'action'
=> 'index', 'controller' =>'canciones'), array('class' => 'cancel')); ?
>










And here i put the controller thing...
This function upload the file

private function procesarArchivos($modelName, $campoArchivos) {



$this->FileUpload->fileModel = $modelName;



foreach($campoArchivos as $campo) {

if (!empty($this->data[$modelName][$campo]['name'])) {

$this->FileUpload->fileVar = $campo;

$this->FileUpload->uploadedFile = 
$this->data[$modelName][$campo];

$this->FileUpload->fileName = 
$this->data[$modelName]
['nombre']; // nombre del archivo SIN la extension

$this->FileUpload->processFile();

if ($this->FileUpload->success) {

$this->data[$modelName][$campo] = 
$this->FileUpload->finalFile;



$arch = $this->FileUpload->finalFile;

$ext = strrchr($arch,".");

}

else {

unset ($this->data[$modelName][$campo]);

}

}

else {

unset ($this->data[$modelName][$campo]);

}

}

}



And this function is called by the admin add function, and then call
the above one

private function processCancionForm() {



$modelName = 'Cancion';

$campoArchivos = array('archivo');

$this->procesarArchivos($modelName, $campoArchivos);



if ($this->Cancion->save($this->data)) {

$this->redirect('/admin/canciones/index');

}

}



Thank you!!


On Dec 27, 7:53 pm, cricket  wrote:
> On Mon, Dec 27, 2010 at 7:10 AM, Leandro Montero  wrote:
> > So...nothing to say??
>
> Well, what have you done to debug the problem? Have you checked the
> logs (both Cake's and Apache's)? Have you debugged $this->data? Does
> the file upload array exist? If so, what error value is there? What
> about your code? Will you post the form here? Did you pass 'type' =>
> 'file' to $this->Form->create()?
>
> There are many things people could say but we'll likely find the
> solution soonest if you fill us in on the situation a bit clearer.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Help on Routes, should we use it ?

2010-12-28 Thread John Maxim
Refer to link below:
http://book.cakephp.org/view/1541/Routes

I don't understand. What does it accomplish ??

Do we normally change the route as shown from the link above ?

Thanks,

Maxim J.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Urgent help needed: Test Tables are gone, How to re-install simpletest ?

2010-12-28 Thread John Maxim
Hi thanks Vivi, should have known this after running the tests and
checked earlier..

(SOLVED)

On Dec 28, 5:17 pm, Vivi Vivi  wrote:
> The test tables are created only when you run the tests, after it finished
> the tables are deleted.
> The tables are created from fixtures.
>
>
>
> On Tue, Dec 28, 2010 at 10:02 AM, John Maxim  wrote:
> > Hi,
>
> > I forgot to create the database for $test, so the test suite tables
> > were populated into my $default database. I dropped all the tables in
> > phpMyAdmin and removed simpletest folder from my *app/vendors. I
> > thought by replacing a new one (simpletest) unzipping in *app/vendors
> > after creating my $test database would populate all the new test suite
> > tables into my test database--but there is not a single table. Weird
> > is I can still check the test case in localhost/MyAppName/test.php
>
> > Where are the tables ? What should I do to re-install ?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> --
> Vivihttp://photos.vr-3d.net

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Can we mix plain php,html and cakephp?

2010-12-28 Thread poor-grammar
hello, i am new to cakephp, and still going thru the manual...

Is there a way to mix cakephp with plain php and HTML i mean
something like this in the code


Form->create('Employee',array('action'=>'edit'));
echo $this->Form->input('id',array('type'=>'hidden'));
echo $this->Form->input('emp_name');
echo $this->Form->input('emp_email');
echo $this->Form->input('emp_phone');
echo $this->Form->input('emp_address');
echo $this->Form->input('emp_joindate');
   echo $this->Form->input('emp_dob');
 ?>

find in the list
finance
marketing
reserve
deployment
testing
research

Form->end('Save');?>

something like this... there must be a way to mix these 2 . after
all its the POWER of PHP

also can u please guide me to some links to read what can be done and
what can't be done while mixing cakephp and php and html...

thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Dispatcher System

2010-12-28 Thread zer0_gravity
controller default page or any of the views will not  will not load. I
manage to configure cakephp according to the required docs (modified
and save changes to config/core.php and config/database.php). Even
after using the bake command from the cake console I am still not able
to load the control default page or any of the view.

what I do get is the welcome page that points to cakephp setup folder
and the following url
works :
http://localhost/cakeapp/ (get the welcome page here with no errors
indicated on the page )
or
http://localhost/cakephp_setup_folder/ (get welcome page about cakephp
that cake is able to write to the tmp folder, cake is able to
connected to the db and  no errors indicated on the page)


however I when I enter the following url the page returns blank  with
an http error saying page cannot be found.

http://localhost/cakeapp/controller
or
http://localhost/cakeapp/controller/action

I am usiing apache2 and php that comes with the macbook and mysql 6.
The only changes i  made to the apache/httpd.conf was to add
  directive. Add to this no changes to
the php.ini was requires becuz mod_rewrite was already turned on.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Urgent Help needed: How to Correct this table so it doesn't have Composite Primary Key?

2010-12-28 Thread Jeremy Burns | Class Outfit
I *think* the main benefit is obfuscation - if you want to hide the fact that I 
am only the third user, for example. It also makes it more difficult to guess 
the id belonging to another row in the table (for example, a table that stores 
company records). Disadvantages can be data size (a minor factor) and the loss 
of the ability to sort by that column (but created ought to do that for you 
instead).

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 28 Dec 2010, at 02:55, John Maxim wrote:

> Hi Jeremy, Thanks for your link will definitely look into that.
> 
> ~~Continue my question~~
> I was going to ask about using this: http://book.cakephp.org/view/1027/query
> 
> There are 2 options if I'm correct based on cookbook 1.3
> ~~
> Rather than using an auto-increment key as the primary key, you may
> also use char(36). Cake will then use a unique 36 character uuid
> (String::uuid) whenever you save a new record using the Model::save
> method.
> 
> according to: http://book.cakephp.org/view/903/Model-and-Database-Conventions
> ~~
> What's the advantage of using char(36) ?
> ~~
> 
> On Dec 27, 7:18 pm, Jeremy Burns | Class Outfit
>  wrote:
>> I would always have a non-inteligent single field as the primary key (id) 
>> and then have a multiple field unique index on the other two fields. I'd 
>> also index them independently for joins and performance. Your second 
>> solution looks closest and it's also the way Cake works. 
>> Seehttp://articles.classoutfit.com/2010/02/cakephp-basic-database-table-...
>> 
>> Jeremy Burns
>> Class Outfit
>> 
>> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>> 
>> On 27 Dec 2010, at 07:33, John Maxim wrote:
>> 
>>> Hi everyone,
>> 
>>> I'm currently creating a table called "Foods_Ingredients", here is the
>>> sql:
>> 
>>> CREATE TABLE IF NOT EXISTS `foods_ingredients` (
>>> `food_id` int(11) NOT NULL AUTO_INCREMENT,
>>> `ingredient_id` int(11) NOT NULL AUTO_INCREMENT,
>>> PRIMARY KEY (`food_id`,`ingredient_id`)
>>> ) ENGINE=InnoDB
>> 
>>> --
>>> The problem now  is I find this table has to have composite primary
>>> key. Cake currently doesn't support composite, I'm not sure what is
>>> the workaround for this.
>> 
>>> 1. Do I change to UNIQUE KEY ? I went briefly with the cookbook,
>>> finding it hard to understand, can anyone suggest a solution for
>>> this ?
>> 
>>> 2. Do I just add a field `id` into it ?--so it becomes the PK? Adding
>>> this seems a bit odd.
>>> 
>>> CREATE TABLE IF NOT EXISTS `foods_ingredients` (
>>> `id` int(11) NOT NULL AUTO_INCREMENT,
>>> `food_id` int(11) NOT NULL,
>>> `ingredient_id` int(11) NOT NULL,
>>> PRIMARY KEY (`id`),
>>> UNIQUE KEY `food_id_ingredient_id` (`food_id`,`ingredient_id`)
>>> ) ENGINE=InnoDB
>>> 
>> 
>>> What is the suggested solution for this ? from veterans/experienced
>>> Cake users.
>> 
>>> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
>>> with their CakePHP related questions.
>> 
>>> You received this message because you are subscribed to the Google Groups 
>>> "CakePHP" group.
>>> To post to this group, send email to cake-php@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
>>> athttp://groups.google.com/group/cake-php?hl=en
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Plugin controller not finding model

2010-12-28 Thread Vivi Vivi
Hi,

In the $uses we need to add plugin something like this: $uses =
array('PaypalIpn.InstantPaymentNotification');

On Mon, Dec 27, 2010 at 8:39 PM, cricket  wrote:

> On Mon, Dec 27, 2010 at 7:33 AM, WhyNotSmile 
> wrote:
> > Hi everyone, I'm using a plugin from the bakery, and having trouble
> > with it.  I think it was working a few days ago, so it's maybe
> > something I've done that's caused the problem.
> >
> > The problem is that the controller doesn't seem to be finding the
> > model functions.  So, I'm getting:
> >
> > Fatal error: Call to undefined method
> > InstantPaymentNotificationsController::isValid() in D:\Work\Clients
> > \IAAD\site\app\plugins\paypal_ipn\controllers
> > \instant_payment_notifications_controller.php on line 31
> >
> > when I go to the controller action.
> >
> > The relevant function is:
> >
> > function process(){
> >   if($this->isValid($_POST)){  // This is line 31
> >  $notification = $this->InstantPaymentNotification-
> >>buildAssociationsFromIPN($_POST);
> >  $this->InstantPaymentNotification->saveAll($notification);
> >  $this->__processTransaction($this->InstantPaymentNotification-
> >>id);
> >   }
> >  $this->redirect('/');
> > }
> >
> > The controller (instant_payment_notifications_controller.php) starts:
> >
> > class InstantPaymentNotificationsController extends
> > PaypalIpnAppController {
> >
> >var $name = 'InstantPaymentNotifications';
> >var $helpers = array('Html', 'Form', 'Paginator');
> >var $components = array('Auth','Email');
> >var $uses = array('InstantPaymentNotification');
> >
> >
> >
> > and the model (instant_payment_notification.php) begins:
> >
> > class InstantPaymentNotification extends PaypalIpnAppModel {
> >var $name = 'InstantPaymentNotification';
> >
> >
> > and has the function isValid().
> >
> > When I copy the function into the controller, I can call it ok, so
> > it's not the function itself that's the problem.  It looks like the
> > controller just isn't finding the model.
>
> You're calling the method as if it's in the controller, not the model.
>
> $this->InstantPaymentNotification->isValid(...)
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Vivi
http://photos.vr-3d.net

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Handing control over to another controller without redirect or requestAction.

2010-12-28 Thread Vivi Vivi
  Set $view->viewPath='controller';

On Tue, Dec 28, 2010 at 9:02 AM, Greg Skerman  wrote:

> Ok so i've gotten as far as instantiating the target controller (i assume
> this is the right approach...)
>
> how do I render its output from another controller???
>
>
>
>
> On Mon, Dec 27, 2010 at 9:35 PM, Greg Skerman  wrote:
>
>> I should explain a bit better
>>
>> What i'm trying to do is allow the administrator of the site to manage the
>> URL structure, without having to expose them to the routes file which would
>> require programming experience or basic understanding of how the router
>> works to operate.
>>
>> The Admin would decide what sections they want in their site (by creating
>> "nodes"), and the nodes would then have resources which could be any
>> controller/action combination.
>>
>>
>> so assume you have a gallery controller, with a view action and an integer
>> as a parameter for a gallery...the output URL would be /gallaries/view/1 for
>> arguments sake.
>>
>> The site Admin might want the gallery to appear under a "services" node,
>> and be named "products"
>>
>> The admin creates the services node, choses to add content, choses the
>> content type of "gallery", uploads their files and what not, then names the
>> gallery "products" under the "services" node.
>>
>> The gallery would then be accessed from /nodes/view/services/products,
>> which i would collapse with routes down to /services/products
>>
>> They could then chose to add an article about the services they offer,
>> called "index"
>>
>> the result would be:
>> /services/products ---> calls controller galleries, action view, parameter
>> 1
>> /services/ > calls controller articles, action view, parameter 1
>>
>> I know all this can be achieved directly through routes, but i'm trying to
>> offer it in a form, in an easy to manage system so you don't need to be a
>> routing expert to logically structure you site map.
>>
>>
>>
>> On Mon, Dec 27, 2010 at 9:27 PM, Greg Skerman  wrote:
>>
>>> but $this->redirect will change the URL will it not?
>>>
>>>
>>>
>>> On Mon, Dec 27, 2010 at 9:25 PM, Jeremy Burns | Class Outfit <
>>> jeremybu...@classoutfit.com> wrote:
>>>
 You do that with $this->redirect...


 Jeremy Burns
 *Class Outfit*
 *
 *
 jeremybu...@classoutfit.com 
 http://www.classoutfit.com

 On 27 Dec 2010, at 11:22, Greg Skerman wrote:

 Not actually after a redirect,

 I'm trying to hand control to another controller (in a simillar way to
 what request action does), from within a controller, and then render the
 output


 So

 /nodes/view//

 Looks up the Nodes table, for a resource.
 the resource record contains Controller and Action for that resource,
 and control is handed to that control/resource

 The URL to the end user looks like /nodes/view/section/resource, but
 internally its hitting /pages/display/about for arguments sake.

 Simillar i guess to setAction, but more like a setControllerAndAction if
 such a beast ever existed.



 On Mon, Dec 27, 2010 at 9:15 PM, Jeremy Burns | Class Outfit <
 jeremybu...@classoutfit.com> wrote:

> Happy to be corrected, but I think browser mechanics mean that
> everything will be lost when you do a redirect. The best solution is to
> store the stuff you want transferred in the session and retrieve it in the
> other action. You can also pass small amounts of data as a parameter.
>
> Jeremy Burns
> *Class Outfit*
> *
> *
> jeremybu...@classoutfit.com 
> http://www.classoutfit.com
>
> On 27 Dec 2010, at 10:31, Greg Skerman wrote:
>
> Anyone got any idea? sorry if this is a completely newb question...
> Open to suggestions if its a downright stupid idea..
>
>
>
> On Mon, Dec 27, 2010 at 12:17 PM, Greg Skerman wrote:
>
>> Yeah that will only work inside the same controller, where I am trying
>> to hand control from one controller to another.
>>
>> Anyone?
>>
>>
>> On Mon, Dec 27, 2010 at 5:48 AM, huoxito  wrote:
>>
>>> The controller class has a setAction() function which *Internally
>>> redirects one action to another. Does not perform another HTTP request
>>> unlike Controller::redirect()* but it I guess it only works within
>>> the same controller ...
>>>
>>> Check out the new CakePHP Questions site http://cakeqs.org and help
>>> others with their CakePHP related questions.
>>>
>>> You received this message because you are subscribed to the Google
>>> Groups "CakePHP" group.
>>> To post to this group, send email to cake-php@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscr...@googlegroups.comFor
>>>  more options, visit this group at
>>> http://groups.google.com/group/cake-php?hl=en
>>>

Re: Urgent help needed: Test Tables are gone, How to re-install simpletest ?

2010-12-28 Thread Vivi Vivi
The test tables are created only when you run the tests, after it finished
the tables are deleted.
The tables are created from fixtures.

On Tue, Dec 28, 2010 at 10:02 AM, John Maxim  wrote:

> Hi,
>
> I forgot to create the database for $test, so the test suite tables
> were populated into my $default database. I dropped all the tables in
> phpMyAdmin and removed simpletest folder from my *app/vendors. I
> thought by replacing a new one (simpletest) unzipping in *app/vendors
> after creating my $test database would populate all the new test suite
> tables into my test database--but there is not a single table. Weird
> is I can still check the test case in localhost/MyAppName/test.php
>
> Where are the tables ? What should I do to re-install ?
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Vivi
http://photos.vr-3d.net

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Urgent help needed: Test Tables are gone, How to re-install simpletest ?

2010-12-28 Thread John Maxim
Hi,

I forgot to create the database for $test, so the test suite tables
were populated into my $default database. I dropped all the tables in
phpMyAdmin and removed simpletest folder from my *app/vendors. I
thought by replacing a new one (simpletest) unzipping in *app/vendors
after creating my $test database would populate all the new test suite
tables into my test database--but there is not a single table. Weird
is I can still check the test case in localhost/MyAppName/test.php

Where are the tables ? What should I do to re-install ?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en