Re: ajax question: how can I make the controller decide what element to update?

2008-03-26 Thread Dave J

Hi Marc,

What if the view is actually a Javascript codeblock which updates the
DOM?  (Since Ajax responses are evaluated in they contain script
tags)

For example, the response view might only contain

$('form_div').update('Hello');

or

$('listing_div').update('Hello');


I haven't tried this out, and it seems to be more of a hack, but no
reason why it shouldn't work. Obviously you'd need to replace the IDs
of the DOM elements with variables, and then set those in the
controller as you wanted to do in the first place



On Mar 25, 11:42 pm, MarcS [EMAIL PROTECTED] wrote:
 Hi, usually I would use a form like this one

  echo $ajax-form('edit', 'post', array(
      'model'    = 'model',
      'url'      = array( 'action' = 'edit'),
      'update'   = 'element_to_update',
  ));

 but what if, depending on the success of the edit operation, I want to
 update another div?
 For example I would like to update the element 'form_div' when there
 is a validation error when saving the record and the element
 'listing_div' when the record was saved successfully and I want to
 relfect the changes in the part of my pages that shows info about the
 data set that has just been updated.

 What do I put in my controllers and in the views?

 what do I have to fill in here and what has to go in the views?

 if ($this-Model-save($this-data)) {
         //some code that will render a view which will update
 'listing_div'} else {

         //some code that will render a view which will update 'form_div'

 }

 I tried to google for this but didn't really find anything.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



My Component try to use RequsetHandler component. Problem.

2008-03-26 Thread wDevil

class OrderComponent extends Object {
private $Orders;
private $OrderComponents;

private $RequestHandler;

function initialize() {
App::import('Model','Orders');
App::import('Model','OrderComponents');
$this-Orders= new Orders();
$this-OrderComponents= new OrderComponents();

App::import('Component','RequestHandler');
$this-requestHandler= new RequestHandler();
...
}
Error:
Fatal error: Class 'RequestHandler' not found in ...

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



Re: acl.php : Call to undefined function uses()

2008-03-26 Thread stonez

Try:  cake acl create aro 0 null Users
it's not acl.php. it's acl

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



Re: acl.php : Call to undefined function uses()

2008-03-26 Thread stonez

I forgot to mention, you have to change this code below,
before you issue the command:  cake acl create aro 0 null Dealers

\cake\cake\libs\model\datasources\db_source.php
in line 29
change uses('set') into uses('set','string')
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM Relation with foreign key

2008-03-26 Thread Guillaume Chomat

Hi boyracerr,

Thanks for  your help. Cake is effectively amazing!!!

Kind Regards.

On Mar 26, 4:10 am, boyracerr [EMAIL PROTECTED] wrote:
 Me again,

 As so often, I knew I wanted to use it but needed a helpful post
 laying it out for me in simple terms. Mariano to the rescue!

 http://www.cricava.com/blogs/index.php?blog=6title=modelizing_habtm_...

 If you are using 1.2, then just set the table up like this (my
 example):

 id, user_id, forum_id, role_id

 and the relation:

 var $hasAndBelongsToMany = array('Members' = array('className' =
 'User'
                                                                               
                                   )
                                                                         );

 Yes, thats it. As usual, Cake is amazing but you need a blog post to
 tell you why :)

 On Mar 26, 4:21 am, boyracerr [EMAIL PROTECTED] wrote:

  As so often, stating my problem helped me think of it in a different
  way (actually it gave me different phrases to Google for)

  Have a look at:

 http://www.thinkingphp.org/2006/10/26/modeling-relationships-in-cakep...

  I think this is what we are both trying to do.

  If you are using 1.2, one of the comments on the above post might also
  be relevant:

  
  This is already halfway implemented in Cake 1.2, but only for MySQL,
  i.e.:

  class User extends AppModel {

  var $hasAndBelongsToMany = array(Group = array(with =
  Memberships));

  }

  And the join table fields will be selected as 'Memberships' within the
  association.

  

  I'm going to try this now, let me know how you get on.

  Ben

  On Mar 26, 4:13 am, boyracerr [EMAIL PROTECTED] wrote:

   Hi, sorry for jumping in your post, but I think my situation is almost
   exactly the same.

   Imagine I have a forum application with many forums, so that we have

   Users
   Forums

   A user may be an admin for one forum, a member of another, a moderator
   of another. There is a table for Roles.

   What is the best way to represent this relationship?

   Like Guillaume, I'm thinking a foreign key in the forums_users table
   which goes to Roles. This seems logical to me.

   I'm sure many people must have faced this (essentially a three way
   relation) but I can't find a decent solution.

   Ben

   On Mar 25, 11:57 pm, Guillaume Chomat [EMAIL PROTECTED]
   wrote:

Hi logica,

Don't focus on the cohérence of the sample used to explain my needs.
It is just a weird example.
What i need is to know if it is possible when defining a HABTM
relationship to tell cake to resolve also the foreign key contained in
the join table.

Can you help me on this?

Thanks in advance.

On Mar 25, 5:17 pm, b logica [EMAIL PROTECTED] wrote:

 I suspect that you'd be far better off with role_id in the users
 table. Unless it denotes a particular role (among many) that a user
 had when making the post.

 users belongsTo roles, HABTM posts
 posts HABTM  users
 posts_users (user_id, post_id)

 On Tue, Mar 25, 2008 at 5:35 AM, Guillaume Chomat

 [EMAIL PROTECTED] wrote:

   Hi everybody,

   Is cake able to read any referenced model in a join table?

   Suppose we have three entities table:
   - users
   - posts
   - roles

   and a join table:
   - posts_users.

   The join table posts_users has a field role_id, foreign key to the
   roles table.

   We have defined the HABTM relationship in the user model.
   So now, we would like to be able to read the posts associated to 
  the
   user but also get the role specified in the relation.

   Is it possible without defining the finderQuery field in the HABTM
   relationship?

   Thanks in advance for your help

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



Re: findAll and model on different database in association

2008-03-26 Thread [EMAIL PROTECTED]

I have found this post that I think it's right for my case:

http://groups.google.com/group/cake-php/browse_thread/thread/b542cf436cc8622f/da154103ba2a3af3?lnk=gstq=Multiple+DB+HasMany


I have used the solution of Grant but I get the same error (in the
Sql query of find all miss the LEFT JOIN relative to the external
model)
I use CAKEPHP 1.1.13

On 25 Mar, 20:09, Chris Hartjes [EMAIL PROTECTED] wrote:
 On Tue, Mar 25, 2008 at 2:42 PM, [EMAIL PROTECTED]

 [EMAIL PROTECTED] wrote:

   Do you know that I have the models  in different databases.
   I don't think that it's a post about this situation.

 #1 - yes, I know you have the models in different databases.  Please
 see my earlier statements in this thread

 #2 - you asked about doing left joins - there have been some posts
 lately about that in this mailing list, which is a totally searchable
 google group

 Add #1 + #2 and you might have a solution.

 --
 Chris Hartjes
 Internet Loudmouth
 Motto for 2008: Moving from herding elephants to handling snakes...
 @TheKeyBoard:http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: upload an image to a directory

2008-03-26 Thread djiize

search for Upload behavior in Group and Bakery

