Re: RequestHandler->isAjax() .. Is this a correct way of doing it ?

2006-06-30 Thread Samuel DeVore
there is also setAjax  http://api.cakephp.org/class_request_handler_component.html#8b41998b31b5b923a990b2d5be45beb8
which is a nice way of setting layout to ajax in a clean consistant waySam DOn 6/30/06, Armando Sosa <
[EMAIL PROTECTED]> wrote:change$this->autoRender=false;
to$this->layout="ajax";On 6/30/06, salimk786 <[EMAIL PROTECTED]> wrote:>> function listing_deleteKeyword($id)> {> //Search for the keyword
> $result = $this->Keyword->findAll($criteria="account_id = '" .> $this->Xauth->getId() . "' and Keyword.id = '" . $id . "'");> if ($result)
> $this->Keyword->del($id);> }>> function listing_editallkeywords($id = null)> {> //request came in to delete a keyword.> if($id)> {> //if the request came in through ajax.
> if($this->RequestHandler->isAjax())> {> $this->listing_deleteKeyword($id);> $this->autoRender=false;> }> }
> $this->order = 'Keyword.' . $this->sortBy.'> '.strtoupper($this->direction);> $data = "" = '" .> $this->Xauth->getId() . "'", $fields=null, $this->order, $this->show,
> $this->page);>> //ListingID ($id) is invalid.> if (empty($data))> {> $this->redirect('/advertisers/listing_viewlisting/');> }> $paging['style'] = 'ajax';
> $paging['link'] => '/bare/advertisers/listing_editallkeywords/?show='.$this->show.'&sort='.$this->sortBy.'&direction='.$this->direction.'&page=';> $paging['count'] = $this->Keyword->findCount($criteria="account_id = '"
> . $this->Xauth->getId() . "'",'50');> $paging['show'] = array('10','25','50');> $paging['page'] = $this->page;> $paging['limit'] = $this->show;> $paging['direction'] = $this->direction;
> $this->set('paging',$paging);> $this->set('data',$data);> $this->set('arr_validation_errors', $arr_validation_errors);> $this->render(null,null,null,'listing');> }>
> ---> I tried requestHandler->isAjax, and its not helping, it rendering> the view inside the view inside the view...>> I change the very last line to:> if($this->RequestHandler->isAjax())
> {> $this->autoRender=false;> }> else> {> $this->render(null,null,null,'listing');> }> and it shows the view but it remove the the listing... I'm confused.
>>> >>--Armando Sosawww.nolimit-studio.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: Validating against non-model data

2006-06-30 Thread Sam

Thanks, this is useful. I think I must be making an assumption
somewhere that I shouldn't be making, so here's my bit of code in my
controller:

function register() {
// Check to see if form data has been submitted
if (!empty($this->data['User'])) {
// Validate both passwords entered are the same
if ($this->data['User']['password'] !=
$this->data['User']['confirmpassword']) {
  $this->User->invalidate('confirmpassword');
  $this->validationErrors['User']['confirmpassword'] = 
'Passwords
must match';
}

// Validate both email addresses entered are the same
if ($this->data['User']['email'] !=
$this->data['User']['confirmemail']) {
  $this->User->invalidate('confirmemail');
  $this->validationErrors['User']['confirmemail'] = 
'E-mail
addresses must match';
}
// Try to save as normal, shouldn't work if the field 
was
invalidated.
if ($this->User->save($this->data)) {
$this->flash('You have been successfully 
registered.',
'/users/login');
} else {
$this->render();
}
}
}

What happens is, regardless of whether the passwords or emails match,
the save still goes through successfully. It looks like save() should
test to see if there are any invalidFields(), but it's still going
through. Where is my thinking wrong in this?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Implemented OthAuth

2006-06-30 Thread Langdon Stevenson

Hi Olivier and Ryan

I have experienced all of the problems that you are now seeing.


1. Constant redirecting to login page indicates that the Permissions and 
var $othAuthRestrictions are not set up right.  I was not able to get * 
to work to protect all actions.  I didn't take the time to figure out 
why, as I didn't really need it.


2. When I set up the login code in my Users controller I got errors like 
this:

Notice: Trying to get property of non-object in 
C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109

Fatal error: Call to a member function find() on a non-object in 
C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109

I moved the login code to another controller and it worked fine.  No 
idea why.


3. You must have the beforeFilter initialise othAuth, particularly 
$othAuthRestrictions.


I haven't dug around in the othAuth code enough to be able to really 
understand all of its logic, so sorry if this post doesn't provide 
enough info.

Regards,
Langdon

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Plurals Problem

2006-06-30 Thread John Zimmerman [gmail]
More info on the problem...So I have a Filter model and a
FilterCriterion model.  A Filter hasMany FilterCriterion and a
FilterCriterion belongs to a FilterIf I load the Filters
controller it comes up fine if I have 'filter_criterion' =>
'filter_criteria' in the irregularPlurals array in inflections.phpBut when I click on the controller for filter_criteria it asks for the model 'FilterCriterium'If
I remove the entry from inflections.php the Filters controller will
complain about not having access to a table called 'filter_criterions'
So it seems I either have something confused or wrong in the
inflections.php file or for some reason the inflection is not working
correctly when trying to go from plural to non-plural.  It seems to
load ok (not tested 100% yet) when going from non-plural to plural.
ThanksOn 6/30/06, John Zimmerman [gmail] <[EMAIL PROTECTED]> wrote:
I have a little bit of a plurals problem.The setup I am trying to implement here is the following:Model: filter_criterion.phpTable: filter_criteriaController: filter_criteria_controller.php
What happens when accessing the hostname/filter_criteria url is that it says I need a model named 'FilterCriterium' but that is the wrong singular form because it should be 'FilterCriterion'.So I have edited app/config/inflections.php and added an entry to irregular plurals 'criterion' => 'criteria'.  I have also tried various forms here with a filter prefix.
But basically it is not picking it up.  I am assuming that it has something to do with my using 'filter_' in front of the controller/table/model.Every time it asks for a model named 'FilterCriterium'.

Any suggestions?



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Plurals Problem

2006-06-30 Thread John Zimmerman [gmail]
I have a little bit of a plurals problem.The setup I am trying to implement here is the following:Model: filter_criterion.phpTable: filter_criteriaController: filter_criteria_controller.php
What happens when accessing the hostname/filter_criteria url is that it says I need a model named 'FilterCriterium' but that is the wrong singular form because it should be 'FilterCriterion'.So I have edited app/config/inflections.php and added an entry to irregular plurals 'criterion' => 'criteria'.  I have also tried various forms here with a filter prefix.
But basically it is not picking it up.  I am assuming that it has something to do with my using 'filter_' in front of the controller/table/model.Every time it asks for a model named 'FilterCriterium'.
Any suggestions?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


using AJAX to watch CHECKBOXES?

2006-06-30 Thread salimk786

Is there a way for me to watch the checkboxes or remember which ones
are being checked?

I like the effect of clicking on the delete link.
I would like to apply the same effect to all the checkboxes that have a
check, when they cilck on the button that reads 'Delete Selected
Keywords'.

Thanks.


domId = 'loading';?>
image('xppc/spinner.gif',array('align'=>'texttop'))?>

';
?>
';?>


checkbox("Keyword/id_" .
$data[$i]['Keyword']['id'] ,$data[$i]['Keyword']['id']); ?>

Delete
link('Delete', 
'listing_editallkeywords/' .
$data[$i]['Keyword']['id'], array('update'=>'ajax_update', 'after' =>
'new Effect.Fade(\'done_' . $data[$i]['Keyword']['id'] . '\');'));
?>

Keyword:
Bid Amout:$ input('Keyword/bid_' . $data[$i]['Keyword']['id'], array('type'
=> 'text', 'size' => '6', 'maxlength' =>'6', 'value' =>
$data[$i]['Keyword']['bid'])) ?>





submit('Delete Selected Keywords', array('name' =>
'DeleteKeywords', 'url' => 'listing_editallkeywords',
'update'=>'ajax_update'));?>
submit('Save Updated Keyword Bids', array('name' =>
'Save')); ?>  submit('Cancel', array('name' =>
'cancel')); ?>  




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Validating against non-model data

2006-06-30 Thread Armando Sosa

I forgot to mention, check Snook's post about validation:

http://www.snook.ca/archives/php/cakephp_data_va_1/



