Cake becomes super-slow when loading assets from Plugins

2012-05-29 Thread Ernesto
Hi all!

i noticed that Cake gets very, very slow (about 50x times slower) if i load 
assets from Plugins.

Here's my layout code

html xmlns=http://www.w3.org/1999/xhtml;
head
?php
echo $this-Html-charset();
echo title. $title ./title;
echo $this-Html-meta(icon);
echo $this-Html-css(array(
generic,
$this-layout ./form,
$this-layout ./menu,
$this-layout ./top,
/. $this-request-plugin ./css/. $this-layout //this css gives 
troubles 
));
?
/head
body
div id='wrapper'
div id='top'
?php 
echo $this-Menu-output();
echo div id='title'. $title ./div;
echo $this-Azioni-output();
?
/div
div id='content'?php echo $this-fetch(content); ?/div
/div
/body
/html

Am i doing something wrong?

-- 
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 becomes super-slow when loading assets from Plugins

2012-05-29 Thread Ernesto
i forgot to say i'm usign Cake 2.2.0-RC1 on a Win7 server

Il giorno martedì 29 maggio 2012 09:51:28 UTC+2, Ernesto ha scritto:

 Hi all!

 i noticed that Cake gets very, very slow (about 50x times slower) if i 
 load assets from Plugins.

 Here's my layout code

 html xmlns=http://www.w3.org/1999/xhtml;
 head
 ?php
 echo $this-Html-charset();
 echo title. $title ./title;
 echo $this-Html-meta(icon);
 echo $this-Html-css(array(
 generic,
 $this-layout ./form,
 $this-layout ./menu,
 $this-layout ./top,
 /. $this-request-plugin ./css/. $this-layout //this css gives 
 troubles 
 ));
 ?
 /head
 body
 div id='wrapper'
 div id='top'
 ?php 
 echo $this-Menu-output();
 echo div id='title'. $title ./div;
 echo $this-Azioni-output();
 ?
 /div
 div id='content'?php echo $this-fetch(content); ?/div
 /div
 /body
 /html

 Am i doing something wrong?


-- 
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: How I can edit a user without changing the password?

2012-05-29 Thread euromark
use this when displaying pwd fields:
http://www.dereuromark.de/2011/08/25/working-with-passwords-in-cakephp/


Am Montag, 28. Mai 2012 22:00:22 UTC+2 schrieb Richard:

 I am sure there are a lot better solutions than this, and more brilliant 
 coders can help you out, but at least this is what I did.

 I used password and password2 (or reEnterPassword however your call it) on 
 edit.ctp
 and use two different rules from the User model

 on Model, you will need public $validation as your default rule,
 then create public $validationSets (you need a plugin for this.  I think 
 it is multivalidate)
 and you would create validation something like

 public $validationSets = array(

 'edit' = array(

 YOU DO ADD PASSWORD SECTION HERE

 },
 'add' = array(

 whatever rule you want

 },
 'editWithOutPassword' = array(

 Rules WITHOUT PASSWORD HERE

 )

 );


 Then on UsersController.php, you would call it something like

 public function edit($id = null) {

 if edit with password {

 $this-User-setValidation('edit');
 and do whatever your code here

 } else {

 $this-User-setValidation('editWithOutPassword');

 And here, you will have to compile your own list of forms you need to save 
 without password.
 something like
 $fieldsToUpdate = array(your field list here);
 $formValues = array(your form values here);
 $this-User-read($fieldsToUpdate, $id);
 $this-User-set($formValues);

 and rest of your save code here
 if($this-User-save()) {

 User has been saved

 } else {

 User could not be saved.

 }

 }

 }

 On Mon, May 28, 2012 at 12:20 PM, lsri8088 lsri8...@gmail.com wrote:

 Hello,

 I'm using cake 2.1 with AuthComponent and standard data modelusers.

 How I can edit a user without changing the password?

 For example, add a check I want to change the password. If thischeck is 
 true then I make a hash of the password and keep it inserted.Otherwise I 
 do not modify the password field.
 How do I add this check and then check it in my beforeSave() function?

 Another option I can think of is to leave the password field empty when 
 I go to edit a user (unset ($ this- request- data ['User'] ['password']) 
 ;)and then check if the password is empty or not. But  when I insert a 
 new user the password field should be mandatory 

 Do you have any ideas?

 thanks

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




 -- 
 Richard Joo

  