On 26 mar, 05:46, damo [EMAIL PROTECTED] wrote:
 I'm sure this is super easy also, but can't find how to do it in the
 cookbook for 1.2.

 So what I want to do is using the form helper upload a file (jpeg or
 jpg) and then save it to the directory /img/students/ and rename it to
 studentnumber.jpg (where student number is a field within the student
 record.

 It would also be handy to know how to delete this image from the edit
 view as well.

 I'm using the following to display images, it doesn't use any of the
 cakePHP goodness, so if there is some better way - I would love to
 hear it!

 ?php
 $image = $student['Student']['studentnumber'];
 echo 'img src=/img/students/';
 echo $image;
 echo '.jpg width=300 border=0 alt=No student Image Available';
 ?

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



behaviour update query

2008-03-26 Thread dr. Hannibal Lecter

Hi everyone,

I'm working on a behaviour, and I'm currently running my query like
this:

$Model-query(
'UPDATE '.$Model-table.'
SET '.$_settings['hitField'].' =
'.$_settings['hitField'].' + 1
WHERE   '.$_settings['keyField'].' = '.$key.';'
);

But this doesn't seem Cakeish enough, is there a better way to run
the same query?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



parseextensions problem - wrong content type

2008-03-26 Thread MarcS

Hi,

I have parseExtensions enabled in my routers.php file

I'm requesting a URL like this: controller/action.js and I expect the
response content type to be javascript.
However, cake sets the content type to text/html and wraps the
javascript output in script/script tags.
I have no idea where these are comming from.

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



Re: findAll and model on different database in association

2008-03-26 Thread [EMAIL PROTECTED]

If I use a model inside the same database instead a model in an other
database all works fine.
For me the problem is in dbo_source.php   function
generateAssociationQuery(...) where the query is generated.

On 26 Mar, 10:52, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 I have found this post that I think it's right for my case:

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

 I have used the solution of Grant but I get the same error (in the
 Sql query of find all miss the LEFT JOIN relative to the external
 model)
 I use CAKEPHP 1.1.13

 On 25 Mar, 20:09, Chris Hartjes [EMAIL PROTECTED] wrote:



  On Tue, Mar 25, 2008 at 2:42 PM, [EMAIL PROTECTED]

  [EMAIL PROTECTED] wrote:

    Do you know that I have the models  in different databases.
    I don't think that it's a post about this situation.

  #1 - yes, I know you have the models in different databases.  Please
  see my earlier statements in this thread

  #2 - you asked about doing left joins - there have been some posts
  lately about that in this mailing list, which is a totally searchable
  google group

  Add #1 + #2 and you might have a solution.

  --
  Chris Hartjes
  Internet Loudmouth
  Motto for 2008: Moving from herding elephants to handling snakes...
  @TheKeyBoard:http://www.littlehart.net/atthekeyboard- Nascondi testo tra 
  virgolette -

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



Re: behaviour update query

2008-03-26 Thread Adam Royle

$Model-updateAll();

Cheers,
Adam

On Mar 26, 8:17 pm, dr. Hannibal Lecter [EMAIL PROTECTED] wrote:
 Hi everyone,

 I'm working on a behaviour, and I'm currently running my query like
 this:

 $Model-query(
 'UPDATE '.$Model-table.'
 SET '.$_settings['hitField'].' =
 '.$_settings['hitField'].' + 1
 WHERE   '.$_settings['keyField'].' = '.$key.';'
 );

 But this doesn't seem Cakeish enough, is there a better way to run
 the same query?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: My Component try to use RequsetHandler component. Problem.

2008-03-26 Thread dr. Hannibal Lecter

Are you using 1.2?

If you are using it:

class OrderComponent extends Object {
 var $components = array('RequestHandler');
}

On Mar 26, 5:11 am, wDevil [EMAIL PROTECTED] wrote:
 class OrderComponent extends Object {
 private $Orders;
 private $OrderComponents;

 private $RequestHandler;

 function initialize() {
 App::import('Model','Orders');
 App::import('Model','OrderComponents');
 $this-Orders= new Orders();
 $this-OrderComponents= new OrderComponents();

 App::import('Component','RequestHandler');
 $this-requestHandler= new RequestHandler();
 ...}

 Error:
 Fatal error: Class 'RequestHandler' not found in ...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: My Component try to use RequsetHandler component. Problem.

2008-03-26 Thread Dardo Sordi Bogado

Also note that the class name is RequestHandlerComponent.

On Wed, Mar 26, 2008 at 7:37 AM, dr. Hannibal Lecter
[EMAIL PROTECTED] wrote:

  Are you using 1.2?

  If you are using it:

  class OrderComponent extends Object {
  var $components = array('RequestHandler');


 }

  On Mar 26, 5:11 am, wDevil [EMAIL PROTECTED] wrote:
   class OrderComponent extends Object {
   private $Orders;
   private $OrderComponents;
  
   private $RequestHandler;
  
   function initialize() {
   App::import('Model','Orders');
   App::import('Model','OrderComponents');
   $this-Orders= new Orders();
   $this-OrderComponents= new OrderComponents();
  
   App::import('Component','RequestHandler');
   $this-requestHandler= new RequestHandler();
   ...}
  
   Error:
   Fatal error: Class 'RequestHandler' not found in ...
  


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



Re: behaviour update query

2008-03-26 Thread dr. Hannibal Lecter

I've searched and I've searched, I see people mentioning it, but I'm
not really sure how to increment the value of 'hitField'? How do I
tell updateAll to add one to the existing value?

Thanks in advance!

On Mar 26, 11:35 am, Adam Royle [EMAIL PROTECTED] wrote:
 $Model-updateAll();

 Cheers,
 Adam

 On Mar 26, 8:17 pm, dr. Hannibal Lecter [EMAIL PROTECTED] wrote:

  Hi everyone,

  I'm working on a behaviour, and I'm currently running my query like
  this:

  $Model-query(
  'UPDATE '.$Model-table.'
  SET '.$_settings['hitField'].' =
  '.$_settings['hitField'].' 
  + 1
  WHERE   '.$_settings['keyField'].' = '.$key.';'
  );

  But this doesn't seem Cakeish enough, is there a better way to run
  the same query?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: behaviour update query

2008-03-26 Thread grigri

It's as easy as :

$Model-updateAll(array('Model.hitfield' = 'Model.hitfield +1'),
array('Model.keyfield' = '= ' . $key));

Note that in some versions the updateAll does a join on hasOne/
belongsTo so you have to specify the fields in Model.field format, not
just the field name.

See:

http://cakebaker.42dh.com/2007/12/12/a-black-sheep-with-the-name-modelupdateall/
https://trac.cakephp.org/ticket/1976

On Mar 26, 11:06 am, dr. Hannibal Lecter [EMAIL PROTECTED]
wrote:
 I've searched and I've searched, I see people mentioning it, but I'm
 not really sure how to increment the value of 'hitField'? How do I
 tell updateAll to add one to the existing value?

 Thanks in advance!

 On Mar 26, 11:35 am, Adam Royle [EMAIL PROTECTED] wrote:

  $Model-updateAll();

  Cheers,
  Adam

  On Mar 26, 8:17 pm, dr. Hannibal Lecter [EMAIL PROTECTED] wrote:

   Hi everyone,

   I'm working on a behaviour, and I'm currently running my query like
   this:

   $Model-query(
   'UPDATE '.$Model-table.'
   SET '.$_settings['hitField'].' =
   
   '.$_settings['hitField'].' + 1
   WHERE   '.$_settings['keyField'].' = '.$key.';'
   );

   But this doesn't seem Cakeish enough, is there a better way to run
   the same query?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: findAll and model on different database in association

2008-03-26 Thread [EMAIL PROTECTED]

I have analizated the code of dbo_source.php   . I have found during
the generation of SQL query that the code controls if the useDbConfig
of the models are the same.
If I set useDbConfig of the belongTo's Model like the useDbConfig of
the principal model can I have  problem in other operations?
On 26 Mar, 11:27, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 If I use a model inside the same database instead a model in an other
 database all works fine.
 For me the problem is in dbo_source.php   function
 generateAssociationQuery(...) where the query is generated.

 On 26 Mar, 10:52, [EMAIL PROTECTED]



 [EMAIL PROTECTED] wrote:
  I have found this post that I think it's right for my case:

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

  I have used the solution of Grant but I get the same error (in the
  Sql query of find all miss the LEFT JOIN relative to the external
  model)
  I use CAKEPHP 1.1.13

  On 25 Mar, 20:09, Chris Hartjes [EMAIL PROTECTED] wrote:

   On Tue, Mar 25, 2008 at 2:42 PM, [EMAIL PROTECTED]

   [EMAIL PROTECTED] wrote:

 Do you know that I have the models  in different databases.
 I don't think that it's a post about this situation.

   #1 - yes, I know you have the models in different databases.  Please
   see my earlier statements in this thread

   #2 - you asked about doing left joins - there have been some posts
   lately about that in this mailing list, which is a totally searchable
   google group

   Add #1 + #2 and you might have a solution.

   --
   Chris Hartjes
   Internet Loudmouth
   Motto for 2008: Moving from herding elephants to handling snakes...
   @TheKeyBoard:http://www.littlehart.net/atthekeyboard-Nascondi testo tra 
   virgolette -

  - Mostra testo tra virgolette -- Nascondi testo tra virgolette -

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



paginator conflicts with Security-requireLogin ?

2008-03-26 Thread gbk *

hi,

i need some help in the following problem:

my cakephp version: 1.2.0.6311.

i have configured digest auth for my admin actions in the
app_controller:

function beforeFilter() {
if(isset($this-params[Configure::read('Routing.admin')])){
$this-Security-requireLogin('*', array('users' = array(
'admin' ='password'), 'type'='digest', 
'realm'='admin'));
}
}

it's working perfectly for the admin actions except when paginator
comes in the picture.

my action (urls_controller):

function admin_getBrokenUrls() {
$this-set('brokenUrls', $this-paginate('Url',
array('repair_count'=10)));
}

the first page (/admin/urls/getBrokenUrls/) is ok, but when i try
other pages (/admin/urls/getBrokenUrls/page:2) i get back 401 http
response code all the time. it's strange, because i've already
authenticated. the other strange thing is, if i enter the admin/
password after a page call it's not working. the server doesn't accept
it.

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



Re: behaviour update query

2008-03-26 Thread dr. Hannibal Lecter

Thanks grigri!

But, it seems like I shouldn't be using the Model.field format,
neither cakebaker nor nate are using it in their working examples (see
the last comment on the ticked you posted). I'm using the latest
nightly, if that matters at all.

On Mar 26, 12:14 pm, grigri [EMAIL PROTECTED] wrote:
 It's as easy as :

 $Model-updateAll(array('Model.hitfield' = 'Model.hitfield +1'),
 array('Model.keyfield' = '= ' . $key));

 Note that in some versions the updateAll does a join on hasOne/
 belongsTo so you have to specify the fields in Model.field format, not
 just the field name.

 See:

 http://cakebaker.42dh.com/2007/12/12/a-black-sheep-with-the-name-mode...https://trac.cakephp.org/ticket/1976

 On Mar 26, 11:06 am, dr. Hannibal Lecter [EMAIL PROTECTED]
 wrote:

  I've searched and I've searched, I see people mentioning it, but I'm
  not really sure how to increment the value of 'hitField'? How do I
  tell updateAll to add one to the existing value?

  Thanks in advance!

  On Mar 26, 11:35 am, Adam Royle [EMAIL PROTECTED] wrote:

   $Model-updateAll();

   Cheers,
   Adam

   On Mar 26, 8:17 pm, dr. Hannibal Lecter [EMAIL PROTECTED] wrote:

Hi everyone,

I'm working on a behaviour, and I'm currently running my query like
this:

$Model-query(
'UPDATE '.$Model-table.'
SET '.$_settings['hitField'].' =

'.$_settings['hitField'].' + 1
WHERE   '.$_settings['keyField'].' = '.$key.';'
);

But this doesn't seem Cakeish enough, is there a better way to run
the same query?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: behaviour update query

2008-03-26 Thread dr. Hannibal Lecter

Got it!

On the latest nightly:

$Model-updateAll
(
array ($_settings['hitField'] = $Model-alias.'.'.
$_settings['hitField'].' +1'),
array ($Model-alias.'.'.$_settings['keyField'] = $key)
);

Apparently, in the fields array, the column is prefixed with the
model's alias, the value is not; conditions are also not prefixed.

Thanks for all the help!

On Mar 26, 1:14 pm, dr. Hannibal Lecter [EMAIL PROTECTED] wrote:
 Thanks grigri!

 But, it seems like I shouldn't be using the Model.field format,
 neither cakebaker nor nate are using it in their working examples (see
 the last comment on the ticked you posted). I'm using the latest
 nightly, if that matters at all.

 On Mar 26, 12:14 pm, grigri [EMAIL PROTECTED] wrote:





  It's as easy as :

  $Model-updateAll(array('Model.hitfield' = 'Model.hitfield +1'),
  array('Model.keyfield' = '= ' . $key));

  Note that in some versions the updateAll does a join on hasOne/
  belongsTo so you have to specify the fields in Model.field format, not
  just the field name.

  See:

 http://cakebaker.42dh.com/2007/12/12/a-black-sheep-with-the-name-mode...

  On Mar 26, 11:06 am, dr. Hannibal Lecter [EMAIL PROTECTED]
  wrote:

   I've searched and I've searched, I see people mentioning it, but I'm
   not really sure how to increment the value of 'hitField'? How do I
   tell updateAll to add one to the existing value?

   Thanks in advance!

   On Mar 26, 11:35 am, Adam Royle [EMAIL PROTECTED] wrote:

$Model-updateAll();

Cheers,
Adam

On Mar 26, 8:17 pm, dr. Hannibal Lecter [EMAIL PROTECTED] wrote:

 Hi everyone,

 I'm working on a behaviour, and I'm currently running my query like
 this:

 $Model-query(
 'UPDATE '.$Model-table.'
 SET '.$_settings['hitField'].' =
 
 '.$_settings['hitField'].' + 1
 WHERE   '.$_settings['keyField'].' = 
 '.$key.';'
 );

 But this doesn't seem Cakeish enough, is there a better way to run
 the same query?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: paginator conflicts with Security-requireLogin ?

2008-03-26 Thread gbk *

hi,

some new information about this problem:

if i change the type from 'digest' to 'basic', the server accepts the
admin/password, but i have to enter it at every page request.

gbk

On márc. 26, 12:33, gbk * [EMAIL PROTECTED] wrote:
 hi,

 i need some help in the following problem:

 my cakephp version: 1.2.0.6311.

 i have configured digest auth for my admin actions in the
 app_controller:

 function beforeFilter() {
 if(isset($this-params[Configure::read('Routing.admin')])){
 $this-Security-requireLogin('*', array('users' = array(
 'admin' ='password'), 'type'='digest', 
 'realm'='admin'));
 }

 }

 it's working perfectly for the admin actions except when paginator
 comes in the picture.

 my action (urls_controller):

 function admin_getBrokenUrls() {
 $this-set('brokenUrls', $this-paginate('Url',
 array('repair_count'=10)));

 }

 the first page (/admin/urls/getBrokenUrls/) is ok, but when i try
 other pages (/admin/urls/getBrokenUrls/page:2) i get back 401 http
 response code all the time. it's strange, because i've already
 authenticated. the other strange thing is, if i enter the admin/
 password after a page call it's not working. the server doesn't accept
 it.

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



Re: looking for a hosting company

2008-03-26 Thread dr. Hannibal Lecter

I've heard many good things about BlueHost, and got myself a subdomain
from a friend. Running Cake with no problems at all.

http://www.bluehost.com/

On Mar 26, 1:53 pm, Zoltan [EMAIL PROTECTED] wrote:
 Just wondering if anyone has a hosting company they'd recommend.
 I've personally hosted a few sites on DreamHost, speed is ok, but
 getting Cake sites up and running is problem-free. On the other hand,
 I've used Rackspace, which is faster, but keep on running into
 problems.

 If anybody has a hosting company they'd recommend, I'd appreciate it.

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



looking for a hosting company

2008-03-26 Thread Zoltan

Just wondering if anyone has a hosting company they'd recommend.
I've personally hosted a few sites on DreamHost, speed is ok, but
getting Cake sites up and running is problem-free. On the other hand,
I've used Rackspace, which is faster, but keep on running into
problems.

If anybody has a hosting company they'd recommend, I'd appreciate it.

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



Re: paginator conflicts with Security-requireLogin ?

2008-03-26 Thread gbk *

i have to correct myself. in basic mode the application works fine.
the problem in digest mode is the ':', page:2.
the ':' is missing from the regexp in function
parseDigestAuthData($digest) ;

preg_match_all('@(\w+)=([\']?)([a-zA-Z0-9=./\_-]+)\2@', $digest,
$match, PREG_SET_ORDER);

gbk


On márc. 26, 13:44, gbk * [EMAIL PROTECTED] wrote:
 hi,

 some new information about this problem:

 if i change the type from 'digest' to 'basic', the server accepts the
 admin/password, but i have to enter it at every page request.

 gbk

 On márc. 26, 12:33, gbk * [EMAIL PROTECTED] wrote:

  hi,

  i need some help in the following problem:

  my cakephp version: 1.2.0.6311.

  i have configured digest auth for my admin actions in the
  app_controller:

  function beforeFilter() {
  if(isset($this-params[Configure::read('Routing.admin')])){
  $this-Security-requireLogin('*', array('users' = array(
  'admin' ='password'), 'type'='digest', 
  'realm'='admin'));
  }

  }

  it's working perfectly for the admin actions except when paginator
  comes in the picture.

  my action (urls_controller):

  function admin_getBrokenUrls() {
  $this-set('brokenUrls', $this-paginate('Url',
  array('repair_count'=10)));

  }

  the first page (/admin/urls/getBrokenUrls/) is ok, but when i try
  other pages (/admin/urls/getBrokenUrls/page:2) i get back 401 http
  response code all the time. it's strange, because i've already
  authenticated. the other strange thing is, if i enter the admin/
  password after a page call it's not working. the server doesn't accept
  it.

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



Re: Friendly-url for multi-language site

2008-03-26 Thread JuniorCMS

This is my solution.
http://www.consulenza-web.com/gestine-multilingua-su-cakephp.dc-52.html

I wrote in my italian blog but code is universal.
My solution provide a simple way to implemente a root lang path for
every controller in app.
This solution il extremely simple but it comes without strong rules
for managing languages.

On Mar 25, 6:44 pm, jonknee [EMAIL PROTECTED] wrote:
  I need a multi language site with cakephp. Ok, this topic is discuss
  commonly. But I need a friendly-url solution, something's like:
     http://mywebsite.com/lang/controller/view

 Couldn't you just make a space for the language in your routes and
 then deal with that variable in AppController::beforeFilter()? No need
 to manually parse anything out.

 Something like:

 Router::connect('/:lang/:controller/:action');

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



Using crumbs in cake 1.2

2008-03-26 Thread ygneo

Hi everybody!

I'm learning to use crumbs with cake 1.2, but I don't find out how to
show the first crumb out of an anchor link (a) to avoid the user
clicks and reload of the page. This is my code:

?php $html-addCrumb('Gestión de usuarios', '/usuarios/nuevo/',
array('id'='seleccionada')); ?

h3?php echo $html-getCrumbs(); ? /h3

I'll like to show

Gestión de usuarios

and not

a id =seleccionada href=/usuarios/nuevoGestión de usuarios/a

If that is possible?

Excuse me if my english is poor, I'm spanish.

Thanks.

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



Changing action on the fly - by user type

2008-03-26 Thread Dan

Hi,

I'd like to change the action on the fly on a per user type basis - I
don't want to use the ACL at the moment ;)

Is anyone else doing this successfully?

I've modified my app_controller-beforeFilter to prepend the userype
to the action so...

controller-index

would become

controller-usertype_index

but i'm noticing that the originally view gets called and the newly
modified action gets called without function parameters.

I'm assuming i'm not using this as intended, but wantd to see if
anyone else is doing something similar?

Cheers

Dan


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



Localizate month names

2008-03-26 Thread ygneo

Hi everybody!

Anyone knows a good method to localizate month names when using $form-
input with a date field?

I mean, setlocale doesn't works for me, and I think it would works
with L10n, with I haven't find out how...

Thanks!

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



Re: looking for a hosting company

2008-03-26 Thread Penfold

Hi,

You can try www.mosso.com which runs on rackspace heardware and is a
scaliable solution

Ian

On 26 Mar, 12:53, Zoltan [EMAIL PROTECTED] wrote:
 Just wondering if anyone has a hosting company they'd recommend.
 I've personally hosted a few sites on DreamHost, speed is ok, but
 getting Cake sites up and running is problem-free. On the other hand,
 I've used Rackspace, which is faster, but keep on running into
 problems.

 If anybody has a hosting company they'd recommend, I'd appreciate it.

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



Re: FinderQuery and findAll

2008-03-26 Thread [EMAIL PROTECTED]

Has anyone some idea for this?

On 25 Mar, 11:06, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 I have a HABTM relation in my model based on a finderQuery.
 How have I to set $conditions in findAll to filtering the model on
 fields of this HABTM relation?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using crumbs in cake 1.2

2008-03-26 Thread grigri

Just leave the url parameter blank and you won't get a link:

?php $html-addCrumb('Gestión de usuarios'); ?

Note that if you do this, html is allowed [the input is not h()-ed],
so if you have any  or  characters you'll have to escape them
manually.

On Mar 26, 9:55 am, ygneo [EMAIL PROTECTED] wrote:
 Hi everybody!

 I'm learning to use crumbs with cake 1.2, but I don't find out how to
 show the first crumb out of an anchor link (a) to avoid the user
 clicks and reload of the page. This is my code:

 ?php $html-addCrumb('Gestión de usuarios', '/usuarios/nuevo/',
 array('id'='seleccionada')); ?

 h3?php echo $html-getCrumbs(); ? /h3

 I'll like to show

 Gestión de usuarios

 and not

 a id =seleccionada href=/usuarios/nuevoGestión de usuarios/a

 If that is possible?

 Excuse me if my english is poor, I'm spanish.

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



Re: looking for a hosting company

2008-03-26 Thread jelmer

I can't recommend bluehost, you'll run into performance problems quite
quickly I think, unless you have a very simple app. I used to have a
(vbulletin) forum there and I was suspended a few times because of
performance issues. I've heard good things about mediatemple but am
using a futurehosting.biz vps right now which is all right.

On Mar 26, 2:52 pm, Penfold [EMAIL PROTECTED] wrote:
 Hi,

 You can trywww.mosso.comwhich runs on rackspace heardware and is a
 scaliable solution

 Ian

 On 26 Mar, 12:53, Zoltan [EMAIL PROTECTED] wrote:

  Just wondering if anyone has a hosting company they'd recommend.
  I've personally hosted a few sites on DreamHost, speed is ok, but
  getting Cake sites up and running is problem-free. On the other hand,
  I've used Rackspace, which is faster, but keep on running into
  problems.

  If anybody has a hosting company they'd recommend, I'd appreciate it.

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



Re: looking for a hosting company

2008-03-26 Thread Chris Hartjes

On Wed, Mar 26, 2008 at 12:20 PM, jelmer [EMAIL PROTECTED] wrote:

  I can't recommend bluehost, you'll run into performance problems quite
  quickly I think, unless you have a very simple app. I used to have a
  (vbulletin) forum there and I was suspended a few times because of
  performance issues. I've heard good things about mediatemple but am
  using a futurehosting.biz vps right now which is all right.

If you have any sort of sysadmin-fu, I recommend getting a VPS as
well.  I'm on slicehost and have had ZERO problems since switching to
them about 5 months ago.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: Moving from herding elephants to handling snakes...
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Re: FinderQuery and findAll

2008-03-26 Thread grigri

`finderQuery` is there for when cake's automagic doesn't suit your
needs, and you want to do everything yourself. So you can't just 'set
$conditions in findAll' because you're explicitly telling cake that
you don't want that to happen.

If you want help with a solution for your specific problem, try
pasting some code - what is your finderQuery, for example? There is no
one size fits-all for this, you'll have to get specific.

On Mar 26, 2:35 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Has anyone some idea for this?

 On 25 Mar, 11:06, [EMAIL PROTECTED]

 [EMAIL PROTECTED] wrote:
  I have a HABTM relation in my model based on a finderQuery.
  How have I to set $conditions in findAll to filtering the model on
  fields of this HABTM relation?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: looking for a hosting company

2008-03-26 Thread interactive

I agree with Chris on the VPS. I use KnownHost and LiquidWeb and both  
have been terrific.

brian fidler


http://www.brianfidler.com

Follow me on Twitter: http://www.twitter.com/brianfidler



Quoting Chris Hartjes [EMAIL PROTECTED]:


 On Wed, Mar 26, 2008 at 12:20 PM, jelmer [EMAIL PROTECTED] wrote:

  I can't recommend bluehost, you'll run into performance problems quite
  quickly I think, unless you have a very simple app. I used to have a
  (vbulletin) forum there and I was suspended a few times because of
  performance issues. I've heard good things about mediatemple but am
  using a futurehosting.biz vps right now which is all right.

 If you have any sort of sysadmin-fu, I recommend getting a VPS as
 well.  I'm on slicehost and have had ZERO problems since switching to
 them about 5 months ago.

 --
 Chris Hartjes
 Internet Loudmouth
 Motto for 2008: Moving from herding elephants to handling snakes...
 @TheKeyBoard: http://www.littlehart.net/atthekeyboard

 





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



Advice about a Calendar

2008-03-26 Thread Grainne

Hi everyone,

I was wondering if anyone has used a cake calendar in their apps -
what they used and how well it worked, what sort of integration
problems they encountered, etc.

Thanks in advance!

Grainne

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



Re: looking for a hosting company

2008-03-26 Thread Rob Russell

Anybody hosted Cake on 1and1? I've really liked them so far but I
haven't pushed any Cake apps on to that server yet. I had a VPS
(somewhere else) and ran in to trouble locking it down so I've been
relegated to managed virtual hosting for now (though 1and1 has met my
needs completely so far).

On Mar 26, 1:06 pm, [EMAIL PROTECTED] wrote:
 I agree with Chris on the VPS. I use KnownHost and LiquidWeb and both
 have been terrific.

 brian fidler
 

 http://www.brianfidler.com

 Follow me on Twitter:http://www.twitter.com/brianfidler

 Quoting Chris Hartjes [EMAIL PROTECTED]:



  On Wed, Mar 26, 2008 at 12:20 PM, jelmer [EMAIL PROTECTED] wrote:

   I can't recommend bluehost, you'll run into performance problems quite
   quickly I think, unless you have a very simple app. I used to have a
   (vbulletin) forum there and I was suspended a few times because of
   performance issues. I've heard good things about mediatemple but am
   using a futurehosting.biz vps right now which is all right.

  If you have any sort of sysadmin-fu, I recommend getting a VPS as
  well.  I'm on slicehost and have had ZERO problems since switching to
  them about 5 months ago.

  --
  Chris Hartjes
  Internet Loudmouth
  Motto for 2008: Moving from herding elephants to handling snakes...
  @TheKeyBoard:http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Advice about a Calendar

2008-03-26 Thread Chris Hartjes

On Wed, Mar 26, 2008 at 1:50 PM, Grainne [EMAIL PROTECTED] wrote:

  Hi everyone,

  I was wondering if anyone has used a cake calendar in their apps -
  what they used and how well it worked, what sort of integration
  problems they encountered, etc.

I've used QCalendar on other projects.  Easy to integrate with Code
Igniter, so it's probably dead simple to drop it into place in  your
vendors directory.

http://www.phpfreaks.com/forums/index.php?topic=186733.msg836776

Hope that helps.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: Moving from herding elephants to handling snakes...
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Re: Advice about a Calendar

2008-03-26 Thread Rob Russell

I don't have a lot of info but someone on #cakephp last week
recommended this one for mootools http://www.electricprism.com/aeron/calendar/.
I thought it looked pretty slick but I haven't even tried integrating
mootools in place of Prototype.js.

There's also this one
http://www.rubyinside.com/calendar-date-select-a-lightweight-prototype-based-datetime-picker-for-rails-developers-573.html
which is designed for Rails but since it relies on Prototype.js it
probably wouldn't be too hard to port (someone in the comments
mentions that it's usable without rails).

Sorry I don't have more detailed info but maybe one of these could be
a starting point. I'm going to have to integrate one myself sooner or
later but for now I'm taking notes.


On Mar 26, 1:50 pm, Grainne [EMAIL PROTECTED] wrote:
 Hi everyone,

 I was wondering if anyone has used a cake calendar in their apps -
 what they used and how well it worked, what sort of integration
 problems they encountered, etc.

 Thanks in advance!

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



Re: looking for a hosting company

2008-03-26 Thread Zoltan

Thanks for all the recommendations, looks like the company I'm doing
this for decided DreamHost was fine for now.

Zoltan
www.nachogrid.ca

On Mar 26, 1:59 pm, Rob  Russell [EMAIL PROTECTED] wrote:
 Anybody hosted Cake on 1and1? I've really liked them so far but I
 haven't pushed any Cake apps on to that server yet. I had a VPS
 (somewhere else) and ran in to trouble locking it down so I've been
 relegated to managed virtual hosting for now (though 1and1 has met my
 needs completely so far).

 On Mar 26, 1:06 pm, [EMAIL PROTECTED] wrote:

  I agree with Chris on the VPS. I use KnownHost and LiquidWeb and both
  have been terrific.

  brian fidler
  

 http://www.brianfidler.com

  Follow me on Twitter:http://www.twitter.com/brianfidler

  Quoting Chris Hartjes [EMAIL PROTECTED]:

   On Wed, Mar 26, 2008 at 12:20 PM, jelmer [EMAIL PROTECTED] wrote:

I can't recommend bluehost, you'll run into performance problems quite
quickly I think, unless you have a very simple app. I used to have a
(vbulletin) forum there and I was suspended a few times because of
performance issues. I've heard good things about mediatemple but am
using a futurehosting.biz vps right now which is all right.

   If you have any sort of sysadmin-fu, I recommend getting a VPS as
   well.  I'm on slicehost and have had ZERO problems since switching to
   them about 5 months ago.

   --
   Chris Hartjes
   Internet Loudmouth
   Motto for 2008: Moving from herding elephants to handling snakes...
   @TheKeyBoard:http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Changing action on the fly - by user type

2008-03-26 Thread Rob Russell

I don't want to use the ACL at the moment

If you intend to add it later then I'd recommend just biting the
bullet and putting ACL in now. It'll only get harder later. I found it
pretty easy to copy my User code from an older app into my current one
even though they're now based on 1.2 beta and the old app was 1.1 of
course I still need to test it out to make sure things are locked
down. You could probably find a decent tutorial to work from, user
rights are pretty much standard across many apps.

As for your current question I'd check and make sure that the action
you think is running is actually getting called. Then maybe there's
somewhere you need to tell it which view to render instead of the one
Cake already decided on, try just dumping the controller (set debug to
3 or use pr()) and see if it tells you which view it intends to render
(I think the render() function might be the one to set that).


On Mar 26, 9:10 am, Dan [EMAIL PROTECTED] wrote:
 Hi,

 I'd like to change the action on the fly on a per user type basis - I
 don't want to use the ACL at the moment ;)

 Is anyone else doing this successfully?

 I've modified my app_controller-beforeFilter to prepend the userype
 to the action so...

 controller-index

 would become

 controller-usertype_index

 but i'm noticing that the originally view gets called and the newly
 modified action gets called without function parameters.

 I'm assuming i'm not using this as intended, but wantd to see if
 anyone else is doing something similar?

 Cheers

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



Re: Localizate month names

2008-03-26 Thread Dardo Sordi Bogado

setlocale does work for me, I have this in app/config/bootstrap.php :

setlocale(LC_ALL, 'es_AR.utf8');


On Wed, Mar 26, 2008 at 8:29 AM, ygneo [EMAIL PROTECTED] wrote:

  Hi everybody!

  Anyone knows a good method to localizate month names when using $form-
  input with a date field?

  I mean, setlocale doesn't works for me, and I think it would works
  with L10n, with I haven't find out how...

  Thanks!

  


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



Editing paginator URL

2008-03-26 Thread Haris

I have a search query that I want to append to the paginator returned
URL. How can I append parameters to the URL?

Example: 
http://isharis.dnsalias.com/songs/search/page:2/relevance/?search=Red%20Jumpsuit

http://bin.cakephp.org/view/1344185837

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



Re: looking for a hosting company

2008-03-26 Thread Haris

In your own case, I would recommend you to stay away from dreamhost
aka nightmarehost.

On Mar 26, 11:16 pm, Zoltan [EMAIL PROTECTED] wrote:
 Thanks for all the recommendations, looks like the company I'm doing
 this for decided DreamHost was fine for now.

 Zoltanwww.nachogrid.ca

 On Mar 26, 1:59 pm, Rob  Russell [EMAIL PROTECTED] wrote:

  Anybody hosted Cake on 1and1? I've really liked them so far but I
  haven't pushed any Cake apps on to that server yet. I had a VPS
  (somewhere else) and ran in to trouble locking it down so I've been
  relegated to managed virtual hosting for now (though 1and1 has met my
  needs completely so far).

  On Mar 26, 1:06 pm, [EMAIL PROTECTED] wrote:

   I agree with Chris on the VPS. I use KnownHost and LiquidWeb and both
   have been terrific.

   brian fidler
   

  http://www.brianfidler.com

   Follow me on Twitter:http://www.twitter.com/brianfidler

   Quoting Chris Hartjes [EMAIL PROTECTED]:

On Wed, Mar 26, 2008 at 12:20 PM, jelmer [EMAIL PROTECTED] wrote:

 I can't recommend bluehost, you'll run into performance problems quite
 quickly I think, unless you have a very simple app. I used to have a
 (vbulletin) forum there and I was suspended a few times because of
 performance issues. I've heard good things about mediatemple but am
 using a futurehosting.biz vps right now which is all right.

If you have any sort of sysadmin-fu, I recommend getting a VPS as
well.  I'm on slicehost and have had ZERO problems since switching to
them about 5 months ago.

--
Chris Hartjes
Internet Loudmouth
Motto for 2008: Moving from herding elephants to handling snakes...
@TheKeyBoard:http://www.littlehart.net/atthekeyboard

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



Re: Changing action on the fly - by user type

2008-03-26 Thread Dan

Many thanks Rob,

Am doing pretty much what you've outlined in your second paragraph but
some extra debug should hopefully point out where cake is wandering
off ;o)

cheers,

D

On Mar 26, 6:20 pm, Rob  Russell [EMAIL PROTECTED] wrote:
 I don't want to use the ACL at the moment

 If you intend to add it later then I'd recommend just biting the
 bullet and putting ACL in now. It'll only get harder later. I found it
 pretty easy to copy my User code from an older app into my current one
 even though they're now based on 1.2 beta and the old app was 1.1 of
 course I still need to test it out to make sure things are locked
 down. You could probably find a decent tutorial to work from, user
 rights are pretty much standard across many apps.

 As for your current question I'd check and make sure that the action
 you think is running is actually getting called. Then maybe there's
 somewhere you need to tell it which view to render instead of the one
 Cake already decided on, try just dumping the controller (set debug to
 3 or use pr()) and see if it tells you which view it intends to render
 (I think the render() function might be the one to set that).

 On Mar 26, 9:10 am, Dan [EMAIL PROTECTED] wrote:

  Hi,

  I'd like to change the action on the fly on a per user type basis - I
  don't want to use the ACL at the moment ;)

  Is anyone else doing this successfully?

  I've modified my app_controller-beforeFilter to prepend the userype
  to the action so...

  controller-index

  would become

  controller-usertype_index

  but i'm noticing that the originally view gets called and the newly
  modified action gets called without function parameters.

  I'm assuming i'm not using this as intended, but wantd to see if
  anyone else is doing something similar?

  Cheers

  Dan

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



Re: Localizate month names

2008-03-26 Thread Guillaume

Yes., it works for me with French.

Be careful though with LC_ALL, because it has a wider effect than just
localizing month names... eg. for French, setting the separator for
float to the comma instead of the dot, which brings trouble when
inserting to a MySQL database not configured the same.

As to me, I simply use :

setlocale(LC_TIME,fr_FR.UTF-8);

Guillaume
--
Cake blog: http://cherryonthe.popnews.com

On 26 mar, 19:34, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
 setlocale does work for me, I have this in app/config/bootstrap.php :

 setlocale(LC_ALL, 'es_AR.utf8');On Wed, Mar 26, 2008 at 8:29 AM, ygneo 
 [EMAIL PROTECTED] wrote:

   Hi everybody!

   Anyone knows a good method to localizate month names when using $form-
   input with a date field?

   I mean, setlocale doesn't works for me, and I think it would works
   with L10n, with I haven't find out how...

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



Re: Advice about a Calendar

2008-03-26 Thread Gráinne O'Neill
thanks you guys - any other suggestions would be much appreciated!

Grainne

On Wed, Mar 26, 2008 at 1:08 PM, Rob Russell [EMAIL PROTECTED]
wrote:


 I don't have a lot of info but someone on #cakephp last week
 recommended this one for mootools
 http://www.electricprism.com/aeron/calendar/.
 I thought it looked pretty slick but I haven't even tried integrating
 mootools in place of Prototype.js.

 There's also this one

 http://www.rubyinside.com/calendar-date-select-a-lightweight-prototype-based-datetime-picker-for-rails-developers-573.html
 which is designed for Rails but since it relies on Prototype.js it
 probably wouldn't be too hard to port (someone in the comments
 mentions that it's usable without rails).

 Sorry I don't have more detailed info but maybe one of these could be
 a starting point. I'm going to have to integrate one myself sooner or
 later but for now I'm taking notes.


 On Mar 26, 1:50 pm, Grainne [EMAIL PROTECTED] wrote:
  Hi everyone,
 
  I was wondering if anyone has used a cake calendar in their apps -
  what they used and how well it worked, what sort of integration
  problems they encountered, etc.
 
  Thanks in advance!
 
  Grainne
 


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



saving records to polymorphic models

2008-03-26 Thread davidpersson

A File model  which uses the Polymorphic behavior (which is by the
way great).
It has a model and a foreign_key  field to bind associated models
on find operations.

An Ufo model which has following association set:

var $hasMany = array(   'Attachment' = array(
 
'foreignKey' = 'foreign_key',
 
'conditions' = array('model' = 'Ufo'),
)
);

When I'm  saving data of the Ufo plus associated File model data
both get saved but the new/updated associated File record lacks a
value for the model field (foreign_key has the correct value).

How can I retrieve the value for the model field without including
it in the to-be-saved File data?
Is this possible?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



default column values overwrite pre-existing values in Model::save()

2008-03-26 Thread aranworld

I am working on this ticket: https://trac.cakephp.org/ticket/4190

Up to now I have been operating under the idea that if I am updating a
record, that it is not necessary to explicitly declare the values for
every column in the database row.

I figured that in the logic for Model::save() that it would check to
make sure that if any values are already set, that those values will
not get overwritten.

However, after doing a bit of investigating, it appears that my
assumption might be wrong.

According to my reading of the logic within the Model class, the
following happens:

-- if the column 'fieldname' has a default value in it's scheme, this
value is set in $this-data[ tablename ][ fieldname ]
-- if the $data array passed to either create() or save() does not
have an explicitly set value for $this-data[ tablename ]
[ fieldname ], then the default value will be entered EVEN IF A VALUE
CURRENTLY EXISTS.

Is this a bug?  Or is this how it is supposed to work?  Should we
always be using the controller to retrieve all values in a record
before sending that data array to the Model::save() function?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Define the GMT ?

2008-03-26 Thread Neveldo

Hi all,

How we can take account of the timezone GMT ?

For example, the fieds created and updated are based on the PHP
function time() or the sql function NOW() ?

What is the best way to define the timezone in a cakePHP application ?

thank !

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



generateList combining fields in valuePath

2008-03-26 Thread Steve

I have two fields in my table that I want to display as one field in
my add form.
ie: dorm_building, dorm_room = dorm_assignment (field names)
ie: South, 203 = South 203 (field values)

I have the following code in my controller:

$available_rooms = $this-Dorm-generateList(array('available' =
'Y'), null, null, '{n}.Dorm.id', '{n}.Dorm.dorm_room');
$this-set('available', $available_rooms);

Which only shows me the dorm_room and only one record in my add
form.

I suspect that I may need to upgrade my version of my Core CakePHP in
order to make use of a combined valuePath, as seen in the statement
below:

$available_rooms = $this-Dorm-generateList(array('available' =
'Y'), null, null, '{n}.Dorm.id', array('{0}-{1}',
'{n}.Dorm.dorm_building', '{n}.Dorm.dorm_room'));

The above statement gives me no records in the add form.

However, when I upgrade my core Cake, my other apps stop working. So
here are my questions:

1. Without upgrading can I combine two fields into one displayed field
without using CONCAT or any work on the DB side? (most efficient way
possible)

2. If I need to point my dorm app to the new version of Cake, what
syntax do I need to enter so that it works? I tried modifying the
webroot/index.php file to point to the new version of cake, and I
received errors that the page could not be found.

While I've been working with PHP for some time, I am not a programmer.
That being said, your patience with my ignorance is appreciated.


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



Best practice for SQL data sanitation

2008-03-26 Thread Travis

Hi, I'm trying to figure out the best way to sanitize a text field of
data that is to be saved to a mysql database.
I have tried the Sanitize-sql() function which adds slashes to any
characters that might be interpreted as sql. But then when displaying
this data I'm not quite sure how to strip out only those added
slashes, as I will probably allow legitimate slashes as well in the
text.

I have also tried the Sanitize-html function but I'm not sure if html
entities are safe for SQL.

I'm wondering the best practice is for saving and re-displaying data
such as this.

Thanks in advance for the support.

-Travis

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



Include PHP code in view

2008-03-26 Thread CodeHooligans

Hello all,

I'm having a but of an issue. I have two forms. But are simple and
submit to discrete backend controllers. Both have their own set of
views (add, edit, index). Each submit into respective tables in the
database. I'm running cake 1.1.xxx (The current stable release).

So here is my issue. I'm try to just include a common function that is
used in each of the index.thtml files. I've tried a traditional PHP
include. Placed the php file under the site root and tried including
the path and filename. Something I would do under a normal PHP
environment.

The included file will load without issues. Meaning if I use require()
no error is reported. The problem is the function that is inside the
included file is not loaded.

I've read through the other message and have tried the app/vendors and
calling the include file via vendor('filename'); without much luck.

What am I missing here? The function runs fine when I place it
directly into the index.thtml files(s). My problem is I really don't
want to have this in 2 different places. It's the same code. Also I
would put this in the controller but again it would need to be in both
controllers. Does not seem efficient to me.

P-

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



Re: looking for a hosting company

2008-03-26 Thread aranworld

Wow, KnownHost has some really low cost VPS plans.  Brian, what level
plan are you on?

I have been happy with Textdrive for the last 2+ years now.  They are
now called Joyent, and offer shared hosting with their Connector
package:

http://joyent.com/connector/web-hosting/

For a shared hosting environment, I think they offer one of the best
feature sets out there.  At one point a couple years ago, they had
quite a few problems with reliability, but eventually they sorted
things out and I almost never have problems with them anymore.


On Mar 26, 11:39 am, Haris [EMAIL PROTECTED] wrote:
 In your own case, I would recommend you to stay away from dreamhost
 aka nightmarehost.

 On Mar 26, 11:16 pm, Zoltan [EMAIL PROTECTED] wrote:

  Thanks for all the recommendations, looks like the company I'm doing
  this for decided DreamHost was fine for now.

  Zoltanwww.nachogrid.ca

  On Mar 26, 1:59 pm, Rob  Russell [EMAIL PROTECTED] wrote:

   Anybody hosted Cake on 1and1? I've really liked them so far but I
   haven't pushed any Cake apps on to that server yet. I had a VPS
   (somewhere else) and ran in to trouble locking it down so I've been
   relegated to managed virtual hosting for now (though 1and1 has met my
   needs completely so far).

   On Mar 26, 1:06 pm, [EMAIL PROTECTED] wrote:

I agree with Chris on the VPS. I use KnownHost and LiquidWeb and both
have been terrific.

brian fidler


   http://www.brianfidler.com

Follow me on Twitter:http://www.twitter.com/brianfidler

Quoting Chris Hartjes [EMAIL PROTECTED]:

 On Wed, Mar 26, 2008 at 12:20 PM, jelmer [EMAIL PROTECTED] wrote:

  I can't recommend bluehost, you'll run into performance problems 
 quite
  quickly I think, unless you have a very simple app. I used to have a
  (vbulletin) forum there and I was suspended a few times because of
  performance issues. I've heard good things about mediatemple but am
  using a futurehosting.biz vps right now which is all right.

 If you have any sort of sysadmin-fu, I recommend getting a VPS as
 well.  I'm on slicehost and have had ZERO problems since switching to
 them about 5 months ago.

 --
 Chris Hartjes
 Internet Loudmouth
 Motto for 2008: Moving from herding elephants to handling snakes...
 @TheKeyBoard:http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Define the GMT ?

2008-03-26 Thread aranworld

Go to PHP.net and search timezone.

http://php.net/manual/en/ref.datetime.php#ini.date.timezone

If you don't have access to php.ini, you can also set this value in
an .htaccess file.

On Mar 26, 2:05 pm, Neveldo [EMAIL PROTECTED] wrote:
 Hi all,

 How we can take account of the timezone GMT ?

 For example, the fieds created and updated are based on the PHP
 function time() or the sql function NOW() ?

 What is the best way to define the timezone in a cakePHP application ?

 thank !

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



Non Numeric index issues.

2008-03-26 Thread Defranco

Hi all,

I'm having multiple problems using non numeric index with Mysql and
CakePHP 1.2, specifically when it reaches a index that is a pure
number -- AFAIK, cakephp supports non numeric index.

Example: I have this table using a non numeric index:

id* (varchar) |  foo (varchar)

xpto  | null
9abc | null
9 | null

It works perfectly while making operations for the items with
id='xpto' and id='9abc', but it will not work while dealing with the
id='9' item due cakephp will use 9 instead of '9' in Mysql queries
that will take item id='9abc' too.

Here are the problems that I'm facing:

1) If I try to count the elements with id='9' it will tell me 2
instead of 1:
$id = '9';
$conditions = array('id' = $id);
$count = $this-NonNumericIndexTest-find('count',
array('conditions' = $conditions));
//it will produce a $count = 2 instead of 1  due it will consider
id='9abc'  item too.

2) if I try to update item with id='9', it will update id='9abc' data
too
$id = '9';
$fields = array('foo'='this should be for id=9 only');
$conditions = array('id' = $id);
$this-NonNumericIndexTest-updateAll($fields, $conditions);
//it will update id='9abc' data too.


