AW: how to translate the pagination words: "next" and "previous"

2008-11-30 Thread Liebermann, Anja Carolin

Hi Ahmed,

If you have these expressions only at one view that is the easiest solution. 
However: if you have a big application working with localization is cleaner. 
It has the advantage, that you have all your GUI strings in one place and when 
you want to change one of them later you know where to look.

Greetings Anja

-Ursprüngliche Nachricht-
Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von 
ahmedhelmy007
Gesendet: Sonntag, 30. November 2008 21:34
An: CakePHP
Betreff: Re: how to translate the pagination words: "next" and "previous"


i found another easy way to translate the two words: "next" and "previous" , 
simply by passing the arabic word to the function as an
argument:

$paginator->prev("السابق");
$paginator->next("التالي");


On Nov 29, 6:05 pm, "Federico Rinaldi" <[EMAIL PROTECTED]>
wrote:
> You should use Localization:
>
> http://book.cakephp.org/view/162/Localizing-Your-Application
>
> And internationalization
>
> http://book.cakephp.org/view/163/Internationalization-in-CakePHP
>
> Regards,
>
> FedeX
>
> On Sat, Nov 29, 2008 at 10:07 AM, ahmed sabrah <[EMAIL PROTECTED]>wrote:
>
>
>
>
>
> > i'm new to cakePHP, and i need the pagination words : "next" and 
> > "previous" to be translated into arabic.
> > should i search for an arabic language translation for the cakePHP ?
> > and if that is the case, can any one tell me where to download it ?
>
> > sorry for my bad english.- Hide quoted text -
>
> - Show quoted text -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: validation in model

2008-11-30 Thread AngeloZanetti


thanks, yes i just discovered that myself and now I realise that the
validation has to be different for create and update.

create: needs to check that the name is unique, 
update: is unique except for the edited record.

Is the best way to accomplish this by creating another function for
validation on 'update'? 

or change the current validation to validate depending on what the action
is?

thanks


David C. Zentgraf wrote:
> 
> 
> What you're looking for is this:
> http://book.cakephp.org/view/131/on
> 
> On 1 Dec 2008, at 16:06, AngeloZanetti wrote:
> 
>>
>>
>> Hi all,
>>
>> Is it possible to have model validation only be called when there is  
>> an add
>> action and not edit for example ?
>>
>> I have added unique name validation but now with the edit of a  
>> record it
>> still gives a validation error as that name of that record already  
>> exists.
>>
>> My code as follows:
>>
>>  var $validate = array(
>>  'question' => array(
>>  'Question already exists, please enter a  
>> unique
>> question' => array(
>>   'rule' => array(
>>
>> 'isUnique',
>> 'question'
>>   )
>> ),
>>  'This field cannot be left blank' =>
>> VALID_NOT_EMPTY
>>  ),
>>
>> function isUnique($field, $value) {
>>
>>$fields[$this->name.'.'.$value] = $field[$value];
>>$this->recursive = -1;
>>
>>if ($this->hasAny($fields)) {
>>  $this->invalidate('unique_'.$field);
>>  return false;
>>} else {
>>
>>  return true;
>>}
>>  }
>>
>> thanks in advance.
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/validation-in-model-tp20767005p20767005.html
>> Sent from the CakePHP mailing list archive at Nabble.com.
>>
>>
>> >
> 
> 
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/validation-in-model-tp20767005p20767279.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Check Unique in a model

2008-11-30 Thread AngeloZanetti


I have got a similiar problem that the validation works for adding must it
mustn't validate when editing the record as its going to have the same name
in DB as the form when editing.

how can we disable this for the edit function? or must it be done in the
controller?





jonknee wrote:
> 
> 
>> In fact, it seems that this built-in rule doesn't work!
>> Why is this not yet fixed? We allways need to check unicity of a field
>> in all of our applications...
> 
> What's not working for you? It seems to be working for me. I had a
> custom method until I was told about isUnique working through
> validation and after updating my code it seemed to keep working.
> 
> 



-- 
View this message in context: 
http://www.nabble.com/Check-Unique-in-a-model-tp16473557p20767209.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: validation in model

2008-11-30 Thread David C. Zentgraf

What you're looking for is this:
http://book.cakephp.org/view/131/on

On 1 Dec 2008, at 16:06, AngeloZanetti wrote:

>
>
> Hi all,
>
> Is it possible to have model validation only be called when there is  
> an add
> action and not edit for example ?
>
> I have added unique name validation but now with the edit of a  
> record it
> still gives a validation error as that name of that record already  
> exists.
>
> My code as follows:
>
>   var $validate = array(
>   'question' => array(
>  'Question already exists, please enter a  
> unique
> question' => array(
>   'rule' => array(
>
> 'isUnique',
> 'question'
>   )
> ),
>  'This field cannot be left blank' =>
> VALID_NOT_EMPTY
>  ),
>
> function isUnique($field, $value) {
>
>$fields[$this->name.'.'.$value] = $field[$value];
>$this->recursive = -1;
>
>if ($this->hasAny($fields)) {
>  $this->invalidate('unique_'.$field);
>  return false;
>} else {
>
>  return true;
>}
>  }
>
> thanks in advance.
>
> -- 
> View this message in context: 
> http://www.nabble.com/validation-in-model-tp20767005p20767005.html
> Sent from the CakePHP mailing list archive at Nabble.com.
>
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



validation in model

2008-11-30 Thread AngeloZanetti


Hi all, 

Is it possible to have model validation only be called when there is an add
action and not edit for example ?

I have added unique name validation but now with the edit of a record it
still gives a validation error as that name of that record already exists.

My code as follows: 

var $validate = array(
'question' => array(
  'Question already exists, please enter a unique
question' => array(
   'rule' => array(
   'isUnique',
'question'
   )
 ),
  'This field cannot be left blank' =>
VALID_NOT_EMPTY   
  ),

 function isUnique($field, $value) {

$fields[$this->name.'.'.$value] = $field[$value];
$this->recursive = -1;

if ($this->hasAny($fields)) {
  $this->invalidate('unique_'.$field);
  return false;
} else {

  return true;
}
  }

thanks in advance.

-- 
View this message in context: 
http://www.nabble.com/validation-in-model-tp20767005p20767005.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Copied cake PHP files to a new Ubuntu Intrepid box and nothing is working

2008-11-30 Thread Nick

Thanks for the suggestions, you were right, I went through the phpinfo
() for the old and new servers and was actually missing one of the
core components.
Completely overlooked it without even thinking about it. Was missing
the mysql module for PHP5... yah slightly important. :-p

All is working now, thanks for the pointers!


On Nov 30, 5:17 pm, "Howard Glynn" <[EMAIL PROTECTED]> wrote:
> Are you sure you have sufficient php modules installed with ubuntu package
> manager?
>
> I would compare your phpinfo() on the original box versus the new box(), or
> even just have a look at what is ticked related to php on synaptic package
> manager. If I saw that error message I'd be looking at libraries straight
> away.
>
> You may not get everything you think you ought to by default.
>
> On Sun, Nov 30, 2008 at 5:52 AM, Nick <[EMAIL PROTECTED]> wrote:
>
> > I'm desperate for some help here...  I just built a brand new ubuntu
> > intrepid server and copied everything from my cake folders on my
> > Ubuntu Hardy box to the new intrepid server.
>
> > If I extract a fresh version of Cake, everything works fine, css shows
> > up, db calls work correctly, etc., but everything is failing when I
> > copy all my work over.
>
> > I see no CSS formatting and I get the following error:
>
> > Fatal error: Call to undefined function mysql_connect() in /home/phazo/
> > Dropbox/www/lymtest3/cake/libs/model/datasources/dbo/dbo_mysql.php on
> > line 117
>
> > I've dumped my sql database and imported it on the new device
> > triple checked the sql accounts
> > made sure my tmp directory is writeable
> > enabled MOD rewrites
> > verified my .htaccess files exist
> > set "AllowOverride all" for my directories in the apache2.conf file
>
> > what else could I be missing?
> > Thanks for any help anyone can provide!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to use Prefix Routing for form submit

2008-11-30 Thread bookme

Thanks Kyo,

Your solution is working fine but sometimes I am not using URL as form
action in this case I am finding problem...

