Saturday, July 31, 2010

Re: How to appreciate cakePHP - try the Zend Framework quickstart

Zend focuses on extendability and configuration, while CakePHP focuses
on convention and rapid deployment. They each have their strengths and
weaknesses. If you want complete control over directory structure, MVC
operation, included libraries, and all of that stuff, then Zend is a
perfectly good choice. But if you're happy with sticking to rigid
conventions and sacrificing some control for speed, then Cake is
definitely the way to go.

Cake and Zend just approach frameworks in different ways. I can tell
you one thing, though: reading and understanding Zend's code is a good
exercise. It's dense and modern (PHP5+).


On Jul 30, 3:19 am, keymaster <ad...@optionosophy.com> wrote:
> If anyone wants to reaffirm their commitment to the intelligence of
> cake, spend an hour reading thezendframework quickstart.
>
> You would not believe the amount of code and configuration involved in
> getting a simple ZF app up and running with a single controller/model
> and two actions/views (index, add).
>
> You just wouldn't believe it.

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

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

Re: session is not working between different actions on different controllers

PLUS there is need to pass session ID via URL. As cookies works ONLY
for one domain.

On Jul 31, 3:52 am, Beavis de Milo <wig...@gmail.com> wrote:
> DragonFlyEye - Isn't what Kei is attempting possible using database
> sessions?  He could store the DB session in the default database and
> each seperate app could have it's own private DB for data.
>
> On Jul 30, 12:25 pm, DragonFlyEye <dragonflyey...@gmail.com> wrote:
>
>
>
> > Well, you're not going to be able to maintain a standard session
> > across multiple domains. That's basic to sessions and cookies. You can
> > certainly create some sort of non-visible login system (like a GET
> > variable) that allows the user to see the same things on two domains,
> > but a literal session across two domains is definitely not going to
> > work.
>
> > This is less about CakePHP and more about sessions and cookies as a
> > broad subject, not really fit for this list. I suggest you do a bit of
> > research on the topic before getting in too deep.
>
> > On Jul 30, 11:15 am, Kei Simone <kimc...@gmail.com> wrote:
>
> > > Hi there,
>
> > > the idea is that i am doing something like an ecommerce platform for
> > > merchants.
>
> > > there are 2 apps because i want the shopping site to be on 1 domain
> > > and the checkout pages to be on another domain.
>
> > > so that i can use ssl on the checkout pages and that this is
> > > consistent for ALL customers who buy stuff from different merchants.
>
> > > > 1. Localhost can often be a tricky thing for cookies and sessions.
> > > > Make sure those addresses are really the way content is being served
> > > > up to the browser.
>
> > > i dont quite get this point. what do you mean by make sure the
> > > addresses are really the way content is being served?
>
> > > > 2. Cookie settings in Configure::write(): make sure they're set for
> > > > the exact same location, not /checkout and /wp
>
> > > i am just confused about this suggestion.
>
> > > On Jul 30, 10:58 pm, DragonFlyEye <dragonflyey...@gmail.com> wrote:
>
> > > > Why two separate applications for this? Is one not CakePHP?
>
> > > > Offhand, here's a few things:
> > > > 1. Localhost can often be a tricky thing for cookies and sessions.
> > > > Make sure those addresses are really the way content is being served
> > > > up to the browser.
> > > > 2. Cookie settings in Configure::write(): make sure they're set for
> > > > the exact same location, not /checkout and /wp
>
> > > > On Jul 30, 10:48 am, Kei Simone <kimc...@gmail.com> wrote:
>
> > > > > Hi all,
>
> > > > > i have 2 cake apps. localhost/wp and localhost/checkout. wp sends a
> > > > > httpsocket->post to localhost/checkout/carts/add and gets a result.
> > > > > the carts/add will set a session value. wp will use the result of the
> > > > > post and redirects to paypalsandbox. after that the paypalsandbox will
> > > > > redirect to localhost/checkout/orders/pay. however in orders/pay it
> > > > > cannot find the session written in carts/add
>
> > > > >http://picasaweb.google.com/lh/photo/o_Ylvp3uqtQer-d5HC9Lgg?feat=dire...
> > > > > describes my situation
>
> > > > > i have tried setting security to low
>
> > > > > changing to database for my session
>
> > > > > changing to custom handler where the referer_check is empty string
>
> > > > > change session cookiename
>
> > > > > change checkAgent to false
>
> > > > > so if you have any other methods, please please tell me.
>
> > > > > i am really stuck.
>
> > > > > i am not sure if this is due to the paypal page redirecting? or due to
> > > > > the fact that the place where i first write the session value i am
> > > > > used a httpsocket post.
>
> > > > > Please advise. thank you.

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

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

Re: Behavior afterFind not filtering data?

> I've discovered this because I'm attempting to run batches through the
> Console. So, I'm only using a Shell script and the Model in question
> and I'm definitely getting "?" where I should be getting ™. I've
> verified that my database.php file is using 'encoding'  => 'iso-8859-1'
> and that my core.php shows Configure::write('App.encoding',
> 'iso-8859-1'); but neither of these two things is solving the problem.

There is no ™ sign in iso-8859-1.

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

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

RE: file uploading. problems with ajax and jquery

Ok for my use I have my upload function i stripped out a lot of code as it's
just going to make it harder to understand so I just left the save then
render part.


function manage_add( $showcase_id = null ) {

//do uploading other stuff what not

$white = array('my', 'allowed', 'fields')
if ($this->Entry->save($this->data, true, $white)) {
$this->set('entry',
$this->Entry->getImageInfo($this->data['Entry']['id'],
$this->Auth->User('id')));//set whatever data you need for the element here
$this->render('/elements/entries/new_image', 'ajax'); //all
we want to render is this little block of code
} else {

//whatever render error element / message /
}
}

new_image.ctp
//so here I just return the newly uploaded image since that's all I need but
you may may not need more that that
<?php echo $html->image('entries/thumb/'.$entry['Entry']['image']); ?>

So on your page if you have a target div say in the js response / success
place that where you want it to go and all you will get is the image.

Hope that helps.

I started with this method then moved onto JSON / AJAX responses as it
allowed more flexibility for me but every situation is different so I hope
it helps.
I'm no pro so you may get better answers