-- 
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 Data into Google Charts

2012-05-29 Thread Nikhil Agrawal
Try making a google chart API helper which will make js code for chart
on-fly using js helper of  cake PHP.  I have a one written by me but works
only for pie charts with some restrictions . If you want e-mail me for it.
Will be happy to help you.
On Mar 30, 2012 8:28 PM, phpMagpie p...@webbedit.co.uk wrote:

 I've outputted some charts (combocharts - near identical to column chart)
 using the visualization api and got the model to output an array like:

 Array
 (
 [labels] = Array
 (
 [0] = Age
 [1] = Clients
 [2] = Not Offered
 [3] = Accepted Offer
 [4] = Declined Offer
 )

 [16] = Array
 (
 [0] = 16
 [1] = 10
 [2] = 7
 [3] = 5
 [4] = 0
 )

 [17] = Array
 (
 [0] = 17
 [1] = 27
 [2] = 22
 [3] = 13
 [4] = 4
 )

 [18] = Array
 (
 [0] = 18
 [1] = 13
 [2] = 8
 [3] = 7
 [4] = 2
 )

 [19] = Array
 (
 [0] = 19
 [1] = 12
 [2] = 6
 [3] = 6
 [4] = 1
 )

 [20] = Array
 (
 [0] = 20
 [1] = 8
 [2] = 2
 [3] = 6
 [4] = 0
 )

 [21] = Array
 (
 [0] = 21
 [1] = 7
 [2] = 4
 [3] = 3
 [4] = 0
 )

 )

 I then ran this through the following
 foreach($arrayFromModel AS $row) {
   $chartData[] = json_encode($row);
 }

 and ended up with:
 Array
 (
 [0] = [Age,Clients,Not Offered,Accepted Offer,Declined
 Offer]
 [1] = [16,10,7,5,0]
 [2] = [17,27,22,13,4]
 [3] = [18,13,8,7,2]
 [4] = [19,12,6,6,1]
 [5] = [20,8,2,6,0]
 [6] = [21,7,4,3,0]
 )

 With an array of this type you use the following google function to get
 your data table:
 var data = google.visualization.arrayToDataTable([.join(',',
 $chartData).]);

 Hope this is of some help, phpMagpie

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


relationship

2012-05-29 Thread ying yang
i'm a new here in cakephp i have some trouble in relationship with
profile , item  and inventory
i want to see in the view table of inventory is all the list of item
and info that profile has. ex.


yang
27
thailand
acer laptop
mouse
keyboard
___
remarks



like that anyone can help me? thanks

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


Cassandra and cakephp

2012-05-29 Thread Arrase
Is there any cassandra datasource for cakephp? Google say yes but i can't 
find the code.

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


Extend model/datasource to save user_id on create, update

2012-05-29 Thread GB
We believe it is important to save the user id with a record both on create 
and update to know who created/changed it.  So if table has columns 
'create_user_id' and 'update_user_id', they would get populated with the 
user_id of who is logged in on create/update, just like the 
'created'/'updated' timestamps automagically get set on create/update.

I recall seeing this long ago but cannot find in any archives.  Can anyone 
point me to resources on how to do this?  I suspect it means extending the 
model in AppModel but wasn't sure if more appropriate extending the 
Datasource.

Thanks!

George

-- 
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: Extend model/datasource to save user_id on create, update

2012-05-29 Thread euromark
you are probably looking for some WhoDidItBehavior
https://github.com/dereuromark/tools/blob/2.0/Model/Behavior/WhoDidItBehavior.php
 


Am Dienstag, 29. Mai 2012 15:23:39 UTC+2 schrieb GB:

 We believe it is important to save the user id with a record both on 
 create and update to know who created/changed it.  So if table has columns 
 'create_user_id' and 'update_user_id', they would get populated with the 
 user_id of who is logged in on create/update, just like the 
 'created'/'updated' timestamps automagically get set on create/update.

 I recall seeing this long ago but cannot find in any archives.  Can anyone 
 point me to resources on how to do this?  I suspect it means extending the 
 model in AppModel but wasn't sure if more appropriate extending the 
 Datasource.

 Thanks!

 George


-- 
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: Extend model/datasource to save user_id on create, update

