Re: Filtering on sub table

2008-09-29 Thread Mickael Gentil
I think I was not clear and I apologize or i'm not understanding and i
apologize too :)

In my view, i've some input on top of my list to filter datas helped with
Paginator helper and Filter component.

When i want to filter or sort on a field on 2nd model, i've no problems. But
when i want to filter or sort on a field on 3rd or more model, i don't know
how do that, and all my tests were been without success.

Ex. :
$array['Program']['ProgramBroadcaster']['id']; //No problem with it
$array['Program']['ProgramBroadcaster']['Broadcaster']['name']; //Not
working

Thanks.

Yudao.

On Mon, Sep 29, 2008 at 7:43 AM, glenda guo [EMAIL PROTECTED] wrote:

 In this case, you can add filter in models when you  create relation with
 models.

 If you don't know how to use the query result in view, you can use print_r
 function to print the results, then you can know how to use it.
 Also , you can reference this page
 http://book.cakephp.org/view/78/Associations-Linking-Models-Together






 On Sun, Sep 28, 2008 at 4:30 PM, Mickael Gentil [EMAIL PROTECTED]wrote:

 Ok, but the conditions are for the select and not for filtering dataswich is 
 the result from this select, no ?

 And on my view what name for my select i can use ?

 Because $this-ProgramBroadcaster-Program-ProgramFile-ProgramState is a
 very deeper relationship.

 Thanks.

 Yudao.


 On Sun, Sep 28, 2008 at 4:19 AM, glenda guo [EMAIL PROTECTED] wrote:

 $this-set('programStateList', $this-ProgramBroadcaster-
 Program-ProgramFile-ProgramState-find('list'));

 You can add condition  in it.




 On Sat, Sep 27, 2008 at 10:43 PM, Mickael Gentil 
 [EMAIL PROTECTED] wrote:

 Hi all,

 I need some help with a problem.

 This is my controller :

 ?php
 class ProgramBroadcastersController extends AppController {

 var $name = 'ProgramBroadcasters';
 var $components = array('Filter');

 var $paginate = array(
'limit'=20,
'page'=1,
'order'='ProgramBroadcaster.created DESC',

 'fields'=array('id','broadcaster_id','program_id','play_date','delivery_date','case_number','video_tape_number'),
'contain'=array(
'Broadcaster'=array('fields'=array('id','name')),
'Program'=array(
'ProgramFile'=array(

 'fields'=array('id','program_id','program_state_id'),
'ProgramState',

 'User'=array('fields'=array('lastname','firstname'))
 )
 )
)
 );

 public function index()
 {
 $this-set('broadcasterList',
 $this-ProgramBroadcaster-Broadcaster-find('list'));
 $this-set('programStateList',
 $this-ProgramBroadcaster-Program-ProgramFile-ProgramState-find('list'));

 $filter = $this-Filter-process($this);
 $this-set('url',$this-Filter-url);
 $this-set('programs', $this-paginate(null, $filter));

 }
 }

 I need to filter datas on ProgramState.id, and i don't know how.

 Thanks a lot.

 Yudao.










 


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



help with YAML pls basic syntax...etc

2008-09-29 Thread forrestgump

Can someone tell me what is wrong with the following YAML code ? \

UP:
  create_table:
users:
  id:
type: integer
length: 11
primary: true
autoincrement: true
  username:
type: varchar
length: 100
index: true
  password:
type: varchar
length: 100

  query:
users: INSERT INTO users SET username = 'admin' and password=
'admin'


DOWN:
  drop_table: users
  query:
users: DELETE FROM users WHERE username = 'admin' and password=
'admin'

what i want it to do is, create a table users with fields
[id,username,password] and then insert data into it
[0,admin,admin]wht YAML is doing for me is...
it create a table users with fields [id,created,modified] and another
table autoincrement with fields  [id,username,password] , and nothing
gets inserted

I would really appreciate some help ive been stuck on this since 2
daysim writing a short tutorial on cakephp migrations that i wish
to shareand this will really help...

Forrestgump
(yes i know very original nick name :) )
--~--~-~--~~~---~--~~
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: help with YAML pls basic syntax...etc

2008-09-29 Thread forrestgump

OK i made some changed to the code as follows
UP:
  create_table:
users:
  username:
type: varchar
length: 100
index: true
  password:
type: varchar
length: 100

  query:
users: INSERT INTO users SET username = 'admin' and password=
'admin'


DOWN:
  query:
users: DELETE FROM users WHERE username = 'admin' and password=
'admin'
  drop_table: users


It has successfully created the users table and the collumns i
require, including two additional ones i dont require(created,
modified)
yet no data was insertedwhere am i going wrong?

On Sep 29, 12:00 pm, forrestgump [EMAIL PROTECTED] wrote:
 Can someone tell me what is wrong with the following YAML code ? \

 UP:
   create_table:
     users:
       id:
             type: integer
             length: 11
             primary: true
             autoincrement: true
       username:
             type: varchar
             length: 100
             index: true
       password:
             type: varchar
             length: 100

   query:
     users: INSERT INTO users SET username = 'admin' and password=
 'admin'

 DOWN:
   drop_table: users
   query:
     users: DELETE FROM users WHERE username = 'admin' and password=
 'admin'

 what i want it to do is, create a table users with fields
 [id,username,password] and then insert data into it
 [0,admin,admin]wht YAML is doing for me is...
 it create a table users with fields [id,created,modified] and another
 table autoincrement with fields  [id,username,password] , and nothing
 gets inserted

 I would really appreciate some help ive been stuck on this since 2
 daysim writing a short tutorial on cakephp migrations that i wish
 to shareand this will really help...

 Forrestgump
 (yes i know very original nick name :) )
--~--~-~--~~~---~--~~
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: dashes in email fail

2008-09-29 Thread JuergenRiemer

Hi,

afaik dashes are allowed in email adresses; why does the validation
module let them fail? do I overlook sg here, I am a bit puzzled since
this validation should be quite well elaborated by now and I found
just one post in that concern that wasn't really answered.
Validation fails with and without domain check ( 'rule' =
array('email') and 'rule' = array('email', true) )

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



page refresh?

2008-09-29 Thread rocket

sup guys
i have an upload script, that lets you upload your profile pic.

but when you change the picture, the old picture is still stuck in the
cache, so to see the new pic the user needs to push F5... I can't
figure out how to refresh the page automatically.

any ideas?
--~--~-~--~~~---~--~~
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: Filtering on sub table

2008-09-29 Thread glenda guo
Does the Program  and  Broadcaster relationship type is
hasAndBelongsToMany?

In this case,  you need to create hasAndBelongsToMany relationshipship  in
Program model, when you want to get the Broadcast data, you can use
$array['Program']['Broadcast'][
0- (sizeof9$array['Program']['Broadcast']) -1]['field_name']  to get the
data.


If you don't know how to use data in view, in your corresponding action, as
below, print_r($array), then you can see all the data.


On Mon, Sep 29, 2008 at 2:58 PM, Mickael Gentil [EMAIL PROTECTED]wrote:

 I think I was not clear and I apologize or i'm not understanding and i
 apologize too :)

 In my view, i've some input on top of my list to filter datas helped with
 Paginator helper and Filter component.

 When i want to filter or sort on a field on 2nd model, i've no problems.
 But when i want to filter or sort on a field on 3rd or more model, i don't
 know how do that, and all my tests were been without success.

 Ex. :
 $array['Program']['ProgramBroadcaster']['id']; //No problem with it
 $array['Program']['ProgramBroadcaster']['Broadcaster']['name']; //Not
 working

 Thanks.

 Yudao.

 On Mon, Sep 29, 2008 at 7:43 AM, glenda guo [EMAIL PROTECTED] wrote:

 In this case, you can add filter in models when you  create relation with
 models.

 If you don't know how to use the query result in view, you can use print_r
 function to print the results, then you can know how to use it.
 Also , you can reference this page
 http://book.cakephp.org/view/78/Associations-Linking-Models-Together






 On Sun, Sep 28, 2008 at 4:30 PM, Mickael Gentil [EMAIL PROTECTED]
  wrote:

 Ok, but the conditions are for the select and not for filtering dataswich 
 is the result from this select, no ?

 And on my view what name for my select i can use ?

 Because $this-ProgramBroadcaster-Program-ProgramFile-ProgramState is
 a very deeper relationship.

 Thanks.

 Yudao.


 On Sun, Sep 28, 2008 at 4:19 AM, glenda guo [EMAIL PROTECTED] wrote:

 $this-set('programStateList', $this-ProgramBroadcaster-
 Program-ProgramFile-ProgramState-find('list'));

 You can add condition  in it.




 On Sat, Sep 27, 2008 at 10:43 PM, Mickael Gentil 
 [EMAIL PROTECTED] wrote:

 Hi all,

 I need some help with a problem.

 This is my controller :

 ?php
 class ProgramBroadcastersController extends AppController {

 var $name = 'ProgramBroadcasters';
 var $components = array('Filter');

 var $paginate = array(
'limit'=20,
'page'=1,
'order'='ProgramBroadcaster.created DESC',

 'fields'=array('id','broadcaster_id','program_id','play_date','delivery_date','case_number','video_tape_number'),
'contain'=array(
'Broadcaster'=array('fields'=array('id','name')),
'Program'=array(
'ProgramFile'=array(

 'fields'=array('id','program_id','program_state_id'),
'ProgramState',

 'User'=array('fields'=array('lastname','firstname'))
 )
 )
)
 );

 public function index()
 {
 $this-set('broadcasterList',
 $this-ProgramBroadcaster-Broadcaster-find('list'));
 $this-set('programStateList',
 $this-ProgramBroadcaster-Program-ProgramFile-ProgramState-find('list'));

 $filter = $this-Filter-process($this);
 $this-set('url',$this-Filter-url);
 $this-set('programs', $this-paginate(null, $filter));

 }
 }

 I need to filter datas on ProgramState.id, and i don't know how.

 Thanks a lot.

 Yudao.













 


--~--~-~--~~~---~--~~
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: page refresh?

2008-09-29 Thread forrestgump

use javascript
http://grizzlyweb.com/webmaster/javascripts/refresh.asp

On Sep 29, 12:37 pm, rocket [EMAIL PROTECTED] wrote:
 sup guys
 i have an upload script, that lets you upload your profile pic.

 but when you change the picture, the old picture is still stuck in the
 cache, so to see the new pic the user needs to push F5... I can't
 figure out how to refresh the page automatically.

 any ideas?
--~--~-~--~~~---~--~~
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: dashes in email fail

2008-09-29 Thread glenda guo
You can reference this page
http://cakebaker.42dh.com/2007/01/03/validation-with-cakephp-12/

On Mon, Sep 29, 2008 at 3:22 PM, JuergenRiemer [EMAIL PROTECTED]wrote:


 Hi,

 afaik dashes are allowed in email adresses; why does the validation
 module let them fail? do I overlook sg here, I am a bit puzzled since
 this validation should be quite well elaborated by now and I found
 just one post in that concern that wasn't really answered.
 Validation fails with and without domain check ( 'rule' =
 array('email') and 'rule' = array('email', true) )

 thx
 Juergen
 


--~--~-~--~~~---~--~~
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: May or may not have one relationship

2008-09-29 Thread grigri

Doesn't really seem much point.

When retrieving an `Entity`, cake will as for the join to be performed
so that both entries will be retrieved in a single query.

To only retrieve the `User` on a condition in the `Entity` table,
you'd have to first retrieve the `Entity` and then (sometimes)
retrieve the `User`. The overhead of a separate query is much higher
than a join that will never happen, assuming your tables are indexed
correctly.

You can always conditionally delete the empty User() array from the
results in afterFind(), if you feel it's necessary.

hth
grigri

On Sep 28, 9:15 am, Novice Programmer [EMAIL PROTECTED]
wrote:
 Hello All,

 This might be an awkward situation but for my current project i am having a
 situation where a table Entity may or not have a user. In the entities table
 there is a field which tells me whether there is some user associated with
 it or not. I want to handle the situation with cake php so that it tries to
 join Entity with User only when that particular field in entity is set. Is
 there some out there to help me?

 --
 Thanks  Regards,
 Novice.
--~--~-~--~~~---~--~~
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: creating and using multiple po files for cleaner maintenance

2008-09-29 Thread exo_duz

Dr. Tarique,

I have done that and have successfully made the default pot files from
the CAKE console script.

The only problem now is that it does not seem to pick it up on the
page. I have kept all the names the same such as -app-views-pages-
default.po and put all the files within /app/locale/eng/LC_MESSAGES
but the pages does not seem to be changing. Any ideas of the naming
conventions and structuring in the language folders?

On Sep 27, 1:44 pm, Dr. Tarique Sani [EMAIL PROTECTED] wrote:
 On Sat, Sep 27, 2008 at 10:03 AM, exo_duz [EMAIL PROTECTED] wrote:

  Currently I am working with someone who isn't a programmer and I would
  like to be able to structure the po files instead of just putting all
  the translations in /app/locale/eng/default.po

 You can create .po files on per model, view,  controller basis

 try /cake i18n in the console and you will get an option to have a
 single .po file or multiple files...

 HTH

 Tarique

 --
 =
 Cheesecake-Photoblog:http://cheesecake-photoblog.org
 PHP for E-Biz:http://sanisoft.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: getting edit view of HABTM

