Re: Uploading an file overwrites the name-field

2009-04-25 Thread thatsgreat2345

No need for a workaround, just show us your form as I assume it is
incorrect.

On Apr 25, 6:35 pm, Aurelius  wrote:
> I already did a workaround, not really clean, but it works and I'm a
> bit in a hurry
> thx!
>
> On 26 Apr., 03:17, Miles J  wrote:
>
> > Can we see your action/model code for it.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Uploading an file overwrites the name-field

2009-04-25 Thread Aurelius

I already did a workaround, not really clean, but it works and I'm a
bit in a hurry
thx!


On 26 Apr., 03:17, Miles J  wrote:
> Can we see your action/model code for it.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Uploading an file overwrites the name-field

2009-04-25 Thread Miles J

Can we see your action/model code for it.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Can not get CakePHP to work with iPhone web app kit "iui"

2009-04-25 Thread cpeele

ok, I tried as you suggested and when the js and css files are in the
cakephp js and css folders it doesn't work. If I have the path point
just to the iui folder that contains the libraries it works.

can you show me what paths in your css files are pointing to the
images and also what directory structure you are using?

Thank you so much,

Chris

On Apr 24, 9:49 pm, Teh Treag  wrote:
> Chris,
>
> I use iui on one of my sites. Your description of your install sound
> ok. Are the uris to the files correct?  Iui is a little quirky, I
> would sugguest you temporarily elimate cakephp as potentially part of
> the problem and try a static HTML/php page in $app/webroot. once you
> can confirm that works, then you can try the integration with
> cakephp.
>
> I do have a page using cakephp and iui.http://iheartstar.com
>
> BTW - I don't use iui for new development.
>
> -teh
>
> On Apr 24, 5:40 pm, cpeele  wrote:
>
> > Hey guys, I have been trying to get CakePHP to work with the iPhone
> > web app js and css library "iui" and always run into problems with it
> > when it comes to CakePHP finding the files.
>
> > I was able to do this without CakePHP. I know it is my lack of
> > understanding of how best to include a third party js and css library
> > into CakePHP framework
>
> > The iui library consists of some images, js and css files with the
> > path to the img files hardcoded in the css (i.e. url(myImage.png) ).
>
> > To go along with the way CakePHP does things I removed the images from
> > their image folder within the iui folder and placed them in the img
> > folder within "webroot". I then placed the js and css files in their
> > respective webroot folders as well.
>
> > Then, since the css styles were looking for the image files in the
> > image folder they came with I had to go and change the path to each
> > and every style so that they could find the images within the webroot
> > img folder.
>
> > I then referenced the styles and js scripts like so:
>
> >  >         $html->css('iui', null, null, false);
> >         $javascript->link('iui', false);
> > ?>
>
> > When I go to view the page in the browser everything goes blank.
> > When I view the page source, this is the path to the files it shows:
>
> >         
> >         

Re: Can not get CakePHP to work with iPhone web app kit "iui"

2009-04-25 Thread cpeele


ok, will do, I will get back with you.
Thank you so much

On Apr 24, 9:49 pm, Teh Treag  wrote:
> Chris,
>
> I use iui on one of my sites. Your description of your install sound
> ok. Are the uris to the files correct?  Iui is a little quirky, I
> would sugguest you temporarily elimate cakephp as potentially part of
> the problem and try a static HTML/php page in $app/webroot. once you
> can confirm that works, then you can try the integration with
> cakephp.
>
> I do have a page using cakephp and iui.http://iheartstar.com
>
> BTW - I don't use iui for new development.
>
> -teh
>
> On Apr 24, 5:40 pm, cpeele  wrote:
>
> > Hey guys, I have been trying to get CakePHP to work with the iPhone
> > web app js and css library "iui" and always run into problems with it
> > when it comes to CakePHP finding the files.
>
> > I was able to do this without CakePHP. I know it is my lack of
> > understanding of how best to include a third party js and css library
> > into CakePHP framework
>
> > The iui library consists of some images, js and css files with the
> > path to the img files hardcoded in the css (i.e. url(myImage.png) ).
>
> > To go along with the way CakePHP does things I removed the images from
> > their image folder within the iui folder and placed them in the img
> > folder within "webroot". I then placed the js and css files in their
> > respective webroot folders as well.
>
> > Then, since the css styles were looking for the image files in the
> > image folder they came with I had to go and change the path to each
> > and every style so that they could find the images within the webroot
> > img folder.
>
> > I then referenced the styles and js scripts like so:
>
> >  >         $html->css('iui', null, null, false);
> >         $javascript->link('iui', false);
> > ?>
>
> > When I go to view the page in the browser everything goes blank.
> > When I view the page source, this is the path to the files it shows:
>
> >         
> >         

Uploading an file overwrites the name-field

2009-04-25 Thread Aurelius

Hi!