Dave

-----Original Message-----
From: Tomfox Wiranata [mailto:tomfox.wiranata@gmail.com]
Sent: July-31-10 6:44 PM
To: CakePHP
Subject: Re: file uploading. problems with ajax and jquery

ok this is what i did

in my view and specifically in the div, where i want the uploaded
image to appear (told jquery to put it there in onclick), i included
this:

echo $this->element('previewProfileImage');

this ctp.-file is in views/elements/previewProfileImage.ctp

the content of this element is just for testing: (no idea yet how to
tell in the view: echo $html->image('profilepics/small/'.
$user['image_path']);)
echo "bla bla";


it works. but i still get all this other cake crap shown too..like the
sql and everything else...and not just "bla bla"

i'm getting nuts here....what am i doing wrong?

On 31 Jul., 22:45, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> Well for my set up I create an element which simply has the "uploaded
> image". Use jQuery to get the response and tell it what DIV to place the
> content in.
>
> -----Original Message-----
> From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> Sent: July-31-10 3:24 PM
> To: CakePHP
> Subject: Re: file uploading. problems with ajax and jquery
>
> dave, thx for the quick reply. i appreciate it.
>
> do you mind going into details a little? you render the div-section?
>
> On 31 Jul., 19:28, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> > Render an element containing the image uploaded.
>
> > -----Original Message-----
> > From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> > Sent: July-31-10 2:54 PM
> > To: CakePHP
> > Subject: Re: file uploading. problems with ajax and jquery
>
> > ok i found the problem:
>
> > it has to be
> > <script type="text/javascript" src="../js/ajaxupload.js"></script>
>
> > not
> > <script type="text/javascript" src="js/ajaxupload.js"></script>
>
> > but i get another one:
>
> > i see the "...loading" text for the web 2.0 feeling, BUT:
>
> > a) the image wont be uploaded. so i guess my function in controller is
> > not called. and
> > b) because i have
> >         $this->redirect(array('controller' => 'users', 'action' =>
> > 'editprofile'));
> >     in my called function i get to see the whole site in the div,
> > where the uploaded pic should appear.
>
> > but if i delete the redirect, cake asks for a view. makes sense
> > though. what do i need to change, that the whole site wont be shown in
> > this div?
>
> > thx :)
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google
Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group
> athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group
athttp://groups.google.com/group/cake-php?hl=en

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

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

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

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

Re: file uploading. problems with ajax and jquery

i appreciate it :)

thank you...

On 31 Jul., 23:26, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> Sorry for vague responses. I will show you a better example of my setup
> later.
>
> Dave
>
> -----Original Message-----
> From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> Sent: July-31-10 6:53 PM
> To: CakePHP
> Subject: Re: file uploading. problems with ajax and jquery
>
> thx dave....sorry i'm giving you such a hard time :)
>
> but where do i need to put this code? in my function
> uploadprofileimage that i am calling in my onclick() ????
>
> On 31 Jul., 23:15, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> > In the controller specify $this->render('elements/previewProfileImage');
> so
> > it will not try to load anything else
>
> > -----Original Message-----
> > From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> > Sent: July-31-10 6:44 PM
> > To: CakePHP
> > Subject: Re: file uploading. problems with ajax and jquery
>
> > ok this is what i did
>
> > in my view and specifically in the div, where i want the uploaded
> > image to appear (told jquery to put it there in onclick), i included
> > this:
>
> > echo $this->element('previewProfileImage');
>
> > this ctp.-file is in views/elements/previewProfileImage.ctp
>
> > the content of this element is just for testing: (no idea yet how to
> > tell in the view: echo $html->image('profilepics/small/'.
> > $user['image_path']);)
> > echo "bla bla";
>
> > it works. but i still get all this other cake crap shown too..like the
> > sql and everything else...and not just "bla bla"
>
> > i'm getting nuts here....what am i doing wrong?
>
> > On 31 Jul., 22:45, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> > > Well for my set up I create an element which simply has the "uploaded
> > > image". Use jQuery to get the response and tell it what DIV to place the
> > > content in.
>
> > > -----Original Message-----
> > > From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> > > Sent: July-31-10 3:24 PM
> > > To: CakePHP
> > > Subject: Re: file uploading. problems with ajax and jquery
>
> > > dave, thx for the quick reply. i appreciate it.
>
> > > do you mind going into details a little? you render the div-section?
>
> > > On 31 Jul., 19:28, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> > > > Render an element containing the image uploaded.
>
> > > > -----Original Message-----
> > > > From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> > > > Sent: July-31-10 2:54 PM
> > > > To: CakePHP
> > > > Subject: Re: file uploading. problems with ajax and jquery
>
> > > > ok i found the problem:
>
> > > > it has to be
> > > > <script type="text/javascript" src="../js/ajaxupload.js"></script>
>
> > > > not
> > > > <script type="text/javascript" src="js/ajaxupload.js"></script>
>
> > > > but i get another one:
>
> > > > i see the "...loading" text for the web 2.0 feeling, BUT:
>
> > > > a) the image wont be uploaded. so i guess my function in controller is
> > > > not called. and
> > > > b) because i have
> > > >         $this->redirect(array('controller' => 'users', 'action' =>
> > > > 'editprofile'));
> > > >     in my called function i get to see the whole site in the div,
> > > > where the uploaded pic should appear.
>
> > > > but if i delete the redirect, cake asks for a view. makes sense
> > > > though. what do i need to change, that the whole site wont be shown in
> > > > this div?
>
> > > > thx :)
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > > > with their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscribe@googlegroups.com For more options, visit this
> group
> > > athttp://groups.google.com/group/cake-php?hl=en
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscribe@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group
> athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en

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

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

RE: file uploading. problems with ajax and jquery

Sorry for vague responses. I will show you a better example of my setup
later.

Dave

-----Original Message-----
From: Tomfox Wiranata [mailto:tomfox.wiranata@gmail.com]
Sent: July-31-10 6:53 PM
To: CakePHP
Subject: Re: file uploading. problems with ajax and jquery

thx dave....sorry i'm giving you such a hard time :)

but where do i need to put this code? in my function
uploadprofileimage that i am calling in my onclick() ????