2008-09-29 Thread glenda guo
the default form action parameter is add ,as below, you just need to assign
it
echo $form-create('

 EmployeesAccreditation', array('action' = 'edit'));


On Sun, Sep 28, 2008 at 7:58 PM, jojiju [EMAIL PROTECTED] wrote:


 hi all,
I have  tables employees and accreditations and join table called
 employees_accreditations. now I want to build the edit form which
 should populate the information both from employees and
 accreditations. its driving me crazy please help.


 div

fieldset
legend?php __('Edit Employee'); ?/legend
?php
echo
 $form-create('EmployeesAccreditation');
echo
 $form-input('id',array('type'='hidden'));
echo $form-input('card_no');
echo
 $form-input('card_expiry_date',array('type'='text'));
echo $form-input('first_name');
echo $form-input('surname');
echo $form-input('date_of_birth');
echo
 $form-input('street_no_and_name');
echo $form-input('suburb');
echo $form-input('state');
echo $form-input('post_code');
echo
 $form-input('telephone_number');
echo $form-input('mobile_number');
echo
 $form-input('driving_license_number');
echo $form-input('position_title');
echo
 $form-input('employer_company_name');
echo
 $form-input('employer_contact_person_name');
echo
 $form-input('employer_department');
echo
 $form-input('employer_telephone_number');
echo
 $form-input('employer_mobile_number');
echo
 $form-input('employer_fax_number');
echo
 $form-input('employer_email_address');
echo
 $form-input('employer_street_no_and_name');
echo
 $form-input('employer_po_box');
echo
 $form-input('employer_suburb');
echo $form-input('employer_state');
echo
 $form-input('employer_post_code');
echo
 $form-input('allergy_description');
echo $form-input('sub_category',
 array('type'='select','options'=array('M'='M')));?
legend?php __('Edit
 Accreditations'); ?/legend
?php
echo
 $form-input('Accreditation.accreditation_id',
 array('type'='select','options'=$accreditationList,'selected' =
 $preferenceaccreditation,'label' = __('Accreditation Name', true)));
echo
 $form-input('Accreditation.certification_number');
echo $form-
 input('Accreditation.issue_date',array('type'='text'));
echo $form-
 input('Accreditation.expiry_date',array('type'='text'));
echo $form-
 input('Accreditation.due_date_assignments',array('type'='text'));
echo $form-submit('Edit');
echo $form-end();
?
/fieldset
/div


 


--~--~-~--~~~---~--~~
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: creating and using multiple po files for cleaner maintenance

2008-09-29 Thread exo_duz

Seems like I found the solution at:

http://bakery.cakephp.org/articles/view/p28n-the-top-to-bottom-persistent-internationalization-tutorial

On the bottom of the page in Comments no. 26 it explains how to use
multiple .po files.



On Sep 29, 4:46 pm, exo_duz [EMAIL PROTECTED] wrote:
 Dr. Tarique,

 I have done that and have successfully made the default pot files from
 the CAKE console script.

 The only problem now is that it does not seem to pick it up on the
 page. I have kept all the names the same such as -app-views-pages-
 default.po and put all the files within /app/locale/eng/LC_MESSAGES
 but the pages does not seem to be changing. Any ideas of the naming
 conventions and structuring in the language folders?

 On Sep 27, 1:44 pm, Dr. Tarique Sani [EMAIL PROTECTED] wrote:

  On Sat, Sep 27, 2008 at 10:03 AM, exo_duz [EMAIL PROTECTED] wrote:

   Currently I am working with someone who isn't a programmer and I would
   like to be able to structure the po files instead of just putting all
   the translations in /app/locale/eng/default.po

  You can create .po files on per model, view,  controller basis

  try /cake i18n in the console and you will get an option to have a
  single .po file or multiple files...

  HTH

  Tarique

  --
  =
  Cheesecake-Photoblog:http://cheesecake-photoblog.org
  PHP for E-Biz:http://sanisoft.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: dashes in email fail

2008-09-29 Thread JuergenRiemer

Thanks for the link.
I already found the problem: I sanitized all data before writing it to
the database thus the dash was escaped and the validation failed as it
should.
Juergen

On 29 Sep., 09:44, glenda guo [EMAIL PROTECTED] wrote:
 You can reference this 
 pagehttp://cakebaker.42dh.com/2007/01/03/validation-with-cakephp-12/

 On Mon, Sep 29, 2008 at 3:22 PM, JuergenRiemer [EMAIL PROTECTED]wrote:



  Hi,

  afaik dashes are allowed in email adresses; why does the validation
  module let them fail? do I overlook sg here, I am a bit puzzled since
  this validation should be quite well elaborated by now and I found
  just one post in that concern that wasn't really answered.
  Validation fails with and without domain check ( 'rule' =
  array('email') and 'rule' = array('email', true) )

  thx
  Juergen
--~--~-~--~~~---~--~~
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: page refresh?

2008-09-29 Thread [EMAIL PROTECTED]

Yahoo (guidelines on caching and optimisations) suggests that you
never replace a picture under the same name.
So when updating your design, for example, you would link your logo to
logo-1.1.gif or something similar.
They particularly suggest this versioning type of setup for logos
and other pictures that are likely to be updated.

/Martin


On Sep 29, 9:37 am, rocket [EMAIL PROTECTED] wrote:
 sup guys
 i have an upload script, that lets you upload your profile pic.

 but when you change the picture, the old picture is still stuck in the
 cache, so to see the new pic the user needs to push F5... I can't
 figure out how to refresh the page automatically.

 any ideas?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Effect.Fade and Effect.Appear

2008-09-29 Thread Arak Tai'Roth

This is my ajax link that I am using:

echo $ajax-link($html-image('/img/portfolio/small/' .
$portfolio['Portfolio']['picture'], array('alt' =
$portfolio['Portfolio']['title'])), '/portfolios/view/' .
$portfolio['Portfolio']['id'], array('update'= 'case_study',
'complete' = 'Effect.Appear(\'case_study\', {duration: 2.0})'), null,
false);

Long I know. I can explain it more if you want me to, but the main
part here that is my focus is this part:

array('update'= 'case_study', 'complete' =
'Effect.Appear(\'case_study\', {duration: 2.0})')

Now all of this works as it is. However what I wanted was that after
the case_study div initially appeared was once another link was
clicked I wanted it to fade away and have it re-appear when it was
complete. So I thought I could add before the 'complete':

'before' = 'Effect.Fade(\'case_study\')
or
'loading' = Effect.Fade(\'case_study\')

Neither of these are working. What happens as soon as I add either of
those, is the div vaguely appears and then suddenly disappears, never
to appear again until another link appears and then it just continues
that cycle.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Form wizard component save data

2008-09-29 Thread mcphisto

Hi all,
I'm installing this component on my application to have a multi-page
form. Everything work, but I really don't know how to save data in the
database. The problem is that I can't find the session variables saved
during the steps. The other thing I don't understand is if I need to
create a function receipt in my controller. This part is not
explained on tutorial.
Anyone can help me?

Thank you.

--~--~-~--~~~---~--~~
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: Upload Iframe ajax

2008-09-29 Thread [EMAIL PROTECTED]


  - What happens if user uploads a file and does not submit the
 form the file will be uploaded

I am not sure what you mean byt this... so I'll more on to the other
questions.


  - How can I use an ajax progress bar in cake ? Not swf upload
 please I sdont want flash in my site .
  - how can I pass data from form to the iframe because I will need
 to record the file path to the database where they belong ?

These two depend so much on which javascript-framework you use (if
any), and how the progress bar is written.
If you have a progress bar working without Cake, then including Cake
should be pretty simple.

/Martin


On Sep 29, 1:17 am, cem [EMAIL PROTECTED] wrote:
 Hi ;

    i want to use iframe and ajax in my form but it seems really
 complicated . Because :

      - What happens if user uploads a file and does not submit the
 form the file will be uploaded
      - How can I use an ajax progress bar in cake ? Not swf upload
 please I sdont want flash in my site .
      - how can I pass data from form to the iframe because I will need
 to record the file path to the database where they belong ?

   has anyone solved any ofthese issues  ?
--~--~-~--~~~---~--~~
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: Problems with cipher behavior

2008-09-29 Thread Kanten

Thanks, that removed the PHP errors.

I still have some problems with the behaviour though. It correctly
encrypts the data, but even though autoDecrypt is set to true, it
doesn't decrypt the data. In the log the behaviour outputs:

2008-09-29 11:53:40 Error: CipherBehavior::_unpackValue Enclosed salt
missmatch: '—y÷' != 'G¡ œ' 8
2008-09-29 11:53:40 Error: CipherBehavior::_decryptValue Could not
unpack value from '—y÷G¡ œ'
2008-09-29 11:53:40 Error: CipherBehavior::decrypt Could not decrpyt
Patient::cpr: '$E$4kK+EF1+'

/Anders

On Sep 26, 3:21 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Hi Kanten,
 You are running this on an version of PHP where you are no longer
 supposed to define pass_by_reference in functions like before. LIke
 the error said you can allow it in php.ini or fix the behaviour. From
 a quick glance I'd say you could safely remove them since decrypt() is
 defined to accept the arguments as references.

 $this-decrypt($model, $result);
 See the two  there.

 /Martin

 On Sep 26, 2:43 pm, Kanten [EMAIL PROTECTED] wrote:

  Hi,

  I'm experimenting with 
  thecipherbehavior:http://bakery.cakephp.org/articles/view/cipher-behavior

  Unfortunately I keep getting the following error and can't seem to
  figure out how to debug the script myself:

  Warning: Call-time pass-by-reference has been deprecated; If you would
  like to pass it by reference, modify the declaration of [runtime
  function name](). If you would like to enable call-time pass-by-
  reference, you can set allow_call_time_pass_reference to true in your
  INI file in C:\wamp\www\cake\app\models\behaviors\cipher.php on line
  90

  The code section corresponding to this is:

   /** Model hook to decrypt model data if auto decipher is turned on in
  the
      * model behavior configuration. Only primary model data are
  decrypted. */
    function afterFind($model, $result, $primary = false) {
      if (!$result || !isset($this-config[$model-name]['cipher']))
        return $result;

      if ($primary  $this-config[$model-name]['autoDecrypt']) {
        // check for single of multiple model
        $keys = array_keys($result);
        if (!is_numeric($keys[0])) {
          $this-decrypt($model, $result);
        } else {
          foreach($keys as $index) {
            $this-decrypt($model, $result[$index]);
          }
        }
      }
      return $result;
    }

  Any ideas?

  /Anders


--~--~-~--~~~---~--~~
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: Form wizard component save data

2008-09-29 Thread [EMAIL PROTECTED]

If you are referring to the component by jaredhoyt then yes the
tutorial can be a little fuzzy on some points. It works great, though.
Just make sure you read both pages of the article and the comments and
any fuzzy bits should be taken care of.

You have to create a receipt method (i.e. a place to end up after the
wizard is done) but you ca call it anything you want and configure the
component with the new name.

As I understand this component (I have only played around with it a
bit so far):
You do no directly access the session data. The component populates
this-data for each step whenever you step back and forth in the
wizard.
The component expects you to process and save data at each step, I
think... Possibly you get all the data available in the receipt... not
sure. What I do know is that data entered in step1 is not available to
you in step2 (without going behind the components back and accessing
the session directly).

I needed each step to have the data of the previous steps so I had to
modify the component a little. And then I had to direct my attention
elsewhere for a while and have not finished the wizard I started...
that's why my knowledge is so limited.

/Martin

On Sep 29, 12:43 pm, mcphisto [EMAIL PROTECTED] wrote:
 Hi all,
 I'm installing this component on my application to have a multi-page
 form. Everything work, but I really don't know how to save data in the
 database. The problem is that I can't find the session variables saved
 during the steps. The other thing I don't understand is if I need to
 create a function receipt in my controller. This part is not
 explained on tutorial.
 Anyone can help me?

 Thank you.
--~--~-~--~~~---~--~~
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: Form wizard component save data

2008-09-29 Thread mcphisto

My problem is that this form, divided in more pages, saves its data
all in a unique table. So, if I save data in DB at each step, at the
end I have 3 new entries with 3 steps.

On 29 Set, 13:07, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 If you are referring to the component by jaredhoyt then yes the
 tutorial can be a little fuzzy on some points. It works great, though.
 Just make sure you read both pages of the article and the comments and
 any fuzzy bits should be taken care of.

 You have to create a receipt method (i.e. a place to end up after the
 wizard is done) but you ca call it anything you want and configure the
 component with the new name.

 As I understand this component (I have only played around with it a
 bit so far):
 You do no directly access the session data. The component populates
 this-data for each step whenever you step back and forth in the
 wizard.
 The component expects you to process and save data at each step, I
 think... Possibly you get all the data available in the receipt... not
 sure. What I do know is that data entered in step1 is not available to
 you in step2 (without going behind the components back and accessing
 the session directly).

 I needed each step to have the data of the previous steps so I had to
 modify the component a little. And then I had to direct my attention
 elsewhere for a while and have not finished the wizard I started...
 that's why my knowledge is so limited.

 /Martin

 On Sep 29, 12:43 pm, mcphisto [EMAIL PROTECTED] wrote:



  Hi all,
  I'm installing this component on my application to have a multi-page
  form. Everything work, but I really don't know how to save data in the
  database. The problem is that I can't find the session variables saved
  during the steps. The other thing I don't understand is if I need to
  create a function receipt in my controller. This part is not
  explained on tutorial.
  Anyone can help me?

  Thank you.- Nascondi testo citato

 - Mostra testo citato -
--~--~-~--~~~---~--~~
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: Form wizard component save data

2008-09-29 Thread [EMAIL PROTECTED]


That is sort of the problem I had.
The component does not to my knowledge handle this at the moment. I
modified it to merge the data from each step so that each step would
contain the data from all steps. On the last step (or in
beforeReceipt) I can then finally save the end-result.

I was in need of a wizard like:
step1 = upload of a file. (csv or xls)
step2 = display part of the file's content and choose what to
import (show row 1 and ask which cols to send to database)
receipt = show result of import (...43 new rows were imported...)

I have got the component to do this now... just got the receipt lest.
I need to make sure it all works and is backwards compatible before I
send my changes to the author. It will of-course be up to him to
decide if my changes are improvements of not. :)

Also, beware, the method you name as the receipt-method will not run
at all. It will only be a placeholder for rendering the
corresponding view. Supposedly this will make this action more of a
redirect when done kind of thing... but not even that, really. You
will still be at the url of the wizard. If you want to have any data
sent to your receipt you have to do that in beforeReceipt() which will
execute during the same request just before rendering. But this method
will not have access to any data from the forms automatically, I just
checked. I will have to mod mine to do that too.
beforeReceipt() = method to use for loading data for receipt.ctp
receipt() = method will never run unless you do a POST or redirect to
here (from receipt.ctp)

/Martin

On Sep 29, 1:19 pm, mcphisto [EMAIL PROTECTED] wrote:
 My problem is that this form, divided in more pages, saves its data
 all in a unique table. So, if I save data in DB at each step, at the
 end I have 3 new entries with 3 steps.

 On 29 Set, 13:07, [EMAIL PROTECTED]

 [EMAIL PROTECTED] wrote:
  If you are referring to the component by jaredhoyt then yes the
  tutorial can be a little fuzzy on some points. It works great, though.
  Just make sure you read both pages of the article and the comments and
  any fuzzy bits should be taken care of.

  You have to create a receipt method (i.e. a place to end up after the
  wizard is done) but you ca call it anything you want and configure the
  component with the new name.

  As I understand this component (I have only played around with it a
  bit so far):
  You do no directly access the session data. The component populates
  this-data for each step whenever you step back and forth in the
  wizard.
  The component expects you to process and save data at each step, I
  think... Possibly you get all the data available in the receipt... not
  sure. What I do know is that data entered in step1 is not available to
  you in step2 (without going behind the components back and accessing
  the session directly).

  I needed each step to have the data of the previous steps so I had to
  modify the component a little. And then I had to direct my attention
  elsewhere for a while and have not finished the wizard I started...
  that's why my knowledge is so limited.

  /Martin

  On Sep 29, 12:43 pm, mcphisto [EMAIL PROTECTED] wrote:

   Hi all,
   I'm installing this component on my application to have a multi-page
   form. Everything work, but I really don't know how to save data in the
   database. The problem is that I can't find the session variables saved
   during the steps. The other thing I don't understand is if I need to
   create a function receipt in my controller. This part is not
   explained on tutorial.
   Anyone can help me?

   Thank you.- Nascondi testo citato

  - Mostra testo citato -
--~--~-~--~~~---~--~~
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: Problems with cipher behavior

2008-09-29 Thread Kanten

You were ofcause absolutely right. The problem was my field in the
database, which was too small. Changed it from VAR(11) to VAR(100) and
the problem was solved.

Thank you very much.

/Anders

On Sep 29, 1:21 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 FYI: I haven't used that behaviour at all.  :)

 The errors you pasted look like encoding issues. You might be
 encrypting data into a field that can't handle the input.
 mypassword is a good varchar(255) but my password ciphered might
 require a blob or at least some other charset.

 When I wrote my own mini-cipher I god pure binary data back from
 Cakes Security::cipher() and had to hex-encode the data before I could
 save it to the database. I also had to do the reverse when reading the
 data back. This was kind of a last-minute hack and I did not like to
 alter the database-schema of a live application.

 This is nothing advanced so here is my code as an example:

 function _encrypt($str) {
 $out = bin2hex(Security::cipher( $str, 'some salt' ));
 return $out;}

 function _decrypt($str) {
   $out = Security::cipher(pack('H*',  $str), 'some salt' );
   return $out;

 }

 After encryption it is bin2hexed and before decryption is is returned
 to binary data.

 On Sep 29, 12:58 pm, Kanten [EMAIL PROTECTED] wrote:

  Thanks, that removed the PHP errors.

  I still have some problems with the behaviour though. It correctly
  encrypts the data, but even though autoDecrypt is set to true, it
  doesn't decrypt the data. In the log the behaviour outputs:

  2008-09-29 11:53:40 Error: CipherBehavior::_unpackValue Enclosed salt
  missmatch: '—y÷' != 'G¡ œ' 8
  2008-09-29 11:53:40 Error: CipherBehavior::_decryptValue Could not
  unpack value from '—y÷G¡ œ'
  2008-09-29 11:53:40 Error: CipherBehavior::decrypt Could not decrpyt
  Patient::cpr: '$E$4kK+EF1+'

  /Anders

  On Sep 26, 3:21 pm, [EMAIL PROTECTED]

  [EMAIL PROTECTED] wrote:
   Hi Kanten,
   You are running this on an version of PHP where you are no longer
   supposed to define pass_by_reference in functions like before. LIke
   the error said you can allow it in php.ini or fix the behaviour. From
   a quick glance I'd say you could safely remove them since decrypt() is
   defined to accept the arguments as references.

   $this-decrypt($model, $result);
   See the two  there.

   /Martin

   On Sep 26, 2:43 pm, Kanten [EMAIL PROTECTED] wrote:

Hi,

I'm experimenting with 
thecipherbehavior:http://bakery.cakephp.org/articles/view/cipher-behavior

Unfortunately I keep getting the following error and can't seem to
figure out how to debug the script myself:

Warning: Call-time pass-by-reference has been deprecated; If you would
like to pass it by reference, modify the declaration of [runtime
function name](). If you would like to enable call-time pass-by-
reference, you can set allow_call_time_pass_reference to true in your
INI file in C:\wamp\www\cake\app\models\behaviors\cipher.php on line
90

The code section corresponding to this is:

 /** Model hook to decrypt model data if auto decipher is turned on in
the
    * model behavior configuration. Only primary model data are
decrypted. */
  function afterFind($model, $result, $primary = false) {
    if (!$result || !isset($this-config[$model-name]['cipher']))
      return $result;

    if ($primary  $this-config[$model-name]['autoDecrypt']) {
      // check for single of multiple model
      $keys = array_keys($result);
      if (!is_numeric($keys[0])) {
        $this-decrypt($model, $result);
      } else {
        foreach($keys as $index) {
          $this-decrypt($model, $result[$index]);
        }
      }
    }
    return $result;
  }

Any ideas?

/Anders


--~--~-~--~~~---~--~~
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: Form wizard component save data

2008-09-29 Thread [EMAIL PROTECTED]


I just noticed that the component restes the wizard before sending you
to the receipt. How I am supposed to show a receipt for a transaction
I no linger have access to, I don't know.

There is apparently also an afterComplete() action that the component
looks for just before resetting. I guess that is our last chance to
save out data in a session variable of out ow or something similar.



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



Crumbs - crumbs - crumbs

2008-09-29 Thread gabriel

I could probably do this easily in sessions BUT I don't want to
reinvent Cakes wheels. So, I have added
?=$html-addCrumb('Register', '/users/register');? in the
register.ctp view. and added the the ?=$html-getCrumbs();? in the
default.ctp layout. It only displays the current view and does not
remember the path like page1page2page3. ect.

Does any one know what do I do wrong?
Obvoiusly I will bless you if you can.;)
--~--~-~--~~~---~--~~
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: Adding to db without going to view..?

2008-09-29 Thread Gabriel Kolbe

Hi Rich

Thanks for that !! One more question..
If I want to change the
($this-UserFavourite-save($this-data)) {

where the controller gets the info from the view..
echo $form-input('user_id');
echo $form-input('item_id');

I want the controller not to go the the 'add' view but just add user
(in the session)($session-read('Auth.User.id')), to db, and also the
item_id which will be given in the URL like so:
testsite/user_favourites/add/2

Any idea how to do this??

Regards



On Fri, Sep 26, 2008 at 7:02 PM, Donkeybob [EMAIL PROTECTED] wrote:

 You use it the way you have it and just change the section in the add
 function to redirect . . .

 - $this-redirect(array('action'='view'));

 Every function should have a related view file unless you state
 otherwise with a layout call.

 if your action is add then you have to have an add function in the
 controller, which uses the add view. . . .just redirect it in your
 statement.

 function add() {
if (!empty($this-data)) {
$this-UserFavourite-create();
if ($this-UserFavourite-save($this-data)) {
$this-Session-setFlash(__('The
 UserFavourite has been saved', true));
$this-
redirect(array('action'='view'));
} else {
$this-Session-setFlash(__('The
 UserFavourite could not be saved. Please, try again.', true));
$this-
redirect(array('action'='view'));
}
}
}


 hope this is a start
 rich


 On Sep 26, 10:59 am, gabriel [EMAIL PROTECTED] wrote:
 Hi, does anyone know how I can add  (like a favourite to a db table)
 without going to the add view?

 I have a link
 testsite/user_favourites/add/2

 IF I click on it it, it takes me to the add view (which has a model
 and controller)
 I DON'T want to go to the add view, but the 'view' view which shows
 the favourite that had just been added... here is the add controller
 and view and model

 
 controller /
 function add() {
 if (!empty($this-data)) {
 $this-UserFavourite-create();
 if ($this-UserFavourite-save($this-data)) {
 $this-Session-setFlash(__('The 
 UserFavourite has been saved',
 true));
 $this-redirect(array('action'='index'));
 } else {
 $this-Session-setFlash(__('The 
 UserFavourite could not be saved.
 Please, try again.', true));
 }
 }
 $users = $this-UserFavourite-User-find('list');
 $this-set(compact('users'));
 }

 
 model//
 class UserFavourite extends AppModel {

 var $name = 'UserFavourite';
 var $validate = array(
 'id' = array('numeric'),
 'user_id' = array('numeric'),
 'item_id' = array('numeric')
 );

 //The Associations below have been created with all possible keys,
 those that are not needed can be removed
 var $belongsTo = array(
 'User' = array('className' = 'User',
 'foreignKey' 
 = 'user_id',
 'conditions' 
 = '',
 'fields' = 
 '',
 'order' = ''
 )
 );

 }

 ///
 view//
 div class=userFavourites form
 ?php echo $form-create('UserFavourite');?
 fieldset
 legend?php __('Add UserFavourite');?/legend
 ?php
 echo $form-input('user_id');
 echo $form-input('item_id');
 ?
 /fieldset
 ?php echo $form-end('Submit');?
 /div
 div class=actions
 ul
 li?php echo $html-link(__('List UserFavourites', true),
 array('action'='index'));?/li
 li?php echo $html-link(__('List Users', true),
 array('controller'= 'users', 'action'='index')); ? /li
 li?php echo $html-link(__('New User', true),
 array('controller'= 'users', 'action'='add')); ? /li
 /ul
 /div
 


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

Re: Problems with cipher behavior

2008-09-29 Thread [EMAIL PROTECTED]

FYI: I haven't used that behaviour at all.  :)

The errors you pasted look like encoding issues. You might be
encrypting data into a field that can't handle the input.
mypassword is a good varchar(255) but my password ciphered might
require a blob or at least some other charset.

When I wrote my own mini-cipher I god pure binary data back from
Cakes Security::cipher() and had to hex-encode the data before I could
save it to the database. I also had to do the reverse when reading the
data back. This was kind of a last-minute hack and I did not like to
alter the database-schema of a live application.

This is nothing advanced so here is my code as an example:

function _encrypt($str) {
$out = bin2hex(Security::cipher( $str, 'some salt' ));
return $out;
}
function _decrypt($str) {
  $out = Security::cipher(pack('H*',  $str), 'some salt' );
  return $out;
}

After encryption it is bin2hexed and before decryption is is returned
to binary data.


On Sep 29, 12:58 pm, Kanten [EMAIL PROTECTED] wrote:
 Thanks, that removed the PHP errors.

 I still have some problems with the behaviour though. It correctly
 encrypts the data, but even though autoDecrypt is set to true, it
 doesn't decrypt the data. In the log the behaviour outputs:

 2008-09-29 11:53:40 Error: CipherBehavior::_unpackValue Enclosed salt
 missmatch: '—y÷' != 'G¡ œ' 8
 2008-09-29 11:53:40 Error: CipherBehavior::_decryptValue Could not
 unpack value from '—y÷G¡ œ'
 2008-09-29 11:53:40 Error: CipherBehavior::decrypt Could not decrpyt
 Patient::cpr: '$E$4kK+EF1+'

 /Anders

 On Sep 26, 3:21 pm, [EMAIL PROTECTED]

 [EMAIL PROTECTED] wrote:
  Hi Kanten,
  You are running this on an version of PHP where you are no longer
  supposed to define pass_by_reference in functions like before. LIke
  the error said you can allow it in php.ini or fix the behaviour. From
  a quick glance I'd say you could safely remove them since decrypt() is
  defined to accept the arguments as references.

  $this-decrypt($model, $result);
  See the two  there.

  /Martin

  On Sep 26, 2:43 pm, Kanten [EMAIL PROTECTED] wrote:

   Hi,

   I'm experimenting with 
   thecipherbehavior:http://bakery.cakephp.org/articles/view/cipher-behavior

   Unfortunately I keep getting the following error and can't seem to
   figure out how to debug the script myself:

   Warning: Call-time pass-by-reference has been deprecated; If you would
   like to pass it by reference, modify the declaration of [runtime
   function name](). If you would like to enable call-time pass-by-
   reference, you can set allow_call_time_pass_reference to true in your
   INI file in C:\wamp\www\cake\app\models\behaviors\cipher.php on line
   90

   The code section corresponding to this is:

    /** Model hook to decrypt model data if auto decipher is turned on in
   the
       * model behavior configuration. Only primary model data are
   decrypted. */
     function afterFind($model, $result, $primary = false) {
       if (!$result || !isset($this-config[$model-name]['cipher']))
         return $result;

       if ($primary  $this-config[$model-name]['autoDecrypt']) {
         // check for single of multiple model
         $keys = array_keys($result);
         if (!is_numeric($keys[0])) {
           $this-decrypt($model, $result);
         } else {
           foreach($keys as $index) {
             $this-decrypt($model, $result[$index]);
           }
         }
       }
       return $result;
     }

   Any ideas?

   /Anders
--~--~-~--~~~---~--~~
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: May or may not have one relationship

2008-09-29 Thread Novice Programmer
Polymorphic behavior on bakery helped me .. just fyi.. in case some one else
is also stuck in such a situation.

Thanks.

On Mon, Sep 29, 2008 at 1:15 PM, grigri [EMAIL PROTECTED] wrote:


 Doesn't really seem much point.

 When retrieving an `Entity`, cake will as for the join to be performed
 so that both entries will be retrieved in a single query.

 To only retrieve the `User` on a condition in the `Entity` table,
 you'd have to first retrieve the `Entity` and then (sometimes)
 retrieve the `User`. The overhead of a separate query is much higher
 than a join that will never happen, assuming your tables are indexed
 correctly.

 You can always conditionally delete the empty User() array from the
 results in afterFind(), if you feel it's necessary.

 hth
 grigri

 On Sep 28, 9:15 am, Novice Programmer [EMAIL PROTECTED]
 wrote:
  Hello All,
 
  This might be an awkward situation but for my current project i am having
 a
  situation where a table Entity may or not have a user. In the entities
 table
  there is a field which tells me whether there is some user associated
 with
  it or not. I want to handle the situation with cake php so that it tries
 to
  join Entity with User only when that particular field in entity is set.
 Is
  there some out there to help me?
 
  --
  Thanks  Regards,
  Novice.
 



-- 
Thanks  Regards,
Novice.

--~--~-~--~~~---~--~~
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: help with YAML pls basic syntax...etc

2008-09-29 Thread mark_story

Couldn't you use the builtin Schema shell to do your migrations?  and
not have to muck with YAML?

-Mark

On Sep 29, 3:13 am, forrestgump [EMAIL PROTECTED] wrote:
 OK i made some changed to the code as follows
 UP:
   create_table:
 users:
   username:
 type: varchar
 length: 100
 index: true
   password:
 type: varchar
 length: 100

   query:
 users: INSERT INTO users SET username = 'admin' and password=
 'admin'

 DOWN:
   query:
 users: DELETE FROM users WHERE username = 'admin' and password=
 'admin'
   drop_table: users

 It has successfully created the users table and the collumns i
 require, including two additional ones i dont require(created,
 modified)
 yet no data was insertedwhere am i going wrong?

 On Sep 29, 12:00 pm, forrestgump [EMAIL PROTECTED] wrote:

  Can someone tell me what is wrong with the following YAML code ? \

  UP:
create_table:
  users:
id:
  type: integer
  length: 11
  primary: true
  autoincrement: true
username:
  type: varchar
  length: 100
  index: true
password:
  type: varchar
  length: 100

query:
  users: INSERT INTO users SET username = 'admin' and password=
  'admin'

  DOWN:
drop_table: users
query:
  users: DELETE FROM users WHERE username = 'admin' and password=
  'admin'

  what i want it to do is, create a table users with fields
  [id,username,password] and then insert data into it
  [0,admin,admin]wht YAML is doing for me is...
  it create a table users with fields [id,created,modified] and another
  table autoincrement with fields  [id,username,password] , and nothing
  gets inserted

  I would really appreciate some help ive been stuck on this since 2
  daysim writing a short tutorial on cakephp migrations that i wish
  to shareand this will really help...

  Forrestgump
  (yes i know very original nick name :) )
--~--~-~--~~~---~--~~
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 with link to mydomain.com

2008-09-29 Thread dr. Hannibal Lecter

You can also use this:

Router::url(array('controller'='users','action'='activate',$key),
true);

Note the second parameter, true, which will make the Router return
the full URL.

Internally, it is using FULL_BASE_URL as teknoid suggested, but I
think it's cleaner to let the Router take care of the proper URL
rather than doing it manually.

On Sep 27, 7:16 pm, donnerbeil [EMAIL PROTECTED] wrote:
 Hi,

 When a user registers on my site, an email with an activation link is
 sent to him. In the email templates I would like to use something like
 echo $html-link('controller'='users','action'='activate',$key). But
 when this link is shown in the email it links to /users/activate/[key]

 How can I tell cakephp, that it has to puthttp://www.mydomain.comin
 front of the url, so that it works when someone clicks on the link in
 the email?

 any ideas?

 Thanks

 Donnerbeil
--~--~-~--~~~---~--~~
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: Form wizard component save data

2008-09-29 Thread mcphisto

I find it strange that this wizard looses its varibales/data during
the steps. If it would be like this, you shouldn't see data when you
go back to a previous step. You shuold loose everything. If you move
your debug value to 3, you're able to see data in your session. So I
could see that in third step, I've data of the first step, the only
problem is that if I use a normal save-data, it doesn't work. Is
there anyone else who had the same problem as me and Martin?

On 29 Set, 14:27, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 I just noticed that the component restes the wizard before sending you
 to the receipt. How I am supposed to show a receipt for a transaction
 I no linger have access to, I don't know.

 There is apparently also an afterComplete() action that the component
 looks for just before resetting. I guess that is our last chance to
 save out data in a session variable of out ow or something similar.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



CakePHP RC2 Output Control

2008-09-29 Thread Kusok

Hello,

I noticed after migrating from the alpha version of 1.2, that in RC2
controllers dump html no matter what you do to try and stop it.

For example:

in the beforeFilter I type die('asd') and I would expect it to just
type asd on the page and debug info (depends on settings), but what I
get is
html
head /head
bodyasd/body
/html

Why is this? Basically the issue is that it is breaking my captcha
generation and email image generator (so emails cannot be copied by
bots).
I tried disabling autoRender, setting layout to null and nothing
helps.

Any ideas how to fix this?
--~--~-~--~~~---~--~~
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: This Router test fails when using named parameters.

2008-09-29 Thread Mathew

I've been debugging this code, and I'm confused as to how Routing is
suppose to work with named parameters.

In the Router.php file in the function mapRouteElements there is this
logic.

if (!strpos($route[0], '*')  (!empty($pass) || !empty($named))) {
  return false;
}

This will return false from mapRouteElement if the named array is not
empty. So if there are named parameters they are not getting handled,
and after returning to Router::url() it continues to build a simple /
gems/gemsProfiles/show/username:mustan9 URL.

It it be possible that this code is broken?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



migration to 1.2

2008-09-29 Thread mcphisto

Hi I was migrating an appilcation on mine to 1.2. Everything works
fine, except for the select fields in forms. I would like to know hoew
to remove labels from the list. Another problem (i'll try to explain
as better as I can) is with data. I've a table with 3 fields, name,
last_name, ID. In my table there are only 2 records and they are: ID:
1, Name: Steven, Last_name: Warren. The other is ID:2, Name: Max,
Last_name: Test. Well in my select I've 6 selectable data. I have this
choices: 1, Steven, Worren, 2, Max, Test.

Here's my code (add.ctp):

   td?php echo $form-label('Practice/lawyer_id',
'Avvocato');?/td
td?php echo $form-select('Practice/lawyer_id', $lawyers, $form-
value('Practice/lawyer_id'), array (), array(), true);?/td
td?php echo $form-error('Practice/lawyer_id', 'Seleziona un
avvocato.') ?/td/tr

(and my controller)

$this-set('lawyers', $this-Practice-Lawyer-
findAll(null,'last_name','last_name ASC',null,null,-1));
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Containable Behaviour

2008-09-29 Thread gmwebs

I am trying out the Containable behaviour but am not getting the
correct result (or at least my expected result!).

I have a DealerAddress model (for their head office) which is
associated to a DealerBranchAddress model (for their branch address)
and I want to be able to return all dealers in a specific region. This
needs to be whether their head office or their branch office is in
that region.

So I have tried the following:

$this-DealerAddress-find('all',
array('conditions'=array('DealerAddress.region_id'=64), 'contain' =
array('DealerBranchAddress'=array('conditions'=array('DealerBranchAddress.region_id'=64));

That doesn't return the correct result as it seems to be appending an
AND clause to the query
which I can see in the debug output as SELECT blah WHERE
`DealerBranchAddress`.`region_id` = 64 AND
`DealerBranchAddress`.`dealer_id` = (3).

I want it to be (pseudo code): find all DealerAddress and
DealerBranchAddress where region_id=64

Which should return all my dealer addresses, whether it's their head
or branch office, in region 64.

Any help would be good 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: Form wizard component save data

2008-09-29 Thread [EMAIL PROTECTED]

I wasn't clear enough. It does not loose the data. It just won't
provide the controller with the data since it expects each step to be
totally isolated from previous ones. The session-storage is really
only designed to populate the form-fields of each step should you wish
choose to go backwards. It was not meant to give you access to it for
a final save at the end of the wizard.

I find it a bit strange but looking at the source it is clear this is
a design decision and not a bug. If you want to have access to the
full data at the end of the wizard (without hacking into the session
data from the controller) you must modify the component or suggest
changes to the original developer.

in short: controller::data is populated from a session key for the
current step not a common key e.g. Wizard.step1 not
Wizard.data.
What I did was to make the wizard also:
• merge new data  and old session-data and save that separately
(in a common session-key)
• return this combined data to the controller on each request.

A small mod is not difficult and if your changes do not break anything
else you can suggest an improvement and provide an implementation.
For what you need (as I understand it) you could look for
afterComplete in the source and set the controllers data property
with all the data before executing that method.

Like this for example:
find:
if(method_exists($this-Controller,'afterComplete')) {
$this-Controller-afterComplete();
}

replace with:
if(method_exists($this-Controller,'afterComplete')) {
foreach ( $this-setps as $a_step ) {
$this-Controller-data = array_merge_recursive($this-Session-
read($this-sessionKey.$a_step),$this-Controller-data);
}
$this-Controller-afterComplete();
}

in the method afterComplete() you would then have a $this-data
containing the data from all steps.


/Martin





On Sep 29, 4:01 pm, mcphisto [EMAIL PROTECTED] wrote:
 I find it strange that this wizard looses its varibales/data during
 the steps. If it would be like this, you shouldn't see data when you
 go back to a previous step. You shuold loose everything. If you move
 your debug value to 3, you're able to see data in your session. So I
 could see that in third step, I've data of the first step, the only
 problem is that if I use a normal save-data, it doesn't work. Is
 there anyone else who had the same problem as me and Martin?

 On 29 Set, 14:27, [EMAIL PROTECTED]

 [EMAIL PROTECTED] wrote:
  I just noticed that the component restes the wizard before sending you
  to the receipt. How I am supposed to show a receipt for a transaction
  I no linger have access to, I don't know.

  There is apparently also an afterComplete() action that the component
  looks for just before resetting. I guess that is our last chance to
  save out data in a session variable of out ow or something similar.
--~--~-~--~~~---~--~~
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: This Router test fails when using named parameters.

2008-09-29 Thread Nate

You're trying to make it do two different things.  Named parameter
format is:

/profiles/username:mustan9

Normal parameter format is:

/profiles/mustan9.

The latter has nothing to do with CakePHP's notion of 'named
parameters'.  Please refer to 
http://book.cakephp.org/view/46/Routes-Configuration

On Sep 29, 10:06 am, Mathew [EMAIL PROTECTED] wrote:
 I've been debugging this code, and I'm confused as to how Routing is
 suppose to work with named parameters.

 In the Router.php file in the function mapRouteElements there is this
 logic.

 if (!strpos($route[0], '*')  (!empty($pass) || !empty($named))) {
   return false;

 }

 This will return false from mapRouteElement if the named array is not
 empty. So if there are named parameters they are not getting handled,
 and after returning to Router::url() it continues to build a simple /
 gems/gemsProfiles/show/username:mustan9 URL.

 It it be possible that this code is broken?
--~--~-~--~~~---~--~~
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 can I destroy cookies

2008-09-29 Thread Damelinks

Goodday Everybody, I set cookie by using the codes below

?php
$cookie_expire = time()+3600;
$cookie_name = users;
$cookie_value = $_POST[f_name] $_POST[s_name];
$ret = setcookie('users', $cookie_value, $cookie_expire, /);if (!
$ret)
{
echo Unable ot set cookie;


}


?

and the cookie was actually set and are working as espected but I am
trying to destroy the cookie using the codes below.


?php
setcookie('users', 'NULL', mktime()-1, '/');
?


but it is not destroying the cookies.  Please I need your help
because
I am using the cookies for users authentation.


I am using the cookie to check if users logged in properly.


Thanks


Damelinks


--~--~-~--~~~---~--~~
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 repair broken ACL tree structure?

2008-09-29 Thread RobsonM

Cakephp Acl behavior sems not to work correctly. Application after few
weeks of working on production server has some of Acos broken (in fact
all tree structure is corrupted).

Can Acl system  be used to repair a damaged tree (basing on the
parent_id fields)?
Or maybe some1 has got algorithm (cakephp wise) to fill corrupted lft
rght values with correct ones?

Cakephp v1.2.0.7125 RC1;


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



please help me with paypal integration

2008-09-29 Thread rasheed

hi iam rasheed from hyderabad,india
i am new to cakephp and never done any paypal integration.

i am using paypal component(BY Mariano Iglesias), i am able to include
PEAR and paypal component in to my application but i am completely
clue less about it's implementation in my application

please help me to complete this task.

please try to send an simple application which demonstrate paypal
integration.


Thanks in advance

M A Rasheed
rasheed 77 @ G mail . 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
-~--~~~~--~~--~--~---



SQL Query String

2008-09-29 Thread paolo

How can I print the SQL Query String in the controller class.

Ex. SELECT `posts`.`id`  FROM

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



repair ACL acos tree cakephp

2008-09-29 Thread Robson

Few weeks ago we introduced application to our customer.
It all went just fine untill now .
System's rights are based on built-in CAKE-PHP ACL Behaviour.
Today i got a call from the customer that users keep reporting not
having enough rights.
Acos table is  massive (15k records) and grows, so analyzes aren't
easy.
Atm we introduced some kind of workaround and it works - partially
skipping acl part.
After some time i discovered that some record in DB have same lft and
rght values, so obviously tree structure is broken.
Does it mean that Tree or ACL behavior doesn't work correctly?
If we wont fix it, we will be forced to bypass usage of ACL in this
App (we loose time we spend on implementing ACL already)

Can  Acl system be used to repair a damaged tree (based on the
parent_id fields)?
If so, please post the algorithm we could use.

CAKE v.1.2.0.7125 RC1
MySQL client version: 5.0.27
PHP: 5

Rob

PS. Sorry for my english.

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



Print SQL Query String

2008-09-29 Thread paolo

Hello there,

How can I print/display SQL Query String in the view area? Like
SELECT `posts`.`id`, `posts`.`title` ... FROM `posts` WHERE ...
Thanks

Paolo

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



Help with TranslateBehavior needed.

2008-09-29 Thread Linas

Hello,

I'm trying to use TranslateBehavior for my project. I describe my
model like that:

class Service extends AppModel {
 var $name = 'Service';
 var $actsAs = array('Translate' = array('title', 'abstract',
'text'));
 // table services also has fields like id, parent_id, order,
created, etc.
}

These virtual fields (title, abstract, text) are great abstraction and
I was very happy thinking how easy it will be to provide content
management in various languages. Then I found out that model would not
load Service from DB if some field in specified locale was missing.
Is there any simple way to change this behavior so that Service with
null fields would be loaded? As far as I understand, I can specify an
array of preferred locales, but how do I recognize which locale was
actually loaded?
Thanks.

Linas



--~--~-~--~~~---~--~~
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: Auth Redirect Problems

2008-09-29 Thread Chris Tomlinson



LunarDraco wrote:
 
 
 Here are the changes I made
 Auth.php
 at about line 300 look for this:
 if ($loginAction == $url) {
   if (empty($controller-data) || 
 !isset($controller-data[$this-
userModel])) {
   if (!$this-Session-check('Auth.redirect') 
 env('HTTP_REFERER')) {
   $this-log('302 session.write 
 auth.redirect '.$url);
   
 $this-log('Controller-referer()'.$controller-referer());
   $this-Session-write('Auth.redirect', 
 $controller-referer());
   }
   return false;
   }
 -
 Change to:
 -
 if ($loginAction == $url) {
   if (empty($controller-data) || 
 !isset($controller-data[$this-
userModel])) {
   if (!$this-Session-check('Auth.redirect')  
 env('HTTP_REFERER')
  !$this-Session-check('Auth.loggedout')) {
   $this-log('302 session.write 
 auth.redirect '.$url);
   
 $this-log('Controller-referer()'.$controller-referer());
   $this-Session-write('Auth.redirect', 
 $controller-referer());
   }
   return false;
   }
 -
 
 Then change the auth logout function to look like:
   function logout() {
   $this-__setDefaults();
   $this-Session-del($this-sessionKey);
   $this-Session-del('Auth.redirect');
   $this-Session-write('Auth.loggedout',true);
   $this-_loggedIn = false;
   return Router::normalize($this-logoutRedirect);
   }
 
 
 I hope this is helpful to everyone. I've spent a better part of a day
 chasing this little bugger.
 
 

Definitely helpful. Thanks! I was working on the same problem on Friday and
was pretty much heading towards the same solution. I have made a slight
change though which is to add these auth.php alterations to an extended
AuthComponent class. This means no core hacks are required but since I had
already extended AuthComponent in the past for other reasons there was no
overhead involved with changing the rest of my site's code.
-- 
View this message in context: 
http://n2.nabble.com/Auth-Redirect-Problems-tp1078183p1125460.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
-~--~~~~--~~--~--~---



Simple question about Auth Component

2008-09-29 Thread Jérémy

Hi,
I am very new with CakePHP and I am trying to set up an authentication
system using the Auth component provided.

How can I show the logged user's name on a view ? Let's say the user
John logged in successfully, I would like to put something like
Logout [John] in the default layout. How can I get this John
string ?

Thank you,
Jérémy

--~--~-~--~~~---~--~~
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: Change Auth component will solve hash without salt?

2008-09-29 Thread michael h

Note: Google Groups seemed to have eaten my first attempt, I hope this
isn't a repost!

I am also stuck on this hashing issue with my existing database.
However, I can't figure out how to create an appropriate object. Could
someone take a look at the component I created and help me find what's
missing?? Thanks!

/* The app controller: */
var $components = array('Auth', 'ScupAuth');
function beforeFilter() {
Security::setHash('md5');
$this-Auth-authorize = $this-ScupAuth;
}

/* My custom controller: */

?php

App::import(array('Router', 'Security'));

class ScupAuthComponent extends Object {
//var $components = array(Auth);
function initialize($controller) {
$this-controller = $controller;
}

function hashPasswords($data) {
if (isset($data[$this-controller-Auth-userModel])) {
if 
(isset($data[$this-controller-Auth-userModel][$this-
controller-Auth-fields['username']])  isset($data[$this-
controller-Auth-userModel][$this-controller-Auth-
fields['password']])) {

$data[$this-controller-Auth-userModel][$this-controller-Auth-
fields['password']] = $this-password($data[$this-controller-Auth-
userModel][$this-controller-Auth-fields['password']]);
}
}
}

function password($password) {
return Security::hash($password, null, false);
}
}

On Sep 14, 10:08 pm, Yodi Aditya [EMAIL PROTECTED] wrote:
 I have read about auth component inhttp://manual.cakephp.org.
 then, i found this :

  The Security class uses a salt value (set in /app/config/core.php) to
 encrypt the password. If you have an existing database that previously used
 an encryption scheme without a salt, set
 authorizehttp://manual.cakephp.org/view/566/view/396/authorizeif not
 already set, and create the method
 password http://manual.cakephp.org/view/386/password in the class you
 nominate. 

 Whew... hope it's help someone that have same problem with me :D

 On 9/12/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:



  thanks martin. thats help me solve my problem.

  On 9/11/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

   There are at least two ways to stop AuthComponent from using the salt.

   I think the simple hacky way for you in this case is to alter that one
   line of code in Auth and keep it in your list of small tweaks I have
   done (I have one of those).
   Line 811
   return Security::hash($password, null, true);
   should read
   return Security::hash($password, null, false);

   You can avoid modifying Auth by assigning the authenticate property to
   an object you have created. Then you can hash any way you like in that
   object. Look at hashPasswords() in Auth. This method delegates the
   hashing to an authenticate object if you have set one.

   /Martin

   On Sep 11, 11:50 am, Yodi Aditya [EMAIL PROTECTED] wrote:
   Thanks David,

   I want password in table hashing with sha1 only and without
  security.salt.
   in another way, it will make me easy using same table with different
   framework or CMS.
   cause sha1 is include on most CMS / framework. Salt? i don't think so.

   Cookies needed for  remember me  on login form.
   I need security.salt to hash them and I don't put user password on
   cookies.

   I think someone has same problem with me.
   Just in some case, you want to build some cakephp based site.
   but, received some user and password data (hashed with sha1) before.

   how to use this with Auth component...

   On 9/11/08, David C. Zentgraf [EMAIL PROTECTED] wrote:

Not quite sure I understand your particular issue, but why is the
password in your DB pure SHA1?
If you're using the Auth component all the way, it will hash the
password including Salt when the user registers, so the only thing
that should go into the db is SHA1(salt.password). And every time the
user logs in, Auth uses the same SHA1(salt.password) for checking.

If of course you got the passwords into the DB in another way, using
only SHA1(password), you'll get conflicting results...

And what do you want to do with cookies?

Chrs,
Dav

On 11 Sep 2008, at 15:36, Yodi Aditya wrote:

 Hey, dude.
 Thanks, that's right sha1 is default hashing in auth component.
 i just convience that using correct hashing sha1 in my controller
 using
 beforeFilter().

 But,
 I say before, security.salt needed not only for Auth but hashing
 cookies
 too.
 Disable security.salt is a bad solution.

 I'm login using Auth component, just like this :

 function login() {
 if ($this-Auth-user()) {
            if (!empty($this-data)) {
            $this-redirect($this-Auth-redirect());
            }
      }
 }

 user() check username and password automatically.
 When checking password, Auth always hashing 

Re: Change Auth component will solve hash without salt?

2008-09-29 Thread michael h

I'm still stuck on this same issue because I don't know how to
properly create an object. The custom controller I created doesn't
seem to cut it. Since I've been stuck on this for days any help would
be greatly appreciated!! Thanks!

/* My custom controller: */

App::import(array('Router', 'Security'));

class ScupAuthComponent extends Object {
function initialize($controller) {
$this-controller = $controller;
}

function hashPasswords($data) {
if (isset($data[$this-controller-Auth-userModel])) {
if 
(isset($data[$this-controller-Auth-userModel][$this-
controller-Auth-fields['username']])  isset($data[$this-
controller-Auth-userModel][$this-controller-Auth-
fields['password']])) {

$data[$this-controller-Auth-userModel][$this-controller-Auth-
fields['password']] = $this-password($data[$this-controller-Auth-
userModel][$this-controller-Auth-fields['password']]);
}
}
}

function password($password) {
return Security::hash($password, null, false);
}
}

/* The app controller: */

class AppController extends Controller {
var $components = array('Auth', 'ScupAuth');
function beforeFilter() {
Security::setHash('md5');
$this-Auth-userModel = 'Person';
$this-Auth-fields = array(
'username' = 'email',
'password' = 'password'
);
$this-Auth-authorize = $this-ScupAuth;
$this-Auth-loginAction = array('controller' = 'people', 
'action'
= 'login');
$this-Auth-loginRedirect = '/';
}
}

On Sep 14, 10:08 pm, Yodi Aditya [EMAIL PROTECTED] wrote:
 I have read about auth component inhttp://manual.cakephp.org.
 then, i found this :

  The Security class uses a salt value (set in /app/config/core.php) to
 encrypt the password. If you have an existing database that previously used
 an encryption scheme without a salt, set
 authorizehttp://manual.cakephp.org/view/566/view/396/authorizeif not
 already set, and create the method
 password http://manual.cakephp.org/view/386/password in the class you
 nominate. 

 Whew... hope it's help someone that have same problem with me :D

 On 9/12/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


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



Saving self-referential-HABTM relationships...

2008-09-29 Thread wallerdm

Dear All,

Forgive me if this is covered elsewhere. I'm playing with cakePHP as
an alternative to Rails and am getting to grips with it by creating a
really simple social network app.

I've got some nice authentication and user profiles sorted and that's
all displaying great but now I've come to add the add as a friend
functionality and I'm struggling.

Every user in the users table has an id and I also have a table
set up, users_users, to hold the self referential join. This table
has a an id, a user_id and a friend_id.

My user model contains the following...

?php
class User extends AppModel {

var $name = 'User';
var $hasOne = 'Profile';
var $hasMany = array('Status' = array('order' = 'Status.created
DESC' ));

var $hasAndBelongsToMany = array(
'Friend' = array('className' = 'User',
'joinTable' = 'users_users',
'foreignKey' = 'user_id',
'associationForeignKey' = 
'friend_id'
),
'Admirer' = array('className' = 'User',
'joinTable' = 'users_users',
'foreignKey' = 'friend_id',
'associationForeignKey' = 
'user_id'
)
);

}
?

And my users_controller contains...

?php
class UsersController extends AppController {

.
function addfriend($friend_id = null) {
$user_id = $this-Session-read('User');
$this-data['User']['id'] = $user_id['id'];
$this-data['Friend']['id'] = $friend_id;
print_r($this-data);
if($this-User-saveAll($this-data)){
echo 'saved';
}else{
echo 'failed';
}
}
.

}
?

Now I know that I've got the data element wrong for the database save
because it isn't working and the SQL that's generated when you add a
friend is incorrect.

If you're logged in as a user with id 1 and want to become friends
with the user with id 4 (http://localhost/network/users/addfriend/4),
you get...

data = Array ( [User] = Array ( [id] = 1) [Friend] = Array ( [id]
= 4 ) )

...and the SQL from the CakePHP debug panel is...

UPDATE `users` SET `id` = 1 WHERE `users`.`id` = 1

Is anyone able to help me get this whole self-referential-HABTM
relationship thing sorted?

Thanks in advance.

Dave.

--~--~-~--~~~---~--~~
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 do I destroy cookies

2008-09-29 Thread Damelinks

Goodday Everybody, I set cookie by using the codes below

?php
$cookie_expire = time()+3600;
$cookie_name = users;
$cookie_value = $_POST[f_name] $_POST[s_name];
$ret = setcookie('users', $cookie_value, $cookie_expire, /);if (!
$ret)
{
echo Unable ot set cookie;


}


?

and the cookie was actually set and are working as espected but I am
trying to destroy the cookie using the codes below.


?php
setcookie('users', 'NULL', mktime()-1, '/');
?


but it is not destroying the cookies.  Please I need your help
because
I am using the cookies for users authentation.


I am using the cookie to check if users logged in properly.


Thanks


Damelinks


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



cache file update problem

2008-09-29 Thread wowfka

Hello,

I am newbie to this workgroup, have tried to search about problem but
cant find any solutions.
My problem is that cake didnt clear-update my cache file. For ex:

//Here i cache my action
function view_page(slug = null){
...
$this-cacheAction = +1  day;


}

//Here trying to update record
function admin_edit_page(id = null){
 if(!empty($this-data)){

   $this-data['Page']['modified'] = time();

 if($this-Page-save($this-data)){

$this-Session-setFlash('Puslapis: '.$this-data['Page']
['page_name'].' pakeistas.');
$this-redirect(/admin/pages/view_pages/);
exit;

  }
if($id != null){
$this-set('page',$this-Page-findById($id));
}
  $this-set('list_data', $this-Page-Cat-generatetreelist(null,
'{n}.Cat.id', '{n}.Cat.cat_name', '-'));
}

But after update operation file in tmp/cache/view is still there. I
think that it should be deleted after update ? Dont know how cake
recognises file which it should delete, by url? if so maybe problem
that i am using slugs and translate behaviour. my url's look /eng/page/
testpage, and in cache dir file look
mano_lit_page_kontaktai.php  (mano) is subfolder in server docs
root.

Thank you.

--~--~-~--~~~---~--~~
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: validate alphanumeric

2008-09-29 Thread [EMAIL PROTECTED]

The manual says I could overdefined any built-in validate rule.

So I added alphaNumeric function to the app_model.php

function alphaNumeric($check){
//alphaNumeric felüldefiniálása a magyar ékezetek kezelése érdekénben
$_this = Validation::getInstance();
$_this-__reset();
$_this-check = $check;

if (is_array($check)) {
$_this-_extract($check);
}

if (empty($_this-check)  $_this-check != '0') {
return false;
}

$_this-regex = '/[^\\dA-ZÍÖÜÓŐÚÉÁŰ ]/i';
if ($_this-_check() === true) {
return false;
} else {
return true;
}
}

This is the method from validation.php, I just changed the regex. But
I get an error message
Warning (2): preg_match() expects parameter 2 to be string, array
given [CORE/cake/libs/validation.php, line 830]

I am a little bit confused.

Any idea?
--~--~-~--~~~---~--~~
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: Help with TranslateBehavior needed.

2008-09-29 Thread jitka (poLK)

It is price for performance and as simple db query as possible.
If you need to know (with multiple preferred locales set) which
translatios are missed, you will have to bind hasMany associations for
translated fields, like

var $actsAs = array('Translate' = array(
'title' = 'Titles',
'abstract' = 'Abstracts',
'text' = 'Texts'
));

or

$this-Service-bindTranslation(array(
'title' = 'Titles',
'abstract' = 'Abstracts',
'text' = 'Texts'
), false);

and then explore returned data for these associations.

Better would be validate translated data before saving (to have all
fields translated, or saved with empty|default string), off course.
Fact that record with missed translation is not returned (when single
locale is set) is intended behavior.
--~--~-~--~~~---~--~~
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: Print SQL Query String

2008-09-29 Thread Daniel Hofstetter

Hi Paolo,

 How can I print/display SQL Query String in the view area? Like
 SELECT `posts`.`id`, `posts`.`title` ... FROM `posts` WHERE ...
 Thanks

In app/config/core.php set debug to 2.

--
Daniel Hofstetter
http://cakebaker.42dh.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: Containable Behaviour

2008-09-29 Thread mark_story

I don't think containable will do this for you.  Supplying additional
conditions to containments only further restricts the associations of
the initial find.  Currently your code is doing the following

find all DealerAddresses in region 64.  For each DealerAddress you
found only return the related DealerBranchAddress' if its region is
64.

Containable will only limit the related models found on the initial
find. Not perform additional reverse lookups.
hope that helps.

-Mark

On Sep 29, 10:51 am, gmwebs [EMAIL PROTECTED] wrote:
 I am trying out the Containable behaviour but am not getting the
 correct result (or at least my expected result!).

 I have a DealerAddress model (for their head office) which is
 associated to a DealerBranchAddress model (for their branch address)
 and I want to be able to return all dealers in a specific region. This
 needs to be whether their head office or their branch office is in
 that region.

 So I have tried the following:

 $this-DealerAddress-find('all',
 array('conditions'=array('DealerAddress.region_id'=64), 'contain' =
 array('DealerBranchAddress'=array('conditions'=array('DealerBranchAddress.region_id'=64));

 That doesn't return the correct result as it seems to be appending an
 AND clause to the query
 which I can see in the debug output as SELECT blah WHERE
 `DealerBranchAddress`.`region_id` = 64 AND
 `DealerBranchAddress`.`dealer_id` = (3).

 I want it to be (pseudo code): find all DealerAddress and
 DealerBranchAddress where region_id=64

 Which should return all my dealer addresses, whether it's their head
 or branch office, in region 64.

 Any help would be good 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: Simple question about Auth Component

2008-09-29 Thread Daniel Hofstetter

Hi Jérémy,

 I am very new with CakePHP and I am trying to set up an authentication
 system using the Auth component provided.

 How can I show the logged user's name on a view ? Let's say the user
 John logged in successfully, I would like to put something like
 Logout [John] in the default layout. How can I get this John
 string ?

Have a look at the user() method of the AuthComponent.

Hope that helps!

--
Daniel Hofstetter
http://cakebaker.42dh.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: Help with TranslateBehavior needed.

2008-09-29 Thread Linas

Thank your for your quick reply. I've seen your other posts and they
were really helpful :)

 var $actsAs = array('Translate' = array(
     'title' = 'Titles',
     'abstract' = 'Abstracts',
     'text' = 'Texts'
 ));

OK, maybe that's worth it, but I'd loose that appreciated
abstraction. :)
Actually, I noticed that I can make it behave the way I want. Here's
how:
If I specify locale as, say, $this-Service-locale = 'lit', and
there's no translation for 'lit', then the record is not returned.
But if I specify it as $this-Service-locale = array('lit'), then the
record gets fetched with missing fields as empty strings.
That is good news for me. But is this intended behavior? I guess I'm
going to rely on it for this little project.

Linas
--~--~-~--~~~---~--~~
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: Simple question about Auth Component

2008-09-29 Thread Jérémy

thank you, it works.

On Sep 29, 6:47 pm, Daniel Hofstetter [EMAIL PROTECTED] wrote:
 Hi Jérémy,

  I am very new with CakePHP and I am trying to set up an authentication
  system using the Auth component provided.

  How can I show the logged user's name on a view ? Let's say the user
  John logged in successfully, I would like to put something like
  Logout [John] in the default layout. How can I get this John
  string ?

 Have a look at the user() method of the AuthComponent.

 Hope that helps!

 --
 Daniel Hofstetterhttp://cakebaker.42dh.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
-~--~~~~--~~--~--~---



making custom validate rule (NotEqualTo)

2008-09-29 Thread mig_akira


Hello!

I'm new to cakePHP and I would like to make a custom validate rule. I made a
page where there is a form with fields such as name, adress, etc. In the
field City there is only ONE city that is not allowed to apply - say,
Forbidden City. I need a rule that is similar to EqualTo, but the
opposite: when the name of the city is equalTo Forbidden City, then there
would be an error message!

Something like rule = array(NotEqualTo, Forbidden City). 

Is there an easy way to do this? Can I somehow use the EqualTo rule?

THanks !!
-- 
View this message in context: 
http://www.nabble.com/making-custom-validate-rule-%28NotEqualTo%29-tp19725904p19725904.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
-~--~~~~--~~--~--~---



Make a validation rule be valid only in a certain date

2008-09-29 Thread mig_akira


Hello!

Is there a way to make a validation rule be applied only within a certain
date? For examplo, in 10/10/2008 the rule will be used, but next day,
10/11/2008, the rule will not be used. The way I need it, there are two
rules, one of them would be used for two days, and the other one will be
used for only one day, and both of them starts at the same day.

The rule is simple, just an 'equalTO' with a warning message. 

For example, in day 1, if the string submited in a form is equalTo
whatever or to wherever, then the rule will be applied. In day 2, the
rule will be applied only to wherever. And in day 3, no rule will be
applied. 

Thanks!
-- 
View this message in context: 
http://www.nabble.com/Make-a-validation-rule-be-valid-only-in-a-certain-date-tp19727816p19727816.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: PostgreSQL schema problems in code generator scripts

2008-09-29 Thread jminkler

Looks like you might have a composite primary key for the ARRAY error?

As far as i know cake does not support this, you would have to create
a new unq primary key I think.



On Sep 22, 1:18 am, chrisbdaemon [EMAIL PROTECTED] wrote:
 Hey, I'm trying to migrate a site's database from MySQL to PostgreSQL
 and I created a schema from the already existing MySQL database and
 the models I created for it.  I put in the PostgreSQL connection
 parameters into the configuration file and tried to do a 'php cake.php
 schema run create' to create the new tables in the postgresql database
 and I got some errors.  Most of them were different instances of these
 errors:

 Warning: pg_query(): Query failed: ERROR:  syntax error at or near ,
 LINE 10:  CREATE INDEX dst_ind ON calls(phone_number_id);,
                                                              ^ in
 [snip]/cake1.2/cake/libs/model/datasources/dbo/dbo_postgres.php on
 line 152

 Warning: pg_query(): Query failed: ERROR:  syntax error at or near
 Array
 LINE 8:  PRIMARY KEY  (Array));
                        ^ in [snip]/cake1.2/cake/libs/model/datasources/
 dbo/dbo_postgres.php on line 152

 Warning: pg_query(): Query failed: ERROR:  syntax error at or near ,
 LINE 11:  CREATE UNIQUE INDEX filename ON reviews(filename);,
                                                                 ^ in
 [snip]/cake1.2/cake/libs/model/datasources/dbo/dbo_postgres.php on
 line 152

 This is with CakePHP 1.2.0.7296 RC2 running on a MacBook with Mac OS X
 10.5.5 with a freshly compiled PHP 5.2.6

 I've been trying to use more and more features of the code generator
 but it doesn't quite seem to be finished yet as far as testing and
 debugging goes.  However, I have noticed quite a few things fixed and
 whoever is working on it, I appreciate it as well as many others I'm
 sure.

--~--~-~--~~~---~--~~
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: validate alphanumeric

2008-09-29 Thread wowfka

it was fixed in https://trac.cakephp.org/ticket/5025, have same
problem with my lithuanian chars.

On Sep 26, 7:50 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hari,

 I would like to use validation with 1.2. I need something like
 alpanumeric, but it seems it does not accept non latin characters. I
 need it for a hungarian site, so I use utf-8. I searched the net, but
 did not find any useful information how to use validation with
 multibyte characters.

 Any suggestion?

 rrd
--~--~-~--~~~---~--~~
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: help with YAML pls basic syntax...etc

2008-09-29 Thread forrestgump

Built in schema shells?i dont follow...can u elaborate on that?

On Sep 29, 6:38 pm, mark_story [EMAIL PROTECTED] wrote:
 Couldn't you use the builtin Schema shell to do your migrations?  and
 not have to muck with YAML?

 -Mark

 On Sep 29, 3:13 am, forrestgump [EMAIL PROTECTED] wrote:

  OK i made some changed to the code as follows
  UP:
    create_table:
      users:
        username:
              type: varchar
              length: 100
              index: true
        password:
              type: varchar
              length: 100

    query:
      users: INSERT INTO users SET username = 'admin' and password=
  'admin'

  DOWN:
    query:
      users: DELETE FROM users WHERE username = 'admin' and password=
  'admin'
    drop_table: users

  It has successfully created the users table and the collumns i
  require, including two additional ones i dont require(created,
  modified)
  yet no data was insertedwhere am i going wrong?

  On Sep 29, 12:00 pm, forrestgump [EMAIL PROTECTED] wrote:

   Can someone tell me what is wrong with the following YAML code ? \

   UP:
     create_table:
       users:
         id:
               type: integer
               length: 11
               primary: true
               autoincrement: true
         username:
               type: varchar
               length: 100
               index: true
         password:
               type: varchar
               length: 100

     query:
       users: INSERT INTO users SET username = 'admin' and password=
   'admin'

   DOWN:
     drop_table: users
     query:
       users: DELETE FROM users WHERE username = 'admin' and password=
   'admin'

   what i want it to do is, create a table users with fields
   [id,username,password] and then insert data into it
   [0,admin,admin]wht YAML is doing for me is...
   it create a table users with fields [id,created,modified] and another
   table autoincrement with fields  [id,username,password] , and nothing
   gets inserted

   I would really appreciate some help ive been stuck on this since 2
   daysim writing a short tutorial on cakephp migrations that i wish
   to shareand this will really help...

   Forrestgump
   (yes i know very original nick name :) )
--~--~-~--~~~---~--~~
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: Fatal error: Class 'Dispatcher' not found - please help

2008-09-29 Thread [EMAIL PROTECTED]

i still have problem witch home.pl fucking shit

http://www.aeonmedia.eu/
http://www.aeonmedia.eu/aeonmedia

i have this rools
if (strpos('aeonmedia.eu', $_SERVER['SERVER_NAME']) !== false) {
ini_set('include_path', '/aeonmedia/..:/aeonmedia:.');
define('APP_PATH', '/aeonmedia');
define('CORE_PATH', '/');
}


On 27 Wrz, 22:12, 3lancer.eu [EMAIL PROTECTED] wrote:
 Oh, got it kind of working, the workaround was quite strange however:

 //this must be set on home.pl
 if (strpos('example.com', $_SERVER['SERVER_NAME']) !== false) {
         ini_set('include_path', '/app/..:/app:.');
         define('APP_PATH', '/app');
         define('CORE_PATH', '/');

 }

 around line 77 in app/webroot/index.php. Maybe that will save someone
 hours of debugging.

 The strpos check is there only to allow running dev version on a
 separate domain where cake works fine...

 Regards,
 Piotr
--~--~-~--~~~---~--~~
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: Saving self-referential-HABTM relationships...

2008-09-29 Thread Bernardo Vieira

I imagine it should work if you use different join tables for each HABTM 
relationship. Regardless of cakephp this is what I imagine you'd need in 
this situation (imagine what would happen if a user is both a friend and 
an admirer of another user).

var $hasAndBelongsToMany = array(
'Friend' = array('className' = 'User',
'joinTable' = 'friends_users',
'foreignKey' = 'friend_id',
'associationForeignKey' = 
'user_id'
),

'Admirer' = array('className' = 'User',
'joinTable' = 'admirers_users',
'foreignKey' = 'admirer_id',
'associationForeignKey' = 
'user_id'
)
);



wallerdm wrote:
 Dear All,

 Forgive me if this is covered elsewhere. I'm playing with cakePHP as
 an alternative to Rails and am getting to grips with it by creating a
 really simple social network app.

 I've got some nice authentication and user profiles sorted and that's
 all displaying great but now I've come to add the add as a friend
 functionality and I'm struggling.

 Every user in the users table has an id and I also have a table
 set up, users_users, to hold the self referential join. This table
 has a an id, a user_id and a friend_id.

 My user model contains the following...

 ?php
 class User extends AppModel {

   var $name = 'User';
   var $hasOne = 'Profile';
   var $hasMany = array('Status' = array('order' = 'Status.created
 DESC' ));

   var $hasAndBelongsToMany = array(
   'Friend' = array('className' = 'User',
   'joinTable' = 'users_users',
   'foreignKey' = 'user_id',
   'associationForeignKey' = 
 'friend_id'
   ),
   'Admirer' = array('className' = 'User',
   'joinTable' = 'users_users',
   'foreignKey' = 'friend_id',
   'associationForeignKey' = 
 'user_id'
   )
   );

 }
 ?

 And my users_controller contains...

 ?php
 class UsersController extends AppController {

 .
   function addfriend($friend_id = null) {
   $user_id = $this-Session-read('User');
   $this-data['User']['id'] = $user_id['id'];
   $this-data['Friend']['id'] = $friend_id;
   print_r($this-data);
   if($this-User-saveAll($this-data)){
   echo 'saved';
   }else{
   echo 'failed';
   }
   }
 .

 }
 ?

 Now I know that I've got the data element wrong for the database save
 because it isn't working and the SQL that's generated when you add a
 friend is incorrect.

 If you're logged in as a user with id 1 and want to become friends
 with the user with id 4 (http://localhost/network/users/addfriend/4),
 you get...

 data = Array ( [User] = Array ( [id] = 1) [Friend] = Array ( [id]
 = 4 ) )

 ...and the SQL from the CakePHP debug panel is...

 UPDATE `users` SET `id` = 1 WHERE `users`.`id` = 1

 Is anyone able to help me get this whole self-referential-HABTM
 relationship thing sorted?

 Thanks in advance.

 Dave.

 

   


--~--~-~--~~~---~--~~
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: Fatal error: Class 'Dispatcher' not found - please help

2008-09-29 Thread mikeg

Hey Peter,

CakePHP will not working on home.pl - there is not rewrite engine (if
i good remember, they are working on it ;)), try ovh.pl - cheap with
great polish support

regards, mike

On Sep 28, 2:07 pm, 3lancer.eu [EMAIL PROTECTED] wrote:
  just clear your app/tmp/cache folder.always worked for me

 I did, but it didn't set proper paths anyway, setting include_path did
 it.

 Regards,
 Piotr

--~--~-~--~~~---~--~~
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: Help with TranslateBehavior needed.

2008-09-29 Thread jitka (poLK)

Nice hint :-)
It is not intended behavior by design, it is just way how current
implementation works. Anyway - you're not first one who brought this
question up, so I think we will keep it working this way (related test
case will be added soon), so you can rely on it without worries.
--~--~-~--~~~---~--~~
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: Multiple Inserts without a loop

2008-09-29 Thread Bruno Bergher

Inserting 100 records all at once will always be better regarding data
consistency.

If something wrong happens with the DB server between two calls, how
you you tell the application where to pick up next?

By inserting them all at one (usgin Model::saveAll()) with the
'atomic' property set to the default of 'true' you won't have to worry
about this. And the performance will certainly be much better,
specially if the DB and Web servers are two different machines,
perhaps in different locations.

Best,

Bruno


On 21 ago, 08:22, RichardAtHome [EMAIL PROTECTED] wrote:
 I think the 1000 was for illustration only.

 I'd run a few quick benchmarks to see what the real difference between
 1insertwith 1000 values() and 1000 queries would be. I'm betting it
 wont be much...

 On Aug 20, 11:04 pm, teknoid [EMAIL PROTECTED] wrote:

  AFAIK, the syntax you are proposing is MySQL (or at least DB vendor)
  specific.
  So, it won't be supported by cake.

  And do you reallyinsert1001 rows?

  On Aug 20, 5:51 pm, seth [EMAIL PROTECTED] wrote:

 Right, but how many inserts does this perform?

- As many inserts as required

   Yes, but my whole point is that if you are inserting 1000 questions,
   this could be done in 2 interests or 1001... Is cake currently smart
   enough to do it in 2?
--~--~-~--~~~---~--~~
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: help with YAML pls basic syntax...etc

2008-09-29 Thread mark_story

In 1.2 there is a builtin Schema shell (console app) that can manage
things like ALTER statements that need to be run on a db between runs.
To my knowledge it doesn't insert records.  From a prompt cd into cake/
console and try cake schema help.  That will give you a list of
commands supported by the SchemaShell.

-Mark

On Sep 29, 1:23 pm, forrestgump [EMAIL PROTECTED] wrote:
 Built in schema shells?i dont follow...can u elaborate on that?

 On Sep 29, 6:38 pm, mark_story [EMAIL PROTECTED] wrote:

  Couldn't you use the builtin Schema shell to do your migrations?  and
  not have to muck with YAML?

  -Mark

  On Sep 29, 3:13 am, forrestgump [EMAIL PROTECTED] wrote:

   OK i made some changed to the code as follows
   UP:
 create_table:
   users:
 username:
   type: varchar
   length: 100
   index: true
 password:
   type: varchar
   length: 100

 query:
   users: INSERT INTO users SET username = 'admin' and password=
   'admin'

   DOWN:
 query:
   users: DELETE FROM users WHERE username = 'admin' and password=
   'admin'
 drop_table: users

   It has successfully created the users table and the collumns i
   require, including two additional ones i dont require(created,
   modified)
   yet no data was insertedwhere am i going wrong?

   On Sep 29, 12:00 pm, forrestgump [EMAIL PROTECTED] wrote:

Can someone tell me what is wrong with the following YAML code ? \

UP:
  create_table:
users:
  id:
type: integer
length: 11
primary: true
autoincrement: true
  username:
type: varchar
length: 100
index: true
  password:
type: varchar
length: 100

  query:
users: INSERT INTO users SET username = 'admin' and password=
'admin'

DOWN:
  drop_table: users
  query:
users: DELETE FROM users WHERE username = 'admin' and password=
'admin'

what i want it to do is, create a table users with fields
[id,username,password] and then insert data into it
[0,admin,admin]wht YAML is doing for me is...
it create a table users with fields [id,created,modified] and another
table autoincrement with fields  [id,username,password] , and nothing
gets inserted

I would really appreciate some help ive been stuck on this since 2
daysim writing a short tutorial on cakephp migrations that i wish
to shareand this will really help...

Forrestgump
(yes i know very original nick name :) )
--~--~-~--~~~---~--~~
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: Fatal error: Class 'Dispatcher' not found - please help

2008-09-29 Thread 3lancer.eu

Hi,

 CakePHP will not working on home.pl - there is not rewrite engine (if
 i good remember, they are working on it ;)), try ovh.pl - cheap with
 great polish support

Well, that was not my decision, I just had to install cake there since
the customer already owned server with all e-mail accounts there + a
ssl certificate was assigned to that server as well. If that would be
my call, I'd go for a VPS.

But as for the rewrite engine - yes, there is rewrite engine on home
(.htaccess syntax compatible), and after setting that include paths
cake is working.

Regards,
Piotr
--~--~-~--~~~---~--~~
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: Fatal error: Class 'Dispatcher' not found - please help

2008-09-29 Thread 3lancer.eu

 i still have problem witch home.pl fucking shit

 http://www.aeonmedia.eu/
 http://www.aeonmedia.eu/aeonmedia

;-)

I see you made it work?

Regards,
Piotr
--~--~-~--~~~---~--~~
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: page refresh?

2008-09-29 Thread 3lancer.eu

Hi,

 but when you change the picture, the old picture is still stuck in the
 cache, so to see the new pic the user needs to push F5... I can't
 figure out how to refresh the page automatically.

 any ideas?

Simplest way is to add some random query string at the end of the url,
like
http://example.com/images/some_profile_image.jpg?andThisIsSomeHash

It would be good to utilize the browser cache the proper way, so you
can try to set 'andThisIsSomeHash' to something like
md5($myModel['MyModel']['modified']) or md5(filemtime('images/
some_profile_image.jpg'));

Regards,
Piotr
--~--~-~--~~~---~--~~
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: Multiple Inserts without a loop

2008-09-29 Thread teknoid

atomic 'true', doesn't mean it's going to build the INSERT as
described above, in one call.

saveAll() is going to do multiple inserts, but within a transaction,
which ensures data integrity.

On Sep 29, 3:29 pm, Bruno Bergher [EMAIL PROTECTED] wrote:
 Inserting 100 records all at once will always be better regarding data
 consistency.

 If something wrong happens with the DB server between two calls, how
 you you tell the application where to pick up next?

 By inserting them all at one (usgin Model::saveAll()) with the
 'atomic' property set to the default of 'true' you won't have to worry
 about this. And the performance will certainly be much better,
 specially if the DB and Web servers are two different machines,
 perhaps in different locations.

 Best,

 Bruno

 On 21 ago, 08:22, RichardAtHome [EMAIL PROTECTED] wrote:

  I think the 1000 was for illustration only.

  I'd run a few quick benchmarks to see what the real difference between
  1insertwith 1000 values() and 1000 queries would be. I'm betting it
  wont be much...

  On Aug 20, 11:04 pm, teknoid [EMAIL PROTECTED] wrote:

   AFAIK, the syntax you are proposing is MySQL (or at least DB vendor)
   specific.
   So, it won't be supported by cake.

   And do you reallyinsert1001 rows?

   On Aug 20, 5:51 pm, seth [EMAIL PROTECTED] wrote:

  Right, but how many inserts does this perform?

 - As many inserts as required

Yes, but my whole point is that if you are inserting 1000 questions,
this could be done in 2 interests or 1001... Is cake currently smart
enough to do it in 2?


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



app_controller.php causing errors with my app

2008-09-29 Thread Ryan

I am working on a new app and everything was playing nicely until I
added a simple app_controller.php in order to take advantage of the
Firecake helper:

?php
class AppController extends Controller {
var $name = 'AppController';
var $helpers = array('Html', 'Form', 'Javascript', 'Firecake');
}
?

Now I am getting errors:

Notice (8): Undefined property: ItemsController::$Item [APP/
controllers/items_controller.php, line 6]

Fatal error: Call to a member function find() on a non-object in /web/
php/balistik_list_app/app/controllers/items_controller.php on line 6

When I delete app_controller.php everything works again. Any ideas?
--~--~-~--~~~---~--~~
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: repair ACL acos tree cakephp

2008-09-29 Thread Penfold

What type of acl authorization are you using?

Crud/model/action?

On 29 Sep, 14:51, Robson [EMAIL PROTECTED] wrote:
 Few weeks ago we introduced application to our customer.
 It all went just fine untill now .
 System's rights are based on built-in CAKE-PHP ACL Behaviour.
 Today i got a call from the customer that users keep reporting not
 having enough rights.
 Acos table is  massive (15k records) and grows, so analyzes aren't
 easy.
 Atm we introduced some kind of workaround and it works - partially
 skipping acl part.
 After some time i discovered that some record in DB have same lft and
 rght values, so obviously tree structure is broken.
 Does it mean that Tree or ACL behavior doesn't work correctly?
 If we wont fix it, we will be forced to bypass usage of ACL in this
 App (we loose time we spend on implementing ACL already)

 Can  Acl system be used to repair a damaged tree (based on the
 parent_id fields)?
 If so, please post the algorithm we could use.

 CAKE v.1.2.0.7125 RC1
 MySQL client version: 5.0.27
 PHP: 5

 Rob

 PS. Sorry for my english.
--~--~-~--~~~---~--~~
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: Multiple Inserts without a loop

2008-09-29 Thread Joe

You're right, multiple plain jane inserts are significantly slower
than one large INSERT statement. Some quick comparisons showed a huge
difference between inserting 1000 rows at once and doing each
individually.

There's a handful of ways to try and get around this, anything from
disabling the indexes while inserting to (the best way, if you can)
using LOAD DATA and pushing the information directly to the DB from
the filesystem.

But the easiest way is already built into Cake. Use a transaction.
saveAll() will start a transaction which results in one write to the
table. This means the index is regenerated after the lock is lifted
and that there is only one write to the filesystem with your changes
as opposed to the many writes and index regenerations that you would
get with multiple inserts.

On Aug 20, 10:55 am, seth [EMAIL PROTECTED] wrote:
 So it seems most implementations of active record I've used have NOT
 had a way to do this, so I guess I'm hoping Cake is above the curve
 here...

 I'd like the general ability to do N record inserts (and updates)
 without doing N database calls.   Essentially, I want something of the
 form:

 INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);

 I'd like to do this without writing custom sql.  Ideally I'd like to
 do this elegantly with associated models in one save().  If I have a
 Exam model that hasMany Questions, I'd like to do the following:

                 $this-data['Exam']['title'] = 'Midterm Exam';
                 $this-data['Exam']['user_id'] = 'kls93mklj03m9d';
                 $this-data['Question'][0]['question_txt'] = Question one 
 text;
                 $this-data['Question'][1]['question_txt'] = Question two 
 text;
                 $this-Exam-create();
                 $this-Exam-save($this-data);

 The way I imagine this would work is actually using two inserts, as
 you would need the insert id of Exam to be added to each Question.
 Ok, so clearly this isn't trivial, but it also seems extremely useful.
 Did someone already implement this, or come up with a relatively
 elegant hack?  Should I be posting this in the feature request for
 cake instead of here?
--~--~-~--~~~---~--~~
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 do I destroy cookies

2008-09-29 Thread DVD

Source: http://www.smartwebby.com/PHP/cookies.asp

Reset a cookie by specifying its name only

Syntax:

setcookie('cookiename');

Example:

setcookie(test);


On 29 Sep., 17:18, Damelinks [EMAIL PROTECTED] wrote:
 Goodday Everybody, I set cookie by using the codes below

 ?php
 $cookie_expire = time()+3600;
 $cookie_name = users;
 $cookie_value = $_POST[f_name] $_POST[s_name];
 $ret = setcookie('users', $cookie_value, $cookie_expire, /);if (!
 $ret)
 {
         echo Unable ot set cookie;

 }

 ?

 and the cookie was actually set and are working as espected but I am
 trying to destroy the cookie using the codes below.

 ?php
 setcookie('users', 'NULL', mktime()-1, '/');
 ?

 but it is not destroying the cookies.  Please I need your help
 because
 I am using the cookies for users authentation.

 I am using the cookie to check if users logged in properly.

 Thanks

 Damelinks

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



beforeFind called one too many times with hasMany?

2008-09-29 Thread Agamon

Hey All,

I have a model, hasMany associated-model, and I'm finding when using
the beforeFind callback inside associated-model, it is called more
times than I'm expecting.  For each associated record found it is
called (with results like  [0][associated-model]), and then for all
the records together it is called again (with results like [0]
[associated-model][n]).

My original issue was I was using beforeFind to do something toggling
of values, which where being re-toggled in the final beforeFind call.
I've worked around the problem, but I was hoping someone could shed
some light on why this happens at all.

From what I can figure out so far, the first set of calls for the
individual results, and the last call for all the results together,
are triggered from 2 different points in read() in dbo_source.php.  It
looks like to me __filterResults() is being called via
queryAssociation() for each record at line 661, and then again for all
of them when the loop ends, at line 666 (appropriately so for
something I though was an evil bug).  This also looks on purpose to
me, but I am wondering why.

Using 1.2.0.7296 RC2
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
-~--~~~~--~~--~--~---



Updating Radio Buttons

2008-09-29 Thread MDB

Hello All, I have a form that is filled with radio buttons which each
represents a time.  What is the best way to loop through these radio
buttons enabling and disabling depending on other factors? Does this
go in the controller and if so, how do I go about this?  Any links or
pointers would greatly be appreciated.

TIA

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



'Undefined index' problem on production server

2008-09-29 Thread Pieter Van Leuven

Hello people,

I have a strange problem i ran into with CakePHP. On my local machine
all works fine. When I upload the complete project to my webhost, the
problems begin.

For example: when I query posts from the database. All fields of this
posts are shown fine (for example $post['Post']['title'], but all
relative data like for example the username ($post['User']
['username']) gives an error similar to 'Notice (8): Undefined
index:'. Someone an idea what the problem could be?

Could this be a know problem? I tried to search, but it is difficult
with that less information.

Some things I already thought of:
 - Version difference of apache/mysql from my local machine/webhost
server
 - windows newlines on my local machine versus webhost server (not
tested yet)

Local server:
 - Apache/2.2.9 (Win32)
 - mysql/5.0.51b with phpMyAdmin/5.0.51b
 - vista

Webhost server:
 - Apache/2.2.3
 - mysql/5.0.32-Debian_7etch6-log with phpMyAdmin/5.0.32
 - debian

Already thanks for reading this folks!

Kind regards,
Pieter Van Leuven

--~--~-~--~~~---~--~~
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: 'Undefined index' problem on production server

2008-09-29 Thread David C. Zentgraf

Stabs into the dark:

a) your local PHP has a lower debug level than your production server,  
i.e. your local system doesn't complain about missing indexes but your  
server does
b) the associated model can't be fetched because your database setup  
is different/misconfigured

Hope that helps,
Dav

On 30 Sep 2008, at 06:26, Pieter Van Leuven wrote:


 Hello people,

 I have a strange problem i ran into with CakePHP. On my local machine
 all works fine. When I upload the complete project to my webhost, the
 problems begin.

 For example: when I query posts from the database. All fields of this
 posts are shown fine (for example $post['Post']['title'], but all
 relative data like for example the username ($post['User']
 ['username']) gives an error similar to 'Notice (8): Undefined
 index:'. Someone an idea what the problem could be?

 Could this be a know problem? I tried to search, but it is difficult
 with that less information.

 Some things I already thought of:
 - Version difference of apache/mysql from my local machine/webhost
 server
 - windows newlines on my local machine versus webhost server (not
 tested yet)

 Local server:
 - Apache/2.2.9 (Win32)
 - mysql/5.0.51b with phpMyAdmin/5.0.51b
 - vista

 Webhost server:
 - Apache/2.2.3
 - mysql/5.0.32-Debian_7etch6-log with phpMyAdmin/5.0.32
 - debian

 Already thanks for reading this folks!

 Kind regards,
 Pieter Van Leuven

 


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



Warning: Configure include core.php configure include failed to open stream No such file or directory

2008-09-29 Thread Malcolm Krugger

This is somewhat related to

http://groups.google.com/group/cake-php/browse_thread/thread/ea2bac4072e36cc6/c59d9cb45cf43a81?lnk=gstq=Warning+Configure+include#c59d9cb45cf43a81

If you receive the following error

Warning: Configure::include core.php configure.include failed to open
stream: No such file or directory

I was able to solve it only setting the following 3 variables
manually

*/
if (!defined('ROOT')) {
//define('ROOT', dirname(dirname(dirname(__FILE__;
define('ROOT', '/home/mywebsite/cakephp');
}
/**
 * The actual directory name for the app.
 *
 */
if (!defined('APP_DIR')) {
//define('APP_DIR', basename(dirname(dirname(__FILE__;
define('APP_DIR', 'cakephp/app');
}
/**
 * The absolute path to the cake directory, WITHOUT a trailing DS.
 *
 */
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', '/home/mywebsite/cakephp');
}

/**

also I remember editing

//ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR .
ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path'))

ini_set('include_path', CAKE_CORE_INCLUDE_PATH)


--~--~-~--~~~---~--~~
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: help with YAML pls basic syntax...etc

2008-09-29 Thread forrestgump

Koolthnx Mark

On Sep 30, 1:03 am, mark_story [EMAIL PROTECTED] wrote:
 In 1.2 there is a builtin Schema shell (console app) that can manage
 things like ALTER statements that need to be run on a db between runs.
 To my knowledge it doesn't insert records.  From a prompt cd into cake/
 console and try cake schema help.  That will give you a list of
 commands supported by the SchemaShell.

 -Mark

 On Sep 29, 1:23 pm, forrestgump [EMAIL PROTECTED] wrote:

  Built in schema shells?i dont follow...can u elaborate on that?

  On Sep 29, 6:38 pm, mark_story [EMAIL PROTECTED] wrote:

   Couldn't you use the builtin Schema shell to do your migrations?  and
   not have to muck with YAML?

   -Mark

   On Sep 29, 3:13 am, forrestgump [EMAIL PROTECTED] wrote:

OK i made some changed to the code as follows
UP:
  create_table:
    users:
      username:
            type: varchar
            length: 100
            index: true
      password:
            type: varchar
            length: 100

  query:
    users: INSERT INTO users SET username = 'admin' and password=
'admin'

DOWN:
  query:
    users: DELETE FROM users WHERE username = 'admin' and password=
'admin'
  drop_table: users

It has successfully created the users table and the collumns i
require, including two additional ones i dont require(created,
modified)
yet no data was insertedwhere am i going wrong?

On Sep 29, 12:00 pm, forrestgump [EMAIL PROTECTED] wrote:

 Can someone tell me what is wrong with the following YAML code ? \

 UP:
   create_table:
     users:
       id:
             type: integer
             length: 11
             primary: true
             autoincrement: true
       username:
             type: varchar
             length: 100
             index: true
       password:
             type: varchar
             length: 100

   query:
     users: INSERT INTO users SET username = 'admin' and password=
 'admin'

 DOWN:
   drop_table: users
   query:
     users: DELETE FROM users WHERE username = 'admin' and password=
 'admin'

 what i want it to do is, create a table users with fields
 [id,username,password] and then insert data into it
 [0,admin,admin]wht YAML is doing for me is...
 it create a table users with fields [id,created,modified] and another
 table autoincrement with fields  [id,username,password] , and nothing
 gets inserted

 I would really appreciate some help ive been stuck on this since 2
 daysim writing a short tutorial on cakephp migrations that i wish
 to shareand this will really help...

 Forrestgump
 (yes i know very original nick name :) )
--~--~-~--~~~---~--~~
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: 'schema generate' and different connections (was: help with YAML pls basic syntax...etc)

2008-09-29 Thread David C. Zentgraf

Speaking of which...

I have multiple connections in my database.conf. Running a 'cake  
schema generate' always quits with Error: Missing database table 'x'  
for model 'y'. Even doing 'schema -connection alt -name Model  
generate' quits with the same message. Depending on which '- 
connection' I specify it quits on different models, so it seems it  
always tries to generate schemas for all models, ignoring my flags.

Am I misusing the schema shell or should I open a ticket?

Chrs,
Dav


On 30 Sep 2008, at 05:03, mark_story wrote:

 In 1.2 there is a builtin Schema shell (console app) that can manage
 things like ALTER statements that need to be run on a db between runs.
 To my knowledge it doesn't insert records.  From a prompt cd into  
 cake/
 console and try cake schema help.  That will give you a list of
 commands supported by the SchemaShell.

 -Mark


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