Problem with foreignKey

2007-07-15 Thread rennis
Hello, I am a newbie to Cake. I am developing my first app. Sorry for my badly english. I have problem with config my Model. I don't now why / 'foreignKey' = 'zdjecie_id' / not working. Zdjecie = ang. Photo Produkt = ang. Product I want keep some photos in my table /Zdjecia/. This photos

Re: Validate $html-radio how to ?

2007-07-15 Thread housebolt
You'll want to put this tag before your $html-radio tag: ?php echo $html-hidden('Bloodbank/gender', array('value'='')); ? labelGender:/label ?php echo $html-radio('Bloodbank/gender',array('Male','Female')) ? ?php echo $html-tagErrorMsg('Bloodbank/gender', 'gender is required') ? The reason for

Re: Get the Session Id being generated

2007-07-15 Thread housebolt
I believe you can just use the php function session_id() http://www.php.net/session_id I haven't tested it in cake-created sessions mode, but I believe this will work with that as well. On Jul 14, 8:31 pm, r557 [EMAIL PROTECTED] wrote: after debugging the session object, it outputted the

Re: Pages proper implementation

2007-07-15 Thread [EMAIL PROTECTED]
I think this should work: pre class Page extends AppModel { var $hasMany = array( 'ChildPages'=array('className'='Page','foreignKey'='parend_id')); var $belongsTo = array('ParentPage'=array('className'='Page', 'foreignKey'='parent_id')); } /pre Don't forget to use recursive option,

Re: How to update a form field using Ajax

2007-07-15 Thread nini
I have the same problem, please help! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to

Re: Associating a new model

2007-07-15 Thread [EMAIL PROTECTED]
In the 'Item' model add this: var $hasMany = array('List'); OPTIONAL: In the 'List' model add this: var $belongsTo = array('Item'); In your ITEM table, make sure each item has a unique id, i.e. give each row a key field called id and make sure that auto_increment is set. In your LIST table,

Model Help

2007-07-15 Thread jmartyniak
I have a model called Item (model, views, controller) in my add method reached by localhost/item/add, I would like to give the user the ability to create a new ItemList db record from the Item add form. I currently am using the following form code (add.thtml): labelList:/label ?php echo

Re: Model Help

2007-07-15 Thread jmartyniak
Right after I posted this I re-read the Model section, and found the way to solve the problem. $this-Item-ItemList-save($this-data); $itemListId = $this-Item-ItemList-getLastInsertId(); $this-data['Item']['item_list_id'] = $itemListId; This both

tags.ini.php

2007-07-15 Thread Feris Thia
I look at the helper section in the manual and find that there is a file called tags.ini.php. I'm using version 1.1.16.5421 and find none of that file. Is it deprecated ? What is the replacement for html template then ? Regards, Feris --~--~-~--~~~---~--~~ You

Re: Problem with foreignKey

