Re: Storing encrypted value using getter/setter not working. Stored in plain text.

2016-03-16 Thread Willem
Eventually i changed it to a varbinary(65000) column and it started to 
work. In Cakephp 2 it worked with a varchar column. now it needs to be 
binary in 3 and have enough space.

On Wednesday, March 16, 2016 at 10:19:38 AM UTC+1, heavyKevy wrote:
>
> I hate to state the obvious, but did you verify that the field size was 
> large enough to store the encrypted value?
> I had a similar issue with hashing a password, the field wasn't large 
> enough and the value was saved but cut off so that the password never 
> matched.
> Maybe try it with the max varchar size and see if it will work.
>

-- 
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup

We will soon be closing this Google Group. But don't worry, we have something 
better coming. Stay tuned for an updated from the CakePHP Team soon.

Like Us on FaceBook https://www.facebook.com/CakePHP
Follow us on Twitter http://twitter.com/CakePHP
--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Storing encrypted value using getter/setter not working. Stored in plain text.

2016-03-16 Thread Willem Schwarte
I have already tried to change it to text. This had the same effect. I also 
cleared the caches/orm cAche when intested this. 



> Op 16 mrt. 2016 om 00:12 heeft Christian Quispe <christian.quis...@gmail.com> 
> het volgende geschreven:
> 
> Cambia tu field de tu base de datos a text, es posible que tu cadena 
> codificada no se guarde completamente.
> 
> 
> 
> Enviado con MailTrack
> 
> 
> Saludos
> 
> Christian Quispe
> 
> Geek and Developer
> Miembro:  GDG Lima (Google Developer Group Lima)
> 
> Portafolio: www.oxicode.io
> 
> ¿A quién le enseñan sus aciertos?, si yo aprendo de mis errores 
> constantemente...
> 
> 
> 2016-03-15 13:46 GMT-05:00 Willem <wschwa...@gmail.com>:
>> saving to the database cuts off the encrypted data. varchar(255) and text 
>> fields both have this issue.. 
>> is this a bug in CakePHP
>> -- 
>> Sign up for our Newsletter for updates.
>> http://cakephp.org/newsletter/signup
>>  
>> We will soon be closing this Google Group. But don't worry, we have 
>> something better coming. Stay tuned for an updated from the CakePHP Team 
>> soon.
>>  
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Follow us on Twitter http://twitter.com/CakePHP
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "CakePHP" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to cake-php+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> Sign up for our Newsletter for updates.
> http://cakephp.org/newsletter/signup
>  
> We will soon be closing this Google Group. But don't worry, we have something 
> better coming. Stay tuned for an updated from the CakePHP Team soon.
>  
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Follow us on Twitter http://twitter.com/CakePHP
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to cake-php+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup

We will soon be closing this Google Group. But don't worry, we have something 
better coming. Stay tuned for an updated from the CakePHP Team soon.

Like Us on FaceBook https://www.facebook.com/CakePHP
Follow us on Twitter http://twitter.com/CakePHP
--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Storing encrypted value using getter/setter not working. Stored in plain text.

2016-03-15 Thread Willem
*saving to the database cuts off the encrypted data. varchar(255) and text 
fields both have this issue.. *
*is this a bug in CakePHP*

-- 
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup

We will soon be closing this Google Group. But don't worry, we have something 
better coming. Stay tuned for an updated from the CakePHP Team soon.

Like Us on FaceBook https://www.facebook.com/CakePHP
Follow us on Twitter http://twitter.com/CakePHP
--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Storing encrypted value using getter/setter not working. Stored in plain text.

2016-03-15 Thread Willem
When I try as follows, the value gets stored encryted, but I cannot read it 
as the getDecryptedUsername function returns false at the decrypt line:

protected function _setUsername($username)
{
 $key = 'wt1U5MACWJFTXGenFoZoiLwQGrLgdbHA';
 if(strlen($username) > 0)
 {
 $username = Security::encrypt($username, $key);
 }
 return($username);
}