On 6/30/06, Armando Sosa <[EMAIL PROTECTED]> wrote:
> You can add as many tagErrorMsg to your view even if don't exist in your 
> model.
>
> ex:
>
> tagErrorMsg('Profile/passwordsDontMatch', 'Sorry, the
> passwords don\'t match');?>
>
> and in your controller:
>
> if (!$this->data['pass1']==$this->data['pass2']){
>   $this->Model->invalidate('passwordsDontMatch');
> }
>
>
>
> On 6/30/06, Sam <[EMAIL PROTECTED]> wrote:
> >
> > I responded to gwoo directly with this:
> >
> > > I saw the first, hadn't seen the second, but here's my problem...
> > >
> > > Invalidating fields that don't exist in the model doesn't seem to do
> > > anything (and this doesn't seem to be addressed in either posting). I
> > > was pretty sure this was a syntax problem on my end, but I couldn't
> > > find what would make it work.So I guess what I am wondering with
> > > respect to invalidation is, can you invalidate fields that don't exist
> > > in the model and have that stop the save process? (Note that I have
> > > added code found in various places to support multi-condition
> > > validation.)
> > >
> > > Thanks.
> >
> > Gwoo then indicated that it's impossible to say without knowing the
> > implementation I used for the multi-condition validation. So, what I
> > did is implement cakebaker's code as illustrated in this post:
> >
> > http://cakebaker.wordpress.com/2006/02/06/yet-another-data-validation-approach/
> >
> > Of all the implementations I've seen, I liked this one the best. It
> > seems the most elegant and extensible without being particularly hacky
> > (in my limited-experience opinion).
> >
> >
> > > >
> >
>
>
> --
> Armando Sosa
>
> www.nolimit-studio.com
>


-- 
Armando Sosa

www.nolimit-studio.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Validating against non-model data

2006-06-30 Thread Armando Sosa

You can add as many tagErrorMsg to your view even if don't exist in your model.

ex:

tagErrorMsg('Profile/passwordsDontMatch', 'Sorry, the
passwords don\'t match');?>

and in your controller:

if (!$this->data['pass1']==$this->data['pass2']){
  $this->Model->invalidate('passwordsDontMatch');
}



On 6/30/06, Sam <[EMAIL PROTECTED]> wrote:
>
> I responded to gwoo directly with this:
>
> > I saw the first, hadn't seen the second, but here's my problem...
> >
> > Invalidating fields that don't exist in the model doesn't seem to do
> > anything (and this doesn't seem to be addressed in either posting). I
> > was pretty sure this was a syntax problem on my end, but I couldn't
> > find what would make it work.So I guess what I am wondering with
> > respect to invalidation is, can you invalidate fields that don't exist
> > in the model and have that stop the save process? (Note that I have
> > added code found in various places to support multi-condition
> > validation.)
> >
> > Thanks.
>
> Gwoo then indicated that it's impossible to say without knowing the
> implementation I used for the multi-condition validation. So, what I
> did is implement cakebaker's code as illustrated in this post:
>
> http://cakebaker.wordpress.com/2006/02/06/yet-another-data-validation-approach/
>
> Of all the implementations I've seen, I liked this one the best. It
> seems the most elegant and extensible without being particularly hacky
> (in my limited-experience opinion).
>
>
> >
>


-- 
Armando Sosa

www.nolimit-studio.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Newbie to cake, running without mod_rewrite

2006-06-30 Thread john_k

Hi,

Thanks so much for this. Here's an update :

I went to the url you suggested : https://trac.cakephp.org/ticket/812

I followed the instructions to change the index.php and config.php.

It now works fine !!

That is to say, where it produced a page with urls such as
"www.mysite.com/index.php/posts/index" it now produces
"www.mysite.com/index.php?posts/index" which works a treat !

Thanks so much - I was beginning to think that cake was one of those
packages I would see loads of people going on and on about how great it
was and I'd be left thinking "well if its so great how come I can't
even do the tutorial !!".

The problem, as suggested in the url you gave, is that my server is
actually IIS and php has been installed as cgi (this is confirmed if
you do phpinfo(); and see this : "Server APICGI/FastCGI" on the
fourth line down).

Thanks dude you saved my bacon ;-)

John K.

bitrace wrote:
> Hi!
>
> I'm pretty new here too but have also had some problems getting Cake
> working without mod_rewrite being available.  So might be able to help.
>
> If you have uncommented define ('BASE_URL', env('SCRIPT_NAME'));  from
> core.php you must all make sure the 3 .htaccess files are removed from
> from the cake install folders
>
> /cake_1.1.5.3148
> /app
> /app/webroot
>
> On my install I found that once this was done there was a problem with
> the  links being generated incorrectly from the base url which I
> managed to fix by changing
>
> //define ('BASE_URL', env('SCRIPT_NAME'));
> to define ('BASE_URL', 'http://'.env('HTTP_HOST').'/index.php'); in
> core.php
>
> presumably you could also try
> define ('BASE_URL', 'http://'.env('HTTP_HOST').'/index.php?')
>
> I think this problem may also relate to
> https://trac.cakephp.org/ticket/812
> 
> cheers


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: RequestHandler->isAjax() .. Is this a correct way of doing it ?

2006-06-30 Thread Armando Sosa

change

$this->autoRender=false;

to

$this->layout="ajax";

On 6/30/06, salimk786 <[EMAIL PROTECTED]> wrote:
>
> function listing_deleteKeyword($id)
> {
> //Search for the keyword
> $result = $this->Keyword->findAll($criteria="account_id = '" .
> $this->Xauth->getId() . "' and Keyword.id = '" . $id . "'");
> if ($result)
> $this->Keyword->del($id);
> }
>
> function listing_editallkeywords($id = null)
> {
> //request came in to delete a keyword.
> if($id)
> {
> //if the request came in through ajax.
> if($this->RequestHandler->isAjax())
> {
> $this->listing_deleteKeyword($id);
> $this->autoRender=false;
> }
> }
> $this->order = 'Keyword.' . $this->sortBy.'
> '.strtoupper($this->direction);
> $data = $this->Keyword->findAll($criteria="account_id = '" .
> $this->Xauth->getId() . "'", $fields=null, $this->order, $this->show,
> $this->page);
>
> //ListingID ($id) is invalid.
> if (empty($data))
> {
> $this->redirect('/advertisers/listing_viewlisting/');
> }
> $paging['style'] = 'ajax';
> $paging['link'] =
> '/bare/advertisers/listing_editallkeywords/?show='.$this->show.'&sort='.$this->sortBy.'&direction='.$this->direction.'&page=';
> $paging['count'] = $this->Keyword->findCount($criteria="account_id = '"
> . $this->Xauth->getId() . "'",'50');
> $paging['show'] = array('10','25','50');
> $paging['page'] = $this->page;
> $paging['limit'] = $this->show;
> $paging['direction'] = $this->direction;
> $this->set('paging',$paging);
> $this->set('data',$data);
> $this->set('arr_validation_errors', $arr_validation_errors);
> $this->render(null,null,null,'listing');
> }
>
> ---> I tried requestHandler->isAjax, and its not helping, it rendering
> the view inside the view inside the view...
>
> I change the very last line to:
> if($this->RequestHandler->isAjax())
> {
> $this->autoRender=false;
> }
> else
> {
> $this->render(null,null,null,'listing');
> }
> and it shows the view but it remove the the listing... I'm confused.
>
>
> >
>


-- 
Armando Sosa

www.nolimit-studio.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Validating against non-model data

2006-06-30 Thread Sam

I responded to gwoo directly with this:

> I saw the first, hadn't seen the second, but here's my problem...
>
> Invalidating fields that don't exist in the model doesn't seem to do
> anything (and this doesn't seem to be addressed in either posting). I
> was pretty sure this was a syntax problem on my end, but I couldn't
> find what would make it work.So I guess what I am wondering with
> respect to invalidation is, can you invalidate fields that don't exist
> in the model and have that stop the save process? (Note that I have
> added code found in various places to support multi-condition
> validation.)
>
> Thanks.

Gwoo then indicated that it's impossible to say without knowing the
implementation I used for the multi-condition validation. So, what I
did is implement cakebaker's code as illustrated in this post:

http://cakebaker.wordpress.com/2006/02/06/yet-another-data-validation-approach/

Of all the implementations I've seen, I liked this one the best. It
seems the most elegant and extensible without being particularly hacky
(in my limited-experience opinion).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



RequestHandler->isAjax() .. Is this a correct way of doing it ?

2006-06-30 Thread salimk786

function listing_deleteKeyword($id)
{
//Search for the keyword
$result = $this->Keyword->findAll($criteria="account_id = '" .
$this->Xauth->getId() . "' and Keyword.id = '" . $id . "'");
if ($result)
$this->Keyword->del($id);
}

function listing_editallkeywords($id = null)
{
//request came in to delete a keyword.
if($id)
{
//if the request came in through ajax.
if($this->RequestHandler->isAjax())
{
$this->listing_deleteKeyword($id);
$this->autoRender=false;
}
}
$this->order = 'Keyword.' . $this->sortBy.'
'.strtoupper($this->direction);
$data = $this->Keyword->findAll($criteria="account_id = '" .
$this->Xauth->getId() . "'", $fields=null, $this->order, $this->show,
$this->page);

//ListingID ($id) is invalid.
if (empty($data))
{
$this->redirect('/advertisers/listing_viewlisting/');
}
$paging['style'] = 'ajax';
$paging['link'] =
'/bare/advertisers/listing_editallkeywords/?show='.$this->show.'&sort='.$this->sortBy.'&direction='.$this->direction.'&page=';
$paging['count'] = $this->Keyword->findCount($criteria="account_id = '"
. $this->Xauth->getId() . "'",'50');
$paging['show'] = array('10','25','50');
$paging['page'] = $this->page;
$paging['limit'] = $this->show;
$paging['direction'] = $this->direction;
$this->set('paging',$paging);
$this->set('data',$data);
$this->set('arr_validation_errors', $arr_validation_errors);
$this->render(null,null,null,'listing');
}

---> I tried requestHandler->isAjax, and its not helping, it rendering
the view inside the view inside the view...

I change the very last line to:
if($this->RequestHandler->isAjax())
{
$this->autoRender=false;
}
else
{
$this->render(null,null,null,'listing');
}   
and it shows the view but it remove the the listing... I'm confused.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Implemented OthAuth

2006-06-30 Thread Olivier Percebois-Garve




Well, I experience unwanted redirects to the login page also. But I
can't tell what are the conditions for this bug to happen.
Sorry, I can't imagine why in addition to that you've twice the login
param.

Ryan Petrain wrote:
I am looking to control where the person is being
redirected to after they login based on what they were trying to access.
  
I solved this problem by setting a variable $AuthConf = array(...) in
app_controller.php and then having the other controllers override that
to set the array to values needed for that controller.
  
  
I cannot figure out why I am being redirected back to the login page
again after Iogin.
the pathe before login looks like:
  
  http://localhost/users/login
  
when redirected back to the login page it is:
  
  
  http://localhost/users/login/login
  
Any ideas?
  
  On 6/30/06, Olivier Percebois-Garve <
[EMAIL PROTECTED]> wrote:
  

"does that mean all the other controllers that
do not override this
will
be redirected to "categories/login" if it is a restricted page?"

Yes, I think so, so how my app is behaving. For instance if I
request
"posts/index/127" I'm redirected first to categories/login.
I'm not sure if I understand you second question. You want to be always
redirect to the same page after login, whatever the restricted page
that has been called ?

 


Ryan Petrain wrote:
Olivier,
  
I have a question about you app_controller.php.
  
If I understand it right, seeing where you have the beforeFilter set in
the main controller, where you set the login to "categories/login" and
the redirect to "categories/login"  does that mean all the other
controllers that do not override this will be redirected to
"categories/login" if it is a restricted page? 
  
How do I set up a generic beforeFilter so that it can be handed in 
apage to redirect after the login is sucessful?
  
Thanx.
  
  On 6/30/06, Ryan Petrain  <[EMAIL PROTECTED]>
wrote:
  
Olivier, 

I am not getting that error, but when I visit a restricted page it
redirects me to the login (good), I login with proper credentials, and
then it redirects me to the login again.

Any ideas on what I am still doing wrong? 
thanx for all your help so far.



On 6/30/06, Olivier Percebois-Garve <
[EMAIL PROTECTED]> wrote: 

  
  Ryan, I think you need
a
before filter, I have this :
  
  
    function beforeFilter()
    {
        $auth_conf = array(
        'auto_redirect' => true,
  
          'login_page' => 'categories/login',
        'logout_page' => 'categories/view',
        'access_page' => 'categories/login',
        'hashkey' => 'MySEcEeTHaSHKeYz');
  
        
        $this->othAuth->controller = &$this;
        $this->othAuth->init($auth_conf);
        $this->othAuth->check();
    }
  
  
  
  Sorry I'm in hurry got to go see Germany win. I'll look
at
your code
later if I can.
If you want you can have a look at how I implemented it in chameleon in
cakeforge (take the svn, the package is old and broke)
  
  
  
  
  
  
  
Ryan Petrain wrote:
  Hi Olivier,

This is the user controller that handles the login.  What other code do
you need?
class UsersController extends AppController
{
    var $name = "Users";
    var $components = array('othAuth'); 
    //var $othAuthRestrictions = array('index','view');
    var $othAuthRestrictions = null;
    var $uses = array('User');
    
    function login()
    {
        $this->layout = 'nosearchbar';
    if(isset($this->params['data']))
    {
           
//$this->flash(print_r($this->params['data']),'/users/login');
    $auth_num =
$this->othAuth->login($this->params['data']['User']); 
    $this->set('auth_msg',
$this->othAuth->getMsg($auth_num));
    }
    }

    function logout()
    {
    $this->othAuth->logout();
    $this->flash('You are not logged in!','/users/login'); 
    } 
}
?>

On 6/30/06, Olivier Percebois-Garve <[EMAIL PROTECTED]
> wrote:

  
  can you paste your
code
? (in
cakebin for instance)
  
  
Ryan Petrain wrote:
  Hi Langdon,

Cna you help me get past a raher mundane aspect of using othAuth?
I have added othAuth to my cake install and all appears to be fine.

I try to get to a restricted area and it redirects to the login page. 
I enter the login credentials and then I get this error once I click
the submit button: 

Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php
on line 109

Fatal error: Call to a member function find() on
a
non-obj

Re: Implemented OthAuth

2006-06-30 Thread Ryan Petrain
I am looking to control where the person is being redirected to after they login based on what they were trying to access.I solved this problem by setting a variable $AuthConf = array(...) in app_controller.php and then having the other controllers override that to set the array to values needed for that controller.
I cannot figure out why I am being redirected back to the login page again after Iogin.the pathe before login looks like:http://localhost/users/loginwhen redirected back to the login page it is:
http://localhost/users/login/loginAny ideas?On 6/30/06, Olivier Percebois-Garve <
[EMAIL PROTECTED]> wrote:


  
  


"does that mean all the other controllers that do not override this
will
be redirected to "categories/login" if it is a restricted page?"
Yes, I think so, so how my app is behaving. For instance if I request
"posts/index/127" I'm redirected first to categories/login.
I'm not sure if I understand you second question. You want to be always
redirect to the same page after login, whatever the restricted page
that has been called ?
 


Ryan Petrain wrote:
Olivier,
  
I have a question about you app_controller.php.
  
If I understand it right, seeing where you have the beforeFilter set in
the main controller, where you set the login to "categories/login" and
the redirect to "categories/login"  does that mean all the other
controllers that do not override this will be redirected to
"categories/login" if it is a restricted page?
  
  
How do I set up a generic beforeFilter so that it can be handed in 
apage to redirect after the login is sucessful?
  
Thanx.
  
  On 6/30/06, Ryan Petrain
   <[EMAIL PROTECTED]>
wrote:
  
Olivier,


I am not getting that error, but when I visit a restricted page it
redirects me to the login (good), I login with proper credentials, and
then it redirects me to the login again.

Any ideas on what I am still doing wrong?

thanx for all your help so far.



On 6/30/06, Olivier Percebois-Garve <
[EMAIL PROTECTED]> wrote:


  
  Ryan, I think you need a
before filter, I have this :
  
  
    function beforeFilter()
    {
        $auth_conf = array(
        'auto_redirect' => true,
  
          'login_page' => 'categories/login',
        'logout_page' => 'categories/view',
        'access_page' => 'categories/login',
        'hashkey' => 'MySEcEeTHaSHKeYz');
  
        
        $this->othAuth->controller = &$this;
        $this->othAuth->init($auth_conf);
        $this->othAuth->check();
    }
  
  
  
  Sorry I'm in hurry got to go see Germany win. I'll look at
your code
later if I can.
If you want you can have a look at how I implemented it in chameleon in
cakeforge (take the svn, the package is old and broke)
  
  
  
  
  
  
  
Ryan Petrain wrote:
  Hi Olivier,

This is the user controller that handles the login.  What other code do
you need?
class UsersController extends AppController
{
    var $name = "Users";
    var $components = array('othAuth'); 
    //var $othAuthRestrictions = array('index','view');
    var $othAuthRestrictions = null;
    var $uses = array('User');
    
    function login()
    {
        $this->layout = 'nosearchbar';
    if(isset($this->params['data']))
    {
           
//$this->flash(print_r($this->params['data']),'/users/login');
    $auth_num =
$this->othAuth->login($this->params['data']['User']); 
    $this->set('auth_msg',
$this->othAuth->getMsg($auth_num));
    }
    }

    function logout()
    {
    $this->othAuth->logout();
    $this->flash('You are not logged in!','/users/login'); 
    } 
}
?>

On 6/30/06, Olivier Percebois-Garve <[EMAIL PROTECTED]
> wrote:

  
  can you paste your code
? (in
cakebin for instance)
  
  
Ryan Petrain wrote:
  Hi Langdon,

Cna you help me get past a raher mundane aspect of using othAuth?
I have added othAuth to my cake install and all appears to be fine.

I try to get to a restricted area and it redirects to the login page. 
I enter the login credentials and then I get this error once I click
the submit button: 

Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php
on line 109

Fatal error: Call to a member function find() on a
non-object
in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php
on line 109

The login page has access to the  User object.  I have even added the
$users = array('User'); to the controller to see if that was what it
needed but I still can not get past this. 

Any help would be appreciated. thanx.


On 6/30/06, Olivier Percebois-Garve <
[EMAIL PROTECTED]
> wrote: 

  
  

Re: Implemented OthAuth

2006-06-30 Thread Olivier Percebois-Garve




"does that mean all the other controllers that do not override this
will
be redirected to "categories/login" if it is a restricted page?"
Yes, I think so, so how my app is behaving. For instance if I request
"posts/index/127" I'm redirected first to categories/login.
I'm not sure if I understand you second question. You want to be always
redirect to the same page after login, whatever the restricted page
that has been called ?
 


Ryan Petrain wrote:
Olivier,
  
I have a question about you app_controller.php.
  
If I understand it right, seeing where you have the beforeFilter set in
the main controller, where you set the login to "categories/login" and
the redirect to "categories/login"  does that mean all the other
controllers that do not override this will be redirected to
"categories/login" if it is a restricted page?
  
  
How do I set up a generic beforeFilter so that it can be handed in 
apage to redirect after the login is sucessful?
  
Thanx.
  
  On 6/30/06, Ryan Petrain
   <[EMAIL PROTECTED]>
wrote:
  
Olivier,


I am not getting that error, but when I visit a restricted page it
redirects me to the login (good), I login with proper credentials, and
then it redirects me to the login again.

Any ideas on what I am still doing wrong?

thanx for all your help so far.



On 6/30/06, Olivier Percebois-Garve <
[EMAIL PROTECTED]> wrote:


  
  Ryan, I think you need a
before filter, I have this :
  
  
    function beforeFilter()
    {
        $auth_conf = array(
        'auto_redirect' => true,
  
          'login_page' => 'categories/login',
        'logout_page' => 'categories/view',
        'access_page' => 'categories/login',
        'hashkey' => 'MySEcEeTHaSHKeYz');
  
        
        $this->othAuth->controller = &$this;
        $this->othAuth->init($auth_conf);
        $this->othAuth->check();
    }
  
  
  
  Sorry I'm in hurry got to go see Germany win. I'll look at
your code
later if I can.
If you want you can have a look at how I implemented it in chameleon in
cakeforge (take the svn, the package is old and broke)
  
  
  
  
  
  
  
Ryan Petrain wrote:
  Hi Olivier,

This is the user controller that handles the login.  What other code do
you need?
class UsersController extends AppController
{
    var $name = "Users";
    var $components = array('othAuth'); 
    //var $othAuthRestrictions = array('index','view');
    var $othAuthRestrictions = null;
    var $uses = array('User');
    
    function login()
    {
        $this->layout = 'nosearchbar';
    if(isset($this->params['data']))
    {
           
//$this->flash(print_r($this->params['data']),'/users/login');
    $auth_num =
$this->othAuth->login($this->params['data']['User']); 
    $this->set('auth_msg',
$this->othAuth->getMsg($auth_num));
    }
    }

    function logout()
    {
    $this->othAuth->logout();
    $this->flash('You are not logged in!','/users/login'); 
    } 
}
?>

On 6/30/06, Olivier Percebois-Garve <[EMAIL PROTECTED]
> wrote:

  
  can you paste your code
? (in
cakebin for instance)
  
  
Ryan Petrain wrote:
  Hi Langdon,

Cna you help me get past a raher mundane aspect of using othAuth?
I have added othAuth to my cake install and all appears to be fine.

I try to get to a restricted area and it redirects to the login page. 
I enter the login credentials and then I get this error once I click
the submit button: 

Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php
on line 109

Fatal error: Call to a member function find() on a
non-object
in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php
on line 109

The login page has access to the  User object.  I have even added the
$users = array('User'); to the controller to see if that was what it
needed but I still can not get past this. 

Any help would be appreciated. thanx.


On 6/30/06, Olivier Percebois-Garve <[EMAIL PROTECTED]
> wrote: 

  
  Wow. I see that
there is
more
and more othAuth users. I've two issues
I'm not sure how to tackle.
Just wanna to know if some peoples are sharing the same concerns (and
if crazylegs thought about that for the new version) 
  
1.Sometimes I hit the login page while its seems that I am already
logged. if I fill in the right login, then I got back the message 
that credentials are wrong. But n fact after that  if I enter manually 
the  url of a restricted method, I can access it. 
I'm not sure how to reproduce this but it happened often during testing
of code in restricted method. maybe it is related to my us

Re: Mail templates

2006-06-30 Thread Attila

Thanks,
now it starts to get together, also part 3 and 4 seem to work - in
principle - now.

The email templates in /views/elements/email/ is good, I like that.

I'm finishing the application now (deadline!) and then I'll post the
working code.

cakePHP rocks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Are there performance overheads to RequestAction?

2006-06-30 Thread gwoo

as 100rk pointed out $this->params['bare'] == 1 when coming through  
requestAction.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



strange othAuth problem

2006-06-30 Thread yeastinflexion

daxroc and i are both experiencing a strange problem with othAuth. i
believe we have everything implemented as per instructions and
everything works except one thing: when not logged in, you can call a
restricted action and that action will be performed before you are
redirected to the login page as long as the action didn't render a
view. strange eh? this is true even if a flash is added or even if
permissions are totally removed from the db. it doesn't happen on
actions that render views/elements, even if the render is to a file and
not to the browser. Does anyone else have this problem and does anyone
have a solution? CraZyLeGs?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Validating against non-model data

2006-06-30 Thread gwoo

did you search for invalidate?

http://groups.google.com/group/cake-php/browse_thread/thread/ 
af164e88e1d4897a/dae09c12f2916331?q=invalidate&rnum=2#dae09c12f2916331

http://groups.google.com/group/cake-php/browse_thread/thread/ 
bec26338072a9e9b/7a47a67e615563ba?q=invalidate&rnum=4#7a47a67e615563ba

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Are there performance overheads to RequestAction?

2006-06-30 Thread Gonçalo Marrafa

On Fri, 30 Jun 2006 10:19:42 -0700
gwoo <[EMAIL PROTECTED]> wrote:

> Yes if you put $this->render() in the method. As was discussed the  
> really should not be needed and a simple return is preferred.
> 
> function foo(){
>   return $this->Example->findAll();
> }

OK, but doesn't work for me. I have actions that render different views
according to conditions so i have to use redner(). I think there should be
a parameter indicating if the request was made through requestAction().

-- 
Gonçalo Marrafa <[EMAIL PROTECTED]>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Implemented OthAuth

2006-06-30 Thread Ryan Petrain
Olivier,I have a question about you app_controller.php.If I understand it right, seeing where you have the beforeFilter set in the main controller, where you set the login to "categories/login" and the redirect to "categories/login"  does that mean all the other controllers that do not override this will be redirected to "categories/login" if it is a restricted page?
How do I set up a generic beforeFilter so that it can be handed in  apage to redirect after the login is sucessful?Thanx.On 6/30/06, Ryan Petrain
 <[EMAIL PROTECTED]> wrote:Olivier,
I am not getting that error, but when I visit a restricted page it redirects me to the login (good), I login with proper credentials, and then it redirects me to the login again.Any ideas on what I am still doing wrong?
thanx for all your help so far.On 6/30/06, Olivier Percebois-Garve <
[EMAIL PROTECTED]> wrote:



  
  


Ryan, I think you need a before filter, I have this :

    function beforeFilter()
    {
        $auth_conf = array(
        'auto_redirect' => true,
        'login_page' => 'categories/login',
        'logout_page' => 'categories/view',
        'access_page' => 'categories/login',
        'hashkey' => 'MySEcEeTHaSHKeYz');
        
        $this->othAuth->controller = &$this;
        $this->othAuth->init($auth_conf);
        $this->othAuth->check();
    }


Sorry I'm in hurry got to go see Germany win. I'll look at your code
later if I can.
If you want you can have a look at how I implemented it in chameleon in
cakeforge (take the svn, the package is old and broke)






Ryan Petrain wrote:
Hi Olivier,
  
This is the user controller that handles the login.  What other code do
you need?
class UsersController extends AppController
{
    var $name = "Users";
    var $components = array('othAuth');
  
    //var $othAuthRestrictions = array('index','view');
    var $othAuthRestrictions = null;
    var $uses = array('User');
    
    function login()
    {
        $this->layout = 'nosearchbar';
    if(isset($this->params['data']))
    {
           
//$this->flash(print_r($this->params['data']),'/users/login');
    $auth_num =
$this->othAuth->login($this->params['data']['User']);
  
    $this->set('auth_msg',
$this->othAuth->getMsg($auth_num));
    }
    }
  
    function logout()
    {
    $this->othAuth->logout();
    $this->flash('You are not logged in!','/users/login');
  
    } 
}
?>
  
  On 6/30/06, Olivier Percebois-Garve <[EMAIL PROTECTED]
> wrote:
  

can you paste your code ? (in
cakebin for instance)


Ryan Petrain wrote:
Hi Langdon,
  
Cna you help me get past a raher mundane aspect of using othAuth?
I have added othAuth to my cake install and all appears to be fine.
  
I try to get to a restricted area and it redirects to the login page. 
I enter the login credentials and then I get this error once I click
the submit button: 
  
  Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php
on line 109
  
  Fatal error: Call to a member function find() on a
non-object
in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php
on line 109
  
The login page has access to the  User object.  I have even added the
$users = array('User'); to the controller to see if that was what it
needed but I still can not get past this. 
  
Any help would be appreciated. thanx.
  
  
  On 6/30/06, Olivier Percebois-Garve <[EMAIL PROTECTED]
  > wrote: 
  

Wow. I see that there is
more
and more othAuth users. I've two issues
I'm not sure how to tackle.
Just wanna to know if some peoples are sharing the same concerns (and
if crazylegs thought about that for the new version) 

1.Sometimes I hit the login page while its seems that I am already
logged. if I fill in the right login, then I got back the message 
that credentials are wrong. But n fact after that  if I enter manually 
the  url of a restricted method, I can access it. 
I'm not sure how to reproduce this but it happened often during testing
of code in restricted method. maybe it is related to my use
of requestAction.

2. I'd like to gather the name of all the controller having restricted
methods, and the names of the restricted methods ($othAuthRestrictions)

in my layout. Basically I'm doing :
if restricted build adminMenu
else build userMenu
Any ideas on how to achieve this ?

olivvv



Langdon Stevenson wrote:

  Hi rombehI have the following code in the controllers that I want to protect:(note: extra $helpers and $components have been removed to simplify)class LeadersController extends AppController
{   var $name = 'Leaders'; //for php4   var $helpers = array('othAuth');   var $components = array('othAuth');	   var $othAuthRestrictions = array('index');	   function beforeFilter()
   { $auth_conf = array('auto_redirect' => 

Re: Validating against non-model data

2006-06-30 Thread Sam

I've been researching this for two weeks trying to find something in
this group (since no one answers questions in the IRC channel) that
applies on a level that I can implement and, so far, have not found
anything that satisfies. In general, it seems like there is no
consensus on a "best practice" for how to do this sort of validation. I
have found several suggestions that only tangentially apply and seem to
hacky to be satisfying.

So what I am hoping for is some explanation that explains a "good" way
to do this and in such a way that I can gain further USEFUL knowledge
that isn't going to suggest some bad practice hack.

I appreciate the need to move things along when relevant support
already exists, but understand, this post is made out of frustration
that I have yet to find an applicable suggestion that would bring a
reasonable solution to this problem.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Validating against non-model data

2006-06-30 Thread gwoo

This question has been answered numerous times. Please use the group  
search or http://cakephp.org/search (which searches the whole cakephp  
world including blogs, manual, and groups);

If you search for invalidate you should find several answers to your  
question.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Are there performance overheads to RequestAction?

2006-06-30 Thread gwoo

Yes if you put $this->render() in the method. As was discussed the  
really should not be needed and a simple return is preferred.

function foo(){
return $this->Example->findAll();
}

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Are there performance overheads to RequestAction?

2006-06-30 Thread [EMAIL PROTECTED]

I would really like to see my original question answered. Doesn't the
view get rendered with requestAction(), even if the 'return' parameter
isn't passed? Master bakers, can you enlighten us?

Thanks in advance.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Mail templates

2006-06-30 Thread gwoo



On Jun 30, 2006, at 6:05 AM, Attila wrote:

>
> well, I need it working today, so here is what I'm just doing:
>
> 1) extension of the email component to be suited for multipart
> alternative

Just add to the one on the wiki, cake lovers will worship you forever.

>
> 2) master layout for a multipart alternative email, with one
> "renderElement" for each of the templates, the html and the txt
> version.

The email component on the wiki takes a layout so that would be a nice
wrapper for the the other page templates.

> 3) the html and the txt version as templates in cakephp style created
> as elements in views/elements (I think they fit in there, but do  
> they?)

elements are the way to go, /views/elements/email/html_part.thtml
$this->renderElement('email/html_part');

>
> 4) "set"ting the vars needed in the controller and calling the Email
> component to render and send, following (but extending) the wiki
> sample.

