Re: how to remove label from username and password

2012-09-28 Thread bujanga
echo $this-Form-label('username', 'Create your own label using this
if you wish');
echo $this-Form-input('username', array( 'type' = 'text', 'label' =false));

On Fri, Sep 28, 2012 at 7:31 PM, Chris chris...@yahoo.com wrote:
 Hi guys,...
 how can I remove label from username and password from the Form,... to NOT
 show up from browser...

 Username Password*


 td style=width:180px;
 ?php echo $this-Form-input('username'); ?
 /td

 td style=width:180px;
 ?php echo $this-Form-input('password'); ?
 /td

 thanks

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

 ---
 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com.
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php?hl=en.



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

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Cakephp 2.x best practice when adding/editing content?

2012-08-03 Thread bujanga
Validation redundancy. When save is called, the data passed to it in
the first parameter is validated using CakePHP validation mechanism.
Read more on Models - Saving your data.

Also, the validation errors are already available to the view so no
need to set them. Try bake and see what it does to get a better feel
of the cake way.

Gary

On Fri, Aug 3, 2012 at 1:43 PM, MetZ met...@gmail.com wrote:
 Hi Mark..

 - Setting validation errors to view to display them in an element = You
 need to correct: Error message 1, Error message 2, Error message 3 = Need
 it ;)
 - __('some text', true) = For translation strings, not sure why I started
 to use the TRUE, but I think it is because of not beeing able to only have
 __('some text') inside the strings (Suggestion??)

 And for the validation Redundancy ? what exactly do you mean?
 I am validating in models = and pushing messages to the view (not using the
 error = true on my form fields, all are set to false and display the
 validation messages in element as explained before.

 And regarding baking.. Have never used it..  =) Any good tutorials on it? I
 need to use terminal right?

 I am developing on my development VPS server, not local, but have terminal
 access..

 Thanks for your time!
 -Tom


 kl. 20:05:19 UTC+2 fredag 3. august 2012 skrev euromark følgende:

 for starters, take out the validation redundancy
 why setting the errors to the view? also not necessary
 also, in 2.x your __() looks differently (arguments usually are not true
 but replacement strings)

 why dont you use baking? it would display a better output than you
 currently have



 Am Freitag, 3. August 2012 17:43:52 UTC+2 schrieb MetZ:

 Yes, I understand what you are doing :)
 Have a couple of those myself..

 But my question is (perhaps not clear enough), the best practice for a
 function like add and edit.

 I am thinking about:
 if ($this-request-is('post')) {
 $this-User-set($this-request-data);
 if ($this-User-validates()) {
 

 Those things inside the function. Like,, what approach/setup would you
 use on cake 2.x to talk with the db and make things happen :)

 I am just wondering if I am doing it 100% correct, as I can not find any
 good tutorials on it anywhere..

 Here is my add function as is today, any pointers?

 public function admin_add() {
 $this-set('title_for_layout', __('Add new role',true));
 if ($this-request-is('post')) {
 $this-Role-set($this-request-data);
 if ($this-Role-validates()) {
 if ($this-Role-save($this-request-data)) {
 $this-Session-setFlash(__('New role created.',true),
 'admin/flash/success');
 $this-redirect(array('action' = 'index'));
 } else {
 $this-Session-setFlash(__('Could not create role, please try
 again.',true), 'admin/flash/error');
 }
 } else {
 // Didn't validate
 }
 }
 $this-set('errors', $this-Role-validationErrors);
 }

 -Tom



 kl. 13:35:30 UTC+2 fredag 3. august 2012 skrev SoulRaven følgende:

 i use a single method, add/edit even if is user or admin, the difference
 between add/edit is that on edit you have the ID set, or in parameter or in
 $this-data

 admin_editpost($id = null){
if(is_null($id){
//something
}
 }

 i guess you understand

 vineri, 3 august 2012, 11:41:01 UTC+3, MetZ a scris:

 Hi all..

 I am in the process of migrate one of my apps fra 1.3 to cakephp 2.x
 and I am wondering, what are the best practices for the new framework?
 AND YES, I have read the documents/book :)

 I am just wondering how you do it, so I can compare my work and see if
 I am heading in the right direction with my app.

 So if anyone could give me an idea about a couple simple add/edit
 functions, and how the best practice for this, I would appreciate it :)

 like:

 admin_users_add() {
 }

 admin_users_edit() {
 }

 and other regular functions you might have an example for.

 Thanks all!
 Awesome!

 -Tom

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


 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at
 http://groups.google.com/group/cake-php

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: WordPress query_posts on a CakePHP page?

2012-03-02 Thread bujanga
You basically have to load the WordPress framework to use their wp
specific functions. See this link:
http://www.digimantra.com/tutorials/wordpress/display-wordpress-post-content-wordpress/

Personally, I don't think I would do it this way. Instead, maybe a
direct query to the database or use some of the wordpress RPC, or even
more generically, RSS.

Gary

-- 
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: java script detection at the time of site load

2012-01-18 Thread bujanga
https://www.google.com/search?q=javascript+version+check


On Wed, Jan 18, 2012 at 6:52 AM, vaibhav pathak
promatics.vaib...@gmail.com wrote:
 Please any one can tell me how i can detect that java script of
 browser is on or not in cake cake php?

 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

-- 
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: Using Configure or other methods to set app-wide constants

2012-01-02 Thread bujanga
This is really not a configuration item, though you can set it using
Configure::write(). Of course, $_SERVER['REMOTE_ADDR'] must be
provided by your web server.
http://php.net/manual/en/reserved.variables.server.php
If you are trying to create a user setting, a session cookie would be
much more appropriate. Alternatively,  I often log the user's IP
address to the DB upon login.

Gary



On Mon, Jan 2, 2012 at 3:48 PM, geste jim.ho...@gmail.com wrote:
 All,

 I am looking for the easiest, most global way to set a couple of app-
 wide constants, more or less, that would derive from Apache variables,
 specifically $_SERVER['REMOTE_USER'] and $_SERVER['REMOTE_ADDR'] and
 that would be used throughout the app both in models and controllers.

 A Configure:write method in app_controller.php seemed like it might be
 the place to set like so:

  Configure::write('User.Address',$_SERVER['REMOTE_ADDR']);

 but it looks like that method only wants text strings for the write
 method and anyhow it did not work whether I tried it at top of
 app_controller.php or in a beforeFilter function in
 app_controller.php.

 I also tried more generic means such as using PHP getenv like so:

  $ipaddr = getenv('REMOTE_ADDR');

 and that partly works, but I am not seeing a way to make it glovally
 available. Using the form

  var  $ipaddr = getenv('REMOTE_ADDR');

 at top of app_controller.php just does not work, but I am guessing I
 am misusing that var construct.

 Any thoughts welcome!

 J



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


 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Validation rules - what a nightmare...

2011-12-04 Thread bujanga
Your password input is auto-hashed and therefore will never match your
rule ('between', 6,15). And yes, I realize that is almost the example
given in the book. (http://book.cakephp.org/view/1154/between)

On passwords: http://book.cakephp.org/view/1263/password

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

2011-11-11 Thread bujanga
http://simmonstrialpractice.com/fair-use-of-trademark-in-domain-name-ninth-circuit/

Seems like nominative use to me. Though I do agree that the Cake
Foundation should protect its rights.



On Fri, Nov 11, 2011 at 4:18 AM, phpMagpie p...@webbedit.co.uk wrote:
 Is this your domain?

 On Nov 9, 7:20 pm, Sandy sandy.wilkins...@gmail.com wrote:
 I thoroughly researched this beforehand and this falls under fair
 use for trademarks as it is used nominatively and does not cause
 confusion. If not, alot of similar websites would also have to be
 shutdown (Google photoshop tutorials, excel tutorials or similar
 to see a great list of websites that use trademarks legally in the
 same fashion).

 In my opinion its better for a CakePHP programmer to use it and not
 some domain squatter, which is why I'm including it here.

 On Nov 8, 7:00 am, euromark dereurom...@googlemail.com wrote:







  indeed, pretty cocky :)

  nothing against making some profit using software made with cake.
  but this is not a place to put advertising and THEN profit from it.
  pretty soon everybody puts some ads in here. and it ain't gonna be no
  help forum anymore..

  On 8 Nov., 05:52, Larry E. Masters php...@gmail.com wrote:

   I like how people use a registered trademark (http://tinyurl.com/cjgr6yf)
   and then try to profit from it. Should I send you a letter now or do you
   prefer to remove it yourself?

   --
   Larry E. Masters

   On Mon, Nov 7, 2011 at 10:46 PM, Sandy Wilkins
   sandy.wilkins...@gmail.comwrote:

Hey in case anyone is interested, this domain is for sale (or auction,
not sure) at $200:www.cakephptutorials.com

Go more info here:
   https://auctions.godaddy.com/trpItemListing.aspx?ci=44661miid=59169857

--
Our newest site for the community: CakePHP Video Tutorials
   http://tv.cakephp.org
Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
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
athttp://groups.google.com/group/cake-php

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


 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php


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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Subscriptions

2011-11-02 Thread bujanga
I have not tried implementing recurring payments using PayPal but have
done it with other systems. Anyway, that is your search term:

http://www.google.com/search?q=paypal+recurring+payments

-- 
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: GPG/PGP Signed with Email Component

2011-07-22 Thread bujanga
The email component is extensible. See this example:
http://bakery.cakephp.org/articles/dankroad/2011/01/30/integrate_amazon_simple_email_service_ses_into_existing_application

While it's purpose is different than yours it should give some ideas.



On Fri, Jul 22, 2011 at 8:44 AM, Christophe Vandeplas
christo...@vandeplas.com wrote:
 Hello bujanga,

 That's indeed what I am doing now, but it is a violation of the MVC principle.
 So I'd like to do it the clean way, but I need a little help to get started.

 Of course I'll publish any final code if it becomes a plugin/component ...


 On Mon, Jul 18, 2011 at 10:21 PM, bujanga buja...@gmail.com wrote:
 I do something very similar. Though I send plain text email only. I
 create my data as fully formatted, sign/encrypt it and then send it to
 a template that just outputs the field.

 On Mon, Jul 18, 2011 at 12:16 PM, Christophe Vandeplas
 christo...@vandeplas.com wrote:
 Hello,


 My webapplication needs to send out emails that are signed with a GPG
 signature.
 However as I am using the Email component this seems a little more
 complicated as I can't really figure out how to do it. Any help will
 be appreciated and compensated with Belgian beer if we ever meet.

 Signing data using GnuPG (and the PEAR GPG classes) is relatively
 easy:
        require_once 'Crypt/GPG.php';
        $gpg = new Crypt_GPG();
        $text = Hello world;
        $gpg-addSignKey(Configure::read('GnuPG.email'),
 Configure::read('GnuPG.password'));
        $text_signed = $gpg-sign($text, Crypt_GPG::SIGN_MODE_CLEAR);
        debug($text_signed);

 The code I use to send out the email is here. The new_event view
 will be used to format my email message with the data from $event.

        $this-Email-from = foo f...@bar.com;
        $this-Email-to = bar b...@foo.com;
        $this-Email-subject = [foo] new event;
        $this-Email-delivery = 'debug';   // do not really send out
 mails, only display it on the screen
        $this-Email-template = 'new_event'; // in views/elements/
 email/html or text
        $this-Email-sendAs = 'text';        // both text or html
        $this-set('event', $event);
        $this-Email-send();

 Now the GPG magic needs to happen on the email body/message.
 I've opened the EmailComponent class to find out that the -send()
 function _renders() the mail using the view and finally sends it using
 the delivery method (mail, smtp,...).

 However I can't find a way to extract the rendered body, sign it, push
 it back and then let it be sent.

 I guess I will probably need to make a new component class to handle
 this. However I have absolutely no idea where or how to start.
 Considering the few lines required to do the gpg signing it shouldn't
 be to difficult though...

 Could you give me some advice to get this going?

 Thanks
 Christophe

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


 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php


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


 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php


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


 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php


-- 
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: GPG/PGP Signed with Email Component

2011-07-18 Thread bujanga
I do something very similar. Though I send plain text email only. I
create my data as fully formatted, sign/encrypt it and then send it to
a template that just outputs the field.

On Mon, Jul 18, 2011 at 12:16 PM, Christophe Vandeplas
christo...@vandeplas.com wrote:
 Hello,


 My webapplication needs to send out emails that are signed with a GPG
 signature.
 However as I am using the Email component this seems a little more
 complicated as I can't really figure out how to do it. Any help will
 be appreciated and compensated with Belgian beer if we ever meet.

 Signing data using GnuPG (and the PEAR GPG classes) is relatively
 easy:
        require_once 'Crypt/GPG.php';
        $gpg = new Crypt_GPG();
        $text = Hello world;
        $gpg-addSignKey(Configure::read('GnuPG.email'),
 Configure::read('GnuPG.password'));
        $text_signed = $gpg-sign($text, Crypt_GPG::SIGN_MODE_CLEAR);
        debug($text_signed);

 The code I use to send out the email is here. The new_event view
 will be used to format my email message with the data from $event.

        $this-Email-from = foo f...@bar.com;
        $this-Email-to = bar b...@foo.com;
        $this-Email-subject = [foo] new event;
        $this-Email-delivery = 'debug';   // do not really send out
 mails, only display it on the screen
        $this-Email-template = 'new_event'; // in views/elements/
 email/html or text
        $this-Email-sendAs = 'text';        // both text or html
        $this-set('event', $event);
        $this-Email-send();

 Now the GPG magic needs to happen on the email body/message.
 I've opened the EmailComponent class to find out that the -send()
 function _renders() the mail using the view and finally sends it using
 the delivery method (mail, smtp,...).

 However I can't find a way to extract the rendered body, sign it, push
 it back and then let it be sent.

 I guess I will probably need to make a new component class to handle
 this. However I have absolutely no idea where or how to start.
 Considering the few lines required to do the gpg signing it shouldn't
 be to difficult though...

 Could you give me some advice to get this going?

 Thanks
 Christophe

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


 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php


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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Where should i contact right people in CakePHP.org because this security critical problem

2011-06-22 Thread bujanga
This should be fixed in core. A developer who actually needed the
password would be able to get it easily enough. We developers are
often rushed and do occasionally make stupid mistakes but a simple
mistake should not reveal passwords. Great and effective effort has
been put into the code to make it easy to deploy a secure application.
The same care and effort should insure that simple mistakes by a
developer do not break the secure application.

Gary

-- 
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: Generate Excel from cakephp

2011-05-12 Thread bujanga
You can also just render to a view and layout. Works great for basic
xls output. See here:
http://www.dnamique.com/cakephp-export-data-to-excel-the-easy-way/

-- 
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: Wildcard DNS | Domain | Subdomain

2011-03-30 Thread bujanga
Do what Ryan suggested for getting your apache set up correctly.

Get rid of that .htaccess file and cake until you know apache can
serve a simple index.htm.

Now about the .htaccess file, is this line really in it?
RewriteCond %{HTTP_HOST} ^([^.]+)\.?domain\.com [NC]

On Wed, Mar 30, 2011 at 2:05 AM, swimwithabhra meet.ab...@gmail.com wrote:
  3. Upload .htaccess with necessary modifications.

 Why would you want to modify .htaccess? This step is not
 needed for CakePHP to work on multiple subdomains.

 Hello Daniel,
 What I am trying to do is to access virtual sub domains [non existing
 sub domains] for each individual user of my website. This means that
 one can access my website by daniel.domain.com and xyz.domain.com and
 abc.domain.com and ... I read the following article where I found
 out configuring .htaccess -:
 http://www.mail-archive.com/cake-php@googlegroups.com/msg03990.html

 Can you please let me know what steps would be enough to achieve the
 above.

 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


-- 
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: Custom Function Password Match Always Triggered

2010-12-21 Thread bujanga
On Tue, Dec 21, 2010 at 2:57 PM, Ryan Schmidt
google-2...@ryandesign.com wrote:
 I should add that Security::hash() does not use the salt unless you tell it 
 to, by passing true in the third parameter. The Auth component does pass true 
 in the third parameter, so if you want to write code today that will store 
 passwords in the database that will be compatible with the Auth component 
 when you switch to it later, you should hash with:

 Security::hash($this-data['User']['password'], null, true)



Definitely follow Ryan's clue here else you will have more work later.
I think you might find just going straight to Auth will save you a lot
of extra work but if you insist...

Why don't you just verify the passwords match before you hash it?

As a bonus here is my complexity validation on password

'password'  = array(
'create'= array(
'rule' = array('g_isComplex'),
'required'  = TRUE,
'allowEmpty'= FALSE,
'on' = 'create',
'message' = 'Password must have at least 6 characters and must
contain at least 1 upper case letter, 1 lower case letter and 1
number'
),
'update'= array(
'rule' = array('g_isComplex'),
'required'  = FALSE,
'allowEmpty'= TRUE,
'on' = 'update',
'message' = 'Password must have at least 6 characters and must
contain at least 1 upper case letter, 1 lower case letter and 1
number'
),
),

function g_isComplex($check){
if ( !isset($this-data['User']['verify']) )return FALSE;
if ( $this-passwordComplex($this-data['User']['verify']) )return 
TRUE;
return FALSE;
}

function passwordComplex($password=null){
if ( $this-enforceComplex ){
if 
(preg_match('/\A(?=[-_a-zA-Z0-9]*?[A-Z])(?=[-_a-zA-Z0-9]*?[a-z])(?=[-_a-zA-Z0-9]*?[0-9])\S{6,}\z/',
$password)){
return TRUE;
}else{
return FALSE;
}
}else{
if ( preg_match('/^[a-zA-Z0-9_]{3,40}$/i', $password) ){
return TRUE;
}else{
return FALSE;
}
}
}


Where  $this-enforceComplex is a configuration setting and
this-data['User']['verify'] is the plaintext verifying password.
Sorry not really a pro on regex, so I'm sure it could be more concise.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Validation based on another field

2010-12-02 Thread bujanga
For this case, I would do as cricket suggested but what you ask is
possible. Take a look at
http://book.cakephp.org/view/1181/Adding-your-own-Validation-Methods.
Note that The full record being validated is stored in $this-data
member variable.

Gary

On Thu, Dec 2, 2010 at 2:05 PM, Dave Maharaj m...@davemaharaj.com wrote:
 I have a problem I cant seem to get.



 User has Location information (city, state, country) with the option to
 select “Hide my location”.



 So if hide location is selected ( $data[‘private’] = true ) then there is
 no need to enter City, State Country) I hide those fields with jquery on
 selecting the checkbox.



 But if not selected then they must be filled out.



 So how can I force / remove validation for those fields based on what the
 user has selected?



 Thanks,



 Dave

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

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


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Cronjob like in cakephp

2010-07-10 Thread bujanga
Yes, you use the console. http://book.cakephp.org/view/1106/The-CakePHP-Console

Basically create your shells and tasks and then run your shell from cron.



On Sat, Jul 10, 2010 at 6:33 AM, Dilip Godhani dilip.godh...@gmail.com wrote:
 Hello Fridend
 I want to create one job using cake php how i developed that using
 cakesupport any that type of future ...
 Thanks
 Dilip Godhani
 Software Developer,
 Entourage Solutions
 e-mail: di...@entouragesolutions.com
            dilip.godh...@gmail.com
 Web.: www.entouragesolutions.com
 m. 9913822582

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

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


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Sending Email from Shell

2010-05-21 Thread bujanga
This is the code I use:

//  IMPORT AND INITIALIZE EMAIL COMPONENT
App::import('Core', 'Controller');
App::import('Component', 'Email');
$this-Controller = new Controller();
$this-Email = new EmailComponent(null);
$this-Email-initialize($this-Controller);

A few minor differences from yours. Maybe give it a try.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: off-Cake: generating unique ident-codes?

2010-03-08 Thread bujanga
I use UUIDs in place of Integers for many of my table IDs. Don't think
that is what Micheal is after though.

What I occasionally use is a 2 character identifier combined with an
incrementing hex number. That would result in something like TI-05A2,
then TI-05A3, etc.

Gary


On Mon, Mar 8, 2010 at 8:36 AM, mivogt-LU c...@mivogt.net wrote:
 Hi there,

 going on with my project I am looking for a way to generate unique
 ident-codes for some entries.
 I.e. if a customer adds a request to the system I have the internal
 index model_id for internal use.
 To have a better look and feel for customers and staff I would like to
 have something more human like a combination of numbers and letters
 (not only the id or a timestamp).

 Any idea how to do this?
 Sure I might use php and some random functions to generate letters and
 numbers as I need.
 My problems is to have em unique - can I use the unique function for
 validating the field in databese or the model vaidation or will I have
 to program a lookup for the database to ensure a generated code is not
 already in use.

 Thanks at all.

 Michael

 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.

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


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Email doesn't work

2010-02-12 Thread bujanga
Are you able to send email using the PHP mail function? See
http://us3.php.net/manual/en/function.mail.php

Gary

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: validation of serialized data

2010-02-09 Thread bujanga
Thanks, I will not use serialized data for this. All of my current
contact models use the BelongsTo - HasMany approach and this project
will also. I had just finished coding a metadata interactor and used
serialized data with great success but I see it does not fit for this
type of relationship. The current project is a conversion where the
previous db has 4 fields for emails and 4 fields for phones. Guess
I'll finally have to write my record status behavior.

Gary

2010/2/9 Dérico Filho uldericofi...@gmail.com:
 Unless you really know what you are doing, you should avoid storing
 canonical data in serialized strings.

 Though it has been done with very great results off the cakephp world.

 See how it is done at FriendFeeder:
 http://bret.appspot.com/entry/how-friendfeed-uses-mysql

 Serialized data used as a denormalized data store.

 On Feb 8, 6:12 pm, bujanga buja...@gmail.com wrote:
 Just some thinking and a question or two, please tell me if I am
 totally off base.

 I would like to store multiple email addresses and phone numbers per
 user. Using a serialized field might work for this. Is that a good
 usage?

 Next, how does one validate the data and properly save and find the
 data. Here is what I am thinking (not tested).

 Validate the Model using a custom validation function:

 var $validate = array(
         'emails'        = array(
                 'is_email'      = array(
                         'rule' = array('g_isEmail'),
                         'required'              = TRUE,
                         'allowEmpty'    = FALSE,
                         'message' = 'You must enter at least 1 valid email 
 address'
                 ),
         ),
 )

 function g_isEmail($check){
         if ( !isset($this-data['Model']['emails']) ){
                 return FALSE;
         }
         if ( is_array($this-data['Model']['emails']) ){
                 foreach( $this-data['Model']['emails'] as $email ){
                         if ( !Validate::email($email) )
                                 return FALSE;
                         }
                 }
         }elseif( !Validate::email($this-data['Model']['emails']) )
                 return FALSE;
         }
         return TRUE;

 }

 Then using beforeSave to serialize the field and afterFind to
 unserialize the field.

 Thanks,

 Gary Dalton

 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.

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


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