2007-07-15 Thread [EMAIL PROTECTED]
You need to change hasOne association in Produkt to belongsTo one. class Produkt extends AppModel { var $name = 'Produkt'; var $belongsTo = array('Zdjecia' = array('className' = 'Zdjecie', 'foreignKey' = 'zd_id' )) Don't forget to set

Re: Problem with foreignKey

2007-07-15 Thread [EMAIL PROTECTED]
Opps. $belongsTo = array('Zdjecia' = array('className' = 'Zdjecie', 'foreignKey' = 'zdjecie_id' of course On 15, 13:15, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: You need to change hasOne association in Produkt to belongsTo one. class Produkt extends AppModel {

database design

2007-07-15 Thread rtanz
hi i am currently designing, as i can see tables should have a primary key called id, in my case i have a table of university modules uniquely identified by their code number, could i make code the primary key, or should i still use id and put the code number into the id field?

Re: CakePHP Conventions

2007-07-15 Thread Tijs Teulings
Good points, opening a ticket on trac will probably be most effective n resolving the issues: https://trac.cakephp.org/report Best, Tijs On 14-jul-2007, at 22:20, JTTACJ1 wrote: I have found thee sources of CakePHP conventions: The Bakery:

Create model (Group) out of another model (User)?

2007-07-15 Thread R. Rajesh Jeba Anbiah
I have one user table like: users (id, username, etc) sample: 1, MA-foo 2, MA-bar 3, AA-foo The username represents the group in which they're in (in this case, MA and AA). Saving the group name in another table might not be the right way as the system isn't represented so. So, I have tried to

Using haml in views

2007-07-15 Thread ianh
Hi all, I just came across the Haml parser snippets on CakeForge from Adeel Khan: http://cakeforge.org/snippet/detail.php?type=snippetid=196 http://cakeforge.org/snippet/detail.php?type=snippetid=197 I'd love to try these out as haml looks like such a good idea (not trying to ignite any sort

Security Best Practice

2007-07-15 Thread Feris Thia
Hi Everyone, Any article recommendation that refer to php/cakephp security best practice ? Regards, Feris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to

Re: FormHelper methods in 1.2.0.5427

2007-07-15 Thread Siegfried Hirsch
$form-input and $form-select will always insert the $model of the form. But you always can use this field for your own use, it does not have to belong to the $model. 2007/7/15, [EMAIL PROTECTED] [EMAIL PROTECTED]: How can I create a select list with name 'justaname', not 'data[Model]

Image Submit Buttons with AJAX Helper

2007-07-15 Thread Casper F.
Hello, I have just been getting more acquainted with Cake in the last couple of weeks - it is quite a difference to being used to code everything by foot. I am looking for a workaround to be able to use Image-Submit- Buttons to initiate AJAX calls. In the API Description (1.2.x Alpha) it

Re: Using haml in views

2007-07-15 Thread ianh
Ignore that - its just appeared in the Bakery (http:// bakery.cakephp.org/articles/view/haml-markup-haiku). Still like to know what others think though, On Jul 15, 12:44 pm, ianh [EMAIL PROTECTED] wrote: Hi all, I just came across the Haml parser snippets on CakeForge from Adeel Khan:

Re: Bakery Article : How to use ACL in 1.2.x

2007-07-15 Thread Ketan Patel
On Jul 13, 3:17 pm, cakeFreak [EMAIL PROTECTED] wrote: Great Article! I was just wondering whether instead of building the aros for every single user, it is possible to build the aros (and then acos) for user groups instead. You get the usergroup from the Auth-user session data, ACL

Re: Security Best Practice

2007-07-15 Thread Feris Thia
On 7/15/07, Chris Hartjes [EMAIL PROTECTED] wrote: Filter input. Escape output. That pretty much covers 99% of PHP security problems. Luckily CakePHP handles a lot of that stuff already for you as long as you follow the conventions. -- Chris Hartjes Senior Developer Cake Development

Re: Security Best Practice

2007-07-15 Thread Mech7
Usually SQL injection.. but you need to look out to if you allow users to do anything for example post html / javascript.. Also beware of some things for example this compenent : http://bakery.cakephp.org/articles/view/autocomplete watch the bottom comments. On Jul 15, 7:02 pm, Feris Thia

Re: Security Best Practice

2007-07-15 Thread Chris Hartjes
On 7/15/07, Feris Thia [EMAIL PROTECTED] wrote: Wow, 99% is a great number. So, I can concluded there is no much security concerns for CakePHP if we follow conventions as you said. That will relieve me much. The big issues are usually to deal with input from users that contains malicious

Re: rewrite rules on nginx

2007-07-15 Thread [EMAIL PROTECTED]
Yes, I know this rule. It's for Drupal system. I tryed to write rules to nginx, but it's failure On Jul 14, 10:22 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On 7/14/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Does somebody has written mod_rewrite rules to nginx http server (much

Re: Security Best Practice

2007-07-15 Thread Feris Thia
On 7/16/07, Mech7 [EMAIL PROTECTED] wrote: Usually SQL injection.. but you need to look out to if you allow users to do anything for example post html / javascript.. Also beware of some things for example this compenent : http://bakery.cakephp.org/articles/view/autocomplete watch the

Re: rewrite rules on nginx

2007-07-15 Thread Chris Hartjes
On 7/15/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Yes, I know this rule. It's for Drupal system. I tryed to write rules to nginx, but it's failure Actually, that's exactly what i use for my WordPress installs...and CakePHP seems to use a similar type of setup: run all requests through

Re: Security Best Practice

2007-07-15 Thread Feris Thia
On 7/16/07, Chris Hartjes [EMAIL PROTECTED] wrote: The big issues are usually to deal with input from users that contains malicious code (like javascript or attempts to manipulate database queries by packing things onto the end of a URL) so you need to be aware of the proper techniques for

Too much cake magic in ff browser?

2007-07-15 Thread Grzegorz Pawlik
Hi, i found this strange behaviour. When accesing page via firefox 1.5 it acts like it has been reloaded few times (3 exactly). Prove: I've put this code in beforeFilter in /app/app_controller.php : $count = $this-Session-read('count'); $count[] = time(); $this-Session-write('count', $count);

CakePHP session lost when using Java Applet

2007-07-15 Thread [EMAIL PROTECTED]
Hey All, I thought I would post this here since it caused me so much grief. I am using a java jar file to allow uploading of multiple files using drag and drop (http://www.radinks.com/upload/). This is an awsome file uploader and I highly recommend it. Anyway, my application ran fine (I am

Re: Problem with foreignKey

2007-07-15 Thread rennis
Yes, it's better :D Thank's I turned on scaffold and checked my model. After that change It seems to work better. I checked my controller again and rebuild It. It's almost working properly (in my app is ok). I don't understand this error (bottom) when / $this-Kategoria- recursive = 3; / For

Failure to JOIN and query correctly beyond $recursive = 1 - workarounds or fixes welcome, maybe a bug?

2007-07-15 Thread Nick
Using the latest 1.2 release (and earlier ones), I'm finding that queries that could be performed with a JOIN are breaking into multiple single row queries at $recursive = 2 or more. In fact worse, there is a JOIN and some single queries that duplicate part of the JOIN for one of the tables. I

RE: Too much cake magic in ff browser?

2007-07-15 Thread Christian \Jippi\ Winther
Do you use requestAction ? :) --- Christian Jippi Winther http://docs.cakephp.nu (Unofficial CakePHP API) http://logs.cakephp.nu (Unofficial CakePHP IRC log) -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Grzegorz Pawlik Sent: 15. juli 2007

Re: Security Best Practice

2007-07-15 Thread housebolt
I highly recommend Essential PHP Security by Chris Shiflet, published by O'reilly. He talks alot about filter input/escape output and gives some good examples. You can read it at http://www.oreilly.com if you get a safari account (in my opinion something essential to all php programmers).

Re: Validate $html-radio how to ?

2007-07-15 Thread housebolt
Oops, typo, it's if(!isset($this-data['Bloodbank']['gender'])) { ... Sorry ; ) On Jul 14, 6:10 pm, housebolt [EMAIL PROTECTED] wrote: You'll want to put this tag before your $html-radio tag: ?php echo $html-hidden('Bloodbank/gender', array('value'='')); ? labelGender:/label ?php echo

Re: Security Best Practice

2007-07-15 Thread citrus
To deal with CSRF, I think we could use Cake's Security component - the requirePost function. On Jul 16, 2:52 am, keymaster [EMAIL PROTECTED] wrote: Would be nice to get a quick cheatsheet together with two columns: column A: Security Risk column B: Best Practise (using cake). I'll offer a

Re: Bakery Article : How to use ACL in 1.2.x

2007-07-15 Thread Geoff Ford
@Ketan The article is quite good, pretty easy to read if you understand the basic concepts of ACL. However, I would recommend reading about the AclBehavior as it will reduce the logic in your controller. I am a fan of Chris Hartjes's Fat Model, Skinny Controller school of thought. @Dan Cakephp

Re: Failure to JOIN and query correctly beyond $recursive = 1 - workarounds or fixes welcome, maybe a bug?

2007-07-15 Thread Nick
Just to correct the query results as that was after modifying the schema. The full depth queries are: SELECT `AThing`.`id`, `AThing`.`b_thing_id`, `BThing`.`id`, `BThing`.`c_thing_id` FROM `a_things` AS `AThing` LEFT JOIN `b_things` AS `BThing` ON (`AThing`.`b_thing_id` = `BThing`.`id`) WHERE

Re: Bakery Article : How to use ACL in 1.2.x

2007-07-15 Thread Ketan Patel
Hi Geoff, If you read the full article, I have covered Acl Behavior as well. I gave user two options, use manual Acl way to handle things and another is to use Acl Behavior. Because there are times when you want to use manual method to create Aros Acos. However, most of the time Acl Behavior

RE: Bakery Article : How to use ACL in 1.2.x

2007-07-15 Thread Mariano Iglesias
Chris has a school? That's a new one ;) -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog: http://www.MarianoIglesias.com.ar

Re: Bakery Article : How to use ACL in 1.2.x

2007-07-15 Thread Chris Hartjes
On 7/15/07, Mariano Iglesias [EMAIL PROTECTED] wrote: Chris has a school? That's a new one ;) -MI The school has exclusive membership...because I'm usually too grumpy to admit anyone! -- Chris Hartjes Senior Developer Cake Development Corporation My motto for 2007: Just build it, damnit!

RE: Bakery Article : How to use ACL in 1.2.x

2007-07-15 Thread Mariano Iglesias
You have seen that sometimes I get grumpier than you, so... -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog:

Re: Bakery Article : How to use ACL in 1.2.x

2007-07-15 Thread Chris Hartjes
On 7/15/07, Mariano Iglesias [EMAIL PROTECTED] wrote: You have seen that sometimes I get grumpier than you, so... Classes start tomorrow morning! Welcome aboard! ;) -- Chris Hartjes Senior Developer Cake Development Corporation My motto for 2007: Just build it, damnit! @TheBallpark -

Re: can $form generate a hierarchical select?

2007-07-15 Thread Geoff Ford
The showParents creates optgroup tags not additional select tags. I'm not sure if cake supports herachical selects out of the box. Seems like a good candidate for a component/helper though, either with ajax callbacks or preload all options (or both with a config option). Geoff --

How can i get $form-dateTime() to use a number instead of english month names!?

2007-07-15 Thread burzum
How can i get $form-dateTime() to use a number instead of english month names!? I don't get it :( And i have this ?php echo $form-dateTime('Event/enddate','DMY', 24,null,array(),true)? and when i submit the form and theres a validation error (in another field), the date fields do not stay

Re: Bakery Article : How to use ACL in 1.2.x

2007-07-15 Thread Geoff Ford
@Ketan Aah.. so you did, but I think that anything on ACL in 1.2 should emphasis the behavior as it is so much easier and cleaner, although some may debate that it is too much magic. Geoff -- http://lemoncake.wordpress.com On Jul 16, 11:33 am, Chris Hartjes [EMAIL PROTECTED] wrote: On

Re: How can i get $form-dateTime() to use a number instead of english month names!?

2007-07-15 Thread Geoff Ford
Looking through the source the options are generated with case 'month': 01343 for ($i = 1; $i = 12; $i++) { 01344 $data[sprintf(%02s, $i)] = strftime(%B, mktime(1,1,1,$i,1,1999)); 01345 } So look slike you are out of

Re: database design

2007-07-15 Thread wralph
I would go with an id field that is an auto-increment and a code field for storing your code numbers. Winston --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to

Returning Value from a Controller

2007-07-15 Thread pravi
I need to have a common function which checks the access permission of a visitor before loading a page in a site.The page call would be proceeded only if this access check function return true.If I write this function as a part of controller,I found that ,it is only possible to get the view of

Re: soap server

2007-07-15 Thread [EMAIL PROTECTED]
the domain ros-soft.net isn't valid now, therefore those classes mentioned in the blog aren't available for download. On Jul 13, 5:39 pm, francky06l [EMAIL PROTECTED] wrote: The Rossoft blog http://rossoft.wordpress.com/2006/02/17/web-services-in-cakephp-compl... On Jul 13, 4:16 pm, pigeon

Re: soap server

2007-07-15 Thread [EMAIL PROTECTED]
The problem is that blog contains an old link to a class named web_services_controller.php from an external expired domain :( On Jul 13, 5:39 pm, francky06l [EMAIL PROTECTED] wrote: The Rossoft blog http://rossoft.wordpress.com/2006/02/17/web-services-in-cakephp-compl... On Jul 13, 4:16 pm,

Re: Returning Value from a Controller

2007-07-15 Thread Walker Hamilton
Look into the beforeFilter function. You can do a redirect in it if the person is trying to access a controller they should not be. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this