Setting is cool.

>
> As you see below, I'm still working on part 3 and 4, so this is no
> finished code to drop in somewhere, not yet.
>
> If you see me doing something stupid, or un-cakePHPish, please alert
> me.

Nope you are looking in all the right places. Keep rolling. We'll  
refactor later.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Implemented OthAuth

2006-06-30 Thread Ryan Petrain
Olivier,I am not getting that error, but when I visit a restricted page it redirects me to the login (good), I login with proper credentials, and then it redirects me to the login again.Any ideas on what I am still doing wrong?
thanx for all your help so far.On 6/30/06, Olivier Percebois-Garve <[EMAIL PROTECTED]> wrote:



  
  


Ryan, I think you need a before filter, I have this :

    function beforeFilter()
    {
        $auth_conf = array(
        'auto_redirect' => true,
        'login_page' => 'categories/login',
        'logout_page' => 'categories/view',
        'access_page' => 'categories/login',
        'hashkey' => 'MySEcEeTHaSHKeYz');
        
        $this->othAuth->controller = &$this;
        $this->othAuth->init($auth_conf);
        $this->othAuth->check();
    }


Sorry I'm in hurry got to go see Germany win. I'll look at your code
later if I can.
If you want you can have a look at how I implemented it in chameleon in
cakeforge (take the svn, the package is old and broke)






