Getting numeric array keys from query... need model names.

2010-10-05 Thread foldiman
I'm currently deploying a CakePHP site that works fine in one
environment (staging), but then encounters errors in another (live).
The error... my result array keys in staging reflect the joined tables
while my array keys in live are numeric. This means, on live, when I
state $my_var = $results['MyModel']['myData'], 'MyModel' is not a
valid index. However, $results[0]['myData'] is valid bc the key has
been converted to a numeric index.

Any ideas on what would cause this? If so, I could hunt down the
difference between the environments.

Thanks!

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

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


CakePHP Job

2010-01-08 Thread foldiman
Hi,
I'm looking for a CakePHP developer to join an existing CakePHP
development team for a 2-3 month contract in NYC. CakePHP knowledge is
required. Any front-end skills such as jQuery and CSS are a bonus.

This project is for a major media/entertainment brand and will require
some work on-site at their ad agency. If you are interested, please
contact directly with a resume and relevant details. If you know
anyone that may be interested, please forward this post.

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

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


Re: Multiple Model Pagination

2009-12-29 Thread foldiman
Here's a new tutorial that's a bit more relevant

http://foldifoldi.com/news/?p=466

On Dec 25, 9:15 am, foldiman  wrote:
> Andrew,
> It sounds like you want to use a join in yourpaginationquery. If you
> have set up your model relationships, the joins may happen
> automagically. However, you can force the join using the 'joins'
> parameter in thepaginationquery. For example:
>
> $joins1 = array(
> 'table' => 'bug_relations',
> 'alias' => 'BugRel',
> 'type' => 'inner',
> 'foreignKey' => false,
> 'conditions' => array(
> 'BugsGarden.bug_relation_id = BugRel.id',
> 'BugRel.name LIKE' => '%' . 'beetle' . '%'
> )
>
> $this->paginate= array(
> 'BugsGarden' => array(
> 'limit' => 20,
> 'order' => array('BugsGarden.created' => 'asc'),
> 'contain' => array(
> 'Garden', 'BugRelation'
> ),
> 'joins' => array($joins1)
> )
> )
>
> If you wanted to see what Bugs were found in which
> Garden...specifically which bugs have the string 'beetle' in their
> name, you could paginate a relation table that carries which bugs are
> in which garden using ids as foreign keys. You can then get the name
> from another tablein this example a table called 'bug_relations'
> that carries info about the various bugs. The join to get the full
> names or other info is forced in the 'joins' param of thepagination
> query. Remember to include the table name in your sort keys.
>
> An example of cross database queries is also here.
>
> http://foldifoldi.com/news/?p=436
>
> I hope this helps,
> Vince
>
> On Dec 24, 12:32 pm, Andrew  wrote:
>
>
>
> > Greetings, all,
> >      I know other people have worked on this before, but I haven't
> > been able to find a solution so far. So, the long and short of it is
> > that I've got multiple models that I want to mix into one view sorted
> > by the date created.
>
> > I've got a 'created' datetime field in the database already. I
> > understand how to paginate each of the individual database calls and
> > merging that info together, but that doesn't work with the core
> >paginationstuff as I understand it. Do you have any suggestions for
> > developing this?
>
> > Also, I'd like to keep the number of database calls down, so any
> > suggestions along those lines would be great. Thanks!
>
> > ~Andrew

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

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


Re: Multiple Model Pagination

2009-12-25 Thread foldiman
Andrew,
It sounds like you want to use a join in your pagination query. If you
have set up your model relationships, the joins may happen
automagically. However, you can force the join using the 'joins'
parameter in the pagination query. For example:

$joins1 = array(
'table' => 'bug_relations',
'alias' => 'BugRel',
'type' => 'inner',
'foreignKey' => false,
'conditions' => array(
'BugsGarden.bug_relation_id = BugRel.id',
'BugRel.name LIKE' => '%' . 'beetle' . '%'
)

$this->paginate= array(
'BugsGarden' => array(
'limit' => 20,
'order' => array('BugsGarden.created' => 'asc'),
'contain' => array(
'Garden', 'BugRelation'
),
'joins' => array($joins1)
)
)

If you wanted to see what Bugs were found in which
Garden...specifically which bugs have the string 'beetle' in their
name, you could paginate a relation table that carries which bugs are
in which garden using ids as foreign keys. You can then get the name
from another tablein this example a table called 'bug_relations'
that carries info about the various bugs. The join to get the full
names or other info is forced in the 'joins' param of the pagination
query. Remember to include the table name in your sort keys.

An example of cross database queries is also here.

http://foldifoldi.com/news/?p=436

I hope this helps,
Vince

On Dec 24, 12:32 pm, Andrew  wrote:
> Greetings, all,
>      I know other people have worked on this before, but I haven't
> been able to find a solution so far. So, the long and short of it is
> that I've got multiple models that I want to mix into one view sorted
> by the date created.
>
> I've got a 'created' datetime field in the database already. I
> understand how to paginate each of the individual database calls and
> merging that info together, but that doesn't work with the core
> pagination stuff as I understand it. Do you have any suggestions for
> developing this?
>
> Also, I'd like to keep the number of database calls down, so any
> suggestions along those lines would be great. Thanks!
>
> ~Andrew

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

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


Looking for an NYC area CakePHP developer

2009-11-19 Thread foldiman
Hi. I'm currently engaged on a CakePHP project and am looking for
another CakePHP developer to help bring it to completion. This site
has been fully wireframed, designed and has a working prototype that
was developed in Zend. Everything is in place and ready to go.
However, the final site needs to be built out using CakePHP. Work
would begin in December. Payment would be based on an hourly rate.

As I mentioned in the subject line, I would prefer an NYC area
developer (I'm in Brooklyn). This would also be a collaborative effort
with myself likely to take on the majority of the front-end work, CSS,
jquery, etc.

If you are interested, please send an email to vi...@foldifoldi.com

Thanks,
Vince

--

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




Re: CakeFest IV - America - Help us pick a location!

2009-11-14 Thread foldiman
I vote NYC!

On Nov 13, 11:19 pm, BrendonKoz  wrote:
> Although I live east coast, I'd be more apt to go if it was some place
> warm/tropical.  Once you're in DC, it's not bad, but getting there if
> you don't fly is a pain.  Chicago's airport's pretty cool, but I've
> never been outside of it.  How is Texas's night life?  Safe?
>
> Anyway, nice of the Cake team to ask!  Thanks!
>
> On Nov 13, 11:02 pm, Miles J  wrote:
>
>
>
> > Chicago seems cheap and cold, also one of the worse major cities in
> > the US, why there?
>
> > I vote for New York, or Seattle, or Boston, or something.
>
> > On Nov 13, 7:36 pm, Renan Gonçalves  wrote:
>
> > > Looks like Chicago is a nice place to host.
>
> > > On Fri, Nov 13, 2009 at 1:43 AM, Graham Weldon 
> > > wrote:
>
> > > > Hi all,
>
> > > > The CakePHP team has been considering the location for the next upcoming
> > > > CakeFest.
> > > > We've decided to bring it back home to the United Sates of America.
> > > > Thus far we haven't chosen a location for the event, but to ensure we 
> > > > reach
> > > > as many people as possible, we'd like your opinion on where we should 
> > > > host
> > > > the event.
>
> > > > Essentially, our choices are:
> > > > - USA East Coast
> > > > - USA West Coast
> > > > - USA Central
>
> > > > If I have missed another location that you feel might be more popular or
> > > > accessible to interested attendees, feel free to suggest it.
> > > > We're keen to hear peoples thoughts on it.
>
> > > > Cheers,
>
> > > > Graham Weldon (AKA: Predominant)
>
> > > > e. gra...@grahamweldon.com
> > > > w.http://grahamweldon.com
>
> > > >  --
> > > > You received this message because you are subscribed to the Google 
> > > > Groups
> > > > "CakePHP" group.
> > > > To post to this group, send email to cake-...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/cake-php?hl=.
>
> > > --
> > > Renan Gonçalves aka renan.saddam
> > > CakeDC Software Engineer
> > > CakePHP Core Developer
> > > Website: renangoncalves dot com
> > > Extrema, MG, Brazil- Hide quoted text -
>
> > - Show quoted text -

--

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




CakePHP sites for pitching the CakePHP framework

2009-10-06 Thread foldiman

I have a chance to pitch using CakePHP as the framework for a very
large project. However, I'm being asked to provide real world examples
of commercial Cake sites. I found the "Cake in the wild list".
However, I'm curious if there are any more high-profile sites like
rockstargames.com, addons.mozilla.org, missuniverse.com, etc.

Also, are there other high-level selling points for CakePHP that
someone can provide. Total CakePHP downloads? Total contributors?

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



Re: Retaining URL parameters on failed validation

2009-08-21 Thread foldiman

Here's a blog post on exactly this subject.

http://foldifoldi.com/news/?p=352

You can also see the comment about the $this->params['url']['url']
entry

On Aug 20, 5:12 pm, Jamie  wrote:
> Oops, you're right - I don't. ;) At least, not until yesterday, and
> now I have a bug report sitting in my inbox that a contact form is
> exhibiting the same action URL error that Carl describes.
>
> But yeah, sticking the forward slash before $this->params['url'][url']
> works just fine.
>
> On Aug 20, 8:37 am, AD7six  wrote:
>
> > You evidently never develop withhttp://domain/project/in/a/subfolder
> > ;)
>
> > if you're athttp://localhost/myapp/foo/bar/fum
>
> > $this->here is 'myapp/foo/bar/fum"
> > $this->params['url']['url'] is "foo/bar/fum"
>
> > (or similar)
>
> > It was a minor oversight that the url param doesn't have a / prefix
>
> > I use/meant to say '/' . $this->params['url']['url']
>
> > AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Certain strings crashing CakePHP - where do I look first?

2009-08-17 Thread foldiman

The original post about problem strings and TinyMCE reminds me of a
problem I recently had. Search for "500.shtml error? What is this?
Help!?" in this group.

But I had built a basic CMS that allowed an admin to change text in
specific views. Whenever the text contained "from" or other specific
words, submitting the form would redirect the browser to a page that
did not exist. Removing TinyMCE allowed the text to submit without a
problem. However, TinyMCE was a requirement.

It turns out the server admin had set the mod_security settings to
protect against sql injection. Once he removed the mod_security
settings site-wide, the problem went away. I made sure I was using
Cake's sanitize function as a sql injection protection.

I hope this helps.


On Aug 16, 6:12 am, AD7six  wrote:
> On Aug 16, 12:03 pm, AD7six  wrote:
>
> > On Aug 16, 11:36 am, technicaltitch  wrote:
>
> PS "By 404 I mean that when I press submit, it redirects to the
> homepage, which is exactly what it does if I type in a non-existent
> URL."
>
> Is that your entire basis for thinking that cake is treating certain
> strings as if they were blank? That's a pretty far fetched assumption
> - especially as it's your own code requesting the redirect (directly,
> or indirectly).
>
> Overriding redirect, and setting debug to != 0 should help you find
> the reason.
>
> AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: 500.shtml error? What is this? Help!?

2009-08-06 Thread foldiman

Thanks JamesF for responding. It turns out the server admin had setup
mod_security to protect against SQL injection. I told him I was
already using a sanitize function. He turned off the corresponding
mod_security rules and the errors disappeared.

On Aug 4, 10:54 pm, JamesF  wrote:
> i got those 500 errors when my webroot directory permissions were
> incorrectly set up. but in your case it seems that the error appears
> when you submit a form. is it submitting the the right controller?
>
> On Aug 4, 7:37 am, foldiman  wrote:
>
>
>
> > I've deployed my project to a client's server and am getting a strange
> > error when submitting text via a simple form. This does not happen on
> > my staging server. The full error looks like this:
>
> > NOT FOUND
>
> > Error: The requested address '/500.shtml' was not found on this
> > server.
>
> > Obviously I'm not looking for a file500.shtml...just submitting to a
> > controller action. I've read somewhere about Zend Optimizer causing
> > problems with CakePHP. But Zend is disabled on this sever? Any ideas?
>
> > Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



500.shtml error? What is this? Help!?

2009-08-04 Thread foldiman

I've deployed my project to a client's server and am getting a strange
error when submitting text via a simple form. This does not happen on
my staging server. The full error looks like this:

NOT FOUND

Error: The requested address '/500.shtml' was not found on this
server.

Obviously I'm not looking for a file 500.shtml...just submitting to a
controller action. I've read somewhere about Zend Optimizer causing
problems with CakePHP. But Zend is disabled on this sever? Any ideas?

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



Re: reading sessions!?

2009-06-17 Thread foldiman

I found this article and followed his advice. It's amazing what damage
a little whitespace can do.

http://dblog.com.au/web-development/cakephp-session-troubleshooting/

On Jun 16, 5:31 pm, foldiman  wrote:
> Correction, I'm using
>
> read()); ?>
>
> On Jun 16, 4:20 pm, foldiman  wrote:
>
> > I just started a new CakePHP project with a new download of Cake. If I
> > place the following in my home.ctp in my pages directory, I see my
> > session.
>
> > 
>
> > But it doesn't work on any view page that's linked to a controller.
> > For example, I have a 'cars_controller' and a 'cars' folder in the
> > 'views' folder. If I place the above code in the index.ctp file in the
> > cars folder and render the page, I get nothing! But if I go back to
> > the homepage the session is still there. I can even see that the time
> > changed.
>
> > The cars controller is not complicated. It's just this.
>
> > var $name = 'Cars';
>
> >         function beforeFilter() {
> >                 parent::beforeFilter();
> >                 $this->pageTitle = $this->name;
> >          }
>
> >         function index () {
>
> >         }
>
> > Why in the world would I not be able to see my session from the view?
> > I've tried adding the Session component and Session helper with no
> > success.
>
> > Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: reading sessions!?