3) It will not allow to update id='9' data using save() due exists a
id='9abc':
$data = array();
$data['NonNumericIndex'] = array ('id' = '9',
'foo' = 'This will never be 
saved due already exists a id=9abc
and id=9');
$result = $this-NonNumericIndexTest-save($data, false);
// This will produce a $result=false and no data will be updated

4) If I try to delete id='9' item, id='9abc' will be gone too.
  $this-NonNumericIndexTest-delete('9');
// items id='9' and id='9abc' are gone.

There is workarounds for item (1) for example using literal conditions
like: `id` =  '$id'  but I don't know how to make item (3) work.

I tested it on cake 1.2 beta (6311) and svn (6609) but for both
versions  all 4 cases  failed.

Am I doing something very wrong or this is really a bug? I prepared
some test cases and I'm thinking in issue a bug on trac for this.

...please so not suggest to use numerical index - this is not an
option for me right now.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Include PHP code in view

2008-03-26 Thread Joel

You can paste some code into bootstrap.php, which then makes your
function available everywhere.  You should never include business/
controller logic into a view; that's just bad practice.

Well, putting code in the bootstrap.php file is also not very MVC-
pattern compliant, but sometimes you gotta do whatcha gotta do.

-J.

On Mar 26, 5:20 pm, CodeHooligans [EMAIL PROTECTED] wrote:
 Hello all,

 I'm having a but of an issue. I have two forms. But are simple and
 submit to discrete backend controllers. Both have their own set of
 views (add, edit, index). Each submit into respective tables in the
 database. I'm running cake 1.1.xxx (The current stable release).

 So here is my issue. I'm try to just include a common function that is
 used in each of the index.thtml files. I've tried a traditional PHP
 include. Placed the php file under the site root and tried including
 the path and filename. Something I would do under a normal PHP
 environment.

 The included file will load without issues. Meaning if I use require()
 no error is reported. The problem is the function that is inside the
 included file is not loaded.

 I've read through the other message and have tried the app/vendors and
 calling the include file via vendor('filename'); without much luck.

 What am I missing here? The function runs fine when I place it
 directly into the index.thtml files(s). My problem is I really don't
 want to have this in 2 different places. It's the same code. Also I
 would put this in the controller but again it would need to be in both
 controllers. Does not seem efficient to me.

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