On 31 Jul., 23:15, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> In the controller specify $this->render('elements/previewProfileImage');
so
> it will not try to load anything else
>
> -----Original Message-----
> From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> Sent: July-31-10 6:44 PM
> To: CakePHP
> Subject: Re: file uploading. problems with ajax and jquery
>
> ok this is what i did
>
> in my view and specifically in the div, where i want the uploaded
> image to appear (told jquery to put it there in onclick), i included
> this:
>
> echo $this->element('previewProfileImage');
>
> this ctp.-file is in views/elements/previewProfileImage.ctp
>
> the content of this element is just for testing: (no idea yet how to
> tell in the view: echo $html->image('profilepics/small/'.
> $user['image_path']);)
> echo "bla bla";
>
> it works. but i still get all this other cake crap shown too..like the
> sql and everything else...and not just "bla bla"
>
> i'm getting nuts here....what am i doing wrong?
>
> On 31 Jul., 22:45, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> > Well for my set up I create an element which simply has the "uploaded
> > image". Use jQuery to get the response and tell it what DIV to place the
> > content in.
>
> > -----Original Message-----
> > From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> > Sent: July-31-10 3:24 PM
> > To: CakePHP
> > Subject: Re: file uploading. problems with ajax and jquery
>
> > dave, thx for the quick reply. i appreciate it.
>
> > do you mind going into details a little? you render the div-section?
>
> > On 31 Jul., 19:28, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> > > Render an element containing the image uploaded.
>
> > > -----Original Message-----
> > > From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> > > Sent: July-31-10 2:54 PM
> > > To: CakePHP
> > > Subject: Re: file uploading. problems with ajax and jquery
>
> > > ok i found the problem:
>
> > > it has to be
> > > <script type="text/javascript" src="../js/ajaxupload.js"></script>
>
> > > not
> > > <script type="text/javascript" src="js/ajaxupload.js"></script>
>
> > > but i get another one:
>
> > > i see the "...loading" text for the web 2.0 feeling, BUT:
>
> > > a) the image wont be uploaded. so i guess my function in controller is
> > > not called. and
> > > b) because i have
> > >         $this->redirect(array('controller' => 'users', 'action' =>
> > > 'editprofile'));
> > >     in my called function i get to see the whole site in the div,
> > > where the uploaded pic should appear.
>
> > > but if i delete the redirect, cake asks for a view. makes sense
> > > though. what do i need to change, that the whole site wont be shown in
> > > this div?
>
> > > thx :)
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscribe@googlegroups.com For more options, visit this
group
> > athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google
Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group
> athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group
athttp://groups.google.com/group/cake-php?hl=en

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

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

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

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

Re: file uploading. problems with ajax and jquery

thx dave....sorry i'm giving you such a hard time :)

but where do i need to put this code? in my function
uploadprofileimage that i am calling in my onclick() ????

On 31 Jul., 23:15, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> In the controller specify $this->render('elements/previewProfileImage'); so
> it will not try to load anything else
>
> -----Original Message-----
> From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> Sent: July-31-10 6:44 PM
> To: CakePHP
> Subject: Re: file uploading. problems with ajax and jquery
>
> ok this is what i did
>
> in my view and specifically in the div, where i want the uploaded
> image to appear (told jquery to put it there in onclick), i included
> this:
>
> echo $this->element('previewProfileImage');
>
> this ctp.-file is in views/elements/previewProfileImage.ctp
>
> the content of this element is just for testing: (no idea yet how to
> tell in the view: echo $html->image('profilepics/small/'.
> $user['image_path']);)
> echo "bla bla";
>
> it works. but i still get all this other cake crap shown too..like the
> sql and everything else...and not just "bla bla"
>
> i'm getting nuts here....what am i doing wrong?
>
> On 31 Jul., 22:45, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> > Well for my set up I create an element which simply has the "uploaded
> > image". Use jQuery to get the response and tell it what DIV to place the
> > content in.
>
> > -----Original Message-----
> > From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> > Sent: July-31-10 3:24 PM
> > To: CakePHP
> > Subject: Re: file uploading. problems with ajax and jquery
>
> > dave, thx for the quick reply. i appreciate it.
>
> > do you mind going into details a little? you render the div-section?
>
> > On 31 Jul., 19:28, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> > > Render an element containing the image uploaded.
>
> > > -----Original Message-----
> > > From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> > > Sent: July-31-10 2:54 PM
> > > To: CakePHP
> > > Subject: Re: file uploading. problems with ajax and jquery
>
> > > ok i found the problem:
>
> > > it has to be
> > > <script type="text/javascript" src="../js/ajaxupload.js"></script>
>
> > > not
> > > <script type="text/javascript" src="js/ajaxupload.js"></script>
>
> > > but i get another one:
>
> > > i see the "...loading" text for the web 2.0 feeling, BUT:
>
> > > a) the image wont be uploaded. so i guess my function in controller is
> > > not called. and
> > > b) because i have
> > >         $this->redirect(array('controller' => 'users', 'action' =>
> > > 'editprofile'));
> > >     in my called function i get to see the whole site in the div,
> > > where the uploaded pic should appear.
>
> > > but if i delete the redirect, cake asks for a view. makes sense
> > > though. what do i need to change, that the whole site wont be shown in
> > > this div?
>
> > > thx :)
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscribe@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group
> athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en

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

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

RE: file uploading. problems with ajax and jquery

In the controller specify $this->render('elements/previewProfileImage'); so
it will not try to load anything else

-----Original Message-----
From: Tomfox Wiranata [mailto:tomfox.wiranata@gmail.com]
Sent: July-31-10 6:44 PM
To: CakePHP
Subject: Re: file uploading. problems with ajax and jquery

ok this is what i did

in my view and specifically in the div, where i want the uploaded
image to appear (told jquery to put it there in onclick), i included
this:

echo $this->element('previewProfileImage');

this ctp.-file is in views/elements/previewProfileImage.ctp

the content of this element is just for testing: (no idea yet how to
tell in the view: echo $html->image('profilepics/small/'.
$user['image_path']);)
echo "bla bla";


it works. but i still get all this other cake crap shown too..like the
sql and everything else...and not just "bla bla"

