Re: Wildcard DNS | Domain | Subdomain

2011-04-03 Thread swimwithabhra
Hi all,
I am glad to inform you that finally wildcard DNS is working for me.
I just add a A type record and added server alias in virtual host. I
didn't have to change anything in the .htaccess file.

Thank you all for your kind support.

Regards,

Abhra Banerjee

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: You favorite IDE/ Dev Setup?

2011-04-03 Thread Chris
NetBeans is new to me and I'm liking it a lot. Much more organized
than Geany and thats good for me since I'm still sort of new to this
stuff.

@the_plumpNation I'm not entirely convinced either. For some reason my
copy of VIM in Ubuntu 10.10 doesn't accept plugins >_>

On Apr 3, 9:48 pm, the plumpNation  wrote:
> Almost identical but I still use netbeans when I'm working with
> spaghetti that someone hands over. I've also recently switched half my
> javascript debugging to chrome developer tools, after I upgraded to
> firefox 4 too quickly.
>
> My colleagues are trying to get me 100% vim, but I'm not yet
> convinced.
>
> On Apr 3, 4:24 am, huoxito  wrote:
>
>
>
>
>
>
>
> > Ubuntu
> > Vim (still learning but already useful for me)
> > Gedit
> > Git
> > Shell
> > Apache
> > Mysql

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Is it time for ACL?

2011-04-03 Thread Chris
Sounds perfect to me, And to anticipate any issues you might have...
Here is a good little github project that provides ACL management
https://github.com/interlock/acl_plugin

Just read it up on the CakePHP book listed on that project, try out
the ACL+Auth setup on a dummy project first and then go ahead. Thats
what I would do.


On Apr 4, 12:13 am, adam_g2000  wrote:
> Hi All,
>
> I've been working on a project, that is essentially an artists
> portfolio. She's just dropped a bombshell, previously, the
> authentication was simple. You either had rights to view the site and
> it's CMS or you had the rights to view only the site.
>
> Now she wants to *lock* certain areas of the site, so that she can
> show some work, to only some people. So it sounds to me like I need to
> learn the ACL component. Or is that too complicated for what I'm
> doing?
>
> the site mainly consists of visual 'lists' of links to images (which
> are in a db of course). In a page of these links, I'm showing the
> whole list, within a controllers method. When we move forward, it may
> be that the method will need to show only some of these links based on
> the ACL, is this level of granularity possible, or does simple ACL
> stop at the method?
>
> Thanks in advance for any advice,
>
> Adam.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: two questions about Auth component

2011-04-03 Thread Chris
I know for the first issue you must set the post data to null so that
it doesn't post back that data to the user. Or maybe just set the
password as null.

for the second issue, I'm just thinking an idea nothing I've tried out
and I'd actually want to see a better answer but, maybe you could set
a hidden field to check if it's post again,unless there is an
unknown,to me, isPostBack property or similar function in PHP like in
ASP.NET, and then force redirect to else where.

On Apr 3, 4:19 pm, Tan Cheng  wrote:
> Hi everyone,
>
> I need help..., I am using the Auth component in cake, but I
> encountered two issues so far and couldn't find good answers, shed me
> some light please.
>
> 1) Register issue:
>
> I set up some validation rules for the password field in my user
> model, so if the password user provided doesn't comply my rule, the
> user will be redirected to the registration page with error message.
> Everything is fine except that the password will still be displayed in
> the password text field (with bullet points), and it's a very long row
> of bullet points because of the encryption. I don't want the user see
> the confusing long bullet points. How can I make the password field
> empty??
>
> 2) Reset password issue:
>
> In my site, I allow user reset their password by typing the email in a
> text box, then the script will generate an email with a link, the
> users click on the link and they will be taken to a page to reset
> their password.
>
> The issue is when the user finished resetting the password, I redirect
> the user to the login page. However, when the user logs in, because
> the "Auth Component" always redirects you to the page where you were
> linked to the login page (autoDirect is on), the user now will always
> be redirected back to the "reset password" page.
>
> So how can I make the user be redirected to another page (e,g.
> homepage), after they have logged in. I don't want to turn the
> "autoRedirect" off, because for most of the time, this is helpful.
>
> Thanks thousand times for your patience reading my long post, any
> implication will be really appreciated!!!
>
> -David

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Is it time for ACL?

2011-04-03 Thread adam_g2000
Hi All,

I've been working on a project, that is essentially an artists
portfolio. She's just dropped a bombshell, previously, the
authentication was simple. You either had rights to view the site and
it's CMS or you had the rights to view only the site.

Now she wants to *lock* certain areas of the site, so that she can
show some work, to only some people. So it sounds to me like I need to
learn the ACL component. Or is that too complicated for what I'm
doing?

the site mainly consists of visual 'lists' of links to images (which
are in a db of course). In a page of these links, I'm showing the
whole list, within a controllers method. When we move forward, it may
be that the method will need to show only some of these links based on
the ACL, is this level of granularity possible, or does simple ACL
stop at the method?

Thanks in advance for any advice,

Adam.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Place action where?

2011-04-03 Thread Krissy Masters
How should this be set up?
User can register as a Buyer or Seller each with different criteria needed
in the form so 2 forms. 
Would you make 2 registration methods in the User controller
buyer_registration() and seller_registration(){} or a register in buyer
controller and register in seller controller? Each is a "User".

Thanks,

K

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: You favorite IDE/ Dev Setup?

2011-04-03 Thread the plumpNation

Almost identical but I still use netbeans when I'm working with
spaghetti that someone hands over. I've also recently switched half my
javascript debugging to chrome developer tools, after I upgraded to
firefox 4 too quickly.

My colleagues are trying to get me 100% vim, but I'm not yet
convinced.