2009-06-16 Thread foldiman

Correction, I'm using

read()); ?>



On Jun 16, 4:20 pm, foldiman  wrote:
> I just started a new CakePHP project with a new download of Cake. If I
> place the following in my home.ctp in my pages directory, I see my
> session.
>
> 
>
> But it doesn't work on any view page that's linked to a controller.
> For example, I have a 'cars_controller' and a 'cars' folder in the
> 'views' folder. If I place the above code in the index.ctp file in the
> cars folder and render the page, I get nothing! But if I go back to
> the homepage the session is still there. I can even see that the time
> changed.
>
> The cars controller is not complicated. It's just this.
>
> var $name = 'Cars';
>
>         function beforeFilter() {
>                 parent::beforeFilter();
>                 $this->pageTitle = $this->name;
>          }
>
>         function index () {
>
>         }
>
> Why in the world would I not be able to see my session from the view?
> I've tried adding the Session component and Session helper with no
> success.
>
> Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



reading sessions!?

2009-06-16 Thread foldiman

I just started a new CakePHP project with a new download of Cake. If I
place the following in my home.ctp in my pages directory, I see my
session.



But it doesn't work on any view page that's linked to a controller.
For example, I have a 'cars_controller' and a 'cars' folder in the
'views' folder. If I place the above code in the index.ctp file in the
cars folder and render the page, I get nothing! But if I go back to
the homepage the session is still there. I can even see that the time
changed.