Ryan Petrain wrote:
Hi Olivier,
  
This is the user controller that handles the login.  What other code do
you need?
class UsersController extends AppController
{
    var $name = "Users";
    var $components = array('othAuth');
  
    //var $othAuthRestrictions = array('index','view');
    var $othAuthRestrictions = null;
    var $uses = array('User');
    
    function login()
    {
        $this->layout = 'nosearchbar';
    if(isset($this->params['data']))
    {
           
//$this->flash(print_r($this->params['data']),'/users/login');
    $auth_num =
$this->othAuth->login($this->params['data']['User']);
  
    $this->set('auth_msg',
$this->othAuth->getMsg($auth_num));
    }
    }
  
    function logout()
    {
    $this->othAuth->logout();
    $this->flash('You are not logged in!','/users/login');
  
    } 
}
?>
  
  On 6/30/06, Olivier Percebois-Garve <[EMAIL PROTECTED]
> wrote:
  

can you paste your code ? (in
cakebin for instance)


Ryan Petrain wrote:
Hi Langdon,
  
Cna you help me get past a raher mundane aspect of using othAuth?
I have added othAuth to my cake install and all appears to be fine.
  
I try to get to a restricted area and it redirects to the login page. 
I enter the login credentials and then I get this error once I click
the submit button: 
  
  Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php