protected function _getDecryptedUsername()
{
 $key = 'wt1U5MACWJFTXGenFoZoiLwQGrLgdbHA';
 $username = $this->_properties['username'];
 if(strlen($username) > 0)
 {
 $username = Security::decrypt($username, $key);
 }
 return($username);
}

-- 
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup

We will soon be closing this Google Group. But don't worry, we have something 
better coming. Stay tuned for an updated from the CakePHP Team soon.

Like Us on FaceBook https://www.facebook.com/CakePHP
Follow us on Twitter http://twitter.com/CakePHP
--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Storing encrypted value using getter/setter not working. Stored in plain text.

2016-03-15 Thread Willem
I am trying to save a string value in the database. this value needs to be 
encrypted. I tried to create a _set and _get function to encrypt/decrypt 
this. 

here is the code:

protected function _setUsername($username)
{
 $key = 'wt1U5MACWJFTXGenFoZoiLwQGrLgdbHA';
 if(strlen($username) > 0)
 {
 $username = Security::encrypt($username, $key);
 }
 return($username);
}

protected function _getUsername($username)
{
 $key = 'wt1U5MACWJFTXGenFoZoiLwQGrLgdbHA';
 if(strlen($username) > 0)
 {
 $username = Security::decrypt($username, $key);
 }

 return($username);
}


However the value is stored in plain text. Am I misunderstanding the 
documentation on the use of these functions?



-- 
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup

We will soon be closing this Google Group. But don't worry, we have something 
better coming. Stay tuned for an updated from the CakePHP Team soon.

Like Us on FaceBook https://www.facebook.com/CakePHP
Follow us on Twitter http://twitter.com/CakePHP
--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What is the meaning of this error in cakephp 3?

2016-03-14 Thread Willem Schwarte
So what was the problem?

> Op 14 mrt. 2016 om 12:43 heeft Clement Crownrise  
> het volgende geschreven:
> 
> Thanks All, the error has been fixed.
> 
> 
> 
>> On Saturday, March 12, 2016 at 10:30:25 AM UTC+1, Clement Crownrise wrote:
>> Hello, I am doing the blog tutorial in cakephp 3, but I got this notice at 
>> the top of my page, please does anyone know the meaning and how to solve it?
>> 
>> Strict (2048): Declaration of App\Controller\AppController::beforefilter() 
>> should be compatible with 
>> Cake\Controller\Controller::beforeFilter(Cake\Event\Event $event) 
>> [APP/Controller\AppController.php, line 29]
>> 
>> 
>> 
>> Strict (2048): Declaration of App\Controller\UsersController::beforefilter() 
>> should be compatible with App\Controller\AppController::beforefilter() 
>> [APP/Controller\UsersController.php, line 10]
>> 
>> Your help will be appreciated
> 
> -- 
> Sign up for our Newsletter for updates.
> http://cakephp.org/newsletter/signup
>  
> We will soon be closing this Google Group. But don't worry, we have something 
> better coming. Stay tuned for an updated from the CakePHP Team soon.
>  
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Follow us on Twitter http://twitter.com/CakePHP
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to cake-php+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup

We will soon be closing this Google Group. But don't worry, we have something 
better coming. Stay tuned for an updated from the CakePHP Team soon.

Like Us on FaceBook https://www.facebook.com/CakePHP
Follow us on Twitter http://twitter.com/CakePHP
--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What is the meaning of this error in cakephp 3?

2016-03-13 Thread Willem Schwarte
Yes. That should solve it. 

- willem