I've a form with data[Blog][name] and data[Blog][pdf]
But when uploading the pdf, the $this->data[Blog][name] is now an
array with $this->data[Blog][name][pdf] = "blog.pdf"
Any Ideas?

How can I solve that?

thx
Aurelius
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Pulling data to use in default.ctp menu

2009-04-25 Thread qwanta

I had a similar problem (display the logged in username in the
default.ctp header), and used the beforeFilter function in the
app_controller. This is a function that when defined in a controller
will execute before any controller action, so if you place it in
app_controller.php the same code will execute before any action in any
controllers and you can do your $this->set() there to setup your list
for the default.ctp view.

A word of caution, if you define beforeFilter in a normal controller.
be sure to call:
parent::beforeFilter();
so that the app_controller beforeFIlter executes.


On Apr 22, 10:58 am, blake  wrote:
> Hello,
>
> I have a menu being generated in my default.ctp file, and I need the
> menu options to change depending on a users permissions. I have a
> component to handle all the checking and returning an array I can use,
> but I am unsure how to properly get that data into the default.ctp
> layout.
>
> What controller would I use the component in to pass the data through
> to default.ctp?
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: modifying a Baked function

2009-04-25 Thread Teedaddy

Also, it would be nice to know how to pass the user id in $htmlhelper
links to assure only related user rows are returned.

Bret