like if url is
http://localhost/test/education/blogs/add/

and I want to handale form post action on education_index then your
suggested solution is not working

Please tell me how should I do this?

Thanks


On Nov 28, 6:54 pm, Kyo <[EMAIL PROTECTED]> wrote:
> Try something like:
>
>         echo $form->create(null, array('url'=>"/{$this->params['url']
> ['url']}"));
>
> $params['url']['url'] holds the url of the current page.
> That should do the trick.
>
> hth
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: total newbie - Config question

2008-11-30 Thread thatsgreat2345

On defining ROOT I forgot to say change CakePHP to whatever folder you
have called your cake folder.

On Nov 30, 7:08 pm, "Scott Powell" <[EMAIL PROTECTED]> wrote:
> Thanks for the help. Will do this.
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
>
> Of thatsgreat2345
> Sent: Sunday, November 30, 2008 11:42 PM
> To: CakePHP
> Subject: Re: total newbie - Config question
>
> DO NOT PUT CAKEPHP IN PUBLIC_HTML! I have hostgator as well, this is
> what you do put it above public_html so it will not be accessible by
> anyone. Then take webroot folder out of the app folder which is inside
> the cake folder, and upload it to your public html, or if the cakeapp
> is going to be your site just upload the contents of webroot folder to
> public_html. Then edit index.php in your webroot folder that you have
> just added to public_html and change these 2 lines
>
> if (!defined('ROOT')) {
>                 define('ROOT', DS.'home'.DS.'YOUR HOSTGATOR
> USERNAME'.DS.'CakePHP');
>         }
>
> and if you have changed the app folder name from app to something else
> then change this line too
> if (!defined('APP_DIR')) {
>                 define('APP_DIR', 'APP FOLDER NAME');
>         }
>
> On Nov 30, 10:01 am, rgreenphotodesign <[EMAIL PROTECTED]>
> wrote:
> > Do you have your domain home directory/doc root pointed to /possible
> > sub dir/app/webroot/?
>
> > On Nov 29, 7:49 pm, scott <[EMAIL PROTECTED]> wrote:
>
> > > Hello all,
>
> > > Just started learning CakePHP and am excited at the possibilities, but
> > > have hit my first snag.
>
> > > This is my first post and have read the documentation, but cannot find
> > > the solution to my problem.
>
> > > I uploaded the full cake package to my server into the root directory
> > > which is public_html. I'm using Hostgator which has php 5 and
> > > mod_rewrite activated.
>
> > > I can only get the home page to show up when I set ReWriteEngine  to
> > > "off". If it is on, I get 404 not found.
>
> > > Also, I don't know if this is a problem, but I don't have an active
> > > domain pointed to it. So I access the root directory
> bywww.mainserverexample.com/~cake
>
> > > Thanks in advance for your help,
>
> > > Scott
>
> No virus found in this incoming message.
> Checked by AVG.
> Version: 7.5.549 / Virus Database: 270.9.10/1810 - Release Date: 11/24/2008
> 2:36 PM
>
> No virus found in this outgoing message.
> Checked by AVG.
> Version: 7.5.549 / Virus Database: 270.9.10/1810 - Release Date: 11/24/2008
> 2:36 PM
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: total newbie - Config question

2008-11-30 Thread Scott Powell

Thanks for the help. Will do this. 



-Original Message-
From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of thatsgreat2345
Sent: Sunday, November 30, 2008 11:42 PM
To: CakePHP
Subject: Re: total newbie - Config question


DO NOT PUT CAKEPHP IN PUBLIC_HTML! I have hostgator as well, this is
what you do put it above public_html so it will not be accessible by
anyone. Then take webroot folder out of the app folder which is inside
the cake folder, and upload it to your public html, or if the cakeapp
is going to be your site just upload the contents of webroot folder to
public_html. Then edit index.php in your webroot folder that you have
just added to public_html and change these 2 lines

if (!defined('ROOT')) {
define('ROOT', DS.'home'.DS.'YOUR HOSTGATOR
USERNAME'.DS.'CakePHP');
}

and if you have changed the app folder name from app to something else
then change this line too
if (!defined('APP_DIR')) {
define('APP_DIR', 'APP FOLDER NAME');
}

On Nov 30, 10:01 am, rgreenphotodesign <[EMAIL PROTECTED]>
wrote:
> Do you have your domain home directory/doc root pointed to /possible
> sub dir/app/webroot/?
>
> On Nov 29, 7:49 pm, scott <[EMAIL PROTECTED]> wrote:
>
> > Hello all,
>
> > Just started learning CakePHP and am excited at the possibilities, but
> > have hit my first snag.
>
> > This is my first post and have read the documentation, but cannot find
> > the solution to my problem.
>
> > I uploaded the full cake package to my server into the root directory
> > which is public_html. I'm using Hostgator which has php 5 and
> > mod_rewrite activated.
>
> > I can only get the home page to show up when I set ReWriteEngine  to
> > "off". If it is on, I get 404 not found.
>
> > Also, I don't know if this is a problem, but I don't have an active
> > domain pointed to it. So I access the root directory
bywww.mainserverexample.com/~cake
>
> > Thanks in advance for your help,
>
> > Scott

No virus found in this incoming message.
Checked by AVG. 
Version: 7.5.549 / Virus Database: 270.9.10/1810 - Release Date: 11/24/2008
2:36 PM
 

No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.549 / Virus Database: 270.9.10/1810 - Release Date: 11/24/2008
2:36 PM
 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Pagination Ordering

2008-11-30 Thread oceanguy

Okay, google isn't helping me find the answer to this one, hopefully
someone else can point me to what is probably an obvious answer...

How can one setup multiple levels or ordering for pagination?

For example: My user listing has a default pagination order of
'User.last_name', but when I select another column (say 'state') the
results are sorted by state only (results from the same state are
listed in the order they are in the database).

Can I setup pagination to sort results by state,last_name (i.e. use a
secondary ordering), or do I need to setup a custom query for this?

Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Mail Queuing in CakePHP

2008-11-30 Thread boyracerr

Hi,

In my rewrite of a system into CakePHP, I need to implement a Mail
Queue (storing mail messages in a database for later sending in order
not to overwhelm the SMTP server). My previous application used the
PEAR Mail::Queue class for this, and it always worked perfectly.

I've searched for similar Cake options, but haven't really found
anything comparable. My options therefore seem to be:

1. Integrate the PEAR class into my application.

- Searching for people who have attempted this gives
http://bakery.cakephp.org/articles/view/integrating-pear-pager as the
top result. The wrapper code seems rather extensive.

2. Integrate a Zend Framework class

- I've never used Zend Framework before, but it looks very interesting
and seems to have less overhead than PEAR. This tutorial:

http://bakery.cakephp.org/articles/view/integrating-zend-framework-lucene-with-your-cake-application

seems to be a pretty tight example of how to integrate the two
frameworks/elements.

3. Write my own

- I'm not particularly keen to do this unless I have to, partly due to
laziness and partly due to the feeling that this sort of thing should
be standardised as with PEAR. There is some previous discussion on
doing this here:

http://groups.google.com/group/cake-php/browse_thread/thread/44fac5e4c87ad053.


I would really appreciate any comments on this, either specifically as
to the best way to do Mail Queing or in general as to implementing
other frameworks into CakePHP.

Thanks!




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: MVC falling to pieces for modern AJAX apps

2008-11-30 Thread the_woodsman

wirtsi,

I honestly think you're takoing the wrong approach here.
For example: emdedding alert() calls in your models??? How fragile a
system will that create? How will you use your business logic in CRON
jobs/ other contexts? I know progressive enhancement has its own
issues, but I think it's much better than the system you seem to have
in mind.

For example, I often use JQuery to do stuff like this:

- standard cake form on the page
- hijack it with JQ to do an ajax submit
- parse the results in JQ (real easy) and insert field/validation
messages into the page dynamically

You can take this further and (as per James K's very good response)
ask for different outputs depending upon the extension -
i.e add .json to the form action URLs so they return data easily used
by JS.

Advantages of this approach are numerous: your site can still work
without JS, is more secure, is reliable cross-platform, with less
coupling, you can keep your JS code in .js files (where it belongs)
and there are SEO benefits!

I know that there are issues with the way important business logic is
spread throughout the server and client layers, but I don't think this
is a MVC issue specifically - it's just the cost of pushing the
boundaries of web apps. And as James mentioned, you'll always need a
foundation of server side code for security etc, and trust me, always
having a working mechanism for your users (even as a backup) in case
your javascript doesn't work in their environment is a big advantage.

Imho, you should try and push the progressive enhancement / separation
of concerns as far as you can before you consider opting for
integrating the client side code with your business logic...

Sorry for the long response, but it appears I have quite strong
feelings on the subject :)


On Nov 30, 4:47 pm, wirtsi <[EMAIL PROTECTED]> wrote:
> James, that ExtHelper of yours would truly be very interesting to
> me ... I've been wrapping my head around Ext the last few weeks and I
> really like the possibilities it gives you creating spot on user
> interfaces .. I just found it a massive pain to get the data over from
> Cake, especially with 1:n or n:m relationships which I more or less
> had to put back together by hand in ext (because I had to flatten the
> data output list to one level) but then perhaps I haven't quite
> grasped all that DataReader stuff yet.
>
> I really like the idea just using a form submit to validate the
> data ... I was thinking along the lines of per field ajax submit &
> validate (like you see in the ext demos .. field is empty, ext
> complains about it right away) but what the heck, this seems so much
> easier :). Do you validate only after a user submits (via ajax) or do
> you submit periodically to display errors on the fly? In latter case I
> could image one could get quite a few duplicate entries if the user
> happens to fill out all the fields correctly.
>
> But to get back to my original post, how would it sound if Cake
> allowed for user defined JavaScript functions in the model definition.
> For example "name" NOT_EMPTY but also "alert('Must not be empty') so
> the server checks the field on submit (in case anyone was fiddling
> around with the post data) but the javascript function gets pushed
> through to the view.
>
> Ok, that would be having view code in the model but on the other hand
> this code is definitely related to the models data.
>
> Thanks for your input
>
> wirtsi
>
> On 30 Nov., 16:07, James K <[EMAIL PROTECTED]> wrote:
>
> > Strongly disagree.
>
> > I'm in the middle of a massive CakePHP/ExtJS development and it works
> > like a dream (To date: 40 controllers, 89 models). A lot of our
> > controller actions simply return JSON. Cake is perfectly suited to
> > this. Grab your data, do some set::extract manipulation on it if
> > necessary, and use the object method of the javascript helper to send
> > it to the client as JSON.
>
> > Also you should ALWAYS validate your data on the server side. Client
> > side validation is not reliable or secure. You can add it in as a
> > slight convenience to the user, but your application should never ever
> > rely on client side validation to do its job.
>
> > The technique we're currently using is we load Cake's forms into ExtJS
> > panels that proceed to digest the DOM elements (configure the form in
> > Ext, set the contentEl properties of the different panels to the ids
> > of the divs or fieldsets generated by cake) and then submit them via
> > AJAX back to the server. When the panel comes back, it has Cake's
> > validation messages next to the appropriate fields. This technique
> > also allows us to leverage the added security of the Security
> > component to ensure that no one's using Firebug or something similar
> > to allow them to submit data they aren't supposed to (which is a major
> > security risk a lot of developers in the honeymoon phase with AJAX
> > overlook or ignore).
>
> > We're also in the process of developing an ExtJS Form Helper

Re: Copied cake PHP files to a new Ubuntu Intrepid box and nothing is working

2008-11-30 Thread Howard Glynn
Are you sure you have sufficient php modules installed with ubuntu package
manager?

I would compare your phpinfo() on the original box versus the new box(), or
even just have a look at what is ticked related to php on synaptic package
manager. If I saw that error message I'd be looking at libraries straight
away.

You may not get everything you think you ought to by default.



On Sun, Nov 30, 2008 at 5:52 AM, Nick <[EMAIL PROTECTED]> wrote:

>
> I'm desperate for some help here...  I just built a brand new ubuntu
> intrepid server and copied everything from my cake folders on my
> Ubuntu Hardy box to the new intrepid server.
>
> If I extract a fresh version of Cake, everything works fine, css shows
> up, db calls work correctly, etc., but everything is failing when I
> copy all my work over.
>
> I see no CSS formatting and I get the following error:
>
> Fatal error: Call to undefined function mysql_connect() in /home/phazo/
> Dropbox/www/lymtest3/cake/libs/model/datasources/dbo/dbo_mysql.php on
> line 117
>
> I've dumped my sql database and imported it on the new device
> triple checked the sql accounts
> made sure my tmp directory is writeable
> enabled MOD rewrites
> verified my .htaccess files exist
> set "AllowOverride all" for my directories in the apache2.conf file
>
> what else could I be missing?
> Thanks for any help anyone can provide!
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: controller fixturize drops table in end, how to test data?

2008-11-30 Thread mradosta

maybe you could overwrite the endController method, and then check for
the result to finish the test case method.


var $result;

function endController(&$controller, $params = array()) {
$this->result = $controller->Model->find("all");

return parent::endController($controller, $params);
}



function testMyAction() {


$this->assertEqual($this->result, $expected);
}

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how to translate the pagination words: "next" and "previous"

2008-11-30 Thread ahmedhelmy007

i found another easy way to translate the two words: "next" and
"previous" , simply by passing the arabic word to the function as an
argument:

$paginator->prev("السابق");
$paginator->next("التالي");


On Nov 29, 6:05 pm, "Federico Rinaldi" <[EMAIL PROTECTED]>
wrote:
> You should use Localization:
>
> http://book.cakephp.org/view/162/Localizing-Your-Application
>
> And internationalization
>
> http://book.cakephp.org/view/163/Internationalization-in-CakePHP
>
> Regards,
>
> FedeX
>
> On Sat, Nov 29, 2008 at 10:07 AM, ahmed sabrah <[EMAIL PROTECTED]>wrote:
>
>
>
>
>
> > i'm new to cakePHP, and i need the pagination words : "next" and
> > "previous" to be translated into arabic.
> > should i search for an arabic language translation for the cakePHP ?
> > and if that is the case, can any one tell me where to download it ?
>
> > sorry for my bad english.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Copied cake PHP files to a new Ubuntu Intrepid box and nothing is working

2008-11-30 Thread Nick

I've traced the issue to the database.php file.

If this file doesn't exist, then the CSS renders correctly.

If this file exists, then everything goes haywire.  This happens
whether I add the correct mysql login data or bogus data.

There is a difference between the versions of mysql between the two
boxes:

Old: 5.0.51a-3ubuntu5.4 (Ubuntu)
New: 5.0.67-0ubuntu6 (Ubuntu)

Anyone know of any issues with the new version of MySql or Ubuntu?





On Nov 30, 12:52 am, Nick <[EMAIL PROTECTED]> wrote:
> I'm desperate for some help here...  I just built a brand new ubuntu
> intrepid server and copied everything from my cake folders on my
> Ubuntu Hardy box to the new intrepid server.
>
> If I extract a fresh version of Cake, everything works fine, css shows
> up, db calls work correctly, etc., but everything is failing when I
> copy all my work over.
>
> I see no CSS formatting and I get the following error:
>
> Fatal error: Call to undefined function mysql_connect() in /home/phazo/
> Dropbox/www/lymtest3/cake/libs/model/datasources/dbo/dbo_mysql.php on
> line 117
>
> I've dumped my sql database and imported it on the new device
> triple checked the sql accounts
> made sure my tmp directory is writeable
> enabled MOD rewrites
> verified my .htaccess files exist
> set "AllowOverride all" for my directories in the apache2.conf file
>
> what else could I be missing?
> Thanks for any help anyone can provide!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how to translate the pagination words: "next" and "previous"

2008-11-30 Thread ahmedhelmy007

thanx very much FedeX .

On Nov 29, 6:05 pm, "Federico Rinaldi" <[EMAIL PROTECTED]>
wrote:
> You should use Localization:
>
> http://book.cakephp.org/view/162/Localizing-Your-Application
>
> And internationalization
>
> http://book.cakephp.org/view/163/Internationalization-in-CakePHP
>
> Regards,
>
> FedeX
>
> On Sat, Nov 29, 2008 at 10:07 AM, ahmed sabrah <[EMAIL PROTECTED]>wrote:
>
>
>
>
>
> > i'm new to cakePHP, and i need the pagination words : "next" and
> > "previous" to be translated into arabic.
> > should i search for an arabic language translation for the cakePHP ?
> > and if that is the case, can any one tell me where to download it ?
>
> > sorry for my bad english.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Understanding if a model-controller couple is needed

2008-11-30 Thread Rob

The answer as always is "it depends" (but in this case I think the
answer is yes you need a model for the review).

First I would suggest that your movies_reviewers might be named
reviews, since it sounds like that is what you're putting in it.

If you will be accessing data from the review, then you need a model
for it. Personally I tend to model the relationships of all of the
tables using "cake bake", then go back and make sure all the
relationships are reflected in the models that I will be driving my UI
with.

Are your relationships really HABTM, or are they parent-child? I would
think that you'd have:

   1. Movies has many Reviews
   2. Reviewers has many Reviews
   3. Reviews belong to Movies and Reviewers

On Nov 29, 11:43 am, Fabio M <[EMAIL PROTECTED]> wrote:
> Hi all. This is my first message here.
> I want to make it clear first that I read the (almost) whole
> documentation and now I'm going to develop a first application. I
> still have a doubt about dealing with HABTM relationship.
>
> I give you the precise picture.
>
> I have two entities: movie (motion picture) and reviewer. These are in
> a HABTM relationship, which represents the review. I'll create the
> conventional db tables: movies, reviewers and movies_reviewers. Note
> that movies_reviewers isnt just a join-table, it includes other
> informations beyond the foreign key (the vote of the review, the text
> of the review).
>
> Now I ask: do I need a model for the review? Is the review an object
> in my application?
>
> If so, which table should this model class be linked to? Directly to
> join-table?
>
> Should I make a whole another design? Dont know...  with three
> entities (movie, review, reviewers) and two merely associative
> relationships (with a movie_id and a reviewer_id in the reviews
> table)?
>
> Thank you. And forgive me for bad explanation and for not having found
> this topic in other threads. I'm italian and I'm a bit in difficulty
> at retrieving technical infos in a foreign language.
>
> Thank you in advance.  : )
>
>                       Fabio M
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: total newbie - Config question

