Introduction and System overview

2006-07-31 Thread aw029

Hello,

I'am started using cake two weeks ago. I'am very happy, that I found a
framework which gives me almost the same possibilities as RoR does, and
which is, for the first time, easy to use. I'am very familiar to PHP
and OOP and I can almost do erverything I like when I want to write a
programm. I have so much questions on Cake and didn't find the answers
in the manual or in the wiki. Maybe the answers to my questions are
very simple, but I can't find any source which shows me how the system
works, and where I can put in my code to do something. For example the
validation. I have a field 'email' and my model validates this field
with the built-in validation in cake. I want that my model only
validates the field when it is submited by the form. I found no source
which explained how can i do that.

To wrap that up, for me, cake is a very good system, and i want to use
it. But if there is no good explanation of things which happens during
execution, I can not alter the behavior to my needs.

Maybe I can help to built up such an Information ressource. It should
also explain how the MVC works and how Cake implements the MVC, because
I think one of the main reason why people don't use cake, is that they
don't know what the MVC-Paradigma is for.

Best regards
Alexander


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



datetime strings and using sanitize-cleanArray()

2006-07-31 Thread ianh

Hi all,

I need to pass a datetime string from a form to be stored on the
database as -MM-DD hh:mm:ss (i.e. datetime format in MySQL).

I then put code to clean the $this-data array in the app_model to try
to setup automatic cleaning of all saved data. What I found was that
because cleanArray() cleans everything without mercy, including html
encoding on everything, it encoded the hyphens in teh datetime format
(not the colons though).

The result was that the DB (MySQL 5.something) didnt want to store it.

My solution was to hack a bit of code into the app_model to reverse
this so that the full sanitize check looks like this:

http://www.cakephp.org/pastes/show/eb23edaac3bd13381b467669d2bd291a

I am specifically interested in the publishUp and publisDown fields,
but an obvious 'to do' is to create an array of fieldnames to do this
to.

But - does anybody have any better solutions?

Thx, ianh


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



Re: datetime strings and using sanitize-cleanArray()

2006-07-31 Thread kitten

 I then put code to clean the $this-data array in the app_model to try
 to setup automatic cleaning of all saved data. What I found was that
 because cleanArray() cleans everything without mercy, including html
 encoding on everything, it encoded the hyphens in teh datetime format
 (not the colons though).

Sanitze::cleanArray() uses (among others) Sanitze::html() to do the
encoding. Sanitze::html() accepts a second parameter to tell it to
strip_tagas() instead of encoding. This is more appropriate in many cases.

Unfortunately, by calling cleanArray(), you can't trigger this alternative
behaviour.

There are other cases where Sanitize::html() encoding can get in your way,
i.e. when getting an email address from a form. [EMAIL PROTECTED] will
become my#45;[EMAIL PROTECTED] and will consequentely not be considered as a
valid Email address when trying to validate it.

The sanitze class is great, but could certainly be more flexible. In the
meantime, I created a controller-wide method (in app_controller.php) to
unhtml() the eunwanted encoding where necessary.

Hope this helps :)

Heiner
 
 The result was that the DB (MySQL 5.something) didnt want to store it.
 
 My solution was to hack a bit of code into the app_model to reverse
 this so that the full sanitize check looks like this:
 
 http://www.cakephp.org/pastes/show/eb23edaac3bd13381b467669d2bd291a
 
 I am specifically interested in the publishUp and publisDown fields,
 but an obvious 'to do' is to create an array of fieldnames to do this
 to.
 
 But - does anybody have any better solutions?
 
 Thx, ianh
 
 
  



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



Re: Switching Layouts

2006-07-31 Thread lorenzo


kdbdallas ha scritto:

 OK, I am hoping this is my last question, but no promises. :-)

 How do I tell a view in my controller to use a different layout.
 In my layouts DIR I have default.thtml and secondary.thtml.
 What do I put in the controller file to specifiy which layout to use?