> Op 13 mrt. 2016 om 08:42 heeft heavyKevy <arnett.ke...@gmail.com> het 
> volgende geschreven:
> 
> You also need to make sure that you add the following line near the top of 
> the file after the namespace with the other use statements:
> 
> use Cake\Event\Event;
> 
> Best regards,
> --Kevin
> 
> 
>> On Sunday, March 13, 2016 at 1:47:10 AM UTC+7, Clement Crownrise wrote:
>> Hi, Thanks Willem, 
>> 
>> I have tried it, but the error still persists , look at the code below
>> 
>> 
>> public function beforefilter(Event $event){
>> //parent::beforefilter($event);
>> //$this->Auth->allow(['add','logout']);
>> return null;
>> }
>> 
>>> On Sat, Mar 12, 2016 at 11:52 AM, Willem Schwarte <wsch...@gmail.com> wrote:
>>> Just as it says. You need to have the same method signature as the one you 
>>> are overriding. Thus:
>>> 
>>> public function beforeFilter(Event $event)
>>> {
>>> return null;
>>> }
>>> 
>>> you forgot the parameter.
>>> 
>>> 
>>> Willem
>>> 
>>> 
>>> 
>>>> On 12 Mar 2016, at 10:30, Clement Crownrise <clementc...@gmail.com> wrote:
>>>> 
>>>> Hello, I am doing the blog tutorial in cakephp 3, but I got this notice at 
>>>> the top of my page, please does anyone know the meaning and how to solve 
>>>> it?
>>>> 
>>>> Strict (2048): Declaration of App\Controller\AppController::beforefilter() 
>>>> should be compatible with 
>>>> Cake\Controller\Controller::beforeFilter(Cake\Event\Event $event) 
>>>> [APP/Controller\AppController.php, line 29]
>>>> 
>>>> 
>>>> 
>>>> Strict (2048): Declaration of 
>>>> App\Controller\UsersController::beforefilter() should be compatible with 
>>>> App\Controller\AppController::beforefilter() 
>>>> [APP/Controller\UsersController.php, line 10]
>>>> 
>>>> Your help will be appreciated
>>>> 
>>>> -- 
>>>> Sign up for our Newsletter for updates.
>>>> http://cakephp.org/newsletter/signup
>>>>  
>>>> We will soon be closing this Google Group. But don't worry, we have 
>>>> something better coming. Stay tuned for an updated from the CakePHP Team 
>>>> soon.
>>>>  
>>>> Like Us on FaceBook https://www.facebook.com/CakePHP
>>>> Follow us on Twitter http://twitter.com/CakePHP
>>>> --- 
>>>> You received this message because you are subscribed to the Google Groups 
>>>> "CakePHP" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>>> email to cake-php+u...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>> 
>>> -- 
>>> Sign up for our Newsletter for updates.
>>> http://cakephp.org/newsletter/signup
>>>  
>>> We will soon be closing this Google Group. But don't worry, we have 
>>> something better coming. Stay tuned for an updated from the CakePHP Team 
>>> soon.
>>>  
>>> Like Us on FaceBook https://www.facebook.com/CakePHP
>>> Follow us on Twitter http://twitter.com/CakePHP
>>> --- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "CakePHP" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/cake-php/qEur8oKsm48/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> cake-php+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>> 
>> 
>> 
>> -- 
>> http://www.clementcrownrise.name/images/nameing.gif
> 
> -- 
> Sign up for our Newsletter for updates.
> http://cakephp.org/newsletter/signup
>  
> We will soon be closing this Google Group. But don't worry, we have something 
> better coming. Stay tuned for an updated from the CakePHP Team soon.
>  
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Follow us on Twitter http://twitter.com/CakePHP
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to cake-php+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup

We will soon be closing this Google Group. But don't worry, we have something 
better coming. Stay tuned for an updated from the CakePHP Team soon.

Like Us on FaceBook https://www.facebook.com/CakePHP
Follow us on Twitter http://twitter.com/CakePHP
--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What is the meaning of this error in cakephp 3?

2016-03-12 Thread Willem Schwarte
Just as it says. You need to have the same method signature as the one you are 
overriding. Thus:

public function beforeFilter(Event $event)
{
return null;
}

you forgot the parameter.


Willem