On Apr 25, 6:06 pm, Teedaddy  wrote:
> Thanks for the response.
>
> The main thing I am trying to do is make sure my index.ctp, view.ctp,
> and add.ctp pages only return and show the data for the current logged
> in user.id.
>
> For instance, it is easy enough to work with related data to a
> specific user after they are selected from the user view but if I want
> to add new records to a related table, the Baked forms for add.ctp
> show all the users in the users table in a pull down input field. I
> deally this would be a hidden input of just the user.id from the
> view.ctp. I want to make sure any new rows added are automatically
> assigned to the specific user, once they are logged in. This seems
> like it should be simple, but everything I try does not work.
>
> On Apr 23, 7:58 pm, brian  wrote:
>
> > On Thu, Apr 23, 2009 at 11:17 AM, Teedaddy  wrote:
>
> > > hello friends, I am VERY new to all the cakePHP methods, so, any help
> > > would be much appreciated.
>
> > > I have built my database tables and have Baked all Models,
> > > Controllers, and Views. Everything is working as expected with the
> > > relations and interaction with the  db tables.
>
> > > I am now trying to customize the view, add, and edit functions. The
> > > main thing I need to do is make many of the views, User.id specific
> > > and can't for the life of me figure out the best way to do that.
>
> > Define "User.id specific". Do you mean that you need to save a user_id
> > foreign key with your data? Are you saving the user to a session when
> > logged in?
>
> > > Here is a sample of code of what I am trying to do. I just want the
> > > add form to grab the current User.id for saving to the database.
>
> > > function writer_add() {
> > >                if (!empty($this->data)) {
> > >                        $this->Writer->create();
> > >                        if ($this->Writer->save($this->data)) {
> > >                                $this->Session->setFlash(__('The Writer 
> > > has been saved', true));
> > >                                $this->redirect(array('action'=>'index'));
> > >                        } else {
> > >                                $this->Session->setFlash(__('The Writer 
> > > could not be saved.
> > > Please, try again.', true));
> > >                        }
> > >                }
> > >                $users = $this->Writer->User->find('first', array('User' =>
> > > 'User.id'));
> > >                $this->set(compact('users'));
> > >        }
>
> > This makes no sense. If you want find a *specific* ('first') User,
> > then you need to put 'User.id' on the left side and pass a $user_id on
> > the right. Also, though it's not too big a deal, I guess your var
> > should be $user, not $users.
>
> > Anyway, if you save the User to the session when they log in, you
> > won't need to do a find() here. Maybe you should explain what it is
> > you're trying to do.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: modifying a Baked function

2009-04-25 Thread Teedaddy

Thanks for the response.

The main thing I am trying to do is make sure my index.ctp, view.ctp,
and add.ctp pages only return and show the data for the current logged
in user.id.

For instance, it is easy enough to work with related data to a
specific user after they are selected from the user view but if I want
to add new records to a related table, the Baked forms for add.ctp
show all the users in the users table in a pull down input field. I
deally this would be a hidden input of just the user.id from the
view.ctp. I want to make sure any new rows added are automatically
assigned to the specific user, once they are logged in. This seems
like it should be simple, but everything I try does not work.

On Apr 23, 7:58 pm, brian  wrote:
> On Thu, Apr 23, 2009 at 11:17 AM, Teedaddy  wrote:
>
> > hello friends, I am VERY new to all the cakePHP methods, so, any help
> > would be much appreciated.
>
> > I have built my database tables and have Baked all Models,
> > Controllers, and Views. Everything is working as expected with the
> > relations and interaction with the  db tables.
>
> > I am now trying to customize the view, add, and edit functions. The
> > main thing I need to do is make many of the views, User.id specific
> > and can't for the life of me figure out the best way to do that.
>
> Define "User.id specific". Do you mean that you need to save a user_id
> foreign key with your data? Are you saving the user to a session when
> logged in?
>
>
>
> > Here is a sample of code of what I am trying to do. I just want the
> > add form to grab the current User.id for saving to the database.
>
> > function writer_add() {
> >                if (!empty($this->data)) {
> >                        $this->Writer->create();
> >                        if ($this->Writer->save($this->data)) {
> >                                $this->Session->setFlash(__('The Writer has 
> > been saved', true));
> >                                $this->redirect(array('action'=>'index'));
> >                        } else {
> >                                $this->Session->setFlash(__('The Writer 
> > could not be saved.
> > Please, try again.', true));
> >                        }
> >                }
> >                $users = $this->Writer->User->find('first', array('User' =>
> > 'User.id'));
> >                $this->set(compact('users'));
> >        }
>
> This makes no sense. If you want find a *specific* ('first') User,
> then you need to put 'User.id' on the left side and pass a $user_id on
> the right. Also, though it's not too big a deal, I guess your var
> should be $user, not $users.
>
> Anyway, if you save the User to the session when they log in, you
> won't need to do a find() here. Maybe you should explain what it is
> you're trying to do.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



User Id Question

2009-04-25 Thread Teedaddy

Could someone be so kind to tell me the easiest way to pass the
current logged in "Auth" user id in $htmlhelper links?

Thank you so much, just learning all this MVC method and have been
through Auth tutorials numerous times but I am missing this somehow.

Bret
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP not working - cake.generic.css not found

2009-04-25 Thread Aivaras
If you have a server and ssh access (which I assume you due, because you
told you had online server) you can easily change permissions.

FYI: you don't need to do chmod 777 /cake/tmp/ -R
It's enough to do chown www-data:www-data /cake/tmp/ -R more security, less
log-reading then :p

Another thing, check your mode-rewrite. If cake's CSS isn't being loaded
it's definitely a conf problem.

Have you set your DocRoot to /cake/app/webroot/ ?

Faifas


On Fri, Apr 24, 2009 at 18:04, Nature Lover wrote:

>
> What can I do for the online server
>
> There owner cannot be changed
> Permissions I have assigned
> But still not working
>
> Thanks for the reply!
>
> On Apr 24, 8:02 pm, Faza  wrote:
> > Make sure that the directory is chown to www server's user.
> >
> > e.g. in my Debian I did:
> > chown -R www-data:www-data /path/to/cake/
> > chmod -R 755 /path/to/cake
> > chmod -R 777 /path/to/cake/tmp
> >
> > Never had any permission-related issues.
> >
> > Nature Lover pisze:
> >
> > > Hi!
> >
> > > I have downloaded CakePHP latest stable release.
> > > extracted on the test server with 755 permission on everything and 777
> > > on tmp folder.
> >
> > > The home page is showing with the default layout but not stylesheet
> > > coloring.
> > > In the FireBug HTML coding the 404 errors is return for default
> > > stylesheet of cake
> >
> > > Please help me to set the permissions on folders
> >
> > > Thanks!
> >
>

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: MeioUpload Problem

2009-04-25 Thread Aivaras
Why in this world you're using $form->label()? CakePHP isn't that
complicated :o

Did you actually check for any errors in the behaviour itself? Try to debug
parts of the code: start with small ones then go bigger and see where it
breaks. Then you will definitely find an answer :)

Cheers,
Faifas


On Sat, Apr 25, 2009 at 01:18, Arak Tai'Roth wrote:

>
> Anyone at all? I could really use some help on this.
>
> On Apr 21, 1:02 pm, "Arak Tai'Roth"  wrote:
> > Anyone have any ideas on this topic?
> >
> > On Apr 20, 5:16 pm, "Arak Tai'Roth"  wrote:
> >
> > > Yup, the exact same permissions as the banners directory
> >
> > > On Apr 20, 4:09 pm, brian  wrote:
> >
> > > > Are the permissions for the posters dir good?
> >
> > > > On Mon, Apr 20, 2009 at 4:56 PM, Arak Tai'Roth <
> nielsen.dus...@gmail.com> wrote:
> >
> > > > > So I have my MeioUpload set up:
> >
> > > > >var $actsAs = array(
> > > > >'MeioUpload' => array(
> > > > >'banner' => array(
> > > > >'dir' =>
> 'img/events/banners',
> > > > >'create_directory' => false,
> > > > >'allowed_mime' =>
> array('image/jpeg', 'image/pjpeg', 'image/
> > > > > png'),
> > > > >'allowed_ext' =>
> array('.jpeg', '.jpg', '.png'),
> > > > >'thumbsizes' => array(
> > > > >'large' =>
> array('width' => 950, 'height' => 170)
> > > > >)
> > > > >),
> > > > >'poster' => array(
> > > > >'dir' =>
> 'img/events/posters',
> > > > >'create_directory' => false,
> > > > >'allowed_mime' =>
> array('image/jpeg', 'image/pjpeg', 'image/
> > > > > png'),
> > > > >'alowed_ext' =>
> array('.jpeg', '.jpg', '.png'),
> > > > >'thumbsizes' => array(
> > > > >'large' =>
> array('width' => 300, 'height' => 465)
> > > > >)
> > > > >)
> > > > >),
> > > > >'Sluggable' => array(
> > > > >'label' => 'name',
> > > > >'overwrite' => true
> > > > >)
> > > > >);
> >
> > > > > and it works great. However there is one problem, the poster
> picture
> > > > > uploads, but no thumbnail is generated. I can't figure out for the
> > > > > life of my why no thumbnail is generated. My code for the add and
> edit
> > > > > views are:
> >
> > > > >echo $form->label('Event.banner',
> 'Banner:');
> > > > >echo $form->input('Event.banner',
> array('label' => false, 'type' =>
> > > > > 'file'));
> >
> > > > >echo $form->label('Event.poster',
> 'Poster:');
> > > > >echo $form->input('Event.poster',
> array('label' => false, 'type' =>
> > > > > 'file'));
> >
> > > > > So still the same code between them, just different variable names,
> > > > > yet it doesn't work.
> >
> > > > > Does anyone have a clue why the banner image would be uploaded and
> > > > > thumbnailed appropriately, but the poster image wouldn't be?
> >
>

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Where do I start if I was SQL injected?

2009-04-25 Thread Aivaras
Linai,

pasidaryk Modelyje f-ja beforeSave(){ ir ten ikalk $this->data =
Sanitize::paranoid($this->data); } ir vsio, iskals tau viska ;) Dar server
apachej ar SQL uzsetink magic_quotes_gpc on (nors ciuju php.ini). Sekmes :)

English:
Linasm

rewrite Model's beforeSave method to beforeSave($this->data =
Sanitize::paranoid($this->data)) and that will seriously help you. You can
also set you magic_quotes_gpc = on; in your php.ini. Good luck! :)

Faifas


On Sat, Apr 25, 2009 at 21:57, mscdex  wrote:

>
> On Apr 25, 2:05 pm, Linas  wrote:
> > So the save() method doesn't do much about security?
> > I understand that it cannot detect problems you've mentioned. Does it
> > at least escape data properly?
> > What are the patterns/advice for doing things correctly? When looking
> > at how to develop with Cake PHP I never saw any advice on how to
> > validate if the hidden fields, etc weren't changed. Although I realize
> > now that it is very important.
>
> If you're not using the Security component, then using hidden fields
> to store valuable data can lead to trouble since anyone can then
> change that value and the server would never know about it. The other
> option of course is to not use hidden fields and get the same data
> that would have been stored in these fields either from the user
> session perhaps or by doing a find or other query.
>
> It may also be wise to use the Sanitize class (http://book.cakephp.org/
> view/153/Data-Sanitization)
> to clean the data before inserting it into
> your database (to strip out or escape HTML, etc. that may have been
> submitted).
>
> Also, one last thing is that $this->Model->save() has a 'fieldList'
> parameter (or array index depending on your usage of save) that allows
> you to specify only the fields in $this->data that should be saved.
> This will prevent other data that has been injected into the HTML form
> on the client-side from making its way into your database when the
> form is submitted to the server.
> >
>

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Tips for cutting queries and load time?

2009-04-25 Thread Miles J

Make sure you have indexes set on your database.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Where do I start if I was SQL injected?

2009-04-25 Thread mscdex

On Apr 25, 2:05 pm, Linas  wrote:
> So the save() method doesn't do much about security?
> I understand that it cannot detect problems you've mentioned. Does it
> at least escape data properly?
> What are the patterns/advice for doing things correctly? When looking
> at how to develop with Cake PHP I never saw any advice on how to
> validate if the hidden fields, etc weren't changed. Although I realize
> now that it is very important.

If you're not using the Security component, then using hidden fields
to store valuable data can lead to trouble since anyone can then
change that value and the server would never know about it. The other
option of course is to not use hidden fields and get the same data
that would have been stored in these fields either from the user
session perhaps or by doing a find or other query.

It may also be wise to use the Sanitize class (http://book.cakephp.org/
view/153/Data-Sanitization) to clean the data before inserting it into
your database (to strip out or escape HTML, etc. that may have been
submitted).

Also, one last thing is that $this->Model->save() has a 'fieldList'
parameter (or array index depending on your usage of save) that allows
you to specify only the fields in $this->data that should be saved.
This will prevent other data that has been injected into the HTML form
on the client-side from making its way into your database when the
form is submitted to the server.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Where do I start if I was SQL injected?

2009-04-25 Thread AD7six



On Apr 25, 8:05 pm, Linas  wrote:
> So the save() method doesn't do much about security?

It has a field list which is a first line of defence:
http://api.cakephp.org/class/model#method-Modelsave

> I understand that it cannot detect problems you've mentioned. Does it
> at least escape data properly?

Yes.

> What are the patterns/advice for doing things correctly?

Use whitelists (fieldlist in save), validation and the security
component.

Don't trust your users :). Assume you're going to receive garbage/
manipulated data/users adding their own data etc. And try and do what
they're going to do.

This is pretty useful:
https://addons.mozilla.org/en-US/firefox/addon/7597

In addition to the obvious firebug + editing html directly.

> When looking
> at how to develop with Cake PHP I never saw any advice on how to
> validate if the hidden fields, etc weren't changed. Although I realize
> now that it is very important.

This is one of the primary functions of the security component.

One caveat: it won't detect a user 'selecting' an option in a select
that isn't a valid value (because doing so doesn't change the
structure of the form).

hth,

AD
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Fatal error: Call to undefined method stdClass::find() in cake\libs\controller\controller.php on line 1063

2009-04-25 Thread Minkbear

I moved to CakePHP 1.2.2.8120 and tried to call url,
http:///admin/magazines/index, got this error:

Notice (8): Undefined property: stdClass::$alias [CORE\cake\libs
\controller\controller.php, line 977]
Code | Context
$object =   stdClass
stdClass::$recursive = 0
$scope  =   array()
$whitelist  =   array()
$assoc  =   null
$options=   array(
"pass" => array(),
"named" => array(),
"controller" => "magazines",
"action" => "admin_index",
"plugin" => null,
"prefix" => "admin",
"admin" => true,
"form" => array(),
"url" => "admin/magazines/index"
)
$options = array_merge($this->params, $this->params['url'],
$this->passedArgs);

if (isset($this->paginate[$object->alias])) {
Controller::paginate() - CORE\cake\libs\controller\controller.php,
line 977
MagazinesController::admin_index() - APP\controllers
\magazines_controller.php, line 27
Object::dispatchMethod() - CORE\cake\libs\object.php, line 115
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194
[main] - APP\webroot\index.php, line 88

Fatal error: Call to undefined method stdClass::find() in C:\Program
Files\xampp\htdocs\cakefinal\cake\libs\controller\controller.php on
line 1063

Code in magazines_controller.php is:
var $name = 'Magazines';
var $uses = array('Column', 'MagazineColumn');

function admin_index() {
$this->Magazine->recursive = 0;
$this->set('magazines', $this->paginate());
}

need help.
thank you in advance.

minkbear

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Where do I start if I was SQL injected?

2009-04-25 Thread Linas

So the save() method doesn't do much about security?
I understand that it cannot detect problems you've mentioned. Does it
at least escape data properly?
What are the patterns/advice for doing things correctly? When looking
at how to develop with Cake PHP I never saw any advice on how to
validate if the hidden fields, etc weren't changed. Although I realize
now that it is very important.

Linas

On Apr 25, 4:10 pm, James K  wrote:
> This would be just as easy to achieve with Firefox and the Firebug
> extension. This would give your students the ability to change the
> HTML on the client-side, add form fields into your web forms or change
> the primary keys in hidden form fields. If you're not doing any
> validation on the server side of the data (meaning the number of form
> fields you sent to the view are the same number that are coming back,
> or the same primary keys you put as hidden fields didn't change), it
> would be a piece of cake (har har) to inject any data into your
> database for the model that form operates on.
>
> Look into using the Security component, or be less trusting of your
> form input. By just saving $this->data, you have no idea how people
> have changed your form on the client in the meantime. (also you should
> technically do $this->Model->create($this->data) then do $this->Model-
>
> >save() )
>
> - James
>
> On Apr 25, 3:30 am, Linas  wrote:
>
> > On Apr 25, 4:20 am, James K  wrote:
>
> > > How do you know it was SQL injection? What exactly happened?
>
> > Well, it's a webpage I use to teach algorithms (http://ims.mii.lt/
> > ~linas/mokykla, it's in lithuanian).
> > These kids are pretty smart, and so one week I just saw a number of
> > new users created, my password was changed and so on. They just let me
> > understand that they can do any query they want. This is not a big
> > problem, because they would not do anything wicked (I hope), but
> > still, I would like to fix that. Mysql query logs were off. Which logs
> > should I check?
>
> > Linas
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: contain HABTM

2009-04-25 Thread Dave Maharaj :: WidePixels.com

'contain' => array(
'Subject' => array('fields' => array('Subject.name')),

 The array looks like this 

[Subject] => Array
(
[0] => Array
(
[name] => Political Science
[PostsSubject] => Array
(
[id] => 1
[post_id] => 1
[subject_id] => 1
)

)

What I do not need is anything in the PostsSubjects array and want to remove
that. 

-Original Message-
From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com] 
Sent: April-25-09 2:14 PM
To: cake-php@googlegroups.com
Subject: RE: contain HABTM


Sorry for the confusion.

The POST has about 10 other tables its related to but I do not want to pull
all that data associated with it. So I am trying to contain the tables I
needed and the fields.



-Original Message-
From: brian [mailto:bally.z...@gmail.com]
Sent: April-25-09 12:54 PM
To: cake-php@googlegroups.com
Subject: Re: contain HABTM


Yeah, I should have been more clear. I'm assuming that the Post info is
being fetched, also.

On Sat, Apr 25, 2009 at 3:54 AM, rich...@home 
wrote:
>
> You don't need contain, unless you want the post data too:
>
> $this->Post->Subject->find("all", array(
>  "conditions"=>array(
>    "Subject.post_id"=>$post_id
>  )
> );
>
> If you do need the post data, brian's solution should work just fine.
>
> On Apr 25, 5:21 am, brian  wrote:
>> This doesn't work?
>>
>> $this->find(
>>         'first',
>>         array(
>>                 'conditions' => array(
>>                         'Post.id' => $post_id
>>                 ),
>>                 'contain' => array(
>>                         'Subject'
>>                 )
>>         )
>> );
>>
>> On Fri, Apr 24, 2009 at 11:30 PM, Dave Maharaj :: WidePixels.com
>>
>>  wrote:
>> > Can someone help me with a contain using a HABTM relationship.
>> > POSTS HABTM SUBJECTS
>> > SUBJECTS
>> > POSTS_SUBJECTS
>>
>> > I have Post HABTM SUBECTS
>>
>> > I just want to print out the array of SUBJECTS that the POST has.
>>
>> > I managed to get the rest of the contain for the other hasmany 
>> > tables...just cant get the HABTM
>>
>> > Thanks
>>
>> > Dave
> >
>





--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: contain HABTM

2009-04-25 Thread Dave Maharaj :: WidePixels.com

Sorry for the confusion.

The POST has about 10 other tables its related to but I do not want to pull
all that data associated with it. So I am trying to contain the tables I
needed and the fields.



-Original Message-
From: brian [mailto:bally.z...@gmail.com] 
Sent: April-25-09 12:54 PM
To: cake-php@googlegroups.com
Subject: Re: contain HABTM


Yeah, I should have been more clear. I'm assuming that the Post info is
being fetched, also.

On Sat, Apr 25, 2009 at 3:54 AM, rich...@home 
wrote:
>
> You don't need contain, unless you want the post data too:
>
> $this->Post->Subject->find("all", array(
>  "conditions"=>array(
>    "Subject.post_id"=>$post_id
>  )
> );
>
> If you do need the post data, brian's solution should work just fine.
>
> On Apr 25, 5:21 am, brian  wrote:
>> This doesn't work?
>>
>> $this->find(
>>         'first',
>>         array(
>>                 'conditions' => array(
>>                         'Post.id' => $post_id
>>                 ),
>>                 'contain' => array(
>>                         'Subject'
>>                 )
>>         )
>> );
>>
>> On Fri, Apr 24, 2009 at 11:30 PM, Dave Maharaj :: WidePixels.com
>>
>>  wrote:
>> > Can someone help me with a contain using a HABTM relationship.
>> > POSTS HABTM SUBJECTS
>> > SUBJECTS
>> > POSTS_SUBJECTS
>>
>> > I have Post HABTM SUBECTS
>>
>> > I just want to print out the array of SUBJECTS that the POST has.
>>
>> > I managed to get the rest of the contain for the other hasmany 
>> > tables...just cant get the HABTM
>>
>> > Thanks
>>
>> > Dave
> >
>



--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: contain HABTM

2009-04-25 Thread brian

Yeah, I should have been more clear. I'm assuming that the Post info
is being fetched, also.

On Sat, Apr 25, 2009 at 3:54 AM, rich...@home  wrote:
>
> You don't need contain, unless you want the post data too:
>
> $this->Post->Subject->find("all", array(
>  "conditions"=>array(
>    "Subject.post_id"=>$post_id
>  )
> );
>
> If you do need the post data, brian's solution should work just fine.
>
> On Apr 25, 5:21 am, brian  wrote:
>> This doesn't work?
>>
>> $this->find(
>>         'first',
>>         array(
>>                 'conditions' => array(
>>                         'Post.id' => $post_id
>>                 ),
>>                 'contain' => array(
>>                         'Subject'
>>                 )
>>         )
>> );
>>
>> On Fri, Apr 24, 2009 at 11:30 PM, Dave Maharaj :: WidePixels.com
>>
>>  wrote:
>> > Can someone help me with a contain using a HABTM relationship.
>> > POSTS HABTM SUBJECTS
>> > SUBJECTS
>> > POSTS_SUBJECTS
>>
>> > I have Post HABTM SUBECTS
>>
>> > I just want to print out the array of SUBJECTS that the POST has.
>>
>> > I managed to get the rest of the contain for the other hasmany 
>> > tables...just
>> > cant get the HABTM
>>
>> > Thanks
>>
>> > Dave
> >
>

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Tips for cutting queries and load time?

2009-04-25 Thread brian

On Sat, Apr 25, 2009 at 4:37 AM, Faza  wrote:
>
> You set-up a view in your database, and then add the model as for any
> other table in CakePHP.

I guess that makes sense. ill give that a go.

> Dunno about other DB's, but since few releases PostgreSQL allows
> INSERT/UPDATE of views. Pretty neat feature, because - if keyed
> correctly - you can make all relations DB-side.

One of the many reasons I prefer working with pg.

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model Association Not Creating Query Joins

2009-04-25 Thread Rob Wilkerson


On Apr 25, 9:55 am, James K  wrote:
> Start from the AccountAlert model rather than the Alert model. Use
> contain as well.
>
> $alert_ids = $this->AccountAlert->find (
>         'all',
>         array (
>                 'contain' => array(),
>                 'conditions'    =>   array (
>                         'AccountAlert.account_id'  => $account_id
>                 ),
>                 'fields'                =>   array('alert_id'),
>         )
> );
>
> You should also use contain to restrict the number of models involved
> in each query. Containing an empty array (or an empty string, I can't
> remember) will tell your query to not join any other models.

Thanks, everyone. Has it always been like this? For some reason, I
would have sworn that in the past I've done something like this:

$this->AccountAlert->find (
   'all',
   array (
  'conditions' => array (
 'AccountAlert.active' => 1
  ),
  'order' => 'Alert.priority'
   )
);

Note the different models being used in the conditions and order
parameters. Has that never been possible?

Thanks again for the help. I'll definitely be digging into the
containable behavior.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: MVC question: convert DB data to human-readable format: where?

2009-04-25 Thread James K

What exactly are you doing to the data? If you're just re-organizing
the array, doing it in the model is appropriate. If you're adding
markup, you should do it in the view.

- James

On Apr 23, 10:08 am, Ernesto  wrote:
> hello
>
> i'm wondering what's the best place to convert DB data in human-
> readable format.
>
> right now i'm using some routines in AppModel::afterFind and in
> AppModel::beforeDelete.
>
> These functions are working correctly but... formatting data in model
> doesn't sound very MVC-ish to me.
>
> So.. i was wondering... wich way is the most coherent with MVC
> pattern?
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model Association Not Creating Query Joins

2009-04-25 Thread James K

Start from the AccountAlert model rather than the Alert model. Use
contain as well.

$alert_ids = $this->AccountAlert->find (
'all',
array (
'contain' => array(),
'conditions'=>   array (
'AccountAlert.account_id'  => $account_id
),
'fields'=>   array('alert_id'),
)
);

You should also use contain to restrict the number of models involved
in each query. Containing an empty array (or an empty string, I can't
remember) will tell your query to not join any other models.

- James

On Apr 23, 8:45 pm, Rob Wilkerson  wrote:
> I have an Alert model, an Account model and an AccountAlert model:
>
> Alert hasMany AccountAlert
> Account hasMany AccountAlert
> AccountAlert belongsTo ( Alert, Account )
>
> AccountAlert has several other defining fields, so it has its own
> primary key in the database as well as being its own model. IOW, it's
> more than a simple linking table. It has foreign keys to the alerts
> and accounts tables (alert_id and account_id, respectively).
>
> From AccountModel, I'm trying to retrieve all of the Alerts for a
> given Account.  If I try a simple find:
>
> $this->Alert->find ( 'all' )
>
> I get each Alert and each AccountAlert that has that alert. If,
> however, I try to restrict by the account_id then I get an unknown
> column error:
>
> $alert_ids = $this->Alert->find (
>         'all',
>         array (
>                 'conditions'    =>   array (
>                         'AccountAlert.account_id'  => $account_id
>                 ),
>                 'fields'                =>   array('id'),
>         )
> );
>
> Looking at the debug SQL, no join is being created. Since the model
> associations are intact (I assume this is the case since the simple
> find() returns data for both models), should CakePHP be building the
> join automagically and, therefore, understanding the
> AccountAlert.account_id syntax in my condition?
>
> Even being relatively new to CakePHP, it still seems like I should
> have run into this before, but I can't remember having seen this. Any
> push in the right direction would be much appreciated.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Where do I start if I was SQL injected?

2009-04-25 Thread James K

This would be just as easy to achieve with Firefox and the Firebug
extension. This would give your students the ability to change the
HTML on the client-side, add form fields into your web forms or change
the primary keys in hidden form fields. If you're not doing any
validation on the server side of the data (meaning the number of form
fields you sent to the view are the same number that are coming back,
or the same primary keys you put as hidden fields didn't change), it
would be a piece of cake (har har) to inject any data into your
database for the model that form operates on.

Look into using the Security component, or be less trusting of your
form input. By just saving $this->data, you have no idea how people
have changed your form on the client in the meantime. (also you should
technically do $this->Model->create($this->data) then do $this->Model-
>save() )

- James

On Apr 25, 3:30 am, Linas  wrote:
> On Apr 25, 4:20 am, James K  wrote:
>
> > How do you know it was SQL injection? What exactly happened?
>
> Well, it's a webpage I use to teach algorithms (http://ims.mii.lt/
> ~linas/mokykla, it's in lithuanian).
> These kids are pretty smart, and so one week I just saw a number of
> new users created, my password was changed and so on. They just let me
> understand that they can do any query they want. This is not a big
> problem, because they would not do anything wicked (I hope), but
> still, I would like to fix that. Mysql query logs were off. Which logs
> should I check?
>
> Linas
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Tips for cutting queries and load time?

2009-04-25 Thread Faza

You set-up a view in your database, and then add the model as for any 
other table in CakePHP.

Dunno about other DB's, but since few releases PostgreSQL allows 
INSERT/UPDATE of views. Pretty neat feature, because - if keyed 
correctly - you can make all relations DB-side.

brian pisze:
> On Fri, Apr 24, 2009 at 9:21 PM, James K  wrote:
>   
>> You can modelize views just like you can tables. No need for query()
>>
>> 
>
> Care to give a hint?
>
> >
>
>   


--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: contain HABTM

2009-04-25 Thread rich...@home

You don't need contain, unless you want the post data too:

$this->Post->Subject->find("all", array(
  "conditions"=>array(
"Subject.post_id"=>$post_id
  )
);

If you do need the post data, brian's solution should work just fine.

On Apr 25, 5:21 am, brian  wrote:
> This doesn't work?
>
> $this->find(
>         'first',
>         array(
>                 'conditions' => array(
>                         'Post.id' => $post_id
>                 ),
>                 'contain' => array(
>                         'Subject'
>                 )
>         )
> );
>
> On Fri, Apr 24, 2009 at 11:30 PM, Dave Maharaj :: WidePixels.com
>
>  wrote:
> > Can someone help me with a contain using a HABTM relationship.
> > POSTS HABTM SUBJECTS
> > SUBJECTS
> > POSTS_SUBJECTS
>
> > I have Post HABTM SUBECTS
>
> > I just want to print out the array of SUBJECTS that the POST has.
>
> > I managed to get the rest of the contain for the other hasmany tables...just
> > cant get the HABTM
>
> > Thanks
>
> > Dave
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Plugin for MySQL Workbench: Who to contact?

2009-04-25 Thread rich...@home

I downloaded the 5.1 Beta OSS and installed the plugin.

Created a schema no problems, but only for copying to the clipboard
(no biggy tbh)  :-)

Unfortunately, there seems to be a bug in 5.1(not the plugin) that
stops exports from producing inserts (for inital seeding of the
database). So its back to 5.0 for me for now.

On Apr 25, 3:35 am, Gwoo  wrote:
> The plugin is very new, seeing as how i finished it last week. It was
> working fine for me and jperras, but it was only tested on OSX. Maybe
> you are referring to the save to file, which requires more work since
> workbench has not open the API to the save dialog. When they add that
> it will be updated. For now the easiest thing to do is copy to
> clipboard and paste it in your favorite text editor.
>
> Anyway, if you actually provide some information about what is not
> working, then I might be able to help.
>
> Happy Baking.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Website on computer works, when on ftp it doesn't

2009-04-25 Thread Nature Lover

hi!

always do remember that there is a .htaccess file under CakePHP root
folder
i.e.
if the structure is
app
cake
vendors
index.php
README

There is a file on this same level along with index.php being
a .htaccess file

You must also upload it. It remains hidden in most cases of FTP.

God bless you
Take Care!


On Apr 25, 9:18 am, brian  wrote:
> Well, the error msg is pretty clear. It looks to me like you forgot to
> change the CAKE_CORE_INCLUDE_PATH define in webroot/index.php. Your
> server isn't a Windows box.
>
> On Fri, Apr 24, 2009 at 10:35 PM, simon...@gmail.com  
> wrote:
>
> > Good Evening,
>
> > I did create my website using cakephp on Windows XP with Xampp. It was
> > working perfectly.
>
> > Then I did send all the files to my ftp and for some reason there is a
> > problem that I've not found the answer yet.
>
> > You can see the error at this adress:
>
> >http://simonjpa.olimpia.kinghost.net/phpinfo.php
>
> > I don't know if I forgot to configure something on the server.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Where do I start if I was SQL injected?

2009-04-25 Thread Linas

On Apr 25, 4:20 am, James K  wrote:
> How do you know it was SQL injection? What exactly happened?

Well, it's a webpage I use to teach algorithms (http://ims.mii.lt/
~linas/mokykla, it's in lithuanian).
These kids are pretty smart, and so one week I just saw a number of
new users created, my password was changed and so on. They just let me
understand that they can do any query they want. This is not a big
problem, because they would not do anything wicked (I hope), but
still, I would like to fix that. Mysql query logs were off. Which logs
should I check?

Linas
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---