validation of serialized data

2010-02-08 Thread bujanga
Just some thinking and a question or two, please tell me if I am
totally off base.

I would like to store multiple email addresses and phone numbers per
user. Using a serialized field might work for this. Is that a good
usage?

Next, how does one validate the data and properly save and find the
data. Here is what I am thinking (not tested).

Validate the Model using a custom validation function:

var $validate = array(
'emails'= array(
'is_email'  = array(
'rule' = array('g_isEmail'),
'required'  = TRUE,
'allowEmpty'= FALSE,
'message' = 'You must enter at least 1 valid email 
address'
),
),
)

function g_isEmail($check){
if ( !isset($this-data['Model']['emails']) ){
return FALSE;
}
if ( is_array($this-data['Model']['emails']) ){
foreach( $this-data['Model']['emails'] as $email ){
if ( !Validate::email($email) )
return FALSE;
}
}
}elseif( !Validate::email($this-data['Model']['emails']) )
return FALSE;
}
return TRUE;
}

Then using beforeSave to serialize the field and afterFind to
unserialize the field.

Thanks,

Gary Dalton

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: calling a component in a model

2010-01-28 Thread bujanga
I have found 2 MVC use cases for this approach. One is to send email
from a model and the other is to send email from a shell task. Here is
how I go about it:

