Re: Data cleanup in Model

2007-03-25 Thread ianh

Hi,

I agree that data cleaning and sanitization is best kept out of the
controller and in the model. However, before I present my solution and
for the sake of completeness, there are two functions,
sanitize::paranoid and sanitize::cleanArray that work from the
controller. I and others have found that cleanArray is useful but
limiting, e.g. it strips characters from email addresses and phone
numbers and doesn't seem to protect against JS code. Paranoid is
perfect but is only useful on a var by var basis from the controller.

So, my solution to clean up data before save is as follows:

1) In appModel put the function found at http://pastebin.co.uk/12244

2) Still in appModel put the following function:

/*
 *  Calls the global sanitize method and sanitizes data via paranoid.
 *  Allowed Chars passed in via an allowedChars array in individual
models
 *  @return must return boolean true otherwise save execution will abor
 **/
function beforeValidate()
{
$this->__sanitize($this->data);
return true;
}

3) So now, your app will run each item of a $this->data array through
sanitize::paranoid() and will strip out everything except alphanumeric
characters. I operate on the basis that you should remove everything
and then create a whitelist of allowed characters for each field in
your model. To do this, in each model create a protected array called
$allowedChars as follows:

protected $allowedChars = array();

If you have two fields in your model, lets say an ID and an email, you
would want only numbers in the ID field but the email field should
contain the special characters @, ., -, _. To do this, your
$allowedChars would appear as:

protected $allowedChars = array('email' => array('@', ',', '.', '-',
'_'));

Effectively the second array in $allowedChars is the second var of the
sanitize::paranoid function.

If you look carefully at my __sanitize function you will see there are
some shortcuts, called 'default', 'datetime', 'markdown' and
'textarea'. These contain pre-written groups of allowed characters. So
for a datetime field (not created or modified, you don't need to do
anything with those) you could write your $allowedChars array as:

protected $allowedChars = array('date' => array( 'datetime'));

You can combine characters and shortcuts as well, e.g.

protected $allowedChars = array('date' => array( 'datetime', '@',
'markdown', '-', '/'));

What do people think of that type of approach? One important note,
this does not clean up inputs used for search or filtering and you
would need to call paranoid for those inputs. I am working on a
beforeFind version of the above but it is not so quick.

HTH, Ianh

On Mar 24, 7:45 am, "Michael Tuzi" <[EMAIL PROTECTED]> wrote:
> I thought that data cleaning should be done prior to a save, so I
> tried using stripAll in the model as follows:
>
> function beforeSave()
> {
> require_once('sanitize.php');
> $cleaner = new Sanitize();
>
> $profile = $this->data;
> $fields['Profile'] = $this->getColumnTypes();
> foreach ($fields['Profile'] as $k => $v)
> {
> if (isset($profile['Profile'][$k]))
> {
> if (($v == 'string') || ($v == 'text'))
> {
> $fields['Profile'][$k] = 
> $this->RequestHandler->stripAll[$profile['Profile'][$k]];
>
> }
> else
> {
>$fields['Profile'][$k] = $profile['Profile'][$k];
> }
> }
> else {
> $fields['Profile'][$k] = '';
> }
> }
> $cleaner->cleanArray($fields);
> }
>
> But I get this warning:
> Undefined property: Profile::$RequestHandler, because the components
> array isn't defined in the model. It's in the controller. Any
> suggestions on how I might move some of this cleaning work out of the
> controller?
>
> Thanks in advance,
>
> Michael Tuzi


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: A question about the Email component

2007-03-25 Thread D.Pape

yes, now it works!! seems it was a bug in the email component. thanks!