i'm getting nuts here....what am i doing wrong?

On 31 Jul., 22:45, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> Well for my set up I create an element which simply has the "uploaded
> image". Use jQuery to get the response and tell it what DIV to place the
> content in.
>
> -----Original Message-----
> From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> Sent: July-31-10 3:24 PM
> To: CakePHP
> Subject: Re: file uploading. problems with ajax and jquery
>
> dave, thx for the quick reply. i appreciate it.
>
> do you mind going into details a little? you render the div-section?
>
> On 31 Jul., 19:28, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> > Render an element containing the image uploaded.
>
> > -----Original Message-----
> > From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> > Sent: July-31-10 2:54 PM
> > To: CakePHP
> > Subject: Re: file uploading. problems with ajax and jquery
>
> > ok i found the problem:
>
> > it has to be
> > <script type="text/javascript" src="../js/ajaxupload.js"></script>
>
> > not
> > <script type="text/javascript" src="js/ajaxupload.js"></script>
>
> > but i get another one:
>
> > i see the "...loading" text for the web 2.0 feeling, BUT:
>
> > a) the image wont be uploaded. so i guess my function in controller is
> > not called. and
> > b) because i have
> >         $this->redirect(array('controller' => 'users', 'action' =>
> > 'editprofile'));
> >     in my called function i get to see the whole site in the div,
> > where the uploaded pic should appear.
>
> > but if i delete the redirect, cake asks for a view. makes sense
> > though. what do i need to change, that the whole site wont be shown in
> > this div?
>
> > thx :)
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google
Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group
> athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group
athttp://groups.google.com/group/cake-php?hl=en

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

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

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

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

Re: file uploading. problems with ajax and jquery

ok this is what i did

in my view and specifically in the div, where i want the uploaded
image to appear (told jquery to put it there in onclick), i included
this:

echo $this->element('previewProfileImage');

this ctp.-file is in views/elements/previewProfileImage.ctp

the content of this element is just for testing: (no idea yet how to
tell in the view: echo $html->image('profilepics/small/'.
$user['image_path']);)
echo "bla bla";


it works. but i still get all this other cake crap shown too..like the
sql and everything else...and not just "bla bla"

i'm getting nuts here....what am i doing wrong?

On 31 Jul., 22:45, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> Well for my set up I create an element which simply has the "uploaded
> image". Use jQuery to get the response and tell it what DIV to place the
> content in.
>
> -----Original Message-----
> From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> Sent: July-31-10 3:24 PM
> To: CakePHP
> Subject: Re: file uploading. problems with ajax and jquery
>
> dave, thx for the quick reply. i appreciate it.
>
> do you mind going into details a little? you render the div-section?
>
> On 31 Jul., 19:28, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> > Render an element containing the image uploaded.
>
> > -----Original Message-----
> > From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> > Sent: July-31-10 2:54 PM
> > To: CakePHP
> > Subject: Re: file uploading. problems with ajax and jquery
>
> > ok i found the problem:
>
> > it has to be
> > <script type="text/javascript" src="../js/ajaxupload.js"></script>
>
> > not
> > <script type="text/javascript" src="js/ajaxupload.js"></script>
>
> > but i get another one:
>
> > i see the "...loading" text for the web 2.0 feeling, BUT:
>
> > a) the image wont be uploaded. so i guess my function in controller is
> > not called. and
> > b) because i have
> >         $this->redirect(array('controller' => 'users', 'action' =>
> > 'editprofile'));
> >     in my called function i get to see the whole site in the div,
> > where the uploaded pic should appear.
>
> > but if i delete the redirect, cake asks for a view. makes sense
> > though. what do i need to change, that the whole site wont be shown in
> > this div?
>
> > thx :)
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group
> athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en

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

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

RE: file uploading. problems with ajax and jquery

Well for my set up I create an element which simply has the "uploaded
image". Use jQuery to get the response and tell it what DIV to place the
content in.
-----Original Message-----
From: Tomfox Wiranata [mailto:tomfox.wiranata@gmail.com]
Sent: July-31-10 3:24 PM
To: CakePHP
Subject: Re: file uploading. problems with ajax and jquery

dave, thx for the quick reply. i appreciate it.

do you mind going into details a little? you render the div-section?

On 31 Jul., 19:28, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> Render an element containing the image uploaded.
>
> -----Original Message-----
> From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> Sent: July-31-10 2:54 PM
> To: CakePHP
> Subject: Re: file uploading. problems with ajax and jquery
>
> ok i found the problem:
>
> it has to be
> <script type="text/javascript" src="../js/ajaxupload.js"></script>
>
> not
> <script type="text/javascript" src="js/ajaxupload.js"></script>
>
> but i get another one:
>
> i see the "...loading" text for the web 2.0 feeling, BUT:
>
> a) the image wont be uploaded. so i guess my function in controller is
> not called. and
> b) because i have
>         $this->redirect(array('controller' => 'users', 'action' =>
> 'editprofile'));
>     in my called function i get to see the whole site in the div,
> where the uploaded pic should appear.
>
> but if i delete the redirect, cake asks for a view. makes sense
> though. what do i need to change, that the whole site wont be shown in
> this div?
>
> thx :)
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group
athttp://groups.google.com/group/cake-php?hl=en

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

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

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

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

Re: file uploading. problems with ajax and jquery

dave, thx for the quick reply. i appreciate it.

do you mind going into details a little? you render the div-section?

On 31 Jul., 19:28, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> Render an element containing the image uploaded.
>
> -----Original Message-----
> From: Tomfox Wiranata [mailto:tomfox.wiran...@gmail.com]
> Sent: July-31-10 2:54 PM
> To: CakePHP
> Subject: Re: file uploading. problems with ajax and jquery
>
> ok i found the problem:
>
> it has to be
> <script type="text/javascript" src="../js/ajaxupload.js"></script>
>
> not
> <script type="text/javascript" src="js/ajaxupload.js"></script>
>
> but i get another one:
>
> i see the "...loading" text for the web 2.0 feeling, BUT:
>
> a) the image wont be uploaded. so i guess my function in controller is
> not called. and
> b) because i have
>         $this->redirect(array('controller' => 'users', 'action' =>
> 'editprofile'));
>     in my called function i get to see the whole site in the div,
> where the uploaded pic should appear.
>
> but if i delete the redirect, cake asks for a view. makes sense
> though. what do i need to change, that the whole site wont be shown in
> this div?
>
> thx :)
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en

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

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