//  IMPORT AND INITIALIZE EMAIL COMPONENT
App::import('Core', 'Controller');
App::import('Component', 'Email');
$this-Controller = new Controller();
$this-Email = new EmailComponent(null);
$this-Email-initialize($this-Controller);

$data = $this-Model-find();
$this-Controller-set('data', $data);



On Thu, Jan 28, 2010 at 8:33 AM, euromark dereurom...@googlemail.com wrote:
 you cant automatically use them

 manual inclusion:

 App::import('Component', 'My');
 $this-My = new MyComponent();
 ...

 On 28 Jan., 11:54, Florian florian.end...@me.com wrote:
 Hi @ all,

 my Problem is that i can not call a component from a model.

 Source - Model:

 class Approval extends AppModel{
       $components = array('CheckKont');

 .
 .
 .
 .

       function beforeSave(){
              $this-CheckKont-execute ();
       }

 }

 Source - Component :

 class CheckKont extends Object(){
      execute(){
           return true;
      }

 }

 Over the Controller i can call the component, also included with
 $components = array()

 Has anybody a hint how do call the component in a model?

 Thanks
 Florian

 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.

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


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Running the action twice?

2009-12-11 Thread bujanga
I will dig into this error today, busy yesterday. I intend to monitor
the server logs and build the actions up until I see the reload
behavior.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Running the action twice?