2008-11-30 Thread thatsgreat2345

DO NOT PUT CAKEPHP IN PUBLIC_HTML! I have hostgator as well, this is
what you do put it above public_html so it will not be accessible by
anyone. Then take webroot folder out of the app folder which is inside
the cake folder, and upload it to your public html, or if the cakeapp
is going to be your site just upload the contents of webroot folder to
public_html. Then edit index.php in your webroot folder that you have
just added to public_html and change these 2 lines

if (!defined('ROOT')) {
define('ROOT', DS.'home'.DS.'YOUR HOSTGATOR 
USERNAME'.DS.'CakePHP');
}

and if you have changed the app folder name from app to something else
then change this line too
if (!defined('APP_DIR')) {
define('APP_DIR', 'APP FOLDER NAME');
}

On Nov 30, 10:01 am, rgreenphotodesign <[EMAIL PROTECTED]>
wrote:
> Do you have your domain home directory/doc root pointed to /possible
> sub dir/app/webroot/?
>
> On Nov 29, 7:49 pm, scott <[EMAIL PROTECTED]> wrote:
>
> > Hello all,
>
> > Just started learning CakePHP and am excited at the possibilities, but
> > have hit my first snag.
>
> > This is my first post and have read the documentation, but cannot find
> > the solution to my problem.
>
> > I uploaded the full cake package to my server into the root directory
> > which is public_html. I'm using Hostgator which has php 5 and
> > mod_rewrite activated.
>
> > I can only get the home page to show up when I set ReWriteEngine  to
> > "off". If it is on, I get 404 not found.
>
> > Also, I don't know if this is a problem, but I don't have an active
> > domain pointed to it. So I access the root directory 
> > bywww.mainserverexample.com/~cake
>
> > Thanks in advance for your help,
>
> > Scott
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Self contained css in Cake's default app

2008-11-30 Thread rgreenphotodesign

I'm no expert, but I generally tend to create a one page/style sheet
in something like Dreamweaver. I'll try to cover as many of the block
level elements I'll need so I can have as simple of mark up in my
views. Then I just plop the CSS  in and am off to the bakery.

On Nov 29, 7:46 pm, "Federico Rinaldi" <[EMAIL PROTECTED]>
wrote:
> The idea is to bring the legacy app, to cake. I know there are some choices
> but I think the cleanest it's to self contain cake classes. If just do not
> use generic css in the app I will have to RE create all the classes for the
> cake views again (not so much DRY I think, as generic should already have
> those).
>
> FedeX
>
> On Sun, Nov 30, 2008 at 12:21 AM, mark_story <[EMAIL PROTECTED]> wrote:
>
> > Could just not use the generic css on an already started app?
>
> > -Mark
>
> > On Nov 29, 2:52 pm, "Federico Rinaldi" <[EMAIL PROTECTED]>
> > wrote:
> > > Hi guys, I just wanted to ask what do you think about the css that comes
> > by
> > > default in a cake's application. As far as I can tell it is very helpfull
> > as
> > > it provides you a way to rapidly change the layout of your app but some
> > > times it's a real pain as it chages the base style for almost every html
> > > entity.
> > > I think that with new apps that's not an issue but if you have to merge
> > it
> > > with some kind of legacy code then you will have to override each and
> > every
> > > one of those entities styles.
>
> > > So my proposal is that the cake.generic.css contains all of the styles
> > self
> > > contained (ie in classes or pointing to specific element's ids).
>
> > > What do you think of that?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to validate and update password of a user with affecting HABTM relations for the user?

2008-11-30 Thread thatsgreat2345

if you have the auth component added, then password field will be
hashed automatically, the hashing happens before validation and thus
your validation rules, except for your password compare, will never
work.
http://teknoid.wordpress.com/2008/10/08/demystifying-auth-features-in-cakephp-12/
check that out should show you what to do to fix that.

For using validation from controller you must set it to the model
first
http://book.cakephp.org/view/410/Validating-Data-from-the-Controller


On Nov 30, 9:52 am, Milmar <[EMAIL PROTECTED]> wrote:
> I tried $this->Model->validate() in the controller, but for some
> reason, 'password' and 'password_confirm' are not being passed to the
> Model (I tried logging them in the "beforeValidate()" callback).
> Do you have some sample code where I can see how to use $this->Model-
>
> >validate() for editing the password?
>
> Thanks.
>
> On Dec 1, 1:36 am, thatsgreat2345 <[EMAIL PROTECTED]> wrote:
>
> > You can validate from the controller using $this->Model->validate();
>
> > On Nov 30, 9:27 am, Milmar <[EMAIL PROTECTED]> wrote:
>
> > > I was able to solve this by first using $this->User->save($this->data)
> > > so that I can validate the fields in the model.
> > > Then switching to the "saveField" function in the Model's "beforeSave
> > > ()" callback so that the save would not affect the HABTM relations.
> > > Here's the code for "beforeSave()":
>
> > > function beforeSave() {
> > >          //If operation is save and this is an edit(has ID,password,
> > > and password_confirm),
> > >          //   use the saveField command to save the password
> > >          if(isset($this->data[$this->alias]['password']) && isset
> > > ($this->data[$this->alias]['id']) &&
> > >             isset($this->data[$this->alias]['password_confirm']))
> > >          {
> > >             return 
> > > $this->saveField('password',$this->data[$this->alias]['password']);
>
> > >          }
>
> > >          $this->hashPasswords(null, true);
> > >          return true;
>
> > > }
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: total newbie - Config question

2008-11-30 Thread rgreenphotodesign

Do you have your domain home directory/doc root pointed to /possible
sub dir/app/webroot/?

On Nov 29, 7:49 pm, scott <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> Just started learning CakePHP and am excited at the possibilities, but
> have hit my first snag.
>
> This is my first post and have read the documentation, but cannot find
> the solution to my problem.
>
> I uploaded the full cake package to my server into the root directory
> which is public_html. I'm using Hostgator which has php 5 and
> mod_rewrite activated.
>
> I can only get the home page to show up when I set ReWriteEngine  to
> "off". If it is on, I get 404 not found.
>
> Also, I don't know if this is a problem, but I don't have an active
> domain pointed to it. So I access the root directory 
> bywww.mainserverexample.com/~cake
>
> Thanks in advance for your help,
>
> Scott
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cake Bake Fatal error in Linux

2008-11-30 Thread brian
This has nothing to do with CakePHP. You need to sort out your MySQL
installation,
first. The error you're seeing is, again, quite common. Google will show you
the way.

On Sun, Nov 30, 2008 at 8:57 AM, nithinalex <[EMAIL PROTECTED]> wrote:

>
> Now I am getting a new error...
>
> Warning: mysql_connect(): Can't connect to local MySQL server through
> socket '/var/run/mysqld/mysqld.sock' (2) in /usr/share/php/cake1.2/
> libs/model/datasources/dbo/dbo_mysql.php on line 100
>
> I am getting confusedI installed php cli,Cake1.2 Scripts,php5-
> mysql...( Working in Xampp environment in ubuntu )
>
> I am getting the above error when i try to bake model,controllers &
> views...only able to configure database.
>
> Can anyone tell how to configure Cake Bake in Ubuntu under Xampp
> Environment.
>
>
>
>
> brian wrote:
> > It appears that you do not have the PHP MySQL libs installed.
> >
> > *apt*-get install php-*mysql*
> >
> > On Sat, Nov 29, 2008 at 10:21 AM, nithinalex <[EMAIL PROTECTED]> wrote:
> >
> > >
> > > Hello Friends
> > >
> > >   When i am using Cake Bake I am getting an error like this...
> > >
> > > Fatal error: Call to undefined function mysql_connect() in /usr/share/
> > > php/cake1.2/libs/model/datasources/dbo/dbo_mysql.php on line 100
> > >
> > > I am using XAMPP, Cake 1.2 in Ubuntu.
> > >
> > >
> > > >
> > >
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to validate and update password of a user with affecting HABTM relations for the user?

2008-11-30 Thread Milmar

I tried $this->Model->validate() in the controller, but for some
reason, 'password' and 'password_confirm' are not being passed to the
Model (I tried logging them in the "beforeValidate()" callback).
Do you have some sample code where I can see how to use $this->Model-
>validate() for editing the password?

Thanks.


On Dec 1, 1:36 am, thatsgreat2345 <[EMAIL PROTECTED]> wrote:
> You can validate from the controller using $this->Model->validate();
>
> On Nov 30, 9:27 am, Milmar <[EMAIL PROTECTED]> wrote:
>
> > I was able to solve this by first using $this->User->save($this->data)
> > so that I can validate the fields in the model.
> > Then switching to the "saveField" function in the Model's "beforeSave
> > ()" callback so that the save would not affect the HABTM relations.
> > Here's the code for "beforeSave()":
>
> > function beforeSave() {
> >          //If operation is save and this is an edit(has ID,password,
> > and password_confirm),
> >          //   use the saveField command to save the password
> >          if(isset($this->data[$this->alias]['password']) && isset
> > ($this->data[$this->alias]['id']) &&
> >             isset($this->data[$this->alias]['password_confirm']))
> >          {
> >             return 
> > $this->saveField('password',$this->data[$this->alias]['password']);
>
> >          }
>
> >          $this->hashPasswords(null, true);
> >          return true;
>
> > }
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: update related model data