on line 109
  
  Fatal error: Call to a member function find() on a
non-object
in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php
on line 109
  
The login page has access to the  User object.  I have even added the
$users = array('User'); to the controller to see if that was what it
needed but I still can not get past this. 
  
Any help would be appreciated. thanx.
  
  
  On 6/30/06, Olivier Percebois-Garve <[EMAIL PROTECTED]
  > wrote: 
  

Wow. I see that there is
more
and more othAuth users. I've two issues
I'm not sure how to tackle.
Just wanna to know if some peoples are sharing the same concerns (and
if crazylegs thought about that for the new version) 

1.Sometimes I hit the login page while its seems that I am already
logged. if I fill in the right login, then I got back the message 
that credentials are wrong. But n fact after that  if I enter manually 
the  url of a restricted method, I can access it. 
I'm not sure how to reproduce this but it happened often during testing
of code in restricted method. maybe it is related to my use
of requestAction.

2. I'd like to gather the name of all the controller having restricted
methods, and the names of the restricted methods ($othAuthRestrictions)

in my layout. Basically I'm doing :
if restricted build adminMenu
else build userMenu
Any ideas on how to achieve this ?

olivvv



Langdon Stevenson wrote:

  Hi rombehI have the following code in the controllers that I want to protect:(note: extra $helpers and $components have been removed to simplify)class LeadersController extends AppController
{   var $name = 'Leaders'; //for php4   var $helpers = array('othAuth');   var $components = array('othAuth');	   var $othAuthRestrictions = array('index');	   function beforeFilter()
   { $auth_conf = array('auto_redirect' => true, 'login_page'  => 'leaders/login', 'logout_page' => 'leaders/logout', 'access_page' => '/leaders', 'hashkey' => 'mYpERsOnALhaSHkeY',
 'strict_gid_check' => false);	 $this->othAuth->controller = &$this; $this->othAuth->init($auth_conf); $this->othAuth->check();   }	   function index ()
   { // Action code ...   }}That is all that is required to add to the controller to protect the index action, assuming that you have followed the othAuth setup instructions and have the required classes and DB tab

Re: Implemented OthAuth

2006-06-30 Thread Olivier Percebois-Garve




Ryan, I think you need a before filter, I have this :

    function beforeFilter()
    {
        $auth_conf = array(
        'auto_redirect' => true,
        'login_page' => 'categories/login',
        'logout_page' => 'categories/view',
        'access_page' => 'categories/login',
        'hashkey' => 'MySEcEeTHaSHKeYz');
        
        $this->othAuth->controller = &$this;
        $this->othAuth->init($auth_conf);
        $this->othAuth->check();
    }


Sorry I'm in hurry got to go see Germany win. I'll look at your code
later if I can.
If you want you can have a look at how I implemented it in chameleon in
cakeforge (take the svn, the package is old and broke)






Ryan Petrain wrote:
Hi Olivier,
  
This is the user controller that handles the login.  What other code do
you need?
class UsersController extends AppController
{
    var $name = "Users";
    var $components = array('othAuth');
  
    //var $othAuthRestrictions = array('index','view');
    var $othAuthRestrictions = null;
    var $uses = array('User');
    
    function login()
    {
        $this->layout = 'nosearchbar';
    if(isset($this->params['data']))
    {
           
//$this->flash(print_r($this->params['data']),'/users/login');
    $auth_num =
$this->othAuth->login($this->params['data']['User']);
  
    $this->set('auth_msg',
$this->othAuth->getMsg($auth_num));
    }
    }
  
    function logout()
    {
    $this->othAuth->logout();
    $this->flash('You are not logged in!','/users/login');
  
    } 
}
?>
  
  On 6/30/06, Olivier Percebois-Garve <[EMAIL PROTECTED]> wrote:
  

can you paste your code ? (in
cakebin for instance)


Ryan Petrain wrote:
Hi Langdon,
  
Cna you help me get past a raher mundane aspect of using othAuth?
I have added othAuth to my cake install and all appears to be fine.
  
I try to get to a restricted area and it redirects to the login page. 
I enter the login credentials and then I get this error once I click
the submit button: 
  
  Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php
on line 109
  
  Fatal error: Call to a member function find() on a
non-object
in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php
on line 109
  
The login page has access to the  User object.  I have even added the
$users = array('User'); to the controller to see if that was what it
needed but I still can not get past this. 
  
Any help would be appreciated. thanx.
  
  
  On 6/30/06, Olivier Percebois-Garve <[EMAIL PROTECTED]
  > wrote: 
  

Wow. I see that there is
more
and more othAuth users. I've two issues
I'm not sure how to tackle.
Just wanna to know if some peoples are sharing the same concerns (and
if crazylegs thought about that for the new version) 

1.Sometimes I hit the login page while its seems that I am already
logged. if I fill in the right login, then I got back the message 
that credentials are wrong. But n fact after that  if I enter manually 
the  url of a restricted method, I can access it. 
I'm not sure how to reproduce this but it happened often during testing
of code in restricted method. maybe it is related to my use
of requestAction.

2. I'd like to gather the name of all the controller having restricted
methods, and the names of the restricted methods ($othAuthRestrictions)

in my layout. Basically I'm doing :
if restricted build adminMenu
else build userMenu
Any ideas on how to achieve this ?

olivvv



Langdon Stevenson wrote:

  Hi rombeh

I have the following code in the controllers that I want to protect:
(note: extra $helpers and $components have been removed to simplify)

class LeadersController extends AppController


{
   var $name = 'Leaders'; //for php4

   var $helpers = array('othAuth');
   var $components = array('othAuth');
	
   var $othAuthRestrictions = array('index');
	
   function beforeFilter()

   {

 $auth_conf = array('auto_redirect' => true,
 'login_page'  => 'leaders/login',
 'logout_page' => 'leaders/logout',
 'access_page' => '/leaders',
 'hashkey' => 'mYpERsOnALhaSHkeY',


 'strict_gid_check' => false);
	
 $this->othAuth->controller = &$this;
 $this->othAuth->init($auth_conf);
 $this->othAuth->check();
   }	

   function index ()


   {
 // Action code ...
   }
}


That is all that is required to add to the controller to protect the 
index action, assuming that you have followed the othAuth setup 
instructions and have the required classes and DB tables in place.



As mentioned in my previous post I also have a permission in the 
permission table like this:

INSERT INTO `cake_permissions` VALUES (1,'leaders/index','2006-03-13 
23:19:31','-00-00 00:00:00');



And a Groups-Permissions mapping that connects that permission to the 

Validating against non-model data

2006-06-30 Thread Sam

I'm new to Cake and trying to figure out basic functionality. My first
"project" I'm using to assist my learning process is to register and
manipulate "user" accounts. My first snag has been in the registration
process.

When a user registers he is presented with the following fields:
username, password, confirmpassword*, email, and confirmemail*. The
fields with an asterisk do not exist in the model for obvious reasons.
What I need to do, but have found no obvious way to handle, is validate
that the password and confirmpassword fields match, as well as the
email and confirmemail fields.

Is there a good and/or right way to handle this validation (which
should also inform me how to handle non-model form fields going
forward)?

TIA

-Sam


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Implemented OthAuth

2006-06-30 Thread Ryan Petrain
Hi Olivier,This is the user controller that handles the login.  What other code do you need?class UsersController extends AppController{    var $name = "Users";    var $components = array('othAuth');
    //var $othAuthRestrictions = array('index','view');    var $othAuthRestrictions = null;    var $uses = array('User');        function login()    {        $this->layout = 'nosearchbar';
    if(isset($this->params['data']))    {            //$this->flash(print_r($this->params['data']),'/users/login');    $auth_num = $this->othAuth->login($this->params['data']['User']);
    $this->set('auth_msg', $this->othAuth->getMsg($auth_num));    }    }    function logout()    {    $this->othAuth->logout();    $this->flash('You are not logged in!','/users/login');
    } }?>On 6/30/06, Olivier Percebois-Garve <[EMAIL PROTECTED]> wrote:



  


can you paste your code ? (in cakebin for instance)

Ryan Petrain wrote:
Hi Langdon,
  
Cna you help me get past a raher mundane aspect of using othAuth?
I have added othAuth to my cake install and all appears to be fine.
  
I try to get to a restricted area and it redirects to the login page. 
I enter the login credentials and then I get this error once I click
the submit button:
  
  
  Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php
on line 109
  
  Fatal error: Call to a member function find() on a non-object
in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php
on line 109
  
The login page has access to the  User object.  I have even added the
$users = array('User'); to the controller to see if that was what it
needed but I still can not get past this.
  
  
Any help would be appreciated. thanx.
  
  
  On 6/30/06, Olivier Percebois-Garve <[EMAIL PROTECTED]
> wrote:
  
  

Wow. I see that there is more
and more othAuth users. I've two issues
I'm not sure how to tackle.
Just wanna to know if some peoples are sharing the same concerns (and
if crazylegs thought about that for the new version) 

1.Sometimes I hit the login page while its seems that I am already
logged. if I fill in the right login, then I got back the message 
that credentials are wrong. But n fact after that  if I enter manually 
the  url of a restricted method, I can access it. 
I'm not sure how to reproduce this but it happened often during testing
of code in restricted method. maybe it is related to my use
of requestAction.

2. I'd like to gather the name of all the controller having restricted
methods, and the names of the restricted methods ($othAuthRestrictions)

in my layout. Basically I'm doing :
if restricted build adminMenu
else build userMenu
Any ideas on how to achieve this ?

olivvv



Langdon Stevenson wrote:

  Hi rombehI have the following code in the controllers that I want to protect:(note: extra $helpers and $components have been removed to simplify)class LeadersController extends AppController
{   var $name = 'Leaders'; //for php4   var $helpers = array('othAuth');   var $components = array('othAuth');	   var $othAuthRestrictions = array('index');	   function beforeFilter()
   { $auth_conf = array('auto_redirect' => true, 'login_page'  => 'leaders/login', 'logout_page' => 'leaders/logout', 'access_page' => '/leaders', 'hashkey' => 'mYpERsOnALhaSHkeY',
 'strict_gid_check' => false);	 $this->othAuth->controller = &$this; $this->othAuth->init($auth_conf); $this->othAuth->check();   }	   function index ()
   { // Action code ...   }}That is all that is required to add to the controller to protect the index action, assuming that you have followed the othAuth setup instructions and have the required classes and DB tables in place.
As mentioned in my previous post I also have a permission in the permission table like this:INSERT INTO `cake_permissions` VALUES (1,'leaders/index','2006-03-13 23:19:31','-00-00 00:00:00');
And a Groups-Permissions mapping that connects that permission to the desired user's group.As a side note, you have to check that your User has the right group ID assigned, and that their Active field is set to "1".
Hope this is useful.Regards,Langdonrombeh wrote:  
  
hi Langdon Stevenson,Can u show me quick walkthrough (place some code too :D) in order toget it worksthanks
  








  
  
  
  
  










--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: Implemented OthAuth

2006-06-30 Thread rombeh

I still can't get it work,
here's my code (I'm trying to protect entire controllers action):
 true,
'login_page'  => '/users/login',
'logout_page' => '/users/logout',
'access_page' => '/autocars/index',
'hashkey' => 'Wh4theV3rHaSHKeYz',
'strict_gid_check' => false);

$this->othAuth->controller = &$this;
$this->othAuth->init($auth_conf);
$this->othAuth->check();
}
}