Re: Best practice for SQL data sanitation

2008-03-26 Thread Adam Royle

Cake automatically handles quoting strings etc when saving to the
database. Sanitize is more for disallowing certain data into your
database, such as script tags or whatever.

Cheers,
Adam

On Mar 27, 7:03 am, Travis [EMAIL PROTECTED] wrote:
 Hi, I'm trying to figure out the best way to sanitize a text field of
 data that is to be saved to a mysql database.
 I have tried the Sanitize-sql() function which adds slashes to any
 characters that might be interpreted as sql. But then when displaying
 this data I'm not quite sure how to strip out only those added
 slashes, as I will probably allow legitimate slashes as well in the
 text.

 I have also tried the Sanitize-html function but I'm not sure if html
 entities are safe for SQL.

 I'm wondering the best practice is for saving and re-displaying data
 such as this.

 Thanks in advance for the support.

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



Run query in background while showing Please wait

2008-03-26 Thread kdecapite

I have a CakePHP CRM application with 30,000+ contact records. Each
Contact hasMany Address records. One feature of my app is to allow my
client to search for duplicate entries within the contacts table
before importing new contacts. In short, I am querying the entire
Contact table and LEFT JOINing with the Address table. I store the
result set into an array and then use PHP's array functions to filter
potential duplicates from a pending contacts table.