On Apr 3, 4:24 am, huoxito  wrote:
> Ubuntu
> Vim (still learning but already useful for me)
> Gedit
> Git
> Shell
> Apache
> Mysql

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Euromark function guaranteeFields($requiredFields, $data = null) {

2011-04-03 Thread Miloš Vučinić
Yeah, at first i didn't really relise what this was about.. But
Euromark is right. Just make another function, to which normal users
have access, and change the way it inputs fields. You can read from DB
to see the old values and place them to be sure they haven't change,
and only allowed ones to put from the form.

But interesting topic, until you asked I really didn't think of this
in cake..

There is also another way that came across my mind for doing this.
It's a little odd, but in odd situations odd solutions can be ok.

If you have like 50 fileds in db which user shouldn't be able to
change and 50 more which he should (raelly aqward situation but let's
just say this is it for conversation purposes..), you could make 2 DB
tables. First one is consisted of 50 allowed fields + 1 not allowed to
change and the other is made of 50 forbiden fields. Logicaly, you have
one on one or many on one relation from allowed to notallowd and that
is the that +1 field. So you can set up function which changes those
50 allowed plus 1 not allowed fields , and check for only that one
which is a connection to forbiden fields. So it is kinda boring, but
at least you do not need to check for these 50 fields in your
controller...

I hope it helps a bit, and that you will make success in your
project !

All the best !
Milos

On Apr 3, 12:32 pm, euromark  wrote:
> i disagree with Milos in some points
> but yes, the crucial point is that the main focus should be the server
> side as far as security is concerned
>
> but besides that he proposes hacks that will not only make the code
> less readable, it also opens the door for many
> bugs and errors as well as bloating the model unnecessarily´.
>
> "if you didn't input required value
> (if you even specified what types of character can be used), there is
> no way you'll pass submitting"
> actually, you will. what if the validation is only checking if the ID
> is valid. you still could use the ID of any other user on the site.
> and the security component will not be able to do anything against it.
>
> thats why all fields, that are not intended to be changed should be
> excluded from being passed on to the model.
> this way you can ensure that no harm can be done to them.
> its easy, its short (compared to other solutions like milos), its
> clean.
>
> On 3 Apr., 10:57, Miloš Vučinić  wrote:
>
> > I just read smth. So one more comment :) Hope I am not borring you. If
> > you are worried about primary key injection etc, you can always make
> > rights to do stuff. You can have several functions for doing stuff.
> > You can grab data in controller and see if somebody tried to enter a
> > parameter which is not allowed for this kind of users. Like role_id
> > etc, and if they are not null, you blok the save functions.
>
> > Eg.
> > I have user controller, and I have 2 edit functions and by that 2
> > different forms. First one is for admins, and second one for users. In
> > users function I check the data before calling model ($this->save($data)) 
> > and I see what is in that data. If I find smth I don't
>
> > want there I would not call the save data function...
>
> > I can't remember if I actually done that, but I think it is quite
> > doable, because you have access to data var before calling the model..
>
> > all the best :)
>
> > On Apr 3, 10:51 am, Miloš Vučinić  wrote:
>
> > > And if you hate programming so many fields, just bake the add form for
> > > the database table and change it the way you want.. baking takes like
> > > a minute to finish .
> > > :)
>
> > > I am no baking everything I can :)
>
> > > all the best
> > > Milos
>
> > > On Apr 2, 9:26 pm, "Krissy Masters" 
> > > wrote:
>
> > > > Right on. Was only curious since Security create a hash based on the 
> > > > fields
> > > > I figured there must be some way to do the same thing and use it for
> > > > whatever reason.
>
> > > > Thanks for the info all the same.
>
> > > > K
>
> > > > -Original Message-
> > > > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On 
> > > > Behalf
>
> > > > Of euromark
> > > > Sent: Saturday, April 02, 2011 10:43 PM
> > > > To: CakePHP
> > > > Subject: Re: Euromark function guaranteeFields($requiredFields, $data =
> > > > null) {
>
> > > > it is not possible
>
> > > > the controller has no direct link to the form helper
> > > > especially not after a post (and therefore BEFORE the form is rendered
> > > > again).
> > > > controller + model are finished before the view even starts to render.
>
> > > > you would need to embed the keys as a hidden field in the form itself
> > > > (+ hash etc to disallow any modifications).
> > > > but then you could just as well use the security component and you
> > > > would be already done.
>
> > > > so i dont see a point in that.
> > > > i agree that it can be a pain in the but.
> > > > in some rare occasions you could use blacklisting (especially if you
> > > > only want to forbid 1 field of 50 allowed fields).
> > > > in oth

HABTM with non-standard fields

2011-04-03 Thread Rob Wilkerson
I'm attempting to lay a Cake app over top of a legacy database and I'm
bumping into a problem with a HABTM relationship. I have a
TechnologyIncentive that HABTM EnergySource through a join table (no
model). Here are the specs:

TechnologyIncentive
  public $name = 'TechnologyIncentive';
  public $useTable = 'incentive__incentive_tech';
  public $primaryKey = 'id';

  public $hasAndBelongsToMany = array(
'EnergySource' => array(
  'className' => 'EnergySource',
  'joinTable' => 'incentive_tech_energy',
  'foreignKey'=> 'incentive__incentive_tech_id', //
incentive_tech_energy.incentive__incentive_tech_id
  'associationForeignKey' => 'incentive_tech_energy_type_id', //
incentive_tech_energy.incentive_tech_energy_type_id
),
  );

EnergySource
  public $name   = 'EnergySource';
  public $useTable   = 'incentive_tech_energy_type';
  public $primaryKey = 'incentive_tech_energy_type_id';

  public $hasAndBelongsToMany = array(
'TechnologyIncentive' => array(
  'className' => 'TechnologyIncentive',
  'joinTable' => 'incentive_tech_energy',
  'foreignKey'=> 'incentive_tech_energy_type_id',
  'associationForeignKey' => 'incentive__incentive_tech_id',
),
  );

Even when I try a simple find on TechnologyIncentive like this:

$es = $this->find( 'all', array(
  'conditions' => array( 'TechnologyIncentive.id' => 11703 ),
) );

The SQL log shows that the appropriate query was executed and that a
record was returned, but the result array is empty and I get the
following notice:

Undefined index: incentive__incentive_tech_id

If I dig through dbo_source.php for a while, I find that the linking
table (incentive_tech_energy) fields do not include that particular
field. Every other field comes along for the ride, but not that one. I
don't know why it's being left out, but that seems to be why the
result never gets populated.

If anyone knows their way around dbo_source.php and wouldn't mind
helping, I'd love another set of eyes. Could it be that I'm missing
something simple?

Thanks.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


RE: Access regular PHP file

2011-04-03 Thread Krissy Masters
Actually I think my ssl / non ssl routed rules might be messing with it so
that's why. Or my lack of knowledge on nginx.

I managed to access the file now so thanks for your time all the same :)

K

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of Ryan Schmidt
Sent: Sunday, April 03, 2011 5:58 PM
To: cake-php@googlegroups.com
Subject: Re: Access regular PHP file


On Apr 3, 2011, at 15:26, Krissy Masters wrote:

> I have a php script I made for regular website (non frameworked) that I
would access by www.site.com/svr_health.php which is just for my own
development work (storage size, load, just standard junk)
>  
> But when I try to access it I get the pop up user / password as expected
for that file but after trying to access it it just sits there thinking...no
error no redirect no 404 or anything just loading
>  
> I even stripped the file down to just the password and echo hello; and it
still sits there. Removed the password protect and still just sits
there..
>  
> Works fine on standard non-frameworked site, so wondering how can I access
this file in a cake site? The file is in app/webroot.

I would have thought that would be fine. Works for me with my test php file.
Does the web server log say anything?


-- 
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.


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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Access regular PHP file

2011-04-03 Thread Ryan Schmidt

On Apr 3, 2011, at 15:26, Krissy Masters wrote:

> I have a php script I made for regular website (non frameworked) that I would 
> access by www.site.com/svr_health.php which is just for my own development 
> work (storage size, load, just standard junk)
>  
> But when I try to access it I get the pop up user / password as expected for 
> that file but after trying to access it it just sits there thinking…..no 
> error no redirect no 404 or anything just loading……..
>  
> I even stripped the file down to just the password and echo hello; and it 
> still sits there. Removed the password protect and still just sits there..
>  
> Works fine on standard non-frameworked site, so wondering how can I access 
> this file in a cake site? The file is in app/webroot.

I would have thought that would be fine. Works for me with my test php file. 
Does the web server log say anything?


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


two questions about Auth component

2011-04-03 Thread Tan Cheng
Hi everyone,

I need help..., I am using the Auth component in cake, but I
encountered two issues so far and couldn't find good answers, shed me
some light please.

1) Register issue:

I set up some validation rules for the password field in my user
model, so if the password user provided doesn't comply my rule, the
user will be redirected to the registration page with error message.
Everything is fine except that the password will still be displayed in
the password text field (with bullet points), and it's a very long row
of bullet points because of the encryption. I don't want the user see
the confusing long bullet points. How can I make the password field
empty??

2) Reset password issue:

In my site, I allow user reset their password by typing the email in a
text box, then the script will generate an email with a link, the
users click on the link and they will be taken to a page to reset
their password.

The issue is when the user finished resetting the password, I redirect
the user to the login page. However, when the user logs in, because
the "Auth Component" always redirects you to the page where you were
linked to the login page (autoDirect is on), the user now will always
be redirected back to the "reset password" page.

So how can I make the user be redirected to another page (e,g.
homepage), after they have logged in. I don't want to turn the
"autoRedirect" off, because for most of the time, this is helpful.

Thanks thousand times for your patience reading my long post, any
implication will be really appreciated!!!

-David

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Non-existent data source

2011-04-03 Thread cricket
On Sun, Apr 3, 2011 at 12:51 PM, pgredeye  wrote:
> Hai Guys,
>      I have a problem arised while creating an blog app ,its showing
> that there is no data source .so, please
>      can you help me

public $useDbConfig = 'blog';

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Non-existent data source

2011-04-03 Thread prasad gaddai
yeah i am asking it to use $blog database properties and i even tried by
changing it to $default it said that table acos is missing for
 Aco model


On Mon, Apr 4, 2011 at 12:54 AM, Jeremy Burns | Class Outfit <
jeremybu...@classoutfit.com> wrote:

> Are you telling Cake to use the $blog data source? If not, it will look for
> a data source called $default. Trying changing it and see what happens.
> On 3 Apr 2011, at 17:51, pgredeye wrote:
>
> > Hai Guys,
> >  I have a problem arised while creating an blog app ,its showing
> > that there is no data source .so, please
> >  can you help me
> >   this is my database.php piece of code to specify the blog data
> > base.
> >   var $blog = array(
> > 'driver' => 'mysql',
> > 'persistent' => false,
> > 'host' => 'localhost',
> > 'login' => 'root',
> > 'password' => 'scourlet',
> > 'database' => 'blog',
> > 'prefix' => '',
> > );
> >
> >   and this is my blog app's model code
> >
> >  >  class Post extends AppModel {
> > var $useDbConfig = '$blog'; //
> > var $name = 'Post';
> > var $validate = array('title' => array(
> > 'alphanumeric' => array(
> > 'rule' => 'alphanumeric',
> > 'required' => true,
> > 'message' => 'enter a title to post',
> > )
> >   ),
> >   'content' => array(
> >   'alphanumeric' => array(
> >   'rule' => 'alphanumeric',
> >   'required' => true,
> >   'message' => 'enter some content to post',
> >   )
> >  )
> >   );
> >  }
> >  ?>
> > Thank you,
> > pgredeye.
> >
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> > Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
> >
> >
> > 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
>
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.com
> http://www.classoutfit.com
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Non-existent data source

2011-04-03 Thread Jeremy Burns | Class Outfit
Are you telling Cake to use the $blog data source? If not, it will look for a 
data source called $default. Trying changing it and see what happens.
On 3 Apr 2011, at 17:51, pgredeye wrote:

> Hai Guys,
>  I have a problem arised while creating an blog app ,its showing
> that there is no data source .so, please
>  can you help me
>   this is my database.php piece of code to specify the blog data
> base.
>   var $blog = array(
> 'driver' => 'mysql',
> 'persistent' => false,
> 'host' => 'localhost',
> 'login' => 'root',
> 'password' => 'scourlet',
> 'database' => 'blog',
> 'prefix' => '',
> );
> 
>   and this is my blog app's model code
> 
>   class Post extends AppModel {
> var $useDbConfig = '$blog'; //
> var $name = 'Post';
> var $validate = array('title' => array(
> 'alphanumeric' => array(
> 'rule' => 'alphanumeric',
> 'required' => true,
> 'message' => 'enter a title to post',
> )
>   ),
>   'content' => array(
>   'alphanumeric' => array(
>   'rule' => 'alphanumeric',
>   'required' => true,
>   'message' => 'enter some content to post',
>   )
>  )
>   );
>  }
>  ?>
> Thank you,
> pgredeye.
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
> 
> 
> 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


Jeremy Burns
Class Outfit

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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Non-existent data source

2011-04-03 Thread pgredeye
Hai guys,
 I have got a problem while working with cakephp.This is the error

Fatal Error (256): ConnectionManager::getDataSource - Non-existent data
source $blog [CORE/cake/libs/model/connection_manager.p
  
context:
 $name  =   "$blog"
$_this  =   ConnectionManager
ConnectionManager::$config = DATABASE_CONFIG object
ConnectionManager::$_dataSources = array
ConnectionManager::$_connectionsEnum = array

and this is my app/config/database .php file
var $blog = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => 'scourlet',
'database' => 'blog',
'prefix' => '',
);

  and this is my blog app's model code

  array(
'alphanumeric' => array(
'rule' => 'alphanumeric',
'required' => true,
'message' => 'enter a title to post',
)
  ),
  'content' => array(
  'alphanumeric' => array(
  'rule' => 'alphanumeric',
  'required' => true,
  'message' => 'enter some content to post',
  )
 )
  );
 }
 ?>
Thank you,
pgredeye



--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Non-existent-data-source-tp4279029p4279029.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Non-existent data source

2011-04-03 Thread pgredeye
Hai Guys,
  I have a problem arised while creating an blog app ,its showing
that there is no data source .so, please
  can you help me
   this is my database.php piece of code to specify the blog data
base.
   var $blog = array(
 'driver' => 'mysql',
 'persistent' => false,
 'host' => 'localhost',
 'login' => 'root',
 'password' => 'scourlet',
 'database' => 'blog',
 'prefix' => '',
 );

   and this is my blog app's model code

  array(
 'alphanumeric' => array(
 'rule' => 'alphanumeric',
 'required' => true,
 'message' => 'enter a title to post',
 )
   ),
   'content' => array(
   'alphanumeric' => array(
   'rule' => 'alphanumeric',
   'required' => true,
   'message' => 'enter some content to post',
   )
  )
   );
  }
  ?>