you can store choice in a session:
function BeforeFilter()
{
$this-layout = $_SESSION['layout'];
}


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



selected items in HABTM multiple select

2006-07-31 Thread Olivier Percebois-Garve
Is there an elegant way to build the list of selected items to feed the $html-selectTag() in a HABTM relation ??I ended with for instance:   $materials_selected_designations = array();   for($i=0; $i  sizeof($this-params['data']['Material']); $i++){
$materials_selected_designations[$this-params['data']['Material'][$i]['id']] = $this-params['data']['Material'][$i]['designation'];}   $this-set('materials_selected_designations', $materials_selected_designations);
its not very elegant compared to: $this-set('materials_designations',$this-Application-Material-generateList());The manual doesn't say anything on this, and in the wiki there is only something confuse in understanding_associations.
Any thoughts ??olivvv

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


cheeseCake Photoblog V1.0 Beta 2 released

2006-07-31 Thread Dr. Tarique Sani [EMAIL PROTECTED]

After a few bug fixes in the tagging system we are proud to release
Beta 2 of the cheeseCake Photoblog V1.0

No new features were added (hey its a Beta! )

I would like to thank Vladislav Sournine for all the work he did on
hunting the bugs down

Download from: http://cakeforge.org/projects/cheesecake/
Installation instructions are in the README file of the tarball

Post Bugs, feature and support request at
http://cakeforge.org/tracker/?group_id=76

Demo is at  http://sanisoft-demo.com/cheesecake/

Login with admin / admin to test the admin side - be nice and upload
only work-safe pictures, Also do not change the theme - there is only
one

Am still looking for developers who would like to join the project -
specially for creating new and more attractive themes

Cheers
Tarique Sani


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



Re: AJAX Autocomplete silently failing

2006-07-31 Thread jonathan

Does anyone have any complete examples?  I just can't seem to get this
thing working.  I'd also like to pass in the minChar variable - any
chance of doing this?

Thanks


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



Re: cheeseCake Photoblog V1.0 Beta 2 released

2006-07-31 Thread Chris Lamb

Tarique,
 
 Demo is at  http://sanisoft-demo.com/cheesecake/

Looks nice!


On a related note, we may be running out of 'cake' words for
cake projects, so people should reserve them ASAP:

[EMAIL PROTECTED]:~$ perl -ne print if /cake[^\'s]/ /usr/share/dict/words
cake
caked
cheesecake
coffeecake
cupcake
fruitcake
griddlecake
hotcake
pancake
pancaked
shortcake


Regards,

Chris

-- 
 Chris Lamb, Cambridgeshire, UK  [EMAIL PROTECTED]
  WWW: www.chris-lamb.co.uk GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: datetime strings and using sanitize-cleanArray()

2006-07-31 Thread Chris Lamb

On Mon, 31 Jul 2006 02:34:29 -0700
AD7six [EMAIL PROTECTED] wrote:

 Why use sanitize at all? Data sent to the DB get´s escaped anyway, so
 it´s not exactly necessary. I thought the intention of the sanitize
 class was for example, so you could still escape your custom sql
 queries easily.

Well, cleaning potentially dangerous HTML to combat XSS[1] attacks is
useful.


[1] http://en.wikipedia.org/wiki/Cross-site_scripting


-- 
 Chris Lamb, Cambridgeshire, UK  [EMAIL PROTECTED]
  WWW: www.chris-lamb.co.uk GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: AJAX Autocomplete silently failing

2006-07-31 Thread jonathan

OK, I commented out the check for isAjax in the component and got it
working - not sure why it's not Ajax but it is so it works.  I'd
still like to set the minChar, though - any thoughts?  Thanks...


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



Integrating Cake phpBB sessions

2006-07-31 Thread ax0rz

Hey! I'm having major trouble integrating the sessions between Cake 
phpBB2.

1) My phpBB2 installation is in /app/webroot/phpBB.
2) The DocumentRoot in httpd.conf is set to /app/webroot.