2008-11-30 Thread Milmar

Did you try setting $this->User->UserProfile->id to the id of the
userprofile to be edited? (I'm not really sure about this since I've
never used "saveAll").

Maybe:

$userprofileid = $this->User->UserProfile->find(array('user_id' =>
$this->data['User']['id']),array('id'));
$this->User->UserProfile->id = $userprofileid['UserProfile']['id'];
$this->User->saveAll($this->data);





On Nov 30, 3:02 am, lacithetemplar <[EMAIL PROTECTED]> wrote:
> hello,
> I have two tables "users" and "user_profiles", which are related .
> there's no problem to add new data to this tables, but I don't know
> how to edit/update this data. when I use $this->User->saveAll($this->data), 
> it updates users table, but in the user_profiles it add a new
>
> entry instead of update current entry. have someone a solution?
> thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to validate and update password of a user with affecting HABTM relations for the user?

2008-11-30 Thread thatsgreat2345

You can validate from the controller using $this->Model->validate();

On Nov 30, 9:27 am, Milmar <[EMAIL PROTECTED]> wrote:
> I was able to solve this by first using $this->User->save($this->data)
> so that I can validate the fields in the model.
> Then switching to the "saveField" function in the Model's "beforeSave
> ()" callback so that the save would not affect the HABTM relations.
> Here's the code for "beforeSave()":
>
> function beforeSave() {
>          //If operation is save and this is an edit(has ID,password,
> and password_confirm),
>          //   use the saveField command to save the password
>          if(isset($this->data[$this->alias]['password']) && isset
> ($this->data[$this->alias]['id']) &&
>             isset($this->data[$this->alias]['password_confirm']))
>          {
>             return 
> $this->saveField('password',$this->data[$this->alias]['password']);
>
>          }
>
>          $this->hashPasswords(null, true);
>          return true;
>
> }
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to validate and update password of a user with affecting HABTM relations for the user?