2012-05-29 Thread luca capra

Il 29/05/2012 15:23, GB ha scritto:

[...]
I recall seeing this long ago but cannot find in any archives.  Can 
anyone point me to resources on how to do this?  I suspect it means 
extending the model in AppModel but wasn't sure if more appropriate 
extending the Datasource.


Thanks!

George


Hi,
I had this done before with a behavior callback, like beforeSave.
Check if a magic-able field exists (like created_by or lastedited_by) 
and then apply the user id to one field or other one if it contains the 
record id.


http://book.cakephp.org/2.0/en/models/behaviors.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: error code from delete or beforeDelete?

2012-05-29 Thread stork


 I need to do more reading on Exceptions, but my case seems more like a 
 flash message than throwing an exception.


If you have your own custom exception NotEmptyCategoryException, you can 
throw it from beforeDelete() and catch it in controller:

try {
$this-Category-delete($id);
} catch (NotEmptyCategoryException $e) {
$this-Session-setFlash('This category is not empty');
$this-redirect($this-referer());
}

-- 
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: Unauthorized users don't get redirected to login action

2012-05-29 Thread McBuck DGAF
@Rihad

If a user that is not logged in is directed to your app somehow (a
link from somewhere, or types in a URL manually), then you would
expect them to be redirected to the login page with a notice that they
must be logged in in order to access that resource.

If a user is logged in and attempts to access a resource for which
they do not have permissions, then they should probably be redirected
back to the last page visited, with a notice that they do not have
access to the requested resource.  Sending them to a login page would
imply that the same person has multiple credentials that he or she
would use to access different resources on your site.

The best solution, I would think, is not offer resources (links) in
the view if the currently logged in user does not have sufficient
permissions to access them.

-- 
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: error code from delete or beforeDelete?

2012-05-29 Thread stork
...or even better:

try {
if ($this-Category-delete($id)) {
$this-Session-setFlash('Category has been deleted');
$this-redirect(array('action' = 'index'));
} else {
$this-Session-setFlash('Unknown error');
}
} catch (NotEmptyCategoryException $e) {
$this-Session-setFlash('This category is not empty');
}
$this-redirect($this-referer());

-- 
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: relationship

2012-05-29 Thread jeremyharris
You can use Containable[1] to bring in relationship data. Something like

$this-Inventory-find('all', array(
  'contain' = array(
'Profile',
'Item'
  )
));

The above assumes Inventory is associated with Profile and Item (you didn't 
give us the relationships).

-jeremy

1:  http://book.cakephp.org/2.0/en/core-libraries/behaviors/containable.html
 

On Monday, May 28, 2012 11:25:57 PM UTC-7, ying yang wrote:

 i'm a new here in cakephp i have some trouble in relationship with 
 profile , item  and inventory 
 i want to see in the view table of inventory is all the list of item 
 and info that profile has. ex. 


 yang 
 27 
 thailand 
 acer laptop 
 mouse 
 keyboard 
 ___ 
 remarks 

  

 like that anyone can help me? thanks

-- 
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: find birthday ignoring the year

2012-05-29 Thread rockbust
Anyone have a solution to this?  Thanks

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


Text instead of pictures

2012-05-29 Thread si2_job


Text instead of pictures 

Hi