What I want to do is somehow run this entire process (the database
query and array comparison) in the background (perhaps with a PHP
exec() call) and show some type of Loading, please wait... interface
to the application user. I'm thinking something similar to Expedia's
Please wait while we search for your flight interface.

The problem is, how would I do this? Any ideas or suggestions are
welcome! Thanks in advance...

- Kevin

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



Re: Changing action on the fly - by user type

2008-03-26 Thread Joel

The action you specify initially is parsed at the Dispatcher level,
before anything is asked of the controller. As a result, by prepending
your new action name in the before filter, all you're really changing
is the value of $this-params['action'], and not the actual action
that is being called by the Dispatcher.

See http://api.cakephp.org/1.2/dispatcher_8php-source.html#l00183


On Mar 26, 3:25 pm, Dan [EMAIL PROTECTED] wrote:
 Many thanks Rob,

 Am doing pretty much what you've outlined in your second paragraph but
 some extra debug should hopefully point out where cake is wandering
 off ;o)

 cheers,

 D

 On Mar 26, 6:20 pm, Rob  Russell [EMAIL PROTECTED] wrote:

  I don't want to use the ACL at the moment

  If you intend to add it later then I'd recommend just biting the
  bullet and putting ACL in now. It'll only get harder later. I found it
  pretty easy to copy my User code from an older app into my current one
  even though they're now based on 1.2 beta and the old app was 1.1 of
  course I still need to test it out to make sure things are locked
  down. You could probably find a decent tutorial to work from, user
  rights are pretty much standard across many apps.

  As for your current question I'd check and make sure that the action
  you think is running is actually getting called. Then maybe there's
  somewhere you need to tell it which view to render instead of the one
  Cake already decided on, try just dumping the controller (set debug to
  3 or use pr()) and see if it tells you which view it intends to render
  (I think the render() function might be the one to set that).

  On Mar 26, 9:10 am, Dan [EMAIL PROTECTED] wrote:

   Hi,

   I'd like to change the action on the fly on a per user type basis - I
   don't want to use the ACL at the moment ;)

   Is anyone else doing this successfully?

   I've modified my app_controller-beforeFilter to prepend the userype
   to the action so...

   controller-index

   would become

   controller-usertype_index

   but i'm noticing that the originally view gets called and the newly
   modified action gets called without function parameters.

   I'm assuming i'm not using this as intended, but wantd to see if
   anyone else is doing something similar?

   Cheers

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