> On 12 Mar 2016, at 10:30, Clement Crownrise <clementcrownr...@gmail.com> 
> wrote:
> 
> Hello, I am doing the blog tutorial in cakephp 3, but I got this notice at 
> the top of my page, please does anyone know the meaning and how to solve it?
> 
> Strict (2048) <>: Declaration of App\Controller\AppController::beforefilter() 
> should be compatible with 
> Cake\Controller\Controller::beforeFilter(Cake\Event\Event $event) 
> [APP/Controller\AppController.php, line 29]
> 
> 
> 
> Strict (2048) <>: Declaration of 
> App\Controller\UsersController::beforefilter() should be compatible with 
> App\Controller\AppController::beforefilter() 
> [APP/Controller\UsersController.php, line 10]
> 
> Your help will be appreciated
> 
> -- 
> Sign up for our Newsletter for updates.
> http://cakephp.org/newsletter/signup <http://cakephp.org/newsletter/signup>
>  
> We will soon be closing this Google Group. But don't worry, we have something 
> better coming. Stay tuned for an updated from the CakePHP Team soon.
>  
> Like Us on FaceBook https://www.facebook.com/CakePHP 
> <https://www.facebook.com/CakePHP>
> Follow us on Twitter http://twitter.com/CakePHP <http://twitter.com/CakePHP>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to cake-php+unsubscr...@googlegroups.com 
> <mailto:cake-php+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup

We will soon be closing this Google Group. But don't worry, we have something 
better coming. Stay tuned for an updated from the CakePHP Team soon.

Like Us on FaceBook https://www.facebook.com/CakePHP
Follow us on Twitter http://twitter.com/CakePHP
--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How To / Example of OO Inheritance for CakePHP 3

2016-01-26 Thread Willem
I have done the tutorials. I posted because it is not totally clear. 
Reading the docs has let me to believe there should be a model for every 
database table. but if i would do that i would end up with a model for 
Customer and a model for Manager both containing the , more or less, same 
fields and the same method. That seems strange to me and that is why i 
posted the question. Sometimes things just get more clear with a simple 
example. 


so to rephrase: if somebody would come to you with this specific UML how 
would you create this setup using CakePHP. 

tx



On Monday, January 25, 2016 at 4:50:52 PM UTC+1, Willem wrote:
>
>
> how would one create a CakePHP3 app and what database tabels would i need 
> to create an app that uses inheritance.
>
> for example fictional setup:
>
> [Person] <--- [Customer]
> [Person]<--- [Manager]
>
> All Persons have "name". Customer has "order_amount". Manager has 
> "sales_total". 
>
> Person has a method "getName()" , which is avavailable through inheritance 
> in Customer and manager.
>
> Person is the parent class and Customer and manager are the child-classes.
>
> How would i implement this in CakePHP?
>
> I could create a customer and manager database table and bake this to two 
> models. but that would mean that the getName() function would be 
> implemented in both classes. 
>
> Could somebody help me grasp this in cakephp? thanks.
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


How To / Example of OO Inheritance for CakePHP 3

2016-01-25 Thread Willem

how would one create a CakePHP3 app and what database tabels would i need 
to create an app that uses inheritance.

for example fictional setup:

[Person] <--- [Customer]
[Person]<--- [Manager]

All Persons have "name". Customer has "order_amount". Manager has 
"sales_total". 

Person has a method "getName()" , which is avavailable through inheritance 
in Customer and manager.

Person is the parent class and Customer and manager are the child-classes.

How would i implement this in CakePHP?

I could create a customer and manager database table and bake this to two 
models. but that would mean that the getName() function would be 
implemented in both classes. 

Could somebody help me grasp this in cakephp? thanks.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


CakePHP 3 - Catch invalidargument email -> to exception

2015-12-29 Thread Willem

How can we catch an invalid email exception? Cake throws and 
invalidargumentexception. 



Invalid email: "bassdsd.cs#adcdc.com"InvalidArgumentException



This does not work, the catch is not reached:

$toEmailAddress = "bassdsd.cs#adcdc.com";

$email = new Email('default');

try
{
$email->to($toEmailAddress); 
}
catch(InvalidArgumentException $ex)
{
   // error
}



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


cakephp 3 Insert with Query Builder update Timestamp fields

2015-12-22 Thread Willem
Using the query builder to insert multiple rows of data the timestamp 
fields are not automatically updated, is this correct? 

so i changed my code a little to add the fields myself. Not sure if this is 
the best way or am i missing something