2009-12-11 Thread bujanga
This is a bit of a flaky one. Think it is mainly a problem with the
third-party application I am working with. I worked around it the
other day.

I have, however; seen a few duplicate HTTP requests from some very
simple actions and views. These are NOT generated by any by a
requestAction. My beforeFilter does have some Session calls and a
ClassRegistry::init, along with settings for the Security and Auth
components. If I figure things out better than this, I will update
this thread.

Thanks.

Gary

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Running the action twice?

2009-12-10 Thread bujanga
There was a requestAction called from my layout BUT I disabled it
during troubleshooting. In fact, All links to js, css, and images are
stripped from my layout and views. I have no beforeRender or
afterFilter.

View still reloads. Odd thing is, it goes twice when called via a
redirect from another action but not when it is refreshed by F5.

 Getting frustrated. Will check to see if other views are going twice.

Gary

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Running the action twice?

2009-12-09 Thread bujanga
I have looked over this code many times and really just don't know why
this is happening. It seems that cake is performing the action twice.
How do I know this? I am receiving 2 of each email. If I put an exit
statement before the end of the action, I only receive 1 of each
email.

As a background, I am using Security-requireSecure() in my
beforeFilter along with the blackHoleCallback = 'forceSSL'  callback
shown in the book. http://book.cakephp.org/view/268/Usage

Here is my action:
--
function pmt_receipt($tid=NULL, $pid=NULL, $cid=NULL){
if ( isset($this-params['named']['tid']) ){
$tid = $this-params['named']['tid'];
$pid = $this-params['named']['pid'];
$cid = $this-params['named']['cid'];
}
if ( is_null($tid) || is_null($pid) || is_null($cid) )
$this-redirect(array('action'='pmt_error', 0008));

$purchase_formatted = $this-PurchaseModel-ggis_format_purchase($pid);
$purchase_formatted .= 
$this-CcPaymentechChpp-ggis_format_payment($cid);
//  NOTIFY BY EMAIL
$this-Transaction-emailnotify($tid);
//  SUBSCRIBE TO EMAIL LIST
$this-Transaction-newslettersubscribe($tid);
//  REMOVE DATA FROM THE SESSION
$this-Session-delete('purchase');

$purchase_msg = 'h4Your credit card has been successfully
processed. Please print a copy of this page as your receipt./h4';
$purchase_msg .= 'pShortly you will receive an email, reiterating
the information on this page./p';
$this-CreditCard = ClassRegistry::init('CreditCard');
$this-set('formOptions', $this-CreditCard-get_formOptions());
$this-set('purchase_msg', $purchase_msg);
$this-set('purchase_formatted', $purchase_formatted);
}
--

The emailnotify and newslettersubscribe methods have been working
without issue for other controllers for quite some time.

Any help would be greatly appreciated. Thank you.

Gary Dalton

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: PHPShop v2 is a cake app!

2008-10-29 Thread bujanga

I have seen this problem a few time. It is not specifically related to
Firefox as I have seen it in IE as well. Pretty sure that your browser
is doing an improper font substituion for the PHPshop Lucinda
font-family. Probably the Helvetica font in Windows.

Don't recall exactly how I resolve on the client side but in my CSS I
would include arial in the font-family.