RE: file uploading. problems with ajax and jquery

Render an element containing the image uploaded.

-----Original Message-----
From: Tomfox Wiranata [mailto:tomfox.wiranata@gmail.com]
Sent: July-31-10 2:54 PM
To: CakePHP
Subject: Re: file uploading. problems with ajax and jquery

ok i found the problem:

it has to be
<script type="text/javascript" src="../js/ajaxupload.js"></script>

not
<script type="text/javascript" src="js/ajaxupload.js"></script>

but i get another one:

i see the "...loading" text for the web 2.0 feeling, BUT:

a) the image wont be uploaded. so i guess my function in controller is
not called. and
b) because i have
$this->redirect(array('controller' => 'users', 'action' =>
'editprofile'));
in my called function i get to see the whole site in the div,
where the uploaded pic should appear.

but if i delete the redirect, cake asks for a view. makes sense
though. what do i need to change, that the whole site wont be shown in
this div?

thx :)

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

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

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

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

Re: file uploading. problems with ajax and jquery

ok i found the problem:

it has to be
<script type="text/javascript" src="../js/ajaxupload.js"></script>

not
<script type="text/javascript" src="js/ajaxupload.js"></script>

but i get another one:

i see the "...loading" text for the web 2.0 feeling, BUT:

a) the image wont be uploaded. so i guess my function in controller is
not called. and
b) because i have
$this->redirect(array('controller' => 'users', 'action' =>
'editprofile'));
in my called function i get to see the whole site in the div,
where the uploaded pic should appear.

but if i delete the redirect, cake asks for a view. makes sense
though. what do i need to change, that the whole site wont be shown in
this div?

thx :)

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

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

file uploading. problems with ajax and jquery

hi,

i found out that its not poosible to upload files with js. so i tried
jquery. so far my uploading funtion works perfectly without ajax, but
i wanna have a loading icon during the upload, the web 2.0 feeling. i
tried to do it this way

http://elmicoxcodes.blogspot.com/2007/03/asynchronous-upload-like-ajax-1.html

in my view i have:
-----------------------------------
in the head section:
<script type="text/javascript" src="js/ajaxupload.js"></script>

then:

<form action="uploadProfileImage" method="post" name="standard_use"
id="standard_use" enctype="multipart/form-data">
<p><input type="file" name="filename" /></p>

<button onClick="ajaxUpload(this.form,'users/
uploadProfileImage','image_preview','Loading...','Error in upload');
return false;" type="button">test</button>
</form>
-----------------------------------

i put the ajaxupload.js file in webroot/js. in my "onclick" event i
try calling my function that does all the uploading and resizing.

this function is in my controller "users_controller"
-----------------------------------
function uploadProfileImage()
{

$image_path = $this->Image->upload_image_and_thumbnail($this-
>data,"",200,150,$this->Session->read('User.username'), true);

$updates = $this->User->findByUsername($this->Session-
>read('User.username'));
$updates['User']['image_path']= $updates['User']['username']."/".
$updates['User']['username'].".jpg";
$this->User->save($updates);

$this->redirect(array('controller' => 'users', 'action' =>
'editprofile'));

}
-----------------------------------
now if i select a file and hit the button, nothing happens. really
nothing..

any idea what is going wrong? i included the .js-file and i am calling
all function with its correct parameters..it seems cake wont react on
my onclick-event..

BIG THX


PS:


I N C A S E: this is the ajaxupload.js
-------------------
function $m(theVar){
return document.getElementById(theVar)
}
function remove(theVar){
var theParent = theVar.parentNode;
theParent.removeChild(theVar);
}
function addEvent(obj, evType, fn){
if(obj.addEventListener)
obj.addEventListener(evType, fn, true)
if(obj.attachEvent)
obj.attachEvent("on"+evType, fn)
}
function removeEvent(obj, type, fn){
if(obj.detachEvent){
obj.detachEvent('on'+type, fn);
}else{
obj.removeEventListener(type, fn, false);
}
}
function isWebKit(){
return RegExp(" AppleWebKit/").test(navigator.userAgent);
}
function
ajaxUpload(form,url_action,id_element,html_show_loading,html_error_http)
{
var detectWebKit = isWebKit();
form = typeof(form)=="string"?$m(form):form;
var erro="";
if(form==null || typeof(form)=="undefined"){
erro += "The form of 1st parameter does not exists.\n";
}else if(form.nodeName.toLowerCase()!="form"){
erro += "The form of 1st parameter its not a form.\n";
}
if($m(id_element)==null){
erro += "The element of 3rd parameter does not exists.\n";
}
if(erro.length>0){
alert("Error in call ajaxUpload:\n" + erro);
return;
}
var iframe = document.createElement("iframe");
iframe.setAttribute("id","ajax-temp");
iframe.setAttribute("name","ajax-temp");
iframe.setAttribute("width","0");
iframe.setAttribute("height","0");
iframe.setAttribute("border","0");
iframe.setAttribute("style","width: 0; height: 0; border: none;");
form.parentNode.appendChild(iframe);
window.frames['ajax-temp'].name="ajax-temp";
var doUpload = function(){
removeEvent($m('ajax-temp'),"load", doUpload);
var cross = "javascript: ";
cross += "window.parent.$m('"+id_element+"').innerHTML =
document.body.innerHTML; void(0);";
$m(id_element).innerHTML = html_error_http;
$m('ajax-temp').src = cross;
if(detectWebKit){
remove($m('ajax-temp'));
}else{
setTimeout(function(){ remove($m('ajax-temp'))}, 250);
}
}
addEvent($m('ajax-temp'),"load", doUpload);
form.setAttribute("target","ajax-temp");
form.setAttribute("action",url_action);
form.setAttribute("method","post");
form.setAttribute("enctype","multipart/form-data");
form.setAttribute("encoding","multipart/form-data");
if(html_show_loading.length > 0){
$m(id_element).innerHTML = html_show_loading;
}
form.submit();
}

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

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