Re: Include PHP code in view

2008-03-26 Thread CodeHooligans

Thanks for the reply Joel. As usual just after I posted this tried
something else and got this working. I was placing the 'vendor();'
call at the bottom of the index.thtml file. As I replaced the original
function with it. I've found if I place the vendor() call before the
function is needed it works fine. Strange PHP.

As for the comment on the no business logic in the View I agree. But
then again I never actually stated what this function I'm including
does. It's not business logic. It's just code to help build the radio
buttons sets since each form (a Questionnaire) has 80+ questions. It's
similar to the built-in Cake function for building say an input field.
But for my case I need to wrap some HTML code around each question and
Yes/No radio button set. It's easier to place this into a function to
build the view output then manually for each of the questions.

P-



On Mar 26, 4:56 pm, Joel [EMAIL PROTECTED] wrote:
 You can paste some code into bootstrap.php, which then makes your
 function available everywhere.  You should never include business/
 controller logic into a view; that's just bad practice.

 Well, putting code in the bootstrap.php file is also not very MVC-
 pattern compliant, but sometimes you gotta do whatcha gotta do.

 -J.

 On Mar 26, 5:20 pm, CodeHooligans [EMAIL PROTECTED] wrote:

  Hello all,

  I'm having a but of an issue. I have two forms. But are simple and
  submit to discrete backend controllers. Both have their own set of
  views (add, edit, index). Each submit into respective tables in the
  database. I'm running cake 1.1.xxx (The current stable release).

  So here is my issue. I'm try to just include a common function that is
  used in each of the index.thtml files. I've tried a traditional PHP
  include. Placed the php file under the site root and tried including
  the path and filename. Something I would do under a normal PHP
  environment.

  The included file will load without issues. Meaning if I use require()
  no error is reported. The problem is the function that is inside the
  included file is not loaded.

  I've read through the other message and have tried the app/vendors and
  calling the include file via vendor('filename'); without much luck.

  What am I missing here? The function runs fine when I place it
  directly into the index.thtml files(s). My problem is I really don't
  want to have this in 2 different places. It's the same code. Also I
  would put this in the controller but again it would need to be in both
  controllers. Does not seem efficient to me.

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



Re: Include PHP code in view

2008-03-26 Thread Samuel DeVore

On Wed, Mar 26, 2008 at 3:15 PM, CodeHooligans [EMAIL PROTECTED] wrote:

  As for the comment on the no business logic in the View I agree. But
  then again I never actually stated what this function I'm including
  does. It's not business logic. It's just code to help build the radio
  buttons sets since each form (a Questionnaire) has 80+ questions. It's
  similar to the built-in Cake function for building say an input field.
  But for my case I need to wrap some HTML code around each question and
  Yes/No radio button set. It's easier to place this into a function to
  build the view output then manually for each of the questions.

Sounds to me like you should make a helper for yourself to contain
these kinds of functions...

-- 
-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/
http://blog.samdevore.com/cakephp-pages/i-cant-bake/

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



Re: Run query in background while showing Please wait

2008-03-26 Thread bingo

you will need to use Ajax
search on ajax + cakePHP



On Mar 26, 6:04 pm, kdecapite [EMAIL PROTECTED] wrote:
 I have a CakePHP CRM application with 30,000+ contact records. Each
 Contact hasMany Address records. One feature of my app is to allow my
 client to search for duplicate entries within the contacts table
 before importing new contacts. In short, I am querying the entire
 Contact table and LEFT JOINing with the Address table. I store the
 result set into an array and then use PHP's array functions to filter
 potential duplicates from a pending contacts table.

 What I want to do is somehow run this entire process (the database
 query and array comparison) in the background (perhaps with a PHP
 exec() call) and show some type of Loading, please wait... interface
 to the application user. I'm thinking something similar to Expedia's
 Please wait while we search for your flight interface.

 The problem is, how would I do this? Any ideas or suggestions are
 welcome! Thanks in advance...

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



Re: Include PHP code in view

2008-03-26 Thread CodeHooligans

Okay, sounds good. So where do I find this information on building my
own helper? Please provide a link to some instructions if you can.

Thanks.
P-

On Mar 26, 5:24 pm, Samuel DeVore [EMAIL PROTECTED] wrote:
 On Wed, Mar 26, 2008 at 3:15 PM, CodeHooligans [EMAIL PROTECTED] wrote:
   As for the comment on the no business logic in the View I agree. But
   then again I never actually stated what this function I'm including
   does. It's not business logic. It's just code to help build the radio
   buttons sets since each form (a Questionnaire) has 80+ questions. It's
   similar to the built-in Cake function for building say an input field.
   But for my case I need to wrap some HTML code around each question and
   Yes/No radio button set. It's easier to place this into a function to
   build the view output then manually for each of the questions.

 Sounds to me like you should make a helper for yourself to contain
 these kinds of functions...

 --
 --
 (the old fart) the advice is free, the lack of crankiness will cost you

 - its a fine line between a real question and an idiot

 http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/http://blog.samdevore.com/cakephp-pages/i-cant-bake/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Include PHP code in view

2008-03-26 Thread jonknee

 Okay, sounds good. So where do I find this information on building my
 own helper? Please provide a link to some instructions if you can.

A helper is definitely what you want here. They are really easy:

http://manual.cakephp.org/chapter/helpers (Section 2, all the way at
the bottom)

Basically you create a file in the helpers directory called common.php
and then inside it define your class:

?php
class CommonHelper extends Helper {
function myFunc($data) {
return $data;
}
}
?

Now in your view you can call your function like ?php echo $common-
myFunc($data); ?. Just make sure you include the helper inside your
controller or AppController.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Run query in background while showing Please wait

2008-03-26 Thread jonknee

 I have a CakePHP CRM application with 30,000+ contact records. Each
 Contact hasMany Address records. One feature of my app is to allow my
 client to search for duplicate entries within the contacts table
 before importing new contacts. In short, I am querying the entire
 Contact table and LEFT JOINing with the Address table. I store the
 result set into an array and then use PHP's array functions to filter
 potential duplicates from a pending contacts table.