On Wed, Oct 29, 2008 at 8:41 AM, BrendonKoz [EMAIL PROTECTED] wrote:

 Mathew, your font blockiness appears to be a resolution dependent
 issue.  If you're not using your monitor's native maximum resolution,
 try setting it to that and see if the problem persists.  If it does
 not, there's probably little that Pablo could do; if it does, I'm not
 entirely sure...  :P

 On Oct 22, 8:51 am, Mathew [EMAIL PROTECTED] wrote:
 Hi Pablo,

 http://fxwars.mathew3d.com/images/webpage.jpg

 That's how the page renders for me. You can see the smaller text on
 the side menu, and footers is hard to read. The rest is kind of
 blocky.

 I'm using Firefox 3.0.3 on Windows XP.

 When I render the page using IE 7.0, and Safari 3.1.2 it looks fine.
 Maybe the font your using doesn't come with Firefox.
 --~--~-~--~~~---~--~~

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



Security component - sometimes works

2008-07-07 Thread bujanga

I use the Security component in a few controllers. I have had no
problems with any of these but one of my clients is not able to get a
particular controller to work. The same snippet is used in 4
controllers and the client has problems with only the
VolunteerInterest controller.

Here is my snippet:

var $components = array('Security', 'Recaptcha');

function beforeFilter() {
$this-Security-requirePost('add');
$this-Security-requireAuth('add');

$this-set('opt_programs', $this-opt_programs);
$this-set('opt_counties', $this-opt_counties);
}

For the VolunteerInterest component, if I set either requirePost or
requireAuth it works. If I set both, it fails. The client uses IE6 if
that matters. I have not been able to duplicate the problem on my
version of IE6 though.

I appreciate any ideas.

Gary

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



redirect( URL + target) ?

2008-07-07 Thread bujanga

Working on an old PHP site and found a few forms that need immediate
replacement. So, I thought I would use some cake forms and insert them
with an iframe. This works fine and the forms function properly but I
was wondering it the following were possible.

Once the form is successfully submitted can cake automatically
redirect the _top frame?

Something along the lines of:
$this-redirect('http://www.example.org target=_top', null, true);

I know that $url can be a simple URL like http://www.example.org or a
route URL like array('action'='index'). But I was not able to figure
a way to include a target.

Any ideas?

Gary

--~--~-~--~~~---~--~~
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: redirect( URL + target) ?

2008-07-07 Thread bujanga

Sorry, bad question. Frame targeting is client side. Will do with some
javascript.

Gary


On Mon, Jul 7, 2008 at 9:55 AM, bujanga [EMAIL PROTECTED] wrote:
 Working on an old PHP site and found a few forms that need immediate
 replacement. So, I thought I would use some cake forms and insert them
 with an iframe. This works fine and the forms function properly but I
 was wondering it the following were possible.

 Once the form is successfully submitted can cake automatically
 redirect the _top frame?

 Something along the lines of:
 $this-redirect('http://www.example.org target=_top', null, true);

 I know that $url can be a simple URL like http://www.example.org or a
 route URL like array('action'='index'). But I was not able to figure
 a way to include a target.

 Any ideas?

 Gary


--~--~-~--~~~---~--~~
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: email component utf-8 body

2008-06-29 Thread bujanga

Yes, that is where I started. I then set it using charset in:
 function _ggisSendMail(){
   $this-Email-charset = 'iso-8859-15';
   $this-Email-to = '[EMAIL PROTECTED]';
   $this-Email-subject = 'Test';
   $this-Email-from = '[EMAIL PROTECTED]';
   $this-Email-layout = 'default';
   $this-Email-template = 'test';
   $this-Email-sendAs = 'text';
   $this-Email-send();
}

Why? When it is not set, I was getting a subject of
=?UTF-8?B?V2VsY29tZ... with no body at all. Searching led me to:
  http://marcgrabanski.com/article/cakephp-email-encoding

I will try again with the nightly build on a different server.
Follow-up post with results shortly.

Gary



On Sat, Jun 28, 2008 at 6:59 AM, b logica [EMAIL PROTECTED] wrote:

 Well, did you at least try removing the 8859 one?

 On Fri, Jun 27, 2008 at 3:11 PM, bujanga [EMAIL PROTECTED] wrote:

 Yes, I saw that but do not know why. Instead of using the Email
 Component, I went back to sending the email via straight php. A little
 ugly but it gives me no problems. Headers from that show:

 Content-Type: text/plain; charset=UTF-8

 I will likely dig into this once I find time and am running on sweet RC2. 
 Yeah!

 Gary



 On Thu, Jun 26, 2008 at 10:55 AM, b logica [EMAIL PROTECTED] wrote:

 You have a 2nd Content-type header. One is 8859 and the other is UTF-8.


 


 


--~--~-~--~~~---~--~~
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: email component utf-8 body

2008-06-29 Thread bujanga

Email Component works fine on my production server with latest cake
build. hmm. That's all for tonight though.

Gary



On Sun, Jun 29, 2008 at 11:03 PM, bujanga [EMAIL PROTECTED] wrote:
 Yes, that is where I started. I then set it using charset in:
  function _ggisSendMail(){
   $this-Email-charset = 'iso-8859-15';
   $this-Email-to = '[EMAIL PROTECTED]';
   $this-Email-subject = 'Test';
   $this-Email-from = '[EMAIL PROTECTED]';
   $this-Email-layout = 'default';
   $this-Email-template = 'test';
   $this-Email-sendAs = 'text';
   $this-Email-send();
 }

 Why? When it is not set, I was getting a subject of
 =?UTF-8?B?V2VsY29tZ... with no body at all. Searching led me to:
  http://marcgrabanski.com/article/cakephp-email-encoding

 I will try again with the nightly build on a different server.
 Follow-up post with results shortly.

 Gary



 On Sat, Jun 28, 2008 at 6:59 AM, b logica [EMAIL PROTECTED] wrote:

 Well, did you at least try removing the 8859 one?

 On Fri, Jun 27, 2008 at 3:11 PM, bujanga [EMAIL PROTECTED] wrote:

 Yes, I saw that but do not know why. Instead of using the Email
 Component, I went back to sending the email via straight php. A little
 ugly but it gives me no problems. Headers from that show:

 Content-Type: text/plain; charset=UTF-8

 I will likely dig into this once I find time and am running on sweet RC2. 
 Yeah!

 Gary



 On Thu, Jun 26, 2008 at 10:55 AM, b logica [EMAIL PROTECTED] wrote:

 You have a 2nd Content-type header. One is 8859 and the other is UTF-8.


 


 



--~--~-~--~~~---~--~~
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: exclude default layout from login view

2008-06-27 Thread bujanga

In addition to what Jonathon states. Place your layout.ctp file into
you app/views/layouts directory.

Gary

On Thu, Jun 26, 2008 at 6:39 AM, RJ [EMAIL PROTECTED] wrote:

 Hi,
 How should i explicitly exclude the default layout from my login page.
 For the other views , i need the default layout

 


--~--~-~--~~~---~--~~
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: email component utf-8 body

2008-06-27 Thread bujanga

Yes, I saw that but do not know why. Instead of using the Email
Component, I went back to sending the email via straight php. A little
ugly but it gives me no problems. Headers from that show:

Content-Type: text/plain; charset=UTF-8

I will likely dig into this once I find time and am running on sweet RC2. Yeah!

Gary



On Thu, Jun 26, 2008 at 10:55 AM, b logica [EMAIL PROTECTED] wrote:

 You have a 2nd Content-type header. One is 8859 and the other is UTF-8.


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



email component utf-8 body

2008-06-20 Thread bujanga

I am finally trying to convert some older code over to the latest
build of cake and thought I would use the Email Component. Read
cookbook examples and did some searching as well. Still running into a
problem.