I've routed base path (/) to /autocars/index

but when I try to access www.myweb.com I got this error:

Notice: Undefined index: url in
/home/projects/autoindonesia_admin_area/apps/autoadmin/controllers/components/oth_auth.php
on line 181

Notice: Undefined index: url in
/home/projects/autoindonesia_admin_area/apps/autoadmin/controllers/components/oth_auth.php
on line 182

Warning: Cannot modify header information - headers already sent by
(output started at
/home/projects/autoindonesia_admin_area/apps/autoadmin/controllers/components/oth_auth.php:181)
in
/home/projects/autoindonesia_admin_area/lib/cake/cake/libs/controller/controller.php
on line 391

I can succesfully redirect to login page only if I access page via full
url: www.myweb.com/autocars/index, if I try to login, I got 'succes
login' message ('You're Logged in!'),  but still can't get acces to any
controller's action (succes login doesn't redirect me to acces_page,
but stay in the login page), and I always redirected to my login page

thx


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: sending cookie

2006-06-30 Thread lorenzo


RosSoft ha scritto:

> set domain to /
I resolved  with this:
setcookie('mycookie','yummm',2147483647,'/',false);


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Implemented OthAuth

2006-06-30 Thread Olivier Percebois-Garve




can you paste your code ? (in cakebin for instance)

Ryan Petrain wrote:
Hi Langdon,
  
Cna you help me get past a raher mundane aspect of using othAuth?
I have added othAuth to my cake install and all appears to be fine.
  
I try to get to a restricted area and it redirects to the login page. 
I enter the login credentials and then I get this error once I click
the submit button:
  
  
  Notice: Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php
on line 109
  
  Fatal error: Call to a member function find() on a non-object
in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php
on line 109
  
The login page has access to the  User object.  I have even added the
$users = array('User'); to the controller to see if that was what it
needed but I still can not get past this.
  
  
Any help would be appreciated. thanx.
  
  
  On 6/30/06, Olivier Percebois-Garve <[EMAIL PROTECTED]> wrote:
  
  

Wow. I see that there is more
and more othAuth users. I've two issues
I'm not sure how to tackle.
Just wanna to know if some peoples are sharing the same concerns (and
if crazylegs thought about that for the new version) 

1.Sometimes I hit the login page while its seems that I am already
logged. if I fill in the right login, then I got back the message 
that credentials are wrong. But n fact after that  if I enter manually 
the  url of a restricted method, I can access it. 
I'm not sure how to reproduce this but it happened often during testing
of code in restricted method. maybe it is related to my use
of requestAction.

2. I'd like to gather the name of all the controller having restricted
methods, and the names of the restricted methods ($othAuthRestrictions)

in my layout. Basically I'm doing :
if restricted build adminMenu
else build userMenu
Any ideas on how to achieve this ?

olivvv



Langdon Stevenson wrote:

  Hi rombeh

I have the following code in the controllers that I want to protect:
(note: extra $helpers and $components have been removed to simplify)

class LeadersController extends AppController

{
   var $name = 'Leaders'; //for php4

   var $helpers = array('othAuth');
   var $components = array('othAuth');
	
   var $othAuthRestrictions = array('index');
	
   function beforeFilter()
   {

 $auth_conf = array('auto_redirect' => true,
 'login_page'  => 'leaders/login',
 'logout_page' => 'leaders/logout',
 'access_page' => '/leaders',
 'hashkey' => 'mYpERsOnALhaSHkeY',

 'strict_gid_check' => false);
	
 $this->othAuth->controller = &$this;
 $this->othAuth->init($auth_conf);
 $this->othAuth->check();
   }	

   function index ()

   {
 // Action code ...
   }
}


That is all that is required to add to the controller to protect the 
index action, assuming that you have followed the othAuth setup 
instructions and have the required classes and DB tables in place.


As mentioned in my previous post I also have a permission in the 
permission table like this:

INSERT INTO `cake_permissions` VALUES (1,'leaders/index','2006-03-13 
23:19:31','-00-00 00:00:00');


And a Groups-Permissions mapping that connects that permission to the 
desired user's group.

As a side note, you have to check that your User has the right group ID 
assigned, and that their Active field is set to "1".


Hope this is useful.

Regards,
Langdon







rombeh wrote:
  
  
hi Langdon Stevenson,
Can u show me quick walkthrough (place some code too :D) in order to
get it works

thanks

  








  
  
  
  
  



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---





Re: Implemented OthAuth

2006-06-30 Thread Ryan Petrain
Hi Langdon,Cna you help me get past a raher mundane aspect of using othAuth?I have added othAuth to my cake install and all appears to be fine.I try to get to a restricted area and it redirects to the login page.  I enter the login credentials and then I get this error once I click the submit button:
Notice:  Trying to get property of non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109

Fatal error:  Call to a member function find() on a non-object in C:\apache2\htdocs\Trans2\app\controllers\components\oth_auth.php on line 109The login page has access to the  User object.  I have even added the $users = array('User'); to the controller to see if that was what it needed but I still can not get past this.
Any help would be appreciated. thanx.On 6/30/06, Olivier Percebois-Garve <[EMAIL PROTECTED]> wrote:



  


Wow. I see that there is more and more othAuth users. I've two issues
I'm not sure how to tackle.
Just wanna to know if some peoples are sharing the same concerns (and
if crazylegs thought about that for the new version) 

1.Sometimes I hit the login page while its seems that I am already
logged. if I fill in the right login, then I got back the message 
that credentials are wrong. But n fact after that  if I enter manually 
the  url of a restricted method, I can access it. 
I'm not sure how to reproduce this but it happened often during testing
of code in restricted method. maybe it is related to my use
of requestAction.

2. I'd like to gather the name of all the controller having restricted
methods, and the names of the restricted methods ($othAuthRestrictions)

in my layout. Basically I'm doing :
if restricted build adminMenu
else build userMenu
Any ideas on how to achieve this ?

olivvv


Langdon Stevenson wrote:

  Hi rombehI have the following code in the controllers that I want to protect:(note: extra $helpers and $components have been removed to simplify)class LeadersController extends AppController
{   var $name = 'Leaders'; //for php4   var $helpers = array('othAuth');   var $components = array('othAuth');	   var $othAuthRestrictions = array('index');	   function beforeFilter()   {
 $auth_conf = array('auto_redirect' => true, 'login_page'  => 'leaders/login', 'logout_page' => 'leaders/logout', 'access_page' => '/leaders', 'hashkey' => 'mYpERsOnALhaSHkeY',
 'strict_gid_check' => false);	 $this->othAuth->controller = &$this; $this->othAuth->init($auth_conf); $this->othAuth->check();   }	   function index ()
   { // Action code ...   }}That is all that is required to add to the controller to protect the index action, assuming that you have followed the othAuth setup instructions and have the required classes and DB tables in place.
As mentioned in my previous post I also have a permission in the permission table like this:INSERT INTO `cake_permissions` VALUES (1,'leaders/index','2006-03-13 23:19:31','-00-00 00:00:00');
And a Groups-Permissions mapping that connects that permission to the desired user's group.As a side note, you have to check that your User has the right group ID assigned, and that their Active field is set to "1".
Hope this is useful.Regards,Langdonrombeh wrote:  
  
hi Langdon Stevenson,Can u show me quick walkthrough (place some code too :D) in order toget it worksthanks
  
  
  










--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: sending cookie

2006-06-30 Thread RosSoft

set domain to /


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: AJAX Form builder

2006-06-30 Thread [EMAIL PROTECTED]

Iam really interested in making a form builder in AJAX for cake contact
me, my mail is [EMAIL PROTECTED] I'm trying to make an accounting
software using cake.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: AJAX Form builder

2006-06-30 Thread Olivier Percebois-Garve

maybe this will interest you:
http://partridge.wordpress.com/
perhaps you would gain at working together.

sicapitan wrote:
> Who wants to develop an AJAX form builder in Cake? :)
>
>
> >
>
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



AJAX Form builder

2006-06-30 Thread sicapitan

Who wants to develop an AJAX form builder in Cake? :)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Implemented OthAuth