Re: Problems with GD i Cake

Most likely you aren't passing any headers so the browser knows it's
an image. If you don't output anything else on the page, you can
vardump it. Remember, you can deliver an image like that from within a
page that has other content. It has to be a separate browser request
(with proper headers)

On Jul 30, 4:37 am, Petter Andreas Strøm <past...@gmail.com> wrote:
> Hi,
>
> I have some problems with using GD in Cakephp. Output from i.e. the
> imagejpeg() function reports just wrongly encoded data like: ...
> JFIF   ...
>
> So i was just wondering if anybody had any experience with this kind
> of problems, which seems to be an encodingproblem:P
>
> -thanks!

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

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

Re: saveAll does'nt work

I'm also have some problems with saveAll. This are the content of this
data and the relations of my model.

# $this->data
Array
(
[Usuario] => Array
(
[PK_usuario] =>
[flPf] => 1
[strNome] => Gildonei Mendes Anacleto Junior
[strLogin] => root
[strSenha] => af47g5t
[strEmail] => junior@sitecomarte.com.br
[intTelefone] =>
[intCelular] => (48)8413-4280
[flSexoMasc] => 1
[tpUsuario] => 2
[flAtivo] => 1
)

[UsuarioPf] => Array
(
[strRg] => 3879169
[intCpf] => 034.306.469-36
)

[Endereco] => Array
(
[0] => Array
(
[FK_estado] => 24
[FK_cidade] => 10
[strBairro] => Capoeiras
[strEndereco] => Srv. Alzira Ventura Vieira
[intNumero] => 40
[intCep] => 88090175
[strComplemento] => Bloco 04 Apto 301
)

)

)