1. Email is sent and received.
2. Subject is fine
3. PROBLEM - body is garbage

Pretty certain it has to do with charset but I am not getting it right.

 function _ggisSendMail(){
$this-Email-charset = 'iso-8859-15';
$this-Email-to = '[EMAIL PROTECTED]';
$this-Email-subject = 'Test';
$this-Email-from = '[EMAIL PROTECTED]';
$this-Email-layout = 'default';
$this-Email-template = 'test';
$this-Email-sendAs = 'text';
$this-Email-send();
}

Before adding $this-Email-charset = 'iso-8859-15'; I was getting a subject of:
=?UTF-8?B?VGVzdA==?=

Now subject is OK but body is still garbage. My test.ctp is simply:
The test email was successfully sent.

I am using the nightly build (which solved some other problems) and
here are my relevant email headers:
X-Mailer: CakePHP Email Component
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: BASE64

Thanks for any clues,

Gary

--~--~-~--~~~---~--~~
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: Email Validation: Test Case Fails

2008-06-20 Thread bujanga

I won't presume to answer why but...

If you change-
'rule' = array('email', true),
to -
'rule' = array('email'),
it works for me.

Gary


On Fri, Jun 20, 2008 at 12:53 PM, J. Anderson [EMAIL PROTECTED] wrote:

 Before posting to Cake Trac and potentially wasting a developers time,
 maybe the group knows of this?

 Preliminaries:
 Version (from version.txt) 1.2.0.7125 RC1
 PHP Version: 5.2.5
 Platform: Apache 2.2.8
 OS: Windows XP

 Begin Code (From Model)

var $validate = array(
'email' = array(
'minimum-length' = array(
'rule' = array('minLength', 7),
'required' = true,
'allowEmpty' = false,
'message' = 'Invalid email format'
),
'maximum-length' = array(
'rule' = array('maxLength', 80),
'message' = 'EMail address can not be more than 80
 characters'
),
'email-format' = array(
'rule' = array('email', true),
'message' = 'Invalid email format'
),
)
);

 End Code (From Model)

 When running, neither the validation code or the rest of the associate
 code produces any errors.  Most of the test cases I've run against the
 email validation work as expected.  Some of the test cases including a
 dash in the domain name do not.  For example:

 value: [EMAIL PROTECTED]
 result: fail

 value: [EMAIL PROTECTED]
 result: pass

 value: [EMAIL PROTECTED]
 result: fail

 value: [EMAIL PROTECTED]
 result: pass

 value: [EMAIL PROTECTED]
 result: fail

 By 'fail' I mean the result message is 'Invalid email format' as with
 clearly invalid entries.


 This is obviously not of any high priority as a custom validation can
 be subbed or added to obtain the correct results.

 Anyone else see similar results?

 


--~--~-~--~~~---~--~~
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 action in beforeSave() ?

2007-11-19 Thread bujanga

I sometimes use code similar to the following in the beforeFilter() of
my controller:

/* function is not in byPass array and isnt being called by another function */
if(in_array($this-action,$byPass) === FALSE AND $this-action != __FUNCTION__){

}

Gary

On Nov 18, 2007 4:47 PM, Grant Cox [EMAIL PROTECTED] wrote:

 No, you cannot access ANYTHING from the controller in the model -
 that's one of the core parts of MVC.

 What you should do is define a new function in your model -
 register()  This can set some class variable which you can check in
 your other callbacks, eg:

 class YourModel extends AppModel {

 var $name = 'YourModel';

 var $is_registering = false;

 function register( $data )
 {
 $this-is_registering = true;
 return $this-save( $data );
 }

 function beforeValidate()
 {
 if ( $this-is_registering ){
 ...
 }
 }

 function afterSave()
 {
 if ( $this-is_registering ){
 ...

 }
 }
 }



 On Nov 18, 6:35 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  It would be great, but model doesn't have field action :/ Any other
  ideas how to check action in model?
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: Problems setting up phpGACL

2007-10-30 Thread bujanga

Are you using cakephp 1.1?

I previously used the phpGACL with success. Since switching to cakephp
1.2, I have migrated to the built-in ACL scheme with a set up similar
to what Geoff uses.
(http://lemoncake.wordpress.com/2007/07/19/acl-with-groups/)

Anyway, take a look at this thread.
http://groups.google.com/group/cake-php/browse_thread/thread/99f6800c439146e4

Gary


On 10/29/07, ellils [EMAIL PROTECTED] wrote:

 Ha... Glad I found another person with the same problems... :)

 I am going to fiddle with it some more and hopefully I can resolve
 this install problem.

 Let me know if you discover something?

 Regards,
 ellils

 On Oct 29, 5:30 pm, Cavallo [EMAIL PROTECTED] wrote:
  Same problem here. :/ When I go to localhost/phpgacl it redirects me
  to phpgacl/install but then I get that phpgacl controller does not
  exists :/
 
  Best regards.
 
  On Oct 28, 10:31 pm, ellils [EMAIL PROTECTED] wrote:
 
   Hi fellas,
 
   I know this topic has been discussed several times on this forum...
   read through everything and tried every conceivable way to get this
   sorted out on my localhost but for some reason, I could not integrate
   phpGACL with my cake install.
 
   Hope someone out here could point me in the correct direction.
 
   These are my settings for my cake installation:-
   Cake library is located at c:\www\cake\
   Web document root is c:\www\webroot\
   App folder is located at c:\www\webroot\app\
   Vendor folder is located at c:\www\webroot\app\vendor
 
   I downloaded phpgacl_for_cakephp-1.0.2b and copied all the folders
   into the corresponding ones.
 
   If I point my browser athttp://localhost/Ican see the correct
   messages:
   
   CakePHP Rapid Development
 
   Your database configuration file is present.
 
   Cake is able to connect to the database.
 
   According to the instructions listed here 
   -http://dev.sypad.com/installing-phpgacl-plugin-cakephp
   - I should next point my browser at http://localhost/phpgacl/;  but
   when I do that, all I get is a 404 page not found error since phpgacl
   is not located there.
 
   Am I interpreting part of the install instructions wrongly?
 
   TIA,
   ellils


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: about the fields chosen for the select tag

2007-10-17 Thread bujanga

Thank you Geoff for the link and Nate for the explanation. I didn't
know afterFind could be used with generateList in this manner. Very
helpfull

Gary Dalton

On 10/16/07, Geoff Ford [EMAIL PROTECTED] wrote:

 http://groups.google.com/group/cake-php/search?group=cake-phpq=generateList+multiple+field

 THis one in particular
 http://groups.google.com/group/cake-php/browse_thread/thread/c5709f46064b4106/853e167148d67f7d?lnk=gstq=generateList+multiple+field#853e167148d67f7d
 Basically nate suggests using afterFind to create a virtual full_name
 field to use for $displayField

 Geoff
 --
 http://lemoncake.wordpress.com

 On Oct 17, 1:24 pm, checkerboard [EMAIL PROTECTED] wrote:
  Hi guys,
  Currently I am having two tables authors and books having M2M
  relationship.
  The author table has three attributes  id ,fname and lname. Now I am
  trying to display a select tag in the book entry form consisting of
  the author last name and first name.
  If I define the var $displayField as last name or first name then it
  won't be sufficient since it will display only one field. What I want
  is to concatenate both the first name and last name into one and
  display it in the select tag. How can I implement this.


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: Emitting a PNG

