Re: cakephp lacks sqlite3 support
SQLite3 support is available via the the datasources plugin: https://github.com/cakephp/datasources Regards Ryan Schmidt schrieb: I'm glad I didn't notice, until I was already several hours into learning CakePHP, that it doesn't support sqlite3 databases out of the box, or I might have given up and kept looking for another framework. And I think I like CakePHP, so I'm sticking with it, but I need to resolve this. I'm currently making a small site using MySQL, just to learn the framework, but when that's done, I'll be writing a site that need a database but needs to not require a separate database server program running, and I'm not about to write flat files when SQLite is so much better than that. So, it's the end of 2010. Why doesn't CakePHP support sqlite3? Or maybe it does and it has managed to elude me? Is anybody here using CakePHP with sqlite3? If so, how are you doing it, and have you encountered any sqlite3-specific problems that I would need to look out for? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Configure before components initialize - startupProcess() or constructClasses() a good idea?
Hi there, i've recently stepped into a problem with Session component configuration, i needed to be able to set the Session path and save path for a specific plugin, it's a separate app in the app and runs under a different user, and so i needed to separate the sessions, otherwise it would always throw permission errors when trying to access/delete session temp files, etc. To make a long story short, components may cause/require the session to start on initialization (popular ex. DebugKit), and so one needs to do the configuration earlier. Am i right that the only options are constructClasses() and startupProcess()? I couldn't find any other possible point to hook in, though i'm wondering if this is really the right way to do it? Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Forms security: Not displaying input means it is protected? --zivi-muh
That's how it is. Personally i'm additionally using the fieldList feature (which unfortunately doesn't work well with multiple models and saveAll) as a last line of defense in case something goes wrong and a modified request slips through. Regards Joshua Muheim schrieb: Thanks for the hint to the $whitelist, Stephen. But this seems not necessary to me anymore when using the Security component (which I do and I forgot to mention in my first post). Look at this (http://book.cakephp.org/view/175/Security-Component): When using the Security Component you must use the FormHelper to create your forms. The Security Component looks for certain indicators that are created and managed by the FormHelper (especially those created in create() and end()). Dynamically altering the fields that are submitted in a POST request (e.g. disabling, deleting or creating new fields via JavaScript) is likely to trigger a black-holing of the request. See the $validatePost or $disabledFields configuration parameters. So if you're using Security component, the end user can't mess with the POST data anymore. :-) Any other comment about this, anyone? On Fri, Nov 26, 2010 at 12:08 PM, Stephen step...@ninjacodermonkey.co.uk wrote: Hi There You should use a whitelist to specify the fields to save, any other fields will not be saved. Even if you don't display the field on the page, a user can still create the post variable from within their browser and use it to change data they shouldn't really be allowed to. Hope this helps Stephen On 26 November 2010 10:38, psybear83 psybea...@gmail.com wrote: Hey everybody In my application, users can edit their email, phone number etc., but they are *not* allowed to edit their username - only admins are allowed to do that. So I'm wondering: is it safe to simply not display the username field to the user? Afaik CakePHP makes sure that the form hasn't been manually edited (e.g. adding a username input field), right? So I don't have to double-check on the application's side, e.g. by unsetting the $data[User][username] field, as long as I'm only displaying form fields using CakePHP's form helper (and not deactivating them by just hiding them using CSS or so), right? If so - yeah, sweet! Thanks, CakePHP! :-) Waiting for your confirmation about this fact, guys... Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- Kind Regards Stephen @ NinjaCoderMonkey www.ninjacodermonkey.co.uk Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Which upload plugin/behavior/component do YOU use? --psybear
I'm using David Perssons Media Plugin because it is very flexible, makes media modification/conversion (thumbnails, compression, type conversion, etc..) simple, is easy to extend, and is up to date. It just could need more documentation, examples, etc., and a little more automagic when it comes to updating records and managing versions. https://github.com/davidpersson/media Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Memory Consumption of Associated Models?
Give containable a try: http://book.cakephp.org/view/1323/Containable Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Memory Consumption of Associated Models?
Sorry, i must have been blind. However, it shouldn't be that hard to write your own behaviour that back ups the original associations and manages binding/unbinding by simple identifiers. Regards O.J. Tibi schrieb: Hi Odd, As I said earlier, the Containable behavior doesn't work for the number of PHP objects (models) loaded in-memory, so no dice here. :) On Nov 25, 3:27 pm, odd zakmccrac...@web.de wrote: Give containable a try: http://book.cakephp.org/view/1323/Containable Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Media Plugin: file operation causes find() to fail
Hi there, I have a big problem with David Perssons Media plugin. The situation is as follows, i have a model that uses the Media plugin, and in the beforeSave handler deletes files from the media directory (original file and versions). Deletion of the files occours in separate methods, each method uses a find operation to retreive the records data that is about to be updated. Here's the essential part of the code: http://pastebin.com/bb3b9WTG Now the problem is that the file operation, unlink in this case (though for example rename causes the same problem), seems to cause the following find operation in the _deleteVersions method to fail, $record is always empty, where as it works fine in the _deleteOriginal method. When removing the delete call the record is fetched correctly. This odd behaviour is somehow connected to the Media plugin, 'cause when removing it, the find operations works fine even with the file delete operation. I've tested it on Windows 7 x64 with PHP 5.3.1 and on Linux/Ubuntu with PHP 5.2.12 and 5.3.2, the same behaviour everywhere, and i'm at my wits' end, i have no clue what exactly is causing the problem. Anyone ever experienced something like that? Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Media Plugin: file operation causes find() to fail
Hi David, thanks for the quick reply. I can't belive that it was that easy, i really don't know why i haven't spotted it :) Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Adding new items to a form dynamically
The reason is Cakes security layer, when creating forms with the Form helper, it automatically creates a signature based on the form elements (position, type, id, name, etc). When receiving data Cake checks the signature (data[_Token][key] and data[_Token][fields]) against the value stored in the session, and if it doesn't match the request gets blackholed, see: http://book.cakephp.org/view/1296/Security-Component So when using the security component, you must resign your forms, that's a bit tricky because there's no interface that simply gives you these values, you have to create the form, and then fetch the values from the genereated HTML, that can for example be done using regular expressions or the XML parser. What i do in such cases is sending an AJAX request with the number of elements (in this case file input fields), generate the form and store the newly created elements in an array, and fetch the token values using XML and Set. After receiving the data i do udpate the form by adding the newly genereated elements and updating the token elements. I have recently done it in a project, this is how i regenerate the form and fetch the field and token data: http://pastebin.com/WAKD5X2P It creates a form with where the first div contains the _Token.key input field, and the last one the _Token.fields one. The genereated fieldsets contain the file input elements. The JavaScript part looks something like this, it simply updates the _Token input fields and appends the newly generated form elements if neccessary: http://pastebin.com/d9tYQUT3 Regards Arak Tai'Roth schrieb: So, here is my situation. I have a form that allows users (only admins) to upload images for a specific product. What I have created is a solution that when they load the add form initially it has one file upload and one caption text box. However, they can click a button lower down, that dynamically adds another file upload and another caption box, so they can essentially upload however many images they want to at a time. Here is the code that I have: images_controller.php function add($productID = NULL) { if ($this-RequestHandler-isPost()) { $slug = $this-Session-read('ProductSlug'); if ($this-Image-saveAll($this-data)) { $this-Session-setFlash('Images have been added to the product.'); $this-redirect('/product/' . $slug); $this-exit(); } } else { $this-Session-write('ProductID', $productID); $this-Session-write('ImageCounter', 0); } } function moreImages() { if ($this-RequestHandler-isAjax()) { $images = $this-Session-read('ImageCounter'); $images++; $this-Session-write('ImageCounter', $images); $this-render('/elements/imageAdd'); } } and imageAdd.ctp $image = $this-Session-read('ImageCounter'); echo $this-Form-input('Image.' . $image . '.product_id', array('type' = 'hidden', 'default' = $this-Session- read('ProductID'))); echo $this-Form-label('Image.' . $image . '.filename', 'Image:'); echo $this-Form-input('Image.' . $image . '.filename', array('label' = false, 'type' = 'file')); echo $this-Form-label('Image.' . $image . '.caption', 'Caption:'); echo $this-Form-input('Image.' . $image . '.caption', array('label' = false)); and finally the js file that adds the stuff: $(document).ready(function() { $('#forms img').click(function() { $.ajax({ url: someUrl', dataType: 'html', success: function(data) { $('#forms div.formInputs').append(data); } }); }); }); Now, what this does. When the user goes to the add form, it renders the element imageAdd. Which creates 3 form elements, 1 hidden. Each form element is rendered with Image.0.columnName. Then if they click the image at the bottom, it renders another element imageAdd, but this time the elements are all named Image.1.columnName, and so on. Now for my issue. All of this works fine if they just add one image. However, that clearly defeats the purpose of this. When they go to add 2 or more images, it goes to a blank screen, where even the view source is blank. So I have no idea what's going wrong. It goes there before the timeout that's declared in php.ini, and I've made sure that the combined filesize is also lower then what's allowed in my php.ini. Also, if it makes a difference, I am using MeioUpload for the file upload behaviour. Any help on this is greatly appreciated. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the
Re: Media Behaviour - OGG not detected correctly
Hi David, thanks for the quick update, works fine :) Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Associations - How deep is too deep?
My structure is like this Release hasOne Cover hasMany Track hasMany TrackVariant A release has one cover (image), many tracks (tracks on an album), and every track can be available in various media formats (wav, mp3, ogg, etc). I don't think that's very complex, actually there is still much room for more normalization. Ofcourse i could use the Track model for variants by for example self-joining it, but i don't want to cripple my DB structure just because of CakePHPs automagic shortcomings ;) I'm now saving it manually, first Release and Cover, and then every single Track with its TrackVariants - works fine :) Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Sessions and http/https
dtemes schrieb: I tryed with a custom save handler, but then i moved to database driver sessions, so finally I decided to touch the cake core code and set session.cookie_secure to 0, I am not really fond of this kind of solutions and would prefer a way to set it up from a config file without having to change the framework code. Not sure what you mean, when using a custom save handler you can simply copy the core code in there, and add the ini_set call that sets cookie_secure to 0. So when using database sessions copy the code in database switch case (cake_session.php, line 503) /// if (empty($_SESSION)) { if (Configure::read('Session.model') === null) { trigger_error(__(You must set the all Configure::write('Session.*') in core.php to use database storage), E_USER_WARNING); $this-_stop(); } if ($iniSet) { ini_set('session.use_trans_sid', 0); ini_set('url_rewriter.tags', ''); ini_set('session.save_handler', 'user'); ini_set('session.serialize_handler', 'php'); ini_set('session.use_cookies', 1); ini_set('session.name', Configure::read('Session.cookie')); ini_set('session.cookie_lifetime', $this-cookieLifeTime); ini_set('session.cookie_path', $this-path); ini_set('session.auto_start', 0); } } session_set_save_handler( array('CakeSession','__open'), array('CakeSession', '__close'), array('CakeSession', '__read'), array('CakeSession', '__write'), array('CakeSession', '__destroy'), array('CakeSession', '__gc') ); ini_set('session.cookie_secure', 0); /// Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Get Function Name
Doesn't have much to do with CakePHP, see magic constants in the PHP manual, you are searching for __FUNCTION__ or __METHOD__ http://php.net/manual/en/language.constants.predefined.php Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Sessions and http/https
Maybe the session.cookie_secure option is set to true/1 by default in your PHP configuration (see php.ini), so uncommenting that line in cakes session class wont have any effect. Or maybe you have some PHP extension installed that automatically chooses to secure the cookie. Instead of uncommenting that line, try changing it to set the option to 0 and see if it makes any difference. If it works you'd probably better do that using a custom session save handler. Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Associations - How deep is too deep?
Nested associations - How deep is too deep? I'm still struggeling a bit with associations, i'm wondering if there is a limit in cakes automagic functionality. One level works fine, ie for example ModelA hasMany ModelB Sending forms and saving everything using saveAll works fine. However, if i add another level: ModelA hasMany ModelB hasMany ModelC It starts getting problematic. First of all, when adding data for ModelC in the form like this (not sure whether this is correct at all): ModelB.0.ModelC.0.field cakes security layer won't accept the form at all, it ends up in an 404 blackhole. After disabling the security check the data was passed fine, but it isn't saved. So my question is whether there is a limit to the automagic functionality, is one level of nesting the maximum it can handle? Do i need to save the additional data manually? Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Associations - How deep is too deep?
Ok, i missed that note: Saving related data with saveAll() will only work for directly associated models. http://book.cakephp.org/view/1031/Saving-Your-Data So, i have to do it manually... but i'm still wondering why cake wont eat the form when sending such nested structures? Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Media Behaviour - OGG not detected correctly
Ok, my problem is that OGG files are put in the generic category, instead of audio. I think i've more or less isolated the problem, in the transfer behavior, the transferTo method invokes Mime_Type::guessName transfer.php, line 345: $name = Mime_Type::guessName($mimeType ? $mimeType : $file); and passes the name of the file. Mime_Type::guessName will then invoke self::guessType in order to find out the mime type. Type.php, line 235: $mimeType = self::guessType($file, array('experimental' = false)); Then the guessType method invokes self::$glob-analyze, Type.php, line 175: $globMatch = (array) self::$glob-analyze($name); and now comes the problem, it doesn't return a single match, instead it returns multiple types (application/ogg, audio/x-vorbis+ogg, audio/ x-flac+ogg, etc), and so the following check: Type.php, line 177: if (count($globMatch) === 1) { results in false, the script continues, and reaches the check whether the $file parameter is a file or a resource, Type.php, line 182: if (is_resource($file)) { Type.php, line 184: } elseif (is_file($file)) { since it's neither of those it ends up at Type.php, line 187: } else { return; } and so it doesn't return the correct mime type, and Mime_Type::guessName returns generic: Type.php, line 242: return 'generic'; So, now i'm wondering what i could do to make it work. Should i remove the duplicate mime types in the glob.db file? Or is this behaviour maybe a bug? Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Auto genereated links do not include route prefixes
Solved it. I've change the route like this: Router::connect('/mobile/:controller/:action/*', array('theme' = 'mobile')); and the link generation like this: $html-link('Title', array('plugin' = null, 'controller' = 'news', 'action' = 'view', 'theme' = $this-params['theme'], $id)); Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Media Behaviour not working with hasOne association
I'm using David Perssons Media Behaviour (http://github.com/ davidpersson/media), and i have a small problem. When trying to save a model that has a hasOne association, the associated model is saved, but the behaviour isn't triggered. The association in my model, named Release, is set up like this: var $hasOne = array( 'Cover' = array( 'className' = 'Cover', 'foreignKey' = 'release_id' 'dependent' = true ) ); In the Cover model the Media Behaviours are set up like this: var $actsAs = array('Media.Transfer', 'Media.Generator', 'Media.Coupler'); And in my view i've added/changed this: echo $this-Form-create('Release', array('type' = 'file')); echo $this-Form-input('Cover.file', array('type' = 'file', 'label' = 'Cover')); According to the manual all i need to do now is to call saveAll, but unfortunately it doesn't work correctly. The data sent is structured correctly (according to http://book.cakephp.org/view/1031/Saving-Your-Data), it looks like this: Array ( ... [Release] = Array ( ... ) [Cover] = Array ( [file] = Array ( [name] = test.jpg [type] = image/jpeg [tmp_name] = G:\xampp\tmp\php6E91.tmp [error] = 0 [size] = 178534 ) ) ) and the associated model is saved, ie a record for the Cover model is created, but the behaviours aren't triggered, ie no file is uploaded and the additional dirname and basename fields are empty. Adding some debug output i've found out that the associated model when saved by saveAll isn't using the actual Cover model, instead it uses AppModel where no actsAs is defined. So my question is... what the heck is going on there? ;) Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Media Behaviour not working with hasOne association
Solved this one too :) It was a simple typo in the Cover model class name, so cake couldn't find it and substitued it with AppModel... Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Auto genereated links do not include route prefixes
Hello, i have a small routing and linking problem, and i can't find a solution for it. The problematic route looks like this: Router::connect('/mobile/:controller/:action/*', array('mobile' = true)); Works fine so far, the problem are the links, they aren't compiled as i would expect it, the following call for example: $html-link('Title', array('plugin' = null, 'controller' = 'news', 'action' = 'view', $id)); creates a link like this: /news/view/1 but i would expect it to look like this /mobile/news/view/1 Can anyone point me in the right direction? Do i explicitly have to tell the link method that it should include the mobile prefix (i've put it in quotes because actually it's not a route prefix, and i don't want it to be!)? Regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en