What exactly are you doing? It can probably be handled pretty quickly
by the database. You shouldn't have to manually fish out dupes.

I always thought the please wait while we search messages were either
a [poor] attempt to seem extra high-tech or a sign that they have a
really inefficient system. Google searches the whole web--not just a
day's commercial flights--and comes back in a flash.

I have used a PHP app with a valid reason for it, it was a mailing
list program and it accomplished sending large amounts of email out by
batching (the page would keep reloading with incrementing GET
variables, such as start=0num=100). It wouldn't work in your case.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: looking for a hosting company

2008-03-26 Thread jonknee

I have been enjoying LiquidWeb. I don't host any Cake stuff there at
the moment, but have had no problems with a shared account and have
been really impressed with a VPS (which hosts a fairly busy vBulletin
forum). They don't do crazy overselling like Dreamhost .
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Advice about a Calendar

2008-03-26 Thread jonknee

 I was wondering if anyone has used a cake calendar in their apps -
 what they used and how well it worked, what sort of integration
 problems they encountered, etc.

Not sure exactly what you need, but Yahoo has a really nice calendar
solution inside its YUI platform. You'll recognize it from their apps
(Yahoo Travel especially).

http://developer.yahoo.com/yui/calendar/

I haven't used it with CakePHP, but and of these JavaScript solutions
should be pretty easy to integrate.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Run query in background while showing Please wait

2008-03-26 Thread kdecapite

What I have is an ImportContact model which is simply a table
containing basic information about a person (name, email, address,
etc). This table gets populated either from a standard website
Contact Us form or by my client manually importing a CSV file. Now,
once this ImportContact model has new records in it, I want to display
a list of *potential* duplicates by various criteria. The master
contacts model is simply called Contact and contains 30,000+ records.
The Contact model does NOT include addresses, there is a separate
Address model for this (again, with 30,000+ records).

The reason I can't have the database do the searching for me is
because the criteria I want to search against to find potential
duplicates doesn't have a direct one-to-one correlation to the
database table fields.

For example this duplicate search criteria works great using Cake:

- Show potential duplicates based on field `email1`
- Cake will generate a SELECT...IN query, listing ALL email addresses
from the ImportContact model and returning all records from the
Contact model containing anyone of the listed emails

However, this example does NOT work:

- Show potential duplicates based on fields `fn` and `ln` (a person's
full name)
- Since I have to CONCAT(`fn`, `ln`) AS `full_name`, the SELECT...IN
syntax no longer works

So what I did was query ALL records from both ImportContact and
Contact models and store each of these result sets in their own
arrays. Then I perform the search using PHP array functions and store
the potential duplicates in a third array. This is working great, but
it's just on the slow side (sometimes 3+ minutes). It's not just the
array searching that's taking a while either, it's actually the
database query retrieving 30,000+ records that's slowing things down
as well.

I'm just giving a brief overview here and can provide specific code if
you like. Thanks for the quick replies, maybe I can get this thing to
run more efficiently but I'm not quite sure how :-/

- Kevin


On Mar 26, 4:14 pm, jonknee [EMAIL PROTECTED] wrote:
  I have a CakePHP CRM application with 30,000+ contact records. Each
  Contact hasMany Address records. One feature of my app is to allow my
  client to search for duplicate entries within the contacts table
  before importing new contacts. In short, I am querying the entire
  Contact table and LEFT JOINing with the Address table. I store the
  result set into an array and then use PHP's array functions to filter
  potential duplicates from a pending contacts table.

 What exactly are you doing? It can probably be handled pretty quickly
 by the database. You shouldn't have to manually fish out dupes.

 I always thought the please wait while we search messages were either
 a [poor] attempt to seem extra high-tech or a sign that they have a
 really inefficient system. Google searches the whole web--not just a
 day's commercial flights--and comes back in a flash.

 I have used a PHP app with a valid reason for it, it was a mailing
 list program and it accomplished sending large amounts of email out by
 batching (the page would keep reloading with incrementing GET
 variables, such as start=0num=100). It wouldn't work in your case.

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



Re: Localizate month names

2008-03-26 Thread Dardo Sordi Bogado

  Be careful though with LC_ALL, because it has a wider effect than just
  localizing month names... eg. for French, setting the separator for
  float to the comma instead of the dot, which brings trouble when
  inserting to a MySQL database not configured the same.

Yes, I know, but that was also a requirement for the app.

  As to me, I simply use :

  setlocale(LC_TIME,fr_FR.UTF-8);

  Guillaume
  --
  Cake blog: http://cherryonthe.popnews.com


  On 26 mar, 19:34, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
   setlocale does work for me, I have this in app/config/bootstrap.php :
  


  setlocale(LC_ALL, 'es_AR.utf8');On Wed, Mar 26, 2008 at 8:29 AM, ygneo 
  [EMAIL PROTECTED] wrote:
  
 Hi everybody!
  
 Anyone knows a good method to localizate month names when using $form-
 input with a date field?
  
 I mean, setlocale doesn't works for me, and I think it would works
 with L10n, with I haven't find out how...
  
 Thanks!
  


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



Re: Run query in background while showing Please wait

2008-03-26 Thread jonknee

 The reason I can't have the database do the searching for me is
 because the criteria I want to search against to find potential
 duplicates doesn't have a direct one-to-one correlation to the
 database table fields.