On 25 Mrz., 18:15, "Gilles Dubois" <[EMAIL PROTECTED]>
wrote:
> I followed the indications of 
> articlehttp://bakery.cakephp.org/articles/view/203
> and now, it's Ok. Thank you.
>
> On 19 mar, 20:27, "djiize" <[EMAIL PROTECTED]> wrote:
>
> > did you create proper layouts in /app/views/layouts/email/ ?
> > seehttp://bakery.cakephp.org/articles/view/203formore info
>
> > On 19 mar, 18:44, "Gilles Dubois" <[EMAIL PROTECTED]> wrote:
>
> > > CakePHP version 1.2.0.4451alpha
>
> > > When calling the ->send() method on a EmailComponent object, CakePHP
> > > try to used a unnamed layout. This generate an error. Here's a sample
> > > code from me showing my use of this component :
>
> > > $this->Email->to = $aTask['Owner']['email'];
> > > $this->Email->from = $this->Session->read('Uzer.email');
> > > $this->Email->cc[] = $this->Session->read('Uzer.email');
> > > $this->Email->subject = 'something';
> > > $this->Email->body = 'something';
> > > $this->Email->send();
>
> > > Is it due to a mistake I made or to a bug ?


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Search Results Word Popularity Tool

2007-03-25 Thread my1empire

I am looking for something that will allow me to plug a list of words
into it and give me the word popularity of each word based on the
number of pages Google finds that use that word. Any suggestions?


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



how to do Multi-Row Edit ?

2007-03-25 Thread cc96ai

I know how to do in PHP,
but I have no idea how to work it on cakePHP

e.g.
I have a table of products,
and I will list all the products in one form , one page,

-Name, Desc, Qty, Price, Total
-Name, Desc, Qty, Price, Total
-Name, Desc, Qty, Price, Total
-Name, Desc, Qty, Price, Total

user will input the Qty in the form, and once he submitted into
server
it will save into invoice database

BUt how can cake handle the name in Multi-Row
and direction will help .

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?hl=en
-~--~~~~--~~--~--~---



Re: Problems with sessions and cookies

2007-03-25 Thread Anton B.

Does nobody have such issues?


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Securing a controller - best practice ?

2007-03-25 Thread Richard Uren
On 3/26/07, Samuel DeVore <[EMAIL PROTECTED]> wrote:
>
>
> look at this thread
> <
> http://groups.google.com/group/cake-php/browse_thread/thread/9b3106780fb861ec/9b2bd7e3c3597f8f?lnk=gst&q=requestAction+controller&rnum=35#9b2bd7e3c3597f8f
> >
>
> if($this->params['requested'] === true){
> //do your thing here
>
> }


Awesome ! Thanks.

Cheers
r

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



RE: Admin Routing Techniques

2007-03-25 Thread Mariano Iglesias

Or even better, no parameter needed:

function admin_add()
{
return $this->setAction('add'); 
}

function add()
{
if (isset($this->params[CAKE_ADMIN]))
{
$this->render('admin_add');
}
}

-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


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de Mariano Iglesias
Enviado el: Domingo, 25 de Marzo de 2007 05:53 p.m.
Para: cake-php@googlegroups.com
Asunto: RE: Admin Routing Techniques

No, setAction() will set the $controller->action to 'add' and therefore
render() will render add.ctp

But you can use a parameter:


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



RE: Admin Routing Techniques

2007-03-25 Thread Mariano Iglesias

No, setAction() will set the $controller->action to 'add' and therefore
render() will render add.ctp

But you can use a parameter:

function admin_add()
{
return $this->setAction('add', true); 
}

function add($admin = false)
{
if ($admin)
{
$this->render('admin_add');
}
}


-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

De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de Sonic Baker
Enviado el: Domingo, 25 de Marzo de 2007 05:19 p.m.
Para: cake-php@googlegroups.com
Asunto: Re: Admin Routing Techniques

Just wondering if setAction() allows rendering of a different view after the
call?


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Admin Routing Techniques

2007-03-25 Thread Sonic Baker
Thanks for all the replies people,



On 3/25/07, Mariano Iglesias <[EMAIL PROTECTED]> wrote:
>
>
> Instead do:
>
> function admin_add()
> {
> return $this->setAction('add');
> }
>
Just wondering if setAction() allows rendering of a different view after the
call?
Like:

