Re: Security Component and AJAX
Each time you make an ajax request you invalidate the existing security token. To use SecurityComponent and Ajax you would have to send the latest token with each form (and make sure you get a new one back from the server on each ajax request). And that is what in part amounts to SecurityComponent and Ajax being incompatible. It is just too much javascript-tangle. On Jun 3, 5:34 pm, "Dave Maharaj :: WidePixels.com" wrote: > You might be onto something there. > > Initial profile page loads with a "edit" button by the users profile section > to update part of the profileclick edit loads the form into a > div"submit" saves the form via a second Ajax request...success: jQuery > effects form fades out...updated selections fade in the users profile. > > Dave > > -Original Message- > From: Martin Westin [mailto:martin.westin...@gmail.com] > Sent: June-03-09 9:09 AM > To: CakePHP > Subject: Re: Security Component and AJAX > > Hi, I'm just buttin in with a quick question. Something for you to check. > > There is no other ajax request after the page loads and before the form is > posted? If so then this will also cause problems for SecurityComponent since > the token will be old. > > /Martin > > On Jun 3, 7:20 am, Miles J wrote: > > At /joesmith/update/systems/, if you can debug the data you should be > > able to save it. What exactly happens, a white page? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
what if I want to change the ($this->Auth->User())'s info.
hi, everyone! after user login in, I want to change the value of user's array ( the return of ($this->Auth->User())), How can I do it? If you know, please tell me. Thank you Rimoe --~--~-~--~~~---~--~~ 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: LOGIN question
I suggest that you turn of autoRedirect on login, as described in http://book.cakephp.org/view/395/autoRedirect and then use something like the following: [code example] if ( !$this->Auth->user() ) { // The user is not logged in, so try with the email as the username! $this->Auth->fields['username'] = 'email'; if ( $this->Auth->login() == false ) { // Not logged in, so report errors! } } [/code example] Enjoy, John On Jun 4, 7:54 am, lakers fan wrote: > Hello, > > I have a login screen with username and password. I want to either use > my username or email address in the username field. I tried setting the Auth > fields as listed below but its not working. > > $this->Auth->fields = array('username'=>array('username', > 'email_address'),'password'=>'password'); > > The warning that i get is: > > Warning (2): Illegal offset type in isset or empty > [CORE\cake\libs\controller\components\auth.php, line 845] > > Code | ContextWarning (2): Illegal offset type in isset or empty > [CORE\cake\libs\controller\components\auth.php, line 313] > > Is there any other way of doing this?? > > Thanks, > > Bharani > > _ > Windows Live™ SkyDrive™: Get 25 GB of free online > storage.http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
LOGIN question
Hello, I have a login screen with username and password. I want to either use my username or email address in the username field. I tried setting the Auth fields as listed below but its not working. $this->Auth->fields = array('username'=>array('username', 'email_address'),'password'=>'password'); The warning that i get is: Warning (2): Illegal offset type in isset or empty [CORE\cake\libs\controller\components\auth.php, line 845] Code | ContextWarning (2): Illegal offset type in isset or empty [CORE\cake\libs\controller\components\auth.php, line 313] Is there any other way of doing this?? Thanks, Bharani _ Windows Live™ SkyDrive™: Get 25 GB of free online storage. http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Creating an uploader component
I just finished creating a straight forward uploader component, and im looking for features and additions. Heres what it currently does. - Uploads files to app/webroot/files/ (can specify subfolders) - Logs errors to be displayed to the user - Support for wide range of filetypes/mimes (image, archive, text, audio, video, application) - Security checking for valid post uploading - Images can be resized to certain dimensions (option to overwrite/ save original) - Validation for types, extensions, size - Sets all ini properties required for uploading Im open to suggestions. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
AJAX and Cake 1.2 -- keeps returning HTML?
I keep getting HTML in my AJAX callbacks in Cake 1.2. Does anyone know why? --~--~-~--~~~---~--~~ 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: A better way? Grouping controllers and views
Thnaks for the feedback Mark & Martin, I'll have a look at these options over the next couple of days and see how they work out. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
$content_for_layout Question
Good Night, How can I change the variable "$content_for_layout" depending on a situation? Like if I use and IF and ELSE. For IF the "$content_for_layout" would have a value and for ELSE, there would be a different value. How could I do that? Regards, --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Proxy server
I am having trouble with sessions and a proxy server. My site uses Auth and ACL and it works fine in all my testing. However, now someone with Microsoft Proxy server is using it and the sessions are getting mixed up - when one user logs in they sometimes get another users info (i.e. the sessions are confused). They claim this doesn't happen on other web sites and if they change the computers to point through separate proxy servers (rather than using their array of proxies) it works fine. Any ideas what could cause this or how to diagnosis this since I cannot replicate it? Thanks. Fred --~--~-~--~~~---~--~~ 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: Using XSL - Should I write Component, Helper or Library?
To keep markup separate from php. I'm fixing to hire a designer to completely redo a website I have and I had decided it'd be much easier to just redo the views and what-not as opposed to letting him get in there and potentially jacking tihngs up. I had thought about taking the Smarty route but I still wasn't comfortable with the language even though he was. He has a good XSL background though and I've been wanting to convert all of my websites that way for a while now On Jun 3, 9:20 pm, Miles J wrote: > Why exactly are you going to use xsl? --~--~-~--~~~---~--~~ 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: Using XSL - Should I write Component, Helper or Library?
Why exactly are you going to use xsl? --~--~-~--~~~---~--~~ 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: Using XSL - Should I write Component, Helper or Library?
That doesn't work, either. To be honest with you, I'm kind of disappointed there isn't much support to be able to do this. Or maybe I'm just missing it. But I've searched Google and even posted on other forums for solutions and have not gotten any responses. It's almost as if it's impossible. I'm almost tempted to just write a "hook" and insert it into the View.php file and just go from there...make a library available for use. I hate to do that but I would much prefer to use XSL/XML over mixing PHP with HTML. I'll keep looking and if anyone has any suggestions, please let me know. Thanks Miles for your help. If you do decide to help tackle it please let me know. On Jun 3, 6:53 pm, Miles J wrote: > The helper beforeRender()/etc does not catch the output. Take a look > at the methods _render() and renderLayout. They both call > _triggerHelpers() which call the helpers beforeRender()/etc, but dont > catch the data. --~--~-~--~~~---~--~~ 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: Displaying an image from Blob field
You have to send the correct headers before echoing the data. Have a look at this recent article at the Bakery about doing something similar: http://bakery.cakephp.org/articles/view/imagebehavior-best-from-database-blobs-and-file-storage On Wed, Jun 3, 2009 at 7:49 PM, Jon wrote: > > Hi, I searched through the archives and didn't find a solution to this > problem I'm encountering so hopefully someone here will know what it > is. I'm trying to get the contents (image) of a MySQL blob field and > output it. However, it won't display properly. > > I have modified my code so that it just echos the data that it > retrieves from the database: > > function download($id = null) { > Configure::write('debug', 0); > if ($id != null) { > $pic = $this->Schoolpicture->findById($id); > echo $pic['Schoolpicture']['content']; > } > exit(); > } > > This produces the result shown here (for picture 6): > http://www.ignitenation.org/index.php/schoolpictures/download/6 > > I also have another test script that bypasses all the CakePHP > structure. It just retrieves the data and outputs it: > > error_reporting(E_ALL); > $my_table = 'schoolpictures'; > $my_server = ''; > $my_user = ''; > $my_pwd = ''; > $my_name = ''; > $my_link = mysql_connect($my_server, $my_user, $my_pwd) > or exit('Could not connect (' . mysql_errno() . '): ' . mysql_error > ()); > $my = mysql_select_db($my_name, $my_link) > or exit('Could not select database (' . mysql_errno() . '): ' . > mysql_error()); > $row = mysql_fetch_array(mysql_query("SELECT content FROM $my_table > where id=6")); > print $row['content']; > ?> > > You'll see that the result (for the same image 6) found at the > following link looks quite different: http://www.ignitenation.org/test.php > > If you do a view source, the first link has some whitespace before the > data whereas this one does not. Also, it looks like the data is > encoded differently. If I add the proper header (Content-type: image/ > gif), test.php will display my image properly. I suspect that the > whitespace and/or the different encoding is the source of the problem, > but I have no idea what could be causing that. > > Thanks for reading this long post and for any insight that you might > be able to provide on this issue! > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Pull data from several models / depths of recursion into a single controller and view
Hi there, I'm another new cakePHP user trying to wrap my brain around this system. My apologies if this is already addressed elsewhere, but I just cannot figure this out: To teach myself Cake, I'm building a listing/review site. As of right now, I have a - User, which hasMany 'Review', 'Listing', and 'ProfileImage' - Review, which belongsTo 'User' and 'Listing' - Listing, which hasMany 'Review' , belongsTo 'User', and hasAndBelongsToMany 'Tag' and 'ListingImage' Right now, I am trying to craft the view for the 'view' action for my ListingsController. That is, I'm trying to build the page that displays a single listing. Right now, it looks like this: function view($id = null) { $this->helpers[] = 'Format'; $this->Listing->id = $id; $this->layout = 'two-column'; $this->set('listing', $this->Listing->read()); $this->set('reviews', $this->Listing->Review- >findAllByListingId($id)); } which already feels a bit less elegant than I think it can be. But this allows me to display the information stored in the listings table (name, address, etc.), one of the 'ListingImages' stored for the listing, all of the reviews for that listing, and the names of the users that wrote those reviews. This brings me to my question: what is the best way to display the user's picture next to their name? Do I attempt to set the recursion depth higher for one (or some combination) of the model(s)? That gets to pulling a lot of extra data. Do I try to create extra queries? How should they be structured so as to keep in line with cake's MVC paradigm? Let me know if I am leaving out any critical information, or if you have any clarifying questions. The problem is probably (hopefully) black and white to a more experienced cake developer, so please forgive my naiveness. I appreciate any ideas you have. 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 -~--~~~~--~~--~--~---
Displaying an image from Blob field
Hi, I searched through the archives and didn't find a solution to this problem I'm encountering so hopefully someone here will know what it is. I'm trying to get the contents (image) of a MySQL blob field and output it. However, it won't display properly. I have modified my code so that it just echos the data that it retrieves from the database: function download($id = null) { Configure::write('debug', 0); if ($id != null) { $pic = $this->Schoolpicture->findById($id); echo $pic['Schoolpicture']['content']; } exit(); } This produces the result shown here (for picture 6): http://www.ignitenation.org/index.php/schoolpictures/download/6 I also have another test script that bypasses all the CakePHP structure. It just retrieves the data and outputs it: You'll see that the result (for the same image 6) found at the following link looks quite different: http://www.ignitenation.org/test.php If you do a view source, the first link has some whitespace before the data whereas this one does not. Also, it looks like the data is encoded differently. If I add the proper header (Content-type: image/ gif), test.php will display my image properly. I suspect that the whitespace and/or the different encoding is the source of the problem, but I have no idea what could be causing that. Thanks for reading this long post and for any insight that you might be able to provide on this issue! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
saving a view to .htm file
I am drawing a blank on this one, any help appreciated. Basically my view is a calibration record that also needs to be saved in a folder for backup purposes. Is it possible to save the view as an htm file, just as if you selected "Save Page As" in Firefox? --~--~-~--~~~---~--~~ 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: Using XSL - Should I write Component, Helper or Library?
The helper beforeRender()/etc does not catch the output. Take a look at the methods _render() and renderLayout. They both call _triggerHelpers() which call the helpers beforeRender()/etc, but dont catch the data. --~--~-~--~~~---~--~~ 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: A good helper for cake 1.2 for Datepicker?
Urg, I tryed the datepicker that you suggest me, but doesn't do the right work... There is an jquery implementation? Can someone give me a tip or a help ora alink for a tutorial? I seracherd in google but I didn't find something that satisfy my problem. Best regards Franco Tampieri Franco Tampieri Details: - Linux User #286282 - FSF Member #5827 GNU/Linux: Hardened / Embedded / H.A. Cluster / System Integrator Certification: ECDL / LPIC 1 - Acquiring Certification: Cisco CCNA / LPIC 2 2009/6/3 Franco Tampieri > Thank you Cake_backer I'm a your follower :D > > Best Regards > > Franco Tampieri > > 2009/6/3 cake_baker > > >> here is the links maybe help you >> http://nik.chankov.net/2007/09/13/advanced-datepicker-helper-for-cakephp/ >> >> On Jun 3, 7:03 am, "Dr.Dran" wrote: >> > Hi! >> > >> > Does anyone know if there is a good tutorial or helper to have the >> > datepicker function implemented in cake? >> > I see in the backery but the tutorial is for cake 1.1 >> > >> > Best Regards >> > >> > Franco Tampieri >> >> >> > > > -- > > Franco Tampieri Details: - Linux User #286282 - FSF Member #5827 > GNU/Linux: Hardened / Embedded / H.A. Cluster / System Integrator > Certification: ECDL / LPIC 1 - Acquiring Certification: Cisco CCNA / LPIC 2 > --~--~-~--~~~---~--~~ 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: Using XSL - Should I write Component, Helper or Library?
I should reclarify my directory structure... /posts/ .../views/ .../.../index.ctp (xml file) .../.../xsl/ .../.../.../index.xsl On Jun 3, 4:21 pm, timtrice wrote: > I don't understand why if I'm writing a helper I can't catch the > action's view file contents from the beforeLayout method or even > beforeRender. Isn't that part of the purpose??? Unfortunately I'm > not finding much on the internet, either. > > On Jun 3, 2:52 pm, Miles J wrote: > > > Yeah this is a very complicated setup, its intriguing me to write > > something for it, let me think about it more and ill get back to you. --~--~-~--~~~---~--~~ 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: form Clear
On Wed, Jun 3, 2009 at 4:22 PM, Dave Maharaj :: WidePixels.com wrote: > Is there a helper for a button to clear a form? > > I have button('Reset', array('type' => 'reset' , 'name' => > 'Reset' , 'id' => 'button' , 'value' => 'Reset')); ?> which creates the > button but clicking it does nothing. > > Am i missing something? I think the form helper can't be used to create a reset button. I didn't found a $form->reset() method in it :-( Maybe we should create a ticket for enhancement? You should do it with plain regular html anyway. Best regards. -- MARCELO DE F. ANDRADE Belem, PA, Amazonia, Brazil Linux User #221105 http://mfandrade.wordpress.com --~--~-~--~~~---~--~~ 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: Security Risk - Need some opinions
False alarm on the Google ads. Turns out you can pretty much run any kind of ad you want on your site via the query string. For example my site is a web development blog but if I pass a querystring like this: http://code621.com/?cars=toyota Car related ads show up. I always thought it was more based on the page content but I guess the query string is given more weight. Anyhow, I learned something new today. Make sure allow_url_fopen and allow_url_include are disabled in your php.ini. It might prevent you some headaches. --~--~-~--~~~---~--~~ 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: Using XSL - Should I write Component, Helper or Library?
I don't understand why if I'm writing a helper I can't catch the action's view file contents from the beforeLayout method or even beforeRender. Isn't that part of the purpose??? Unfortunately I'm not finding much on the internet, either. On Jun 3, 2:52 pm, Miles J wrote: > Yeah this is a very complicated setup, its intriguing me to write > something for it, let me think about it more and ill get back to you. --~--~-~--~~~---~--~~ 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 setup - Missing Controller error
items_controller.php On Jun 3, 10:43 pm, Miles J wrote: > Whats the filename of your controller? --~--~-~--~~~---~--~~ 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 setup - Missing Controller error
http://localhost/todo/items Missing Controller Error: ItemsController could not be found. Error: Create the class ItemsController below in file: app\controllers \items_controller.php Notice: If you want to customize this error message, create app\views \errors\missing_controller.ctp On Jun 3, 1:57 pm, persianshadow wrote: > please paste whole error text and address bar text . --~--~-~--~~~---~--~~ 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 setup - Missing Controller error
items_controller.php On Jun 3, 10:43 pm, Miles J wrote: > Whats the filename of your controller? --~--~-~--~~~---~--~~ 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 setup - Missing Controller error
Whats the filename of your controller? --~--~-~--~~~---~--~~ 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 setup - Missing Controller error
http://localhost/todo/items Missing Controller Error: ItemsController could not be found. Error: Create the class ItemsController below in file: app\controllers \items_controller.php Notice: If you want to customize this error message, create app\views \errors\missing_controller.ctp On Jun 3, 1:57 pm, persianshadow wrote: > please paste whole error text and address bar text . --~--~-~--~~~---~--~~ 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: Security Risk - Need some opinions
You should post a trac ticket of this anyways for the team to see. https://trac.cakephp.org/ --~--~-~--~~~---~--~~ 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: Security Risk - Need some opinions
I've been doing some more research on this. First off, you should probably make sure that allow_url_fopen and allow_url_include are disabled in both the php.ini file and the http.conf file in apache. This will protect you from someone executing code that gets included via a url. In regard to the google ads, it seems that you can still easily change the ads that show up via the query stirng. Very weird. For example: http://code621.com/content/1/?_SERVER[DOCUMENT_ROOT]=http://code621.com/m.txt? Nothing malicious in that "m.txt" file but it still causes Google to display incorrect or foreign ads. --~--~-~--~~~---~--~~ 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: Accessing variable in pass array, routing
@Miles J When I am viewing a project, there is a link to "Add New Risk". When the user clicks the link, the ID of the project from which they clicked "Add New Risk" must be passed to the risk controller. project_id is a foreign key in the Risks table. Rather than the user seeing a dropdown and selecting the project, I want the system to automatically set the project (remember that "Add New Risk" link is the view of a specific project with a specific ID). On Jun 3, 12:48 pm, Miles J wrote: > To pass the variables as an action argument, do it like so: > > Router::connect('/risks/add/:project_id', array('controller' => > 'risks', 'action' => 'add'), array('project_id' => '[0-9]+', 'pass' => > array('project_id'))); > > link('Project', array('controller' => 'risks', > 'action' => 'add', 'project_id' => $id)); ?> > > BUT YOU DONT HAVE TO DO THAT! > Why are you setting up a route if the controller/action will be the > same, remove the route and just do: > > link('Project', array('controller' => 'risks', > 'action' => 'add', $id)); ?> --~--~-~--~~~---~--~~ 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: Using XSL - Should I write Component, Helper or Library?
Yeah this is a very complicated setup, its intriguing me to write something for it, let me think about it more and ill get back to you. --~--~-~--~~~---~--~~ 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: Accessing variable in pass array, routing
To pass the variables as an action argument, do it like so: Router::connect('/risks/add/:project_id', array('controller' => 'risks', 'action' => 'add'), array('project_id' => '[0-9]+', 'pass' => array('project_id'))); link('Project', array('controller' => 'risks', 'action' => 'add', 'project_id' => $id)); ?> BUT YOU DONT HAVE TO DO THAT! Why are you setting up a route if the controller/action will be the same, remove the route and just do: link('Project', array('controller' => 'risks', 'action' => 'add', $id)); ?> --~--~-~--~~~---~--~~ 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: Accessing variable in pass array, routing
@paulinthought I made both of these changes, but no change. Also, using pr ($project_id) in the controller does not display anything (because project_id is null???) @brian I modified my routes to the following, but no change. Router::connect( '/risks/add/:project_id', array( 'controller' => 'risks', 'action' => 'add' ), array( 'project_id' => '[0-9]+', 'pass' => array('project_id') ) ); On Jun 3, 11:38 am, brian wrote: > I'm not positive about it, but I think you need to add a regexp: > > Router::connect( > '/risks/add/:project_id', > array( > 'controller' => 'risks', > 'action' => 'add' > ), > array( > 'project_id' => '[0-9]+', > 'pass' => array('project_id') > ) > ); > > On Wed, Jun 3, 2009 at 12:15 PM, jake1729 wrote: > > > I have been struggling with this for about 3 weeks. A variable is not > > being created in the pass array. I need the value of "project_id" to > > be included when creating a new risk. The Risks table must have a > > value for project_id. > > > Please, what am I doing wrong here? > > > == > > CONTROLLER (RisksController) > > > function add($project_id = null) { > > if (!empty($this->data)) { > > $this->Risk->create(); > > $this->data['Risk']['project_id'] = $project_id; > > if ($this->Risk->save($this->data)) { > > $this->Session->setFlash(__('The Risk has > > been saved', true)); > > $this->redirect(array('action'=>'index')); > > } else { > > debug($this->params); > > $this->Session->setFlash(__('The Risk could not be > > saved. Please, try again.', true)); > > } > > } > > $projects = $this->Risk->Project->find('list'); > > $riskcategories = $this->Risk->Riskcategory->find('list'); > > $this->set(compact('projects', 'riskcategories')); > > } > > > == > > ROUTE (routes.php) > > > Router::connect( > > '/risks/add/:project_id', > > array( > > 'controller' => 'risks', > > 'action' => 'add' > > ), > > array( > > 'pass' => array('project_id') > > ) > > ) > > > == > > VIEW (creates link with project_id value; inside of projects view.ctp) > > > link(__('Add New Risk', true), array > > ('controller'=> 'risks', 'action'=>'add', 'project_id' => $project > > ['Project']['id'])); ?> > > > == > > URL (being passed to risks add action. The "1" below is the passed > > project_id, whichI need to pass to the database when adding new risk) > > >http://localhost/PBSRG/cake_1_2/risks/add/1 > > > == > > DEBUG (debug($this->params); in the add action in risks_controller) > > > Array > > ( > > [pass] => Array > > ( > > ) > > ... > > } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
countQuery?
Hello, I'm working on a project where I have a number of Parties that are coming to an Event. A party contains some information including how many people are with that party. An event can only handle a certain number of people. I know I can use countCache to find out the n of parties, but I'd like to be able to increment that count not based on the number of parties assigned to that event, but by the cumulative number of people in those parties. I have tried to find information about countQuery but have found pages saying only that it exists, but not how to use it. Anyone have any information they can share? Thanks, BBT --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
form Clear
Is there a helper for a button to clear a form? I have button('Reset', array('type' => 'reset' , 'name' => 'Reset' , 'id' => 'button' , 'value' => 'Reset')); ?> which creates the button but clicking it does nothing. Am i missing something? 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: Please Please Help - Non conventional CakePHP ACL Setup...
If your models/tables don't follow Cake's conventions, you're going to cause yourself more trouble than it's worth. Given that Cake's ACL is already a bear to work with, I strongly suggest you get the other stuff in order first. On Wed, Jun 3, 2009 at 2:26 PM, Jenski wrote: > > Its not the model's I'm having problems with... > it's the setting up of ACL - any ideas? > > On Jun 3, 7:17 pm, brian wrote: >> You should clean up your table schema, first to get them in line with >> Cake's conventions. It'll save you lots of headaches down the road. >> >> CREATE TABLE staffs ( >> id int(11) NOT NULL auto_increment, >> department_id int(11) default NULL, >> logon_code char(10) NOT NULL, >> forename char(50) NOT NULL, >> surname char(50) NOT NULL, >> PRIMARY KEY (id), >> ) ; >> >> CREATE TABLE managers ( >> id int(11) NOT NULL auto_increment, >> logon_code varchar(15) NOT NULL, >> department_id int(11) default NULL, >> SystemAdmin tinyint(1) unsigned default NULL, >> PRIMARY KEY (id) >> ) ; >> >> CREATE TABLE departments ( >> id int(11) default NULL, >> sect_id varchar(50) default NULL, >> subsect_id varchar(50) default NULL, >> sect_name varchar(50) default NULL, >> sect_abbr varchar(50) default NULL, >> subsect_name varchar(50) default NULL, >> PRIMARY KEY (id) >> ) ; >> >> - all table names are lowercase, plural forms of the model >> >> - all PK are 'id int(11) NOT NULL auto_increment' >> >> - all FK are singular table name + '_id' (eg. department_id) >> >> If departments.sect_id is a FK to another table, it should be >> section_id and the table named sections (assuming thatsect is short >> for section). >> >> I guess staffs isn't the greatest name. Maybe members would be better. >> >> On Wed, Jun 3, 2009 at 6:26 AM, Jenski wrote: >> >> > I have a database setup like this (I know it isnt the best setup but >> > its out of my power to change it :-( >> >> > Basically there are 3 levels of users >> > - Admin >> > - Managers >> > - Staff >> >> > Few notes: >> > -Each member of staff belongs to department >> > -If the Staffs logon_code appears in the manager table they are a >> > Manager, otherwise they are a member of staff >> > -If the staffs logon_code appears in the manager table and SystemAdmin >> > is set to 1, they are Admin >> >> > How on earth do I go about setting ACL/Auth for this? Any ideas? >> >> > CREATE TABLE `tblStaff` ( >> > `StaffID` int(11) NOT NULL auto_increment, >> > `dept_id` varchar(5) default NULL, >> > `logon_code` char(10) NOT NULL, >> > `forename` char(50) NOT NULL, >> > `surname` char(50) NOT NULL, >> > PRIMARY KEY (`StaffID`), >> > ) ; >> >> > CREATE TABLE `tblManager` ( >> > `ManagerID` varchar(15) NOT NULL, >> > `logon_code` varchar(15) NOT NULL, >> > `dept_id` varchar(5) NOT NULL, >> > `SystemAdmin` tinyint(1) unsigned default NULL, >> > PRIMARY KEY (`ManagerID`) >> > ) ; >> >> > CREATE TABLE `tblDepartment` ( >> > `dept_id` varchar(5) NOT NULL, >> > `sect_id` varchar(50) default NULL, >> > `subsect_id` varchar(50) default NULL, >> > `sect_name` varchar(50) default NULL, >> > `sect_abbr` varchar(50) default NULL, >> > `subsect_name` varchar(50) default NULL, >> > PRIMARY KEY (`dept_id`) >> > ) ; > > > --~--~-~--~~~---~--~~ 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: Accessing variable in pass array, routing
I'm not positive about it, but I think you need to add a regexp: Router::connect( '/risks/add/:project_id', array( 'controller' => 'risks', 'action' => 'add' ), array( 'project_id' => '[0-9]+', 'pass' => array('project_id') ) ); On Wed, Jun 3, 2009 at 12:15 PM, jake1729 wrote: > > I have been struggling with this for about 3 weeks. A variable is not > being created in the pass array. I need the value of "project_id" to > be included when creating a new risk. The Risks table must have a > value for project_id. > > Please, what am I doing wrong here? > > == > CONTROLLER (RisksController) > > function add($project_id = null) { > if (!empty($this->data)) { > $this->Risk->create(); > $this->data['Risk']['project_id'] = $project_id; > if ($this->Risk->save($this->data)) { > $this->Session->setFlash(__('The Risk has been > saved', true)); > $this->redirect(array('action'=>'index')); > } else { > debug($this->params); > $this->Session->setFlash(__('The Risk could not be > saved. Please, try again.', true)); > } > } > $projects = $this->Risk->Project->find('list'); > $riskcategories = $this->Risk->Riskcategory->find('list'); > $this->set(compact('projects', 'riskcategories')); > } > > > == > ROUTE (routes.php) > > Router::connect( > '/risks/add/:project_id', > array( > 'controller' => 'risks', > 'action' => 'add' > ), > array( > 'pass' => array('project_id') > ) > ) > > > == > VIEW (creates link with project_id value; inside of projects view.ctp) > > link(__('Add New Risk', true), array > ('controller'=> 'risks', 'action'=>'add', 'project_id' => $project > ['Project']['id'])); ?> > > > == > URL (being passed to risks add action. The "1" below is the passed > project_id, whichI need to pass to the database when adding new risk) > > http://localhost/PBSRG/cake_1_2/risks/add/1 > > > == > DEBUG (debug($this->params); in the add action in risks_controller) > > Array > ( > [pass] => Array > ( > ) > ... > } > > > --~--~-~--~~~---~--~~ 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: generatetreelist and conditions
On Wed, Jun 3, 2009 at 8:20 AM, Toutankharton wrote: > > Hey everyone, > > I'm trying to select all of my projects belonging to a client, but I > fail to use generatetreelist and conditions. > > I tried : > > $this->Project->generatetreelist(null, array('Project.client_id' => > '3'), null, null, '...'); $this->Project->generatetreelist( array('Project.client_id' => '3'), null, null, '...' ); > since the second parameters seems to be the conditions in the doc... I > got this errror : > > Warning (2): array_combine() expects parameter 1 to be array, null > given [CORE/cake/libs/set.php, line 972] > > don't ask why, but I tried : > > $this->Project->generatetreelist(array('Project.client_id' => '3'), > null, null, null, '...'); > > and it works, but i have all my projects at the same level : > > Array > ( > [32] => Project 1 > [44] => Subproject 2 > [11] => Project 2 > ) > > where i should have > > > Array > ( > [32] => 'Project 1' > [11] => 'Project 2' > [44] => '...Subproject 2' > ) > Because you have null where the '...' should 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: HtmlHelper Div
label('Book.release_date.day', 'Date'); echo $form->dateTime('Book.release_date','DMY','NONE); ?> On Wed, Jun 3, 2009 at 10:49 AM, bokerao wrote: > > Hi Guys... I'm making a form and need to put an own css div, so I did > this: > > echo $html->div('input text'); > echo $form->label('Book.release_date.day', 'Date'); > echo $form->dateTime('Book.release_date','DMY','NONE); > > So Cake create the div class but it doesn't close the tag... > > So what can I do in this case? > > 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: Please Please Help - Non conventional CakePHP ACL Setup...
Its not the model's I'm having problems with... it's the setting up of ACL - any ideas? On Jun 3, 7:17 pm, brian wrote: > You should clean up your table schema, first to get them in line with > Cake's conventions. It'll save you lots of headaches down the road. > > CREATE TABLE staffs ( > id int(11) NOT NULL auto_increment, > department_id int(11) default NULL, > logon_code char(10) NOT NULL, > forename char(50) NOT NULL, > surname char(50) NOT NULL, > PRIMARY KEY (id), > ) ; > > CREATE TABLE managers ( > id int(11) NOT NULL auto_increment, > logon_code varchar(15) NOT NULL, > department_id int(11) default NULL, > SystemAdmin tinyint(1) unsigned default NULL, > PRIMARY KEY (id) > ) ; > > CREATE TABLE departments ( > id int(11) default NULL, > sect_id varchar(50) default NULL, > subsect_id varchar(50) default NULL, > sect_name varchar(50) default NULL, > sect_abbr varchar(50) default NULL, > subsect_name varchar(50) default NULL, > PRIMARY KEY (id) > ) ; > > - all table names are lowercase, plural forms of the model > > - all PK are 'id int(11) NOT NULL auto_increment' > > - all FK are singular table name + '_id' (eg. department_id) > > If departments.sect_id is a FK to another table, it should be > section_id and the table named sections (assuming thatsect is short > for section). > > I guess staffs isn't the greatest name. Maybe members would be better. > > On Wed, Jun 3, 2009 at 6:26 AM, Jenski wrote: > > > I have a database setup like this (I know it isnt the best setup but > > its out of my power to change it :-( > > > Basically there are 3 levels of users > > - Admin > > - Managers > > - Staff > > > Few notes: > > -Each member of staff belongs to department > > -If the Staffs logon_code appears in the manager table they are a > > Manager, otherwise they are a member of staff > > -If the staffs logon_code appears in the manager table and SystemAdmin > > is set to 1, they are Admin > > > How on earth do I go about setting ACL/Auth for this? Any ideas? > > > CREATE TABLE `tblStaff` ( > > `StaffID` int(11) NOT NULL auto_increment, > > `dept_id` varchar(5) default NULL, > > `logon_code` char(10) NOT NULL, > > `forename` char(50) NOT NULL, > > `surname` char(50) NOT NULL, > > PRIMARY KEY (`StaffID`), > > ) ; > > > CREATE TABLE `tblManager` ( > > `ManagerID` varchar(15) NOT NULL, > > `logon_code` varchar(15) NOT NULL, > > `dept_id` varchar(5) NOT NULL, > > `SystemAdmin` tinyint(1) unsigned default NULL, > > PRIMARY KEY (`ManagerID`) > > ) ; > > > CREATE TABLE `tblDepartment` ( > > `dept_id` varchar(5) NOT NULL, > > `sect_id` varchar(50) default NULL, > > `subsect_id` varchar(50) default NULL, > > `sect_name` varchar(50) default NULL, > > `sect_abbr` varchar(50) default NULL, > > `subsect_name` varchar(50) default NULL, > > PRIMARY KEY (`dept_id`) > > ) ; --~--~-~--~~~---~--~~ 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: Extracting numeric data and then add one
On Wed, Jun 3, 2009 at 5:32 AM, liaogz82 wrote: > > Hi all, > > I need help in cakePHP. > > I am using this framework in my area of work. I have successfully > migrated from the old database that uses an auto increment field as > the primary key to one that uses uuid as the primary key. > unfortunately the users request the old ID to be remain in place so > that they can identify, as UUID is too long and unreadable. > > I am trying my very best to figure out how to do the implementation of > the auto increment in cakePHP, that is to use the codes below: > > $newId = $this->Subscription->find('list', > array( > 'fields'=>'Subscription.scp_id', > 'order'=>'Subscription.scp_id desc', > 'limit'=> 1 > ) > ); > $newId2 = Set::extract($newId,'{0}.Subscription.scp_id'); > $this->data['Subscription']['scp_id'] = $newId2+1; > If you're using 'list', I think that should be: $newId2 = Set::extract($newId,'Subscription.{0}.scp_id'); $newId = Set::extract( $this->Subscription->find( 'list', array( 'fields'=>'Subscription.scp_id', 'order'=>'Subscription.scp_id desc', 'limit'=> 1 ) ), 'Subscription.{0}.scp_id' ); $this->data['Subscription']['scp_id'] = $newId+1; --~--~-~--~~~---~--~~ 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: Please Please Help - Non conventional CakePHP ACL Setup...
You should clean up your table schema, first to get them in line with Cake's conventions. It'll save you lots of headaches down the road. CREATE TABLE staffs ( id int(11) NOT NULL auto_increment, department_id int(11) default NULL, logon_code char(10) NOT NULL, forename char(50) NOT NULL, surname char(50) NOT NULL, PRIMARY KEY (id), ) ; CREATE TABLE managers ( id int(11) NOT NULL auto_increment, logon_code varchar(15) NOT NULL, department_id int(11) default NULL, SystemAdmin tinyint(1) unsigned default NULL, PRIMARY KEY (id) ) ; CREATE TABLE departments ( id int(11) default NULL, sect_id varchar(50) default NULL, subsect_id varchar(50) default NULL, sect_name varchar(50) default NULL, sect_abbr varchar(50) default NULL, subsect_name varchar(50) default NULL, PRIMARY KEY (id) ) ; - all table names are lowercase, plural forms of the model - all PK are 'id int(11) NOT NULL auto_increment' - all FK are singular table name + '_id' (eg. department_id) If departments.sect_id is a FK to another table, it should be section_id and the table named sections (assuming thatsect is short for section). I guess staffs isn't the greatest name. Maybe members would be better. On Wed, Jun 3, 2009 at 6:26 AM, Jenski wrote: > > I have a database setup like this (I know it isnt the best setup but > its out of my power to change it :-( > > Basically there are 3 levels of users > - Admin > - Managers > - Staff > > Few notes: > -Each member of staff belongs to department > -If the Staffs logon_code appears in the manager table they are a > Manager, otherwise they are a member of staff > -If the staffs logon_code appears in the manager table and SystemAdmin > is set to 1, they are Admin > > How on earth do I go about setting ACL/Auth for this? Any ideas? > > CREATE TABLE `tblStaff` ( > `StaffID` int(11) NOT NULL auto_increment, > `dept_id` varchar(5) default NULL, > `logon_code` char(10) NOT NULL, > `forename` char(50) NOT NULL, > `surname` char(50) NOT NULL, > PRIMARY KEY (`StaffID`), > ) ; > > CREATE TABLE `tblManager` ( > `ManagerID` varchar(15) NOT NULL, > `logon_code` varchar(15) NOT NULL, > `dept_id` varchar(5) NOT NULL, > `SystemAdmin` tinyint(1) unsigned default NULL, > PRIMARY KEY (`ManagerID`) > ) ; > > CREATE TABLE `tblDepartment` ( > `dept_id` varchar(5) NOT NULL, > `sect_id` varchar(50) default NULL, > `subsect_id` varchar(50) default NULL, > `sect_name` varchar(50) default NULL, > `sect_abbr` varchar(50) default NULL, > `subsect_name` varchar(50) default NULL, > PRIMARY KEY (`dept_id`) > ) ; > > > --~--~-~--~~~---~--~~ 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: On Tickets & The Core Team: Why some tickets get tagged as 'wontfix' or 'invalid'
Excellent post, and thank you for the explanation. I now understand better how the 80-20 rules applies in the case of a framework the size and complexity of Cake. On Jun 3, 10:43 am, jperras wrote: > (for context, please read the comments for ticket > #5145:https://trac.cakephp.org/ticket/5145. I chose continue this > discussion in the google group because it is a more appropriate venue > for this type of discourse). > > First, let me state that neither myself or *anyone* on the CakePHP > core team gets their jollies from closing tickets as 'wontfix' or > 'invalid'. We all appreciate the time & effort that is spent in > writing a ticket, and are grateful that people are attempting to make > CakePHP a better framework. > > Alright, I'm going to take the time to explain the reasoning behind > the 'wontfix' tag that was attributed to > tickethttps://trac.cakephp.org/ticket/5145 > and perhaps offer some insight in the thought processes that go on > behind the scenes that are not usually explained, for the simple > reason that writing a small novella for each ticket would consume all > the free time that any of us has. > > First, you must note that CakePHP is an ''opinionated'' framework; we > enforce certain conventions and (what we consider to be) best > practices. This also translates to any code that is included in the > core; if we believe that certain enhancements/features would go > against accepted best-practices of development, then it has no place > in the official codebase. Being conscious of the limitations of the > real world, however, we have endeavoured to allow users of the > framework to customize & extend the base functionality to accommodate > a wide variety of edge case uses, an example of which is the topic of > this ticket: Validation rules. The rules that are provided in the core > are present for one of two reasons: 1) the rule is quite common and > used in many different applications (e.g. notEmpty, numeric) or 2) the > implementation of the rule is quite complex, and we feel it best to > provide that functionality so that people need not re-invent the wheel > (e.g. credit cards, date and time). The alphanumeric+ whitespace > +whitelist_of_valid_characters rule which you have proposed does not > fall within either of the above two categories. > > It is not a rule which many people require, simply because if you are > allowing non alphanumeric characters, you need to either provide a > whitelist or a blacklist of additional characters. Neither of these > options is maintainable in the long-term; you will be eternally adding > characters to your (white|black)list to comply with varying & changing > requirements from your application. > > However, I do understand that the real-world sometimes does not > coincide with the ivory tower that comprises best practices of > software design & implementation patterns. This is where the > extensibility of the framework comes into play. The above validation > rule that you both desire can be very easily implemented in a variety > of places: 1) in a model, for domain-specific validation that need not > be available to the rest of your application. 2) at the AppModel > level, so that all your models in a given application may use it. 3) > In a behavior, so that you can pick & choose which models will have > the custom validation rules available to them. In addition, this also > allows you to make the rules portable; you could even package it up in > a plugin along with some test cases, thus utilizing the full extent of > CakePHP's extensibility. > > Furthermore, every line of code that is added to the CakePHP codebase > is a line of code that the core team needs to maintain. What might > seem like a simple validation rule addition actually encompasses the > validation rule itself, a new test case with at least a dozen new > assertions, possible modification of bake templates for models to > include the new validation rule, integration tests for the new > validation rule and its interaction with the FormHelper, in addition > to whatever new functionality gets added in future versions. As a > result, what seems like a simple addition of a few lines of code > snowballs into several hundred lines and countless hours of work. Thus > you can imagine why we shy away from adding new 'features' that > introduce infinitesimally new functionality, especially when such > functionality is actually best implemented with your own application > logic in mind. This is not to say that we never plan on adding new and > awesome things to CakePHP; you need only visit the development branch > for 1.3 onhttp://thechaw.com/cakephp/source/branches/1.3to see for > yourself. > > Given all that I've said, however, I still realize that sometimes > certain problems need dirty solutions. To this end, I've written a > simple example of how you would create an alphanumeric > +whitelist_of_valid_characters rule: > > // in either your app_model.php or a model class > public fu
Re: Custom methods for Aro and Aco models?
Looks like it's a bad idea to create "handmade" models named Aro and Aco. When I change the model names (still referencing the default Cake tables aros and acos, though), then I'm able to get the expected results from my custom methods and properties. I chose AclRequester and AclControlled as my model names. The only downside (so far), is that I lose the AclNode functionality. So I'm manually bundling that in my own custom behavior. On Jun 3, 6:34 am, etipaced wrote: > In an attempt to utilize my own ACL system, I have 3 models which I > created: > - Aro > - Aco > - AclPermission > > Each of these correlates with the default Cake ACL tables (aros, acos, > aros_acos, respectively). Now I'm trying to write some custom methods > in these models but having no luck. When attempting to access my > custom method through a controller model chain (NOT AuthComponent), I > get the following error: > > "1064: You have an error in your SQL syntax; check the manual that > corresponds to your MySQL server version for the right syntax to use > near 'getAros' at line 1" > > In other words, even though I have a method named "getAros()", I can't > call it. I'm happy to provide code if anyone is interested. I'm just > wondering if maybe I should call my Aro and Aco models different > names. I'm guessing they are "automatically built-in" and Cake is > disallowing me to customize their methods. --~--~-~--~~~---~--~~ 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: A better way? Grouping controllers and views
There are a number of ways to solve this. You can use inheritance, or parameters, and setup routes for the parameters. Venue1NewsController extends NewsController or NewsController::news($venueNumber,$moreParams) I don't think copy+paste is the right solution though. -Mark On Jun 2, 9:40 pm, double07 wrote: > Hi All, > > I'm working on a project at the moment which has a main site then sub > sites for venue franchises. The venue sub sites are effectively the > same as the main site but the news items etc are filtered to be only > for that particular venue. > > The way I have this setup at the moment is as follows (I'll use news > as an example): > -Just a standard news model > -a main controller for news news_controller.php > -a sub controller for each venue i.e. venue1_news_controller.php - > this is the same as the normal news controller except it has a > condition to filter only news items for 'venue1' > -normal news views > -a venue1 sub folder in news containing slightly different views > (mainly to add a hidden venue id field when adding news so when a > venue1 editor can only add news for venue1) - accessed in the venue1 > news controller via changing the view path > -Then I have routes setup ie: Router::connect('/venue1/news/:action/ > *', array('controller' => 'venue1_news')); > > Now this all works perfectly fine. However, what concerns me is the > amount of times I'm effectively repeating things which are - bar a few > small differences - doing essentially the same thing. Also, if I have > to make changes to the news controller I effectively have to update > each sub controller too. > > I'm just wondering if this is the best way to go about things? Is > there a better way where I could have only one news controller/set of > views but somehow add the conditions for the venues on the fly or > something? > > 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: cake start problem
Unless you have some special reason to change the directory structure Id say the best thing to begin with is to just extract cake and put the cake folder into your root folder. Then change the name of the cake folder to the name of your site and now your application should be accessible at localhost/site/ On Jun 3, 2:30 pm, gakkou wrote: > hi! i am new to cakephp and obviously i have some perhaps typical > problems. > > my directory structure: > > C:/.../upp/cake/ > C:/.../upp/app_upp/ > C:/.../upp/public_html/upp/ > > localhost is set on C:/.../upp/public_html/upp/ > > I set path > > > define('APP_DIR', 'app_upp'); > > define('DS', DIRECTORY_SEPARATOR); > > define('ROOT', 'C:/.../upp/'); > > define('WEBROOT_DIR', '../public_html/upp'); > > define('WWW_ROOT', ROOT . DS . APP_DIR . DS . WEBROOT_DIR . DS); > > And it's still the same, it just doesn't work ;/ > > error on localhost: > Fatal error: Cannot redeclare config() (previously declared in C:\www > \upp\cake\basics.php:60) in C:\www\upp\cake\basics.php on line 77 > > what should I do now? please help smile.gif --~--~-~--~~~---~--~~ 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: Accessing variable in pass array, routing
Hi, If I understand you properly, the url http://localhost/PBSRG/cake_1_2/risks/add/1 does not correctly pass $project_id into the controllereven though it appears in the url. Try link(__('Add New Risk', true), array ('controller'=> 'risks', 'action'=>'add', $project ['Project']['id'])); ?> i.e. without the 'project_id' => Also use pr($project_id); in your controller to check the value is there. Hope that helps. On Jun 3, 6:15 pm, jake1729 wrote: > I have been struggling with this for about 3 weeks. A variable is not > being created in the pass array. I need the value of "project_id" to > be included when creating a new risk. The Risks table must have a > value for project_id. > > Please, what am I doing wrong here? > > == > CONTROLLER (RisksController) > > function add($project_id = null) { > if (!empty($this->data)) { > $this->Risk->create(); > $this->data['Risk']['project_id'] = $project_id; > if ($this->Risk->save($this->data)) { > $this->Session->setFlash(__('The Risk has > been saved', true)); > $this->redirect(array('action'=>'index')); > } else { > debug($this->params); > $this->Session->setFlash(__('The Risk could not be > saved. Please, try again.', true)); > } > } > $projects = $this->Risk->Project->find('list'); > $riskcategories = $this->Risk->Riskcategory->find('list'); > $this->set(compact('projects', 'riskcategories')); > } > > == > ROUTE (routes.php) > > Router::connect( > '/risks/add/:project_id', > array( > 'controller' => 'risks', > 'action' => 'add' > ), > array( > 'pass' => array('project_id') > ) > ) > > == > VIEW (creates link with project_id value; inside of projects view.ctp) > > link(__('Add New Risk', true), array > ('controller'=> 'risks', 'action'=>'add', 'project_id' => $project > ['Project']['id'])); ?> > > == > URL (being passed to risks add action. The "1" below is the passed > project_id, whichI need to pass to the database when adding new risk) > > http://localhost/PBSRG/cake_1_2/risks/add/1 > > == > DEBUG (debug($this->params); in the add action in risks_controller) > > Array > ( > [pass] => Array > ( > ) > ... > > } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
On Tickets & The Core Team: Why some tickets get tagged as 'wontfix' or 'invalid'
(for context, please read the comments for ticket #5145: https://trac.cakephp.org/ticket/5145 . I chose continue this discussion in the google group because it is a more appropriate venue for this type of discourse). First, let me state that neither myself or *anyone* on the CakePHP core team gets their jollies from closing tickets as 'wontfix' or 'invalid'. We all appreciate the time & effort that is spent in writing a ticket, and are grateful that people are attempting to make CakePHP a better framework. Alright, I'm going to take the time to explain the reasoning behind the 'wontfix' tag that was attributed to ticket https://trac.cakephp.org/ticket/5145 and perhaps offer some insight in the thought processes that go on behind the scenes that are not usually explained, for the simple reason that writing a small novella for each ticket would consume all the free time that any of us has. First, you must note that CakePHP is an ''opinionated'' framework; we enforce certain conventions and (what we consider to be) best practices. This also translates to any code that is included in the core; if we believe that certain enhancements/features would go against accepted best-practices of development, then it has no place in the official codebase. Being conscious of the limitations of the real world, however, we have endeavoured to allow users of the framework to customize & extend the base functionality to accommodate a wide variety of edge case uses, an example of which is the topic of this ticket: Validation rules. The rules that are provided in the core are present for one of two reasons: 1) the rule is quite common and used in many different applications (e.g. notEmpty, numeric) or 2) the implementation of the rule is quite complex, and we feel it best to provide that functionality so that people need not re-invent the wheel (e.g. credit cards, date and time). The alphanumeric+ whitespace +whitelist_of_valid_characters rule which you have proposed does not fall within either of the above two categories. It is not a rule which many people require, simply because if you are allowing non alphanumeric characters, you need to either provide a whitelist or a blacklist of additional characters. Neither of these options is maintainable in the long-term; you will be eternally adding characters to your (white|black)list to comply with varying & changing requirements from your application. However, I do understand that the real-world sometimes does not coincide with the ivory tower that comprises best practices of software design & implementation patterns. This is where the extensibility of the framework comes into play. The above validation rule that you both desire can be very easily implemented in a variety of places: 1) in a model, for domain-specific validation that need not be available to the rest of your application. 2) at the AppModel level, so that all your models in a given application may use it. 3) In a behavior, so that you can pick & choose which models will have the custom validation rules available to them. In addition, this also allows you to make the rules portable; you could even package it up in a plugin along with some test cases, thus utilizing the full extent of CakePHP's extensibility. Furthermore, every line of code that is added to the CakePHP codebase is a line of code that the core team needs to maintain. What might seem like a simple validation rule addition actually encompasses the validation rule itself, a new test case with at least a dozen new assertions, possible modification of bake templates for models to include the new validation rule, integration tests for the new validation rule and its interaction with the FormHelper, in addition to whatever new functionality gets added in future versions. As a result, what seems like a simple addition of a few lines of code snowballs into several hundred lines and countless hours of work. Thus you can imagine why we shy away from adding new 'features' that introduce infinitesimally new functionality, especially when such functionality is actually best implemented with your own application logic in mind. This is not to say that we never plan on adding new and awesome things to CakePHP; you need only visit the development branch for 1.3 on http://thechaw.com/cakephp/source/branches/1.3 to see for yourself. Given all that I've said, however, I still realize that sometimes certain problems need dirty solutions. To this end, I've written a simple example of how you would create an alphanumeric +whitelist_of_valid_characters rule: // in either your app_model.php or a model class public function alnumWhitelist($data, $whitelist = array()) { $data = array_values($data); $check = $data[0]; $whitelist = implode($whitelist); $rule = "/^[\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}{$whitelist}]+ $/mu"; return preg_match($rule, $check); } // in your model validation rules public $validate = array(
Accessing variable in pass array, routing
I have been struggling with this for about 3 weeks. A variable is not being created in the pass array. I need the value of "project_id" to be included when creating a new risk. The Risks table must have a value for project_id. Please, what am I doing wrong here? == CONTROLLER (RisksController) function add($project_id = null) { if (!empty($this->data)) { $this->Risk->create(); $this->data['Risk']['project_id'] = $project_id; if ($this->Risk->save($this->data)) { $this->Session->setFlash(__('The Risk has been saved', true)); $this->redirect(array('action'=>'index')); } else { debug($this->params); $this->Session->setFlash(__('The Risk could not be saved. Please, try again.', true)); } } $projects = $this->Risk->Project->find('list'); $riskcategories = $this->Risk->Riskcategory->find('list'); $this->set(compact('projects', 'riskcategories')); } == ROUTE (routes.php) Router::connect( '/risks/add/:project_id', array( 'controller' => 'risks', 'action' => 'add' ), array( 'pass' => array('project_id') ) ) == VIEW (creates link with project_id value; inside of projects view.ctp) link(__('Add New Risk', true), array ('controller'=> 'risks', 'action'=>'add', 'project_id' => $project ['Project']['id'])); ?> == URL (being passed to risks add action. The "1" below is the passed project_id, whichI need to pass to the database when adding new risk) http://localhost/PBSRG/cake_1_2/risks/add/1 == DEBUG (debug($this->params); in the add action in risks_controller) Array ( [pass] => Array ( ) ... } --~--~-~--~~~---~--~~ 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: SELECT IN in WHERE clause
On Jun 3, 2:00 pm, John Andersen wrote: > @JStein > You missed the OR part in the condition! > > @Havanna > The condition should be: > > ... $conditions = array('OR' => array('Immobilien.zip' => > $saZipCodes)) ... That OR has no functional meaning (or what? there's only 1 array key within it) - take a look at the sql with the extra array and without it. the only difference will be an extra set of brackets. 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 -~--~~~~--~~--~--~---
Re: I need conceptual help transferring my existing data
On Wed, Jun 3, 2009 at 1:15 AM, Ian R wrote: > > > On Jun 2, 7:45 pm, brian wrote: >> Model::create() doesn't actually create a new DB record, it just sets >> up the model instance. You have to use save() for that. >> >> What i've done in the past when moving an existing project to Cake is >> to create a (non-cake) script that simply moves the data from one >> database to the other, the latter DB being designed according to Cake >> conventions. > > > Ha! Well, that had been my original plan, and then I thought "oh, > this is probably really easy the Cake way, and a good learning > experience". Well, maybe I'll go running back. Thanks, Brian, and if > anybody has any other thoughts, I'd be pleased to hear them! That was what I had thought, also. Though one would have to select the original data using query(), given the tables are unlikely to follow Cake's conventions. That wouldn't be such a big deal except that I also never did figure out how to select from 2 separate DBs. Of course, I could have just copied the old DB tables to the new, then added the Cake tables to it and create methods to copy the data between them. But I had a few old tables that had exactly the name I need to satisfy Cake conventions. And then I'd still have to go in and clean out the old tables. So, in the end, it seemed *much* simpler to just write an old-school script to take care of this. --~--~-~--~~~---~--~~ 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: Security Component and AJAX
You might be onto something there. Initial profile page loads with a "edit" button by the users profile section to update part of the profileclick edit loads the form into a div"submit" saves the form via a second Ajax request...success: jQuery effects form fades out...updated selections fade in the users profile. Dave -Original Message- From: Martin Westin [mailto:martin.westin...@gmail.com] Sent: June-03-09 9:09 AM To: CakePHP Subject: Re: Security Component and AJAX Hi, I'm just buttin in with a quick question. Something for you to check. There is no other ajax request after the page loads and before the form is posted? If so then this will also cause problems for SecurityComponent since the token will be old. /Martin On Jun 3, 7:20 am, Miles J wrote: > At /joesmith/update/systems/, if you can debug the data you should be > able to save it. What exactly happens, a white page? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
HtmlHelper Div
Hi Guys... I'm making a form and need to put an own css div, so I did this: echo $html->div('input text'); echo $form->label('Book.release_date.day', 'Date'); echo $form->dateTime('Book.release_date','DMY','NONE); So Cake create the div class but it doesn't close the tag... So what can I do in this case? 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: cakephp setup - Missing Controller error
please copy/paste whole error text and address bar text there. On Jun 3, 3:21 pm, dflow wrote: > yes same error! :( > > On Jun 3, 2:47 am, Miles J wrote: > > > What about going to > > > /items/index > > > Or another action? > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
cake start problem
hi! i am new to cakephp and obviously i have some perhaps typical problems. my directory structure: C:/.../upp/cake/ C:/.../upp/app_upp/ C:/.../upp/public_html/upp/ localhost is set on C:/.../upp/public_html/upp/ I set path > define('APP_DIR', 'app_upp'); > define('DS', DIRECTORY_SEPARATOR); > define('ROOT', 'C:/.../upp/'); > define('WEBROOT_DIR', '../public_html/upp'); > define('WWW_ROOT', ROOT . DS . APP_DIR . DS . WEBROOT_DIR . DS); And it's still the same, it just doesn't work ;/ error on localhost: Fatal error: Cannot redeclare config() (previously declared in C:\www \upp\cake\basics.php:60) in C:\www\upp\cake\basics.php on line 77 what should I do now? please help smile.gif --~--~-~--~~~---~--~~ 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 i display an Auth Message Error please ?
yes u can just use the flash method i m giving the syntax $this->controller->flash('Sorry! You don\'t have the rights to access this page','Page for redirection',time in secends to hold the screen); On Jun 3, 1:32 pm, Xanax wrote: > Hi everyone, > > My problem is quite simple : i've setup auth and ACL in my application > everything seems to work fine unless one thing : > > When a user try to launch a forbidden (for him) controllers/actions, > it' just redirect him to another page autorized for him. I would just > like to have an explicit message error like "You don't have access to > this page. Please click here for being redirected..." > > Here are my Auth parameters for information : > > $this->Auth->actionPath = 'controleurs/'; > $this->Auth->userModel = 'User'; > $this->Auth->fields = array('username' => 'login', 'password' => > 'password'); > $this->Auth->loginAction = '/users/login'; > $this->Auth->loginRedirect = '/users/index'; > $this->Auth->loginError = "Identifiant ou mot de passe > incorrects."; > $this->Auth->logoutRedirect = '/planifications/index_users'; > $this->Auth->authError = "Vous n'avez pas accès à cette page."; > $this->Auth->autoRedirect = true; > $this->Auth->authorize = 'actions'; > > As you can see i've setup properly the "$this->Auth->authError" > property. > > Thank you very much for any help, have a good day! --~--~-~--~~~---~--~~ 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 i display an Auth Message Error please ?
create a method in ur component something like this function checkActionRight($action) { $rightCategoryId=$this->Session->read($action.'.right_category_id'); $optionId=$this->Session->read($action.'.option_id'); if((int)$rightCategoryId>0 && (int)$optionId>0) { return true; } else { $this->controller->flash('Sorry! You don\'t have the rights to access this page.', '/'.$this->Session->read('RightHeader.selected_controller').'/'.$this->Session->read('RightHeader.selected_action').'/'.$this->Session->read('RightsHeader.selected_category_id').'/'.$this->Session->read('RightsHeader.selected_option_id'),3); return false; } } On Wed, Jun 3, 2009 at 4:49 PM, Martin Westin wrote: > > Do you output auth messages in your layout? > They have their own "name": > $session->flash('auth'); > > I have done something like this in my layout a few times: > if (is_array($messages = $session->read('Message'))) { >foreach (array_keys($messages) as $key) { >$session->flash($key); >} > } > > It will output any and all messages in the session. > > > On Jun 3, 10:32 am, Xanax wrote: > > Hi everyone, > > > > My problem is quite simple : i've setup auth and ACL in my application > > everything seems to work fine unless one thing : > > > > When a user try to launch a forbidden (for him) controllers/actions, > > it' just redirect him to another page autorized for him. I would just > > like to have an explicit message error like "You don't have access to > > this page. Please click here for being redirected..." > > > > Here are my Auth parameters for information : > > > > $this->Auth->actionPath = 'controleurs/'; > > $this->Auth->userModel = 'User'; > > $this->Auth->fields = array('username' => 'login', 'password' => > > 'password'); > > $this->Auth->loginAction = '/users/login'; > > $this->Auth->loginRedirect = '/users/index'; > > $this->Auth->loginError = "Identifiant ou mot de passe > > incorrects."; > > $this->Auth->logoutRedirect = '/planifications/index_users'; > > $this->Auth->authError = "Vous n'avez pas accès à cette page."; > > $this->Auth->autoRedirect = true; > > $this->Auth->authorize = 'actions'; > > > > As you can see i've setup properly the "$this->Auth->authError" > > property. > > > > Thank you very much for any help, have a good day! > > > --~--~-~--~~~---~--~~ 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 setup - Missing Controller error
please paste whole error text and address bar text . --~--~-~--~~~---~--~~ 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: A good helper for cake 1.2 for Datepicker?
Thank you Cake_backer I'm a your follower :D Best Regards Franco Tampieri 2009/6/3 cake_baker > > here is the links maybe help you > http://nik.chankov.net/2007/09/13/advanced-datepicker-helper-for-cakephp/ > > On Jun 3, 7:03 am, "Dr.Dran" wrote: > > Hi! > > > > Does anyone know if there is a good tutorial or helper to have the > > datepicker function implemented in cake? > > I see in the backery but the tutorial is for cake 1.1 > > > > Best Regards > > > > Franco Tampieri > > > -- Franco Tampieri Details: - Linux User #286282 - FSF Member #5827 GNU/Linux: Hardened / Embedded / H.A. Cluster / System Integrator Certification: ECDL / LPIC 1 - Acquiring Certification: Cisco CCNA / LPIC 2 --~--~-~--~~~---~--~~ 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: A good helper for cake 1.2 for Datepicker?
here is the links maybe help you http://nik.chankov.net/2007/09/13/advanced-datepicker-helper-for-cakephp/ On Jun 3, 7:03 am, "Dr.Dran" wrote: > Hi! > > Does anyone know if there is a good tutorial or helper to have the > datepicker function implemented in cake? > I see in the backery but the tutorial is for cake 1.1 > > Best Regards > > Franco Tampieri --~--~-~--~~~---~--~~ 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: Security Component and AJAX
Two different sets of data.. First is with Security component added in app_controller When I debug debug($this->data); right before the save $this->User->save($this->data, true, array_keys($this->User->$join_table->schema())) Array ( [_Token] => Array ( [key] => f653941fc718b276cf8f28b41f5bb1b3a812047c [fields] => 6c5072f719544a7d300fe09d7030e1da27e2652b%3An%3A0%3A%7B%7D ) [System] => Array ( [System] => Array ( [0] => 13 [1] => 1 [2] => 9 [3] => 8 [4] => 7 [5] => 6 [6] => 11 [7] => 5 [8] => 4 [9] => 12 [10] => 2 [11] => 14 ) ) ) Debug the save its self and I get 1 Just the number 1and nothing saves Remove security component and debug the same save and I get Array ( [System] => Array ( [System] => Array ( [0] => 13 [1] => 7 [2] => 6 [3] => 11 [4] => 5 [5] => 4 [6] => 12 [7] => 2 [8] => 14 ) ) ) And the save returns number 1 app/controllers/users_controller.php (line 236) 1 Which is debug($this->User->save($this->data, true, array_keys($this->User->$join_table->schema(; -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: June-03-09 2:50 AM To: CakePHP Subject: Re: Security Component and AJAX At /joesmith/update/systems/, if you can debug the data you should be able to save it. What exactly happens, a white page? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
A good helper for cake 1.2 for Datepicker?
Hi! Does anyone know if there is a good tutorial or helper to have the datepicker function implemented in cake? I see in the backery but the tutorial is for cake 1.1 Best Regards Franco Tampieri --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Belongs to Hasmany
hey i'm working on comment box so need help var $belongsTo = array( 'User' => array( 'className' => 'User', 'foreignKey' => 'user_id', 'conditions' => '', 'fields' => '', 'order' => '' ), 'Recipe' => array( 'className' => 'Recipe', 'foreignKey' => 'recipe_id', 'conditions' => '', 'fields' => '', 'order' => '' ) ); what i wannna do is have user login before using the comment then and comment on the recipe they are viewing so what you guys think function add() { if (!empty($this->data)) { $this->Comment->create(); if ($this->Comment->save($this->data)) { $this->Session->setFlash(__('The Comment has been saved', true)); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash(__('The Comment could not be saved. Please, try again.', true)); } } $this->set(compact('users', 'recipes')); } --~--~-~--~~~---~--~~ 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: Auth Session question
it worked thanks On Jun 2, 10:37 am, brian wrote: > On Mon, Jun 1, 2009 at 1:20 PM, cake_baker wrote: > > > ok here is the full the details > > > i'm using a star rating plugin that need user.id in the Session > > > define('RATING_SESSION_USER_ID', 'User.id'); > > This defines the session key? You can get Auth's session info using > $this->Session->read('Auth.User.id') so, in this case, 'Auth.User.id' > should work for your define(). > > I've never used the plugin, so if this doesn't work, maybe you should > re-send your query with "Star rating" somewhere in the subject line. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Custom methods for Aro and Aco models?
In an attempt to utilize my own ACL system, I have 3 models which I created: - Aro - Aco - AclPermission Each of these correlates with the default Cake ACL tables (aros, acos, aros_acos, respectively). Now I'm trying to write some custom methods in these models but having no luck. When attempting to access my custom method through a controller model chain (NOT AuthComponent), I get the following error: "1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'getAros' at line 1" In other words, even though I have a method named "getAros()", I can't call it. I'm happy to provide code if anyone is interested. I'm just wondering if maybe I should call my Aro and Aco models different names. I'm guessing they are "automatically built-in" and Cake is disallowing me to customize their methods. --~--~-~--~~~---~--~~ 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 setup - Missing Controller error
yes same error! :( On Jun 3, 2:47 am, Miles J wrote: > What about going to > > /items/index > > Or another action? --~--~-~--~~~---~--~~ 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 setup - Missing Controller error
yes same error! :( On Jun 3, 2:47 am, Miles J wrote: > What about going to > > /items/index > > Or another action? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
generatetreelist and conditions
Hey everyone, I'm trying to select all of my projects belonging to a client, but I fail to use generatetreelist and conditions. I tried : $this->Project->generatetreelist(null, array('Project.client_id' => '3'), null, null, '...'); since the second parameters seems to be the conditions in the doc... I got this errror : Warning (2): array_combine() expects parameter 1 to be array, null given [CORE/cake/libs/set.php, line 972] don't ask why, but I tried : $this->Project->generatetreelist(array('Project.client_id' => '3'), null, null, null, '...'); and it works, but i have all my projects at the same level : Array ( [32] => Project 1 [44] => Subproject 2 [11] => Project 2 ) where i should have Array ( [32] => 'Project 1' [11] => 'Project 2' [44] => '...Subproject 2' ) any ideas ? --~--~-~--~~~---~--~~ 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 i display an Auth Message Error please ?
Thank you very much, i've just add : flash(); $session->flash('auth'); ?> and it works now Bye --~--~-~--~~~---~--~~ 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: SELECT IN in WHERE clause
@JStein You missed the OR part in the condition! @Havanna The condition should be: ... $conditions = array('OR' => array('Immobilien.zip' => $saZipCodes)) ... Enjoy, John On Jun 1, 11:13 pm, havanna wrote: > Dear Jonathan, > > thank you, for your answer. I thought first I wan't to ask in the > google group. But I think also it's an error in CakePHP. > > Trust me, I'm the last one, who want to make things complicated. If I > use the Array directly, I the following error: > > SQL Error: 1054: Unknown column 'Array' in 'where clause' > > This is the pr( ) output of the array: > > Array > ( > [0] => 48531 > [1] => 48529 > [2] => 48527 > ) > > I tried also to pack it in a deep array like Modell.field - but this > will got the same error message > > SQL Error: 1054: Unknown column 'Array' in 'where clause' > > Regards Thomas > > On 1 Jun., 21:46, jstein wrote: > > > On Jun 1, 7:25 pm, havanna wrote: > > > > But if I use this one like > > > $conditions = array('OR' => array('Immobilien.zip' => array > > > ($svZipCodes))); > > > Try to print the array: debug($conditions); > > > You are telling cake, that the zip field should equal one string with > > your imploded zip codes. > > > You are actually complicating things much more than needed. Simply use > > the array directly: > > $conditions = array('Immobilien.zip' => $saZipCodes); > > > Regards > > > Jonathan > > --~--~-~--~~~---~--~~ 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: HABTM question - keeping associated records in a specific order
Had an informative discussion on this at Stack Overflow: http://stackoverflow.com/questions/936203/storing-sort-order-for-items-held-in-an-habtm-association-cakephp On Jun 1, 9:31 pm, Hiero wrote: > I have a HasAndBelongsToMany association setup on Videos and Bins: A > Bin can store n references to Videos, and Videos can belong to n Bins. > > I need to be able to manually set and store the display order of the > Videos within a particular Bin (so the client can have his Videos in a > particular order within the Bin.) My initial thought is to create a > field in Bin that stores an array of Video IDs in the order they need > to appear. Is this the most efficient way to handle this? > > If so, when I then get the HABTM query result, what is the cleanest/ > most efficient way to re-order the returned query to match the sorted > array of ID's? > > Or is there a better way to achieve what I'm trying to do without > using HABTM associations? > > Thanks in advance - --~--~-~--~~~---~--~~ 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: Security Component and AJAX
Hi, I'm just buttin in with a quick question. Something for you to check. There is no other ajax request after the page loads and before the form is posted? If so then this will also cause problems for SecurityComponent since the token will be old. /Martin On Jun 3, 7:20 am, Miles J wrote: > At /joesmith/update/systems/, if you can debug the data you should be > able to save it. What exactly happens, a white page? --~--~-~--~~~---~--~~ 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: A better way? Grouping controllers and views
My 2¢ If you are pretty happy with the setup and it works for you there is a quick way to minimize code-duplication. Your sub controllers should extend the main news controller. (you will have to add a App::import() at the top of these files so that news controller can be found) THen you can probably tweak your code to read site-specific stuff from class attributes you have set and possible one or two overridden methods. If you can to mote to a single controller, that should be possible too. Your route could add a named parameter that the controller can read and understand which sub-site it is in. Custom data for that site can them be loaded from a statis lookup table (array) in the class or from a database table. You could probably even just get away with using the parameter the rout sets directly as the foldername for views and site "id" for storing news. But it all depends in exactly how they differ. /Martin On Jun 3, 3:40 am, double07 wrote: > Hi All, > > I'm working on a project at the moment which has a main site then sub > sites for venue franchises. The venue sub sites are effectively the > same as the main site but the news items etc are filtered to be only > for that particular venue. > > The way I have this setup at the moment is as follows (I'll use news > as an example): > -Just a standard news model > -a main controller for news news_controller.php > -a sub controller for each venue i.e. venue1_news_controller.php - > this is the same as the normal news controller except it has a > condition to filter only news items for 'venue1' > -normal news views > -a venue1 sub folder in news containing slightly different views > (mainly to add a hidden venue id field when adding news so when a > venue1 editor can only add news for venue1) - accessed in the venue1 > news controller via changing the view path > -Then I have routes setup ie: Router::connect('/venue1/news/:action/ > *', array('controller' => 'venue1_news')); > > Now this all works perfectly fine. However, what concerns me is the > amount of times I'm effectively repeating things which are - bar a few > small differences - doing essentially the same thing. Also, if I have > to make changes to the news controller I effectively have to update > each sub controller too. > > I'm just wondering if this is the best way to go about things? Is > there a better way where I could have only one news controller/set of > views but somehow add the conditions for the venues on the fly or > something? > > 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: How setting path for only one layout
Hi Petr, I'm not sure what you're asking here... if you just want to change the layout for an action's view, then set the $layout variable in the controller like: $this->layout = 'layoutname' where you have 'layoutname.ctp' in /app/views/layouts. Or are you saying that you want the controller to render a view to a layout defined on a user's machine? Because if you think about it that's just not remotely possible - all the php action happens on the server before anything gets sent to client (browser). How would the server know what is on a client? > , 4:40 am, Petr Vytlačil wrote: > APP CONTROLLER > > function beforeRender(){ > if($this->params['controller']=='frontends'){ > // This do nothing > $viewPaths = array(CAKE_CORE_INCLUDE_PATH .'\shared > items\views'); > > // This do nothing > define('LAYOUTS','C:'.DS.'Program > Files'.DS.'VertrigoServ'.DS.'www'.DS.'projekty'.DS.'klientpenzion'.DS.'app'.DS.'view'.DS); > } > } > > please help, how i can set directory for layout, thx. > > On 2 čvn, 13:50, Petr Vytlačil wrote: > > > Hi I develop simple CMS, but it will be multisite system. > > One core (controller, admin, frontend views, models) > > User: (frontend layout, css, images) > > > Pleas is any idea how I can chagne path for on layout in any action in > > controller? > > Path must be in some adr for example: /root/cake/layout/frontend.ctp > > > THX --~--~-~--~~~---~--~~ 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: Extracting numeric data and then add one
Can you try using the MAX() SQL-function? You could just do a custom query on the database returning just the number of the maximum value in that column. It should be reasonably fast if you have the column indexed. Then you do the +1 thing. On Jun 3, 11:50 am, liaogz82 wrote: > Oh yes by the way, the above codes generate this error: > Column 'scp_id' cannot be null > > Means there is no value in $newId2 > > On Jun 3, 5:32 pm, liaogz82 wrote: > > > Hi all, > > > I need help in cakePHP. > > > I am using this framework in my area of work. I have successfully > > migrated from the old database that uses an auto increment field as > > the primary key to one that uses uuid as the primary key. > > unfortunately the users request the old ID to be remain in place so > > that they can identify, as UUID is too long and unreadable. > > > I am trying my very best to figure out how to do the implementation of > > the auto increment in cakePHP, that is to use the codes below: > > > $newId = $this->Subscription->find('list', > > array( > > 'fields'=>'Subscription.scp_id', > > 'order'=>'Subscription.scp_id desc', > > 'limit'=> 1 > > ) > > ); > > $newId2 = Set::extract($newId,'{0}.Subscription.scp_id'); > > $this->data['Subscription']['scp_id'] = $newId2+1; > > > the idea is to extract the latest rolling number in scp_id field and > > then add 1 to it to become the new identifyable id for the system > > users, unfortunately the system keeps giving errors. is there a way > > out? --~--~-~--~~~---~--~~ 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 i display an Auth Message Error please ?
Do you output auth messages in your layout? They have their own "name": $session->flash('auth'); I have done something like this in my layout a few times: if (is_array($messages = $session->read('Message'))) { foreach (array_keys($messages) as $key) { $session->flash($key); } } It will output any and all messages in the session. On Jun 3, 10:32 am, Xanax wrote: > Hi everyone, > > My problem is quite simple : i've setup auth and ACL in my application > everything seems to work fine unless one thing : > > When a user try to launch a forbidden (for him) controllers/actions, > it' just redirect him to another page autorized for him. I would just > like to have an explicit message error like "You don't have access to > this page. Please click here for being redirected..." > > Here are my Auth parameters for information : > > $this->Auth->actionPath = 'controleurs/'; > $this->Auth->userModel = 'User'; > $this->Auth->fields = array('username' => 'login', 'password' => > 'password'); > $this->Auth->loginAction = '/users/login'; > $this->Auth->loginRedirect = '/users/index'; > $this->Auth->loginError = "Identifiant ou mot de passe > incorrects."; > $this->Auth->logoutRedirect = '/planifications/index_users'; > $this->Auth->authError = "Vous n'avez pas accès à cette page."; > $this->Auth->autoRedirect = true; > $this->Auth->authorize = 'actions'; > > As you can see i've setup properly the "$this->Auth->authError" > property. > > Thank you very much for any help, have a good day! --~--~-~--~~~---~--~~ 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: How setting path for only one layout
Petr, Read http://book.cakephp.org/view/428/render. On Jun 2, 1:40 pm, Petr Vytlačil wrote: > APP CONTROLLER > > function beforeRender(){ > if($this->params['controller']=='frontends'){ > // This do nothing > $viewPaths = array(CAKE_CORE_INCLUDE_PATH .'\shared > items\views'); > > // This do nothing > define('LAYOUTS','C:'.DS.'Program > Files'.DS.'VertrigoServ'.DS.'www'.DS.'projekty'.DS.'klientpenzion'.DS.'app'.DS.'view'.DS); > } > } > > please help, how i can set directory for layout, thx. > > On 2 čvn, 13:50, Petr Vytlačil wrote: > > > Hi I develop simple CMS, but it will be multisite system. > > One core (controller, admin, frontend views, models) > > User: (frontend layout, css, images) > > > Pleas is any idea how I can chagne path for on layout in any action in > > controller? > > Path must be in some adr for example: /root/cake/layout/frontend.ctp > > > THX --~--~-~--~~~---~--~~ 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: getNumRows()
I'm looking for the number of rows in Catalog not Product. $this->Product->Catalog->getNumRows() On May 29, 8:32 pm, Miles J wrote: > Why would it be 3, if the rows are 100? --~--~-~--~~~---~--~~ 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: Using XSL - Should I write Component, Helper or Library?
I tried that but I can't pull the XML out of the action's view file. I can do it programmatically (file_get_contents) but I need to catch it in Cake's variables (whichever one it is). How do I access that? On Jun 2, 10:24 pm, Miles J wrote: > You could write your own view class to get this done. Base it off the > cake/libs/view/view.php --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Please Please Help - Non conventional CakePHP ACL Setup...
I have a database setup like this (I know it isnt the best setup but its out of my power to change it :-( Basically there are 3 levels of users - Admin - Managers - Staff Few notes: -Each member of staff belongs to department -If the Staffs logon_code appears in the manager table they are a Manager, otherwise they are a member of staff -If the staffs logon_code appears in the manager table and SystemAdmin is set to 1, they are Admin How on earth do I go about setting ACL/Auth for this? Any ideas? CREATE TABLE `tblStaff` ( `StaffID` int(11) NOT NULL auto_increment, `dept_id` varchar(5) default NULL, `logon_code` char(10) NOT NULL, `forename` char(50) NOT NULL, `surname` char(50) NOT NULL, PRIMARY KEY (`StaffID`), ) ; CREATE TABLE `tblManager` ( `ManagerID` varchar(15) NOT NULL, `logon_code` varchar(15) NOT NULL, `dept_id` varchar(5) NOT NULL, `SystemAdmin` tinyint(1) unsigned default NULL, PRIMARY KEY (`ManagerID`) ) ; CREATE TABLE `tblDepartment` ( `dept_id` varchar(5) NOT NULL, `sect_id` varchar(50) default NULL, `subsect_id` varchar(50) default NULL, `sect_name` varchar(50) default NULL, `sect_abbr` varchar(50) default NULL, `subsect_name` varchar(50) default NULL, PRIMARY KEY (`dept_id`) ) ; --~--~-~--~~~---~--~~ 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: Extracting numeric data and then add one
Oh yes by the way, the above codes generate this error: Column 'scp_id' cannot be null Means there is no value in $newId2 On Jun 3, 5:32 pm, liaogz82 wrote: > Hi all, > > I need help in cakePHP. > > I am using this framework in my area of work. I have successfully > migrated from the old database that uses an auto increment field as > the primary key to one that uses uuid as the primary key. > unfortunately the users request the old ID to be remain in place so > that they can identify, as UUID is too long and unreadable. > > I am trying my very best to figure out how to do the implementation of > the auto increment in cakePHP, that is to use the codes below: > > $newId = $this->Subscription->find('list', > array( > 'fields'=>'Subscription.scp_id', > 'order'=>'Subscription.scp_id desc', > 'limit'=> 1 > ) > ); > $newId2 = Set::extract($newId,'{0}.Subscription.scp_id'); > $this->data['Subscription']['scp_id'] = $newId2+1; > > the idea is to extract the latest rolling number in scp_id field and > then add 1 to it to become the new identifyable id for the system > users, unfortunately the system keeps giving errors. is there a way > out? --~--~-~--~~~---~--~~ 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: Using MySQL's DAYNAME in find
Thanks for the replies, and apologies for not responding sooner - busy! I'm going to try your suggestions out later today though, I'll report back here. theChrisWalker wrote: > If you add an alias to the field list you can do this (I think, again > not tested...) > > $this->paginate['fields'] = am( $this->paginate['fields'], array > ( 'DAYNAME(Model.field) as `day`' ) ); > $this->paginate['conditions'] = am( $this->paginate['conditions'], > array('`day`'=>'Monday' ) ); > > but as Martin says, the SQL produced and the SQL you where hoping for > would be very helpful. > > Chris. > > On Jun 2, 3:10 pm, Martin Westin wrote: > > You don't post any mysql error or what the query looked like (it > > usually tells you what is wrong). > > A shot in the dark but it could be this simple: array('((DAYNAME > > (Model.field)))' => 'Monday'); > > > > On Jun 2, 12:46 pm, toby1kenobi wrote: > > > > > Hi there, > > > > > Is it possible to use MySQL's DAYNAME function in the where clause > > > of a call to 'find'? i.e. something a bit like: > > > > > $this->paginate['conditions'] = array('DAYNAME(Model.field)' => > > > 'Monday'); > > > > > The above doesn't work (which is what I was expecting) but I haven't > > > managed to find an equivalent syntax that does. > > > > > I'm wondering if I should pursue another route? I could put > > > something in afterFind, and test that I'm in the appropriate action as > > > detailed in this useful post, would that be the best approach? > > > > >http://teknoid.wordpress.com/2009/05/04/execute-code-in-model-callbac... > > > > > As ever, any help is greatly appreciated. > > > > > Toby --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Extracting numeric data and then add one
Hi all, I need help in cakePHP. I am using this framework in my area of work. I have successfully migrated from the old database that uses an auto increment field as the primary key to one that uses uuid as the primary key. unfortunately the users request the old ID to be remain in place so that they can identify, as UUID is too long and unreadable. I am trying my very best to figure out how to do the implementation of the auto increment in cakePHP, that is to use the codes below: $newId = $this->Subscription->find('list', array( 'fields'=>'Subscription.scp_id', 'order'=>'Subscription.scp_id desc', 'limit'=> 1 ) ); $newId2 = Set::extract($newId,'{0}.Subscription.scp_id'); $this->data['Subscription']['scp_id'] = $newId2+1; the idea is to extract the latest rolling number in scp_id field and then add 1 to it to become the new identifyable id for the system users, unfortunately the system keeps giving errors. is there a way out? --~--~-~--~~~---~--~~ 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: Using MySQL's DAYNAME in find
If you add an alias to the field list you can do this (I think, again not tested...) $this->paginate['fields'] = am( $this->paginate['fields'], array ( 'DAYNAME(Model.field) as `day`' ) ); $this->paginate['conditions'] = am( $this->paginate['conditions'], array('`day`'=>'Monday' ) ); but as Martin says, the SQL produced and the SQL you where hoping for would be very helpful. Chris. On Jun 2, 3:10 pm, Martin Westin wrote: > You don't post any mysql error or what the query looked like (it > usually tells you what is wrong). > A shot in the dark but it could be this simple: array('((DAYNAME > (Model.field)))' => 'Monday'); > > On Jun 2, 12:46 pm, toby1kenobi wrote: > > > Hi there, > > > Is it possible to use MySQL's DAYNAME function in the where clause > > of a call to 'find'? i.e. something a bit like: > > > $this->paginate['conditions'] = array('DAYNAME(Model.field)' => > > 'Monday'); > > > The above doesn't work (which is what I was expecting) but I haven't > > managed to find an equivalent syntax that does. > > > I'm wondering if I should pursue another route? I could put > > something in afterFind, and test that I'm in the appropriate action as > > detailed in this useful post, would that be the best approach? > > >http://teknoid.wordpress.com/2009/05/04/execute-code-in-model-callbac... > > > As ever, any help is greatly appreciated. > > > Toby --~--~-~--~~~---~--~~ 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: SELECT IN in WHERE clause
On Jun 1, 10:13 pm, havanna wrote: > SQL Error: 1054: Unknown column 'Array' in 'where clause' Try to post your code - and a debug print of $conditions. Regards Jonathan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Can i display an Auth Message Error please ?
Hi everyone, My problem is quite simple : i've setup auth and ACL in my application everything seems to work fine unless one thing : When a user try to launch a forbidden (for him) controllers/actions, it' just redirect him to another page autorized for him. I would just like to have an explicit message error like "You don't have access to this page. Please click here for being redirected..." Here are my Auth parameters for information : $this->Auth->actionPath = 'controleurs/'; $this->Auth->userModel = 'User'; $this->Auth->fields = array('username' => 'login', 'password' => 'password'); $this->Auth->loginAction = '/users/login'; $this->Auth->loginRedirect = '/users/index'; $this->Auth->loginError = "Identifiant ou mot de passe incorrects."; $this->Auth->logoutRedirect = '/planifications/index_users'; $this->Auth->authError = "Vous n'avez pas accès à cette page."; $this->Auth->autoRedirect = true; $this->Auth->authorize = 'actions'; As you can see i've setup properly the "$this->Auth->authError" property. Thank you very much for any help, have a good day! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Question on Set::combine
Hi everyone, I got a simple question on the combine function. I want to simplify an array like for example a groups array: Array ( [0] => Array ( [UserGroup] => Array ( [id] => 1 [parent_id] => [lft] => 1 [rgt] => 2 [name] => admin ) ) [1] => Array ( [UserGroup] => Array ( [id] => 2 [parent_id] => [lft] => 3 [rgt] => 8 [name] => User ) ) ) to work with ACL, and need something like this: Array ( [0] => Array ( [alias] => admin ) [1] => Array ( [alias] => User ) ) When trying to use Set::combine for this I have two problems: + I cannot pass a static key ('alias') + for the group key (3rd parameter) I cannot pass only '{n}' Any advices? Maybe another function that I overlooked so far? Thanks, harpax --~--~-~--~~~---~--~~ 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: Using XSL - Should I write Component, Helper or Library?
Perhaps you could create an element or helper to act as a kind of sub view - you move the code that normally be in the view (i.e. looping through data, building tables etc.) and then return this into a variable in your view rather than just echoing it. You could then do what you wanted with it, pre layout. You can obviously choose which layout (or none at all) to use in the controller - is it possible to set the layout from the view too? John --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---