2006-06-30 Thread Olivier Percebois-Garve




Wow. I see that there is more and more othAuth users. I've two issues
I'm not sure how to tackle.
Just wanna to know if some peoples are sharing the same concerns (and
if crazylegs thought about that for the new version) 

1.Sometimes I hit the login page while its seems that I am already
logged. if I fill in the right login, then I got back the message 
that credentials are wrong. But n fact after that  if I enter manually 
the  url of a restricted method, I can access it. 
I'm not sure how to reproduce this but it happened often during testing
of code in restricted method. maybe it is related to my use
of requestAction.

2. I'd like to gather the name of all the controller having restricted
methods, and the names of the restricted methods ($othAuthRestrictions)

in my layout. Basically I'm doing :
if restricted build adminMenu
else build userMenu
Any ideas on how to achieve this ?

olivvv


Langdon Stevenson wrote:

  Hi rombeh

I have the following code in the controllers that I want to protect:
(note: extra $helpers and $components have been removed to simplify)

class LeadersController extends AppController
{
   var $name = 'Leaders'; //for php4

   var $helpers = array('othAuth');
   var $components = array('othAuth');
	
   var $othAuthRestrictions = array('index');
	
   function beforeFilter()
   {
 $auth_conf = array('auto_redirect' => true,
 'login_page'  => 'leaders/login',
 'logout_page' => 'leaders/logout',
 'access_page' => '/leaders',
 'hashkey' => 'mYpERsOnALhaSHkeY',
 'strict_gid_check' => false);
	
 $this->othAuth->controller = &$this;
 $this->othAuth->init($auth_conf);
 $this->othAuth->check();
   }	

   function index ()
   {
 // Action code ...
   }
}


That is all that is required to add to the controller to protect the 
index action, assuming that you have followed the othAuth setup 
instructions and have the required classes and DB tables in place.

As mentioned in my previous post I also have a permission in the 
permission table like this:

INSERT INTO `cake_permissions` VALUES (1,'leaders/index','2006-03-13 
23:19:31','-00-00 00:00:00');

And a Groups-Permissions mapping that connects that permission to the 
desired user's group.

As a side note, you have to check that your User has the right group ID 
assigned, and that their Active field is set to "1".

Hope this is useful.

Regards,
Langdon







rombeh wrote:
  
  
hi Langdon Stevenson,
Can u show me quick walkthrough (place some code too :D) in order to
get it works

thanks

  
  


  



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---





Re: model associations causing errors.

2006-06-30 Thread Samuel DeVore
Try using array('Article.active'=1) for the condition ('Article.active'=1 would work as well but there are some advantages to using the arrays for conditions)On 6/30/06, 
AD7six <[EMAIL PROTECTED]> wrote:
Hi Luke,set debug to 2 in your /app/config/core.php file, and you will see thatthe sql query that is generated, and see that there are 2 tablesincluded in the SQL that contain the field active.
Cheers,AD7six
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: Mail templates

2006-06-30 Thread Attila

well, I need it working today, so here is what I'm just doing:

1) extension of the email component to be suited for multipart
alternative

2) master layout for a multipart alternative email, with one
"renderElement" for each of the templates, the html and the txt
version.

3) the html and the txt version as templates in cakephp style created
as elements in views/elements (I think they fit in there, but do they?)

4) "set"ting the vars needed in the controller and calling the Email
component to render and send, following (but extending) the wiki
sample.

As you see below, I'm still working on part 3 and 4, so this is no
finished code to drop in somewhere, not yet.

If you see me doing something stupid, or un-cakePHPish, please alert
me.

Also any ideas, hints or comments are welcome!

--

Here's the part one, the email component to be suited for multipart
alternative:

*** BEGIN **
tpl =
$params['tpl'];
if (!empty($params['to']))   $this->to  =
$params['to'];
if (!empty($params['from ']))$this->from= $params['from
'];
if (!empty($params['cc']))   $this->cc  =
$params['cc'];
if (!empty($params['bcc']))  $this->bcc =
$params['bcc'];
if (!empty($params['subject']))  $this->subject =
$params['subject'];

// create a boundary
$this->boundary = "UNIVERSALX-BOUNDARY-" . md5(uniqid (rand()))
;
$this->boundary = str_replace("=", "-", $this->boundary);

$this->controller->set('boundary', $this->boundary );

if ( empty($this->to) || empty($this->from) ||
empty($this->tpl))
{
return false;
}
else
{
return true;
}

}

function message()
{
ob_start();

$this->controller->render($this->tpl,'multipart_alternative_email');
$mail = ob_get_clean();
return $mail;
}


function send()
{
// make sure we have all what we need
if ( empty($this->from) ||empty($this->to)  )
{
return false;   // missing sender and / or receipient
}

// create a boundary
$boundary = "UNIVERSALX-BOUNDARY-" . md5(uniqid (rand())) ;
$boundary = str_replace("=", "-", $boundary);


// TBD: check for valid email format

$headers  = "From: $this->from\n" . "Return-Path:
$this->from\n" . $this->xmailer ;
$headers .= "MIME-Version: 1.0\nContent-Type:
multipart/alternative; boundary=$boundary\n\n";

if (!empty($this->cc)  )  $headers  .= "CC:$this->cc\n" ;
if (!empty($this->bcc) )  $headers  .= "BCC:$this->bcc\n"  ;

$fifthparameter .= $this->from ;

$success = mail($this->to, $this->subject, $this->message(),
$headers, $fifthparameter);
return $success;
}

}
?>
*** END **

Here's the part 2, the master layout for a multipart alternative email:

*** BEGIN **
This is an Email in the modern MIME format. If you are reading this
text, your email reader does not understand how to properly display
MIME multipart messages. You might want to consider upgrading your
email reader.

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

renderElement( 'emailTxt' ); ?>

--
Content-Type: text/html; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

renderElement( 'emailHtml' ); ?>

--

*** END **

Part 3, the 2 templates itself, are whatever you need in cakePHP
format, and

Part 4, the code in the controller, is something like this:

*** BEGIN **
function sendBookingEmail($some_data_for_email)
{
$this->set('var_to_email',$some_data_for_email);

$this->MultipartAlternativeEmail->controller = $this;

$emailparams = array(
'tpl' => 'email_to_send',
'to'  => '[EMAIL PROTECTED]',
'from'=> '[EMAIL PROTECTED]',
'cc'  => '[EMAIL PROTECTED]',
'bcc' => '[EMAIL PROTECTED]',
'subject' => 'the subject',
);


$this->MultipartAlternativeEmail->init( $emailparams );

// render the text part into a variable
// set text part as $title_for_layout

// render the html part into a variable
// set html part as $content_for_layout

/***/

if($this->MultipartAlternativeEmail->send())
{
$this->set('message','email was sent');
}
else
{
$this->set('message','email could not be sent');
}

}
*** END **


--~--~-~--~~~---~--~~
You received this 

Re: Implemented OthAuth

2006-06-30 Thread Langdon Stevenson

Hi rombeh

I have the following code in the controllers that I want to protect:
(note: extra $helpers and $components have been removed to simplify)

class LeadersController extends AppController
{
   var $name = 'Leaders'; //for php4

   var $helpers = array('othAuth');
   var $components = array('othAuth');

   var $othAuthRestrictions = array('index');

   function beforeFilter()
   {
 $auth_conf = array('auto_redirect' => true,
 'login_page'  => 'leaders/login',
 'logout_page' => 'leaders/logout',
 'access_page' => '/leaders',
 'hashkey' => 'mYpERsOnALhaSHkeY',
 'strict_gid_check' => false);

 $this->othAuth->controller = &$this;
 $this->othAuth->init($auth_conf);
 $this->othAuth->check();
   }

   function index ()
   {
 // Action code ...
   }
}


That is all that is required to add to the controller to protect the 
index action, assuming that you have followed the othAuth setup 
instructions and have the required classes and DB tables in place.

As mentioned in my previous post I also have a permission in the 
permission table like this:

INSERT INTO `cake_permissions` VALUES (1,'leaders/index','2006-03-13 
23:19:31','-00-00 00:00:00');

And a Groups-Permissions mapping that connects that permission to the 
desired user's group.

As a side note, you have to check that your User has the right group ID 
assigned, and that their Active field is set to "1".

Hope this is useful.

Regards,
Langdon







rombeh wrote:
> hi Langdon Stevenson,
> Can u show me quick walkthrough (place some code too :D) in order to
> get it works
> 
> thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Mail templates

2006-06-30 Thread Matt

I am sending out multi-part emails with both an HTML and text version,
and I am using the Pear library Mail_Mime to achieve this:
http://pear.php.net/mail_mime

Though I plan to abstract this somewhat by moving all the repeated
logic into a mail component.

Attila wrote:
> So you guys are just sending out either html only email (wiki example)
> or text only emails (matt's example).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: ACL on a shared host

2006-06-30 Thread Ryan Petrain
Nate:Is there a simple way to get a list of the ACOs a given ARO (user) has access to?On 6/29/06, nate <
[EMAIL PROTECTED]> wrote:The example with setup_controller is just an example of how to do some
basic initalization.  The idea is, you can just write a shortcontroller action to do the initial setup of your ARO/ACO trees, andthe permissions settings.  Once you have the initial tree in place, youcan use those same objects and methods to populate the tree as new
objects are created, i.e. adding a new ARO to the tree when a newsystem user is created.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: stats for cakephp

2006-06-30 Thread bracchetto

yes.. very powerfull, i've use it some times


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Implemented OthAuth

2006-06-30 Thread rombeh

hi Langdon Stevenson,
Can u show me quick walkthrough (place some code too :D) in order to
get it works

thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Fwd : NEW JOBS POSTED

2006-06-30 Thread Ritu

Hi Dear Members,

FOLLOWING R THE NEW JOBS OF THE DAY :

Sr. TIBCO Developer

Peoplesoft Professionals

self supporting trainee

Sr.Software Developer

ITES(bpo)

IT(.net,asp,php)

MNC BANKS

Associate Software Developer

Java Programmer

Executives - Business Development

HR Executive

Siebel Professionals

Quality Audit

Post for Hotel manager/ Asst. Manager


PLS APPLY ONLINE ON www.net4professionals.com

*Looking For Better Jobs/Employee?

-Search Jobs/Resumes and Apply Online/Call 4 Interview FREE

-Browse Interveiw Calls Free

-Employers Can Post 5 Jobs Free And Also Win Free Gifts

http://www.net4professionals.com

(A2Z HR INFO SERVICES INDIA)
THE COMPLETE e-JOBS SOLUTIONS PROVIDER...
 
REGARDS


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Are there performance overheads to RequestAction?

2006-06-30 Thread Olivier Percebois-Garve

I'm also dreaming of a

$this->isCalledByRequestAction

I made a ticket for this https://trac.cakephp.org/ticket/1013

olivvv

Gonçalo Marrafa wrote:
> Hi. 
>
> This thread is being very enlightening. I have a question though: doesn't
> an action always render a view (unless $autoRender is set to false)? Here's
> an example:
>
> in one_controller.php:
>
> function foo()
> {
> $this->set('foo', $this->Foo->findAll());
> $this->render('foo_view');
> }
> 
> *NOTE*: The render() part is optional, of course, but assuming $autoRender
> is not set to false it will implicitly render foo.thtml.
>
> in other_controller.php:
>
> function bar()
> {
> $this->set('bar', $this->Bar->findAll());
> $this->set('foo', $this->requestAction('/one/foo'));
> }
>
>
> Maybe i'm missing something but doesn't the call to '/one/foo' always
> render the view, even though requestAction is not asked to return the
> rendered view? Does foo()'s implementation have to contemplate the two
> distinct situations? Kinda like:
>
> function foo()
> {
> $foo = $this->Foo->findAll();
> if ($this->isCalledByRequestAction) {
> return $foo;
> }
> else {
> $this->render('foo_view');
> }
> }
>
> Thanks in advance.
>
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: stats for cakephp

2006-06-30 Thread Seb

phpMyVisites is great too (http://www.phpmyvisites.net)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Are there performance overheads to RequestAction?

2006-06-30 Thread 100rk


> if ($this->isCalledByRequestAction) {

if (!empty($this->params['bare']))

But be careful, 'bare' parameter is 1 in case of ajax call also


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Scaffolding??

2006-06-30 Thread stefano

Maybe in your browser you are requesting http://[yoursite]/user instead
of http://[yoursite]/users (note the final 's').
Your controller have to be users_controllers.php and in it class
UsersController extends AppController (note, as alvays the plural
'users' )


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: md5 field - modify field from controller

2006-06-30 Thread AD7six


Chris Lamb wrote:
> But what if your plaintext password looks like a valid MD5 string?

Hi Chris,

Indeed then the code would cause a problem in this case. I don't think
that any of the places I've used it would accept an MD5 as a password,
and as such the MD5 and password validations are mutually exclusive -
but if that is not the case then it would be necessary to take that
into account when saving the user info.

The ONLY reason to require a check of any kind before md5ing is if it
is possible to edit an MD5ed field, if there is no possibility to edit
the field, there is no risk to md5 what was saved when the object was
created and the code can be simplified to a simple md5 statement (as
icelander probably put in place). Don't scaffold a view for the admin
to view the users if this is the case ;).


Cheers,

AD7six


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: homepage controller = info from other controllers

2006-06-30 Thread AD7six


Sergei wrote:
> Thanks,
>
> I've already managed this myself. Just created special controller with
> view which uses existing model.
>
> AD7six, I think elements and components are not very suitable for my
> task, right?
>
> S.

Hi Sergi,

It's up to you how to write your own pages, I only pointed out that the
possibility to use components and elements existed ;)

I think that any solution which does not mean that you write the same
code in two places is a good one :)

Cheers,

AD7six


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Scaffolding??

2006-06-30 Thread AD7six

Luke wrote:
> OK, I got it working, but whenever I click ANYTHING (edit, add, view)
> it says:
>
> Missing controller
>
> You are seeing this error because controller UserController could not
> be found.

Hi Luke,

This sounds suspiciously like a variable has been defined incorrectly,
or there is a confusion somewhere with the plurals and singulars (as
controllers are plural).

What does your controller and model look like? If you are using
Scaffold to get going they should be virtually empty as shown in the
manual chapter (http://manual.cakephp.org/chapter/5)

@John Zimmerman: That doesn't sound right, what is happening such that
you are drawing that conclusion? If there is an index method defined in
your controller as well as the scaffold variable, you can still use
scaffold for your other edit/show/delete actions, at least that's the
intention and my experience ;).

HTH, Cheers,

AD7six


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: model associations causing errors.

2006-06-30 Thread AD7six

Hi Luke,

set debug to 2 in your /app/config/core.php file, and you will see that
the sql query that is generated, and see that there are 2 tables
included in the SQL that contain the field active.

Cheers,

AD7six


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Are there performance overheads to RequestAction?

2006-06-30 Thread Gonçalo Marrafa

Hi. 

This thread is being very enlightening. I have a question though: doesn't
an action always render a view (unless $autoRender is set to false)? Here's
an example:

in one_controller.php:

function foo()
{
$this->set('foo', $this->Foo->findAll());
$this->render('foo_view');
}

*NOTE*: The render() part is optional, of course, but assuming $autoRender
is not set to false it will implicitly render foo.thtml.

in other_controller.php:

function bar()
{
$this->set('bar', $this->Bar->findAll());
$this->set('foo', $this->requestAction('/one/foo'));
}


Maybe i'm missing something but doesn't the call to '/one/foo' always
render the view, even though requestAction is not asked to return the
rendered view? Does foo()'s implementation have to contemplate the two
distinct situations? Kinda like:

function foo()
{
$foo = $this->Foo->findAll();
if ($this->isCalledByRequestAction) {
return $foo;
}
else {
$this->render('foo_view');
}
}

Thanks in advance.

-- 
Gonçalo Marrafa <[EMAIL PROTECTED]>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Mail templates

2006-06-30 Thread Jon Bennett

On 6/30/06, Attila <[EMAIL PROTECTED]> wrote:
>
> So you guys are just sending out either html only email (wiki example)
> or text only emails (matt's example).
>
> How about mime multipart alternative? The same email in a text version
> and in a html version, so that everybody can see it?
>
> I'm porting a nice website to cakephp, and I would like to port this
> part as much as possible to be the cakephp way. I have written the old
> version - before cakphp, but working fine - and I just try to get it
> into cakephp.

I started working on this the other day (then got side tracked!), I
was going to put the BOUNDARY stuff in the Email component, and simply
use strip_tags on the html email to get the plain text version. It
would mean having fully qualified urls for links, but that's no real
biggy.

alternatively you could have a plain version of each template that can
be rendered

hth

jb

-- 


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: sending cookie

2006-06-30 Thread lorenzo


RosSoft ha scritto:

> try changing domain and expires in setcookie
Expires is set to time() + 3600 ... but nothing change :(
Why should I change domains? Cookie was corectly sended ... but only
the method that sended it can use it !!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



model associations causing errors.

2006-06-30 Thread Luke

Alright... I just set up a hasOne and a belongsTo for my users and
articles tables, and now I am getting this error:

SQL Error in model Article: 1052: Column 'active' in where clause is
ambiguous

Here are my findAll calls:
$this->set('articles', $this->Article->findAll('active = 1', 
null,
'created desc', 30, 1, 3));
$this->set('inactive_articles', $this->Article->findAll('active 
!=
1', null, 'created desc', 30, 1, 3));


Article model:
var $belongsTo = array('User' =>
   array('className'  => 'User',
 'conditions' => '',
 'order'  => '',
 'foreignKey' => ''
   )
 );

User model:
var $hasMany = array('Article' =>
 array('className'   => 'Article',
   'conditions'  => '',
   'order'   => '',
   'limit'   => '',
   'foreignKey'  => '',
   'dependent'   => false,
   'exclusive'   => false,
   'finderSql'   => ''
 )
  );


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---