function admin_add()
{
return $this->setAction('add');
$this->render('admin_add');
}

Cheers,

Sonic

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: phpThumb Component

2007-03-25 Thread Samuel DeVore

On 3/25/07, dizz <[EMAIL PROTECTED]> wrote:
>
> Samual,
>
> Yes, I made sure that phpThumb worked on my server and double checked
> the permissions on the folder.
> I am wondering if the the problem lies in the version of Cake that I
> am using.
>

I just wanted to say something so you wouldn't feel ignored, I haven't
tried the phpThumb in either version so I can't help you with the
specifics.

I don't see anything in the component itself that looks like it
wouldn't work (from  )

Maybe if you don't get a useful answer here, try posting a comment on

 and see if that Nate has an idea of what to look for (that is not the
nate from the cake core group I think)

or a comment on the article in the bakery.

Sorry I can't actually 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: phpThumb Component

2007-03-25 Thread dizz

Samual,

Yes, I made sure that phpThumb worked on my server and double checked
the permissions on the folder.
I am wondering if the the problem lies in the version of Cake that I
am using.

Samuel DeVore wrote:
> couple things to check
>
> gd installed and active in your version of php on that server
> tmp directories are writable  (and all the little subfolders are there too)
>
> I'm not sure where the thumbcontroller is trying to write any temp or
> final files but you should make sure you know where they are, that
> they exist and they are writable.
>
>
>
> On 3/25/07, dizz <[EMAIL PROTECTED]> wrote:
> >
> > Does anyone know if this works with Cake 1.2xxx? I keep on getting the
> > following error:
> >
> > (
> > [0] => could not generate thumbnail
> > )
> >
> > Any help would be greatly appreciated.
> >
> > Thanks,
> > -Andrew
> >
> >
> > >
> >
>
>
> --
> (the old fart) the advice is free, the lack of crankiness will cost you
>
> - its a fine line between a real question and an idiot
>
> http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: phpThumb Component

2007-03-25 Thread Samuel DeVore

couple things to check

gd installed and active in your version of php on that server
tmp directories are writable  (and all the little subfolders are there too)

I'm not sure where the thumbcontroller is trying to write any temp or
final files but you should make sure you know where they are, that
they exist and they are writable.



On 3/25/07, dizz <[EMAIL PROTECTED]> wrote:
>
> Does anyone know if this works with Cake 1.2xxx? I keep on getting the
> following error:
>
> (
> [0] => could not generate thumbnail
> )
>
> Any help would be greatly appreciated.
>
> Thanks,
> -Andrew
>
>
> >
>


-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



phpThumb Component

2007-03-25 Thread dizz

Does anyone know if this works with Cake 1.2xxx? I keep on getting the
following error:

(
[0] => could not generate thumbnail
)

Any help would be greatly appreciated.

Thanks,
-Andrew


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: problems with alternative installation and acl.php

2007-03-25 Thread Stacey

still trying to work this out. i've played a bit, and it seems that
the 'CONFIG' path is not being set properly. even though i can pass
parameters along with the acl.php, it only uses them in certain
conditions. but, it is not doing anything with the 'CONFIG' path after
is has initially been set in paths.php. and, since there is no
index.php in cake's core directory, it is using the default...
\path_to_core\app. this won't work for me because my app is located in
\path_to_apps\myapp. (see structure in prior post)

can someone direct me to the proper way to set this up?


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Session->setFlash() with layout fails

2007-03-25 Thread jyrgen

i have a similar problem,

i want to have *all* system messages (incl. form validation errors) in
views
displayed in JS popups instead of html rendering.

does anybody know a smart way to accomplish this ?

thanks ! jyrgen


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Not "relative" but "absolute" link is needed.

2007-03-25 Thread skyblueink

Thanks, Stacey.
Removing the helper soved the problem.