The cars controller is not complicated. It's just this.

var $name = 'Cars';

function beforeFilter() {
parent::beforeFilter();
$this->pageTitle = $this->name;
 }

function index () {


}

Why in the world would I not be able to see my session from the view?
I've tried adding the Session component and Session helper with no
success.

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



Session.timeout vs session cookie expiration date

2009-06-11 Thread foldiman

I haven't found any documentation on this. But I'm assuming the
Session.timeout and Cookie expiration date are not equal. In fact, by
experimenting with the three different security levels, I found the
following:

low = cookie expires in 25 years
medium = cookie expires in 1 week
high = cookie expires at the end of the session

Can anyone confirm these values? Also, I'm assuming a new session uses
the same cookie if it exists rather than overwriting itcorrect?

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



Re: Reading/Writing ciphers from MySQL

2009-06-09 Thread foldiman

Setting the 'content' field type to BLOB in the secrets table solved
this problem.


On Jun 9, 12:10 pm, foldiman  wrote:
> I'm trying to figure out why on one host, my CakePHP app will read/
> write ciphered text in and out of a MySQL table while on another it
> fails. I've set up a simple test to comparetry it and you can see
> for yourself
>
> On this host it works:
>
> http://www.foldifoldi.com/cakeapps/cipher/secrets/add
>
> On this host it does not:
>
> http://cakeappcipher.aptanacloud.com/secrets/add
>
> On both hosts, the Default Character Set is "latin1" and Default
> Collation is "latin1_swedish_ci". On both the table type is InnoDB.
> Here's the two differences.
>
> 1. The foldi host is running 4.1.22-standard while the Aptana host is
> running Mysql 5.0.51.
> 2. On the foldi host, the primary key in the "secrets" table is type =
> PRIMARY while on the Aptana host the primary key is type = BTREE.
>
> Any insights would be greatly appreciated.
>
> Also, this is my controller:
>
> class SecretsController extends AppController {
>
>         var $name = 'Secrets';
>
>         function beforeFilter() {
>
>                 parent::beforeFilter();
>
>                 $this->pageTitle = $this->name;
>
>          }
>
>         function add () {
>
>                 if (!empty($this->data)) {
>                         $this->data['Secret']['content'] = 
> Security::cipher($this->data
> ['Secret']['content'], Configure::read('Security.salt'));
>                         if($this->Secret->save($this->data)) {
>                                 $this->Session->setFlash("Your secret is safe 
> with me");
>                                 $this->redirect(array('action' => 'confess', 
> $this->data['Secret']
> ['user_id']));
>                 } else {
>                                 $this->Session->setFlash(__('Your secret 
> could not be created.
> Please review the errors below and try again.', true));
>                         }
>                 }
>
>                 $this->data['Secret']['user_id'] = uniqid();
>
>         }
>
>         function confess ($id) {
>
>                 $params = array(
>                         'conditions' => array('Secret.user_id' => $id)
>                 );
>
>                 $this->data = $this->Secret->find('first', $params);
>
>                 $this->set('confession', 
> Security::cipher($this->data['Secret']
> ['content'], Configure::read('Security.salt')));
>
>         }
>
> }
>
> Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Reading/Writing ciphers from MySQL

2009-06-09 Thread foldiman

I'm trying to figure out why on one host, my CakePHP app will read/
write ciphered text in and out of a MySQL table while on another it
fails. I've set up a simple test to comparetry it and you can see
for yourself

On this host it works:

http://www.foldifoldi.com/cakeapps/cipher/secrets/add

On this host it does not:

http://cakeappcipher.aptanacloud.com/secrets/add

On both hosts, the Default Character Set is "latin1" and Default
Collation is "latin1_swedish_ci". On both the table type is InnoDB.
Here's the two differences.

1. The foldi host is running 4.1.22-standard while the Aptana host is
running Mysql 5.0.51.
2. On the foldi host, the primary key in the "secrets" table is type =
PRIMARY while on the Aptana host the primary key is type = BTREE.

Any insights would be greatly appreciated.

Also, this is my controller:

class SecretsController extends AppController {

var $name = 'Secrets';

function beforeFilter() {

parent::beforeFilter();

$this->pageTitle = $this->name;

 }


function add () {

if (!empty($this->data)) {
$this->data['Secret']['content'] = 
Security::cipher($this->data
['Secret']['content'], Configure::read('Security.salt'));
if($this->Secret->save($this->data)) {
$this->Session->setFlash("Your secret is safe 
with me");
$this->redirect(array('action' => 'confess', 
$this->data['Secret']
['user_id']));
} else {
$this->Session->setFlash(__('Your secret could 
not be created.
Please review the errors below and try again.', true));
}
}

$this->data['Secret']['user_id'] = uniqid();

}

function confess ($id) {

$params = array(
'conditions' => array('Secret.user_id' => $id)
);

$this->data = $this->Secret->find('first', $params);

$this->set('confession', Security::cipher($this->data['Secret']
['content'], Configure::read('Security.salt')));

}


}


Thanks!



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



Warning (2): unlink() !? What is this error?

2009-06-05 Thread foldiman

I get this error intermittently and do not understand why.

Warning (2): unlink(/app/tmp/cache/models/
cake_model_default_restaurants_states)
[function.unlink]: No such file or directory [CORE/cake/libs/file.php,
line 292]

I notice that if I simply reload the page, the error goes away. It
seems to always mention a "cake_model" in the /tmp/cache/models/
folderbut it's not always the same model. I also have my debug
level set to 2.

Does anyone else know what this is about?

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



Re: Involuntary logouts - WHY?

2009-05-29 Thread foldiman

Thanks. I've implemented this change and pushed another build for
testing. Meanwhile, would the following setting in the core.php file
have any effect?

Configure::write('Session.start', true);
Configure::write('Session.checkAgent', true);

Do these have anything to do with the Auth component?

Thanks.

On May 26, 7:51 pm, Miles J  wrote:
> Try changing this:
>
> $this->Auth->allow('display');
> $this->Auth->allow('recoverpassword_submit');
> $this->Auth->allow('*');
>
> To this:
>
> $this->Auth->allow('display', 'recoverpassword_submit');
>
> By putting the * your overwriting the other 2. You also only need to
> call allow() once but supply many arguments for each action.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Involuntary logouts - WHY?

2009-05-26 Thread foldiman

My Cake built site is in QA and is receiving bugs from testers saying
they are getting involuntarily logged out at random places in both the
admin and public side. I'm using a simple implementation of the Auth
component...no Acl. I have my Security set to low for long sessions.

But I'm really stuck as to what could be happening. Anyone have ideas
about where to start looking. Here's my Auth variables.

$this->Auth->allow('display');
$this->Auth->allow('recoverpassword_submit');
$this->Auth->allow('*');
$this->Auth->loginRedirect = '/';
$this->Auth->loginAction = array('controller' => 'users', 'action' =>
'login');
$this->Auth->logoutRedirect = array('controller' => 'pages', 'action'
=> 'homepage');
$this->Auth->autoRedirect = false;

// additional login criteria
$this->Auth->userScope = array(
'User.inactive' => '0',
'User.deleted' => '0'
);

$this->Auth->fields = array(
 'username' => 'email',
 'password' => 'password'
);

Thanks.

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



Re: link TO an image

2009-05-19 Thread foldiman

James F responded with some advice that worked...

...

rewrite it like this.

$html->link($html->image('/uploads/main_demo.jpg'), $html->url('/
uploads/main_zoom.jpg'), array('title' => 'hello', 'escape' =>
false, 'class' => 'mg_main'));

you shouldn't pass the url as an array. you can pass an array as a
parameter for $html->url to use verbose linking (i.e.
'controller'=>'post', 'action'=>'index').

On May 18, 4:53 pm, justclint  wrote:
> Are you placing the folder "upload" somewhere in the webroot folder?
>
> If not, you would want to create your upload folder in the webroot
> folder. If they are images getting uploaded you might make a folder
> structure like:
>
> webroot/img/photos/mediagallery/uploads/
>
> Then your image helper would look something like:
>
> $html->link($html->image('photos/mediagallery/uploads/main_demo.jpg'),
> array($html->url('
> photos/mediagallery/uploads/main_zoom.jpg')), array('title' =>
> 'hello', 'escape' =>
> false, 'class' => 'mg_main'));
>
> Hope this helps.
>
> On May 18, 12:50 pm, foldiman  wrote:
>
> > I'm stuck trying to construct a URL using the html helper that points
> > to an jpeg sitting in an 'uploads' folder in my webroot folder. I've
> > tried the following.
>
> > $html->link($html->image('/uploads/main_demo.jpg'), array($html->url('/
> > uploads/main_zoom.jpg', true)), array('title' => 'hello', 'escape' =>
> > false, 'class' => 'mg_main'));
>
> > However, this creates the following URL which is obviously broken.
>
> >http://mysite/photos/mediagallery/http://mysite/uploads/main_zoom.jpg
>
> > When I remove the 'true' option from the $html->url statement I get
> > this which is also wrong.
>
> >http://mysite/photos/mediagallery/uploads/main_zoom.jpg
>
> > And then I also noticed that when I go to the following url, Cake asks
> > for a controller which is of course missing.
>
> >http://mysite/uploads/main_zoom.jpg
>
> > So how can I just point the browser to this image?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



link TO an image

2009-05-18 Thread foldiman

I'm stuck trying to construct a URL using the html helper that points
to an jpeg sitting in an 'uploads' folder in my webroot folder. I've
tried the following.

$html->link($html->image('/uploads/main_demo.jpg'), array($html->url('/
uploads/main_zoom.jpg', true)), array('title' => 'hello', 'escape' =>
false, 'class' => 'mg_main'));

However, this creates the following URL which is obviously broken.

http://mysite/photos/mediagallery/http://mysite/uploads/main_zoom.jpg

When I remove the 'true' option from the $html->url statement I get
this which is also wrong.

http://mysite/photos/mediagallery/uploads/main_zoom.jpg

And then I also noticed that when I go to the following url, Cake asks
for a controller which is of course missing.

http://mysite/uploads/main_zoom.jpg

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



complex find condition, HELP

2009-05-17 Thread foldiman

I'm stuck on constructing a complex find statement. I have a Car model
and a Cartype model that are associated via HABTM. In other words, a
Jeep (Car) can be an SUV (Cartype), a Truck (Cartype), and a
Convertible (Cartype).

I'm stuck on constructing the find query when searching for Cars by
Cartype. If the relationship WAS Cartype HasMany Car (ie. a Car can
only have one Cartype) it would be easy

$search_criteria = array('SUV', 'Truck', 'Convertible');

$params = array(
 'conditions' = array('Car.cartype_id' => $search_criteria);
)

$this->Car->find('all', $params);

BUT, the Car model can have many Cartypes...meaning the Car model does
not have a `cartype_id` field.

So how do construct a query that would mean, "give me all the Cars
that are related to at least one Cartype contained in the search
criteria"? Does this make sense?

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



Re: PEAR Spreadsheet_Excel_Writer

2009-05-04 Thread foldiman

Does anyone have a live example of Spreadsheet_Excel_Writer? Thanks.

On May 3, 2:38 pm, shird  wrote:
> Thank you. I found the problem I was having when I first replied to
> this. I am now set on this. I did have to declare the vendors path
> though, I am keeping my vendors in the app directory, instead of a
> level above, so I had to change that one. After that, it works like a
> charm.
>
> On May 3, 9:32 am, brian  wrote:
>
> > You didn't provide the correct class name. Try it this way:
>
> > App::import('vendor', 'Spreadsheet_Excel_Writer', array('file' => 
> > 'vendors/PEAR/
> > Spreadsheet_Excel_Writer-0.9.1/Writer/Writer.php'));
>
> > On Sun, May 3, 2009 at 12:17 PM, shird  wrote:
>
> > > I am trying to get the Spreadsheet_Excel_Writer to work as a vendor in
> > > CakePHP 1.2. I have downloaded the PEAR library and the
> > > Spreadsheet_Excel_Writer libraries to the following:
>
> > > app/vendors/PEAR/PEAR
> > > app/vendors/PEAR/Spreadsheet_Excel_Writer-0.9.1
>
> > > I am trying to export a list of registrations that is stored in a
> > > MySQL database. In my controller, I am trying to load the vendor
> > > libraries with the following:
> > > App::import('vendor', 'xls', array('file' => 'vendors/PEAR/
> > > Spreadsheet_Excel_Writer-0.9.1/Writer/Writer.php'));
>
> > > I am trying to do everything from the controller and not the view, as
> > > I want this to be a "view-less" action.
>
> > > The code I am trying to load is as follows:
> > > $xls = new Spreadsheet_Excel_Writer("registrations.xls");
>
> > > and it fails and gives this error message:
> > > Fatal error: Class 'Spreadsheet_Excel_Writer' not found in ~app/
> > > controllers/conferences_controller.php on line 827
>
> > > I have looked thru this group to see if there is any info or
> > > instructions on how to include PEAR libraries with a CakePHP 1.2 app,
> > > and I have looked thru the cookbook and there is no section for
> > > vendors, and I have done Google searches for the info on how to do
> > > this.
>
> > > If anyone can steer me in the right direction, or to a site that has
> > > the information on how to get a PEAR library to work with CakePHP 1.2,
> > > it would be very helpful.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: intercepting HABTM inserts - Where?

2009-03-05 Thread foldiman

I was stumbling because I thought the beforeSave() was an all or
nothing thing. So if you return true, the save functionthe ENTIRE
save function executes. So I was trying to query bits of the save
function to specifically stop the insert query on the HABTM table.

Now I realize that if I unset the key variable of the HABTM
relationship, cake knows to not make the insert. So here's the
solution in the User model to the above problem:

function beforeSave() {
if ($this->data['User']['role_id'] != 'Club Administrator') {
unset($this->data['Club']['Club']);
}

}

FOLLOW-UP QUESTION:
Is there a way to detect the action the controller is executing so I
can wrap the if..then in a condition like:

if ($this->action) {

}

...that of course does not work...but what would get me the current
users_controller action?

Thanks!

On Mar 4, 6:19 pm, brian  wrote:
> I would do that in beforeSave(). What problems were you having with that?
>
> On Wed, Mar 4, 2009 at 1:34 PM, foldiman  wrote:
>
> > I've successfully setup a HABTM between a User model and Club model
> > that looks like this in my User model:
> > var $hasAndBelongsToMany = array(
> > 'Club' =>array(
> > 'className' => 'Club',
> > 'foreignKey'  => 'user_id',
> > 'associationForeignKey'  => 'club_id'
> > )
> > );
>
> > When creating new Users, I display a select field using the following
> > in my Controller.
>
> > $this->set('clubs', $this->User->Club->find('list'));
>
> > However, after saving a new user, I only want to insert records into
> > my clubs_users table for certain types of Users. For example, if a
> > User is a 'Club Administrator', they can have a relationship with a
> > Club. If they are an 'Anonymous User', I don't want to associate them
> > with a Club.
>
> > I've successfully got this running by using jQuery to hide and show
> > the Clubs select field on the add new User page according to a
> > preceding User Role field. jQuery actually sets the Clubs field's name
> > to 'null' when hidden so Cake ignores the field. However, this sees
> > like a fragile system.
>
> > Is there a built in way in Cake to achieve the same results? Maybe in
> > the beforeSave() callback in the User model to intercept and kill the
> > clubs_users table insert? I've tried a few things there without luck.
> > Any help would be appreciated. Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



HABTM checkboxes disappearing after validation rules applied

2009-03-04 Thread foldiman

I have an add User page that has a set of checkboxes representing the
User model's HABTM relationship to another model. On form submission,
when one of the validation rules gets triggered, all the checkboxes
disappear. Has anyone else encountered this problem?

To get around it, I do the validation in the Users controller and
resend the HABTM data on validation failure. Is this standard practice
or am I missing something?

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



HABTM query with conditions - HELP

2009-03-04 Thread foldiman

I've successfully setup a HABTM between a User model and Club model
that looks like this in my User model:

var $hasAndBelongsToMany = array(

'Club' =>array(
'className' => 'Club',
'foreignKey'  => 'user_id',
'associationForeignKey'  => 'club_id'
)

);

When creating new Users, I display a select field using the following
in my Controller.

$this->set('clubs', $this->User->Club->find('list'));

However, after saving a new user, I only want to insert records into
my clubs_users table for certain types of Users. For example, if a
User is a 'Club Administrator', they can have a relationship with a
Club. If they are an 'Anonymous User', I don't want to associate them
with a Club.

I've successfully got this running by using jQuery to hide and show
the Clubs select field on the add new User page according to a
preceding User Role field. jQuery actually sets the Clubs field's name
to 'null' when hidden so Cake ignores the field. However, this sees
like a fragile system.

Is there a built in way in Cake to achieve the same results? Maybe in
the beforeSave() callback in the User model? I've tried a few things
there without luck. Any help would be appreciated. Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



intercepting HABTM inserts - Where?

2009-03-04 Thread foldiman

I've successfully setup a HABTM between a User model and Club model
that looks like this in my User model:
var $hasAndBelongsToMany = array(
'Club' =>array(
'className' => 'Club',
'foreignKey'  => 'user_id',
'associationForeignKey'  => 'club_id'
)
);

When creating new Users, I display a select field using the following
in my Controller.

$this->set('clubs', $this->User->Club->find('list'));

However, after saving a new user, I only want to insert records into
my clubs_users table for certain types of Users. For example, if a
User is a 'Club Administrator', they can have a relationship with a
Club. If they are an 'Anonymous User', I don't want to associate them
with a Club.

I've successfully got this running by using jQuery to hide and show
the Clubs select field on the add new User page according to a
preceding User Role field. jQuery actually sets the Clubs field's name
to 'null' when hidden so Cake ignores the field. However, this sees
like a fragile system.

Is there a built in way in Cake to achieve the same results? Maybe in
the beforeSave() callback in the User model to intercept and kill the
clubs_users table insert? I've tried a few things there without luck.
Any help would be appreciated. Thanks.

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



Re: HABTM query with conditions - HELP

2009-03-03 Thread foldiman

Thanks. That was it

On Mar 3, 12:05 pm, mscdex  wrote:
> On Mar 3, 10:15 am, foldiman  wrote:
>
> > $params = array(
> > 'conditions' => array('Music.inactive' => '0')
> > );
> > $this->set('musics', $this->Club->Music->find('list', array
> > ($params)));
>
> > However, the full list of items from the Musics table always appears
> > when I need only the entries with 'inactive' = 0.
>
> One guess is that you are enclosing the params array in another array.
> Try:
> $this->set('musics', $this->Club->Music->find('list', $params));
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



HABTM query with conditions - HELP

2009-03-03 Thread foldiman

I've successfully setup a HABTM relationship between two models,
`Club` and `Music`. When I want to add a new club, I do the following
in the Clubs controller:

$this->set('musics', $this->Club->Music->find('list'));

Like magic my admin_add view for Clubs displays a series of checkboxes
with a list of music from the Music model.

So here's the problem: I have a field in the Musics table called
'inactive'. I'd like to use it to restrict certain entries in the
Musics table from the admin_add view for Clubs. In other words, if we
discontinue certain types of music, I don't want it available to new
Clubs. However, I can't seem to get the above query to accept
conditions. This is what I currently have:

$params = array(
'conditions' => array('Music.inactive' => '0')
);
$this->set('musics', $this->Club->Music->find('list', array
($params)));

However, the full list of items from the Musics table always appears
when I need only the entries with 'inactive' = 0. Here's what the
debugger always shows.

SELECT `Music`.`id`, `Music`.`name` FROM `musics` AS `Music` WHERE 1 =
1

How do I get this?

SELECT `Music`.`id`, `Music`.`name` FROM `musics` AS `Music` WHERE
`Music`.`inactive` = 0

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



Re: What do you develop in (ide, text editor, etc.)?

2009-03-01 Thread foldiman

I've been using Aptana studio and have been deploying to the Aptana
Cloud. Synching to the cloud is pretty cool and has saved me some
time.

On Mar 1, 3:53 am, Kappa  wrote:
> Does the code completion works well with netbeans?
> I'm currently using Eclipse, and it's completion is not great.. for i
> period i used
> to work with Zend IDE ..and it was definitively great..but not free.
>
> Does anybody is using Aptana with cakePHP ?
>
> bye,
>    Andrea
>
> On Feb 28, 11:34 pm, Gonzalo Servat  wrote:
>
> > On Sat, Feb 28, 2009 at 8:06 PM, Mauricio Morales 
> > wrote:
>
> > > I just downloaded Netbeans for PHP 6.5 and it's great.  I've been
> > > using Eclipse for a long but I think you can enjoy Netbeans (open
> > > source and works in linux, mac, windows).
>
> > >http://www.netbeans.org/features/php/
>
> > I second this. NetBeans for PHP 6.5 is excellent! I've stopped using Eclipse
> > myself.
>
> > - Gonzalo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: submitting forms outside Auth

2009-02-27 Thread foldiman

...after trying a few things, I noticed I can't even do this...

form id='pwTestForm' action='javascript:alert()'>



Just trying to trigger an alert triggers the loginAction!?


On Feb 27, 9:12 am, foldiman  wrote:
> I'm using the Auth component with no problem..users login, logout,
> admin working fine, etc.
>
> However, I have a few forms (contact, password recovery) that are not
> connected to models and need to be accessible to all users. The pages
> themselves are easily accessible using the allow() method. But when
> the form is submitted, my Auth->loginAction is getting called. No
> matter how I setup the form, Cake thinks I'm trying to loginwhich
> is of course not what I'm trying to do.
>
> Does anyone have any thoughts as to why Cake is trying to login when
> any form is submitted? Note: this still happens when I set $this->Auth-
>
> >allow('*');
>
> Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



submitting forms outside Auth

2009-02-27 Thread foldiman

I'm using the Auth component with no problem..users login, logout,
admin working fine, etc.

However, I have a few forms (contact, password recovery) that are not
connected to models and need to be accessible to all users. The pages
themselves are easily accessible using the allow() method. But when
the form is submitted, my Auth->loginAction is getting called. No
matter how I setup the form, Cake thinks I'm trying to loginwhich
is of course not what I'm trying to do.

Does anyone have any thoughts as to why Cake is trying to login when
any form is submitted? Note: this still happens when I set $this->Auth-
>allow('*');

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



Re: validating email_confirm field

2009-02-10 Thread foldiman

Thanks, your advice led me to the solution.

With the full debug on, I could see that before the INSERT query was
executed, a SELECT COUNT(*) AS `count` FROM `users` AS `User` WHERE
`User`.`email_confirm` = 'm...@email.com' was throwing an error. This
was because I had a 'unique' validation rule set on the email_confirm
field.

I removed the rule from the field and used your unset suggestion and
the column is no longer included in the INSERT statement. So now it
works...

Thanks!

On Feb 10, 7:04 pm, mscdex  wrote:
> foldiman wrote:
> > Cake wants an 'email_confirm' column in the Users table. This is key
> > to what I'm trying to understand. I don't have a 'password_confirm'
> > column EITHER. But for some reason, Cake does not mind. Is there a
> > built in exception for a field called 'password_confirm'?
>
> Maybe you could unset the 'email_confirm' key in $this->data in the
> beforeSave() callback so it won't try to save to a non-existing column.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: validating email_confirm field

2009-02-10 Thread foldiman

Ok. Thanks. But this only works if I specify exactly which columns to
save in my controller using:

$user = $this->User->save($this->data, true, array('email',
'password', 'password_confirm', 'first_name', 'last_name')

Notice I left out 'email_confirm' in the list even though that field
appears in the view. I would rather use this:

$user = $this->User->save($this->data)

However, SQL throws the following error:

SQL Error: 1054: Unknown column 'User.email_confirm' in 'where clause'

Cake wants an 'email_confirm' column in the Users table. This is key
to what I'm trying to understand. I don't have a 'password_confirm'
column EITHER. But for some reason, Cake does not mind. Is there a
built in exception for a field called 'password_confirm'?

On Feb 10, 4:55 pm, Miles J  wrote:
> If you are trying to match dynamic data, it wont work because Cakes
> default validation is for static data. Heres a method I use to match
> dynamic:
>
> Place this in your appmodel.
>
>         /**
>          * Validates two inputs against each other
>          * @param array $data
>          * @param string $confirmField
>          * @return boolean
>          */
>         function validateMatch($data, $confirmField) {
>                 $data = array_values($data);
>                 $var1 = $data[0];
>                 $var2 = (isset($this->data[$this->name][$confirmField])) ? 
> $this-
>
> >data[$this->name][$confirmField] : '';
>
>                 return ($var1 === $var2);
>         }
>
> And then the validation rule:
>
> 'rule' => array('validateMatch', 'NAMEOFCONFIRMFIELD'),
> 'message' => 'They do not match'
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: validating email_confirm field

2009-02-10 Thread foldiman

Ok. Here's the relevant code in the view file 'users/add.ctp'

echo $form->create('User', array('action' => 'add'));
echo $form->input('first_name', array('label' => '*First name',
'before' => '', 'between' => '', 'after' => '',
'error' => array('wrap' => 'span', 'class' => 'errorMsg'), 'maxlength'
=> '255'));
echo $form->input('last_name', array('label' => '*Last name', 'before'
=> '', 'between' => '', 'after' => '', 'error' =>
array('wrap' => 'span', 'class' => 'errorMsg'), 'maxlength' =>
'255'));
echo $form->input('email', array('label' => '*Email', 'before' =>
'', 'between' => '', 'after' => '', 'error' => array
('wrap' => 'span', 'class' => 'errorMsg'), 'maxlength' => '255'));
echo $form->input('email_confirm', array('label' => '*Confirm email',
'before' => '', 'between' => '', 'after' => '',
'error' => array('wrap' => 'span', 'class' => 'errorMsg'), 'maxlength'
=> '255'));
echo $form->input('password', array('before' => '', 'between' =>
'', 'after' => '', 'error' => array('wrap' => 'span',
'class' => 'errorMsg')));
echo $form->input('password_confirm', array('label' => 'Re-enter
password', 'type' => 'password', 'before' => '', 'between' =>
'', 'after' => '', 'error' => array('wrap' => 'span',
'class' => 'errorMsg')));

..here's the code from the controller

function add() {
$this->layout = 'register';
$this->pageTitle = 'Register';

if (!empty($this->data)) {
if ($user = $this->User->save($this->data)) {
$this->Session->setFlash(__('Thanks for 
registering. Now please
log in.', true));
$this->redirect(array('action' => 'login'));
} else {
$this->Session->setFlash(__('Your account could 
not be created.
Please review the errors below and try again.', true));
}
}
}

... and here's the User model...


 array(

'match' => array(
'rule' => array('confirmEmail','email'),
'message' => 'Your email and email confirmation 
do not
match.',
),

'between' => array(
'rule' => array('between', 1, 255),
'message' => 'Username must be between 1 and 255
characters in length.',
),

'validemail' => array(
'rule' => 'email',
'message' => 'You must supply a valid email
address.',
),

'unique' => array(
'rule' => 'isUnique',
'message' => 'This email address has already 
been
registered.',
),

'notEmpty' => array(
'rule'=> 'notEmpty',
'message' => 'You must supply a valid email 
address.',
)),


'email_confirm' => array(

'validemail' => array(
'rule' => 'email',
'message' => 'You must supply a valid email
address.',
),

'between' => array(
'rule' => array('between', 1, 255),
'message' => 'Username must be between 1 and 255
characters in length.',
),

'unique' => array(
'rule' => 'isUnique',
'message' => 'This email address has already 
been
registered.',
),

'notEmpty' => array(
'rule'=> 'notEmpty',
'message' => 'You must supply a valid email 
address.',
)),


'password' => array(

'match' => array(
'rule' => array('confirmPassword','password'),
'message' => 'Your password and password 
confirmation do
not match.'
),

'alphaNumeric' => array(
'rule' => 'alphaNumeric',
'message' => 'Password can only include 
alpha-numeric
characters.'
),

'between' => array(
'rule' => array('between', 4, 12),
'message' => 'Password must be between 4 and 12
characters in length.'
),

'notEmpty' => array(
'rule'=> 'notEmpty',
'message' => 'You must supply a password.'
)),

'passwor

validating email_confirm field

2009-02-10 Thread foldiman

I'm trying to build a form that includes both a password_confirm field
as well as a email_confirm field. The password_confirm field behaves
as expected when using a confirmPassword() function in the model that
compares the two fields, 'password' and 'password_confirm'.

However, there's a problem when trying to do the same thing with the
'email_confirm' field. Cake is looking for a User.email_confirm column
that does not exist.

Why does Cake not throw an error with 'password_confirm'? What's a
good strategy to avoid an error that does not involve creating an
extra column in the User table?

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



Creating a tagging system for uploaded images

2009-01-28 Thread foldiman

Can anyone give general strategy advice on building a tagging system?
I'm creating an app where users simply upload pics. I've successfully
established an HABTM relationship bw my 'pic' model and my 'tag' model
and have a table w two foreign keys called 'pics_tags'. Adding new
'tags' updates this table just fine.

However, I'm stuck when it comes to assigning already existing tags to
already existing pics. I can currently click on a pic and view its
associated tags and generate a list of available tags in a select
form. However, I get a slew of errors if I try to submit a tag in the
list. Currently, cake thinks I'm trying to add a new pic instead of
updating my 'pics_tags' table.

Do I need a custom function in my pics_controller to handle updating
my 'pics_tags' table?

Can anyone point me to a tutorial for building a tagging system?

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



Help - Acl controlled Application

2009-01-26 Thread foldiman

I'm working thru the "Simple Acl controlled Application" in the
cookbook and cannot get past the 10.2.4 Acts As a Requester step.
Everything is working up to this point, baking the files, initializing
the Dd Acl, tables, etc. I'm on a Mac and can view the app in progress
at http://localhost/tusers/

Before this step, I can see the users and groups scaffolded views at
http://localhost/tusers/users/
http://localhost/tusers/groups/

However, when I add the lines $belongsTo and $actsAs to the users and
groups models (step 10.2.4), I get the following errors when trying to
access the above pages.

Error: The requested address '/users' was not found on this server.
Error: The requested address '/groups' was not found on this server.

So now I'm stuck. Any help would be greatly appreciated.

Thanks.


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