$oQuery = $this->query();
>
> if (($handle = fopen($tmpFilename, "r")) !== FALSE) {
> while (($data = fgetcsv($handle, 0, ",")) !== FALSE) {
> $num = count($data);
> if ($linenumber == 1) {
> for ($c = 0; $c < $num; $c++) {
> $columnnames[] = $data[$c];
> }
> } else {
> for ($c = 0; $c < $num; $c++) {
> $line['csv_file_id'] = $csvFileId;
> $line['linenumber'] = $linenumber;
> $line['columnname'] = $columnnames[$c];
> $line['columndata'] = $data[$c];
> $line['created'] = date('Y-m-d h:m:s');
> $line['modified'] = date('Y-m-d h:m:s');
>
> $oQuery->insert(['csv_file_id', 'linenumber', 'columnname', 
> 'columndata','created','modified'])
> ->values($line); 
> }
> }
> $linenumber++;
> }
> fclose($handle);
>
> $oQuery->execute();
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Seeking some CakePHP tutoring

2015-09-20 Thread Willem
Why not just install wordpress as a cms for a simple website?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Editor for Cakephp

2015-06-23 Thread Willem Schwarte (Prive)
I like the fact that with PHPStorm you have zero-config debugging. That is.
install wamp, install Phpstorm, set xdebug config option in php.ini, start
debugging.Piece of cake :-)

On Wed, Jun 24, 2015 at 5:52 AM, Reuben reuben.he...@gmail.com wrote:

 For a long time, I used Eclipse with PDT, and associated .ctp files with
 PHP, but just recently, I decided to see what else was out there.

 I ended up going with PHPStorm, because of it's focus on PHP, and the
 extra support tools it could harness for web related languages.

 I did try NetBeans after the PHPStorm evaluation, but the navigation
 rubbed me the wrong way, and PHP editing felt like a second class citizen
 to Java (especially the application of code formatting).

 On Saturday, 13 June 2015 17:12:42 UTC+10, Pamela Whittaker wrote:

 What do you suggest as an editor for CakePHP please? I use Dreamweaver
 cs6 for PHP but that doesn't open .ctp files. Thanks

  --
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP

 ---
 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Editor for Cakephp

2015-06-13 Thread Willem Schwarte
Phpstorm is awesome 



 Op 11 jun. 2015 om 11:45 heeft Pamela Whittaker knutsfordsoftw...@gmail.com 
 het volgende geschreven:
 
 What do you suggest as an editor for CakePHP please? I use Dreamweaver cs6 
 for PHP but that doesn't open .ctp files. Thanks
 -- 
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP
 
 --- 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: [Cake 2.6.3] Cake's FileUpload Validation not working; what is wrong?

2015-04-13 Thread Willem
It worked thanks!

On Monday, April 13, 2015 at 6:18:36 PM UTC+2, John Andersen wrote:

 The validation in your model points to a field named image, but the view 
 you have points to a field named submittedFile :)
 Which is the correct one?
 Enjoy, John

 On Monday, 13 April 2015 11:17:13 UTC+3, Willem wrote:

 I have a model Attachment which Belongs to another model (hasMany 
 Attachment). 

 In model Attachment I put a validator (from the Cake helpbook) to check 
 against filetypes. After saveAssociated i would expect an error if uploaded 
 a .txt file, but the model is save successfully?

 *Add.ctp* 

 for($i=0;$i1;$i++)
 {
 ?
 div class=row
 ?php
 echo $this-Form-file('Attachment.'.$i.'.submittedfile');
 ?
 /div
 ?php
 }



 *Attachment model:*

 ?php
 App::uses('AppModel', 'Model');

 class Attachment extends AppModel {

 public $belongsTo = 'CollectionRequest';

 public $validate = array(
 'image' = array(
 'rule' = array(
 'extension',
 array('gif', 'jpeg', 'png', 'jpg')
 ),
 'message' = 'Please supply a valid image.'
 )
 );


 public function beforeSave($options = array()) {

 parent::beforeSave($options);
 }

 public function beforeValidate($options = array()) {

 // ignore empty file - causes issues with form validation when 
 file is empty and optional
 if (!empty($this-data[$this-alias]['error']) 
 $this-data[$this-alias]['error']==4 
 $this-data[$this-alias]['size']==0) {
 unset($this-data[$this-alias]);
 }


 parent::beforeValidate($options);
 }

 }


 ?

 *Controller*

  if ($this-CollectionRequest-saveAssociated($this-request-data)) {
 // All good
 
 $this-Session-setFlash(__('CollectionRequest saved'));
 return $this-redirect(array('action' = 'index'));
 }


 thanks