2007-10-15 Thread bujanga

This code does work although I am having trouble getting it to post
properly when using the Security Component. Anyway, the post issue is
low priority for me right now.

In view:
?php if ( $useCaptcha ){ ?
labelSecurity Code: (refresh for new code)/label
?php echo $form-input('Temp.captcha', array('size' = '20')) ?
img src=?php echo $html-url('/users/captcha'); ? /
?php } ?

In users_controller:
function captcha(){
...
/* output captcha image to browser */
header('Content-Type: image/jpeg');
imagejpeg($image);
imagedestroy($image);

}

Gary Dalton


On 10/14/07, MikeK [EMAIL PROTECTED] wrote:


 I am still struggling with this dadgumit -- there is nothing wrong
 with the img generated itself -- I just can't emit it without saving
 it to a file with the Header command if anything else is on the page.


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: Emitting a PNG

2007-10-15 Thread bujanga

Hmm, my view source is
img src=/cake12/users/captcha /

Don't know where your ###s came from. Maybe consider AD's suggestion
to review your image code.

Using CakePHP 1.2.0.5427alpha. No ajax or special routing. Notice that
I am generating jpg vs your png though don't see how that would
matter.

Gary


On 10/15/07, MikeK [EMAIL PROTECTED] wrote:

 Gary I tried the same code and it just doesn't work for me  -- I'm
 using the alpha 1.2 code.

 The action similar to /users/captcha if directly invoked puts the
 image right on the screen no problem.

 If invoked from another view the way you have with the html img
 syntax it just gives me a blanked X image whose path is the path to
 the action.

 When I view the source of the emitted page I get - img src=/apppath/
 controller/do_imgtoken/### / where the #s are what gets rendered
 into the image.

 Are you using ajax or doing something with routes I need to enable
 perhaps?


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: generateList with concatenated valuePath

2007-09-22 Thread bujanga

Didn't show in my inbox. If dup, my apologies.

Gary

On 9/21/07, bujanga [EMAIL PROTECTED] wrote:
 Pretty sure this can be done but haven't quite gotten it yet.

 $this-User-generateList();

 gives array of key=value such as

 [joined] = Array
 (
 [30] = garyroot
 [31] = Tester1
 )

 Doing

 $this-User-generateList(null, null, null, null, '{n}.User.person_name_id');

 results in
 [joined] = Array
 (
 [30] = 8
 [31] = 13
 )

 But how does one concatenate those fields in generateList? I've tried
 a few things such as
 $this-User-generateList(null, null, null, null,

 '{n}.User.person_name_id'.'{n}.User.username');
 and
 $this-User-generateList(null, null, null, null,
 array('{0}: {1}',
 '{n}.User.person_name_id', '{n}.User.username'));

 without result. What is the proper way to get

 [joined] = Array
 (
 [30] = 8: garyroot
 [31] = 31: Tester1
 )


 Baking on Friday again.

 Gary Dalton


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---



generateList with concatenated valuePath

2007-09-21 Thread bujanga

Pretty sure this can be done but haven't quite gotten it yet.

$this-User-generateList();

gives array of key=value such as

[joined] = Array
(
[30] = garyroot
[31] = Tester1
)

Doing

$this-User-generateList(null, null, null, null, '{n}.User.person_name_id');

results in
[joined] = Array
(
[30] = 8
[31] = 13
)

But how does one concatenate those fields in generateList? I've tried
a few things such as
$this-User-generateList(null, null, null, null,

'{n}.User.person_name_id'.'{n}.User.username');
and
$this-User-generateList(null, null, null, null,
array('{0}: {1}',
'{n}.User.person_name_id', '{n}.User.username'));

without result. What is the proper way to get

[joined] = Array
(
[30] = 8: garyroot
[31] = 31: Tester1
)


Baking on Friday again.

Gary Dalton

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: Unexpected behaviour in 'required' validation rule (v 1.2)

2007-09-20 Thread bujanga

Here is an example of a working rule with a required condition.

var $validate = array(
'owner_id'  = array(
'number'= array(
'rule'  = array('numeric'),
'on'= 'create',
'required' = true,
'allowEmpty' = false,
'message'   = 'Owner ID must exist!'
)
)
);

