Re: Wrong request method (2.1.2)

2012-05-04 Thread Jimit Kapadya
Which book is best in CakePhp..

On Sat, May 5, 2012 at 9:41 AM, Miles J  wrote:

> I believe it has changed so if you are doing an edit it sends a PUT, else
> if you are doing a create it sends a POST.
>
> I ran into that same issue today.
>
>
> On Friday, May 4, 2012 1:17:31 PM UTC-7, SigalX wrote:
>>
>> I've seen that cake had sent "PUT" in the "_method" variable but it was
>> POST and I got "PUT" from $this->request->method() in the controller as
>> well. How to get truly request method via cake?
>
>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Wrong request method (2.1.2)

2012-05-04 Thread Miles J
I believe it has changed so if you are doing an edit it sends a PUT, else 
if you are doing a create it sends a POST.

I ran into that same issue today.

On Friday, May 4, 2012 1:17:31 PM UTC-7, SigalX wrote:
>
> I've seen that cake had sent "PUT" in the "_method" variable but it was 
> POST and I got "PUT" from $this->request->method() in the controller as 
> well. How to get truly request method via cake?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Problem with Miles J. Uploader plugin and image name

2012-05-04 Thread Miles J
What version are you using?

On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote:
>
> This is my behavior setup:
>
> public $actsAs = array(
> 'Uploader.Attachment' => array(
> 'image_upload' => array(
> 'name'=> 'formatFileName', 
> 'baseDir'=> IMAGES,
> 'uploadDir'=> 'writers',
> 'dbColumn'=> 'image', 
> 'maxNameLength'=> 200, 
> 'overwrite' => true,
> 'transforms' => array(
> array('method' => 'resize', 'width' => IMAGE_WRITER_H, 
> 'height' => IMAGE_WRITER_H, 'dbColumn' => 'image', 'append' => false),
> array('method' => 'resize', 'width' => 
> IMAGE_WRITER_THUMB_W, 'height' => IMAGE_WRITER_THUMB_W, 'dbColumn' => 
> 'thumb', 'append' => '_thumb')
> )
> )
> )
> );
>
> The problem is that the saved image in 'image' column is "bowser-1.png", 
> instead the expected "bowser.png".
>
> The thumb works fine and is named "bowser_thumb.png" as expected.
>
> Any idea?
>
>
On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote:
>
> This is my behavior setup:
>
> public $actsAs = array(
> 'Uploader.Attachment' => array(
> 'image_upload' => array(
> 'name'=> 'formatFileName', 
> 'baseDir'=> IMAGES,
> 'uploadDir'=> 'writers',
> 'dbColumn'=> 'image', 
> 'maxNameLength'=> 200, 
> 'overwrite' => true,
> 'transforms' => array(
> array('method' => 'resize', 'width' => IMAGE_WRITER_H, 
> 'height' => IMAGE_WRITER_H, 'dbColumn' => 'image', 'append' => false),
> array('method' => 'resize', 'width' => 
> IMAGE_WRITER_THUMB_W, 'height' => IMAGE_WRITER_THUMB_W, 'dbColumn' => 
> 'thumb', 'append' => '_thumb')
> )
> )
> )
> );
>
> The problem is that the saved image in 'image' column is "bowser-1.png", 
> instead the expected "bowser.png".
>
> The thumb works fine and is named "bowser_thumb.png" as expected.
>
> Any idea?
>
>
On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote:
>
> This is my behavior setup:
>
> public $actsAs = array(
> 'Uploader.Attachment' => array(
> 'image_upload' => array(
> 'name'=> 'formatFileName', 
> 'baseDir'=> IMAGES,
> 'uploadDir'=> 'writers',
> 'dbColumn'=> 'image', 
> 'maxNameLength'=> 200, 
> 'overwrite' => true,
> 'transforms' => array(
> array('method' => 'resize', 'width' => IMAGE_WRITER_H, 
> 'height' => IMAGE_WRITER_H, 'dbColumn' => 'image', 'append' => false),
> array('method' => 'resize', 'width' => 
> IMAGE_WRITER_THUMB_W, 'height' => IMAGE_WRITER_THUMB_W, 'dbColumn' => 
> 'thumb', 'append' => '_thumb')
> )
> )
> )
> );
>
> The problem is that the saved image in 'image' column is "bowser-1.png", 
> instead the expected "bowser.png".
>
> The thumb works fine and is named "bowser_thumb.png" as expected.
>
> Any idea?
>
>
On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote:
>
> This is my behavior setup:
>
> public $actsAs = array(
> 'Uploader.Attachment' => array(
> 'image_upload' => array(
> 'name'=> 'formatFileName', 
> 'baseDir'=> IMAGES,
> 'uploadDir'=> 'writers',
> 'dbColumn'=> 'image', 
> 'maxNameLength'=> 200, 
> 'overwrite' => true,
> 'transforms' => array(
> array('method' => 'resize', 'width' => IMAGE_WRITER_H, 
> 'height' => IMAGE_WRITER_H, 'dbColumn' => 'image', 'append' => false),
> array('method' => 'resize', 'width' => 
> IMAGE_WRITER_THUMB_W, 'height' => IMAGE_WRITER_THUMB_W, 'dbColumn' => 
> 'thumb', 'append' => '_thumb')
> )
> )
> )
> );
>
> The problem is that the saved image in 'image' column is "bowser-1.png", 
> instead the expected "bowser.png".
>
> The thumb works fine and is named "bowser_thumb.png" as expected.
>
> Any idea?
>
>
On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote:
>
> This is my behavior setup:
>
> public $actsAs = array(
> 'Uploader.Attachment' => array(
> 'image_upload' => array(
> 'name'=> 'formatFileName', 
> 'baseDir'=> IMAGES,
> 'uploadDir'=> 'writers',
> 'dbColumn'=> 'image', 
> 'maxNameLength'=> 200, 
> 'overwrite' => true,
> 'transforms' => array(
> array('method' => 'resize', 'width' => IMAGE_WRITER_H, 
> 'height' 

large pdf

2012-05-04 Thread oscar aguilar morales

Hello. I've been using cakephp for 2 years, but now I'm working with a kind of 
huge database almost 600,000 , With this system the user need to be able to 
download a pdf file can reach 100,000 so with these creating a script for 
writing the pdf file would crash with the server. But I have put attention to 
the way the xampp make a script of a database downloadable ,it seems like the 
the server create the file on the client side, please I would like to know if 
you know how to deal with it and if so, where I can read more about this topic, 
Thanks For Your Time :)

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Wrong request method (2.1.2)

2012-05-04 Thread stork
Html form supports just GET and POST methods, thats why CakePHP (and 
others) uses workaround with _method to fake PUT and DELETE. If you 
want/need true PUT request from web browser, use XMLHttpRequest (ajax).

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Edit method in hasMany Model

2012-05-04 Thread lhas
Hello, guys.

I'm working with CakePHP 2.1.2 stable.

I search about this problem, but i don't found any solution.

This is the models-relationship:

Usuarios (Users)
UsuarioEmails (UserEmails)
UsuarioEndereco (UserAddress)

A User hasMany UserEmail and UserAddress.

In add method, i create the User and add news rows in the UserEmail
and UserAddress, with your values = NULL.
In the edit method, i want to edit theses rows with NULL values (from
UserEmail and UserAddress).
I want to use this edit method in User, to edit in one form all these
informations.

By the way, i have this in edit method:

http://bin.cakephp.org/view/1820438376

And this in edit view:

http://bin.cakephp.org/view/1154545357

But when i submit the form, the CakePHP rather than update the rows,
he create news rows.

3   INSERT INTO `---`.`tbl_usuarios` (`nome`, `modified`, `created`)
VALUES ('Luiz Henrique Almeida sada Silva', '2012-05-04 15:59:47',
'2012-05-04 15:59:47')  1   1   1
4   INSERT INTO `---`.`tbl_usuario_enderecos` (`usuario_id`, `endereco`,
`bairro`, `cidade`, `cep`, `ativo`, `modified`, `created`) VALUES (15,
'', '', '', '', '1', '2012-05-04 15:59:47', '2012-05-04 15:59:47')  
1
1   1
5   INSERT INTO `---`.`tbl_usuario_emails` (`usuario_id`, `email`,
`senha`, `modified`, `created`) VALUES (15, 'luizhr...@gmail.com',
'relogio123', '2012-05-04 15:59:47', '2012-05-04 15:59:47') 1   
1   1
6   COMMIT

How i can do to the saveAssociated method update, rathe than insert
new rows?

Thanks, and sorry for my bad english. =)
Lhas
luizhr...@gmail.com

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Problem with Miles J. Uploader plugin and image name

2012-05-04 Thread Xoubaman
After further investigation, the black square only apperas when the first 
resize operation actually takes place. If the source image is smaller than 
the max hegith and width, the thumb is correctly generated.

If I add a third transform, with the same params as the second changing the 
append value only, the third image doesn't show the black part (unless the 
second algo has it).

El viernes, 4 de mayo de 2012 19:14:25 UTC+2, Xoubaman escribió:
>
> Mmmm... sad that after try lots of things I missed one so obvious.
>
> But, now that the naming problem is solved, the thumb generation is 
> producing an unexpected result, wrapping the image with smaller width and 
> height into a black square of the passed mesaures
>
> Here is a capture: http://i.minus.com/iMCU4QfzWadYN.jpg
>
> It will be nice to allow using the Uploader image functions isolated with 
> custom images and not only after uploading them.
>
> Great plugin however, and thanks for the fast reply.
>
> El viernes, 4 de mayo de 2012 07:41:50 UTC+2, Miles J escribió:
>>
>> Are you trying to overwrite the original image with the resized one?
>>
>> Try adding overwrite = true to the resize transformation.
>>
>> On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote:
>>>
>>> This is my behavior setup:
>>>
>>> public $actsAs = array(
>>> 'Uploader.Attachment' => array(
>>> 'image_upload' => array(
>>> 'name'=> 'formatFileName', 
>>> 'baseDir'=> IMAGES,
>>> 'uploadDir'=> 'writers',
>>> 'dbColumn'=> 'image', 
>>> 'maxNameLength'=> 200, 
>>> 'overwrite' => true,
>>> 'transforms' => array(
>>> array('method' => 'resize', 'width' => 
>>> IMAGE_WRITER_H, 'height' => IMAGE_WRITER_H, 'dbColumn' => 'image', 'append' 
>>> => false),
>>> array('method' => 'resize', 'width' => 
>>> IMAGE_WRITER_THUMB_W, 'height' => IMAGE_WRITER_THUMB_W, 'dbColumn' => 
>>> 'thumb', 'append' => '_thumb')
>>> )
>>> )
>>> )
>>> );
>>>
>>> The problem is that the saved image in 'image' column is "bowser-1.png", 
>>> instead the expected "bowser.png".
>>>
>>> The thumb works fine and is named "bowser_thumb.png" as expected.
>>>
>>> Any idea?
>>>
>>>
El viernes, 4 de mayo de 2012 19:14:25 UTC+2, Xoubaman escribió:
>
> Mmmm... sad that after try lots of things I missed one so obvious.
>
> But, now that the naming problem is solved, the thumb generation is 
> producing an unexpected result, wrapping the image with smaller width and 
> height into a black square of the passed mesaures
>
> Here is a capture: http://i.minus.com/iMCU4QfzWadYN.jpg
>
> It will be nice to allow using the Uploader image functions isolated with 
> custom images and not only after uploading them.
>
> Great plugin however, and thanks for the fast reply.
>
> El viernes, 4 de mayo de 2012 07:41:50 UTC+2, Miles J escribió:
>>
>> Are you trying to overwrite the original image with the resized one?
>>
>> Try adding overwrite = true to the resize transformation.
>>
>> On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote:
>>>
>>> This is my behavior setup:
>>>
>>> public $actsAs = array(
>>> 'Uploader.Attachment' => array(
>>> 'image_upload' => array(
>>> 'name'=> 'formatFileName', 
>>> 'baseDir'=> IMAGES,
>>> 'uploadDir'=> 'writers',
>>> 'dbColumn'=> 'image', 
>>> 'maxNameLength'=> 200, 
>>> 'overwrite' => true,
>>> 'transforms' => array(
>>> array('method' => 'resize', 'width' => 
>>> IMAGE_WRITER_H, 'height' => IMAGE_WRITER_H, 'dbColumn' => 'image', 'append' 
>>> => false),
>>> array('method' => 'resize', 'width' => 
>>> IMAGE_WRITER_THUMB_W, 'height' => IMAGE_WRITER_THUMB_W, 'dbColumn' => 
>>> 'thumb', 'append' => '_thumb')
>>> )
>>> )
>>> )
>>> );
>>>
>>> The problem is that the saved image in 'image' column is "bowser-1.png", 
>>> instead the expected "bowser.png".
>>>
>>> The thumb works fine and is named "bowser_thumb.png" as expected.
>>>
>>> Any idea?
>>>
>>>
El viernes, 4 de mayo de 2012 19:14:25 UTC+2, Xoubaman escribió:
>
> Mmmm... sad that after try lots of things I missed one so obvious.
>
> But, now that the naming problem is solved, the thumb generation is 
> producing an unexpected result, wrapping the image with smaller width and 
> height into a black square of the passed mesaures
>
> Here is a capture: http://i.minus.com/iMCU4QfzWadYN.jpg
>
> It will be nice to allow using the Uploader image functions isolated with 
> custom images and not only after uploading them.
>
> Great plugin however, and thanks for the fast reply.
>
> El viernes, 4 de mayo de 2012 07:41:50 UTC+2, Miles J escribió:
>>
>> Are you trying to overwrite the origina

Re: Problem with Miles J. Uploader plugin and image name

2012-05-04 Thread Xoubaman
After further investigation, the black square only apperas when the first 
resize operation actually takes place. If the source image is smaller than 
the max hegith and width, the thumb is correctly generated.

If I add a third transform, with the same params as the second changing the 
append value only, the third image doesn't show the black part (unless the 
second algo has it).

El viernes, 4 de mayo de 2012 19:14:25 UTC+2, Xoubaman escribió:
>
> Mmmm... sad that after try lots of things I missed one so obvious.
>
> But, now that the naming problem is solved, the thumb generation is 
> producing an unexpected result, wrapping the image with smaller width and 
> height into a black square of the passed mesaures
>
> Here is a capture: http://i.minus.com/iMCU4QfzWadYN.jpg
>
> It will be nice to allow using the Uploader image functions isolated with 
> custom images and not only after uploading them.
>
> Great plugin however, and thanks for the fast reply.
>
> El viernes, 4 de mayo de 2012 07:41:50 UTC+2, Miles J escribió:
>>
>> Are you trying to overwrite the original image with the resized one?
>>
>> Try adding overwrite = true to the resize transformation.
>>
>> On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote:
>>>
>>> This is my behavior setup:
>>>
>>> public $actsAs = array(
>>> 'Uploader.Attachment' => array(
>>> 'image_upload' => array(
>>> 'name'=> 'formatFileName', 
>>> 'baseDir'=> IMAGES,
>>> 'uploadDir'=> 'writers',
>>> 'dbColumn'=> 'image', 
>>> 'maxNameLength'=> 200, 
>>> 'overwrite' => true,
>>> 'transforms' => array(
>>> array('method' => 'resize', 'width' => 
>>> IMAGE_WRITER_H, 'height' => IMAGE_WRITER_H, 'dbColumn' => 'image', 'append' 
>>> => false),
>>> array('method' => 'resize', 'width' => 
>>> IMAGE_WRITER_THUMB_W, 'height' => IMAGE_WRITER_THUMB_W, 'dbColumn' => 
>>> 'thumb', 'append' => '_thumb')
>>> )
>>> )
>>> )
>>> );
>>>
>>> The problem is that the saved image in 'image' column is "bowser-1.png", 
>>> instead the expected "bowser.png".
>>>
>>> The thumb works fine and is named "bowser_thumb.png" as expected.
>>>
>>> Any idea?
>>>
>>>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Potential Database Project using Cake PHP

2012-05-04 Thread Michael Gaiser
http://book.cakephp.org/2.0/en/index.html

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Cakephp SSN Encryption

2012-05-04 Thread Steven Scaffidi
Just in case anyone found this useful here is an update. This finally 
worked:

$ssns = $this->User->query("SELECT id, ssn_temp FROM users as User ORDER BY 
id");
foreach ($ssns as $i) {
$this->User->id = $i['User']['id'];
$this->User->saveField('ssn', $i['User']['ssn_temp']);
}

Also be sure to put set_time_limit(0); in your bootstrap.php file. 

Thanks for all the help Justin.

On Wednesday, May 2, 2012 4:02:03 PM UTC-5, Justin Edwards wrote:
>
> You can do it in batches.  You can also set the timeout.  
> http://php.net/manual/en/function.set-time-limit.php
>
> 'conditions' => array('User.id <' => '200')
>
>
> On Wed, May 2, 2012 at 3:39 PM, Steven Scaffidi  wrote:
>
>> I created SSN through using regular sql and just literally copying whats 
>> in the ssn field to the ssn_temp field. And then, this would work if it 
>> didn't time out on me. How can I change the timeout time? There has to be a 
>> better way to do this though. 
>>
>> public function encryptssn() {
>> $ssns = $this->User->find('list', array('fields' => array('id', 
>> 'ssn_temp')));
>>  $j = 1;
>> foreach ($ssns as $i) {
>> $this->User->id = $j;
>>  $this->User->saveField('ssn', $i);
>> $j++;
>> }
>>  $this->redirect(array('action' => 'index')); 
>> }
>>
>> On Wednesday, May 2, 2012 3:03:46 PM UTC-5, Steven Scaffidi wrote:
>>>
>>> Can you give me a specific example of how to use saveMany? I have 4000 
>>> clients in my database. Can I create another encrypted field in the 
>>> database (say ssn_temp) then do something like this:
>>>
>>> $this->User->saveMany(array(**array('ssn_temp' => array('User' => 
>>> 'ssn'; 
>>>
>>> Would something like that work? I'm really confused by the documentation 
>>> on saveMany
>>>
>>> On Tuesday, May 1, 2012 2:51:50 PM UTC-5, Justin Edwards wrote:

 Sorry temp table* not temp folder

 On Tue, May 1, 2012 at 7:51 PM, Justin Edwards <
 justinledwa...@gmail.com> wrote:

> Steven,
>
> Create a controller method.
>
> Find the data from the temp folder set it to a variable, and then 
> saveMany from the variable to the encrypted table.   
>
> http://book.cakephp.org/2.0/**en/models/saving-your-data.**
> html#model-savemany-array-**data-null-array-options-array
>  
>
>
> On Tue, May 1, 2012 at 7:18 PM, Steven Scaffidi wrote:
>
>> Ok I have the data migrated already (I probably should have used 
>> something like pentaho instead of writing my own queries but oh well). 
>> How 
>> do I use cake's encryption function on the data?
>>
>> On Tuesday, May 1, 2012 2:07:56 PM UTC-5, Justin Edwards wrote:
>>>
>>> I would migrate it using pentaho.  Then you can run cake's 
>>> encryption function on the data.   You could make a temporary table 
>>> /model 
>>> and then append it to the production table.
>>>
>>> On Tue, May 1, 2012 at 7:01 PM, Steven Scaffidi 
>>> wrote:
>>>
 Thanks for the plugin that worked great. I still don't understand 
 how
 to use pentaho though to encrypt social security numbers listed in 
 the
 access database.

 On Apr 30, 5:28 pm, Justin Edwards  
 wrote:
 > #1http://bakery.cakephp.org/**ar**ticles/jmillerdesign/2011/**12/
 **29/cipher_pl.
 ..
 > #2http://www.pentaho.com/**downl**oad/
 >
 >
 >
 >
 >
 >
 >
 > On Mon, Apr 30, 2012 at 4:46 PM, Steven Scaffidi <
 ssca...@gmail.com> wrote:
 > > Hi - I'm looking for information on how to encrypt data in 
 Cakephp. My
 > > employer had a client management system built in Microsoft 
 Access, and
 > > I recently took that application and put it on a web-based 
 space built
 > > in cake. I need to now two things:
 >
 > > #1 How can I encrypt social security numbers from new clients 
 coming
 > > into the system? I'm encrypting passwords right now, but I'm 
 not sure
 > > how to do social security numbers.
 >
 > > #2 How do I take social security numbers that are currently 
 listed in
 > > Microsoft Access with no encryption and put them into the MySQL
 > > database encrypted?
 >
 > > Thanks for the help,
 >
 > > Steven
 >
 > > --
 > > Our newest site for the community: CakePHP Video Tutorials
 > >http://tv.cakephp.org
 > > Check out the new CakePHP Questions 
 sitehttp://ask.cakephp.organd help
 > > others with their CakePHP related questions.
 >
 > > To unsubscribe from this group, send ema

Re: What is the 2nd parameter for in the __ function?

2012-05-04 Thread Xoubaman
Yes, it's ok.

The point is, you can use __('User %s was not found.', $username) and the 
%s will be replaced with the value in $username, or with __('User %s from 
%s was not found.', $username, $country) you'll get, for example, "User 
John from Jamaica was not found".

El viernes, 4 de mayo de 2012 19:38:27 UTC+2, Daniel escribió:
>
> I'm using Cake 2.0, so this is OK, right? 
> $this->Session->setFlash(__('User was not found.'));

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: What is the 2nd parameter for in the __ function?

2012-05-04 Thread Daniel
I'm using Cake 2.0, so this is OK, right?
$this->Session->setFlash(__('User was not found.'));

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


cake-php@googlegroups.com

2012-05-04 Thread Xoubaman
When I found that there is such a way to ask for help, I start to use it 
and answer the questions I know how to, moving my "help activity" from this 
group to Q&A.

But, after some time, I realized that the Q&A service is quite "abandoned", 
much less healthy than the google group and almost hidden in the Cake 
website (just a link in the top menu, whit the group much more visible an 
accesible).

I think that centralize all in just one place (due to activity, this group) 
will be better than split the users in two sites. Not a big problem at all 
and no intention to blame anyone, just a personal thought.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Problem with Miles J. Uploader plugin and image name

2012-05-04 Thread Xoubaman
Mmmm... sad that after try lots of things I missed one so obvious.

But, now that the naming problem is solved, the thumb generation is 
producing an unexpected result, wrapping the image with smaller width and 
height into a black square of the passed mesaures

Here is a capture: http://i.minus.com/iMCU4QfzWadYN.jpg

It will be nice to allow using the Uploader image functions isolated with 
custom images and not only after uploading them.

Great plugin however, and thanks for the fast reply.

El viernes, 4 de mayo de 2012 07:41:50 UTC+2, Miles J escribió:
>
> Are you trying to overwrite the original image with the resized one?
>
> Try adding overwrite = true to the resize transformation.
>
> On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote:
>>
>> This is my behavior setup:
>>
>> public $actsAs = array(
>> 'Uploader.Attachment' => array(
>> 'image_upload' => array(
>> 'name'=> 'formatFileName', 
>> 'baseDir'=> IMAGES,
>> 'uploadDir'=> 'writers',
>> 'dbColumn'=> 'image', 
>> 'maxNameLength'=> 200, 
>> 'overwrite' => true,
>> 'transforms' => array(
>> array('method' => 'resize', 'width' => 
>> IMAGE_WRITER_H, 'height' => IMAGE_WRITER_H, 'dbColumn' => 'image', 'append' 
>> => false),
>> array('method' => 'resize', 'width' => 
>> IMAGE_WRITER_THUMB_W, 'height' => IMAGE_WRITER_THUMB_W, 'dbColumn' => 
>> 'thumb', 'append' => '_thumb')
>> )
>> )
>> )
>> );
>>
>> The problem is that the saved image in 'image' column is "bowser-1.png", 
>> instead the expected "bowser.png".
>>
>> The thumb works fine and is named "bowser_thumb.png" as expected.
>>
>> Any idea?
>>
>>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: What is the 2nd parameter for in the __ function?

2012-05-04 Thread Xoubaman
In Cake >= 2.0 the second (and further) params are used to replace the %s 
present in the first one, like in the sprintf PHP function.

In Cake <= 1.3 if you omit the second parameter the function will echo the 
first one, if you set it to true will return it as a string.

El viernes, 4 de mayo de 2012 18:03:36 UTC+2, Daniel escribió:
>
> What is the 2nd parameter for in the __ function?  I don't understand 
> what it says in the manual. 
> For example should I use: 
> $this->Session->setFlash(__('User was not found.', true)); 
> or just: 
> $this->Session->setFlash(__('User was not found.')); 
> ? 
>
> Thanks, 
> Daniel

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: 2.1.x API

2012-05-04 Thread José Lorenzo
go to http://api21.cakephp.org

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Potential Database Project using Cake PHP

2012-05-04 Thread Timothy Lau
I was told that I should use cakePHP for a project involving a database for 
input from multiple forms.  Can someone start me in the right direction 
from scratch.  I only know HTML.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Running Controller Test blows away database table

2012-05-04 Thread Dan Doyon
I'm just starting to use Phpunit with CakePhp2.0 when I run my first 
controller test against a very simple Model Items (id, title)

./Console/cake test app Controller/ItemsController

I haven't added any other tests than those from 'cake bake;. The tests 
pass, however, it blows away the associated item table. 

I have the latest 2.1.2 version. 

thx

--dan

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


The result of mysql query is different between windows and linux

2012-05-04 Thread Jeyha
Use apache of windows will return the results:
Array(
[0]=>Array([product]=>Array([id]=>123,[title]=>'this is title')),
[1]=>Array([product]=>Array([id]=>124,[title]=>'this is title2'))
)

Use apache of linux will return the results:
Array(
[0]=>Array([0]=>Array([id]=>123,[title]=>'this is title')),
[1]=>Array([0]=>Array([id]=>124,[title]=>'this is title2'))
)
product is the table name or model name.

Linux: cenos 6 + apache 2.4 + mysql 5.5 + php 5.4.1
windwos: apache 2.2 + mysql 5.5 + php 5.3.8

How to do it?
Thank you!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: [Cake 2.1.1] AJAX POST with jQuery cross Controller - Bad Request

2012-05-04 Thread Jimit Kapadya
Plz send me cakephp books link.its mean download cakephp book.

On Fri, May 4, 2012 at 5:48 PM, luca capra  wrote:

>  Hi,
> probably you have to configure the SecurityComponent (and eventually use
> the FormHelper) to permit those types of request to happen.
>
> See:
> - http://en.wikipedia.org/wiki/Cross-site_request_forgery
> -
> http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#restricting-cross-controller-communication
> -
> http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#csrf-protection
>
>
>
> Il 04/05/2012 13:58, jmail ha scritto:
>
> Hi!
>
>  I've got application which I am translating from other technology to
> CakePHP. Application is in about 60% written with AJAX.There are a lot of
> cross controller sends :/ So I've got a problem because when I am trying to
> make something similar with Cake I get error 400 - bad request. Of course I
> am using Security component and I would like to use this component. App
> it's quite secure with that component. Of course when I am using GET
> request everything is OK, but when try to use POST request there is a
> problem.
>
>  I've got Controller MainController with function start
>
>  class MainController extends AppController{
>  function start(){
>  $this->set('contests', $this->Contest->find('all', array('conditions' =>
> array('Contest.start <= now()', 'Contest.finish > now()', 'Contest.active'
> => 1, 'Board.status' => 1;
>  if(CakeSession::read('user') === null){
>  $this->layout = 'nonloginlayout';
>  }
>  else{
> $this->render('startlogged');
>  }
>  }
> }
>
>  Then in startlogged.ctp I've got script:
>
>  function moreChances(){
>  $.prompt.close();
>  $.prompt(states, {zIndex: 11000});
>  $.ajax({
>  url: "/user/invite/"
>  ,async: true
>  ,dataType: "html"
>  ,type: "GET"
>  ,success: function(data){
>  $.prompt.close();
>  $.prompt(data, {buttons:{}, zIndex: 11000})
>   }
>
>  });
>  }
>   function sendInvite(){
>  mail = document.getElementById('inviteMail').value;
>  message = document.getElementById('inviteMessage').value;
>  $.prompt.close();
>  $.prompt(states, {zIndex: 11000});
>  $.ajax({
>  url: "/user/send_invite?tmp="+Math.random()
>  ,async: false
>  ,data: {test:'doopa'}
>  ,type: "POST"
>  ,dataType: "html"
>  ,success: function(data){
>  $('#deb').html(data);
>  }
>  ,error: function(jqXHR, textStatus, errorThrown){
>  $('#deb').html(errorThrown);
>  }
>  });
>}
>
>
>  user/invite just loading a form into a prompt window
>
>
>  Email address:
>  
>  
>  Message:
>  
>  
>  
>  send
>  
>
>  and User controller look like this
>
>  class UserController extends AppController{
>
>  function beforeFilter() {
>  parent::beforeFilter();
>  $json_actions = array('send_invite');
>  if(in_array($this->action, $json_actions)){
>  $this->Security->validatePost = false = array('Session',
> 'RequestHandler', 'ImageConverter');
>  }
>  }
>   function invite(){
>  $this->layout = '';
>  }
>   function send_invite(){
>  $this->autoRender = false;
>  var_dump($_POST);
>  }
>  }
>
>  And I don't know what to do more. Every POST request generating error:
>
>  2012-05-04 13:54:27 Error: [BadRequestException] The request has been
> black-holed
> #0
> !!!Path_to_root!!!\lib\Cake\Controller\Component\SecurityComponent.php(227):
> SecurityComponent->blackHole(Object(UserController), 'csrf')
>
>
>  Can some please help me? I don't know what to do to not get black-holed.
> I am desperate because of that three of my projects are stoped :(
>
>  Thanks for all.
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>
>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


What is the 2nd parameter for in the __ function?

2012-05-04 Thread Daniel
What is the 2nd parameter for in the __ function?  I don't understand
what it says in the manual.
For example should I use:
$this->Session->setFlash(__('User was not found.', true));
or just:
$this->Session->setFlash(__('User was not found.'));
?

Thanks,
Daniel

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: who can tell me what the Make is.

2012-05-04 Thread kdubya
Try looking at http://en.wikipedia.org/wiki/Make_%28software%29

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: [Cake 2.1.1] AJAX POST with jQuery cross Controller - Bad Request

2012-05-04 Thread luca capra

Hi,
probably you have to configure the SecurityComponent (and eventually use 
the FormHelper) to permit those types of request to happen.


See:
- http://en.wikipedia.org/wiki/Cross-site_request_forgery
- 
http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#restricting-cross-controller-communication
- 
http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#csrf-protection




Il 04/05/2012 13:58, jmail ha scritto:

Hi!

I've got application which I am translating from other technology to 
CakePHP. Application is in about 60% written with AJAX.There are a lot 
of cross controller sends :/ So I've got a problem because when I am 
trying to make something similar with Cake I get error 400 - bad 
request. Of course I am using Security component and I would like to 
use this component. App it's quite secure with that component. Of 
course when I am using GET request everything is OK, but when try to 
use POST request there is a problem.


I've got Controller MainController with function start

class MainController extends AppController{
function start(){
$this->set('contests', $this->Contest->find('all', array('conditions' 
=> array('Contest.start <= now()', 'Contest.finish > now()', 
'Contest.active' => 1, 'Board.status' => 1;

if(CakeSession::read('user') === null){
$this->layout = 'nonloginlayout';
}
else{
$this->render('startlogged');
}
}
}

Then in startlogged.ctp I've got script:

function moreChances(){
$.prompt.close();
$.prompt(states, {zIndex: 11000});
$.ajax({
url: "/user/invite/"
,async: true
,dataType: "html"
,type: "GET"
,success: function(data){
$.prompt.close();
$.prompt(data, {buttons:{}, zIndex: 11000})
}

});
}
function sendInvite(){
mail = document.getElementById('inviteMail').value;
message = document.getElementById('inviteMessage').value;
$.prompt.close();
$.prompt(states, {zIndex: 11000});
$.ajax({
url: "/user/send_invite?tmp="+Math.random()
,async: false
,data: {test:'doopa'}
,type: "POST"
,dataType: "html"
,success: function(data){
$('#deb').html(data);
}
,error: function(jqXHR, textStatus, errorThrown){
$('#deb').html(errorThrown);
}
});
   }


user/invite just loading a form into a prompt window


Email address:


Message:



send


and User controller look like this

class UserController extends AppController{

function beforeFilter() {
parent::beforeFilter();
$json_actions = array('send_invite');
if(in_array($this->action, $json_actions)){
$this->Security->validatePost = false = array('Session', 
'RequestHandler', 'ImageConverter');

}
}
function invite(){
$this->layout = '';
}
function send_invite(){
$this->autoRender = false;
var_dump($_POST);
}
}

And I don't know what to do more. Every POST request generating error:

2012-05-04 13:54:27 Error: [BadRequestException] The request has been 
black-holed
#0 
!!!Path_to_root!!!\lib\Cake\Controller\Component\SecurityComponent.php(227): 
SecurityComponent->blackHole(Object(UserController), 'csrf')



Can some please help me? I don't know what to do to not get 
black-holed. I am desperate because of that three of my projects are 
stoped :(


Thanks for all.
--
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and 
help others with their CakePHP related questions.



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


--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.



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


[Cake 2.1.1] AJAX POST with jQuery cross Controller - Bad Request

2012-05-04 Thread jmail
Hi!

I've got application which I am translating from other technology to 
CakePHP. Application is in about 60% written with AJAX.There are a lot of 
cross controller sends :/ So I've got a problem because when I am trying to 
make something similar with Cake I get error 400 - bad request. Of course I 
am using Security component and I would like to use this component. App 
it's quite secure with that component. Of course when I am using GET 
request everything is OK, but when try to use POST request there is a 
problem. 

I've got Controller MainController with function start

class MainController extends AppController{
function start(){
$this->set('contests', $this->Contest->find('all', array('conditions' => 
array('Contest.start <= now()', 'Contest.finish > now()', 'Contest.active' 
=> 1, 'Board.status' => 1;
if(CakeSession::read('user') === null){
$this->layout = 'nonloginlayout';
}
else{
$this->render('startlogged');
}
}
}

Then in startlogged.ctp I've got script:

function moreChances(){
$.prompt.close();
$.prompt(states, {zIndex: 11000});
$.ajax({
url: "/user/invite/"
,async: true
,dataType: "html"
,type: "GET"
,success: function(data){
$.prompt.close();
$.prompt(data, {buttons:{}, zIndex: 11000})
 }

});
}
 function sendInvite(){
mail = document.getElementById('inviteMail').value;
message = document.getElementById('inviteMessage').value;
$.prompt.close();
$.prompt(states, {zIndex: 11000});
$.ajax({
url: "/user/send_invite?tmp="+Math.random()
,async: false
,data: {test:'doopa'}
,type: "POST"
,dataType: "html"
,success: function(data){
$('#deb').html(data); 
}
,error: function(jqXHR, textStatus, errorThrown){
$('#deb').html(errorThrown);
}
});
   }


user/invite just loading a form into a prompt window


Email address:


Message:



send


and User controller look like this

class UserController extends AppController{

function beforeFilter() {
parent::beforeFilter();
$json_actions = array('send_invite');
if(in_array($this->action, $json_actions)){
$this->Security->validatePost = false = array('Session', 'RequestHandler', 
'ImageConverter');
}
}
 function invite(){
$this->layout = '';
}
 function send_invite(){
$this->autoRender = false;
var_dump($_POST);
}
}

And I don't know what to do more. Every POST request generating error:

2012-05-04 13:54:27 Error: [BadRequestException] The request has been 
black-holed
#0 
!!!Path_to_root!!!\lib\Cake\Controller\Component\SecurityComponent.php(227): 
SecurityComponent->blackHole(Object(UserController), 'csrf')


Can some please help me? I don't know what to do to not get black-holed. I 
am desperate because of that three of my projects are stoped :(

Thanks for all.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: retrieving-your-data.html: DboSource::fetchAll()

2012-05-04 Thread majna
That's prepared statements http://php.net/manual/en/pdo.prepare.php
used for better performance (compiled query plan can be cached)

On Thursday, May 3, 2012 5:37:22 PM UTC+2, johnericsutton wrote:
>
> At the end of 
> http://book.cakephp.org/2.0/en/models/retrieving-your-data.html are some 
> examples of the use
> of DboSource::fetchAll() :
>
>
> $db = $this->getDataSource();
>
> $db->fetchAll(
> 'SELECT * from users where username = ? AND password = ?',
> array('jhon', '12345'));
> $db->fetchAll(
> 'SELECT * from users where username = :username AND password = :password',
> array('username' => 'jhon','password' => '12345'));
>
>
> I can't imagine how the first use of fetchAll() is supposed to work, but 
> surely the second is supposed to read:
>
> $db->fetchAll(
>   String::insert(
> 'SELECT * from users where username = :username AND password = :password',
> array('username' => 'jhon','password' => '12345')
>   )
> );
>
>
> Is there some magic whereby the call to String::insert() can be omitted 
> and yet the substitutions happen anyway?
>
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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