I've tried accessing $_SESSION directly in /phpBB/login.php (ie- when
the user logs in successfully, $_SESSION['user_id'] etcetc is set),
but, the problem is I'm not able to access these $_SESSION variables
from outside phpBB. :( :(

If someone else has any idea how this can be achieved, please post! I'm
sure it will be helpful to a LOT of people. Thanks in advance!

Cheers!


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



Get a controller method from template

2006-07-31 Thread alepane

I have to get in a template some code generated from a controller
(Lavoro).
I have write:
pspan class=dicituraCliente :/span ?php echo
$this-controller-Lavoro-getLavoro(); ?/p
But php return an error :
Fatal error: Call to a member function on a non-object in
c:\programmi\easyphp1-8\www\app\views\layouts\default.thtml on line 47
Why ? How I have to do ?
Thanks.


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



DBO MetaType Error

2006-07-31 Thread Dave Rogers

I am attempting to upgrade to the newest version of CakePHP from a beta
version.  I am using Oracle using dbo.  When I run any route, I get the
error:

Fatal error:  Call to a member function MetaType() on a non-object in
...\cake\libs\model\dbo\dbo_adodb.php on line 298

Does this ring a bell to anyone.  I'm having trouble tracking down
where/how this is getting implemented.

Thanks in advance.


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



Re: Switching Layouts

2006-07-31 Thread nate

Actually it'd be more like this:

if ($this-Session-check('layout')) {
$this-layout = $this-Session-read('layout');
}

but that's controller code.  You should, however, still be able to use
$this-layout in your view templates.


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



Re: Integrating Cake phpBB sessions

2006-07-31 Thread nate

Either make sure you're setting session.auto_start in php.ini, or
you're calling session_start( ) before trying to access $_SESSION.
Also, Cake will only use $_SESSION to store session data if
CAKE_SESSION_SAVE is set to 'php' in app/config/core.php.


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



Re: AJAX Autocomplete silently failing

2006-07-31 Thread nate

http://api.cakephp.org/class_ajax_helper.html#023c127898fec19debbb715010383935

You should be able to pass 'minChar' in the $options array.


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



Re: DBO MetaType Error

2006-07-31 Thread nate

Do you have ADOdb installed in /vendors?


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



Re: Big problems with cake getting confused between different DBs

2006-07-31 Thread [EMAIL PROTECTED]

Good advice. I'll try it. 

Thank you!


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



Re: Switching Layouts

2006-07-31 Thread lorenzo


nate ha scritto:

 but that's controller code.  You should, however, still be able to use
 $this-layout in your view templates.
Sure ... but is better in controller than in view ;)


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



Re: Get a controller method from template

2006-07-31 Thread John David Anderson (_psychic_)


On Jul 31, 2006, at 9:06 AM, alepane wrote:


 I have to get in a template some code generated from a controller
 (Lavoro).
 I have write:
 pspan class=dicituraCliente :/span ?php echo
 $this-controller-Lavoro-getLavoro(); ?/p
 But php return an error :
 Fatal error: Call to a member function on a non-object in
 c:\programmi\easyphp1-8\www\app\views\layouts\default.thtml on line  
 47
 Why ? How I have to do ?

You need to have your controller generate the code and hand it to the  
view in a variable, using the set() function. In your controller, do  
something like this:

$this-set('code', $this-Lavoro-getLavoro());

And in your view, do:

?php echo $code; ?

-- John

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



Re: DBO MetaType Error

2006-07-31 Thread Dave Rogers




nate wrote:

  Do you have ADOdb installed in /vendors?




  

Yes. I have ADOdb installed in /vendors. It
was working before I tried upgrading.

Does the upgrade need to be a certain revision level?

--Dave


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





Re: associations: SELECTs correctly but doesn't UPDATE

2006-07-31 Thread vtbludgeon

Grant Cox wrote:
 What you are doing (the commented out line) is a good way to do it.[...]

Great. I just wanted to make sure I wasn't doing something wrong.

 The only thing to improve it would be to manually run the
 Judge-validates($this-data) and User-validates($this-data), before
 attempting to save.  Otherwise the Judge may be updated, even when the
 User has validation errors.

Yes, you've read my mind (retroactively, sort of). I discovered that
one model can indeed get updated even when the other doenn't validate,
and have been playing with ways to avoid that.

Thanks very much for helping me with this.

Odd thing to me is, why does cake SELECT from all both joined tables
when you findAll(), but not UPDATE  them when you save().


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



Validator and scaffolding

2006-07-31 Thread V

Hello!

I have read in a post about the Validator script at
http://www.webtest.wvu.edu/users/cbscharf/validator/, and given that I
had some problems with the wiki's advanced validation w/ params
(http://wiki.cakephp.org/tutorials:advanced_validation:advance_validation_with_parameters),
I thought to give it a try.

Given that I think that the method suggested at Validator's site
corrupts the MVC  framework, I choose a different approach.

I did as follows:

(0.5 took a bottle of milk)
1. added it under app/controllers/components/validator.php

(1.5 added some sugar and flour to it)
2. then wrote my own my_validator.php component which does a
require_once(app/controllers/components/validator.php) and initializes
the main class, adds custom validation methods, etc
the __construct method is:
function __construct($obj, $data){
if(is_object($obj))
$this-obj = $obj;
parent::__construct($obj, $obj-validate, $data[$obj-name]);
}

(3.5 put it in the owen)
3. finally I rewrote the validates function in app_model.php to use the
MyValidator class

my new validates method is:
function validates($data=array()){
if ( empty($data) ) {
$data = $this-data;
}

$v = new MyValidator($this, $data);

if( is_array($this-filters) )
$this-filter($this-filters, $v);

$this-invalidFields = $v-_validation_errors;

return $v-validates();
}

(4.5 but don't know when to take it off?! :) )

I think it should work now, but it does not. At least not with
scaffolding, because when I save a data it runs the validates method
found in cake/libs/model_php5.php. I thought to get it overwritten in
app_model.php, or is this because of scaffolding?

Second question: is this a good way to validate all the models? I think
to the parent::__construct($obj, $obj-validate, $data[$obj-name]);
part of my constructor. Will it validate in all of my models if I have
a complex request? (ie: $params['data']['User'] and
$params['data']['Posts'] too get validated?)

any ideas, suggestions?

V


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



hierarchical controllers

2006-07-31 Thread Neves

Hi,

Is possible to have hierarchical controllers like:
/admin/blog/edit/1 where admin is a folder with others controllers
related do the admin of the site.


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



Re: hierarchical controllers

2006-07-31 Thread Samuel DeVore

There is an admin routing feature you might want to look at

http://manual.cakephp.org/chapter/4  in section 4

It's a different way to do what you might be thinking about.  And no I
do not believe that there is builtin support for hierarchical
controllers

Sam D

On 7/31/06, Neves [EMAIL PROTECTED] wrote:

 Hi,

 Is possible to have hierarchical controllers like:
 /admin/blog/edit/1 where admin is a folder with others controllers
 related do the admin of the site.


 


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



Re: hierarchical controllers

2006-07-31 Thread AD7six

Plugins are an easy way to organize things too, a plugin is a mini,
self contained app

see http://manual.cakephp.org/chapter/13

Cheers,

AD7six


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



Re: strange helper behaviour in element

2006-07-31 Thread Ben Durbin

Scope confusion?

The following works:

?php
function printUpDown($html_helper)
{
echo $html_helper-image('up.gif');
echo $html_helper-image('down.gif');
}
?

p?php printUpDown($html) ?/p

Geoff wrote:
 When i use the html helper in an element it works fine if it is called
 directly. If, however, it is called from a function in the element, it
 does not work: Notice: Undefined variable: html in.

 For example, this doesn't work:

 ?php
 function printUpDown() {
   echo $html-image('up.gif');
   echo $html-image('down.gif');
 }
 ?
 p
 ?php printUpDown() ?
 /p

 But this does:

 p
 ?php echo $html-image('down.gif') ?
 /p

 any ideas?


 

   

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



findAllByFieldName in a manyToMany relation

2006-07-31 Thread [EMAIL PROTECTED]

Hi everyone, I'm trying to do something like this:

findAllByFieldName(), in a relation hasAndBelongsToMany, so I don't
have a field to look for, do you know which method should I use to do
this?

Thanks in advance.


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



Re: findAllByFieldName in a manyToMany relation

2006-07-31 Thread John David Anderson


On Jul 31, 2006, at 2:37 PM, [EMAIL PROTECTED] wrote:


 Hi everyone, I'm trying to do something like this:

 findAllByFieldName(), in a relation hasAndBelongsToMany, so I don't
 have a field to look for, do you know which method should I use to do
 this?

Give us a more concrete example - what you've asked here seems a  
little contradictory.

-- John

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



Re: findAllByFieldName in a manyToMany relation

2006-07-31 Thread John David Anderson (_psychic_)


On Jul 31, 2006, at 2:53 PM, [EMAIL PROTECTED] wrote:


 OK, I have Post and Category, they both hasAndBelongsToMany each  
 other,
 how can I get all posts in one category,

$this-Category-find('id = '.$id);

 and all categories inone Post,

$this-Post-find('id = '.$id);

 that's the question :-).

Print_r() out the results of those calls, and you should see the  
associated models (given that your association has been set up  
correctly).

-- John

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



Character sets

2006-07-31 Thread [EMAIL PROTECTED]

I have posted and readed many times about character encoding. But most
of the times the responses are incomplete and confusing is there a good
tutorial for this.
I have made  a simple script with cakephp the index.thtml view is like
this
?
echo Año, canción
?
 and the output is:
 A?o, canci?n

I was using UTF8 for encoding, then I've changed to ISO-8859-1
adding the following two lines to the (default.thtml, ajax.thtml...etc)
scripts.
?php
mb_http_output('ISO-8859-1');
ob_start('mb_output_handler');
?
and now the outputs are rigth. I can also store and retrive data
correctly from the databse with cakephp. But there is only one problem
when I use the ajax autocomplete it still uses UTF8 for encoding my
query string to the database and I can't make querys with characters
like (Ñ,ñ..etc). Can someone give a GOOD explenantion about character
encoding.


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



Re: Character sets

2006-07-31 Thread John David Anderson (_psychic_)

  But there is only one problem
 when I use the ajax autocomplete it still uses UTF8 for encoding my
 query string to the database and I can't make querys with characters
 like (Ñ,ñ..etc). Can someone give a GOOD explenantion about character
 encoding.

Using which browser(s)?

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



Re: Character sets

2006-07-31 Thread AD7six

How about this,

If the encoding for your files == charset meta tag in html == database
encoding

Then you won't get any pr?blems.

If you are not using UTF-8 you will get pr?blems with AJAX updates
if you use UTF-8 database connection you need to execute set names
'UTF8' as your first  mysql command
Most people miss/don't know that they need to change the encoding for
the files themselves.
If you get the text  being output you have BOMs at the
beginning of your files which you need to remove

Therefore to avoid all pr?blems:
Put EVERYTHING as UTF-8
google set names 'UTF8' cakephp and put in place a fix*
Configure your editor to use UTF-8 charset and don't add BOMs

And you don't get any more problems.

HTH

AD7six
* for v1.2 of cake adding encoding=UTF8 to your database
connection parameters takes care of this.


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



Re: Character sets

2006-07-31 Thread AD7six

The bom got cleaned, so I'll give it another try

If you get the text  being output you have BOMs at the
If you get the text  ï » ¿  without the spaces output to screen..
you have BOMs..


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



Re: Character sets

2006-07-31 Thread Chris Lamb

Hi,

Firstly, ISO8859-1 (or Latin-1) has rather limited character set[1]
and you should consider sticking with Unicode (in your case UTF-8)

 Can someone give a GOOD explenantion about character encoding.

The eminent Joel Spolsky gives an excellent guide[1] to character
encodings from the programmers point of view. Everyone reading this
post should read this.

With regard to your problem the W3[2] say:

 It is very important that the character encoding of any XML or (X)HTML
 document is clearly labeled, so that clients can easily map these
 encodings to Unicode.
  (Source: [2])

So, can you first check whether your view that houses the input
element which will be autocompleted contains the magic:

 meta http-equiv=Content-Type content=text/html;charset=utf-8 /

in the head section? 

Regards,

Chris


[1] http://www.htmlhelp.com/reference/charset/
[2] http://www.joelonsoftware.com/articles/Unicode.html
[3] http://www.w3.org/
[4] http://www.w3.org/International/O-charset

-- 
 Chris Lamb, Cambridgeshire, UK  [EMAIL PROTECTED]
  WWW: www.chris-lamb.co.uk GPG: 0x634F9A20


signature.asc
Description: PGP signature


Will Sanitize-cleanArray protect against XSS attacks?

2006-07-31 Thread Eric Farraro

I've been reading about all types of security vulnerabilities common in
online applications, and realized that my application had some rather
large XSS holes.  I found that using the Sanitize function 'cleanArray'
did a nice job in removing all? of the vulnerabilities, but I am
curious whether it is safe to rely on cleanArray 100%.

I looked at what cleanArray actually did, and noticed it called the
Sanitize-html function.  Looking at the contents of the html function,
it seems like Sanitizes uses a simple 'find and replace' routine -- it
looks for certain characters, like '' and '', then escapes them
appropriately.

HOWEVER, one of the hallmarks of XSS attacks is getting around simple
filtering routines by using other character sets -- so for instance, if
I were able to some how find a character that did not look like a ''
but was interpreted as such, I don't know if cleanArray would catch it.

The html function :
http://api.cakephp.org/sanitize_8php-source.html#l00081

I'm hoping that someone more familiar with XSS attacks, and Cake in
general, might be able to give me some insight into whether or not we
can rely on cleanArray to Sanitize data that could potentially lead to
XSS attacks.  Would it make more sense to use something like the PHP
function 'htmlentities', which allows you to specify a charset as an
argument?  Is it possible that Cake takes care of this problem behind
the scenes?

Thanks for any and all comments!


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



ACL and Multiple Groups

2006-07-31 Thread etaham

I was looking throught the ACL documentation and became very interested
in using it.  My question is as follows:
Is there a way for a user to be part of multiple groups? for example,
if i have a user named john, i want him to be in both the UsersA and
UsersB group.  PageA which allows UsersA should allow john in.  what
would happen if UsersB is denied from PageA and john tried accessing
it? would it act like windows? my understanding of windows is, a deny
is teh most powerfull.  ie, if one permission says you are denied, the
even if another says you are permitted you are still denied.

thank you
etaham


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



Re: ACL and Multiple Groups

2006-07-31 Thread nate

 Is there a way for a user to be part of multiple groups?

Yes and no.  ARO's and ACO's are organized in a tree-based fashion, so
if a node is a child of another node, it inherits that node's
permissions as well as the permissions of any node which the parent
node is a child of.  However, the concept of a node being the child of
more than one parent does not exist within the system.

 my understanding of windows is, a deny
 is teh most powerfull.  ie, if one permission says you are denied, the
 even if another says you are permitted you are still denied.

That sounds like a very inflexible system.  Cake's ACL system works off
of a similar 'default deny' premise, but it allows you to, for example,
deny permissions on an object to a group, but allow permissions on an
object to a specific user in a group.  By default, users will inherit
the permissions settings of their parent node, but you can override any
setting at any level.


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



Associated Model SELECT statements

2006-07-31 Thread teken894

A voting system:

Model Ballot: hasMany Options,Votes
Model Option: belongsTo Ballot
Model Vote: belongsTo Ballot
Model User: hasMany Votes

^^Im sort of new to MVC, hopefully those associations are OK!

Now: some controller code for viewing a ballot:
I tried:
$this-Ballot-id = $someID
$this-Ballot-Options-findAll();

I thought that since Ballot is associated with many options:
  WHERE `ballot_id` = `Ballot`.`id`
that Options-findAll() would only return an array of Options belonging
to that Ballot, but actually that call is retrieving ALL rows in the
options table

right now, I'm using
$this-Ballot-Options-findAll(ballot_id=$someID);

Am I doing this correctly? Is there any simpler way to get the result I
want?


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



Re: Character sets

2006-07-31 Thread [EMAIL PROTECTED]

Thanx for the help given with the theme.


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



Re: Associated Model SELECT statements

2006-07-31 Thread teken894

Oh yea, one more question

When I do
$this-Ballot-id = $someID;
$this-Ballot-read();
I get a huge array with ['Ballot'], ['Options'], and
  Say I wanted to return only the (['Ballot'] and ['Options']) or
(['Ballot'] and ['Votes']),

  Is there a method/way that will return selective associations in
that way? Or, I guess again I'll resort to a custom query...


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



Re: Associated Model SELECT statements

2006-07-31 Thread Eric Farraro

Regarding your section question, and pulling only certain
information...

Check out:
http://api.cakephp.org/class_model.html#c2d8fb14f5398c85452d978bd013436f,
which is the API page for FindAll().  One of the parameters is
'fields', where you can specify fields returned.  I'm not certain, but
you might be able to specify something like:

array('ballots.*', 'options.*')

Again, I'm not sure on that, but it might help.

Also in your first question, you wrote:
$this-Ballot-Options-findAll(ballot_id=$someID); .

You could also write that as $this-Ballot-Options-findById($someID).
 The result would be the same, but it looks a little better IMO.


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



Re: Associated Model SELECT statements

2006-07-31 Thread teken894


  I'm not certain, but
 you might be able to specify something like:

 array('ballots.*', 'options.*')

That doesn't work. I think that's for returing one field from the model
that the controller is associated with. I want something very similar
by to get a particular from a associated Model, not a particular field.



 Also in your first question, you wrote:
 $this-Ballot-Options-findAll(ballot_id=$someID); .

 You could also write that as $this-Ballot-Options-findById($someID).
  The result would be the same, but it looks a little better IMO.

The result is not the same. findById is will find a Option with that
ID,
where Option.id = $someBallotID (which is comparing the worng
IDs)
  my query was lo
where Option.ballot_id = $someBallotID


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



Re: AJAX Autocomplete silently failing

2006-07-31 Thread jonathan

Hey Nate - when I pass in minChar, it adds it to the text field and not
the Ajax call:

echo
$ajax-autocomplete('Entity/name','/entities',array('size'='40','minChar'='4'))

produces:

input name=data[Entity][name]  size=40 minChar=4 id=EntityName
autocomplete=off value= type=text /
div  id=EntityName_autoComplete class=auto_complete/div
script type=text/javascriptnew Ajax.Autocompleter('EntityName',
'EntityName_autoComplete', '/ivsCake/entities', {});/script

Could the AJAX helper be modified to account for the minChar parameter?

Thanks for the outstanding effort in this project!


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



I don't want to associations in every queries, how?

2006-07-31 Thread Daniel King

There are some associations in my app. But I don't need to use it every
time.
What should I do?


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



Re: AJAX Autocomplete silently failing

2006-07-31 Thread nate

Sorry, it should actually be 'minChars', not 'minChar'.  That's why the
key wasn't being recognized by AjaxHelper.


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



Re: I don't want to associations in every queries, how?

2006-07-31 Thread Ryan K

Could you be more specific when you say...

'You don't need to use it every time?'

Are you saying you don't want the query to run everytime? (aka, enable
some type of caching)

_RK

Daniel King wrote:
 There are some associations in my app. But I don't need to use it every
 time.
 What should I do?


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



Re: I don't want to associations in every queries, how?

2006-07-31 Thread John David Anderson (_psychic_)


On Jul 31, 2006, at 6:57 PM, Daniel King wrote:


 There are some associations in my app. But I don't need to use it  
 every
 time.
 What should I do?

Set the recursive var to 0 before making find calls.

$this-ModelName-recursive = 0;
$this-ModelName-find();

-- John



 


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



Re: I don't want to associations in every queries, how?

2006-07-31 Thread nate

http://api.cakephp.org/class_model.html#c2d8fb14f5398c85452d978bd013436f

See the $recursive parameter.  You can set it to 0 to disable hasMany
and hasAndBelongsToMany associations, or -1 to disable all associations.


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



Re: AJAX Autocomplete silently failing

2006-07-31 Thread jonathan

Thanks Nate - that was it - the thing works brilliantly now.  And now
for something completely different:

I used CSS to set a max-height and overflow:auto for the returned list,
so if the results are lengthy, I get a scrollable list.  Of course, IE
(pre-7) does not recognize max-height but that's another story.  My
solution works perfectly in Firefox, but in IE, if you click the
scrollbar to scroll through the list, the list disappears!  You can use
the mouse's scroll wheel, but not the scrollbar itself.

example here: http://www.ultimediaintl.com/ivsCake/entities  (search
with Arizona (minChars = 4))

I know this has nothing to do with the Cake framework, but if anyone
knows a work-around, I'd be truly obliged...

Jonathan


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



ajax-link -- unable to get it working

2006-07-31 Thread bingo

Hello all,

I am trying to update the content of a div (details) based on the
article title that was clicked. Below is my code for the view
(test.thtml) and the generated code. The problem is that when I click
on article title, nothing happens. Even the controller function
specified in the ajax-link never gets called. One specific thing that
is bothering me is the event onClick for the link is returning false.
Is that normal ?

regards

=== test.thml =
?php
foreach($articles as $index){
$article = $index['Article'];
?

div class=record
span class=title
 ?php echo $ajax-link($article['title'], 
'/articles/view/'.
$article['id'], array('update' = 'details')); ?
/span
/div

?php
} // next $articles
?

 ?php e($ajax-div(details)); ?
   h2?php $php-array2table($data, true); ?/h2
 ?php e($ajax-divEnd(details)); ?

== generate code 

div class=record
span class=title
 a href=/cake/articles/view/11  id=link8473 onclick= 
return
false;Article 2/ascript
type=text/javascriptEvent.observe('link8473', 'click',
function(event){ new Ajax.Updater('details','/cake/articles/view/11',
{asynchronous:true, evalScripts:true, requestHeaders:['X-Update',
'details']}) }, false);/script/span
/div


div class=record
span class=title

 a href=/cake/articles/view/10  id=link26078 onclick=
return false;Semantic Analysis of GIS/ascript
type=text/javascriptEvent.observe('link26078', 'click',
function(event){ new Ajax.Updater('details','/cake/articles/view/10',
{asynchronous:true, evalScripts:true, requestHeaders:['X-Update',
'details']}) }, false);/script/span
/div


 div id=detailsh2br /
bNotice/b:  Undefined variable: data in
bC:\Apache2\htdocs\cake\app\views\general\test.thtml/b on line
b18/bbr /
/h2
 /div


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