Re: Cron help

2011-08-12 Thread Prabha vathi
crontab -e "0 0 * * *"

i am getting invalid option error now

Now i have added the following line,

crontab -e "0 0 * * *" /---as you mentioned -- /

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


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


Re: Cron help

2011-08-12 Thread Prabha vathi
It is my mistake. I added the server's php path also, now cron executed, 
file executed.

now, I got ./console/cake: Permission denied Permission denied

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


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


Re: Cron help

2011-08-12 Thread Prabha vathi
cron executed correctly. But the file is not executed.

 i used my server's document root

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


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


Re: redirect admin and user to different dashboard

2011-08-12 Thread Mohd Hasnol
already solved. Thanks..

On Fri, Aug 12, 2011 at 7:20 PM, Mohd Hasnol  wrote:

> Sorry, i still cant get it. I give an example. if admin, i would like to
> link to the admin dashboard(homes/index) while users i link to the users
> dashboard(posts/index). Then, in app_controller i used
> $this->Auth->loginRedirect = array('controller'=>'homes',
> 'action'=>'index');
>
> is it i need loginRedirect or disable it??
>
> Sorry, im newb.
>
> Thanks.
>
>
> On Fri, Aug 12, 2011 at 6:02 PM, euromark wrote:
>
>> i use the same action
>> only switch the rendered view
>>
>> dashboard{
>> $this->_dashbboardXXX depending on the role of the current user
>> }
>>
>> _dashboardAdmin(
>> $this->render('dashboard_admin')
>>
>> _dashboardUser(
>> $this->render('dashboard_user')
>> }
>>
>> makes a lot of thins easier
>>
>> On 12 Aug., 10:58, nOLL  wrote:
>> > Hi,
>> >
>> > I have admin and user that will redirect to different dashboard after
>> > login.
>> > For example, admin will redirect to dashboard A and allow to access
>> > dashboard B.
>> > while user will redirect to dashboard B and not allow to access
>> > dashboard A.
>> >
>> > I already using ACL, but i have problem in redirect after login since
>> > both admin and user will redirect to dashboard A.
>> >
>> > So how i could implement this?
>> >
>> > Thanks,
>> > nOLL
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> others with their CakePHP related questions.
>>
>>
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group
>> at http://groups.google.com/group/cake-php
>>
>
>

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


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


Re: Security and Model Validation Questions

2011-08-12 Thread andrewperk
The username and password is specific to just that database luckily.
I've changed the information. Thanks Ceeram.

On Aug 12, 3:51 pm, Ceeram  wrote:
> with debug on, and there is an error with db connection, it will show db
> login credentials (this is changed in latest versions), so they probably
> accessed the db itself, is the user allowed for all hosts on the db or just
> local?

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


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


Re: Security and Model Validation Questions

2011-08-12 Thread Ceeram
with debug on, and there is an error with db connection, it will show db 
login credentials (this is changed in latest versions), so they probably 
accessed the db itself, is the user allowed for all hosts on the db or just 
local?

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


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


Re: Moving a tree node

2011-08-12 Thread Ceeram
check the api for this, if you dont set 3rd parameter it will move 1 
position by default

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


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


Re: 1.3.11 Auth ACL beforeFilter

2011-08-12 Thread Ceeram
call parent::beforeFilter()

also bindNode should be in your model

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


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


Re: Nested table update

2011-08-12 Thread Ryan Schmidt

On Aug 12, 2011, at 04:18, Kevin Woolley wrote:

> REMOVE ME

Remove yourself. The footer of this email explains how.


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


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


Re: Add new fields to a database table

2011-08-12 Thread Ryan Schmidt
On Aug 12, 2011, at 15:29, aortizhi wrote:
> On Aug 11, 5:30 pm, Ryan Schmidt  wrote:
>> On Aug 10, 2011, at 11:45, aortizhi wrote:
>> 
>>> Hi eveyone, i'm new working with cakephp. I would like to know how can
>>> i let my webapp's users add new fields to a table in my data base but
>>> while is in production.
>> 
>> That's not usually done. Why do you believe you want to do this? What 
>> problem are you trying to solve? Perhaps there is a better way.

> 

> that's an application's request made for the client. He would like to
> add new information to a table or many tables because there could be
> more information in the future that may came out.

Clients often request things without knowing what they're talking about. :) 
It's up to you as the developer to translate their need into a technical 
solution that makes sense within the context of the development environment 
you're using.

As you're no doubt aware, the usual way to write an app with CakePHP is for the 
CakePHP app to have intimate knowledge of the database. Each database table is 
represented by a CakePHP model file, and each column in the table has specific 
settings in the model, regarding validation and so forth. And each view that 
deals with this model knows about those fields as well and has specific ways 
and places to display them. It's completely outside the scope of this line of 
thinking to imagine a user being able to arbitrarily add a column to a table 
and have it just work without needing to also do a lot of reprogramming in the 
app's code.

Not to mention that contemplating allowing a web user to alter a database table 
is just a nightmare in terms of security. The database user PHP is connecting 
with shouldn't even have permission to alter a table. If the user can add 
columns, can they also delete columns? What if they delete an essential column? 
No, clearly, allowing an end user to alter your database tables is not a course 
of action you should consider.

So again: what is the table? What kind of information is in the table? What 
kind of additional information that is not in the table now does the client 
think they will need to add? Can you give examples?

If I were designing an app that must allow the user to add arbitrary 
information to a record, I'd probably have two tables: one for the static 
information—the information each record will definitely have—and a second table 
for each additional piece of optional data a user might add. For example, 
consider an app for tracking houses for sale. I might have table "houses" with 
basic information about the house, and "house_extras" which would just have an 
additional key/value pair. There could be multiple house_extras records for 
each house record. They'd be linked by the house_id.


Table houses ("house_id" is primary key)

house_id: 5
house_address: 123 main street
house_price: 123,456.00


Table house_extras ("house_id + key" is primary key, or at least has a unique 
index)

house_id: 5
key: garden
value: ugly

house_id: 5
key: neighbors
value: obnoxious


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


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


Re: Where to place code meant to be universally accessible?

2011-08-12 Thread Burningfuses
I opted to go by Miles' suggestion and created a static class in
vendors. So far it is working great. Thanks a lot for all the help
guys.

Best,
Burningfuses


On Aug 12, 2:17 pm, Miles J  wrote:
> That's not what models are for. Models are meant to represent an
> entity of data from a datasource (database or rest), not to convene
> helper methods. Cake creates even more confusion because their model
> system isn't a true model system, it's simply a DAO (database access
> object).
>
> On Aug 11, 3:42 pm, Stephen Latham  wrote:
>
>
>
>
>
>
>
> > I agree the model is a good place.  I recently wrote these type of global 
> > actions in the app controller rather than bootstrap.php but found after 
> > thought and discussion the model made more sense.
>
> > On 11 Aug 2011, at 22:09, euromark  wrote:
>
> > > usually in the model
> > > since controllers can easily access models
>
> > > but that depends on your situation
> > > maybe a lib, maybe a behavior, maybe some boostrap code
>
> > > without knowing more details, i go for model code
>
> > > On 11 Aug., 22:30, BurningFuses  wrote:
> > >> In my app I have a bunch of time related routines that I want to be
> > >> able to call from my controllers and models. I could turn them into a
> > >> component so they could be accessible on all my controllers, but they
> > >> wouldn't be (in a trivial way or recommended way) be accessible from
> > >> my models. Where should I put them? Is there a recommended cake
> > >> guideline for such a thing?
> > >> Thank you,
> > >> Burningfuses
>
> > > --
> > > Our newest site for the community: CakePHP Video 
> > > Tutorialshttp://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php

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


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


Re: Security and Model Validation Questions

2011-08-12 Thread andrewperk
Hi euromark,

Thank you. Thank you for the article.

But I'm already using the Security component to prevent form tampering
and submitting an empty form or modifying the form fields should not
work correct? The security component now prevents all of that?

On Aug 12, 1:57 pm, euromark  wrote:
> debug > 0 is an absolute nogo for productive sites.
>
> but besides that:
> yes, thats possible
> there are several easy ways to bypass the baked actions and validation
>
> the easiest thing is to post empty forms (using firebug its easy to
> remove the inputs or replace them with nonsense).
>
> @seehttp://www.dereuromark.de/2010/09/21/saving-model-data-and-security/
> for details
>
> On 12 Aug., 22:24, andrewperk  wrote:
>
> > Hello,
>
> > I have a cakephp site I'm working on. I have it live on a production
> > server, it's still in development.
>
> > I switched my core.php from production to development to do some
> > testing of things on the live server and forgot to change it back. I
> > left it like this for about a week.
>
> > Apparently someone smart found the website. They didn't do any damage
> > they just kind of let me know I had a bug somewhere.
>
> > They were somehow able to bypass my model validation and register
> > themselves with a NULL username and password and marked themselves as
> > a premium member which can only be done via a paypal payment using web
> > tech nicks paypal plugin. They did this 4 times set username, email,
> > password fields in the DB to NULL and marked themselves as a premium
> > member giving them paid services for free.
>
> >  I'm wondering if while I left the core.php in development mode they
> > got DB access somehow and that's how they did it?
>
> > Here's my basic user validation which ensures a username and valid
> > password and confirmation as well as username uniqueness:
>
> > 'username'=>array(
> >       'Not Empty'=>array(
> >         'rule'=>'notEmpty',
> >         'message'=>'Please enter your desired username.'
> >       ),
> >       'Username 4 length'=>array(
> >         'rule'=>array('minLength', 4),
> >         'message'=>array('Username must be at least 4 characters in
> > length')
> >       ),
> >       'Username can only be alphanumeric'=>array(
> >         'rule'=>'alphaNumeric',
> >         'message'=>'Username can only be letters and numbers.'
> >       ),
> >       'Must be unique'=>array(
> >         'rule'=>'isUnique',
> >         'message'=>'That username is taken, try another.'
> >       )
> >     ),
> >     'email'=>array(
> >       'Not empty'=>array(
> >         'rule'=>'notEmpty',
> >         'message'=>'Please enter your email address.'
> >       ),
> >       'Valid email'=>array(
> >         'rule'=>'email',
> >         'message'=>'This is not a valid email address.'
> >       ),
> >       'Must be unique'=>array(
> >         'rule'=>'isUnique',
> >         'message'=>'That email address is already taken.'
> >       )
> >     ),
> >     'password'=>array(
> >       'Minimum 6 length'=>array(
> >         'rule'=>array('minLength', 6),
> >         'message'=>'Password must be at least 6 characters in length.'
> >       ),
> >       'Passwords must match'=>array(
> >         'rule'=>'matchPasswords',
> >         'message'=>'The passwords do not match.'
> >       )
> >     ),
> >     'ToS'=>array(
> >         'rule'=>'/1/',
> >         'message'=>'You must agree to the terms of service.'
> >     )
>
> > Is there any other way they could have gotten around my model
> > validations? Or did they DB access because I left my core.php in
> > development?
>
> > Thanks.

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


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


Re: Security and Model Validation Questions

2011-08-12 Thread euromark
debug > 0 is an absolute nogo for productive sites.

but besides that:
yes, thats possible
there are several easy ways to bypass the baked actions and validation

the easiest thing is to post empty forms (using firebug its easy to
remove the inputs or replace them with nonsense).

@see
http://www.dereuromark.de/2010/09/21/saving-model-data-and-security/
for details


On 12 Aug., 22:24, andrewperk  wrote:
> Hello,
>
> I have a cakephp site I'm working on. I have it live on a production
> server, it's still in development.
>
> I switched my core.php from production to development to do some
> testing of things on the live server and forgot to change it back. I
> left it like this for about a week.
>
> Apparently someone smart found the website. They didn't do any damage
> they just kind of let me know I had a bug somewhere.
>
> They were somehow able to bypass my model validation and register
> themselves with a NULL username and password and marked themselves as
> a premium member which can only be done via a paypal payment using web
> tech nicks paypal plugin. They did this 4 times set username, email,
> password fields in the DB to NULL and marked themselves as a premium
> member giving them paid services for free.
>
>  I'm wondering if while I left the core.php in development mode they
> got DB access somehow and that's how they did it?
>
> Here's my basic user validation which ensures a username and valid
> password and confirmation as well as username uniqueness:
>
> 'username'=>array(
>       'Not Empty'=>array(
>         'rule'=>'notEmpty',
>         'message'=>'Please enter your desired username.'
>       ),
>       'Username 4 length'=>array(
>         'rule'=>array('minLength', 4),
>         'message'=>array('Username must be at least 4 characters in
> length')
>       ),
>       'Username can only be alphanumeric'=>array(
>         'rule'=>'alphaNumeric',
>         'message'=>'Username can only be letters and numbers.'
>       ),
>       'Must be unique'=>array(
>         'rule'=>'isUnique',
>         'message'=>'That username is taken, try another.'
>       )
>     ),
>     'email'=>array(
>       'Not empty'=>array(
>         'rule'=>'notEmpty',
>         'message'=>'Please enter your email address.'
>       ),
>       'Valid email'=>array(
>         'rule'=>'email',
>         'message'=>'This is not a valid email address.'
>       ),
>       'Must be unique'=>array(
>         'rule'=>'isUnique',
>         'message'=>'That email address is already taken.'
>       )
>     ),
>     'password'=>array(
>       'Minimum 6 length'=>array(
>         'rule'=>array('minLength', 6),
>         'message'=>'Password must be at least 6 characters in length.'
>       ),
>       'Passwords must match'=>array(
>         'rule'=>'matchPasswords',
>         'message'=>'The passwords do not match.'
>       )
>     ),
>     'ToS'=>array(
>         'rule'=>'/1/',
>         'message'=>'You must agree to the terms of service.'
>     )
>
> Is there any other way they could have gotten around my model
> validations? Or did they DB access because I left my core.php in
> development?
>
> Thanks.

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


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


Re: Add new fields to a database table

2011-08-12 Thread aortizhi
that's an application's request made for the client. He would like to
add new information to a table or many tables because there could be
more information in the future that may came out.

On Aug 11, 5:30 pm, Ryan Schmidt  wrote:
> On Aug 10, 2011, at 11:45, aortizhi wrote:
>
> > Hi eveyone, i'm new working with cakephp. I would like to know how can
> > i let my webapp's users add new fields to a table in my data base but
> > while is in production.
>
> That's not usually done. Why do you believe you want to do this? What problem 
> are you trying to solve? Perhaps there is a better way.

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


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


Security and Model Validation Questions

2011-08-12 Thread andrewperk
Hello,

I have a cakephp site I'm working on. I have it live on a production
server, it's still in development.

I switched my core.php from production to development to do some
testing of things on the live server and forgot to change it back. I
left it like this for about a week.

Apparently someone smart found the website. They didn't do any damage
they just kind of let me know I had a bug somewhere.

They were somehow able to bypass my model validation and register
themselves with a NULL username and password and marked themselves as
a premium member which can only be done via a paypal payment using web
tech nicks paypal plugin. They did this 4 times set username, email,
password fields in the DB to NULL and marked themselves as a premium
member giving them paid services for free.

 I'm wondering if while I left the core.php in development mode they
got DB access somehow and that's how they did it?

Here's my basic user validation which ensures a username and valid
password and confirmation as well as username uniqueness:

'username'=>array(
  'Not Empty'=>array(
'rule'=>'notEmpty',
'message'=>'Please enter your desired username.'
  ),
  'Username 4 length'=>array(
'rule'=>array('minLength', 4),
'message'=>array('Username must be at least 4 characters in
length')
  ),
  'Username can only be alphanumeric'=>array(
'rule'=>'alphaNumeric',
'message'=>'Username can only be letters and numbers.'
  ),
  'Must be unique'=>array(
'rule'=>'isUnique',
'message'=>'That username is taken, try another.'
  )
),
'email'=>array(
  'Not empty'=>array(
'rule'=>'notEmpty',
'message'=>'Please enter your email address.'
  ),
  'Valid email'=>array(
'rule'=>'email',
'message'=>'This is not a valid email address.'
  ),
  'Must be unique'=>array(
'rule'=>'isUnique',
'message'=>'That email address is already taken.'
  )
),
'password'=>array(
  'Minimum 6 length'=>array(
'rule'=>array('minLength', 6),
'message'=>'Password must be at least 6 characters in length.'
  ),
  'Passwords must match'=>array(
'rule'=>'matchPasswords',
'message'=>'The passwords do not match.'
  )
),
'ToS'=>array(
'rule'=>'/1/',
'message'=>'You must agree to the terms of service.'
)


Is there any other way they could have gotten around my model
validations? Or did they DB access because I left my core.php in
development?

Thanks.

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


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


Moving a tree node

2011-08-12 Thread mebibyte
Hello

With the function moveUp and moveDown you can move a node up or down
the tree. But the node moves so it becomes the first (or last)child.
Is there a function so it wil move 1 place?

Example:
vegetable
   - lettuce
Fruit
   - peer
   - apple
   - Mango ***

I want to move the mango one place up:

vegetable
   - lettuce
Fruit
   - peer
   - mango ***
   - apple

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


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


1.3.11 Auth ACL beforeFilter

2011-08-12 Thread SibLiant
Hi community,

I'm trying to create a public interface to allow for registration and
I'm experiencing an issue that i don't understand.  I have ACL (with
bindNode for easy group permissions) setup but no permissions within
the aro_aco join table as of yet.  Please correct me but with no
permissions in the aro_aco table no one should have access to any of
the users controller actions.

When I completely remove the beforeFilter function, this holds true.
I can not access the users controllers index function - as expected.
However when I simply put the function back in, I can access index,
edit , etc..
function beforeFilter() {
$this->Auth-
>allow('register','register_confirm','verify','login','logout');
$this->Auth->autoRedirect = false;
}

Even if i just add an empty beforeFilter declaration.  the access to
the users controller is opened up again.

I don't get it.




var $name = 'Users';
var $layout = 'gsc-layout';
var $components = array('Email','Acl', 'Auth', 'Session');
var $uses  = array('User','Group');

var $paginate = array(
  'limit' => 100,
  'order' => array(
  'user_id' => 'asc'
  )
);

function index() {
$this->User->recursive = 0;
$this->set('users', $this->paginate());
}

function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid user', true));
$this->redirect(array('action' => 'index'));
}
$this->set('user', $this->User->read(null, $id));
}

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

function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid user', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->User->save($this->data)) {
$this->Session->setFlash(__('The user has been 
saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The user could not 
be saved. Please,
try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->User->read(null, $id);
}
$users = $this->User->find('list');
$groups = $this->User->Group->find('list');
$this->set(compact('users', 'groups'));
}

function delete($id = null) {
  if (!$id) {
  $this->Session->setFlash(__('Invalid id for user', true));
  $this->redirect(array('action'=>'index'));
  }
  if ($this->User->delete($id)) {
  $this->Session->setFlash(__('User deleted', true));
  $this->redirect(array('action'=>'index'));
  }
  $this->Session->setFlash(__('User was not deleted', true));
  $this->redirect(array('action' => 'index'));
}

function send_confirm_email($user_id){
  $User = $this->User->read(null,$user_id);
  //$this->Email->to = $User['User']['email'];
  $this->Email->to = $User['User']['email'];
  //$this->Email->bcc = array('sec...@example.com');
  $this->Email->subject = 'Web Registration Confirmation';
  $this->Email->replyTo = 'me@mysitecom';
  $this->Email->from = 'The co ';
  $this->Email->template = 'registration_confirm'; // note no '.ctp'
  //Send as 'html', 'text' or 'both' (default is 'text')
  $this->Email->sendAs = 'text'; // because we like to send pretty
mail

  //Set view variables as normal
  $this->set('User', $User);

  //Do not pass any args to send()
  $this->Email->send();
}

function register(){

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

  if ($this->data['User']['password'] == $this->Auth-
>password($this->data['User']['password_confirm'])) {
$this->User->cr

Re: Cron help

2011-08-12 Thread Sebastian Henschel
hi Prabha...

Am Freitag, den 12.08.2011, 03:19 -0700 schrieb Prabha vathi:

> http://www.ibm.com/developerworks/opensource/library/os-php-fwk5/?ca=.
> 
> I used the above link to learn, how to do cron. But I don't understand
> the below line
> /column/protected/cakephp/cake/console/cake prune
> -app /column/protected/cakephp/app/
> 
> How to change this to create cron in my shared server? I have option
> to add crons.

$ crontab -e 

and paste the following line:

@hourly /cake/console/cake prune -app
/app/

replace  accordingly and the script will be executed
every hour. if you need more info about how to control execution times:

$ man 5 crontab


hth,
 Sebastian


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


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


Cake 2.0 beta: FormHelper + HABTM fields

2011-08-12 Thread handsofaten
Hi - I'm working with CakePHP 2.0 beta, and having some trouble with
the expected FormHelper functionality.

I have in my view something like this:

$i = 0;
foreach($terms as $term){
  echo $this->Form->input('Term.'.$i.'.id');
  $i++
}

>From which I expect something like this to be generated:


...

But instead I'm getting:


...

Can anyone explain this behavior, or help me work around it?

thanks-
Ben.

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


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


Re: Using SELECT... FOR UPDATE in cakephp

2011-08-12 Thread Dr. Loboto
Start transaction, select, save, close transaction. Something like
this:

$DS = $this->getDataSource();
$DS->begin();
$this->find(...);
if ($this->save(...)) {
$DS->commit();
}
else {
$DS->rollback();
}

On 11 авг, 00:10, Teddy Zeenny  wrote:
> Hi,
>
> Is there a way in cakephp to use SELECT .. FOR UPDATE (for InnoDB row
> level locking) without using the $Model::query function (as this is
> highly not recommended) ?
>
> If not, does anyone know an alternative ?
>
> Thanks,
>
> Teddy

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


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


Re: replace emty fields at model or controler level

2011-08-12 Thread Dr. Loboto
If you want to display these values for users in form you _must_ do it
in view with placeholder input tags attribute. It's the only way to
display something to user and do not get affected by these values.

If you want to save these values in case of empty fields you should
fill it it somewhere like beforeSave() in model.

If you want not to save these values but display on pages (not forms)
you can check for empty fields in view or fill values somewhere like
afterFind() in model.

On 8 авг, 14:48, Johkke  wrote:
> Is it possible to replace empty fields with an given string (like: 'No
> subject given') at model or controller level? I really like to keep
> the view as simple as possible

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


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


Re: Cron help

2011-08-12 Thread euromark
cake prune option1 option2 ...
should do the trick

On 12 Aug., 12:19, Prabha vathi  wrote:
> Hi,
>
> http://www.ibm.com/developerworks/opensource/library/os-php-fwk5/?ca=.
>
> I used the above link to learn, how to do cron. But I don't understand the
> below line
> /column/protected/cakephp/cake/console/cake prune -app
> /column/protected/cakephp/app/
>
> How to change this to create cron in my shared server? I have option to add
> crons.
>
> Thanks

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


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


Re: Where to place code meant to be universally accessible?

2011-08-12 Thread Miles J
That's not what models are for. Models are meant to represent an
entity of data from a datasource (database or rest), not to convene
helper methods. Cake creates even more confusion because their model
system isn't a true model system, it's simply a DAO (database access
object).

On Aug 11, 3:42 pm, Stephen Latham  wrote:
> I agree the model is a good place.  I recently wrote these type of global 
> actions in the app controller rather than bootstrap.php but found after 
> thought and discussion the model made more sense.
>
> On 11 Aug 2011, at 22:09, euromark  wrote:
>
>
>
>
>
>
>
> > usually in the model
> > since controllers can easily access models
>
> > but that depends on your situation
> > maybe a lib, maybe a behavior, maybe some boostrap code
>
> > without knowing more details, i go for model code
>
> > On 11 Aug., 22:30, BurningFuses  wrote:
> >> In my app I have a bunch of time related routines that I want to be
> >> able to call from my controllers and models. I could turn them into a
> >> component so they could be accessible on all my controllers, but they
> >> wouldn't be (in a trivial way or recommended way) be accessible from
> >> my models. Where should I put them? Is there a recommended cake
> >> guideline for such a thing?
> >> Thank you,
> >> Burningfuses
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

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


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


Re: security component

2011-08-12 Thread Özgür Demir
I was able to solve the first question myself:

In my controller actions I allways check if(this->data) before saving
or editing a record.
If variables are passed via get (harmfull link for example), $this-
>data is empty and nothing harmfull can happen.
In other words, without using post method its not possible to add or
edit a record.
Hence, security->requirePost just seems to be neccessary for the
delete actions.

Still, do I have to replace all delete links
with small forms which contain the authentication token?

On Aug 11, 5:54 pm, Özgür Demir  wrote:
> Hi every body,
>
> I'm pretty sure this must have been answered somewhere. However I
> wasn't able to find an answer yet. I have two question regarding the
> security component.
>
> 1. Authentification tokens seem to be checked by the security
> component only if data is passed via post. I assume this since my
> delete action is performed through a delete link even if the action is
> protected by the security component. This makes the security component
> useless for CSRF without the use of security->requirePost(). Am I
> right with this?
>
> 2. Its obvious that my "add/edit" links are not working if using
> requirePost('add','edit'), I could solve this by adding
> requirePost('add','edit') only if data is submitted by the user like
> this:
>
> in beforeFilter
> if(this->data){
> security->requirePots('add,'edit')
>
> }
>
> But how do I handle the delete links? Do I have to replace all of them
> with small forms which contain the authentication token?
>
> Thanks for your help...

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


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


Re: redirect admin and user to different dashboard

2011-08-12 Thread Mohd Hasnol
Sorry, i still cant get it. I give an example. if admin, i would like to
link to the admin dashboard(homes/index) while users i link to the users
dashboard(posts/index). Then, in app_controller i used
$this->Auth->loginRedirect = array('controller'=>'homes',
'action'=>'index');

is it i need loginRedirect or disable it??

Sorry, im newb.

Thanks.

On Fri, Aug 12, 2011 at 6:02 PM, euromark wrote:

> i use the same action
> only switch the rendered view
>
> dashboard{
> $this->_dashbboardXXX depending on the role of the current user
> }
>
> _dashboardAdmin(
> $this->render('dashboard_admin')
>
> _dashboardUser(
> $this->render('dashboard_user')
> }
>
> makes a lot of thins easier
>
> On 12 Aug., 10:58, nOLL  wrote:
> > Hi,
> >
> > I have admin and user that will redirect to different dashboard after
> > login.
> > For example, admin will redirect to dashboard A and allow to access
> > dashboard B.
> > while user will redirect to dashboard B and not allow to access
> > dashboard A.
> >
> > I already using ACL, but i have problem in redirect after login since
> > both admin and user will redirect to dashboard A.
> >
> > So how i could implement this?
> >
> > Thanks,
> > nOLL
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

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


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


Cron help

2011-08-12 Thread Prabha vathi
Hi,

http://www.ibm.com/developerworks/opensource/library/os-php-fwk5/?ca=.

I used the above link to learn, how to do cron. But I don't understand the 
below line
/column/protected/cakephp/cake/console/cake prune -app 
/column/protected/cakephp/app/

How to change this to create cron in my shared server? I have option to add 
crons.

Thanks

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


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


Re: redirect admin and user to different dashboard

2011-08-12 Thread euromark
i use the same action
only switch the rendered view

dashboard{
$this->_dashbboardXXX depending on the role of the current user
}

_dashboardAdmin(
$this->render('dashboard_admin')

_dashboardUser(
$this->render('dashboard_user')
}

makes a lot of thins easier

On 12 Aug., 10:58, nOLL  wrote:
> Hi,
>
> I have admin and user that will redirect to different dashboard after
> login.
> For example, admin will redirect to dashboard A and allow to access
> dashboard B.
> while user will redirect to dashboard B and not allow to access
> dashboard A.
>
> I already using ACL, but i have problem in redirect after login since
> both admin and user will redirect to dashboard A.
>
> So how i could implement this?
>
> Thanks,
> nOLL

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


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


Re: Nested table update

2011-08-12 Thread Kevin Woolley
REMOVE ME

On Wed, Aug 10, 2011 at 12:31 AM, LJgato  wrote:

> I have the following models:
>
>
> Profile
>
> Image
>
> Post belongsTo Profile
>
> Profile hasOne Image
>
> When creating a post, a profile and its image can be created
> dynamically at the same time. When this occurs, I need to insert into
> post, profile and image. Using the relationships, Post->saveAll()
> inserts into Post and Profile, but not into Image. I have verified
> that the data posted from my form is all there and correct.
>
> Is there a way have the entire nested insert performed using the Post-
> >saveAll() and relationships between the models/tables?
>
> Thank you.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

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


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


Re: Nested table update

2011-08-12 Thread Ceeram
saveAll() will only save directly associated data, so Post->saveAll() wont 
save Image data, as that model is directtly associated with Post
This is described in the book and api

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


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


redirect admin and user to different dashboard

2011-08-12 Thread nOLL
Hi,

I have admin and user that will redirect to different dashboard after
login.
For example, admin will redirect to dashboard A and allow to access
dashboard B.
while user will redirect to dashboard B and not allow to access
dashboard A.

I already using ACL, but i have problem in redirect after login since
both admin and user will redirect to dashboard A.

So how i could implement this?

Thanks,
nOLL

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


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


Re: compatibility with mysql workbench foreign key names

2011-08-12 Thread Ceeram
then complain with workbench that you are not able to define how fk 
fieldnames are named

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


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


console errors when running 2.0 Console/cake

2011-08-12 Thread #2Will
Hello,

I'm starting a new project and have installed cake2.0 today.  All good
so far, got the debug kit working etc.

I have run into a problem when trying to run bake, i'm getting lots of
repeated notices along the lines of

"Undefined index:  tag in /Users/me/sites/mywebapp/lib/Cake/Console/
ConsoleOutput.php on line 195"

Line 195 looks like this:

$style = $this->styles($matches['tag']);

and the other errors are all along similar lines,

Notice: Undefined index: error in /Users/ne/sitez/webapp/lib/Cake/
Console/ConsoleOutput.php on line 210

$styleInfo[] = self::$_options[$option];

These lines are from the replace tags, which from the look of things
replaces html with color codes for the console i think?

so something Iv'e done has gone wrong there.  Could cake1.3 sites
elsewhere on the machine be conflicting or something?

Thanks for any pointers,

will

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


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