# Model Usuario
class Usuario extends AppModel
{
public $name = 'Usuario';
public $useTable = 'usuarios';
public $primaryKey = 'PK_usuario';

public $hasOne = array(
'UsuarioPf' => array(
'className' => 'UsuarioPf',
'foreignKey' => 'PK_usuario',
'type' => 'LEFT'
),
'UsuarioPj' => array(
'className' => 'UsuarioPj',
'foreignKey' => 'PK_usuario',
'type' => 'LEFT'
)
);

#Model UsuarioPf
class UsuarioPf extends AppModel
{
public $name = 'UsuarioPf';
public $useTable = 'usuario_pfs';
public $primaryKey = 'PK_usuario';
public $displayField = 'intCpf';

public $belongsTo = array(
'Usuario' => array(
'className' => 'Usuario',
'foreignKey' => 'PK_usuario',
'type' => 'INNER'
)
);
# Model Endereco
class Endereco extends AppModel
{
public $name = 'Endereco';
public $useTable = 'enderecos';
public $primaryKey = 'PK_endereco';

public $belongsTo = array(
'Cidade' => array(
'className' => 'Cidade',
'foreignKey' => 'FK_cidade',
'type' => 'INNER'
),
'Usuario' => array(
'className' => 'Usuario',
'foreignKey' => 'FK_usuario',
'type' => 'INNER'
)
);

# SQL CallBacks
1 DESCRIBE `usuarios` 10 10 3
2 DESCRIBE `usuario_pfs` 3 3 4
3 DESCRIBE `usuario_pjs` 4 4 4
4 DESCRIBE `enderecos` 7 7 4
5 DESCRIBE `cidades` 3 3 4
6 DESCRIBE `estados` 3 3 3
7 DESCRIBE `pagamentos` 4 4 4
8 DESCRIBE `setores` 5 5 4
9 DESCRIBE `imagens` 9 9 4
10 SELECT `Usuario`.`PK_usuario` FROM `usuarios` AS `Usuario` LEFT
JOIN `usuario_pfs` AS `UsuarioPf` ON (`UsuarioPf`.`PK_usuario` =
`Usuario`.`PK_usuario`) LEFT JOIN `usuario_pjs` AS `UsuarioPj` ON
(`UsuarioPj`.`PK_usuario` = `Usuario`.`PK_usuario`) WHERE `strLogin` =
'root' AND `Usuario`.`PK_usuario` <> "" LIMIT 1 0 0 1
11 START TRANSACTION 0 1
12 ROLLBACK 0 1
13 SELECT `Estado`.`PK_estado`, `Estado`.`strNome` FROM `estados` AS
`Estado` WHERE 1 = 1 27 27 1
14 SELECT `Setor`.`PK_setor`, `Setor`.`strNome`,
`Setor`.`strDescricao`, `Setor`.`strController`, `Setor`.`flMenu` FROM
`setores` AS `Setor` WHERE `flMenu` = 1 10 10 1
15 SELECT `Imagem`.`PK_imagem`, `Imagem`.`FK_setor`,
`Imagem`.`FK_registro`, `Imagem`.`strNome`, `Imagem`.`strNomeDisco`,
`Imagem`.`strMime`, `Imagem`.`intSize`, `Imagem`.`intWidth`,
`Imagem`.`intHeight` FROM `imagens` AS `Imagem` WHERE
`Imagem`.`FK_setor` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) 0 0 0

Does anyone can help us?

Ty.

On 30 jul, 04:04, Vijay Kumbhar <k.vidn...@gmail.com> wrote:
> It is not working while saving the data while adding the data or while
> editing the existing data?
>
> I have the same problem with cakephp 1.3 but while editing the associated
> model data using saveAll.
> If it is not saving the data while editing then in cakephp 1.3 you have to
> specify the related model primary key with the edited record.
>
> You have to take the profile id field in you form. So that you can get it
> after posting the form.
>
> $this->User->UserProfile->id = $this->data['UserProfile']['id'];
>
> If you have defined your associations correctly between the models then it
> has to work.
>
> If you have the relation then please recheck the associations or please put
> the code here so that we can verify it & tell you appropriate solution.
>
> On Fri, Jul 30, 2010 at 11:29 AM, Norman Paniagua
> <normanpania...@gmail.com>wrote:
>
>
>
> > Can you put the model code?
> > ---
>
> > Norman Paniagua
>
> > 2010/7/30 Jeremy <shimeilin1...@gmail.com>
>
> > today, I find function saveAll can not work ,when save data into two
> >> relations tables, blew is the data,
>
> >> Array
> >> (
> >>    [User] => Array
> >>        (
> >>            [username] => tester
> >>            [password] => 17acdc1ee8e4ed05e9d27fce4df6d4b5de036910
> >>            [email] => tes...@admin.com
> >>            [country_id] => 180
> >>            [captcha_input] => uhrfca
> >>            [reg_ip] => 172.16.5.73
> >>            [confirm_code] => 4c526005-2038-4c84-b01f-0ccec0a8061f
> >>        )
>
> >>    [UserProfile] => Array
> >>        (
> >>            [birth] => 2009-02-12
> >>        )
>
> >> ), and mysql ENGINE is MyISAM , anyone know the reason ?  help me !!!
>
> >> Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> >> others with their CakePHP related questions.
>
> >> You received this message because you are subscribed to the Google Groups
> >> "CakePHP" group.
> >> To post to this group, send email to cake-php@googlegroups.com
> >> To unsubscribe from this group, send email to
> >> cake-php+unsubscribe@googlegroups.com<cake-php%2Bunsubscribe@googlegroups.com>For more options, visit this group at
> >>http://groups.google.com/group/cake-php?hl=en
>
> >  Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> > others with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com<cake-php%2Bunsubscribe@googlegroups.com>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> --
> Thanks & Regards,
> Vijayk.
>
> "You Bring the Dreams, We'll Bring the Means"

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

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

Re: Controller not working on live site

On Fri, Jul 30, 2010 at 9:58 AM, meekamoo <bryanpaddock@gmail.com> wrote:
> Hmmm the paginate array is very simple :( That's what I can't
> understand.
>
> Array
> (
>    [limit] => 3
>    [page] => 1
>    [contain] => Array
>        (
>            [Seller] => Array
>                (
>                    [User] => Array
>                        (
>                            [0] => Country
>                        )
>
>                    [0] => Agency
>                )
>
>            [0] => Location
>            [1] => SponsoredProperty
>            [2] => Favourite
>        )
>
> )
>

Any joins in the association arrays in these models? Is Cake showing
you the SQL it's running?

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

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

Re: Behavior afterFind not filtering data?

On Fri, Jul 30, 2010 at 11:03 AM, DragonFlyEye <dragonflyeye74@gmail.com> wrote:
> Ok, the problem appears to be that somewhere in the bowels of
> CakePHP's Models, it doesn't seem to like certain characters and just
> replaces them with "?"
>
> I've discovered this because I'm attempting to run batches through the
> Console. So, I'm only using a Shell script and the Model in question
> and I'm definitely getting "?" where I should be getting ™. I've
> verified that my database.php file is using 'encoding'  => 'iso-8859-1'
> and that my core.php shows Configure::write('App.encoding',
> 'iso-8859-1'); but neither of these two things is solving the problem.
>
> Cricket: I've finally convinced people here to get rid of the blasted
> weird characters and replace with HTML entities, but now the battle is
> actually getting that done! Trying to use SQL Server's Import and
> Export utility is at least as unsuccessful so far as doing it the
> CakePHP way and for a variety of reasons, I'd prefer to go CakePHP.
>

Sorry, can't help if it's a Windows environment. But my inclination
would be to convert everything to UTF-8 using iconv.

And I haven't used SQL-Server in over ten years, so I can't suggest
anything on that end.

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

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

adding "loading gif" with ajax to my uploading image process

hi,

so far i successfully coded an image upload and resize feature. but i
want my website to be web 2.0 compliant. so i read about ajax and
thought its really easy to do ajax with cake. appearently i've got
problems.

all this happens with controller "users", model "User" and View
"editProfile.ctp":

i wanna show a typical loading gif while the picture is uploaded. when
uploading is done, the gif disappears and the picture is shown.

so far i have the form in my view where i define url and options:


echo $ajax->form('User','post', array (
'url'=> array(
'controller' => 'users',
'action' => 'uploadProfileImage'
),
'update' => 'image_preview',
'before' => 'startLoading()',
'complete' => 'endloading()',
'failure' => 'failure()'
));
echo $form->file('User');
echo $form->button('Upload', array('type' => 'submit'));
echo $form->end();

with my divs in the view for showing the loading icon and picture

<div id="loading" style="display:none;">
<?php echo $html->image('../img/icons/loader.gif'); ?>
</div>

<div id="image_preview">
<?php echo $html->image('profilepics/small/'.
$user['image_path']); ?>
</div>


in the <head> section of my view

<?php
echo $this->Html->css(array('profile.css'));
echo $this->Html->charset();
echo $javascript->link('scriptaculous-js-1.8.3/lib/prototype');
echo $javascript->link('scriptaculous-js-1.8.3/src/scriptaculous');
?>


<script id="demo" type="text/javascript">

var error = false;

function startLoading(){
error=false;
Element.show('loading');
Element.hide('image_preview');
}

function endLoading(){
Element.hide('loading');
if(!error) Element.show('image_preview');
}

function failure(){
alert('Es ist ein Fehler aufgetreten');
error=true;
}

</script>

the actual uploading process is triggered in a function in my
controller

function uploadProfileImage()
{

$image_path = $this->Image->upload_image_and_thumbnail($this-
>data,"",200,150,$this->Session->read('User.username'), true);

$updates = $this->User->findByUsername($this->Session-
>read('User.username'));
$updates['User']['image_path']= $updates['User']['username']."/".
$updates['User']['username'].".jpg";
$this->User->save($updates);

$this->redirect(array('controller' => 'users', 'action' =>
'editprofile'));

}

the problem is, i only see the loading icon endlessly and it seems my
function in the controller is not called correctly.


can anyone help me?

thx :)

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

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

Re: SQL injection (multiqueries sanitization?)

On Jul 30, 8:19 pm, Hugo M <ham1...@gmail.com> wrote:
> Hi! I have a question about Model->query and sql injection. I was
> trying to sql inject my own site to see vulnerabilities, and I got:
>
> Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
> check the manual that corresponds to your MySQL server version for the
> right syntax to use near 'drop table users; select * from users WHERE
> id = 2' at line 1 [CORE/cake/libs/model/datasources/dbo_source.php,
> line 681]
>
> Query: UPDATE users SET score = score + 10; drop table users; select *
> from users WHERE id = 2

It's a fallacy that php+mysql is susceptible to multiple-query sql
injection http://php.net/manual/en/function.mysql-query.php

>
> That query works good when I do it from console!

Because the mysql cli, obviously, let's you run more than one query in
sequence.
>
> The real query is:
>
> Update users SET score = score + $param WHERE id = 2.

then try this

$param = '-100 WHERE id != 2 -- haha, everyone else loses 100 points
and everything after this gets ignored.';

>
> And $param is "10; drop table users; select * from users WHERE id = 2 ".
>
> I think cake is smart enough to cut somehow the params when they have
> a ';' inside, or something like that.

Nope, you're just doing it 'lucky'/doing it rong :).

>
> I thought this sql injection should work. I'm not happy, my system
> seems to be protected but I don't know why :S

Try this plugin https://addons.mozilla.org/en-US/firefox/addon/7597/
it'll give you some ideas if you log the queries that it executes/look
at the sort of thing it tries.

Obviously if you're /actually/ using query with user input (or update
all with user input in the where) instead of find/save/field etc.
you're completely unprotected and on your own as far as cake's
concerned - you need to escape user input.