I am using the code
class SignupsController extends AppController {
public $ name = 'Signups';
public $ uses = array ('Signup');
public $ helpers = array ('Html', 'Form');
public $ components = array ();
public $ useTable = false;

public function image ($ width = '120 ', $ height = '40', $ characters = '6 
') {
$ this- autoRender = false;
 $ this- layout = 'none';
 $ this- autoLayout = false;
$ image = @ imagecreate ($ width, $ height) or die ('Cannot initialize new 
GD image stream');
header (Content-Type: image / jpeg);
imagejpeg ($ image);
imagedestroy ($ image);

}
in version 1.3.15 this code to display an image, but in version 2.1.3 there 
is no picture, see the attachment 


cakephp v 2.1.3

https://lh5.googleusercontent.com/-S0xQnDTDkKc/T8Tb-F-A_pI/AEo/7bzAox5ku3U/s1600/cakephp2.1.3.jpg

cakephp v 1.3.15

https://lh3.googleusercontent.com/-FpJ0gETI51M/T8Tb3AUuPII/AEg/V54Yn7RQ9K4/s1600/cakephp-1.3.15.jpg


-- 
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: How I can edit a user without changing the password?

2012-05-29 Thread AD7six


On Monday, 28 May 2012 21:20:13 UTC+2, lsri8088 wrote:

 Hello,

 I'm using cake 2.1 with AuthComponent and standard data modelusers.

 How I can edit a user without changing the password?


Don't include the password field at all in the data you are saving.

AD

-- 
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: Unauthorized users don't get redirected to login action

2012-05-29 Thread AD7six


On Saturday, 26 May 2012 21:29:33 UTC+2, rihad wrote:



 On May 25, 7:13 pm, Dave Milsom mil...@gmail.com wrote: 
  On Friday, May 25, 2012 2:15:51 AM UTC-4, rahajiyev wrote: 
  
   On May 24, 6:52 pm, Ceeram c33...@gmail.com wrote: 
Why should a logged in user be redirected to login? 
  
   The logged in user doesn't have that specific privilege. 
   One would expect a login screen to appear when one has insufficient 
   privileges... 
  
  I wouldn't expect that. 

 Well, you would expect to be told that you don't have the permission, 
 and be allowed to log in as the user who does have it, wouldn't you?


That sounds like a workflow optimized for one user (the site admin, who is 
logged in as a test user or some such) at the significant detriment to the 
experience for normal users.

AD

-- 
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: find birthday ignoring the year

2012-05-29 Thread AD7six


On Tuesday, 29 May 2012 17:58:25 UTC+2, rockbust wrote:

 Anyone have a solution to this?  Thanks


Why don't you store the user's birthday (MM/DD) and search on that instead 
of or in addition to their birthdate.

You could also just use mysql's date functions ala (all users born in 
february):

select * from users where MONTH(birthdate) = 2;

To use sql functions in queries - either type the whole thing as a string, 
or use a dbo expression object (try first, ask second - with code).

AD

-- 
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: error code from delete or beforeDelete?

2012-05-29 Thread Steve Found

On 29/05/12 15:35, stork wrote:

...or even better:

try {
if ($this-Category-delete($id)) {
$this-Session-setFlash('Category has been deleted');
$this-redirect(array('action' = 'index'));
} else {
$this-Session-setFlash('Unknown error');
}
} catch (NotEmptyCategoryException $e) {
$this-Session-setFlash('This category is not empty');
}
$this-redirect($this-referer());


...or even better:

if( $this-Category-isEmpty() ) {
if ($this-Category-delete($id)) {
$this-Session-setFlash('Category has been deleted');
$this-redirect(array('action' = 'index'));
} else {
$this-Session-setFlash('Unknown error');
}
} else {
$this-Session-setFlash('This category is not empty');
}
$this-redirect($this-referer());

--
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: How I can edit a user without changing the password?

2012-05-29 Thread lsri8088
Thanks euromak.

I like the solution to check if it is empty but ... How do I distinguish 
between add action and edit action?
If I add a new user the password should be mandatory.
If I edit the user then the password is blank if not modified.

Another thing  How can see the current value of the field in database? 
For example

function beforeSave(){
 if(empty($this-data[$this-alias]['password']))
$this-data[$this-alias]['password'] = currentPassword;  // 
hash password stored in data base
 else
$this-data[$this-alias]['password'] = 
AuthComponent::password($this-data[$this-alias]['password']);

return true;
}

Thanks!


  

-- 
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: error code from delete or beforeDelete?

2012-05-29 Thread stork


 I need to do more reading on Exceptions, but my case seems more like a 
 flash message than throwing an exception.


Go back to reading ;-) because it is easier to throw 2 different custom 
exceptions NotEmptyCategoryException (has some products) and 
NotLeafCategoryException (has some subcategories) from beforeDelete() and 
then either react differently for them or (in controller):

try {
...
} catch (CakeException $e) {
   $this-Session-setFlash($e-getMessage());
}

-- 
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: How I can edit a user without changing the password?

2012-05-29 Thread lsri8088
Hello,

Sorry, did not read well Euromak blog. There is being compared tothe 
password field with an auxiliary field of the form (pwd) 

Understanding that, I've solved with this code:


public function beforeSave() {
parent::beforeSave($options);
if(!empty($this-data[$this-alias]['*auxPassword*'])) {
$this-data[$this-alias]['password'] = 
AuthComponent::password($this-data[$this-alias]['*auxPassword*']);

}elseif(!isset($this-data[$this-alias]['*auxPassword*'])){
$this-data[$this-alias]['password'] = 
AuthComponent::password($this-data[$this-alias]['password']);

}else{
//nothing, leave the password is in database
}
return true;
}

... and I leave the password field as not required, but does not allowempty 
strings (allowEmpty = false):


'password' = array(
'required' = array(
'rule' = array('notEmpty'),
'message' = AppModel::MESSAGE_ERROR_MANDATORY,
'allowEmpty' = false,
'required' = false, /* Can not be empty but there is not 
obligatrío in the edit form (by example) */
)
),


and I leave the edit form as:
echo $this-Form-input('username');
//echo $this-Form-input('password');
*echo $this-Form-input('auxPassword', array(*
* 'type' = 'password',*
* 'label' = 'Password (leave blank for no update)' *
* ));*



Thank you very much for your comments. :)

El martes, 29 de mayo de 2012 18:38:03 UTC+2, AD7six escribió:


On Monday, 28 May 2012 21:20:13 UTC+2, lsri8088 wrote:
Hello,

I'm using cake 2.1 with AuthComponent and standard data modelusers.

How I can edit a user without changing the password?


Don't include the password field at all in the data you are saving.


AD

-- 
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: error code from delete or beforeDelete?

2012-05-29 Thread bs28723
Thanks @stork  @steve-2  for the examples - great stuff!

Can either of you, give me some best practices for exceptions 
processing?  Maybe it is my self-taught PHP  CakePHP experiences but I 
have not a done a lot with exceptions.  Is this efficient?  Any good 
references to do some reading on this?

Thanks,
bill


On 5/29/2012 2:17 PM, Steve-2 [via CakePHP] wrote:
 On 29/05/12 15:35, stork wrote:

  ...or even better:
 
  try {
  if ($this-Category-delete($id)) {
  $this-Session-setFlash('Category has been deleted');
  $this-redirect(array('action' = 'index'));
  } else {
  $this-Session-setFlash('Unknown error');
  }
  } catch (NotEmptyCategoryException $e) {
  $this-Session-setFlash('This category is not empty');
  }
  $this-redirect($this-referer());

 ...or even better:

 if( $this-Category-isEmpty() ) {
  if ($this-Category-delete($id)) {
  $this-Session-setFlash('Category has been deleted');
  $this-redirect(array('action' = 'index'));
  } else {
  $this-Session-setFlash('Unknown error');
  }
 } else {
  $this-Session-setFlash('This category is not empty');
 }
 $this-redirect($this-referer());

 -- 
 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
 [hidden email] /user/SendEmail.jtp?type=nodenode=5708378i=0 For 
 more options, visit this group at http://groups.google.com/group/cake-php


 
 If you reply to this email, your message will be added to the 
 discussion below:
 http://cakephp.1045679.n5.nabble.com/error-code-from-delete-or-beforeDelete-tp5708340p5708378.html
  

 To start a new topic under CakePHP, email 
 ml-node+s1045679n125572...@n5.nabble.com
 To unsubscribe from CakePHP, click here 
 http://cakephp.1045679.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=1255722code=YmlsbC5zdG9sdHpAYm9vc3RlcndlYnNvbHV0aW9ucy5jb218MTI1NTcyMnwtNTU0NTk2MTUy.
 NAML 
 http://cakephp.1045679.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
  



--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/error-code-from-delete-or-beforeDelete-tp5708340p5708382.html
Sent from the CakePHP mailing list archive at Nabble.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: How I can edit a user without changing the password?

2012-05-29 Thread euromark
a) by attaching the behavior in different ways (with different settings) 
for each action you can have the desired results
I think it was allowEmpty = false for add forms

b) you can't (and never should either) - due to the nature of how hashing 
works



Am Dienstag, 29. Mai 2012 20:57:49 UTC+2 schrieb lsri8088:

 Thanks euromak.

 I like the solution to check if it is empty but ... How do I distinguish 
 between add action and edit action?
 If I add a new user the password should be mandatory.
 If I edit the user then the password is blank if not modified.

 Another thing  How can see the current value of the field in database? 
 For example

 function beforeSave(){
  if(empty($this-data[$this-alias]['password']))
 $this-data[$this-alias]['password'] = currentPassword;  // 
 hash password stored in data base
  else
 $this-data[$this-alias]['password'] = 
 AuthComponent::password($this-data[$this-alias]['password']);

 return true;
 }

 Thanks!


  