Thank you,
pgredeye.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Help in Pagination

2011-04-03 Thread cricket
On Sun, Apr 3, 2011 at 9:11 AM, blogSystem  wrote:
> does any one have an idea about the source of the problems ?

Put this in AppController:

function redirect($url, $status = null, $exit = true)
{
die(debug($this->params));
}


> On 2 avr, 21:36, blogSystem  wrote:
>> i forgot:
>> in my routes.php
>>         Router::connect(
>>         '/blog/*',
>>         array('controller' => 'blogs', 'action' => 'pseudo')
>>         );
>>
>> in the controllers i have:
>> var $paginate = array(
>>             'Article' => array(
>>                 'limit' => 5,
>>                 'order' => array(
>>                 'Article.id' => 'desc'
>>                 )
>>                 ));
>> in the views i have:
>>
>>                                 $paginator->options(array('url' => 
>> $this->passedArgs));
>>                 echo $paginator->prev(' Précedent - ', null, null,
>> array('class' => 'disabled'));
>>                 echo $paginator->numbers();
>>                 echo $paginator->next(' - Suivant ', null, null,
>> array('class' => 'disabled'));
>>
>> On 2 avr, 21:12, blogSystem  wrote:
>>
>> > you can see this linkshttp://kyle77680.awsblog.net/?cat=165
>> > in bottom i have the pagination of the posts list (articles in
>> > frensh )
>> > if you try to get the second page for exemple you will be return to
>> > the default page of the blog
>>
>> > On 2 avr, 19:51, "Krissy Masters"  wrote:
>>
>> > > What does your code look like?
>> > > Every controller or just 1 page set? Need to provide some details / code 
>> > > to
>> > > the problem not "just its not working" we can't see what your doing so 
>> > > your
>> > > going to have to help us a bit there :)
>>
>> > > -Original Message-
>> > > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On 
>> > > Behalf
>>
>> > > Of Ryan Schmidt
>> > > Sent: Saturday, April 02, 2011 4:59 PM
>> > > To: cake-php@googlegroups.com
>> > > Subject: Re: Help in Pagination
>>
>> > > On Apr 2, 2011, at 14:25, Krissy Masters wrote:
>>
>> > > > Could be the problem "i'm using cackephp 0.2.9".
>>
>> > > I'm going to guess that's a typo for cakephp 1.2.9.
>>
>> > > --
>> > > Our newest site for the community: CakePHP Video 
>> > > Tutorialshttp://tv.cakephp.org
>> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
>> > > others with their CakePHP related questions.
>>
>> > > To unsubscribe from this group, send email to
>> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
>> > > athttp://groups.google.com/group/cake-php
>
> --
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: You favorite IDE/ Dev Setup?

2011-04-03 Thread DerekGardiner
I use Netbeans, it's great for the normal PHP stuff but I haven't
found a nice cakePHP plugin. Do you know of one?

On Mar 31, 6:49 pm, Chris  wrote:
> How often do you use NetBeans over geany? I haven't really figured out
> how I want to use Netbeans
>
> On Mar 31, 7:10 am, LipeDjow  wrote:
>
>
>
>
>
>
>
> > Ubuntu
> > NetBeans / Geany
> > SVN / Git
> > Apache
> > MySql

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


RE: Validate HABTM Multiple

2011-04-03 Thread Krissy Masters
Nothing. I simply want to first make sure no more than 5 are selected so I
select 6 and submit.

Debug data see 6 
Category Category array(
0 => 3
1 => 5
so on.)

But no validation errors for Category. Just the Post...missing title,
missing comment what not

$this->Post->set($this->data);

//Debug($this->Post->saveAll( $this->data, array('validate' => 'only')));
$this->Post->saveAll( $this->data, array('validate' => 'only') )


If I manually set data to the Category I get the messages saying too many
selected so the validation in Category is set correct.

I was just hoping saveAll would take care of this for me.

I can wite validation anywhere set it to any model but figured why should I
have to since all should be all :) Not some.

K
-Original Message-
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of euromark
Sent: Sunday, April 03, 2011 9:07 AM
To: CakePHP
Subject: Re: Validate HABTM Multiple

"but I never get any validation errors for the HABTM model "

what does $this->Post->saveAll() return?
boolean or array?

pr() it pretty quick - I had similar issues I think