2008-11-30 Thread Milmar

I was able to solve this by first using $this->User->save($this->data)
so that I can validate the fields in the model.
Then switching to the "saveField" function in the Model's "beforeSave
()" callback so that the save would not affect the HABTM relations.
Here's the code for "beforeSave()":

function beforeSave() {
 //If operation is save and this is an edit(has ID,password,
and password_confirm),
 //   use the saveField command to save the password
 if(isset($this->data[$this->alias]['password']) && isset
($this->data[$this->alias]['id']) &&
isset($this->data[$this->alias]['password_confirm']))
 {
return $this->saveField('password',$this->data[$this-
>alias]['password']);
 }

 $this->hashPasswords(null, true);
 return true;
}
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: MVC falling to pieces for modern AJAX apps

2008-11-30 Thread wirtsi

James, that ExtHelper of yours would truly be very interesting to
me ... I've been wrapping my head around Ext the last few weeks and I
really like the possibilities it gives you creating spot on user
interfaces .. I just found it a massive pain to get the data over from
Cake, especially with 1:n or n:m relationships which I more or less
had to put back together by hand in ext (because I had to flatten the
data output list to one level) but then perhaps I haven't quite
grasped all that DataReader stuff yet.

I really like the idea just using a form submit to validate the
data ... I was thinking along the lines of per field ajax submit &
validate (like you see in the ext demos .. field is empty, ext
complains about it right away) but what the heck, this seems so much
easier :). Do you validate only after a user submits (via ajax) or do
you submit periodically to display errors on the fly? In latter case I
could image one could get quite a few duplicate entries if the user
happens to fill out all the fields correctly.

But to get back to my original post, how would it sound if Cake
allowed for user defined JavaScript functions in the model definition.
For example "name" NOT_EMPTY but also "alert('Must not be empty') so
the server checks the field on submit (in case anyone was fiddling
around with the post data) but the javascript function gets pushed
through to the view.

Ok, that would be having view code in the model but on the other hand
this code is definitely related to the models data.

Thanks for your input

wirtsi



