Re: Problem with multiple submit buttons in on ajax form
In case anyone comes across this issue I thought it worth reporting my findings since it is an artifact of using Scriptaculous and Ajax in Cake. > I have some strange behavior in an ajax form and am wondering if it > could be cake related? > > Cake version: 1.1.8.3544 > > Regardless of which submit button is clicked > $this->params['form']['submit'] always contains the value from the last > button in the form. This is caused by the serialisation of the form content by Scriptaculous. Unlike a standard form post it does not detect the button that was clicked, but just serialises all of the tags. This means that multiple submit buttons are overwritten and you just end up with the last one in the form. With hindsight it is logical. Pity I wasted Sunday night on it. > This doesn't happen with other versions of Cake that I have used. It > also doesn't happen if I use a regular submit rather than ajax. I was wrong here. I reviewed the other application and found that I was not trying to distinguish multiple buttons via Ajax requests, but doing it on the client side with Javascript. > This happens with both IE and Firefox. Understandable since it is Scriptaculous that is responsible. Regards, Langdon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Blank lines at top of XML rendering
Hi guys, We've created a REST based webservice with cake, and when we set the layout of the controller to var $layout = 'xml'; and we have views for each of the actions on the controller that wil render the xml. \n"; echo $content_for_layout; ?> What we are seeing is we always get 1 or 2 blank lines at the top of the xml rendering, which firefox complains about when the xml is served (IE puts up with it). We've checked our php files for lead or trailing blank lines and there are none. Has anyone else seen this issue? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Webservices
Christoph, I don't have a solution, but I can confirm that I had the exact same results as you have. I suspect we need to do more than manual shows us. As for the article that Synchro recommended (http://bakery.cakephp.org/articles/view/126 ); I had to change the reg exp (regular expressions) to get that component to work. However it seems to me that once you get the the component working, it pretty much adds the same functionality that cake is supposed to support internally. Shawn On Nov 13, 8:15 pm, "Christoph" <[EMAIL PROTECTED]> wrote: > I'm fooling around w/cake to try to see what it's capable of. All of > my MVC parts have all been created by bake.php and I've done very > little modification from there. I'm still learning. > > So I have a users controller with the default index action (as provided > by bake). The manual (http://manual.cakephp.org/chapter/configuration) > says that if I set WEBSERVICES to 'on' in /app/config/core.php, then I > can access different 'views' of the data. When I go to > > www.mysite.com/users/index > > I see the HTML view just fine. But if I go to > > www.mysite.com/xml/users/index > > I get the missing component error page. The exact error text is: > > Fatal: Create the Class: > class XmlComponent extends Object > { > // Your component functions here > function myComponentFunction () > { > } > } > ?> > in file : app/controllers/components/xml.php > > Why is it looking for XmlComponent? The manual makes no mention of > having to create any component. Is there something else I need to do? > Is there something I'm missing? I do have the > /app/views/users/xml/index.thtml file as instructed in the manual. The > odd thing is that if that file is not there, I get a missing controller > error page instead...? I also get the missing controller error page if > I set WEBSERVICES to off. > > thnx, > Christoph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Automatic plugin detection
On 11/14/06, Christian Winther <[EMAIL PROTECTED]> wrote: > > Hi > Oh, that looks very cool - im going to check it out :) Thanks If you are interested - there is a tutorial on creating a cheesecake addon at http://cheesecake-photoblog.org/doku.php?id=tutorials Cheers Tarique -- = PHP Applications for E-Biz: http://www.sanisoft.com Coppermine Picture Gallery: http://coppermine.sf.net = --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: ACLs, actions and views
On 11/15/06, Martin <[EMAIL PROTECTED]> wrote: > Hi, we have the need to manage ACLs not only based on actions which > allow/deny users (aros) > to access controllers accions (acos), but also to include the ability > to allow the users only to see a certain filtered view of the database > (only every user's clients, providers, etc). A very common situation in apps > This situation makes us difficult trying to use the DBAcl part of the > framework as > AFAIK the ACO concept is based on actions that details the behaviour of > a controller. No - ACO is an abstract alias - and not hard wired into the app in any way > One approach to use the dbacl is defining views on the backend > accordingly to our needs > and map them to models which are used by the appropriate controllers, > but this would > lead to duplicate controllers only tu refer different models. Other > could be to rewrite AppModel or AppController classes to act as we > need, using just a part of concept of cakephp's ACLs. The approach I am considering is creating per user per controller per action ACOs Like in my case I want users to edit only those albums which belong to them and each album has a unique ID so my ACO alias looks like albums:edit:2 The ARO and the aros_acos continues as usual - the special part that you will have program in your beforeFilter would be how the ACO alias gets computed before being checked using the ACL component > I would like to know if some one had this situation and could give some > advise. Just an idea... hope you find it useful Cheers Tarique -- = PHP Applications for E-Biz: http://www.sanisoft.com Coppermine Picture Gallery: http://coppermine.sf.net --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Retrieve URL - New thread.
The above code was lifted from an Actual Application (tm), but some of the variable names were changed for clarity, which is why some of the session setting doesn't match up with the session checking, but you get the idea. There's also some extra goodies in there on how to handle login expirations for both regular and Ajax requests. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Retrieve URL - New thread.
class AppController extends Controller { function beforeFilter () { if (!$this->Session->check('User') && $this->params['action'] != 'login') { if (!$this->RequestHandler->isAjax()) { // If this is not an Ajax Request, just redirect the user to the login $this->redirect('/accounts/login/'.$this->params['url']['url']); exit(); } else { // Otherwise, throw up a login error with a link back to the login $this->set('url', $this->referer()); $this->viewPath = 'elements'; $this->render('login_error', 'ajax'); exit(); } } } } class AccountsController extends AppController { function login () { if (!empty($this->data)) { if ($login = $this->Contact->login($this->data)) { $params = func_get_args(); $url = empty($params) || in_array('logout', $params) ? '/' : '/' . implode('/', $params); $this->Session->write('Contact', $login['Contact']); $this->redirect($url); exit(); } } } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Retrieve URL - New thread.
Bernard Grosperrin wrote: > I would like to improve my rather crude login system. For now, after > login, I redirect the user to '/', or the "Home" page. > I would like to "trap" or retrieve the URL the user intended to go to, > pass it as parameter to my login function, to redirect to this URL > instead of Home. Maypole (a Perl MVC project) and Catalyst (and other projects) have a nice way of stopping a user for authentication (so if I requested /home but needed to be authenticated first then /home would bring up an login page instead). After logging in the user would be sent to /home. I would like to see this sort of flow available in Cake as well. I just haven't gotten around to it :-) Matt -- BASIC: A programming language. Related to certain social diseases in that those who have it will not admit it in polite company. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: generateList()
nate wrote: > You can never have enough rope. Amen. -- BASIC: A programming language. Related to certain social diseases in that those who have it will not admit it in polite company. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Output Escaping
I like a(), or aa() :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Output Escaping
Is short enough for you? Cake does URL's automatically, and most helper methods (like $html->link() and friends) automatically escape output by default. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to add header to all pages
not realy sure about the standard but I think if you concern about "how to add header to all your pages with the data inside it" it must be using the standard MVC and logically in cakePHP, it a standard way how to access using url by creating standard coding of MVC in cakePHP, and how to put together you pieces (inside layout / view) your thtml is by using: //---$this->requestAction("zones/dynamicheader",array('return'));?>//---anyway if you see this method, this method not create in "Controller" but inheritance from /cake/libs/object.php The parent class of controller and view. I think there are another way to do this, personally (for now) I like doing it like this. Regards, Widi Harsojomy2cn.On 11/14/06, devarz <[EMAIL PROTECTED]> wrote: Thanks, that made things a bit clearer to me.If I understand you correctly, does this mean that it is the *template*itself that is initiating the call to get the data. Is this thestandard procedure in frameworks llike cake, or are there other ways of achieving the same result? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Output Escaping
How does cake handle output escaping? If I have a var to pass to a view: $this->set('thing', ''); and I echo it in my view I going to get unescaped output. I could do: But that's cumbersome to do all the time. I was wondering if Cake had something built-in for handling this automatically, perhaps where you can set a default output context (e.g. HTML, URL, SQL, CSV escaping formats) for a view and output through a helper? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: ACLs, actions and views
Something that I've done outside of cake is an ACL-style permissions system that allows the same user different permissions in different contexts, so for example they may be able to access all the registered users of one account but not another. It's not open source (and it's not a generic solution anyway), but the key principle is that users are not AROs directly. The AROs are a combination of user and account. In your example it sounds like you need to introduce some similar structure, abstracting away the explicit link between ARO and user to an appropriate degree of granularity. Beyond that, it sounds like you're much further into cake than I have managed yet... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Webservices
Not quite what you asked about, but this is pretty interesting, especially the follow-up comment: http://bakery.cakephp.org/articles/view/126 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: filtering HABTM associations
Thank you nate. That got me going on the right direction (i think). So $result = $this->Post->Tag->findAll(array("Tag.id" => array(3, 6))); returns an array with each tag specified in the condition and their related posts within, and when I set recursive to 2 I get all the tags associated with each Post returned. >From here my thought is to merge $result[0]['Post'] and $result[1]['Post'] to get an array of all Posts with those two tags. Then I need to loop through the array and get rid of the dupes. Am I going about this correctly? I feel like there might be a more efficient way to do this all. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: accessing session info in AppController
Thanks nate! Worked like a charm! On Nov 14, 4:17 pm, "nate" <[EMAIL PROTECTED]> wrote: > If you have a beforeFilter method defined in one of your controllers, > try adding the following: > parent::beforeFilter(); > > See here:http://us3.php.net/keyword.parent --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Findall and group by
hi floepi, for grouping you can do this $conditions = 'Job.location = test Group by Col'; $this->Job->findAll($condition); you can set debug to 3 and see the actually query that is being issued by Cake regards, Bingo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: filtering HABTM associations
$this->Post->Tag->findAll(array("Tag.id" => array(3, 6))); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
filtering HABTM associations
So say i'm working on a blog applicaiton and I have the HABTM association set up between the post model and the tag model. What I can't figure out is how do I 1.) call a findAll and get all the posts that have two specific tags; and 2.) how do I get those results to contain the other tags associated to the returned posts. Somewhere I want to be able to write something to the effect 'condtions' => 'tag_id =3 and tag_id = 6', or find all posts that have the tag with id 3 and the tag with id 6. My understanding is that I can't reference the tag in the findAll statement - so I can't do: $this->Post->findAll("Tag.id = 3 and Tag.id = 6") I tried putting the condition in the association on the fly with bindModel but ran into two problems - one being it would only accept one condition and not two conditions, and the other problem is that it excludes all the other tags in the result, so only the matching tags get returned. Any suggestions would be appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Slightly naughty but is it an acceptable way of doing things?
By using phpThumb you could simplify your application logic and abstract image size to the views. olivvv TWIOF wrote: > HI Everyone, > > I've been making an images system for my site. There are various types > of image (e.g. thumb nails and illustrations). As far as the models go > an article might use hasOne for the thumb nails and hasMany for > illustrations. > > BUT, i'm using one db table for all images (there won't be that many > over all) - so can i have a hasOne and add a condition to only pick > thumbs, and a hasMany with a condition only to pick illustrations. I > know I should probably separate them into different tables, but would > it be that bad? > > Cheers > > TWIOF > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: generateList()
You can never have enough rope. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: accessing session info in AppController
If you have a beforeFilter method defined in one of your controllers, try adding the following: parent::beforeFilter(); See here: http://us3.php.net/keyword.parent --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
accessing session info in AppController
Hi! my appController looks like below: class AppController extends Controller { var $helpers = array('Html','Ajax','Javascript'); function beforeFilter() { if($this->Session->check('User')) $this->set('userinfo', $this->Session->read('User.username')); } } However, I get an "Undefined variable: userinfo" in my views. If I move the beforeFilter() function to one of my controllers than I can see $userinfo in the views associated with that particular controller. Why can't I set $userinfo at the appController level but only at individual controllers levels? Thx! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: generateList()
nate wrote: > Cake isn't designed to do everything you could possibly want to do, > just most things. And for the things it doesn't specifically cover, it > gives you more than enough leverage to cover them yourself. That brings to mind something about C and having enough rope. -- BASIC: A programming language. Related to certain social diseases in that those who have it will not admit it in polite company. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
ACLs, actions and views
Hi, we have the need to manage ACLs not only based on actions which allow/deny users (aros) to access controllers accions (acos), but also to include the ability to allow the users only to see a certain filtered view of the database (only every user's clients, providers, etc). For example: A user belonging to groups Recorders may use all the controllers which manage the table Invoices but only those invoices of certain clients. On the other side, the users in the group Managers may access all the controllers and all the clients. And every possible combinationa of the previous. This situation makes us difficult trying to use the DBAcl part of the framework as AFAIK the ACO concept is based on actions that details the behaviour of a controller. One approach to use the dbacl is defining views on the backend accordingly to our needs and map them to models which are used by the appropriate controllers, but this would lead to duplicate controllers only tu refer different models. Other could be to rewrite AppModel or AppController classes to act as we need, using just a part of concept of cakephp's ACLs. I would like to know if some one had this situation and could give some advise. Thanks MARTIN --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Findall and group by
Hi all, i was just wondering if i could somehow use the genius findall function and define a group by option i am not sure how i put that in the conditions. i have an array like $conditions = array('Job.location'=>'test') $this->Job->findAll($conditions); but how can i group this now ?? Thanks Phil --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: chmod
afaik, the cache goes in tmp too... so if you use caching, your view code is pulled out of the tmp/cache/ directory correct me if i'm wrong ;-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Slightly naughty but is it an acceptable way of doing things?
(although, i would personally also use different tables because it's more future-proof, like Chris said. If you don't have a good reason to do it your way, i would do it our way ;-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Slightly naughty but is it an acceptable way of doing things?
On 11/14/06, TWIOF <[EMAIL PROTECTED]> wrote: > > HI Everyone, > > I've been making an images system for my site. There are various types > of image (e.g. thumb nails and illustrations). As far as the models go > an article might use hasOne for the thumb nails and hasMany for > illustrations. > > BUT, i'm using one db table for all images (there won't be that many > over all) - so can i have a hasOne and add a condition to only pick > thumbs, and a hasMany with a condition only to pick illustrations. I > know I should probably separate them into different tables, but would > it be that bad? > The road to maintainability hell is paved with good intentions... :) -- Chris Hartjes "The greatest inefficiencies come from solving problems you will never have." -- Rasmus Lerdorf @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: 2 noobie questions
> " ... you can call this function to render the view at any point in the > controller logic" At first I was like "Huh? How does that help me. I'm still using just one view." then , the light bulb went on. :p duh. :) Thanks for pointing that out! thnx, Christoph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Query not returning associative array on 1 dev box
Hi guys, have a weird error that only occurs on one developer machine. The query is : $columns = $this->MetaDataField->query("DESC assets_data"); On my machine if I do a pr($columns) I get : Array ( [0] => Array ( [COLUMNS] => Array ( [Field] => id [Type] => int(11) [Null] => NO [Key] => PRI [Default] => [Extra] => auto_increment ) ) on my other developers machine Array ( [0] => Array ( [0] => Array ( [Field] => id [Type] => int(11) [Null] => NO [Key] => PRI [Default] => [Extra] => auto_increment ) ) Notice the COLUMNS association is no present, differences right now is he's running php 5.1.4 and I'm running 5.1.6 and he's running a slightly older version of mysql, we are going to upgrade both, but would love to know why the hell the associations are being built differently.. thanks Grant --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Not quite understanding associations
To do HABTM, you need an extra table. To do HABTM between users and game_pieces, you'd need a table called game_pieces_users (table1_table2 in alphabetical order). game_pieces_users would have 2 fields: game_piece_id and user_id. I hope that helps a little. I've found that scaffolding helps me get a better idea of how my associations work. Turn scaffolding on, set some associations, and then see what info shows up in my view. It's a quick, easy way to get visuals on your associations. hydra12 On Nov 13, 8:59 pm, "Christoph" <[EMAIL PROTECTED]> wrote: > I have the following tables: > > users > collections, FK user_id, FK game_piece_id > game_pieces, FK games_set_id > games_sets, FK game_id, FK set_id > games > sets > > So, if I understand correctly: > > users $hasMany collections > collections $belongsTo users, game_pieces > game_pieces $belongsTo game_sets > games_sets $belongsTo games, sets > games $hasMany games_sets > sets $hasMany games_sets > > I would think that collections $hasMany game_pieces (such that many > game pieces make up a collection), but using the relationship between > users and collections as, well, a model, that means since collections > belongs to users, it must also belong to game_pieces. > > I suppose collections is a HABTM joining table between users and > game_pieces? But if I try to define the association that way, I get an > error from cake (using the debug mode 3) showing: > > 1146: Table 'cake_communal_haven.collections_users' doesn't exist > 1146: Table 'cake_communal_haven.collections_game_pieces' doesn't exist > > so obviously I can't make it a HABTM association. So I'm just not > quite getting this... > > Any help would be greatly appreciated! > > thnx, > Christoph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: chmod
On Nov 14, 4:55 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > 666 would disable execute rights, I'm not a habitual linux user (although I just bought a new dev machine, so let's see), thanks for clarifying what that would do to a folder. So: If you have access to modify php to run as a different user 775 or even further restricted rights seems to be the order of the day Otherwise I conclude from that: You /must/ have 777 applied to the folders under tmp for php to be able to use them. If that's correct, and assuming that anyone with access to change the php user would know they can and should restrict rights, I think this thread could have been 2 messages long :) HTH, AD7six Please note: The manual/bakery is a good place to start any quest for info. The cake search (at the time of writing) erroneously reports less/no results for the google group. The wiki may contain incorrect info - read at your own risk (it's mainly user submitted) :) You may get your answer quicker by asking on the IRC Channel (you can access it with just a browser here: http://irc.cakephp.org). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: chmod
On 11/14/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > after update cake i have errors > > Warning: > file_put_contents(/home/andriu/beta/tmp/cache/models/default_lowcy_list) > [function.file-put-contents]: failed to open stream: Permission denied > in /home/andriu/cake/basics.php on line 843 > > Warning: > file_put_contents(/home/andriu/beta/tmp/cache/models/default_files) > [function.file-put-contents]: failed to open stream: Permission denied > in /home/andriu/cake/basics.php on line 843 > > witch folders in cake must have chmod 777 except for tmp ? > > You should do a recursive chmod on the tmp directory chmod -R 777 tmp/ and that will fix the problem. Everything in tmp should be 777 in my opinion. -- Chris Hartjes "The greatest inefficiencies come from solving problems you will never have." -- Rasmus Lerdorf @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: chmod
On Nov 14, 4:36 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > afaik, the cache goes in tmp too... so if you use caching, your view > code is pulled out of the tmp/cache/ directory > > correct me if i'm wrong ;-) : The trouble is... If you are using a shared host, then php is probably running as "nobody". If 'other users' don't have read and write access to the tmp folder, php can't use it. 775 would therefore (probably) mean that php is not able to write to the tmp folder; the concequences of which should be obvious. I never put a whole lot of thought into the rights for the tmp folder, 777 isn't that bad an idea for tmp files imo - But for shared host users (the ones most likely to hit a wall of problems when they assigne 700 or whatever to their tmp folder), I guess the rights should be 666 to limit what potential damage anyone could do. Not that you a malicious person could do much, but in reality - your hands are tied. HTH, AD7six Please note: The manual/bakery is a good place to start any quest for info. The cake search (at the time of writing) erroneously reports less/no results for the google group. The wiki may contain incorrect info - read at your own risk (it's mainly user submitted) :) You may get your answer quicker by asking on the IRC Channel (you can access it with just a browser here: http://irc.cakephp.org). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: chmod
Chris Hartjes wrote: > You should do a recursive chmod on the tmp directory > > chmod -R 777 tmp/ > > and that will fix the problem. Everything in tmp should be 777 in my opinion. > > > -- > Chris Hartjes > Imo, you should give read, write and execute (for directories) permissions to the user that your webserver runs as. Giving these same permissions to the group is also a good idea, just make sure that you (your username) also belongs to that group! Other then that, no-one should have write access. So i would recommend chmod -R775. 777 means that anyone who has an account on the system can change these files, changing the content of your website!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: chmod
> > 777 means that anyone who has an account on the system can change these > files, changing the content of your website!! > True, but if you only give it to the tmp directory in your Cake install, they can't really do much to change the content of your website. -- Chris Hartjes "The greatest inefficiencies come from solving problems you will never have." -- Rasmus Lerdorf @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
chmod
after update cake i have errors Warning: file_put_contents(/home/andriu/beta/tmp/cache/models/default_lowcy_list) [function.file-put-contents]: failed to open stream: Permission denied in /home/andriu/cake/basics.php on line 843 Warning: file_put_contents(/home/andriu/beta/tmp/cache/models/default_files) [function.file-put-contents]: failed to open stream: Permission denied in /home/andriu/cake/basics.php on line 843 witch folders in cake must have chmod 777 except for tmp ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: Automatic plugin detection
Hi Oh, that looks very cool - im going to check it out :) Thanks -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dr. Tarique Sani Sent: 9. november 2006 08:03 To: cake-php@googlegroups.com Subject: Re: Automatic plugin detection On 10/31/06, Christian Winther <[EMAIL PROTECTED]> wrote: > plugins/$name/$name_uninstall.phpfile for > deactivating the plugin ( removing tables ) We have something very similar in cheesecake photoblog - check out 1.5 Beta 1 from http://cakeforge.org/projects/cheesecake/ > and then somehow the plugin should 'publish' itself to cake what menu > options it has, and what features it should add where and how The plugin does publish itself on to the Addons page and gives a management Interface. HTH Tarique -- = PHP Applications for E-Biz: http://www.sanisoft.com Coppermine Picture Gallery: http://coppermine.sf.net = --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Slightly naughty but is it an acceptable way of doing things?
HI Everyone, I've been making an images system for my site. There are various types of image (e.g. thumb nails and illustrations). As far as the models go an article might use hasOne for the thumb nails and hasMany for illustrations. BUT, i'm using one db table for all images (there won't be that many over all) - so can i have a hasOne and add a condition to only pick thumbs, and a hasMany with a condition only to pick illustrations. I know I should probably separate them into different tables, but would it be that bad? Cheers TWIOF --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Security and performance of Cake PHP
> and besides, cake programmers are programmers too... i've inspected the > cake code and that's why i *know* that cake handles stuff like sql > injections, session hijackings,.. also, it provides very easy ways for > the programmer to protect himself against XSS and the like. We also cover CSRF, as well as a few other security acronyms. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: chmod
666 would disable execute rights, for files that's okay, but not for directories. no-one (except root) would be able to go "into" directories (by definition) also there aren't really files in there that one would like to execute i think ;-) (unless someone with write access puts em there himself) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: 2 noobie questions
>> Is it possible to tell a controller to use multiple views? I believe the example shown in the online manual for requestAction in the Controllers chapter is what you're looking for (http://manual.cakephp.org/chapter/controllers). In this example, a function named "showUserProducts" is added to the controller that uses "requestAction" to get the rendered view from another model. This rendered view gets "set" to a variable for the view to echo as needed. This allows you to re-use a rendered view without duplicating the code for it in another view. You may also wish to create a new MVC that only aggregates views from other models. Here's an example that creates a "workspace" view that consists of rendered views from two other models: MODEL (app\models\workspace.php): VIEW (app\views\workspaces\index.thtml): Workspace Home - View Users and Posts " . $postsTable; ?> CONTROLLER (app\controllers\workspaces_controller.php): set('usersTable', $this->requestAction('/users/index', array('return'))); $this->set('postsTable', $this->requestAction('/posts/index', array('return'))); // Now, we can echo out $usersTable and $postsTable in this action's view to // see the rendered view. } }?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Slightly naughty but is it an acceptable way of doing things?
your method is fine, if you have a column called "category" or something like that --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to add header to all pages
Thanks, that made things a bit clearer to me. If I understand you correctly, does this mean that it is the *template* itself that is initiating the call to get the data. Is this the standard procedure in frameworks llike cake, or are there other ways of achieving the same result? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: generateList()
I believe this entry from trac.cakephp.org will help you out. It did for me. https://trac.cakephp.org/ticket/1368 - Michael Odden Christoph skrev: > Ok, so I figured out how to generate a list using different > fields, other than the id, as the key => value pair. But I still have > some issues. > > * Is it possible to use multiple fields to make up the value of the > select box? Such that it would come out looking something like > > field2value - field3value > > ? > > * I have 4 seperate tables. sets, games_sets, game_pieces and > collections. collections has a FK referencing game_pieces which has a > FK referencing games_sets which has a FK referencing sets. So yay. > The following are the associated models follows by the associates > controllers (only the relevant parts; everything else is cut out): > > class Collection extends AppModel { > var $name = 'Collection'; > var $hasMany = array( > 'GamePiece' => > array('className' => 'GamePiece', > 'foreignKey' => 'game_piece_id' > )); > } > > class CollectionsController extends AppController { > var $name = 'Collections'; > var $uses = array('Collection', 'User', 'GamePiece'); > } > > class GamePiece extends AppModel { > var $name = 'GamePiece'; > var $belongsTo = array( > 'GamesSet' => > array('className' => 'GamesSet', > 'foreignKey' => 'games_set_id', > 'conditions' => '', > 'fields' => '', > 'order' => '', > 'counterCache' => '' > ), > > 'Collection' => > array('className' => 'Collection', > 'foreignKey' => 'id', > 'conditions' => '', > 'fields' => '', > 'order' => '', > 'counterCache' => '' > )); > } > > class GamePiecesController extends AppController { > var $name = 'GamePieces'; > var $uses = array('GamePiece', 'GamesSet', 'Collection', 'DeckPart', > 'TradeGamePiece', 'GamePieceAttribute'); > } > > class GamesSet extends AppModel { > var $name = 'GamesSet'; > var $belongsTo = array( > 'Set' => > array('className' => 'Set', > 'foreignKey' => 'set_id', > 'conditions' => '', > 'fields' => '', > 'order' => '', > 'counterCache' => '' > ) > > ); > > var $hasMany = array( > 'GamePiece' => > array('className' => 'GamePiece', > 'foreignKey' => > 'games_set_id')); > > } > > class GamesSetsController extends AppController { > var $name = 'GamesSets'; > var $uses = array('GamesSet', 'Game', 'Set', 'GamePiece'); > } > > class Set extends AppModel { > var $name = 'Set'; > var $hasMany = array( > 'GamesSet' => > array('className' => 'GamesSet', > 'foreignKey' => 'set_id')); > > } > > class SetsController extends AppController { > var $name = 'Sets'; > var $uses = array('Set', 'GamesSet'); > } > > I'm trying to make it so that the collection controller can, going > through game_pieces, games_sets and finally sets, get the set name that > a game piece belongs to. I'm trying to do something like: > > $this->set('gamePieces', > $this->Collection->GamePiece->generateList(NULL,NULL,15, > '{n}.GamePiece.id', '{n}.Set.set_name )); > > but that's not working. Is something like this possible? Or am I > going to have to generate the box manually? > > thnx, > Christoph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Security and performance of Cake PHP
> > Security is the responsibility of the PROGRAMMER, not the framework. > The best security features are not worth anything if you don't use > them properly. > > All the common security problems like XSS, cross-domain scripting and > SQL injection are easily solved by the programmer. Expecting Cake to > do it for you is being lazy. > security is the responsability of everyone involved with the project. the programmer of the application, the programmer of the framework, the people that built the webserver and extra modules (mod_php), the people that install and maintain the system (operating system, other software, configuration, keeping it all up to date) right to the guys that designed/assembled the hardware in your server. everything works together, in several layers, and each layer is vulnerable for security issues. and besides, cake programmers are programmers too... i've inspected the cake code and that's why i *know* that cake handles stuff like sql injections, session hijackings,.. also, it provides very easy ways for the programmer to protect himself against XSS and the like. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Security and performance of Cake PHP
On 11/13/06, Ger_Val <[EMAIL PROTECTED]> wrote: > > Hi! I'm new to CakePHP, seems it's a really great framework. I didn't > find any bad comments about it in the Internet. Probably, I was looking > badly. :) > What about using CakePHP for large projects? My concerns are about > performance and security. I've read some posts and people say > performance is not a problem. What about a site with 10 000 visitors > daily and a user area with many database-driven features (edit personal > data, history etc.)? > Should I worry about security of my site powered by CakePHP? Security > is of great importance for me since a hacker intrusion can destroy the > whole business. > > Security is the responsibility of the PROGRAMMER, not the framework. The best security features are not worth anything if you don't use them properly. All the common security problems like XSS, cross-domain scripting and SQL injection are easily solved by the programmer. Expecting Cake to do it for you is being lazy. -- Chris Hartjes "The greatest inefficiencies come from solving problems you will never have." -- Rasmus Lerdorf @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Security and performance of Cake PHP
Cakephp, combined with a decent auth system (check the bakery for that) will do pretty much everything they can to make your app as secure as possible. (sql injections, session hijackings, brute force attempts, network sniffings...) http://bakery.cakephp.org/articles/view/147 will address al these issues (article not published yet, but will be in a day or two) The rest is in your hands: get SSL. get a dedicated host, or at least a very hardened/secured shared hosting account, etc --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---