On 1 Apr., 05:37, "Krissy Masters"  wrote:
> I can, but why should I have to validate the Category in the Post model?
>
> I was just under the assumption cake would handle that with saveAll since
> there is nothing mentioning that it can't validate HABTM models. The "ALL"
> in saveAll makes it sounds like it would save all related data.
>
> $this->Post->saveAll( $this->data, array('validate' => 'only') ) to me
> sounds like " if all of this data were to validate it could all be saved".
> Post is related to Category HABTM relation and the book says save related
> data in 1 call (db supports that is) if it validates.
>
> Not being an ass but that sounds like saveSome() if your validating it
> first.no?
>
>
>
>
>
>
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On
Behalf
>
> Of Jeremy Burns | Class Outfit
> Sent: Friday, April 01, 2011 12:53 AM
> To: cake-php@googlegroups.com
> Subject: Re: Validate HABTM Multiple
>
> Couldn't you write a custom validation rule in the Post model that
examines
> the count of the Category key of the data array passed in?
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 1 Apr 2011, at 01:18, Krissy Masters wrote:
>
> > How can you validate the number of "multiple" selected?
>
> > I have a Post which hasMany, and HABTM relations so saving with :
>
> > if ( $this->Post->saveAll( $this->data, array('validate' => 'only') ) )
> > {//only testing to get errors
>
> > but I never get any validation errors for the HABTM model
>
> > Category:
> > public $validate = array(
>
> >            'Category' => array(
> >                    'multiple' => array(
> >                            'required' => false,
> >                            'allowEmpty' => true,
> >                            'rule' => array(
> >                                    'multiple', array('max' => 3),
> >                            'message' => 'Please select one, two or
> > three options';
>
> > Post HABTM Category
>
> > Ideas?
>
> > Thanks
>
> > K
>
> > --
> > Our newest site for the community: CakePHP Video
Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> athttp://groups.google.com/group/cake-php
>
> --
> Our newest site for the community: CakePHP Video
Tutorialshttp://tv.cakephp.org
> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> others with their CakePHP related questions.
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.


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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: You favorite IDE/ Dev Setup?

2011-04-03 Thread Chris
@huoxito I've been wanting to get in to using VIM but I can't get the
plugins I want to work >.< so I haven't been able to really get in to
it as much as I might have wanted to.

On Apr 2, 10:24 pm, huoxito  wrote:
> Ubuntu
> Vim (still learning but already useful for me)
> Gedit
> Git
> Shell
> Apache
> Mysql

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Digest for cake-php@googlegroups.com - 4 Messages in 3 Topics

2011-04-03 Thread Ed Propsner
@ShadowCross:

That's it! I don't rely on the book as much as I used to (there is a lesson
to be learned here) ... I could have saved myself a lot of tinkering. Thanks
so much for the help and getting me pointed in the right direction.

- ED

On Sat, Apr 2, 2011 at 11:39 PM,  wrote:

>   Today's Topic Summary
>
> Group: http://groups.google.com/group/cake-php/topics
>
>- You favorite IDE/ Dev Setup? <#12f19719e9b0773c_group_thread_0> [1
>Update]
>- Euromark function guaranteeFields($requiredFields, $data = null) 
> {<#12f19719e9b0773c_group_thread_1>[2 Updates]
>- Paginate pre-ordered list <#12f19719e9b0773c_group_thread_2> [1
>Update]
>
>   Topic: You favorite IDE/ Dev 
> Setup?
>
>huoxito  Apr 02 07:24PM -0700 
> ^<#12f19719e9b0773c_digest_top>
>
>Ubuntu
>Vim (still learning but already useful for me)
>Gedit
>Git
>Shell
>Apache
>Mysql
>
>
>
>   Topic: Euromark function guaranteeFields($requiredFields, $data = null)
> { 
>
>euromark  Apr 02 06:13PM -0700 
> ^<#12f19719e9b0773c_digest_top>
>
>it is not possible
>
>the controller has no direct link to the form helper
>especially not after a post (and therefore BEFORE the form is rendered
>again).
>controller + model are finished before the view even starts to render.
>
>you would need to embed the keys as a hidden field in the form itself
>(+ hash etc to disallow any modifications).
>but then you could just as well use the security component and you
>would be already done.
>
>so i dont see a point in that.
>i agree that it can be a pain in the but.
>in some rare occasions you could use blacklisting (especially if you
>only want to forbid 1 field of 50 allowed fields).
>in other occasions you would store those field names in a (long?)
>array in the model and simply use it in the controller
>$this->Model->allowedFieldsForEdit
>etc
>
>either way linking the form helper / form inputs to the model logic
>can probably do more harm than good.
>i would think about which fields are allowed and manually pass them to
>the set/save methods. using the model arrays to store the fields will
>also ensure that after an update of the schema you got all field names
>in a single place. less likely you will forget to add/delete fields.
>
>
>
>
>
>
>"Krissy Masters"  Apr 02 10:56PM -0230 
> ^<#12f19719e9b0773c_digest_top>
>
>Right on. Was only curious since Security create a hash based on the
>fields
>I figured there must be some way to do the same thing and use it for
>whatever reason.
>
>Thanks for the info all the same.
>
>K
>
>-Original Message-
>From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On
>Behalf
>Of euromark
>Sent: Saturday, April 02, 2011 10:43 PM
>To: CakePHP
>Subject: Re: Euromark function guaranteeFields($requiredFields, $data =
>null) {
>
>it is not possible
>
>the controller has no direct link to the form helper
>especially not after a post (and therefore BEFORE the form is rendered
>again).
>controller + model are finished before the view even starts to render.
>
>you would need to embed the keys as a hidden field in the form itself
>(+ hash etc to disallow any modifications).
>but then you could just as well use the security component and you
>would be already done.
>
>so i dont see a point in that.
>i agree that it can be a pain in the but.
>in some rare occasions you could use blacklisting (especially if you
>only want to forbid 1 field of 50 allowed fields).
>in other occasions you would store those field names in a (long?)
>array in the model and simply use it in the controller
>$this->Model->allowedFieldsForEdit
>etc
>
>either way linking the form helper / form inputs to the model logic
>can probably do more harm than good.
>i would think about which fields are allowed and manually pass them to
>the set/save methods. using the model arrays to store the fields will
>also ensure that after an update of the schema you got all field names
>in a single place. less likely you will forget to add/delete fields.
>
>
>> grab all the fields your form has before rendering it
>
>> $form_fields = ??? somefunction to grab all your fields
>
>> Then use an array  / !in_array / arrys_keys to keep  / exclude ones
>that
>are
>
>> K
>
>> -Original Message-
>> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On
>Behalf
>>  wrote:
>> > Reading the bit about making fields required in a form so a user
>can not
>> > firebug them out and thought is there a way to manually grab the
>names
>of
>> > would be trauma. (but writing the names and updating the m

Re: Help in Pagination

2011-04-03 Thread blogSystem
does any one have an idea about the source of the problems ?

On 2 avr, 21:36, blogSystem  wrote:
> i forgot:
> in my routes.php
>         Router::connect(
>         '/blog/*',
>         array('controller' => 'blogs', 'action' => 'pseudo')
>         );
>
> in the controllers i have:
> var $paginate = array(
>             'Article' => array(
>                 'limit' => 5,
>                 'order' => array(
>                 'Article.id' => 'desc'
>                 )
>                 ));
> in the views i have:
>
>                                 $paginator->options(array('url' => 
> $this->passedArgs));
>                 echo $paginator->prev(' Précedent - ', null, null,
> array('class' => 'disabled'));
>                 echo $paginator->numbers();
>                 echo $paginator->next(' - Suivant ', null, null,
> array('class' => 'disabled'));
>
> On 2 avr, 21:12, blogSystem  wrote:
>
> > you can see this linkshttp://kyle77680.awsblog.net/?cat=165
> > in bottom i have the pagination of the posts list (articles in
> > frensh )
> > if you try to get the second page for exemple you will be return to
> > the default page of the blog
>
> > On 2 avr, 19:51, "Krissy Masters"  wrote:
>
> > > What does your code look like?
> > > Every controller or just 1 page set? Need to provide some details / code 
> > > to
> > > the problem not "just its not working" we can't see what your doing so 
> > > your
> > > going to have to help us a bit there :)
>
> > > -Original Message-
> > > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On 
> > > Behalf
>
> > > Of Ryan Schmidt
> > > Sent: Saturday, April 02, 2011 4:59 PM
> > > To: cake-php@googlegroups.com
> > > Subject: Re: Help in Pagination
>
> > > On Apr 2, 2011, at 14:25, Krissy Masters wrote:
>
> > > > Could be the problem "i'm using cackephp 0.2.9".
>
> > > I'm going to guess that's a typo for cakephp 1.2.9.
>
> > > --
> > > Our newest site for the community: CakePHP Video 
> > > Tutorialshttp://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: 1 form 2 models - how to validate without savingAll?

2011-04-03 Thread func0der
yeah...
a quick overview over the cake "model.php" in "cake/libs/model/
model.php" shows me, that

---
if ($this->ModelName->saveAll($this->data, array('validate' =>
'only'))) {..
---

Does exactly the same as the code provided in the blog post.
It only validates one model after the other. I may be mistaken,
because i don't want to read each and every line of the code now, but
i'm pretty sure it is the same.

Also if you really want to do this:

if ($this->User->validates() && $this->Profile->validates()) {

it is the right method.

If you want to do that:

if ($this->User->validates()){...
//saving the user
//manipulating some data and stuff for the profile
if($this->Profile->validates()){...

The blog method is the right one.

Good Luck with your project ;)

On Apr 2, 6:01 pm, netusco  wrote:
> Hi func0der,
>
> don't take it bad but I think you didn't read well my post, neither the
> title...
>
> I ask how to do it without savingAll, as I wanted to validate data in
> diferent steps and save at the end.
>
> Then as euromark pointed out in his blog the if statements check the first
> element and if it doesn't pass don't check the second so your solution
> behaves exactly the way I was doing it.
>
> Yet the solution found by euromark is smart and works perfectly.
>
> Thanks though to try to help even further, in this post is not needed but
> that's a great attitude.
>
> keep it up!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Validate HABTM Multiple

2011-04-03 Thread euromark
"but I never get any validation errors for the HABTM model "

what does $this->Post->saveAll() return?
boolean or array?

pr() it pretty quick - I had similar issues I think


On 1 Apr., 05:37, "Krissy Masters"  wrote:
> I can, but why should I have to validate the Category in the Post model?
>
> I was just under the assumption cake would handle that with saveAll since
> there is nothing mentioning that it can't validate HABTM models. The "ALL"
> in saveAll makes it sounds like it would save all related data.
>
> $this->Post->saveAll( $this->data, array('validate' => 'only') ) to me
> sounds like " if all of this data were to validate it could all be saved".
> Post is related to Category HABTM relation and the book says save related
> data in 1 call (db supports that is) if it validates.
>
> Not being an ass but that sounds like saveSome() if your validating it
> first.no?
>
>
>
>
>
>
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
>
> Of Jeremy Burns | Class Outfit
> Sent: Friday, April 01, 2011 12:53 AM
> To: cake-php@googlegroups.com
> Subject: Re: Validate HABTM Multiple
>
> Couldn't you write a custom validation rule in the Post model that examines
> the count of the Category key of the data array passed in?
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 1 Apr 2011, at 01:18, Krissy Masters wrote:
>
> > How can you validate the number of "multiple" selected?
>
> > I have a Post which hasMany, and HABTM relations so saving with :
>
> > if ( $this->Post->saveAll( $this->data, array('validate' => 'only') ) )
> > {//only testing to get errors
>
> > but I never get any validation errors for the HABTM model
>
> > Category:
> > public $validate = array(
>
> >            'Category' => array(
> >                    'multiple' => array(
> >                            'required' => false,
> >                            'allowEmpty' => true,
> >                            'rule' => array(
> >                                    'multiple', array('max' => 3),
> >                            'message' => 'Please select one, two or
> > three options';
>
> > Post HABTM Category
>
> > Ideas?
>
> > Thanks
>
> > K
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> athttp://groups.google.com/group/cake-php
>
> --
> Our newest site for the community: CakePHP Video 
> Tutorialshttp://tv.cakephp.org
> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> others with their CakePHP related questions.
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: You favorite IDE/ Dev Setup?

2011-04-03 Thread Fons Vandamme
I recommend 'Coda' to all Mac OS X users out there! Awesome editor and
Coda 2.0 (which is still in development) will make it all even
greater!

All you need is MAMP (Mac Os X, Apache, Mysql, PHP) and you are all
set!

As a browser Firefox 4 with the plugin "Firebug" .

For collaboration I suggest using GIT.

Happy baking!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Euromark function guaranteeFields($requiredFields, $data = null) {

2011-04-03 Thread euromark
i disagree with Milos in some points
but yes, the crucial point is that the main focus should be the server
side as far as security is concerned

but besides that he proposes hacks that will not only make the code
less readable, it also opens the door for many
bugs and errors as well as bloating the model unnecessarily´.

"if you didn't input required value
(if you even specified what types of character can be used), there is
no way you'll pass submitting"
actually, you will. what if the validation is only checking if the ID
is valid. you still could use the ID of any other user on the site.
and the security component will not be able to do anything against it.

thats why all fields, that are not intended to be changed should be
excluded from being passed on to the model.
this way you can ensure that no harm can be done to them.
its easy, its short (compared to other solutions like milos), its
clean.


On 3 Apr., 10:57, Miloš Vučinić  wrote:
> I just read smth. So one more comment :) Hope I am not borring you. If
> you are worried about primary key injection etc, you can always make
> rights to do stuff. You can have several functions for doing stuff.
> You can grab data in controller and see if somebody tried to enter a
> parameter which is not allowed for this kind of users. Like role_id
> etc, and if they are not null, you blok the save functions.
>
> Eg.
> I have user controller, and I have 2 edit functions and by that 2
> different forms. First one is for admins, and second one for users. In
> users function I check the data before calling model ($this->save($data)) and 
> I see what is in that data. If I find smth I don't
>
> want there I would not call the save data function...
>
> I can't remember if I actually done that, but I think it is quite
> doable, because you have access to data var before calling the model..
>
> all the best :)
>
> On Apr 3, 10:51 am, Miloš Vučinić  wrote:
>
>
>
>
>
>
>
> > And if you hate programming so many fields, just bake the add form for
> > the database table and change it the way you want.. baking takes like
> > a minute to finish .
> > :)
>
> > I am no baking everything I can :)
>
> > all the best
> > Milos
>
> > On Apr 2, 9:26 pm, "Krissy Masters" 
> > wrote:
>
> > > Right on. Was only curious since Security create a hash based on the 
> > > fields
> > > I figured there must be some way to do the same thing and use it for
> > > whatever reason.
>
> > > Thanks for the info all the same.
>
> > > K
>
> > > -Original Message-
> > > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On 
> > > Behalf
>
> > > Of euromark
> > > Sent: Saturday, April 02, 2011 10:43 PM
> > > To: CakePHP
> > > Subject: Re: Euromark function guaranteeFields($requiredFields, $data =
> > > null) {
>
> > > it is not possible
>
> > > the controller has no direct link to the form helper
> > > especially not after a post (and therefore BEFORE the form is rendered
> > > again).
> > > controller + model are finished before the view even starts to render.
>
> > > you would need to embed the keys as a hidden field in the form itself
> > > (+ hash etc to disallow any modifications).
> > > but then you could just as well use the security component and you
> > > would be already done.
>
> > > so i dont see a point in that.
> > > i agree that it can be a pain in the but.
> > > in some rare occasions you could use blacklisting (especially if you
> > > only want to forbid 1 field of 50 allowed fields).
> > > in other occasions you would store those field names in a (long?)
> > > array in the model and simply use it in the controller
> > > $this->Model->allowedFieldsForEdit
> > > etc
>
> > > either way linking the form helper / form inputs to the model logic
> > > can probably do more harm than good.
> > > i would think about which fields are allowed and manually pass them to
> > > the set/save methods. using the model arrays to store the fields will
> > > also ensure that after an update of the schema you got all field names
> > > in a single place. less likely you will forget to add/delete fields.
>
> > > On 3 Apr., 00:51, "Krissy Masters"  wrote:
> > > > Sorry I think you missed my point.
> > > > Example:
> > > > I have a form with 50 fields. I would have to manually type out all 50 
> > > > if
> > > > they have to be in the form = pain
> > > > Im interested in grabbing all the field names the form has before its
> > > > rendered. Then use that in the function before saving
>
> > > > beforeRender() / beforeFilter(){
> > > > grab all the fields your form has before rendering it
>
> > > > $form_fields = ??? somefunction to grab all your fields
>
> > > > Then use an array  / !in_array / arrys_keys to keep  / exclude ones that
> > > are
> > > > required to be there
>
> > > > $required_fields  = array_diff( array('optional', 'fields', 'here'
> > > > ),$form_fields); //something like that so you type out a few not all 
> > > > type
> > > > thing
>
> > > > }
>
> > > > That's what I am won

Re: Euromark function guaranteeFields($requiredFields, $data = null) {

2011-04-03 Thread Miloš Vučinić
I just read smth. So one more comment :) Hope I am not borring you. If
you are worried about primary key injection etc, you can always make
rights to do stuff. You can have several functions for doing stuff.
You can grab data in controller and see if somebody tried to enter a
parameter which is not allowed for this kind of users. Like role_id
etc, and if they are not null, you blok the save functions.

Eg.
I have user controller, and I have 2 edit functions and by that 2
different forms. First one is for admins, and second one for users. In
users function I check the data before calling model ($this-
>save($data)) and I see what is in that data. If I find smth I don't
want there I would not call the save data function...

I can't remember if I actually done that, but I think it is quite
doable, because you have access to data var before calling the model..

all the best :)




On Apr 3, 10:51 am, Miloš Vučinić  wrote:
> And if you hate programming so many fields, just bake the add form for
> the database table and change it the way you want.. baking takes like
> a minute to finish .
> :)
>
> I am no baking everything I can :)
>
> all the best
> Milos
>
> On Apr 2, 9:26 pm, "Krissy Masters" 
> wrote:
>
> > Right on. Was only curious since Security create a hash based on the fields
> > I figured there must be some way to do the same thing and use it for
> > whatever reason.
>
> > Thanks for the info all the same.
>
> > K
>
> > -Original Message-
> > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
>
> > Of euromark
> > Sent: Saturday, April 02, 2011 10:43 PM
> > To: CakePHP
> > Subject: Re: Euromark function guaranteeFields($requiredFields, $data =
> > null) {
>
> > it is not possible
>
> > the controller has no direct link to the form helper
> > especially not after a post (and therefore BEFORE the form is rendered
> > again).
> > controller + model are finished before the view even starts to render.
>
> > you would need to embed the keys as a hidden field in the form itself
> > (+ hash etc to disallow any modifications).
> > but then you could just as well use the security component and you
> > would be already done.
>
> > so i dont see a point in that.
> > i agree that it can be a pain in the but.
> > in some rare occasions you could use blacklisting (especially if you
> > only want to forbid 1 field of 50 allowed fields).
> > in other occasions you would store those field names in a (long?)
> > array in the model and simply use it in the controller
> > $this->Model->allowedFieldsForEdit
> > etc
>
> > either way linking the form helper / form inputs to the model logic
> > can probably do more harm than good.
> > i would think about which fields are allowed and manually pass them to
> > the set/save methods. using the model arrays to store the fields will
> > also ensure that after an update of the schema you got all field names
> > in a single place. less likely you will forget to add/delete fields.
>
> > On 3 Apr., 00:51, "Krissy Masters"  wrote:
> > > Sorry I think you missed my point.
> > > Example:
> > > I have a form with 50 fields. I would have to manually type out all 50 if
> > > they have to be in the form = pain
> > > Im interested in grabbing all the field names the form has before its
> > > rendered. Then use that in the function before saving
>
> > > beforeRender() / beforeFilter(){
> > > grab all the fields your form has before rendering it
>
> > > $form_fields = ??? somefunction to grab all your fields
>
> > > Then use an array  / !in_array / arrys_keys to keep  / exclude ones that
> > are
> > > required to be there
>
> > > $required_fields  = array_diff( array('optional', 'fields', 'here'
> > > ),$form_fields); //something like that so you type out a few not all type
> > > thing
>
> > > }
>
> > > That's what I am wondering, if anyone knows how you could grab a list of
> > > fields in the form.
>
> > > Thanks,
>
> > > K
>
> > > -Original Message-
> > > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On
> > Behalf
>
> > > Of cricket
> > > Sent: Saturday, April 02, 2011 7:45 PM
> > > To: cake-php@googlegroups.com
> > > Subject: Re: Euromark function guaranteeFields($requiredFields, $data =
> > > null) {
>
> > > On Sat, Apr 2, 2011 at 3:10 PM, Krissy Masters
> > >  wrote:
> > > > Reading the bit about making fields required in a form so a user can not
> > > > firebug them out and thought is there a way to manually grab the names
> > of
> > > > the fields in a form being rendered in the controller?
> > > > Form might have 50 fields and you need them all, writing out all of that
> > > > would be trauma. (but writing the names and updating the model in the
> > > > future, spellingso on)
>
> > > > Security component does something with all the names to makes it hash
> > no?
>
> > > > Anyone have any ideas? Here is a link to his excellent idea incase
> > anyone
> > > > wants to read up on it.
>
> > > >http://www.dereuromark.de/2010/0

Re: Euromark function guaranteeFields($requiredFields, $data = null) {

2011-04-03 Thread Miloš Vučinić
And if you hate programming so many fields, just bake the add form for
the database table and change it the way you want.. baking takes like
a minute to finish .
:)

I am no baking everything I can :)

all the best
Milos

On Apr 2, 9:26 pm, "Krissy Masters" 
wrote:
> Right on. Was only curious since Security create a hash based on the fields
> I figured there must be some way to do the same thing and use it for
> whatever reason.
>
> Thanks for the info all the same.
>
> K
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
>
> Of euromark
> Sent: Saturday, April 02, 2011 10:43 PM
> To: CakePHP
> Subject: Re: Euromark function guaranteeFields($requiredFields, $data =
> null) {
>
> it is not possible
>
> the controller has no direct link to the form helper
> especially not after a post (and therefore BEFORE the form is rendered
> again).
> controller + model are finished before the view even starts to render.
>
> you would need to embed the keys as a hidden field in the form itself
> (+ hash etc to disallow any modifications).
> but then you could just as well use the security component and you
> would be already done.
>
> so i dont see a point in that.
> i agree that it can be a pain in the but.
> in some rare occasions you could use blacklisting (especially if you
> only want to forbid 1 field of 50 allowed fields).
> in other occasions you would store those field names in a (long?)
> array in the model and simply use it in the controller
> $this->Model->allowedFieldsForEdit
> etc
>
> either way linking the form helper / form inputs to the model logic
> can probably do more harm than good.
> i would think about which fields are allowed and manually pass them to
> the set/save methods. using the model arrays to store the fields will
> also ensure that after an update of the schema you got all field names
> in a single place. less likely you will forget to add/delete fields.
>
> On 3 Apr., 00:51, "Krissy Masters"  wrote:
> > Sorry I think you missed my point.
> > Example:
> > I have a form with 50 fields. I would have to manually type out all 50 if
> > they have to be in the form = pain
> > Im interested in grabbing all the field names the form has before its
> > rendered. Then use that in the function before saving
>
> > beforeRender() / beforeFilter(){
> > grab all the fields your form has before rendering it
>
> > $form_fields = ??? somefunction to grab all your fields
>
> > Then use an array  / !in_array / arrys_keys to keep  / exclude ones that
> are
> > required to be there
>
> > $required_fields  = array_diff( array('optional', 'fields', 'here'
> > ),$form_fields); //something like that so you type out a few not all type
> > thing
>
> > }
>
> > That's what I am wondering, if anyone knows how you could grab a list of
> > fields in the form.
>
> > Thanks,
>
> > K
>
> > -Original Message-
> > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On
> Behalf
>
> > Of cricket
> > Sent: Saturday, April 02, 2011 7:45 PM
> > To: cake-php@googlegroups.com
> > Subject: Re: Euromark function guaranteeFields($requiredFields, $data =
> > null) {
>
> > On Sat, Apr 2, 2011 at 3:10 PM, Krissy Masters
> >  wrote:
> > > Reading the bit about making fields required in a form so a user can not
> > > firebug them out and thought is there a way to manually grab the names
> of
> > > the fields in a form being rendered in the controller?
> > > Form might have 50 fields and you need them all, writing out all of that
> > > would be trauma. (but writing the names and updating the model in the
> > > future, spellingso on)
>
> > > Security component does something with all the names to makes it hash
> no?
>
> > > Anyone have any ideas? Here is a link to his excellent idea incase
> anyone
> > > wants to read up on it.
>
> > >http://www.dereuromark.de/2010/09/21/saving-model-data-and-security/
>
> > > secion => Protection against missing fields
>
> > I think it would be best to use a class var in the model.
>
> > $this->Model->set(
> >         $this->data,
> >         null,
> >         $this->Model->required_fields
> > );
>
> > You could even have separate field lists for different actions:
>
> > $this->Model->set(
> >         $this->data,
> >         null,
> >         $this->Model->required_fields['edit']
> > );
>
> > --
> > Our newest site for the community: CakePHP Video
> Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> athttp://groups.google.com/group/cake-php
>
> --
> Our newest site for the community: CakePHP Video 
> Tutorialshttp://tv.cakephp.org
> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> others with their CakePHP related questions.
>
> To unsubscribe from this group, send emai

Re: Euromark function guaranteeFields($requiredFields, $data = null) {

2011-04-03 Thread Miloš Vučinić
In risk of looking a little bit stupid, I'll ask this. If you need a
field to be required, you can set that in model, so why bother with
other stuff ?  doI it that way. You can either use predefined rules of
cake or make your own using regular expressions.. You can firebug all
you want but when you click save, if you didn't input required value
(if you even specified what types of character can be used), there is
no way you'll pass submitting, and user will not even be redirected
from the page.. And if you really need to make something very tricky ,
you can always use ajax . This component of cake is beautiful. It even
flashes messages next to the fields if there is an error with them..
Also one more comment. I do not see much point of protecting your form
from being firebuged... Because, if somebody tries to hack a form on
the client side (smth that is already loaded in his browser) you can't
really stop them. When they receive a form it is kinda their now and
they can change it or do whatever they want with it, because you have
no control over data on his computer. But, in order to make sure no
hacks are gonna happen, just made the same security on the server side
of app and there you have it. The security you put on client side is
for clients. So that it would make their lives easier, when filling
forms etc. But for those evil clients who wish to ruin your work, you
put security on server side and you have done all you needed to do.

Hope i didn't miss the subject :)

All the best,
Milos


On Apr 2, 9:26 pm, "Krissy Masters" 
wrote:
> Right on. Was only curious since Security create a hash based on the fields
> I figured there must be some way to do the same thing and use it for
> whatever reason.
>
> Thanks for the info all the same.
>
> K
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
>
> Of euromark
> Sent: Saturday, April 02, 2011 10:43 PM
> To: CakePHP
> Subject: Re: Euromark function guaranteeFields($requiredFields, $data =
> null) {
>
> it is not possible
>
> the controller has no direct link to the form helper
> especially not after a post (and therefore BEFORE the form is rendered
> again).
> controller + model are finished before the view even starts to render.
>
> you would need to embed the keys as a hidden field in the form itself
> (+ hash etc to disallow any modifications).
> but then you could just as well use the security component and you
> would be already done.
>
> so i dont see a point in that.
> i agree that it can be a pain in the but.
> in some rare occasions you could use blacklisting (especially if you
> only want to forbid 1 field of 50 allowed fields).
> in other occasions you would store those field names in a (long?)
> array in the model and simply use it in the controller
> $this->Model->allowedFieldsForEdit
> etc
>
> either way linking the form helper / form inputs to the model logic
> can probably do more harm than good.
> i would think about which fields are allowed and manually pass them to
> the set/save methods. using the model arrays to store the fields will
> also ensure that after an update of the schema you got all field names
> in a single place. less likely you will forget to add/delete fields.
>
> On 3 Apr., 00:51, "Krissy Masters"  wrote:
> > Sorry I think you missed my point.
> > Example:
> > I have a form with 50 fields. I would have to manually type out all 50 if
> > they have to be in the form = pain
> > Im interested in grabbing all the field names the form has before its
> > rendered. Then use that in the function before saving
>
> > beforeRender() / beforeFilter(){
> > grab all the fields your form has before rendering it
>
> > $form_fields = ??? somefunction to grab all your fields
>
> > Then use an array  / !in_array / arrys_keys to keep  / exclude ones that
> are
> > required to be there
>
> > $required_fields  = array_diff( array('optional', 'fields', 'here'
> > ),$form_fields); //something like that so you type out a few not all type
> > thing
>
> > }
>
> > That's what I am wondering, if anyone knows how you could grab a list of
> > fields in the form.
>
> > Thanks,
>
> > K
>
> > -Original Message-
> > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On
> Behalf
>
> > Of cricket
> > Sent: Saturday, April 02, 2011 7:45 PM
> > To: cake-php@googlegroups.com
> > Subject: Re: Euromark function guaranteeFields($requiredFields, $data =
> > null) {
>
> > On Sat, Apr 2, 2011 at 3:10 PM, Krissy Masters
> >  wrote:
> > > Reading the bit about making fields required in a form so a user can not
> > > firebug them out and thought is there a way to manually grab the names
> of
> > > the fields in a form being rendered in the controller?
> > > Form might have 50 fields and you need them all, writing out all of that
> > > would be trauma. (but writing the names and updating the model in the
> > > future, spellingso on)
>
> > > Security component does something with all the