On 9/19/07, Farez [EMAIL PROTECTED] wrote:

 thanks grigri. seems to be working fine for me without 'allowEmpty'.
 but the 'required' rule is still a mystery to me.



 On Sep 19, 9:40 am, grigri [EMAIL PROTECTED] wrote:
  I ran into this too - you need to add the 'allowEmpty' attribute too:
 
  'email' = array('rule'=VALID_NOT_EMPTY, 'allowEmpty' = true)
 
  On Sep 18, 1:51 pm, Farez [EMAIL PROTECTED] wrote:
 
   Hi,
 
   I'm wondering if I'm doing something wrong here (have searched docs,
   sources and archives and can't find an answer).
 
   The 'required' rule seems to be broken as it still reports an error
   even when the field is not empty. The rule I have is:
 
   'email' = array('rule'='required')
 
   I traced this to this part of the code in Model:invalidFields():
 
   if (method_exists($this, $rule)) {
   $ruleParams[] = array_diff_key($validator, $default);
   $valid = call_user_func_array(array($this, $rule), 
   $ruleParams);} elseif (method_exists($Validation, $rule)) {
 
   $valid = call_user_func_array(array($Validation, $rule),
   $ruleParams);} elseif (!is_array($validator['rule'])) {
 
   $valid = preg_match($rule, $data[$fieldName]);
 
   }
 
   where it always lands on the preg_match(...) line in the last
   condition, where it tries to preg_match() $rule which has a value of
   'required', against the data field.
 
   Anyway, I tried using a pattern instead of 'required' and it works,
   like this:
 
   'email' = array('rule'=VALID_NOT_EMPTY)
 
   ... but I'm wondering if the 'required' rule is working in 1.2?
 
   Cheers,
   Farez


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: unset unwanted fields

2007-09-17 Thread bujanga

Of course there is a cake way! It is in the Model::save method.

Model::save() takes 3 parameters. The last parameter is a list of
fields that are allowed to be written.

So:
...
$allowed_fields = array('username', 'email');
$this-Model-save($this-data, true, $allowed_fields);
...



On 9/14/07, Claudia [EMAIL PROTECTED] wrote:

 Hi there

 I have added a two-dimensional array to each model which
 for each action states the fields that are allowed to be saved
 in this action.
 When I call $this-model-save() in an action, I supply the respective
 array entry as second parameter to the save() function which limits
 the fields that are used during the save.

 I don't know whether there is a cake specific way to do this,
 so if you find one, please post it here.


 @RichardAtHome: If you just remove the form fields from the ctp file a
 malicious user
 could still post to the form action using his own form and thus his
 own form fields. You
 could of course add some checks to verify the integrity of the form
 but this can get
 complicated really quick.


 Claudia


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---



unset unwanted fields

2007-09-14 Thread bujanga

I think my question is just the result of a Friday brainlock but anyway.

Is there a cake way to prevent unwanted fields being inserted into an
edit form post?
* Admin user is allowed to set $nologin to TRUE or FALSE
* but Manager user is only allowed to view it.
* Manager user is however allowed to change other items on the User model
* Admin submits via admin_edit.ctp
* while Manager submits through edit.ctp.

Normally, I would discard all unwanted values. I can certainly do this
here but is there a cake specific way that I am missing?

Gary Dalton

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: unset unwanted fields

2007-09-14 Thread bujanga

The fields are not in the edit.ctp but using form injection a
knowledgeable user could add them. Here are the fields in edit.ctp:

?php echo $form-create('User');?
fieldset
legend?php __('Edit');? ?php __('User');?/legend
?php
echo $form-input('id');
echo $form-input('person_name_id');
echo $form-input('username');
echo $form-input('email');
?
/fieldset
?php echo $form-end('Submit');?

Running a simple test with the Web Developer plugin for Firefox, I was
able to edit and post the form to update nologin. This was done by
adding into the form the line:
input name=data[User][nologin] value=1 id=UserNologin type=checkbox
and then checking the box and submitting the form.

Gary Dalton




On 9/14/07, RichardAtHome [EMAIL PROTECTED] wrote:

 I may be misunderstanding your query, but can't you just remove the
 fields from edit.ctp ?

 Admin will still be able to change them in admin_edit.ctp

 On Sep 14, 4:42 pm, bujanga [EMAIL PROTECTED] wrote:
  I think my question is just the result of a Friday brainlock but anyway.
 
  Is there a cake way to prevent unwanted fields being inserted into an
  edit form post?
  * Admin user is allowed to set $nologin to TRUE or FALSE
  * but Manager user is only allowed to view it.
  * Manager user is however allowed to change other items on the User model
  * Admin submits via admin_edit.ctp
  * while Manager submits through edit.ctp.
 
  Normally, I would discard all unwanted values. I can certainly do this
  here but is there a cake specific way that I am missing?
 
  Gary Dalton


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: form-input force required

2007-08-28 Thread bujanga

Answer is add the option:
   'div' = 'required'

Gary


On 8/27/07, Pablo Viojo [EMAIL PROTECTED] wrote:

 http://api.cakephp.org/1.2/class_form_helper.html

 On 8/27/07, bujanga [EMAIL PROTECTED] wrote:
 
  On my registration form, I wish to verify the user's password entry by
  having them enter it twice. The FormHelper magically indicates which
  fields must be completed when the field is part of the model. How can
  it be done to indicate a required field when it is not part of the
  model. Finally, is there anyplace that enumerates the options for the
  FormHelper::input? (looked in many places).
 
  Snip of form register.ctp
 
  ?php echo $form-input('password', array('label' = 'Password',
  'size'='40')) ?
 
  ?php echo $form-input('Temp.verify', array('label' = 'Verify
  Password', 'type' = 'password', 'size'='40')) ?
 
  Thanks,
 
  Gary
 
  
 


 --
 Pablo Viojo
 [EMAIL PROTECTED]
 http://pviojo.net

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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

2007-06-02 Thread bujanga

Where does the code fail?

Here is a snippet of mine that does function.

if ( !$this-User-passwordComplex($this-data['User']['password']) ){
$this-User-invalidate('password');
}elseif( $this-data['User']['password'] != $this-data['Temp']['verify'] ){
$this-User-invalidate('password');
$this-set('password_error', $this-ggMessages['pass2']);
}

if ( $this-User-save($this-data['User']) ){
...

My model is User vs yours is Client. Guessing perhaps you wish to
invalidate password and not confirm_password? Which is part of your
model?



On 5/31/07, cake_learner [EMAIL PROTECTED] wrote:

 I want confirm password to be validated. (Both password and confirm
 password should be same)

 views:

 Password
 ?php echo $html-tagErrorMsg('Client/password', 'Password is
 required.') ?
 ?php echo $html-input('Client/password', array('size' = 
 '10'))?
 p

 Confirm Password
 ?php echo $html-tagErrorMsg('Client/confirm_password', 
 'Confirm
 Password is required.') ?
 ?php echo $html-input('Client/confirm_password', 
 array('size' =
 '10'))? p


 controller:

function index() {

if (!empty($this-data))
 {

 
 if(($this-data['Client']['password'])!=($this-data['Client']
 ['confirm_password']))
 $this-Client-invalidate('confirm_password');


 if ($this-Client-save($this-data))
 {
 $this-flash('Your post has been saved.','/clients/
 register2');
 }
 else
 {
  $this-render();
 }
 }

}

 The above code is not working.


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: Problems installing phpGACL-Plugin with Cake

2007-05-18 Thread bujanga

Search this group for:
phpGACL could not be installed

On 5/18/07, JuergenE [EMAIL PROTECTED] wrote:

 Hello group

 I have spent hours trying to install phpGACL-Plugin with CakePHP and I
 have spent hours to find a solution.

 I use CakePHP 1.1.14.4797, phpGACL Plugin 1.0.2b, phpGACL 3.3.7, PHP
 5.1.4 on my local server and MySQL 4.1.20.
 I use the document http://dev.sypad.com/installing-phpgacl-plugin-cakephp
 for installation. I only get to the page that says Check your
 settings and shows my database-settings. When I click on Proceed
 with Installation, the page reloads presenting an error-message on
 top (phpGACL could not be installed). Looking at the database-table,
 there are 4 tables, that the script created (prefix_acl,
 prefix_acl_sections, prefix_aco, prefix_phpgacl).

 Has anybody any hint for me how to get the plugin installed and
 working?

 Thanks
 JuergenE


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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: phpGACL could not be installed

2007-05-17 Thread bujanga

I had similar problems and determined the issue to be with phpGACL
trying to create overly large index keys for that version of MySQL. To
view the error messages, try installing phpGACL directly.

I overcame the problem by editing the schema.xml. No problems in
production usage. For example:

!-- ACO Table --
table name=aco
field name=id type=I
DEFAULT value=0/
NOTNULL/
KEY/
/field
field name=section_value type=C size=150
DEFAULT value=0/
NOTNULL/
/field
field name=value type=C size=150
NOTNULL/
/field
field name=order_value type=I
DEFAULT value=0/
NOTNULL/
/field
field name=name type=C size=255
NOTNULL/
/field
field name=hidden type=I
DEFAULT value=0/
NOTNULL/
/field

index name=section_value_value_aco
colsection_value/col
colvalue/col
UNIQUE/
/index
index name=hidden_aco
colhidden/col
/index
/table

I am using cake 1.1. So as MI states it is not compatible with 1.2, believe it.

Gary



On 5/17/07, tagawa [EMAIL PROTECTED] wrote:

 Hello,
 I'm developing a new site using CakePHP 1.2, dAuth and hopefully
 phpGACL.  Having upload the CakePHP phpGACL plugin and phpGACL itself,
 clicking the 'Proceed with installation' button results in the error
 message phpGACL could not be installed.  Looking at the code, this
 happens when schema.xml is parsed and executed but I'd like more
 details.  Is there a way to get the phpGACL plugin to print a log of
 what's going on or print error messages from phpGACL itself?

 Here's what I've checked:
 * The database settings are OK.
 * The error occurs with or without using table prefixes
 * schema.xml exists in app/vendors/phpgacl
 * I put my database details in gacl.ini.php (although I don't think
 this is necessary)
 * I am sober

 My settings are:
 CakePHP 1.2
 PHP 4.3
 MySQL 4.1

 As mentioned, I believe the problem is that I'm using CakePHP 1.2 in
 which case it would be worthwhile trying to make it compatible.
 Either that or it's something embarrassingly simple.
 Thanks in advance for any assistance.


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP 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
-~--~~~~--~~--~--~---