hth,

AD

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

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

How to use ACL in theme?

I'm writing a theme and I want to display several elements depends on
ACL permission of user. I don't want to change every controller for
this change. What is the best way to do ACL checking in a theme view
file?

Koala Yeung

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

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

Friday, July 30, 2010

Re: Security Component; custom form (rich editor)

Your welcome. :)

On Jul 30, 5:32 pm, Tomatosoup <wiegersteenhui...@gmail.com> wrote:
> A bit late though, but thanks!
>
> On 11 jul, 03:48, nurvzy <nur...@gmail.com> wrote:
>
>
>
> > Set the security component to not validate that field.
>
> >http://book.cakephp.org/view/1297/Configuration
>
> > Hope that helps,
> > Nick
>
> > On Jul 10, 1:28 pm, Tomatosoup <wiegersteenhui...@gmail.com> wrote:
>
> > > Hello,
>
> > > I use the Security component, but one (kind of custom) form gets
> > > invalidated.
>
> > > Is there some way to validate an invalidated (because of the token the
> > > Security component generates) form?
>
> > > Because I have an edit page in which I have a DIV that acts as a Rich
> > > Text Editor. Whenever one clicks the submit button the HTML content of
> > > the DIV is transferred into a hidden form field.
>
> > > Much thanks in advance for any advice.

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

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

Re: SQL injection (multiqueries sanitization?)

As far as I know Model->query() is not escaped or protected in any
other way
you need to use find() etc in order to use safe sql queries


On 30 Jul., 20:19, Hugo M <ham1...@gmail.com> wrote:
> Hi! I have a question about Model->query and sql injection. I was
> trying to sql inject my own site to see vulnerabilities, and I got:
>
> Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
> check the manual that corresponds to your MySQL server version for the
> right syntax to use near 'drop table users; select * from users WHERE
> id = 2' at line 1 [CORE/cake/libs/model/datasources/dbo_source.php,
> line 681]
>
> Query: UPDATE users SET score = score + 10; drop table users; select *
> from users WHERE id = 2
>
> That query works good when I do it from console!
>
> The real query is:
>
> Update users SET score = score + $param WHERE id = 2.
>
> And $param is "10; drop table users; select * from users WHERE id = 2 ".
>
> I think cake is smart enough to cut somehow the params when they have
> a ';' inside, or something like that.
>
> I thought this sql injection should work. I'm not happy, my system
> seems to be protected but I don't know why :S

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

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

Re: Security Component; custom form (rich editor)

A bit late though, but thanks!

On 11 jul, 03:48, nurvzy <nur...@gmail.com> wrote:
> Set the security component to not validate that field.
>
> http://book.cakephp.org/view/1297/Configuration
>
> Hope that helps,
> Nick
>
> On Jul 10, 1:28 pm, Tomatosoup <wiegersteenhui...@gmail.com> wrote:
>
>
>
> > Hello,
>
> > I use the Security component, but one (kind of custom) form gets
> > invalidated.
>
> > Is there some way to validate an invalidated (because of the token the
> > Security component generates) form?
>
> > Because I have an edit page in which I have a DIV that acts as a Rich
> > Text Editor. Whenever one clicks the submit button the HTML content of
> > the DIV is transferred into a hidden form field.
>
> > Much thanks in advance for any advice.

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

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

Re: generatetreelist; similar function for retrieving depth

Yes, that would work too.
Thanks :)

(for some reason this message didn't get posted earlier)

On 30 jul, 13:55, Jon Bennett <jmbenn...@gmail.com> wrote:
> you could use getpath, eg:
>
> count($this->Model->getpath($id, array('id')));
>
> hth
>
> Jon

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

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

Re: generatetreelist; similar function for retrieving depth

Yes, that would work too.
Thanks :)

On 30 jul, 13:55, Jon Bennett <jmbenn...@gmail.com> wrote:
> you could use getpath, eg:
>
> count($this->Model->getpath($id, array('id')));
>
> hth
>
> Jon
>
> On 30 July 2010 12:45, Tomatosoup <wiegersteenhui...@gmail.com> wrote:
>
>
>
>
>
> > Hello,
>
> > Does anybody know of a function likegeneratetreelistthat seperates
> > the depth from the value. Instead of counting the spacer chars.
>
> > I saw an SQL query in the explanation page of MySQL.
> > It's this page:http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
>
> > This is the query:
> > SELECT node.name, (COUNT(parent.name) - 1) AS depth
> > FROM nested_category AS node,
> > nested_category AS parent
> > WHERE node.lft BETWEEN parent.lft AND parent.rgt
> > GROUP BY node.name
> > ORDER BY node.lft;
>
> > I don't know how I would use this query with find.
> > Though I could use the custom-query-function.
>
> > The thing is; I would like to seperate depth and the value of my tree
> > (categories). Then I can filter it withhtmlentities(the category
> > names), without usinghtmlentitieson the spacer.
>
> > So if anybody can point me in the right direction I would be very
> > pleased.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en
>
> --
> jon bennett -www.jben.net- blog.jben.net

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

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