On 3월26일, 오전1시53분, "Stacey" <[EMAIL PROTECTED]> wrote:
> i'm new to cakephp, but i believe the $html helper is your problem. i
> think it appends your site to the beginning of the link. just remove
> the helper bit and put the direct link in.
>
> On Mar 25, 11:06 am, "skyblueink" <[EMAIL PROTECTED]> wrote:
>
>
>
> > The following index.thtml gives a Google link 
> > ofhttp://www.mydomain.com/tests/http://www.google.cominsteadofhttp://www.google.com.
> >  What shoud I do to get get the correct link?
>
> > -index.thtml-
> > 
> > 
> > function insertScript(){
> > var sHTML=" > >Google";
>
> > scriptDiv.innerHTML = "
" + sHTML;} > > > > > > > > > > > > - 따온 텍스트 숨기기 - > > - 따온 텍스트 보기 - --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---

RE: Not "relative" but "absolute" link is needed.

2007-03-25 Thread Mariano Iglesias

This issue was solved some time ago. What CakePHP version are you using (as
a side note ALWAYS attach your CakePHP version when you are talking about
something that may be going wrong)

-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


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: A question on reusing ,parts'

2007-03-25 Thread francky06l

you could stick what should appear on every pages into the layout as
well ...

On Mar 25, 3:06 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> elements :)
>
> On Mar 25, 12:13 pm, "nitsuj" <[EMAIL PROTECTED]> wrote:
>
> > Hi everyone,
> > I've just started trying to use cake, I've followed a few tutorials
> > and read parts of the manual.
> > I'm now trying 'learning by doing', and have my first problem! While I
> > am quite sure this question has been asked and answered here I can't
> > find the answer.
>
> > I would like to have my login box appear on every page of my site, and
> > a few other 'parts' appear on multiple pages to.
>
> > I have read about requestAction and elements. What should I be using?
> > The manual has no search function so I have been browsing though and
> > found a very small explanation about elements, but can't find much
> > more.
>
> > If anyone could point me in the right direction it would be much
> > appreciated.
>
> > Thanks in advance,
>
> > Justin


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Not "relative" but "absolute" link is needed.

2007-03-25 Thread Stacey

i'm new to cakephp, but i believe the $html helper is your problem. i
think it appends your site to the beginning of the link. just remove
the helper bit and put the direct link in.

On Mar 25, 11:06 am, "skyblueink" <[EMAIL PROTECTED]> wrote:
> The following index.thtml gives a Google link 
> ofhttp://www.mydomain.com/tests/http://www.google.cominstead 
> ofhttp://www.google.com. What shoud I do to get get the correct link?
>
> -index.thtml-
> 
> 
> function insertScript(){
> var sHTML=" >Google";
>
> scriptDiv.innerHTML = "
" + sHTML;} > > > > > > > --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---

Re: A question about the Email component

2007-03-25 Thread Gilles Dubois

I followed the indications of article 
http://bakery.cakephp.org/articles/view/203
and now, it's Ok. Thank you.

On 19 mar, 20:27, "djiize" <[EMAIL PROTECTED]> wrote:
> did you create proper layouts in /app/views/layouts/email/ ?
> seehttp://bakery.cakephp.org/articles/view/203for more info
>
> On 19 mar, 18:44, "Gilles Dubois" <[EMAIL PROTECTED]> wrote:
>
> > CakePHP version 1.2.0.4451alpha
>
> > When calling the ->send() method on a EmailComponent object, CakePHP
> > try to used a unnamed layout. This generate an error. Here's a sample
> > code from me showing my use of this component :
>
> > $this->Email->to = $aTask['Owner']['email'];
> > $this->Email->from = $this->Session->read('Uzer.email');
> > $this->Email->cc[] = $this->Session->read('Uzer.email');
> > $this->Email->subject = 'something';
> > $this->Email->body = 'something';
> > $this->Email->send();
>
> > Is it due to a mistake I made or to a bug ?


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Session->setFlash() with layout fails

2007-03-25 Thread Preloader

Nobody an idea?

On 23 Mrz., 23:11, "Preloader" <[EMAIL PROTECTED]> wrote:
> Ah of course: I'm using Cake  1.2.x.x_22.03.2007
>
> :-)


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Securing a controller - best practice ?