Hmm. Is there a way you could make them directly correlate? It's a
pretty fast DB query if you can get them to line up. If I'm
understanding it correctly, you just have a full name in the import
model and broken out first and last names in your contact model. This
can work, though you'll probably need some manual SQL. Instead of
CONCAT you want to use CONTACT_WS(' ', 'fn', 'ls) which will result in
a space between the first and last names.

SELECT * FROM contactImport WHERE full_name IN (SELECT CONCAT_WS(' ',
first_name, last_name) FROM contact)

That will match a record in contactImport with a full_name of Joe
Blow when there is a record in contact with a first name of Joe and
a last name of Blow.

The beauty of doing the heavy lifting in SQL, even if you can't do it
in the ORM, is that you only have to bring the matches across the
wire. So instead of a minimum of 30,000 records coming out of the DB
(and each getting messed around with Cake's ORM) you get only the
dupes.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: .po files not being read suddenly

2008-03-26 Thread [EMAIL PROTECTED]

I think I've narrowed down the problem if not the solution. Looking
through i18n.php I noticed that the getInstance() method checks the
session, but only if the language is not found in the core config.

function getInstance() {
static $instance = array();
if (!$instance) {
$instance[0] = new I18n();
$instance[0]-l10n = new L10n();

$language = Configure::read('Config.language');
if ($language === null  
!empty($_SESSION['Config']['language'])) {
$language = $_SESSION['Config']['language'];
}

$instance[0]-l10n-get($language);
}
return $instance[0];
}

Since I'm doing language switching this seems backwards to me. If it's
been switched, the new language would never be picked up here, it
seems. Anyway, I stuck debug(i18n: ${language}); in there but
$language is consistently empty.

Trying my initial hunch, I modified the method to have:

if (!empty($_SESSION['Config']['language']))
{
$language = $_SESSION['Config']['language'];
}
else
{
$language = Configure::read('Config.language');
}

This seems more reasonable to me because my language switching code (a
modified version of  Jason Chow's P28NComponent) is writing the newly-
requested lang to the session.

But the debug() is still showing it's empty, however. So, I put
debug($_SESSION) in my default.ctp and it properly shows the new
language, eg:

Array
(
[Config] = Array
(
[userAgent] = 67d3fbdba7bd59adfe49aefd8b4eb32b
[time] = 1206579533
[rand] = 563719418
[timeout] = 9
[language] = fr
)
)

When I print the output from Configure::read('Config.language') on the
page I see en-us. This doesn't change even when I modify the
component to add a Configure::write('Config.language', $lang);

Does anyone have any thoughts on why the session appears to be empty
in the i18n class? And, if this is normal, why getInstance() would
bother checking it?

On Mar 26, 12:59 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
 I got some L10n stuff working yesterday but it now seems to have
 stopped. I'd extracted a new default.pot file because I had a lot more
 strings to translate. I had the script overwrite the one I made
 yesterday and copied it into:

 locale/eng/LC_MESSAGES/default.po
 locale/fre/LC_MESSAGES/default.po
 locale/spa/LC_MESSAGES/default.po

 Later on, I noticed that I wasn't seeing any changes when switching
 languages. $session-read('Config.language') does show the change from
 one language to another. And I can immediately see changes to a msgstr
 in the eng default.po, so I know that one's being read.

 I have caching disabled and I've made no other changes to core.
 Neither have I done anything to the language settings I had.

 Any idea what I may have done (or left out) to cause this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: .po files not being read suddenly

2008-03-26 Thread [EMAIL PROTECTED]

Stranger and stranger. I decided to disable Auth because it was that
that I'd added to the site before i18n stopped working. As soon as I
did that, my Configure::read('Config.language') now shows the new
language setting. Why would Auth be screwing around with
Config.language?

Unfortunately, I'm still not seeing anything translated ;-(

I'm using cake_1.2.x.x_24.01.2008, btw.

As an aside, does anyone know how to globally disable Auth without
removing it from the $components array in AppController? Doing that
isn't great because I then had to comment out all of the Auth-
allow(...) calls in 5 other controllers.

On Mar 26, 9:37 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
 I think I've narrowed down the problem if not the solution. Looking
 through i18n.php I noticed that the getInstance() method checks the
 session, but only if the language is not found in the core config.

 function getInstance() {
 static $instance = array();
 if (!$instance) {
 $instance[0] = new I18n();
 $instance[0]-l10n = new L10n();

 $language = Configure::read('Config.language');
 if ($language === null  
 !empty($_SESSION['Config']['language'])) {
 $language = $_SESSION['Config']['language'];
 }

 $instance[0]-l10n-get($language);
 }
 return $instance[0];

 }

 Since I'm doing language switching this seems backwards to me. If it's
 been switched, the new language would never be picked up here, it
 seems. Anyway, I stuck debug(i18n: ${language}); in there but
 $language is consistently empty.

 Trying my initial hunch, I modified the method to have:

 if (!empty($_SESSION['Config']['language']))
 {
 $language = $_SESSION['Config']['language'];}

 else
 {
 $language = Configure::read('Config.language');

 }

 This seems more reasonable to me because my language switching code (a
 modified version of  Jason Chow's P28NComponent) is writing the newly-
 requested lang to the session.

 But the debug() is still showing it's empty, however. So, I put
 debug($_SESSION) in my default.ctp and it properly shows the new
 language, eg:

 Array
 (
 [Config] = Array
 (
 [userAgent] = 67d3fbdba7bd59adfe49aefd8b4eb32b
 [time] = 1206579533
 [rand] = 563719418
 [timeout] = 9
 [language] = fr
 )
 )

 When I print the output from Configure::read('Config.language') on the
 page I see en-us. This doesn't change even when I modify the
 component to add a Configure::write('Config.language', $lang);

 Does anyone have any thoughts on why the session appears to be empty
 in the i18n class? And, if this is normal, why getInstance() would
 bother checking it?

 On Mar 26, 12:59 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
 wrote:

  I got some L10n stuff working yesterday but it now seems to have
  stopped. I'd extracted a new default.pot file because I had a lot more
  strings to translate. I had the script overwrite the one I made
  yesterday and copied it into:

  locale/eng/LC_MESSAGES/default.po
  locale/fre/LC_MESSAGES/default.po
  locale/spa/LC_MESSAGES/default.po

  Later on, I noticed that I wasn't seeing any changes when switching
  languages. $session-read('Config.language') does show the change from
  one language to another. And I can immediately see changes to a msgstr
  in the eng default.po, so I know that one's being read.

  I have caching disabled and I've made no other changes to core.
  Neither have I done anything to the language settings I had.

  Any idea what I may have done (or left out) to cause this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Sanitize binary data

2008-03-26 Thread [EMAIL PROTECTED]

Iam creating a system that stores files in a database, I would like to
know if there is no problem in not sanitizing bynary data, I exclude
some type of extensions like .exe .zip and others in the upload
process. Can someone make a SQL injection or some kind of attack
uploading binary data that it is not Sanitized.

Iam using cakePHP and I have used the Sanitize::escape function to
sanitize my data but it transforms binary data and it is unreadable
when I try to download it again.
How can I solve this problem?

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



Re: .po files not being read suddenly

2008-03-26 Thread [EMAIL PROTECTED]

Solved! When I added the Auth stuff yesterday, I included some
settings in AppController::beforeFilter(), including:

$this-Auth-loginError = __('Invalid e-mail / password combination.
Please try again', true);

Once I commented that out everything worked as before. So this call to
translate() was somehow messing things up royally.

And, it seems obvious to me now that setting this is unnecessary
because I can place it in the login() method's flash msg.

On Mar 26, 9:55 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
 Stranger and stranger. I decided to disable Auth because it was that
 that I'd added to the site before i18n stopped working. As soon as I
 did that, my Configure::read('Config.language') now shows the new
 language setting. Why would Auth be screwing around with
 Config.language?

 Unfortunately, I'm still not seeing anything translated ;-(

 I'm using cake_1.2.x.x_24.01.2008, btw.

 As an aside, does anyone know how to globally disable Auth without
 removing it from the $components array in AppController? Doing that
 isn't great because I then had to comment out all of the Auth-

 allow(...) calls in 5 other controllers.

 On Mar 26, 9:37 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
 wrote:

  I think I've narrowed down the problem if not the solution. Looking
  through i18n.php I noticed that the getInstance() method checks the
  session, but only if the language is not found in the core config.

  function getInstance() {
  static $instance = array();
  if (!$instance) {
  $instance[0] = new I18n();
  $instance[0]-l10n = new L10n();

  $language = Configure::read('Config.language');
  if ($language === null  
  !empty($_SESSION['Config']['language'])) {
  $language = $_SESSION['Config']['language'];
  }

  $instance[0]-l10n-get($language);
  }
  return $instance[0];

  }

  Since I'm doing language switching this seems backwards to me. If it's
  been switched, the new language would never be picked up here, it
  seems. Anyway, I stuck debug(i18n: ${language}); in there but
  $language is consistently empty.

  Trying my initial hunch, I modified the method to have:

  if (!empty($_SESSION['Config']['language']))
  {
  $language = $_SESSION['Config']['language'];}

  else
  {
  $language = Configure::read('Config.language');

  }

  This seems more reasonable to me because my language switching code (a
  modified version of  Jason Chow's P28NComponent) is writing the newly-
  requested lang to the session.

  But the debug() is still showing it's empty, however. So, I put
  debug($_SESSION) in my default.ctp and it properly shows the new
  language, eg:

  Array
  (
  [Config] = Array
  (
  [userAgent] = 67d3fbdba7bd59adfe49aefd8b4eb32b
  [time] = 1206579533
  [rand] = 563719418
  [timeout] = 9
  [language] = fr
  )
  )

  When I print the output from Configure::read('Config.language') on the
  page I see en-us. This doesn't change even when I modify the
  component to add a Configure::write('Config.language', $lang);

  Does anyone have any thoughts on why the session appears to be empty
  in the i18n class? And, if this is normal, why getInstance() would
  bother checking it?

  On Mar 26, 12:59 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
  wrote:

   I got some L10n stuff working yesterday but it now seems to have
   stopped. I'd extracted a new default.pot file because I had a lot more
   strings to translate. I had the script overwrite the one I made
   yesterday and copied it into:

   locale/eng/LC_MESSAGES/default.po
   locale/fre/LC_MESSAGES/default.po
   locale/spa/LC_MESSAGES/default.po

   Later on, I noticed that I wasn't seeing any changes when switching
   languages. $session-read('Config.language') does show the change from
   one language to another. And I can immediately see changes to a msgstr
   in the eng default.po, so I know that one's being read.

   I have caching disabled and I've made no other changes to core.
   Neither have I done anything to the language settings I had.

   Any idea what I may have done (or left out) to cause this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice for SQL data sanitation

2008-03-26 Thread b logica

For the record, HTML entities are harmless WRT SQL injection.

On Wed, Mar 26, 2008 at 6:00 PM, Adam Royle [EMAIL PROTECTED] wrote:

  Cake automatically handles quoting strings etc when saving to the
  database. Sanitize is more for disallowing certain data into your
  database, such as script tags or whatever.

  Cheers,
  Adam



  On Mar 27, 7:03 am, Travis [EMAIL PROTECTED] wrote:
   Hi, I'm trying to figure out the best way to sanitize a text field of
   data that is to be saved to a mysql database.
   I have tried the Sanitize-sql() function which adds slashes to any
   characters that might be interpreted as sql. But then when displaying
   this data I'm not quite sure how to strip out only those added
   slashes, as I will probably allow legitimate slashes as well in the
   text.
  
   I have also tried the Sanitize-html function but I'm not sure if html
   entities are safe for SQL.
  
   I'm wondering the best practice is for saving and re-displaying data
   such as this.
  
   Thanks in advance for the support.
  
   -Travis
  


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



Re: Sanitize binary data

2008-03-26 Thread b logica

The Sanitize methods are for operating on text only and won't do your
binary data any good at all. Binary data should be safe to insert into
your database because it won't be interpreted as instructions (which
are text only).

I won't discount it completely, as I've seen some pretty amazingly
clever hacks. But, unless the data could somehow be interpreted as
text you should be fine. I think this question would be better posed
on a list dedicated to whichever database you're using if you want to
be sure.

On Wed, Mar 26, 2008 at 10:15 PM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:

  Iam creating a system that stores files in a database, I would like to
  know if there is no problem in not sanitizing bynary data, I exclude
  some type of extensions like .exe .zip and others in the upload
  process. Can someone make a SQL injection or some kind of attack
  uploading binary data that it is not Sanitized.

  Iam using cakePHP and I have used the Sanitize::escape function to
  sanitize my data but it transforms binary data and it is unreadable
  when I try to download it again.
  How can I solve this problem?

  Thanx in advance
  


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



Re: Editing paginator URL

2008-03-26 Thread Dardo Sordi Bogado

Easy, just search in this group, found one of the many threads
discussing this issue, then apply the solution proposed.

On Wed, Mar 26, 2008 at 3:38 PM, Haris [EMAIL PROTECTED] wrote:

  I have a search query that I want to append to the paginator returned
  URL. How can I append parameters to the URL?

  Example: 
 http://isharis.dnsalias.com/songs/search/page:2/relevance/?search=Red%20Jumpsuit

  http://bin.cakephp.org/view/1344185837

  


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



RSS feeds in cake

2008-03-26 Thread Novice Programmer
i know that i would be doing a silly mistake. i am using rss helper to
transform feeds. Same controller feeds rss as well as normal HTML.

The controller is http://localhost/entities/view/XXX

I was thinking that rss should be visible using
http://localhost/entities/view/XXX.rss

but i get cake parser error.

i have included Request handler component in controller. i have added
Router::parseExtensions(); as well. Any thing else that i need to do?
-- 
Thanks  Regards,
Novice (http://ishuonweb.wordpress.com/).

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



Customize setFlash() ?

2008-03-26 Thread John R

So .. according to the API, you can send params with setFlash() to be
used in the view. That is fine and dandy .. however, is it possible to
use those params to set the class of the div? The only parameter
flash() allows is the key.

What I am trying to do is pass a parameter called class so I could
show a red box with a big X for error and a green box with a nice
checkmark depending on where the setFlash was called.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: My Component try to use RequsetHandler component. Problem.

2008-03-26 Thread wDevil

 If you are using it:

 class OrderComponent extends Object {
  var $components = array('RequestHandler');

 }
Thanks. :)

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



Re: RSS feeds in cake

2008-03-26 Thread Dr. Tarique Sani

On Thu, Mar 27, 2008 at 9:26 AM, Novice Programmer
[EMAIL PROTECTED] wrote:

 but i get cake parser error.


What is the parse error?

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 Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Customize setFlash() ?

2008-03-26 Thread b logica

Create 2 flash layouts, flash_ok.ctp  flash_not_ok.ctp like so(ish):

div id=flash_ok
?= $content_for_layout ?
/div
div id=flash_not_ok
?= $content_for_layout ?
/div

Then style them in your CSS. Pass the id as the 2nd param to setFlash().

On Wed, Mar 26, 2008 at 11:57 PM, John R [EMAIL PROTECTED] wrote:

  So .. according to the API, you can send params with setFlash() to be
  used in the view. That is fine and dandy .. however, is it possible to
  use those params to set the class of the div? The only parameter
  flash() allows is the key.

  What I am trying to do is pass a parameter called class so I could
  show a red box with a big X for error and a green box with a nice
  checkmark depending on where the setFlash was called.
  


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



Re: selecting extra info from related fields for an association

2008-03-26 Thread jaypee

For anyone who found themselves understanding what I needed, this is
what I came up with that delivered a result.

My issue was that I had a field for first_name and a field for
last_name of people who referred the contact I was entering and I
could not get the auto-cake-magic to render the complete name. To
display a drop down box that would include the id and join the two
name fields together, I added this to the controller:


$referrers = $this-Contact-find('all', array('fields' =
array('id','first_name','last_name')), 0);
$referrers = Set::combine($referrers, '{n}.Contact.id', array('{0}
{1}','{n}.Contact.first_name','{n}.Contact.last_name'));

$this-set(compact('referrers'));

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



AJAX logic question

2008-03-26 Thread John R

I am trying to setup something similar (but not identical) to Digg Spy
(http://www.digg.com/spy).

Basically, I want a latest activity on my front page, and then call
some sort of function to load new events in real time from various
controllers to this div. From the Spy tutorials I have seen, the best
way to do this is to have the list pull from an XML doc, and then the
controllers would simply populate that doc.

However, I am a bit lost on translating this logic to Cake. Some
guidance would be great. And yes, I have searched high and low for a
tutorial on this and one doesn't exist - but I promise to create one
when I figure it out! :)

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