-- 
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: error code from delete or beforeDelete?

2012-05-29 Thread stork


 Can either of you, give me some best practices for exceptions processing?  
 Maybe it is my self-taught PHP  CakePHP experiences but I have not a done 
 a lot with exceptions.  Is this efficient?  Any good references to do some 
 reading on this?


Learn from the best ones ;-)

http://mark-story.com/posts/view/simplifying-controller-logic-with-exceptions 

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


CakePHP login don´t work on server

2012-05-29 Thread Omar Gonzalez
Hi, i am building 2 applicactions and on my localhost (WAMP server)
works great, but when i upload it to the server this happen:

With one:

I cant get to see domain.com/Users or eny page with Auth- It just
show a page in white.

With the other application:

When i write my username/password on the Users/login it just refresh
the page and when i request another page with Auth, i show the same
white page.

There is no white spaces befor and after ?php ?.
Tha database are the same.

Thanks. Please i have been stuck with this for 3 weeks i even changed
hosting company.

-- 
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: find birthday ignoring the year

2012-05-29 Thread rockbust
Thanks AD,

After playing around with the date function I did a search by the
month

array('MONTH(User.birthdate)' = date('m') )
array('MONTH(User.birthdate)' = date('m', strtotime('+30 days')) )
array('MONTH(User.birthdate)' = date('m', strtotime('+60 days')) )

works fine

-- 
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: app/tmp permissions

2012-05-29 Thread Nikhil Agrawal
Try changing the mode of entire cake folder using chmod to 777
-R , it will work.
Pls give the error which is displayed, if it don't work.
On May 27, 2012 3:23 PM, Steve Found step...@foundfamily.co.uk wrote:

 On 26/05/12 06:30, Kid Noire wrote:

 I'm a total newbie to Cake and believe I've put everything in their
 proper folders.  Everything is green on my local host except my tmp
 Directory is not writable (yellow)  I have no idea how to set
 permissions and have tried chmod in terminal but really not sure even
 if I'm doing this part properly.  Any step by step would be much
 appreciated.  Thanks!


 Assuming you are on a linux server running apache2:

 The easiest (but most unsafe) method is to change to your app directory
 and do 'chmod -R 777 tmp' which makes tmp and everything below it readable
 and writeable by everyone.

 A better method is to change group ownership of tmp and everthing below it
 to www-data ( or whatever group your apache server runs in ) with 'chgrp -R
 www-data tmp' followed by 'chmod -R 774 tmp' This makes tmp read/write for
 you and the www-data group but readonly for everyone else

 If you have access to /etc/apache2 on your system, you could also modify
 /etc/apache2/envvars and change 'APACHE_RUN_USER' and 'APACHE_RUN_GROUP' to
 be your username and group. This will make the webserver run as you. This
 is OK for local systems but you are unlikely to have access to this file in
 a hosted environment unless you have your own server.

 --
 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+unsubscribe@**googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/**group/cake-phphttp://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


CakePHP login don´t work on server

2012-05-29 Thread Jeremy
I had a similar item when changing in house dev server on a project. My issue 
was that my new server didn't have the pdo drivers installed for MySQL. Are you 
using a dedicated (virtual or physical) server or a shared server? You may want 
to get with your hosting company to see what the steps are to get get those 
installed.

-- 
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 login don´t work on server

2012-05-29 Thread Omar Gonzalez
Just checked and it has the PDO Driver for MySql

PDO
PDO support enabled
PDO drivers sqlite, sqlite2, mysql

pdo_mysql
PDO Driver for MySQLenabled
Client API version  5.1.61

zombiesoftware.com.mx/phpinfo.php

Thanks!

On 29 mayo, 23:31, Jeremy jcbarngro...@gmail.com wrote:
 I had a similar item when changing in house dev server on a project. My issue 
 was that my new server didn't have the pdo drivers installed for MySQL. Are 
 you using a dedicated (virtual or physical) server or a shared server? You 
 may want to get with your hosting company to see what the steps are to get 
 get those installed.

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