2007-03-25 Thread Samuel DeVore

look at this thread


if($this->params['requested'] === true){
//do your thing here

}


On 3/25/07, Richard Uren <[EMAIL PROTECTED]> wrote:
> Hi Bakers,
>
> First off let me say cake rocks.  I've been baking for about 2 weeks now and
> I'm loving it.
>
> I've got a best practice question for y'all.
>
> Whats the _best_ way to secure my controller's public actions such that I
> can requestAction on them form other controllers but prevent users from
> calling those public actions directly (via URLs) ?
>
> Thanks.
>
> Cheers
> r
>
>
>
>
>  >
>


-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Not "relative" but "absolute" link is needed.

2007-03-25 Thread skyblueink

The following index.thtml gives a Google link of
http://www.mydomain.com/tests/http://www.google.com instead of
http://www.google.com. What shoud I do to get get the correct link?

-index.thtml-


function insertScript(){
var sHTML="Google";
scriptDiv.innerHTML = "
" + sHTML; } --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---

Re: use beforeSave only in add action

2007-03-25 Thread varunkrish

Thx for pointing out Mariano..

I understand that only controllers have actions not Models.. I was
even thinking of writing a function in the model for this Model..

if id is empty then its add - Brilliant One Mate !! just wanted this
functionality..

And I am new to CakePHP and loving it as a framework..and moving loads
of php only sites to this framework..

On Mar 25, 7:10 pm, "Mariano Iglesias" <[EMAIL PROTECTED]>
wrote:
> I think you have your concepts mixed up. Read over the three basic elements
> of an MVC framework:
>
> Controllers:http://manual.cakephp.org/chapter/controllers
> Models:http://manual.cakephp.org/chapter/models
> Views:http://manual.cakephp.org/chapter/views
>
> Controllers have $action, not models.
>
> The way to do your thing would be:
>
> function beforeSave()
> {
> if (empty($this->id))
> {
> // Adding (not editing)
> }
>
> return parent::beforeSave();
>
> }
>
> -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
>
> -Mensaje original-
> De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
> de varunkrish
> Enviado el: Domingo, 25 de Marzo de 2007 08:57 a.m.
> Para: Cake PHP
> Asunto: re:use beforeSave only in add action
>
> function beforeSave()
> {
> if($this->data){
> if($this->action=="add"){
>//load stuff
> }
>
> }
>
> this throws Notice: Undefined property: Product::$action


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



problems with alternative installation and acl.php

2007-03-25 Thread Stacey

i followed the alternative installation procedure in the cake manual.
everything works well, except i seem to be running into a lot of
pathing problems with the command line tools. first, here is my
installation structure running on a wamp server...

/wamp
/cakeapp
/mysite  <-- Used to be /cake_install/app
/config
/controllers
/models
/plugins
/tmp
/vendors
/views
index.php
/wamp
/www
/mysite  <-- Used to be /cake_install/app/
webroot
/css
/files
/img
/js
.htaccess
css.php
favicon.ico
index.php

/wamp
   /cakecore<-- Used to be /cake_install/cake
   /cake
   /config
/docs
/libs
/scripts
app_controller.php
app_model.php
basics.php
bootstrap.php
dispatcher.php
   /vendors

the current problem i'm having is with acl.

here is the output running it without any params:

C:\WAMP\cakeapp>c:\wamp\php\php.exe c:\wamp\cakecore\cake\scripts
\acl.php initdb

Warning: require(c:\WAMP\cakecore\\app\config\core.php): failed to
open stream:
No such file or directory in c:\WAMP\cakecore\cake\scripts\acl.php on
line 98

and here it is with command line options for pathing:

C:\WAMP\cakeapp>c:\wamp\php\php.exe c:\wamp\cakecore\cake\scripts
\acl.php initdb
 -core c:\wamp\cakecore\cake -app c:\wamp\cakeapp\ibmtutorial -root c:
\wamp\www\ibmtutorial

Warning: require(cake\basics.php): failed to open stream: No such file
or direct
ory in c:\WAMP\cakecore\cake\scripts\acl.php on line 95

c:\wamp\cakecore\cake\basics.php is there, but acl must not be setting
the path properly.

the path section of c:\wamp\www\ibmtutorial\index.php is as follows:

if (!defined('ROOT')) {
define('ROOT', DS.'WAMP'.DS.'CAKEAPP');
}
if (!defined('APP_DIR')) {
define('APP_DIR', 'IBMTUTORIAL');
}
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', DS.'WAMP'.DS.'CAKECORE');
}

the app is working properly. i just can't, for the life of me, figure
out how to get acl.php to run properly.

any suggestions are appreciated, as this is driving me utterly crazy =)


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: newbie baker question