-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Detecting file size overflow (POST Content-Length of 30980857 bytes exceeds the limit of 2097152 bytes)

2015-04-13 Thread Willem
When uploading a file bigger then the post_max_size setting in php.ini the 
$_FILES global will be empty. CakePHP does not give an error and saves the 
rest of the data (as the $this-data still has data for the rest of the 
model) 

How can i catch this in CakePHP?


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


[Cake 2.6.3] Cake's FileUpload Validation not working; what is wrong?

2015-04-13 Thread Willem
I have a model Attachment which Belongs to another model (hasMany 
Attachment). 

In model Attachment I put a validator (from the Cake helpbook) to check 
against filetypes. After saveAssociated i would expect an error if uploaded 
a .txt file, but the model is save successfully?

*Add.ctp* 

for($i=0;$i1;$i++)
{
?
div class=row
?php
echo $this-Form-file('Attachment.'.$i.'.submittedfile');
?
/div
?php
}



*Attachment model:*

?php
App::uses('AppModel', 'Model');

class Attachment extends AppModel {

public $belongsTo = 'CollectionRequest';

public $validate = array(
'image' = array(
'rule' = array(
'extension',
array('gif', 'jpeg', 'png', 'jpg')
),
'message' = 'Please supply a valid image.'
)
);


public function beforeSave($options = array()) {

parent::beforeSave($options);
}

public function beforeValidate($options = array()) {

// ignore empty file - causes issues with form validation when file 
is empty and optional
if (!empty($this-data[$this-alias]['error']) 
$this-data[$this-alias]['error']==4 
$this-data[$this-alias]['size']==0) {
unset($this-data[$this-alias]);
}


parent::beforeValidate($options);
}

}


?

*Controller*

 if ($this-CollectionRequest-saveAssociated($this-request-data)) {
// All good

$this-Session-setFlash(__('CollectionRequest saved'));
return $this-redirect(array('action' = 'index'));
}


thanks


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: [Cake 2.6.3] Cake's FileUpload Validation not working; what is wrong?

2015-04-13 Thread Willem
Hi,

thanks, will try this ASAP. I got it mixed up thiking it was an 
alias/name/labe as in multiple validations per field. :-S





On Monday, April 13, 2015 at 6:18:36 PM UTC+2, John Andersen wrote:

 The validation in your model points to a field named image, but the view 
 you have points to a field named submittedFile :)
 Which is the correct one?
 Enjoy, John

 On Monday, 13 April 2015 11:17:13 UTC+3, Willem wrote:

 I have a model Attachment which Belongs to another model (hasMany 
 Attachment). 

 In model Attachment I put a validator (from the Cake helpbook) to check 
 against filetypes. After saveAssociated i would expect an error if uploaded 
 a .txt file, but the model is save successfully?

 *Add.ctp* 

 for($i=0;$i1;$i++)
 {
 ?
 div class=row
 ?php
 echo $this-Form-file('Attachment.'.$i.'.submittedfile');
 ?
 /div
 ?php
 }



 *Attachment model:*

 ?php
 App::uses('AppModel', 'Model');

 class Attachment extends AppModel {

 public $belongsTo = 'CollectionRequest';

 public $validate = array(
 'image' = array(
 'rule' = array(
 'extension',
 array('gif', 'jpeg', 'png', 'jpg')
 ),
 'message' = 'Please supply a valid image.'
 )
 );


 public function beforeSave($options = array()) {

 parent::beforeSave($options);
 }

 public function beforeValidate($options = array()) {

 // ignore empty file - causes issues with form validation when 
 file is empty and optional
 if (!empty($this-data[$this-alias]['error']) 
 $this-data[$this-alias]['error']==4 
 $this-data[$this-alias]['size']==0) {
 unset($this-data[$this-alias]);
 }


 parent::beforeValidate($options);
 }

 }


 ?

 *Controller*

  if ($this-CollectionRequest-saveAssociated($this-request-data)) {
 // All good
 
 $this-Session-setFlash(__('CollectionRequest saved'));
 return $this-redirect(array('action' = 'index'));
 }


 thanks




