double key realization in Cake PHP?

2009-06-05 Thread Aurelius

Hi!

I want to have a running numer for all entries for a specific blog, so
would this code be the cake way or what would be better?


Here are my Tables:

MySQL Table blogs:
 id| next_entry_id | ...
 Autoincr. | int-default 1 |

 1 | 2 | ...
 2 | 1 | ...
 3 | 4 | ...

Blog hasMany Entries

Because cake understands only single keys I have
the id (in an normal Model blod_id AND display would be the key
together...)

displayed_id = an autoincrement on one blog
(this shoudl be static, so when I have 4 entries for blog x and I
delete entry 3, entry 4 should stay entry 4 and not become 3, thats
why I need another column for the display_id)
MySQL Table entries:
 id| blog_id | display_id | ...
 Autoincr. | int | int| ...
---
 1 | 1   | 1  | ...
 2 | 3   | 1  | ...
 3 | 3   | 2  | ...
 4 | 3   | 3  | ...




__


So now to automatically set the right display_id I would add this
function to the Entries Model:


[CODE lang=PHP]
function beforeSave() {
  // is it an insert?
  if(!isset($this-data['Entry']['id']) {
  // new entry, so get the display_id
  mysql_query(lock record in blogs where blog_id = '.$this-data
['Entry']['blog_id'].');
  $result = mysql_query(select next_entry_id from blogs where
blog_id = '.$this-data['Entry']['blog_id'].');
   if(!$next_entry_id = mysql_fetch_array($result, MYSQL_NUM)) {
 return false;
   }
   mysql_query(update next_entry_id in blogs set next_entry_id =
'.$next_entry_id+1.' where blog_id = '.$this-data['Entry']
['blog_id'].');
   mysql_query(unlock table blogs);
   $this-data['Entry']['display_id'] = $next_entry_id;
  }
  return true;
}
[/CODE]

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



Uploading an file overwrites the name-field

2009-04-25 Thread Aurelius

Hi!

I've a form with data[Blog][name] and data[Blog][pdf]
But when uploading the pdf, the $this-data[Blog][name] is now an
array with $this-data[Blog][name][pdf] = blog.pdf
Any Ideas?

How can I solve that?

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



Re: Uploading an file overwrites the name-field

2009-04-25 Thread Aurelius

I already did a workaround, not really clean, but it works and I'm a
bit in a hurry
thx!


On 26 Apr., 03:17, Miles J mileswjohn...@gmail.com wrote:
 Can we see your action/model code for it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Languages and L10n

2009-04-12 Thread Aurelius

Hi!

I would like to let Cake choose the appropriate language from an array
of languages and if nothing fits use a default language, how is that
possible?

How can I set the User-Language, I found those tree, which works or
does all work the same way?
Configure::write ( 'Config.language', $lang );
$this-Session-write('Config.language', $lang);
$this-L10n-get ( $lang );

thx
Aurelius

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



Re: Subdomains and Routes

2009-04-09 Thread Aurelius

thx!

That was much easier as I expected, Cake rocks!


On 9 Apr., 02:31, schneimi michael.schne...@arcor.de wrote:
 Hi Aurelius,

 I use something like this in config/routes.php:

 $subdomain = substr(env(HTTP_HOST), 0, strpos(env(HTTP_HOST),
 .));

 if ($subdomain != 'domain') {
   Router::connect('/', array('controller' = 'users', 'action' =
 'view', 'pass' = $subdomain));

 }

 Regards,

 Michael

 On 9 Apr., 01:17, Aurelius aurel...@temporaryinbox.com wrote:

  Hi!

  I want to have a subdomainrouting from
  http://(.*).domain.com mappt to 
  htpp://www.domain.com/users/view/username:$1,
  which should be mappt standardwise like a normal cake app.(or mybe
  directly).

  I Don't really understand much about modRewrite and even less about
  cakes dispatcher :-/
  Can someone help me and tell me what I should replace?

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



Subdomains and Routes

2009-04-08 Thread Aurelius

Hi!

I want to have a subdomainrouting from
http://(.*).domain.com mappt to htpp://www.domain.com/users/view/username:$1,
which should be mappt standardwise like a normal cake app.(or mybe
directly).

I Don't really understand much about modRewrite and even less about
cakes dispatcher :-/
Can someone help me and tell me what I should replace?

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



It's all about Language - The TranslationBehaviour

2009-04-06 Thread Aurelius

Hi!

Is it possible to restrict the languages from which the
TranslationBehaviour chooses?
Is it possible to set a default language if non of the available one
matches?

thx
Aurelius

PS: Can you recommend anything whichs gets further with
translationBehaviour than the Cookbook?
Are there any Plug-ins or feature-enhancements?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: AuthComponent and AJAX Requests to another Controller

2009-04-06 Thread Aurelius

I checked, it seems that the Session breaks, what do I have to do so
it won't?

thx
Aurelius

On 5 Apr., 02:46, Miles J mileswjohn...@gmail.com wrote:
 Heres an example of my js and action. Btw im using jquery.

 // Js
 function deleteAvatar(user_id) {
 $.ajax({
 type: POST,
 url:  /ajax/deleteAvatar/,
 data: data[user_id]=+ user_id,
 success:

 function (response) {
 // Do something with response
 }
 });

 return false;

 }

 // Action
 function deleteAvatar() {
 $user_id = $this-Auth-user('id');
 $owner_id = $this-data['user_id'];

 if ($this-validRequest($owner_id)  $user_id == $owner_id) {
 if ($this-User-deleteAvatar($this-Auth-user())) {
 $this-_refreshAuth('avatar', '');

 echo 'pass';
 return;
 }
 }

 echo 'fail';
 return;

 }

 The echos are my js response, and validRequest() is a custom method I
 wrote.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: AuthComponent and AJAX Requests to another Controller

2009-04-04 Thread Aurelius

No, that does the RequesHandler with ther Parse Extention .json
That can't be the Problem, after a second login in the other
Controller
the Content is delivered right!

thx
Aurelius

On 4 Apr., 03:47, Alfredo Quiroga-Villamil laww...@gmail.com wrote:
 How are you defining you layout for the methods?

 Do you have ?

 $this-layout = 'ajax';

 Regards,

 Alfredo

 On Fri, Apr 3, 2009 at 8:30 PM, Aurelius aurel...@temporaryinbox.com wrote:

  I already tried making the Blogs/edit/ Output static (in the edit.ctp-
  file is only I'm working), the BlogsController Method is as well
  empty, but still there's nothing coming from the Server other than an
  empty Document with an working header and StatusCode 200. When opening
  that link in the brwoser I get redirected to a login form :-/
  The AJAX url looks like that:
 http://myhost.com/Blogs/edit/Content.json?_dc=1238803628586languages...

  I've the same problem with another Controller which gets called
  through AJAX, so it can't be because of an endless loop or something
  like that ...

  Any more Ideas?

  thx
  Aurelius

  On 3 Apr., 22:40, Miles J mileswjohn...@gmail.com wrote:
  Im doing the same thing but have not run into this problem. A few
  questions:

  1 - Are the controllers in the same folder, or different apps?

  2 - Are you calling parent::beforeFilter() in both controllers?

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



Re: AuthComponent and AJAX Requests to another Controller

2009-04-04 Thread Aurelius

@ Miles J: How does your AJAX Request look like, did you do any
adjustments till it worked?

@captain_geek: I don't use ACL!

@Brendon Kozlowski: Thats seems to be a big security-issue, cause my
app admin panel should be completly with ajax

thx
Aurelius

On 4 Apr., 20:54, Brendon Kozlowski brendon...@hotmail.com wrote:
 I haven't tried this out yet, but I will soon have to be implementing
 something like this.  I don't know for certain if the Session
 information is being sent along with the AJAX request - and if it's
 not, we need to make an exception in the controller for Auth to
 behave.

 Using the RequestHandler's isAjax() method, along with the Auth allow
 () might be a nice direction.  Will it open some possible security
 issues?  Yes.  In this case it's the user experience over
 security...assuming my theoretical solution is in fact the only
 solution.  (But from what Miles has done, it sounds like it might not
 be.)

 On Apr 4, 12:13 pm, captain_geek landon.brads...@gmail.com wrote:

  You might want to check your aros_acos table to make sure the Group/
  User has rights to the controller action ... otherwise the Auth
  component will throw you at the login screen ...

  step 1: select * from acos where parent_id=(select id from acos where
  alias='Blogs');
  step 2: find the id of the row matching 'index'
  step 3: select * from aros_acos where aco_id=#;
             if you don't have any rows returned then you'll need to
  insert the values manually

  insert into aros_acos values('',[user/group id from aros table],[id
  from acos (step 2)],1,1,1,1);

  On Apr 4, 3:55 am, Aurelius aurel...@temporaryinbox.com wrote:

   No, that does the RequesHandler with ther Parse Extention .json
   That can't be the Problem, after a second login in the other
   Controller
   the Content is delivered right!

   thx
   Aurelius

   On 4 Apr., 03:47, Alfredo Quiroga-Villamil laww...@gmail.com wrote:

How are you defining you layout for the methods?

Do you have ?

$this-layout = 'ajax';

Regards,

Alfredo

On Fri, Apr 3, 2009 at 8:30 PM, Aurelius aurel...@temporaryinbox.com 
wrote:

 I already tried making the Blogs/edit/ Output static (in the edit.ctp-
 file is only I'm working), the BlogsController Method is as well
 empty, but still there's nothing coming from the Server other than an
 empty Document with an working header and StatusCode 200. When opening
 that link in the brwoser I get redirected to a login form :-/
 The AJAX url looks like that:
http://myhost.com/Blogs/edit/Content.json?_dc=1238803628586languages...

 I've the same problem with another Controller which gets called
 through AJAX, so it can't be because of an endless loop or something
 like that ...

 Any more Ideas?

 thx
 Aurelius

 On 3 Apr., 22:40, Miles J mileswjohn...@gmail.com wrote:
 Im doing the same thing but have not run into this problem. A few
 questions:

 1 - Are the controllers in the same folder, or different apps?

 2 - Are you calling parent::beforeFilter() in both controllers?

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



AuthComponent and AJAX Requests to another Controller

2009-04-03 Thread Aurelius

Hi!

I have a UserController which loads a site and then the user can make
a AJAX Request to another Controller (BlogController). I'm using the
AuthComponent,but the other Controller always needs a second login,
why?

Any Ideas how to solve that problem?

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



Re: AuthComponent and AJAX Requests to another Controller

2009-04-03 Thread Aurelius

ad 1) yes, they are in the same app
ad 2) yes, they do
ad 3) I'm trying low and it doesn't work, is it possible that there's
something wrong with the AJAX Requests?

thx
Aurelius

On 3 Apr., 22:40, Miles J mileswjohn...@gmail.com wrote:
 Im doing the same thing but have not run into this problem. A few
 questions:

 1 - Are the controllers in the same folder, or different apps?

 2 - Are you calling parent::beforeFilter() in both controllers?

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



Re: AuthComponent and AJAX Requests to another Controller

2009-04-03 Thread Aurelius

I already tried making the Blogs/edit/ Output static (in the edit.ctp-
file is only I'm working), the BlogsController Method is as well
empty, but still there's nothing coming from the Server other than an
empty Document with an working header and StatusCode 200. When opening
that link in the brwoser I get redirected to a login form :-/
The AJAX url looks like that:
http://myhost.com/Blogs/edit/Content.json?_dc=1238803628586languages=deu%2Ceng

I've the same problem with another Controller which gets called
through AJAX, so it can't be because of an endless loop or something
like that ...

Any more Ideas?

thx
Aurelius


On 3 Apr., 22:40, Miles J mileswjohn...@gmail.com wrote:
 Im doing the same thing but have not run into this problem. A few
 questions:

 1 - Are the controllers in the same folder, or different apps?

 2 - Are you calling parent::beforeFilter() in both controllers?

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



Splitting a Controller in two?

2009-04-02 Thread Aurelius

Hi!

I have a Controller,my Main Controller, which have 5 frontend Methods
and 6 admin methods. The biggest issue is that the frontend and admin
part need completely different things (frontend uses the
SecurityComponent, FormHelper and AjaxHelper, which are not needed in
the admin methods, but the admin methods need the AuthComponent and
some other stuff...

So I think it would be much easier (and faster) to split the big
controller in two separate controllers, what are the disadvantages of
that?

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



Using two Security Levels in one Controller?

2009-04-02 Thread Aurelius

Hi!

I want to use Session in the frontend with SecurityLevel 'low'
and  Session in the backend with SecurityLevel 'high'.
How can I do that?

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



Re: Notice (8): Undefined index: id?

2009-03-31 Thread Aurelius

It happens when Saving a Model!

I've no beforeX-Filters, I also had debug($this-data) right before
saving,
but each Model (Accept the hasAndbelongToMany) have an id!

thx
Aurelius

On 31 Mrz., 02:32, mscdex msc...@gmail.com wrote:
 On Mar 30, 6:11 pm, Marcelo Andrade mfandr...@gmail.com wrote:



  On Mon, Mar 30, 2009 at 6:44 PM, Aurelius aurel...@temporaryinbox.com 
  wrote:

   What does that mean, and where is the problem?
   Notice (8): Undefined index: id [CORE/cake/libs/model/model.php, line
   1281...on line 77

   That's line 77:
   if ($this-User-save ( $this-data, true , array ( 'firstname',
   'lastname', '' ))) {
   ... }

   What's wrong?

  It's hard to say.  Maybe you're in an edit action and
  your $this-data doesn't contain the desired record id.

  Please, tell us more about your scenario.

  Best regards.

  --
  MARCELO DE F. ANDRADE
  Belem, PA, Amazonia, Brazil
  Linux User #221105

 http://mfandrade.wordpress.com

 Also, do you have any beforeValidate or beforeSave callbacks that are
 changing the data?
 Sounds like the data for your primary key for your User model is being
 unset somewhere possibly.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Notice (8): Undefined index: id?

2009-03-30 Thread Aurelius

What does that mean, and where is the problem?
Notice (8): Undefined index: id [CORE/cake/libs/model/model.php, line
1281...on line 77

That's line 77:
if ($this-User-save ( $this-data, true , array ( 'firstname',
'lastname', '' ))) {
... }

What's wrong?

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



Re: Best Practise: Protecting against unallowed save()

2009-03-29 Thread Aurelius

I cant use the SecuriityComponent, coulds I'm working with AJAX
Forms...

thx
Aurelius

On 28 Mrz., 19:27, brian bally.z...@gmail.com wrote:
 On Sat, Mar 28, 2009 at 12:07 PM, Aurelius aurel...@temporaryinbox.com 
 wrote:

  That works only if the model is DIRECTLY associated with Users, but
  not e.g. here:

  User hasMany Blogs hasMany Entries

  I can't believe theres no standard-function for this, isn't is one of
  the normallest things,
  that there can be User, which have stuff to edit, but ONLY there one
  (=99% of big websites)

 public function edit()
 {
         if (!empty($this-data))
         {
                 // ...
         }

         if (empty($this-data))
         {
                 $filters = array(
                         'conditions' = array(
                                 'Whatever.user_id' = $this-Auth-user('id')
                         )
                 );
                 $this-data = $this-Whatever-find('first', $filters);
         }

 }

 As I said, use the SecurityComponent to ensure that your hidden fields
 are not adjusted by the user.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best Practise: Protecting against unallowed save()

2009-03-28 Thread Aurelius

That works only if the model is DIRECTLY associated with Users, but
not e.g. here:

User hasMany Blogs hasMany Entries

I can't believe theres no standard-function for this, isn't is one of
the normallest things,
that there can be User, which have stuff to edit, but ONLY there one
(=99% of big websites)

thx
Aurelius

On 28 Mrz., 14:58, JamesF usaexportexpe...@gmail.com wrote:
 whoops hit enter too quick:

 continuing the function
 

 if ($this-Model-data['Model']['user_id'] == $auth_id ) // make sure
 to use == not =

 {
       //render logic if authorized

 }

 else

 {

 $this-redirect('/');  //redirect unauthorized

 now this all breaks down when using validation on your forms
 im still working on that part! =]

 hope this is a start

 }

 On Mar 28, 9:54 am, JamesF usaexportexpe...@gmail.com wrote:

  first make sure the thing you are saving has a foreign key with the
  user id associated with it.
  i usually would deny access with the Auth component to the action that
  i don't want a non logged in user to use.

  simple acl to check if the record belongs to current logged in user:

  put some kind of check in your action to read the user_id of the
  record you are about to loadif it fails use cakes' redirect
  function redirect the user to a location of some kind. if it passes
  allow the record to be displayed.

  i.e.

  function read ($id = null)
  {
  $this-Model-id = $id; //gets id of item from url parameter
  $auth_id = $this-Auth-user('id');   //make sure your controller is
  using Auth or this wont work)

  $this-Model-read(); // reads record

  On Mar 27, 9:05 pm, Aurelius aurel...@temporaryinbox.com wrote:

   I'm working about 2 month with Cake, but its my first bigger app.
   I want to write my own security function which would check before each
   save() if the save model is associated to the logged in user, what
   would be the best way to do that?

   My Ideas till now:
   a beforeSave() function in Appmodel:
     + DRY
     + relative secure
     - if I use more than one save() its inefficient (I have up till 8 on
   one page)
     - I don't have a clue how I can check newly created ones with no id

   a beforeSave(9 in each Modell:
    - even more crappy than above

   a validation-function in the controller
    - not DRY
    - more code
    + could work with allready readed data

   I believe that there must be more peaple out there with the same
   problem, are there any finished solutions?

   Any Ideas or thoughts are welcome!

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



Best Practise: Protecting against unallowed save()

2009-03-27 Thread Aurelius

I'm working about 2 month with Cake, but its my first bigger app.
I want to write my own security function which would check before each
save() if the save model is associated to the logged in user, what
would be the best way to do that?

My Ideas till now:
a beforeSave() function in Appmodel:
  + DRY
  + relative secure
  - if I use more than one save() its inefficient (I have up till 8 on
one page)
  - I don't have a clue how I can check newly created ones with no id

a beforeSave(9 in each Modell:
 - even more crappy than above

a validation-function in the controller
 - not DRY
 - more code
 + could work with allready readed data

I believe that there must be more peaple out there with the same
problem, are there any finished solutions?

Any Ideas or thoughts are welcome!

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



Re: Saving of hasAndBelongToMany with-Data?

2009-03-26 Thread Aurelius

But that doesn't seem performace friendly, if there is a with-function
already implemented, how does it work?
If it is implemented, shouldn't be there a save function as well?

thx
Aurelius

mscdex schrieb:
 On Mar 25, 9:21 pm, Aurelius aurel...@temporaryinbox.com wrote:
  I've a Model User hasAndBelongToMany Blogs
  the blogs_users table has 3 fields: blog_id, user_id, with_language
  Reading the data works fine, but how can I save text to with_language?

 This article should help you:
 http://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-join-table-for-habtm-models/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: limit access to a site?

2009-03-25 Thread Aurelius

???
I've already written two books about CakePHP,
but there were nothing in it.

I now tried to use your tip read a book, but there's
nothing in the dictionary as well, maybe you can help me...

thx
Aurelius

On 24 Mrz., 13:52, Smelly Eddie ollit...@gmail.com wrote:
 yes, read a book

 On Mar 24, 8:41 am, Aurelius aurel...@temporaryinbox.com wrote:

  Thanks!
  One more problem, when it is going live, the Allow from would be a
  domain like service.mydomain.de and not a IP address, any solutions
  for that?

  thx
  Aurelius

  On 24 Mrz., 01:22, Graham Weldon gra...@grahamweldon.com wrote:

   class AppController extends Controller {

       var $allowedHosts = array('127.0.0.1', '::1', '85.127.249.210');
       var $accessDeniedRedirect = ... // Define your action to redirect to
   here.

       function beforeFilter() {
           if (!in_array(env('REMOTE_ADDR'), $this-allowedHosts)) {
               $this-redirect($this-accessDeniedRedirect);
               die();
           }
       }

   }

   That would cover it.
   The only thing I have not considered is that you need to allow anyone
   access to the $accessDeniedRedirect address.
   So you will need a check in or around your if statement in the
   beforeFilter there to ensure unrestricted access to whatever you set
   $accessDeniedRedirect is set to.
   But I will leave that for you to sort out. Can't give you all the
   solutions. That would be boring!

   Cheers,
   Graham

   Aurelius wrote:
Hi!

I Would like to limit the access to a controller function in the same
way as .htaccess would do it with these lines:
Order deny,allow
Deny from all
Allow from 85.127.249.210

How can I achieve that?

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



Saving of hasAndBelongToMany with-Data?

2009-03-25 Thread Aurelius

Hi!

I've a Model User hasAndBelongToMany Blogs
the blogs_users table has 3 fields: blog_id, user_id, with_language
Reading the data works fine, but how can I save text to with_language?

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



Re: limit access to a site?

2009-03-24 Thread Aurelius

Thanks!
One more problem, when it is going live, the Allow from would be a
domain like service.mydomain.de and not a IP address, any solutions
for that?

thx
Aurelius

On 24 Mrz., 01:22, Graham Weldon gra...@grahamweldon.com wrote:
 class AppController extends Controller {

     var $allowedHosts = array('127.0.0.1', '::1', '85.127.249.210');
     var $accessDeniedRedirect = ... // Define your action to redirect to
 here.

     function beforeFilter() {
         if (!in_array(env('REMOTE_ADDR'), $this-allowedHosts)) {
             $this-redirect($this-accessDeniedRedirect);
             die();
         }
     }

 }

 That would cover it.
 The only thing I have not considered is that you need to allow anyone
 access to the $accessDeniedRedirect address.
 So you will need a check in or around your if statement in the
 beforeFilter there to ensure unrestricted access to whatever you set
 $accessDeniedRedirect is set to.
 But I will leave that for you to sort out. Can't give you all the
 solutions. That would be boring!

 Cheers,
 Graham

 Aurelius wrote:
  Hi!

  I Would like to limit the access to a controller function in the same
  way as .htaccess would do it with these lines:
  Order deny,allow
  Deny from all
  Allow from 85.127.249.210

  How can I achieve that?

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



$ajax-observeForm() result auslesen?

2009-03-24 Thread Aurelius

Hi!

I have this Form Observer:
$options = array(
'url' = array('controller'='users','action'='edit', $user['users']
['id'].'.json'),
'before' = 'startLoading()',
'complete' = 'endLoading()',
'failure' = 'failure()',
'frequency' = '0.2',
'condition' = 'reloadForm()'
);
echo $ajax-observeForm('UserForm', $options);


How can I get the result of the POST?
I'm returning some JSON, but doen't know where I can find it :-/

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



limit access to a site?

2009-03-23 Thread Aurelius

Hi!

I Would like to limit the access to a controller function in the same
way as .htaccess would do it with these lines:
Order deny,allow
Deny from all
Allow from 85.127.249.210

How can I achieve that?

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



WebTesting: how to click?

2009-03-18 Thread Aurelius

Hi!

I'm trying to do WebTests, but my clicking doesn't work :-/
What do I have to but into $this-click('whats here) to click on this
submitbutton?

$form-end(array('label' == 'buttons/button_buy_now.gif', 'div' ==
false));


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



Testing: Fixtures on related tables

2009-03-17 Thread Aurelius

Hi!

I want to use fixtures for my tests, I have a Model User which
hasAndBelongToMany Languages

So I created the fixtures:
user_fixture.php
languages_user_fixture.php
language_fixture.php

But as soon as I add following to users_controller.test.php
var $fixtures = array( 'user');
or
var $fixtures = array( 'user', 'language');
I get the error message:
Missing Database Table
Error:  Database table test_suite_languages for model Language was not
found.

What do I have to do?

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



inputfield error?

2009-03-17 Thread Aurelius

Why doesn't that work:
echo $form-input('Validate.s_address', array( 'type' = 'checkbox',
'label' = __(Other address,true), 'id' = 's_address', 'value' =
1));

It generates:
div class=input checkbox
  input type=hidden name=data[Validate][s_address]
id=s_address_ value=0 /
  input type=checkbox name=data[Validate][s_address]
id=s_address value=1 /
  label for=s_addressOther address/label
/div

But It should generate only one inputfield!

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



$ajax-observeForm()

2009-03-17 Thread Aurelius

Hi!

Is it posible to get the data what/which field has changed for the
condition-function?

How can I work with the returned data, if I want to return them in a
function?

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



Re: inputfield error?

2009-03-17 Thread Aurelius

ok, thx

On 18 Mrz., 04:03, brian bally.z...@gmail.com wrote:
 On Tue, Mar 17, 2009 at 10:35 PM, Aurelius aurel...@temporaryinbox.com 
 wrote:

  Why doesn't that work:
  echo $form-input('Validate.s_address', array( 'type' = 'checkbox',
  'label' = __(Other address,true), 'id' = 's_address', 'value' =
  1));

  It generates:
  div class=input checkbox
   input type=hidden name=data[Validate][s_address]
  id=s_address_ value=0 /
   input type=checkbox name=data[Validate][s_address]
  id=s_address value=1 /
   label for=s_addressOther address/label
  /div

  But It should generate only one inputfield!

 Note that one of them is hidden and its name begins with an
 underscore. That element is created so that FormHelper can decide how
 to set the checkbox value if you submit and for some reason (eg.
 validation fails) and your form is re-displayed. FormHelper needs to
 know what the default value was.

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



Re: is $id already secure inside a function?

2009-03-17 Thread Aurelius

is it been validated in the Model, e.g. when this us called:
$whatever = $this-User-read( null, $id);

Is that enought so I can be sure that its an int?
if( bccomp($id, intval($id), 3) != 0 ) die( __ ( We couldn't find
this Shop.,true) );

thx
Aurelius
On 16 Mrz., 05:36, Dr. Loboto drlob...@gmail.com wrote:
 No one checked your $id. It is insecure. Anyone can call your action
 ashttp://domain.com/controller/editorhttp://domain.com/controller/edit/013
 orhttp://domain.com/controller/edit/kill%20your%20app

 On Mar 16, 1:04 am, Aurelius aurel...@temporaryinbox.com wrote:

  Hi!

  When I have a function like
  function edit($id = null) { ... }
  is the $id already checked against hacking and can only be a integer
  or is it unsecure?

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



is $id already secure inside a function?

2009-03-15 Thread Aurelius

Hi!

When I have a function like
function edit($id = null) { ... }
is the $id already checked against hacking and can only be a integer
or is it unsecure?

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



Re: Ajax observeField()

2009-03-14 Thread Aurelius

Already solved, markstory helped me!


On 14 Mrz., 03:24, Aurelius aurel...@temporaryinbox.com wrote:
 Whats wrong whit this code, why doesn't it work?
 I'm getting no Error or Wanring from Cake, but the code is not added
 to the html output :-/

 [code lang=php]
 ...
 form:
 echo $form-input('User.name', array('id'='username'));
 ...
 ?
 // AJAX Requests
 $options = array(
 'url' = array('controller'='users','action'='getAJAX', $user
 ['User']['id']),
 'before' = 'startLoading()',
 'complete' = 'endLoading()',
 'failure' = 'failure()',
 'frequency' = '10'
 );
 $options['condition'] = 'ifUsernameHasChanged()';
 $ajax-observeField('username', $options);

 ?[code]

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



Ajax observeField()

2009-03-13 Thread Aurelius

Whats wrong whit this code, why doesn't it work?
I'm getting no Error or Wanring from Cake, but the code is not added
to the html output :-/

[code lang=php]
...
form:
echo $form-input('User.name', array('id'='username'));
...
?
// AJAX Requests
$options = array(
'url' = array('controller'='users','action'='getAJAX', $user
['User']['id']),
'before' = 'startLoading()',
'complete' = 'endLoading()',
'failure' = 'failure()',
'frequency' = '10'
);
$options['condition'] = 'ifUsernameHasChanged()';
$ajax-observeField('username', $options);

?[code]

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



Re: L18n Showing and editing all available languages at the same time

2009-03-06 Thread Aurelius

Sry, I didn't quite get it...

I want to load the content in all languages of the Model I'm in, no an
associated one!

I need a function which load all/the choosen languages of the record
I'm editing
e.g. localhost/blogs/edit/2
the printed find-method should something like this:
Array
(
[0] = Array
(
[Blog] = Array
(
[id] = 2
[locale] = en
[name] = English blogtitle
)

)

[1] = Array
(
[Blog] = Array
(
[id] = 2
[locale] = de
[name] = German blogtitle
)
)

)

How can I achieve that?

thx
Aurelius

On 4 Mrz., 19:18, jitka (poLK) slunii...@gmail.com wrote:
 Yes, you can use TranslateBehavior, if you don't mind that callbacks
 are not fired on associated models. It means - any behavior's
 callbacks can work correctly only on primary model, so it does not
 translate virtual fields for associated models.

 Possible workaround for this issue is 
 here:http://groups.google.com/group/cake-php/browse_thread/thread/9b7e6090...

 As of displaying or editing multiple translations at once, yes it is
 possible - by default it picks up locale from your Config.language
 setting, but you can set YourModel-locale to array of locales and
 then ;) you know, read test case of TranslateBehavior.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Security and associated Models

2009-03-05 Thread Aurelius

Hi!

I have a model Users which has Many Blogs which hasMany Entries.

When I'm now in the Users edit function, I can also save Blog changes,
so here's my question about Security.
Does CakePHP automaticly checks if the Blog belongs to User or could
I save any Blog changes through my user edit page, is the Standard -
CakePHP-function secure?
And the same question about changing entries from the users edit-page.

(I can't use the SecurityComponent, which would make this (almost)
imposible)

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



Re: Best Practice?

2009-03-05 Thread Aurelius

But the I'm in the EntryController, the associations would be more
complex
than in the Blog.
I would need to connect the Entry to the Blog to the languages and
then
load more Entries at the same time in the edit-page...

thx
Aurelius

On 5 Mrz., 00:07, brian bally.z...@gmail.com wrote:
 When you fetch the data for a BlogEntry, you can also get the Blog
 info. Have a look at ContainableBehavior (or setting recursive in find
 conditions). You can have Cake fetch data from any other table row
 (model instance) which is associated with BlogEntry.

 On Wed, Mar 4, 2009 at 7:14 AM, Aurelius aurel...@temporaryinbox.com wrote:

  Hi!

  I have a Software Design Question, here's what I want to do (a bit
  simplified for better understanding):

  I have following tables:
  Users - hasMany - Blogs - hasMany - Entries
  Users - hasAndBelongsToMany - Languages
  Blogs - hasAndBelongsToMany - Languages
  Entries use the TranslationBehaviour.
  So User one or more Blogs and can chose the languages in which he post
  all his blogentrie.
  An example would be:
  User (id=5,name=max) has one blog
  (id=7,name=myblog,languages=eng,ger).
  So every blogentry is saved in eng and ger with the
  TranslationBehaviour.

  Now to the Design Part.
  Is it now right that I have to programm the whole Backend in the
  BlogController (while saving the Owner id in a session)?
  When I want to edit a Blogentry I need to know the settings of the
  blog...

  And other Design Ideas?

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



Best Practice?

2009-03-04 Thread Aurelius

Hi!

I have a Software Design Question, here's what I want to do (a bit
simplified for better understanding):

I have following tables:
Users - hasMany - Blogs - hasMany - Entries
Users - hasAndBelongsToMany - Languages
Blogs - hasAndBelongsToMany - Languages
Entries use the TranslationBehaviour.
So User one or more Blogs and can chose the languages in which he post
all his blogentrie.
An example would be:
User (id=5,name=max) has one blog
(id=7,name=myblog,languages=eng,ger).
So every blogentry is saved in eng and ger with the
TranslationBehaviour.

Now to the Design Part.
Is it now right that I have to programm the whole Backend in the
BlogController (while saving the Owner id in a session)?
When I want to edit a Blogentry I need to know the settings of the
blog...

And other Design Ideas?

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



Re: L18n Showing and editing all available languages at the same time

2009-03-04 Thread Aurelius

Because the german title could be Mein Blog über CakePHP,
but most Americans will not understand it, same with Spanish,
I would not understand Spanish...
(The whole Content will be available in more languages.)

What would be the best realization? Can I work with the
TranslationBehaviour or should I create a model which represents
the translation table?

thx
Aurelius

On 4 Mrz., 06:33, Miles J mileswjohn...@gmail.com wrote:
 You would have to store all of this in a database, and use some heavy
 relations. Why would the use add one for each language?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Creating HasAndBelongsToMany Checkboxes in the View

2009-02-15 Thread Aurelius

Hi!

 I've writen checkboxes for a HasAndBelongsToMany Association (without
form helper)
checkboxname = data[languages][languages][], the value are the
language_ids

so adding new checked languages works fine, but they doens't
automaticly get deleted when they are unchecked, what do I have to
change?


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



Re: Security-Component-form-checks?

2009-02-03 Thread Aurelius

anyone?

On 31 Jan., 11:52, Aurelius aurel...@temporaryinbox.com wrote:
 When I use the form-Helper and the security-component, do I have to
 check if the user changes the value of hidden fields (like id, and
 foreign keys like author_id) or do the security-component auto-check
 that through the data[_Token][key]?

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



Reading Security-Component dataToken?

2009-02-03 Thread Aurelius

Hi!

I create forms with JS (because of AJAX) instead of normal HTML, so it
is it posible to use the really cool dataToken function as well?
So what I would need is the value of the data[_Token][key] and data
[_Token][fields]?

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



extJS and i18n

2009-02-03 Thread Aurelius

Hi!

I couldn't find something on the net, so here's my Question:
How can I work with extJS and i18n?
Normally the extJS-code is written in an external js-file, but there
is no __()-function.
So should I just write the extJS-Code in the HTML or is there a more
convenient way of doing that?

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



loading a layout from a database

2009-02-02 Thread Aurelius

Hi!

Whats the best way to read a layout from the database?

Simply writing a model for the layout-table and using following layout-
code?
?php
echo $database_layout['top'];
echo $scripts_for_layout;
echo $database_layout['middle'];
$session-flash();
echo $content_for_layout; ?
echo $database_layout['bottom'];
echo $cakeDebug;
?

Or is there an more elegant way?

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



Prototype AND extJS?

2009-02-02 Thread Aurelius

Hi!

I really like the Ajax-Helper, but the extJS-Framework has some
function which are not provided by prototype, so is there any reason
why not to use both at the same time (beside a bit more download at
the first page)?

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



Security-Component-form-checks?

2009-01-31 Thread Aurelius

When I use the form-Helper and the security-component, do I have to
check if the user changes the value of hidden fields (like id, and
foreign keys like author_id) or do the security-component auto-check
that through the data[_Token][key]?

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



AJAX in CakePHP

2009-01-30 Thread Aurelius

Hi!

Is there an Integration/Plug-in for easily Integration JS-Functions
from an more easy-to-use - Framework than JQuery?

For example I think extJS provides much more easily integrated
functions for an not-JS-Expert than JQuery...

Is there some kind an help in CakePHP which make AJAX easy for JS-
n00bs like me?

thx
Aurelius

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



Error using $validation?

2009-01-30 Thread Aurelius

Hey Guys!

Where's the Bug here, the Validation doesn't work, I can save all
input, e.g. 125.

?php
   class Post extends AppModel {
  var $name = 'Post';
  var $validate = array(
 'percent' = array(
 'rule' = array('between', 0, 100),
 'message' = 'You can only have between 0 and 100 percent
of your costumers in the test.'
  ),
 );
?

what's wrong?

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



Error using $validation?

2009-01-30 Thread Aurelius

Hey Guys!

Where's the Bug here, the Validation doesn't work, I can save all
input, e.g. 125.

?php
   class Post extends AppModel {
  var $name = 'Post';
  var $validate = array(
 'percent' = array(
 'rule' = array('between', 0, 100),
 'message' = 'You can only have between 0 and 100 percent
of your costumers in the test.'
  ),
 );
?

what's wrong?

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



Re: Error using $validation?

2009-01-30 Thread Aurelius

It's the the standard bake-controller
All other field-validations works perfect.


?php
class Shop extends AppModel {

var $name = 'Shop';
var $validate = array(
'active' = array('numeric'),
'title' = array(
 'minlength' = array(
  'rule' = array('minLength', 3),
  'message' =  'The Shop title must have at least 3
characters.'
  ),
 'maxlength' = array(
  'rule' = array('maxlength', 100),
  'message' = 'The Shop title can\'t have more than 100
characters.'
  ),
),
'language_id' = array('numeric'),
'address_required' = array('numeric'),
'percent_in_test' = array(
  'rule' = array('between', 0, 100),
  'message' = 'You can only have between 0 and 100 
percent
of your costumers in the test.'
   ),
);
var $displayField = 'title';
...}




And the Controller:

?php
class ShopsController extends AppController {

var $name = 'Shops';
var $helpers = array('Html', 'Form');
...

function edit($id = null) {
if (!$id  empty($this-data)) {
$this-Session-setFlash(__('Invalid Shop', true));
$this-redirect(array('action'='index'));
}
if (!empty($this-data)) {
if ($this-Shop-save($this-data)) {
$this-Session-setFlash(__('The Shop has been 
saved', true));
$this-redirect(array('action'='index'));
} else {
$this-Session-setFlash(__('The Shop could not 
be saved. Please,
try again.', true));
}
}
if (empty($this-data)) {
$this-data = $this-Shop-read(null, $id);
}
$languages = $this-Shop-Language-find('list');
$owners = $this-Shop-Owner-find('list');
$this-set(compact('languages','owners'));
}
...
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---