2007-03-25 Thread Stacey

i'm using the latest version of cake. actually, after a bit more
research, i ran across this post...

http://groups.google.com/group/cake-php/browse_thread/thread/a66aaeacfe48a30c/08aa90865e13a781?lnk=gst&q=bake+singular&rnum=1&hl=en#08aa90865e13a781

it had the fix for the file at trac.

On Mar 25, 6:55 am, "mindcharger" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> In fcat that's wierd...it shouldn't be happening...
>
> Did you defined any rules on inflections.php (it's in $PATH_TO_CAKE\app
> \config)?
>
> Also, what Cake version you're using?
>
> Cheers!
>
> On Mar 25, 6:53 am, "Stacey" <[EMAIL PROTECTED]> wrote:
>
> > hi all,
>
> > i'm playing with bake for the first time using a tutorial i found on
> > the ibm website. after finally getting my paths right, i am confused
> > by one thing. i have a model as follows:
>
> > app\models\dealer.php
>
> >  >   class Dealer extends AppModel
> >   {
> > var $name = 'Dealer';
> > var $hasMany = array ('Product' => array(
> > 'className' => 'Product',
> > 'conditions'=>'',
> > 'order'=>'',
> > 'foreignKey'=>'dealer_id')
> > );
> >   }
> > ?>
>
> > when i use bake to create the controller, i get the following:
>
> > app\controllers\dealers_controller.php
>
> >  > class DealersController extends AppController {
>
> > var $name = 'Dealers';
> > var $helpers = array('Html', 'Form' );
>
> > function index() {
> > $this->Dealer->recursive = 0;
> > $this->set('dealers', $this->Dealer->findAll());
> > }
>
> > function view($id = null) {
> > if(!$id) {
> > $this->Session->setFlash('Invalid id for Dealer.');
> > $this->redirect('/dealer/index');
> > }
> > $this->set('dealer', $this->Dealer->read(null, $id));
> > }}
>
> > ?>
>
> > note the redirect in the view function...it has 'dealer' singular
> > instead of 'dealers'. it does the same thing for all of the others,
> > ie. add/delete/etc. i just cut them out to shorten the post.
>
> > why does it do this? i had to manually replace them to be plural so
> > that the links would work correctly. what am i doing wrong?
>
> > thanks in advance for any replies.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



RE: Admin Routing Techniques

2007-03-25 Thread Mariano Iglesias

This is wrong:

function admin_add() {
$this->requestAction($this->viewPath . '/add);
$this->render('admin_add');
}

Instead do:

function admin_add() 
{
return $this->setAction('add');
}

-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


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



RE: use beforeSave only in add action

2007-03-25 Thread Mariano Iglesias

I think you have your concepts mixed up. Read over the three basic elements
of an MVC framework:

Controllers: http://manual.cakephp.org/chapter/controllers
Models: http://manual.cakephp.org/chapter/models
Views: http://manual.cakephp.org/chapter/views

Controllers have $action, not models.

The way to do your thing would be:

function beforeSave()
{
if (empty($this->id))
{
// Adding (not editing)
}

return parent::beforeSave();
}

-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


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de varunkrish
Enviado el: Domingo, 25 de Marzo de 2007 08:57 a.m.
Para: Cake PHP
Asunto: re:use beforeSave only in add action

function beforeSave()
{
if($this->data){
if($this->action=="add"){
   //load stuff
}
}

this throws Notice: Undefined property: Product::$action


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Admin Routing Techniques

2007-03-25 Thread digital spaghetti

I had a similar quandry and came up with a simple solution - not to
use Cake's admin routing.  Instead, I've written an admin controller
that gives me a backend admin screen.  Whenever I call to a method in
another controller, I just use /path/method.

In each method, I call a session check method to see if the user has access.

Some may disagree with this method, but I feel it gives me more
control and I don't have to repeat methods with a normal and admin
version.

What I haven't done yet is a finer level of control per user group, that next.

Tane

On 3/23/07, Sonic Baker <[EMAIL PROTECTED]> wrote:
> Hi,
>
> In my current app, I've enables admin routing. There are certain actions I
> want to appear in the /admin path. Rather than repeat the logic of the
> existing actions in the admin_() actions, I thought it'd be best to just
> call these actions from the admin_() actions required.
> So, I was wondering if I would be best to simply call either requestAction()
> on the required actions, or call the action directly?
>
> e.g.
> Regular Action:
>
> function add() {
> 
> 
> // some logic
> }
>
>
> Admin Action:
>
> function admin_add() {
> $this->requestAction($this->viewPath . '/add);
> $this->render('admin_add');
> }
>
> or
>
> function add() {
> return $this->add();
> $this->render('admin_add');
> }
>
> Alternatively, has anyone come up with anything better?
> What do you think?
>
> Cheers,
>
> Sonic
>
> >
>

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: WithCake.com relaunched

2007-03-25 Thread varunkrish

Hi Jonathan,

Looks pretty :D

colors look much like ur font site

- Varun

On Mar 25, 2:22 am, "jonathan.snook" <[EMAIL PROTECTED]> wrote:
> > There's still two main features that I need to add:
> > 1) RSS feeds for the job listing
>
> Correction, just added the RSS feeds but haven't added buttons on the
> page, yet.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



re:use beforeSave only in add action

2007-03-25 Thread varunkrish

function beforeSave()
{
if($this->data){
if($this->action=="add"){
   //load stuff
}
}

this throws Notice: Undefined property: Product::$action

can anyone help me with 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?hl=en
-~--~~~~--~~--~--~---



Securing a controller - best practice ?

2007-03-25 Thread Richard Uren
Hi Bakers,

First off let me say cake rocks.  I've been baking for about 2 weeks now and
I'm loving it.

I've got a best practice question for y'all.

Whats the _best_ way to secure my controller's public actions such that I
can requestAction on them form other controllers but prevent users from
calling those public actions directly (via URLs) ?

Thanks.

Cheers
r

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: A question on reusing ,parts'

2007-03-25 Thread [EMAIL PROTECTED]

elements :)

On Mar 25, 12:13 pm, "nitsuj" <[EMAIL PROTECTED]> wrote:
> Hi everyone,
> I've just started trying to use cake, I've followed a few tutorials
> and read parts of the manual.
> I'm now trying 'learning by doing', and have my first problem! While I
> am quite sure this question has been asked and answered here I can't
> find the answer.
>
> I would like to have my login box appear on every page of my site, and
> a few other 'parts' appear on multiple pages to.
>
> I have read about requestAction and elements. What should I be using?
> The manual has no search function so I have been browsing though and
> found a very small explanation about elements, but can't find much
> more.
>
> If anyone could point me in the right direction it would be much
> appreciated.
>
> Thanks in advance,
>
> Justin


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



A question on reusing ,parts'

2007-03-25 Thread nitsuj

Hi everyone,
I've just started trying to use cake, I've followed a few tutorials
and read parts of the manual.
I'm now trying 'learning by doing', and have my first problem! While I
am quite sure this question has been asked and answered here I can't
find the answer.

I would like to have my login box appear on every page of my site, and
a few other 'parts' appear on multiple pages to.

I have read about requestAction and elements. What should I be using?
The manual has no search function so I have been browsing though and
found a very small explanation about elements, but can't find much
more.

If anyone could point me in the right direction it would be much
appreciated.

Thanks in advance,

Justin


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: newbie baker question

2007-03-25 Thread mindcharger

Hi,

In fcat that's wierd...it shouldn't be happening...

Did you defined any rules on inflections.php (it's in $PATH_TO_CAKE\app
\config)?

Also, what Cake version you're using?

Cheers!



On Mar 25, 6:53 am, "Stacey" <[EMAIL PROTECTED]> wrote:
> hi all,
>
> i'm playing with bake for the first time using a tutorial i found on
> the ibm website. after finally getting my paths right, i am confused
> by one thing. i have a model as follows:
>
> app\models\dealer.php
>
>class Dealer extends AppModel
>   {
> var $name = 'Dealer';
> var $hasMany = array ('Product' => array(
> 'className' => 'Product',
> 'conditions'=>'',
> 'order'=>'',
> 'foreignKey'=>'dealer_id')
> );
>   }
> ?>
>
> when i use bake to create the controller, i get the following:
>
> app\controllers\dealers_controller.php
>
>  class DealersController extends AppController {
>
> var $name = 'Dealers';
> var $helpers = array('Html', 'Form' );
>
> function index() {
> $this->Dealer->recursive = 0;
> $this->set('dealers', $this->Dealer->findAll());
> }
>
> function view($id = null) {
> if(!$id) {
> $this->Session->setFlash('Invalid id for Dealer.');
> $this->redirect('/dealer/index');
> }
> $this->set('dealer', $this->Dealer->read(null, $id));
> }}
>
> ?>
>
> note the redirect in the view function...it has 'dealer' singular
> instead of 'dealers'. it does the same thing for all of the others,
> ie. add/delete/etc. i just cut them out to shorten the post.
>
> why does it do this? i had to manually replace them to be plural so
> that the links would work correctly. what am i doing wrong?
>
> thanks in advance for any replies.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Are you going to let this happen?

2007-03-25 Thread sunertl

btw. today it is CakePHP 50k (!) and Symphony 3.3k :-D - that's what I
call realistic ;-)

On 25 Mrz., 09:33, "Mandy" <[EMAIL PROTECTED]> wrote:
> Went and paid my tributes :)
>
> On Mar 25, 1:03 am, "francky06l" <[EMAIL PROTECTED]> wrote:
>
> > Actually I mean 21K and about 5k for the sum of all others ...
>
> > On Mar 24, 9:00 pm, "francky06l" <[EMAIL PROTECTED]> wrote:
>
> > > Just got here and voted  hummm no doubt concerning the results,
> > > more than 21K for cake, symphony about 5K ..:-)
>
> > > On Mar 24, 7:03 pm, "Mariano Iglesias" <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > It got even more realistic:
>
> > > > CakePHP: 16,685
> > > > Symfony: 3,485
>
> > > > But that shouldn't stop you from voting, go ahead give your arrow up to
> > > > CakePHP!
>
> > > > -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
>
> > > > -Mensaje original-
> > > > De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
> > > > de [EMAIL PROTECTED]
> > > > Enviado el: Sábado, 24 de Marzo de 2007 02:53 p.m.
> > > > Para: Cake PHP
> > > > Asunto: Re: Are you going to let this happen?
>
> > > > problem solved
> > > > cake: 13k
> > > > symfony: 4k
>
> > > > :-)


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---