On 30 Nov., 16:07, James K <[EMAIL PROTECTED]> wrote:
> Strongly disagree.
>
> I'm in the middle of a massive CakePHP/ExtJS development and it works
> like a dream (To date: 40 controllers, 89 models). A lot of our
> controller actions simply return JSON. Cake is perfectly suited to
> this. Grab your data, do some set::extract manipulation on it if
> necessary, and use the object method of the javascript helper to send
> it to the client as JSON.
>
> Also you should ALWAYS validate your data on the server side. Client
> side validation is not reliable or secure. You can add it in as a
> slight convenience to the user, but your application should never ever
> rely on client side validation to do its job.
>
> The technique we're currently using is we load Cake's forms into ExtJS
> panels that proceed to digest the DOM elements (configure the form in
> Ext, set the contentEl properties of the different panels to the ids
> of the divs or fieldsets generated by cake) and then submit them via
> AJAX back to the server. When the panel comes back, it has Cake's
> validation messages next to the appropriate fields. This technique
> also allows us to leverage the added security of the Security
> component to ensure that no one's using Firebug or something similar
> to allow them to submit data they aren't supposed to (which is a major
> security risk a lot of developers in the honeymoon phase with AJAX
> overlook or ignore).
>
> We're also in the process of developing an ExtJS Form Helper that will
> translate Cake's built-in validation rules to client side equivalents
> to further tighten up the client-side experience.
>
> Another thing people commonly misunderstand about MVC - or at least
> take too literally - is the idea that each controller has to operate
> on a single model. I reject that notion entirely - we organize our
> controllers by logical functionality. For instance, we have a
> controller that deals entirely with account related operations. We
> don't have a table called accounts, and that controller operates on
> half a dozen models. This makes the URLs more logical for the end-user
> and it's much easier to maintain from a developer's standpoint, AND
> makes it easier to divide up work amongst a team of developers.
>
> Like Nate mentioned, this is not an MVC problem at all, just an
> integration problem.
>
> I hope to share a lot of the knowledge we've gained developing this
> application on the Bakery at some point.
>
> Good luck,
> James
>
> On Nov 30, 9:00 am, wirtsi <[EMAIL PROTECTED]> wrote:
>
> > Hey guys
>
> > I've been developing web applications with Cake for almost 2 years
> > and  I never want go back to the old vile php ways again.
>
> > I must say that with more advanced applications the MVC concept isn't
> > working so good any more. With any halfway decent webapp you will have
> > a lot of controller logic in the views, namely all those JavaScript
> > functions you use.
>
> > For example: Passing form field values to the server via ajax calls
> > for validation or opening modal windows over content items (ie context
> > menus etc)
>
> > If you take JavaScript even a step further then you'll end up with
> > frameworks like ExtJS ... you don't write a single line of HTML code
> > anymore, just the body. The framework then will insert all the lists,
> > menus or whatever you want onto the canvas and populate them with data
> > it gets from the server via json.
>
> > W

Re: Copied cake PHP files to a new Ubuntu Intrepid box and nothing is working

2008-11-30 Thread Nick

I've traced the issue to something with my

On Nov 30, 12:52 am, Nick <[EMAIL PROTECTED]> wrote:
> I'm desperate for some help here...  I just built a brand new ubuntu
> intrepid server and copied everything from my cake folders on my
> Ubuntu Hardy box to the new intrepid server.
>
> If I extract a fresh version of Cake, everything works fine, css shows
> up, db calls work correctly, etc., but everything is failing when I
> copy all my work over.
>
> I see no CSS formatting and I get the following error:
>
> Fatal error: Call to undefined function mysql_connect() in /home/phazo/
> Dropbox/www/lymtest3/cake/libs/model/datasources/dbo/dbo_mysql.php on
> line 117
>
> I've dumped my sql database and imported it on the new device
> triple checked the sql accounts
> made sure my tmp directory is writeable
> enabled MOD rewrites
> verified my .htaccess files exist
> set "AllowOverride all" for my directories in the apache2.conf file
>
> what else could I be missing?
> Thanks for any help anyone can provide!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How to validate and update password of a user with affecting HABTM relations for the user?

2008-11-30 Thread Milmar

I have the following code for my "reset user password" administrator
page:


create('User',array('action' => 'resetpassword'));?>
link('Back',array('action' => 'edit',$id)); ?>


input('id',array('value'=>$id));
echo $form->input('password',array('label'=>'New Password'));
echo $form->input('password_confirm',array
('type'=>'password','label'=>'Confirm Password'));
echo $form->submit('Submit');
echo $form->button('Reset',array('type' => 'reset'));
echo $form->end();
?>

link('Back',array('action' => 'edit',$id)); ?>



...then for the Users controller:

function resetpassword($id = null)
{
if (!$id && empty($this->data)) {
 $this->Session->setFlash('Invalid User', true);
}
else if (!empty($this->data)) {
$this->User->id = $this->data['User']['id'];
$this->set('id',$this->data['User']['id']);
$username = $this->User->read('username',$this->data['User']
['id']);
$this->set('username',$username);
if($this->User->save($this->data))
{
  $this->Session->setFlash('You have successfully reset the
password.');
}
else
{
 $this->Session->setFlash('Failed to reset password.
Please try again.');
}
}
   else if (empty($this->data)) {
$username = $this->User->read('username', $id);
$this->set('username',$username);
$this->set('id',$id);
}
}

As you can see in the Users controller, I need to call $this->User-
>save($this->data) so that I can send both 'password' and
'password_confirm' to the User model where the validation is
performed.

My validation rules in the User model is as follows:

var validate = array(
 'password' => array
(
array('rule'=>array
('passwordCompare','password_confirm'),'message'=>''),
array('rule'=>array('minLength',4),'message'=>'Password
must have at least 4 characters.'),
array('rule'=>array('notEmpty'),'message'=>'Password
cannot be empty.'),
 )
);

...where "passwordCompare" is defined to check if 'password' and
'password_confirm' are equal before saving the field in the DB.

My problem is that "Users" is also connected via an HABTM relation to
a "Roles" table, so, when I call $this->User->save($this->data) above,
my existing HABTM relations are getting deleted. I'm suspecting it's
because $this->data only contains data that was in my "reset" form
(password, and password_confirm), but cake requires that the HABTM
relations should be there too (maybe via hidden fields?).  My first
idea to fix this was to perform the validation in the controller then
just use the "saveField" function so that I'm sure that only the
password field is being modified.

Question: Is there a way where I can still implement validation in the
model without affecting the HABTM relations???
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: MVC falling to pieces for modern AJAX apps

2008-11-30 Thread James K

Strongly disagree.

I'm in the middle of a massive CakePHP/ExtJS development and it works
like a dream (To date: 40 controllers, 89 models). A lot of our
controller actions simply return JSON. Cake is perfectly suited to
this. Grab your data, do some set::extract manipulation on it if
necessary, and use the object method of the javascript helper to send
it to the client as JSON.

Also you should ALWAYS validate your data on the server side. Client
side validation is not reliable or secure. You can add it in as a
slight convenience to the user, but your application should never ever
rely on client side validation to do its job.

The technique we're currently using is we load Cake's forms into ExtJS
panels that proceed to digest the DOM elements (configure the form in
Ext, set the contentEl properties of the different panels to the ids
of the divs or fieldsets generated by cake) and then submit them via
AJAX back to the server. When the panel comes back, it has Cake's
validation messages next to the appropriate fields. This technique
also allows us to leverage the added security of the Security
component to ensure that no one's using Firebug or something similar
to allow them to submit data they aren't supposed to (which is a major
security risk a lot of developers in the honeymoon phase with AJAX
overlook or ignore).

We're also in the process of developing an ExtJS Form Helper that will
translate Cake's built-in validation rules to client side equivalents
to further tighten up the client-side experience.

Another thing people commonly misunderstand about MVC - or at least
take too literally - is the idea that each controller has to operate
on a single model. I reject that notion entirely - we organize our
controllers by logical functionality. For instance, we have a
controller that deals entirely with account related operations. We
don't have a table called accounts, and that controller operates on
half a dozen models. This makes the URLs more logical for the end-user
and it's much easier to maintain from a developer's standpoint, AND
makes it easier to divide up work amongst a team of developers.

Like Nate mentioned, this is not an MVC problem at all, just an
integration problem.

I hope to share a lot of the knowledge we've gained developing this
application on the Bakery at some point.

Good luck,
James

On Nov 30, 9:00 am, wirtsi <[EMAIL PROTECTED]> wrote:
> Hey guys
>
> I've been developing web applications with Cake for almost 2 years
> and  I never want go back to the old vile php ways again.
>
> I must say that with more advanced applications the MVC concept isn't
> working so good any more. With any halfway decent webapp you will have
> a lot of controller logic in the views, namely all those JavaScript
> functions you use.
>
> For example: Passing form field values to the server via ajax calls
> for validation or opening modal windows over content items (ie context
> menus etc)
>
> If you take JavaScript even a step further then you'll end up with
> frameworks like ExtJS ... you don't write a single line of HTML code
> anymore, just the body. The framework then will insert all the lists,
> menus or whatever you want onto the canvas and populate them with data
> it gets from the server via json.
>
> Working with Cake this gets really ugly .. because then you will end
> up with redundant code, data validation on the server side but also on
> the client.
>
> Yesterday I read an article on this issue (http://advogato.org/article/
> 993.html) ... it's a bit strong anti-PHP but it hits the spot. It goes
> on about combining a MVC framework (Web2Py) with a Python-to-
> Javascript compiler (Pyjamas) which in the end will result in coding
> in Python and having a framework do all the html work .. so like Ext
> but with a proper server-side backend.
>
> What also would solve the problem of code redundancy is a JS framework
> like TrimPath  (http://code.google.com/p/trimpath/wiki/TrimJunction)
> where you only code in JS and the same code gets executed on the
> server and the client ... BUT ... do we really want to code ours apps
> in JavaScript? I for sure don't want to.
>
> So I had this idea yesterday how to solve this problem at least
> partly .. by partly I mean at least all the data validation.
>
> Develop a doped up form helper. Said form helper gets the validation
> rules for every field from the model and implements the JavaScript
> rules automatically ... on the server side everything stays the same.
>
> For examle if field "name" has the NOT_EMPTY validation rule, the
> DopeFormHelper could add this validation to the view so even before
> submitting to the server the user gets notified of his mistake.
>
> What I'm not quite sure of is ... am I breaking all the MVC rules
> thinking like this? AFAIK the view (and therefore the Helper as well)
> should have no knowledge of any model rules or code. How do I get
> these informations in there?
>
> So what do the gurus think of this? Any ideas how to 

Re: MVC falling to pieces for modern AJAX apps

2008-11-30 Thread Nate

Maybe something kinda like this?

http://github.com/1Marc/cake-stuff/tree/master/live-validate

Not all the way there yet, but you get the idea.

Hint: it's an integration problem, not an MVC problem.

wirtsi wrote:
> Hey guys
>
> I've been developing web applications with Cake for almost 2 years
> and  I never want go back to the old vile php ways again.
>
> I must say that with more advanced applications the MVC concept isn't
> working so good any more. With any halfway decent webapp you will have
> a lot of controller logic in the views, namely all those JavaScript
> functions you use.
>
> For example: Passing form field values to the server via ajax calls
> for validation or opening modal windows over content items (ie context
> menus etc)
>
> If you take JavaScript even a step further then you'll end up with
> frameworks like ExtJS ... you don't write a single line of HTML code
> anymore, just the body. The framework then will insert all the lists,
> menus or whatever you want onto the canvas and populate them with data
> it gets from the server via json.
>
> Working with Cake this gets really ugly .. because then you will end
> up with redundant code, data validation on the server side but also on
> the client.
>
> Yesterday I read an article on this issue (http://advogato.org/article/
> 993.html) ... it's a bit strong anti-PHP but it hits the spot. It goes
> on about combining a MVC framework (Web2Py) with a Python-to-
> Javascript compiler (Pyjamas) which in the end will result in coding
> in Python and having a framework do all the html work .. so like Ext
> but with a proper server-side backend.
>
> What also would solve the problem of code redundancy is a JS framework
> like TrimPath  (http://code.google.com/p/trimpath/wiki/TrimJunction)
> where you only code in JS and the same code gets executed on the
> server and the client ... BUT ... do we really want to code ours apps
> in JavaScript? I for sure don't want to.
>
> So I had this idea yesterday how to solve this problem at least
> partly .. by partly I mean at least all the data validation.
>
> Develop a doped up form helper. Said form helper gets the validation
> rules for every field from the model and implements the JavaScript
> rules automatically ... on the server side everything stays the same.
>
> For examle if field "name" has the NOT_EMPTY validation rule, the
> DopeFormHelper could add this validation to the view so even before
> submitting to the server the user gets notified of his mistake.
>
> What I'm not quite sure of is ... am I breaking all the MVC rules
> thinking like this? AFAIK the view (and therefore the Helper as well)
> should have no knowledge of any model rules or code. How do I get
> these informations in there?
>
> So what do the gurus think of this? Any ideas how to keep all that JS
> code out of our views?
>
> Enjoy your weekends
>
> wirtsi
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



MVC falling to pieces for modern AJAX apps

2008-11-30 Thread wirtsi

Hey guys

I've been developing web applications with Cake for almost 2 years
and  I never want go back to the old vile php ways again.

I must say that with more advanced applications the MVC concept isn't
working so good any more. With any halfway decent webapp you will have
a lot of controller logic in the views, namely all those JavaScript
functions you use.

For example: Passing form field values to the server via ajax calls
for validation or opening modal windows over content items (ie context
menus etc)

If you take JavaScript even a step further then you'll end up with
frameworks like ExtJS ... you don't write a single line of HTML code
anymore, just the body. The framework then will insert all the lists,
menus or whatever you want onto the canvas and populate them with data
it gets from the server via json.

Working with Cake this gets really ugly .. because then you will end
up with redundant code, data validation on the server side but also on
the client.

Yesterday I read an article on this issue (http://advogato.org/article/
993.html) ... it's a bit strong anti-PHP but it hits the spot. It goes
on about combining a MVC framework (Web2Py) with a Python-to-
Javascript compiler (Pyjamas) which in the end will result in coding
in Python and having a framework do all the html work .. so like Ext
but with a proper server-side backend.

What also would solve the problem of code redundancy is a JS framework
like TrimPath  (http://code.google.com/p/trimpath/wiki/TrimJunction)
where you only code in JS and the same code gets executed on the
server and the client ... BUT ... do we really want to code ours apps
in JavaScript? I for sure don't want to.

So I had this idea yesterday how to solve this problem at least
partly .. by partly I mean at least all the data validation.

Develop a doped up form helper. Said form helper gets the validation
rules for every field from the model and implements the JavaScript
rules automatically ... on the server side everything stays the same.

For examle if field "name" has the NOT_EMPTY validation rule, the
DopeFormHelper could add this validation to the view so even before
submitting to the server the user gets notified of his mistake.

What I'm not quite sure of is ... am I breaking all the MVC rules
thinking like this? AFAIK the view (and therefore the Helper as well)
should have no knowledge of any model rules or code. How do I get
these informations in there?

So what do the gurus think of this? Any ideas how to keep all that JS
code out of our views?

Enjoy your weekends

wirtsi
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cake Bake Fatal error in Linux

2008-11-30 Thread nithinalex

Now I am getting a new error...

Warning: mysql_connect(): Can't connect to local MySQL server through
socket '/var/run/mysqld/mysqld.sock' (2) in /usr/share/php/cake1.2/
libs/model/datasources/dbo/dbo_mysql.php on line 100

I am getting confusedI installed php cli,Cake1.2 Scripts,php5-
mysql...( Working in Xampp environment in ubuntu )

I am getting the above error when i try to bake model,controllers &
views...only able to configure database.

Can anyone tell how to configure Cake Bake in Ubuntu under Xampp
Environment.




brian wrote:
> It appears that you do not have the PHP MySQL libs installed.
>
> *apt*-get install php-*mysql*
>
> On Sat, Nov 29, 2008 at 10:21 AM, nithinalex <[EMAIL PROTECTED]> wrote:
>
> >
> > Hello Friends
> >
> >   When i am using Cake Bake I am getting an error like this...
> >
> > Fatal error: Call to undefined function mysql_connect() in /usr/share/
> > php/cake1.2/libs/model/datasources/dbo/dbo_mysql.php on line 100
> >
> > I am using XAMPP, Cake 1.2 in Ubuntu.
> >
> >
> > >
> >
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



XML backend instead of Relational DB backend

2008-11-30 Thread Matthew

Hi,

I'm looking at the feasibility of CakePHP for a project i'm working
on. I've worked through the blog tutorial and it looks fine but
unfortunately in the production environment that i'm working i have to
use PHP 4.x.x and there is no database backend so I'm storing the data
in xml files.

So i'm wondering:

1. Does CakePHP support an XML backend out-of-the-box in the same way
that it supports relational DBs?
2. If it doesn't support it out of the box how much work is it to
modify it - Is it more hassle than it's worth (it's a quite small
project for which i would be using the CakePHP framework)
3. What would i have to look at extending?

>From looking at the DOCS/API it doesn't look to me like there's out-of-
the-box support for this but i might be missing something.

Thanks.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



total newbie - Config question

2008-11-30 Thread scott

Hello all,

Just started learning CakePHP and am excited at the possibilities, but
have hit my first snag.

This is my first post and have read the documentation, but cannot find
the solution to my problem.

I uploaded the full cake package to my server into the root directory
which is public_html. I'm using Hostgator which has php 5 and
mod_rewrite activated.

I can only get the home page to show up when I set ReWriteEngine  to
"off". If it is on, I get 404 not found.

Also, I don't know if this is a problem, but I don't have an active
domain pointed to it. So I access the root directory by
www.mainserverexample.com/~cake

Thanks in advance for your help,

Scott

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: RC3 Auth: Hash value still being generated for empty password textbox?

2008-11-30 Thread Milmar

Thanks. Looks like this would solve my problem.

On Nov 30, 4:46 pm, thatsgreat2345 <[EMAIL PROTECTED]> wrote:
> Check out teknoids auth blog, should be the second code box that shows
> you how to not hash passwords so that they 
> validatehttp://teknoid.wordpress.com/2008/10/08/demystifying-auth-features-in...
>
> On Nov 30, 12:29 am, Milmar <[EMAIL PROTECTED]> wrote:
>
> > I have an "Add User" form that submits a username and a password.
> > When I try to submit an empty username and password field then log it
> > in the "Users" controller (Auth component is used in
> > app_controller.php), the username value is returned as blank, but the
> > password value returns "ea03a66b50513f5710cb2507d7c91daecfefdab7" (may
> > be dependent on my security.salt):
>
> > [User] => Array
> >         (
> >             [username] =>
> >             [password] => ea03a66b50513f5710cb2507d7c91daecfefdab7
> >         )
>
> > I expect that no hash value would be generated since I left the
> > password field empty.
> > Also, would it be possible to validate the password length (without
> > using javascript) before Auth generates a hash value for it? Right now
> > I have a validation for "minimum length >=8", but that would always
> > return true since the hash value is always more than 8 characters
> > long.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP Revision 7896: HABTM Issue (deleting one relation deletes other relations)

2008-11-30 Thread Milmar

Thanks, this worked. It's already in the latest manual, but an added
warning in the baking script would also help.
There's a minor issue though, when clicking on "View" an unnecessary
field (RolesUser) is added to the table.

On Nov 30, 1:49 pm, LunarDraco <[EMAIL PROTECTED]> wrote:
> Your HABTM table is missing a primary key 'id' if you add one the
> problem will go away.
> I too responded to this problem previously and it was determined the
> primary key was the correct fix.
> I had stated we should at least ad a warring in the check code or the
> baking scripts to do a check on the HABTM table for the 'id' key.
>
> On Nov 28, 10:07 pm, Milmar <[EMAIL PROTECTED]> wrote:
>
> > I filed a ticket for this.
>
> > On Nov 29, 12:32 am, Marcus Silva <[EMAIL PROTECTED]> wrote:
>
> > > Had exactly the same problem :http://groups.google.com/group/cake-php/
> > > browse_thread/thread/64516dd7a1b63d0c/f350fa78c7cfc772?
> > > hl=en&lnk=gst&q=an+easy+way+to+add+roles#f350fa78c7cfc772
>
> > > nobody has replied to my post. Very sad
>
> > > It must be a bug for sure, I ended up writting my on function to add
> > > and delete the role of a user.
>
> > > Hopefully somebody will know what is going wrong.
>
> > > On Nov 28, 3:51 pm, Milmar <[EMAIL PROTECTED]> wrote:
>
> > > > This issue might be related to ticket #5579 which was fixed in
> > > > revision 7795. I was seeing the same issue as #5579 for the edit and
> > > > save functions but I verified that it is already fixed in revision
> > > > 7795 and later (I'm currently using revision 7896).
>
> > > > Now, my problem is with the delete function, and it's quite easy to
> > > > reproduce.
>
> > > > For example, you have three tables, namely, "roles", "users", and
> > > > "roles_users" (where "roles_users" is the join table).
>
> > > > After baking, the role model is defined as:
>
> > > >  > > > class Role extends AppModel {
>
> > > >         var $name = 'Role';
>
> > > >         //The Associations below have been created with all possible 
> > > > keys,
> > > > those that are not needed can be removed
> > > >         var $hasAndBelongsToMany = array(
> > > >                         'User' => array('className' => 'User',
> > > >                                                 'joinTable' => 
> > > > 'roles_users',
> > > >                                                 'foreignKey' => 
> > > > 'role_id',
> > > >                                                 'associationForeignKey' 
> > > > => 'user_id',
> > > >                                                 'unique' => true,
> > > >                                                 'conditions' => '',
> > > >                                                 'fields' => '',
> > > >                                                 'order' => '',
> > > >                                                 'limit' => '',
> > > >                                                 'offset' => '',
> > > >                                                 'finderQuery' => '',
> > > >                                                 'deleteQuery' => '',
> > > >                                                 'insertQuery' => ''
> > > >                         )
> > > >         );
>
> > > > }
>
> > > > ?>
>
> > > > ...and the user model is defined as:
>
> > > >  > > > class User extends AppModel {
>
> > > >         var $name = 'User';
>
> > > >         //The Associations below have been created with all possible 
> > > > keys,
> > > > those that are not needed can be removed
> > > >         var $hasAndBelongsToMany = array(
> > > >                         'Role' => array('className' => 'Role',
> > > >                                                 'joinTable' => 
> > > > 'roles_users',
> > > >                                                 'foreignKey' => 
> > > > 'user_id',
> > > >                                                 'associationForeignKey' 
> > > > => 'role_id',
> > > >                                                 'unique' => true,
> > > >                                                 'conditions' => '',
> > > >                                                 'fields' => '',
> > > >                                                 'order' => '',
> > > >                                                 'limit' => '',
> > > >                                                 'offset' => '',
> > > >                                                 'finderQuery' => '',
> > > >                                                 'deleteQuery' => '',
> > > >                                                 'insertQuery' => ''
> > > >                         )
> > > >         );
>
> > > > }
>
> > > > ?>
>
> > > > The role and user controllers just use a simple scaffold (although the
> > > > issue could still be reproduced even if you're not using a scaffold).
>
> > > > Supposing you have the following data and relations:
> > > > User - User A, User B
> > > > Role - Role A, Role B, Role C
>
> > > > Join table:
> > > > User A <-> Role A

Re: RC3 Auth: Hash value still being generated for empty password textbox?

2008-11-30 Thread thatsgreat2345

Check out teknoids auth blog, should be the second code box that shows
you how to not hash passwords so that they validate
http://teknoid.wordpress.com/2008/10/08/demystifying-auth-features-in-cakephp-12/

On Nov 30, 12:29 am, Milmar <[EMAIL PROTECTED]> wrote:
> I have an "Add User" form that submits a username and a password.
> When I try to submit an empty username and password field then log it
> in the "Users" controller (Auth component is used in
> app_controller.php), the username value is returned as blank, but the
> password value returns "ea03a66b50513f5710cb2507d7c91daecfefdab7" (may
> be dependent on my security.salt):
>
> [User] => Array
>         (
>             [username] =>
>             [password] => ea03a66b50513f5710cb2507d7c91daecfefdab7
>         )
>
> I expect that no hash value would be generated since I left the
> password field empty.
> Also, would it be possible to validate the password length (without
> using javascript) before Auth generates a hash value for it? Right now
> I have a validation for "minimum length >=8", but that would always
> return true since the hash value is always more than 8 characters
> long.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RC3 Auth: Hash value still being generated for empty password textbox?

2008-11-30 Thread Milmar

I have an "Add User" form that submits a username and a password.
When I try to submit an empty username and password field then log it
in the "Users" controller (Auth component is used in
app_controller.php), the username value is returned as blank, but the
password value returns "ea03a66b50513f5710cb2507d7c91daecfefdab7" (may
be dependent on my security.salt):

[User] => Array
(
[username] =>
[password] => ea03a66b50513f5710cb2507d7c91daecfefdab7
)

I expect that no hash value would be generated since I left the
password field empty.
Also, would it be possible to validate the password length (without
using javascript) before Auth generates a hash value for it? Right now
I have a validation for "minimum length >=8", but that would always
return true since the hash value is always more than 8 characters
long.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---