-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Generate XML using controller and force it to sent as download

2014-01-02 Thread Willem
Still haven't figured this out. Is this at all possible with CakePHP? I 
can't imagine it would not be possible.

thanks




On Thursday, December 19, 2013 5:16:50 PM UTC+1, Willem wrote:

 Hi,

 Goal: I have a button on a page. When user clicks it should generate a XML 
 file and make it download (instead of opening in browser window).
 Cake version: 1.3

 So I create a HTML link like this:

 ?php echo $html-link( __('Generate XML file', true), 
 array('action'='generateXMLFile','ext'='xml'), 
 array('class'='button','target'='_blank') ); ?


 Which outputs a simple HTML link. 

 I have added in Routes:

   Router::parseExtensions('json','xml');


 My action: 

 function generateXMLFile(){
 // Configure::write('debug',0);
 // Only XML Requests
 if(!$this-RequestHandler-isXml()){
 die();

}
 }



 My view:


 response
 posts
 Post
 idtest 234/id
 /Post
 /posts
 /response


 My Layout:

 ?php header('Content-type: text/xml');?
 ?php echo $this-Xml-header(); ?
 ?php echo $content_for_layout; ?



 Now when I click the link the XML is sent as output to the screen. 
 Clicking with right mousebutton -save as.. makes it possible to save the 
 file as XML. 
 Headers are correctly set as text/xml

 How can i prevent this from outputting to the screen but output it to a 
 file/stream for download ?

 thanks 




-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Generate XML using controller and force it to sent as download

2013-12-20 Thread Willem
Hi,

Goal: I have a button on a page. When user clicks it should generate a XML 
file and make it download (instead of opening in browser window).
Cake version: 1.3

So I create a HTML link like this:

?php echo $html-link( __('Generate XML file', true), 
 array('action'='generateXMLFile','ext'='xml'), 
 array('class'='button','target'='_blank') ); ?


Which outputs a simple HTML link. 

I have added in Routes:

  Router::parseExtensions('json','xml');


My action: 

function generateXMLFile(){
 // Configure::write('debug',0);
 // Only XML Requests
 if(!$this-RequestHandler-isXml()){
 die();

}
 }



My view:


 response
 posts
 Post
 idtest 234/id
 /Post
 /posts
 /response


My Layout:

?php header('Content-type: text/xml');?
 ?php echo $this-Xml-header(); ?
 ?php echo $content_for_layout; ?



Now when I click the link the XML is sent as output to the screen. Clicking 
with right mousebutton -save as.. makes it possible to save the file as 
XML. 
Headers are correctly set as text/xml

How can i prevent this from outputting to the screen but output it to a 
file/stream for download ?

thanks 


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


RSS RequestHandler problem in Safari

2008-12-19 Thread willem

Hi everyone,
I'm just getting started using cakePHP by going through the IBM
tutorials, and I have a problem which I don't understand, and I also
haven't found a solution on the web.

I'm trying to set up an RSS feed using the RSS helper and the
RequestHandler component. Everything works exactly as it should in
Firefox, but in Safari something strange happens when I go to the
index.rss page. The following error occured:


Safari can’t open the page “localhost:/products/index.rss” because
it cannot redirect to locations starting with “localhost:”.


After some googling on this error I got the idea that it might have
had something to do with the port I'm running MAMP on. After changing
the port to the standard port 80 however, another error occurred:


Safari can’t open the page “http://index.rss/” because it can’t find
the server “index.rss”.


And again, in Firefox, everyhing works like a charm.

It seems to be some strange HTTP request problem, that messes up
redirecting to the correct address.

Has anyone seen this problem before? I'm running cake 1.2 on OS X
Tiger, using MAMP.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---