Re: PHP Fatal error: Class 'Router' not found in cake\libs\view\helper.php on line 178

2009-06-12 Thread AD7six



On Jun 13, 5:19 am, joshua  wrote:
> Hi Cakes,
> Is there anybody come across this problem? When I try to run cron job in
> cake console, it print out this error.
>
> PHP Fatal error:  Class 'Router' not found in cake\libs\view\helper.php on
> line 178
>
> If I change to $html->link to xxx, there will be no this
> error.
>
> My Shell Scripts like this:
> [code]
> class AbcShell extends Shell {
>     var $uses = array('modelA' );
>     var $helpers = array('Html','Javascript');
>
>    function main(){
> //
>    }
>
> [/code]
>
> Is there anything I missed? Thanks in advance for your reply.

The router isn't needed for shell access, so most likely that's the
reason it's not loaded.

AD
--~--~-~--~~~---~--~~
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: Help with meta attributes.

2009-06-12 Thread Dr. Loboto

Set array("http-equiv" => "Default-Style") as params?

On Jun 12, 4:51 pm, "mazharul2...@gmail.com" 
wrote:
>  
>
> this is a normal html tags and meta attributes.
> I want to change it into cakephp framework. Like
>
> meta(
>     'meta_name',
>     'enter any meta keyword here',
>     array(), false
> );?>
>
> but how can I change  http-equiv="Default-Style" this thing...plz help
>
> Thanx in advance.
--~--~-~--~~~---~--~~
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: Model + 2x behaviors = headache :(

2009-06-12 Thread Dr. Loboto

Use beforeSave method for data change... As you do in
AutoDateBehavior.

On Jun 12, 9:31 pm, Ernesto  wrote:
> So... is there any workaround?
>
> On 12 Giu, 10:07, "Dr. Loboto"  wrote:
>
>
>
> > What do you see in OrderModel::beforeValidate() do not prove anything
> > in this case. State of $this->data in OrderModel::beforeSave() have
> > sense. Validation and beforeValidate calls can even operate on copy of
> > data.
>
> > On Jun 11, 3:42 pm, Ernesto  wrote:
>
> > > that's not correct.
>
> > > a pr in model::beforeValidate shows the "Code" field.
>
> > > the data array seems to be resetted at every behavior call
>
> > > On 11 Giu, 10:13, "Dr. Loboto"  wrote:
>
> > > > I don't know why, but model data modification is possible only in
> > > > beforeSave method (at least in model itself) but your AutoCodeBehavior
> > > > try to do it in beforeValidate method.
>
> > > > On Jun 11, 2:38 pm, Ernesto  wrote:
>
> > > > > bump!!!
>
> > > > > On 9 Giu, 16:20, Ernesto  wrote:
>
> > > > > > here's some pr output.
>
> > > > > > @@@ AutoCodeBehavior @@@
>
> > > > > > $model->data @ AutoCode::beforeValidate (begin of function)
> > > > > > Note: this is the original data array returned by the view
>
> > > > > > Array
> > > > > > (
> > > > > >     [Order] => Array
> > > > > >         (
> > > > > >             [customer_id] => 30
> > > > > >             [ref] => T
> > > > > >         )
> > > > > > )
>
> > > > > > $model->data @ AutoCode::beforeValidate (end of function)
> > > > > > Note: the "Code" field is successfully added to model data array
>
> > > > > > Array
> > > > > > (
> > > > > >     [Order] => Array
> > > > > >         (
> > > > > >             [customer_id] => 30
> > > > > >             [ref] => T
> > > > > >             [Code] => 20090609
> > > > > >         )
> > > > > > )
>
> > > > > > @@@ AutoDateBehavior @@@
>
> > > > > > $model->data @ AutoDate::beforeSave (begin of function)
> > > > > > Note: the $model->data array is equal to the original one, "Code"
> > > > > > field is magically disappeared, maybe Cake passes the original data
> > > > > > array and not the modified one to every behavior?
>
> > > > > > Array
> > > > > > (
> > > > > >     [Order] => Array
> > > > > >         (
> > > > > >             [customer_id] => 30
> > > > > >             [ref] => T
> > > > > >         )
> > > > > > )
>
> > > > > > $model->data @ AutoDate::beforeSave (end of function)
> > > > > > Note: field "EstimatedDeliveryDate" is successfully added
>
> > > > > > Array
> > > > > > (
> > > > > >     [Order] => Array
> > > > > >         (
> > > > > >             [customer_id] => 30
> > > > > >             [ref] => T
> > > > > >             [EstimatedDeliveryDate] => 2009-06-09
> > > > > >         )
> > > > > > )
>
> > > > > > @@@ Model @@@
>
> > > > > > $this->data @ model::beforeSave
> > > > > > Note: there's only "EstimatedDeliveryDate" field in data array. It
> > > > > > seems like the first behavior didn't work at all
>
> > > > > > Array
> > > > > > (
> > > > > >     [Order] => Array
> > > > > >         (
> > > > > >             [customer_id] => 30
> > > > > >             [ref] => T
> > > > > >             [EstimatedDeliveryDate] => 2009-06-09
> > > > > >         )
> > > > > > )
>
> > > > > > On 9 Giu, 15:52, Ernesto  wrote:
>
> > > > > > > here's my code.
>
> > > > > > > i removed all the comments.
>
> > > > > > > class OrderModel extends AppModel {
>
> > > > > > >         var $actsAs = array("AutoCode", "AutoDate");
>
> > > > > > >         var $validate = array(
> > > > > > >                 "Code" => array(
> > > > > > >                         "unique" => array(
> > > > > > >                                 "rule" => "isUnique",
> > > > > > >                                 "allowEmpty" => false,
> > > > > > >                                 "on" => "create"
> > > > > > >                         )
> > > > > > >                 ),
> > > > > > >         )
>
> > > > > > > }
>
> > > > > > > class AutoCodeBehavior extends ModelBehavior {
>
> > > > > > >         function beforeValidate (&$model) {
>
> > > > > > >                 $model->data[$model->alias]["Code"] = date("Ymd");
>
> > > > > > >                 return true;
>
> > > > > > >         }
>
> > > > > > > }
>
> > > > > > > class AutoDateBehavior extends ModelBehavior {
>
> > > > > > >         function beforeSave (&$model) {
>
> > > > > > >                 
> > > > > > > $model->data[$model->alias]["EstimatedDeliveryDate"] =
> > > > > > > date("Y-m-d");
>
> > > > > > >                 return true;
>
> > > > > > >         }
>
> > > > > > > }
>
> > > > > > > On 9 Giu, 15:04, Rob Conner  wrote:
>
> > > > > > > > You probably should paste code, your "in theory" based on code 
> > > > > > > > you
> > > > > > > > told us your wrote is correct. But that doesn't solve the 
> > > > > > > > problem. So
> > > > > > > > there must be some error in your code.
--~--~-~--~~~---~--~~
You received this message because you are subscri

Re: Auth Component Problem

2009-06-12 Thread Francisco Rivas
Yes, It's clear:

Configure::write('Security.salt', '');

But I still cannot login.

There're is something wrong with the code or It's missing something?.

Thanks for thw answer

2009/6/12 joshua 

> Don't forget to clear the session salt in core.php
>
> Configure::write('Security.salt', '');
>
>
>
> On Sat, Jun 13, 2009 at 10:33 AM, PanchoRivas  wrote:
>
>>
>> Hi all,
>>
>> I just started with Auth and I have some problems. I learned about
>> Auth in tutorials and it seems very easy but It doesn´t work in my
>> application.
>>
>> I create a table called 'personas' with the fields 'email' for
>> username and 'clave' for password. When I add a new person, the
>> password saved with md5 codification.
>>
>> My app_controller:
>>
>> class AppController extends Controller {
>>
>> var $components = array('Auth');
>>
>> function beforeFilter(){
>>
>>
>>$this->Auth->userModel = 'Persona';
>>
>>Security::setHash("md5");
>>
>>   $this->Auth->fields = array('username' => 'email',
>> 'password' => 'clave');
>>
>>  $this->Auth->loginAction = array('controller' =>
>> 'personas', 'action' => 'index');
>>
>> $this->Auth->allow('index','add');
>>
>> $this->Auth->loginRedirect = array('controller' =>
>> 'personas', 'action' => 'display', 'login');
>>
>>   $this->Auth->logoutRedirect = array('controller' =>
>> 'personas', 'action' => 'logout');
>>
>> $this->Auth->loginError = 'El email ingresado o la contraseña
>> no son correctos. Por favor, intentalo otra vez.';
>>
>> $this->Auth->authError = 'Para entrar en la zona privada
>> tienes que
>> autenticarte';
>>
>> $this->Auth->authorize = 'controller';
>>
>> $this->Session->write('Auth.redirect', null);
>>
>>  }
>>
>>  function isAuthorized() {
>>return true;
>>}
>> }
>>
>> My personas_controller.php:
>>
>> function login()
>> {
>>
>> }
>>
>> function logout() {
>>$this->Session->setFlash("Se ha desconectado
>> correctamente");
>>$this->redirect($this->Auth->logout());
>> }
>>
>> In the views personas, I created a index.ctp:
>>
>> >
>>  $session->flash('auth');
>>
>>  echo $form->create('Persona',array('action'=>'login'));
>>
>>  echo $form->input('email',array('label' => 'Email: '));
>>
>>  echo $form->input('clave',array('label' => 'Password: ','type' =>
>> 'password'));
>>
>>  echo $form->end('Ingresar!');
>>
>>
>> ?>
>>
>> And I create the view login.ctp but when I tried to login with a
>> existing username and password I cannot enter.
>>
>> Please I appreciate your help.
>>
>> Thanks
>>
>>
>> Godbye
>>
>>
>>
>>
>
>
> --
> Thanks
> Joshua
>
> >
>


-- 
Francisco Rivas Dibán
BackSpace
www.backspace.cl

--~--~-~--~~~---~--~~
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: Auth Component Problem

2009-06-12 Thread joshua
Don't forget to clear the session salt in core.php

Configure::write('Security.salt', '');


On Sat, Jun 13, 2009 at 10:33 AM, PanchoRivas  wrote:

>
> Hi all,
>
> I just started with Auth and I have some problems. I learned about
> Auth in tutorials and it seems very easy but It doesn´t work in my
> application.
>
> I create a table called 'personas' with the fields 'email' for
> username and 'clave' for password. When I add a new person, the
> password saved with md5 codification.
>
> My app_controller:
>
> class AppController extends Controller {
>
> var $components = array('Auth');
>
> function beforeFilter(){
>
>
>$this->Auth->userModel = 'Persona';
>
>Security::setHash("md5");
>
>   $this->Auth->fields = array('username' => 'email',
> 'password' => 'clave');
>
>  $this->Auth->loginAction = array('controller' =>
> 'personas', 'action' => 'index');
>
> $this->Auth->allow('index','add');
>
> $this->Auth->loginRedirect = array('controller' =>
> 'personas', 'action' => 'display', 'login');
>
>   $this->Auth->logoutRedirect = array('controller' =>
> 'personas', 'action' => 'logout');
>
> $this->Auth->loginError = 'El email ingresado o la contraseña
> no son correctos. Por favor, intentalo otra vez.';
>
> $this->Auth->authError = 'Para entrar en la zona privada
> tienes que
> autenticarte';
>
> $this->Auth->authorize = 'controller';
>
> $this->Session->write('Auth.redirect', null);
>
>  }
>
>  function isAuthorized() {
>return true;
>}
> }
>
> My personas_controller.php:
>
> function login()
> {
>
> }
>
> function logout() {
>$this->Session->setFlash("Se ha desconectado
> correctamente");
>$this->redirect($this->Auth->logout());
> }
>
> In the views personas, I created a index.ctp:
>
> 
>  $session->flash('auth');
>
>  echo $form->create('Persona',array('action'=>'login'));
>
>  echo $form->input('email',array('label' => 'Email: '));
>
>  echo $form->input('clave',array('label' => 'Password: ','type' =>
> 'password'));
>
>  echo $form->end('Ingresar!');
>
>
> ?>
>
> And I create the view login.ctp but when I tried to login with a
> existing username and password I cannot enter.
>
> Please I appreciate your help.
>
> Thanks
>
>
> Godbye
>
>
> >
>


-- 
Thanks
Joshua

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



Auth Component Problem

2009-06-12 Thread PanchoRivas

Hi all,

I just started with Auth and I have some problems. I learned about
Auth in tutorials and it seems very easy but It doesn´t work in my
application.

I create a table called 'personas' with the fields 'email' for
username and 'clave' for password. When I add a new person, the
password saved with md5 codification.

My app_controller:

class AppController extends Controller {

var $components = array('Auth');

function beforeFilter(){


$this->Auth->userModel = 'Persona';

Security::setHash("md5");

   $this->Auth->fields = array('username' => 'email',
'password' => 'clave');

  $this->Auth->loginAction = array('controller' =>
'personas', 'action' => 'index');

 $this->Auth->allow('index','add');

 $this->Auth->loginRedirect = array('controller' =>
'personas', 'action' => 'display', 'login');

   $this->Auth->logoutRedirect = array('controller' =>
'personas', 'action' => 'logout');

 $this->Auth->loginError = 'El email ingresado o la contraseña
no son correctos. Por favor, intentalo otra vez.';

 $this->Auth->authError = 'Para entrar en la zona privada 
tienes que
autenticarte';

 $this->Auth->authorize = 'controller';

 $this->Session->write('Auth.redirect', null);

  }

  function isAuthorized() {
return true;
}
}

My personas_controller.php:

function login()
{

}

function logout() {
$this->Session->setFlash("Se ha desconectado correctamente");
$this->redirect($this->Auth->logout());
}

In the views personas, I created a index.ctp:

flash('auth');

 echo $form->create('Persona',array('action'=>'login'));

 echo $form->input('email',array('label' => 'Email: '));

 echo $form->input('clave',array('label' => 'Password: ','type' =>
'password'));

 echo $form->end('Ingresar!');


?>

And I create the view login.ctp but when I tried to login with a
existing username and password I cannot enter.

Please I appreciate your help.

Thanks


Godbye


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



PHP Fatal error: Class 'Router' not found in cake\libs\view\helper.php on line 178

2009-06-12 Thread joshua
Hi Cakes,
Is there anybody come across this problem? When I try to run cron job in
cake console, it print out this error.

PHP Fatal error:  Class 'Router' not found in cake\libs\view\helper.php on
line 178

If I change to $html->link to xxx, there will be no this
error.

My Shell Scripts like this:
[code]
class AbcShell extends Shell {
var $uses = array('modelA' );
var $helpers = array('Html','Javascript');

   function main(){
//
   }

[/code]


Is there anything I missed? Thanks in advance for your reply.

Joshua

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



xml not parse correctly

2009-06-12 Thread robert123

i am using the below codes, took from the bakery, straight

 App::import('Xml');

// your XML file's location
$file = "my_xml_file.xml";

// now parse it
$parsed_xml =& new XML($file);
$parsed_xml = Set::reverse($parsed_xml); // this is what i call
magic

// see the returned array
   var_dump($parsed_xml);
 it shows
array(1) { ["Order"]=>  array(1) { ["id"]=>  string(7) "3525314" } }

the  my_xml_file.xml have the data below



it has two order data, the my_xml_file.xml was generated from the
database using $xml->serialize($data);

but whenever the code above is executed I only get
Array ( [Order] => Array ( [id] => 3525314 ) )

that is it is only reads the first order and never the second order,
how can i make it to read the whole xml data into an array, thank you




http://www.generics.ws
--~--~-~--~~~---~--~~
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 element rendering causing isUnique to misbehave

2009-06-12 Thread brian

On Fri, Jun 12, 2009 at 7:43 PM, Jon Chin wrote:
> It's taken me a little bit to track this down.  The problem is that the
> model's $this->id is not set.  How can I make it so the model has that?

Did you supply a hidden field with the ID? You need that if it's an edit form.

echo $form->create('User', array('action' => 'edit'));
echo $form->hidden('id');

--~--~-~--~~~---~--~~
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 element rendering causing isUnique to misbehave

2009-06-12 Thread Jon Chin
It's taken me a little bit to track this down.  The problem is that the 
model's $this->id is not set.  How can I make it so the model has that?


Jon Chin




brian wrote:

Are you sure you're passing the model's ID? If you change the email,
is the record edited, or do you get a completely new record? Cake will
check the ID to see if the unique field it finds belongs to the
currently-edited object. If so, it should let it pass.

On Tue, Jun 9, 2009 at 1:32 PM, Jon Chin wrote:
  

I'm hoping somebody here can help me figure out how to use isUnique in
my model correctly.

I have a db table with email, name, etc.  I developed an action in my
controller and a view for the purpose of allowing the user to editing
the data stored here.  I created a rule isUnique for the email field and
it worked perfectly.

However, I needed to convert it to a page where groups of these settings
are in their own view (and I load them into the page via AJAX).  Now, it
won't let the user save changes to their profile without changing their
email (since it detects that the email they entered already exists).

Can anybody tell me why this change to AJAX element rendering is causing
this?  Or better yet, how I can fix it?  Thanks.

--
Jon Chin
801-592-5029
email: j...@boogly.net
AIM: port23user
Google Talk: port23u...@gmail.com
MSN Messenger: egghea...@hotmail.com
Yahoo Messenger: port23user





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

  


smime.p7s
Description: S/MIME Cryptographic Signature


Re: Auth Component, white page when cookies disabled

2009-06-12 Thread Miles J

Auth does not use Cookies, so please make sure this is even an Auth
problem.
--~--~-~--~~~---~--~~
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: Controller Variable name for bake

2009-06-12 Thread stretcharmy

In addition it needs to be "Foo_Bar".  I can see in the shell.php code
that _pluralName() returns what I want.  But how it's brought out in
bake I have no idea.

On Jun 12, 2:42 pm, stretcharmy  wrote:
> I'm creating a custom template for bake for my index views.  I still
> trying to get my head around cake and I'm looking for the name of the
> variable for the controller for the template.  Or at least how to get
> it.  I'm looking for the "foo_bar" type.
>
> Thanks for any help.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Controller Variable name for bake

2009-06-12 Thread stretcharmy

I'm creating a custom template for bake for my index views.  I still
trying to get my head around cake and I'm looking for the name of the
variable for the controller for the template.  Or at least how to get
it.  I'm looking for the "foo_bar" type.

Thanks for any help.

--~--~-~--~~~---~--~~
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: Help with CSS Rollover Links

2009-06-12 Thread Andreas

Hi,
well i think you first need to learn the basics. e.g.: html + css before 
proceeding to php (cake not to mention). 
besides, its called "hover", not "rollover".
But anyway, to help you with that problem (maybe i missunderstood it 
...), this is how you make a button wich changes the image when the 
mouse is over it:

Viewcode:
link('Home', "blog/index/", array('id' => 'homebtn')); ?>
link('Best Postings', "blog/bestof/", array('id' => 
'best')); ?>

CSS:
a#homebtn { background: transparent url(path/to/button/img.png) 0 0 
no-repeat); float: left; }
a#homebtn:hover { background: transparent url(path/to/hover/img.png) 0 0 
no-repeat; float: left; }

hope that helps.

greets
Andreas

DbZeroOne schrieb:
> Ok, good advice from both of you. This is what my code looks like now:
>
>  echo $html->link('',array('controller'=>'blog','action' =>
> 'index'),array('ID' => 'homebtn','alt' => 'Home'));
> echo $html->link('',array('controller'=>'blog','action' =>
> 'bestof'),array('ID' => 'best',  ,'alt' => 'Best Postings'));
> ?>
>
> This should be one button to the right of the other.There will be 5
> total in a horizontal menu.
>
> The problem now is that only one button will work at a time (link and
> rollover). Either one will work when they're alone, but together, only
> the first one will work (whichever one is first). I've tried
> everything I can think of, but either nothing changes or the whole
> page blanks out.
>
> Thank you for your input.
>
>
> >
>   

--~--~-~--~~~---~--~~
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: Matching two "favorites"-lists

2009-06-12 Thread Céryl

Never mind, It has been solved,

I used the Query() command with this query from Lavin:

SELECT  t1.product_id
FROMusers_products t1
WHERE   t1.user_id=$user1
AND t1.product_id IN
(SELECT t2.product_id
FROMusers_products t2
WHERE   t2.user_id=$user2)

Thansk!

On 12 jun, 18:17, Céryl  wrote:
> Hej all,
>
> I still can't find a solution to my problem. I have a users that can
> place products on a favorites list. The products have a HABTM relation
> with users. Now I need to find the products that are similar on the
> lists of two users. Is there a handy query for this or do I have fetch
> both list seperate and code PHP that iterates through the arrays and
> checks it. I think coding will become to slow, so I prefer a query
> solution.
>
> Does anybody have any idea to solve this?
>
> Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth Component, white page when cookies disabled

2009-06-12 Thread cakephp_rocks

set debug to 1 you should able to see it

On Jun 9, 3:44 pm, Marcel  wrote:
> Hi,
>
> When I disable Cookies I get a white page after logging into my website
> (using Auth Component).
>
> Is there a way view an error page instead of just a white page?
>
> Marcel
--~--~-~--~~~---~--~~
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: Tough find query!

2009-06-12 Thread lavin

Although I am new to cake, this SQL query could work with the query()
function

SELECT  t1.prod_id
FROMHABTMtable t1
WHERE   t1.user_id=1
AND t1.prod_id IN
(SELECT t2.prod_id
FROMHABTMtable t2
WHERE   t2.user_id=2)

Second SELECT gets all products from user2, while first SELECT  gets
products that belong to user 1 and are in the second query (belonging
to both users)
On 9 jun, 10:40, Céryl  wrote:
> Allright,
> I;ve been cracking my head on this.
>
> I have a HABTM relation between users and products. Users can select a
> product to put on his favorite list. Everything works great (A lot of
> thanks to this Googlegroups for that!) but now I need something heavy.
>
> So I have a users table, products table and the HABTM table with
> user_id and product_id. From this table I can get, using Containable
> behaviour) the products belonging to a certain user.
>
> Now I want to match the lists of two users together. So using two id's
> from two different users, I need to get a list of products from the
> table that occur in both users list.
>
> So:
> User1       User2
> Product1  Product2
> Product3  Product3
> Product5  Product6
> Product6
>
> Needs to return an array containing Product 3 and product 6. I've been
> reading and re-reading containable behaviour and the internet, and
> though about getting both lists from the database and just use a PHP
> query to match. Is there an easy solution, or do you recommend using
> PHP instead of SQL for this, timewise?
>
> Thanks a million!

--~--~-~--~~~---~--~~
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: Advice about file security

2009-06-12 Thread wowfka

Thank you for the response. Performance is not  very important because
these files will be small. Why i want dedicated FTP server?, well it
creates another secure layer + hardware firewall in case somebody
break http server (which is hosted by another company) and we want
have all files near us. In details, my scheme is: user buy file, i
check that order is legal, then send request to ftp for file, if
everything is ok, starting download. T

On Jun 12, 6:18 pm, Martin Westin  wrote:
> I just had a small question.
> Any particular reason you want to put the files on a separate server
> and get them via ftp?
>
> The easiest way to "secure" the acces to the files is (as it sounds
> like you are doing) to send them out through a controller/action that
> checks that you have purchased that particular file and so on. On top
> of that you of that you have added the overhead of ftp which on the
> face of it sound needlessly complicated. Loading them from a local
> filesystem would be quicker and safer.
>
> I have a Cake app outputting data at 60-70mbit read from a secure
> folder on the server and dumped out via an action to priviliged users.
> If you use readfile_chunked() (found in the comments onwww.php.net/readfile)
> you can output files of any size without overloading the server's
> memory.  Dual layer DVD images via php? No problem :)
>
> If the firewall is set correctly it is not really that unsafe to use
> php as a middle-man to an ftp. Your app needs to be secure no matter
> what you do.
>
> On Jun 12, 4:09 pm, wowfka  wrote:
>
> > Hello,
>
> > Have question regarding file security. I am thinking to create e-shop
> > where you can buy some files.
> > Would it be secure if i create dedicated ftp server, allow access to
> > it only from e-shop (IP). Users cant directly access ftp, i have
> > written ftp client with php, which downloads, sends files to-from FTP
> > server, then delivers it to buyer respectively. What security problems
> > that solution may have?  Maybe anyone have implented anything similar?
> > What solutions you have used.? Any suggestion appreciated.
--~--~-~--~~~---~--~~
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: Help with CSS Rollover Links

2009-06-12 Thread brian

On Fri, Jun 12, 2009 at 12:16 PM, DbZeroOne wrote:
>
> Ok, good advice from both of you. This is what my code looks like now:
>
>  echo $html->link('',array('controller'=>'blog','action' =>
> 'index'),array('ID' => 'homebtn','alt' => 'Home'));
> echo $html->link('',array('controller'=>'blog','action' =>
> 'bestof'),array('ID' => 'best',  ,'alt' => 'Best Postings'));
> ?>

You have an extra comma after "'ID' => 'best'".

> This should be one button to the right of the other.There will be 5
> total in a horizontal menu.
>
> The problem now is that only one button will work at a time (link and
> rollover). Either one will work when they're alone, but together, only
> the first one will work (whichever one is first). I've tried
> everything I can think of, but either nothing changes or the whole
> page blanks out.

Could be a javascript or CSS issue.

--~--~-~--~~~---~--~~
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: Cache::delete() very slow

2009-06-12 Thread brian

On Fri, Jun 12, 2009 at 2:45 AM, AD7six wrote:
>
>
>
> On Jun 12, 6:07 am, brian  wrote:
>> I have a function which reorders a tree list using TreeBehavior's
>> moveup()/movedown(). This list is, more or less, a set of navigation
>> links. I'm using ACL so that I can display a slightly different
>> version for each of several (5-10) groups. To avoid having to make an
>> ACL lookup every page view, the trees are cached. So, any time a node
>> is edited/added/deleted/moved, I remove the cached trees. This is
>> generally ok as these actions will be performed only sporadically and
>> always by an admin.
>>
>> To move nodes around, I'm using some jquery drag & drop and then
>> sending an AJAX request. The method that handles the move includes a
>> call to __removeGroupSections() (shown below). I'm consistently seeing
>> this request take ~20 seconds. If I comment out the call to
>> __removeGroupSections() the request comes back in ~1 second.
>>
>> So, can anyone suggest a faster way to accomplish this?
>
> I'd suggest xdebug -> profile -> see where your 20s are going.

I'll check out using xdebug. It's certainly fine when I comment out
the Cache::delete()

> Why don't you put all your acl in a single folder (e.g. tmp/cache/
> acl/, create a new cache config to encompass it) then you can bulk
> delete them. (e.g exec('rm -rf tmp/cache/acl/*') ) or some other such
> planning for deletinging some/all strategy.

Bulk deleting works. Thanks for the tip.

The weird thing is that I've just discovered that there's some other
problem on the staging server. There's an error with this line:

$aros = $this->Acl->Aro->find('all');

I can't figure out how to debug this. Processing stops right there.

In any case, your alternative cache config idea works for now, so
there's no need for the find() call. In the meantime, I'm going to see
about installing memcached.

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



Matching two "favorites"-lists

2009-06-12 Thread Céryl

Hej all,

I still can't find a solution to my problem. I have a users that can
place products on a favorites list. The products have a HABTM relation
with users. Now I need to find the products that are similar on the
lists of two users. Is there a handy query for this or do I have fetch
both list seperate and code PHP that iterates through the arrays and
checks it. I think coding will become to slow, so I prefer a query
solution.

Does anybody have any idea to solve this?

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



Re: Help with CSS Rollover Links

2009-06-12 Thread DbZeroOne

Ok, good advice from both of you. This is what my code looks like now:

link('',array('controller'=>'blog','action' =>
'index'),array('ID' => 'homebtn','alt' => 'Home'));
echo $html->link('',array('controller'=>'blog','action' =>
'bestof'),array('ID' => 'best',  ,'alt' => 'Best Postings'));
?>

This should be one button to the right of the other.There will be 5
total in a horizontal menu.

The problem now is that only one button will work at a time (link and
rollover). Either one will work when they're alone, but together, only
the first one will work (whichever one is first). I've tried
everything I can think of, but either nothing changes or the whole
page blanks out.

Thank you for your input.


--~--~-~--~~~---~--~~
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: $javascript->event() with Event:Selectors

2009-06-12 Thread isho

Nate thanks for the reply.

I tried using that syntax but it throws this Javascript error.

iterator.call is not a function
http://dc-dev..xx/cakephp/js/prototype.js
Line 661

I'm using version 1.6.0.3 of prototype


On Jun 11, 7:22 am, Nate Abele  wrote:
> Hi Ishmael,
>
> The event:Selectors style requires a slightly different syntax because
> of how it's set up, and you need to write it like this:
>
> $javascript->event('.post .title:mouseover', 'this.select
> (".delete_action").invoke("show")');
>
> Hope that helps,
> - Nate
>
> On Jun 8, 9:06 pm, isho  wrote:
>
> > I having some trouble figuring out how to use $javascript->event()
> > with selectors other than #id's
>
> > First of all I was getting this error message "EventSelectors is not
> > defined" until I included the js lib "event-selectors.js" that I found
> > on github. (http://github.com/Caged/javascript-bits/tree/
> > 16af773a1316774b53805b7fc63b5e1eec34c35d/event-selectors) The
> > documentation doesn't really make this clear so I may have included
> > the wrong library.
>
> > Now I'm getting the js error: "mouseout is not defined"
>
> > This is my php code:
> > ---
> > echo $javascript->event('.post .title', 'mouseover','this.select
> > (".delete_action").invoke("show")');
> > ---
> > and here's the generated javascript:
>
> > var Rules = {
> > '.post .title': function(element, event) {
> >  mouseout
> >  }}
>
> > EventSelectors.start(Rules);
>
> > It seems like the method signature for this usage of the event()
> > method is different. Does anyone know how to do this? I'm fairly new
> > to cakephp and prototype.
>
> > Best,
> > Ishmael

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



Autocomplete Textbox In Php

2009-06-12 Thread richapate...@gmail.com

The textbox Autocomplete property which shows the next string for
entered character in that textbox. As the user types into the textbox,
a list drops down to show next match entry for the characters entered
in textbox.

http://www.sourcecode4you.com/article/articleview/584f35f0-4759-4e8c-9030-5615af16fce7/autocomplete-textbox-in-php.aspx


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



Help with meta attributes.

2009-06-12 Thread mazharul2...@gmail.com

 

this is a normal html tags and meta attributes.
I want to change it into cakephp framework. Like

meta(
'meta_name',
'enter any meta keyword here',
array(), false
);?>

but how can I change  http-equiv="Default-Style" this thing...plz help

Thanx in advance.

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



HABTM saving duplicates

2009-06-12 Thread Lucas Prim

Hi all!

I was starting to work with some HABTM relations and I've found the
following problem: Whenever I try to save the relationship between the
models I'm using (subject,teacher) more than one time, cake creates
duplicate entries into the subjects_teachers table.
I've created an unike key so it wouldn`t do that. It works but I got
some mySQL errors:

SQL Error: 1062: Duplicate entry '1-1' for key 'unique link' [CORE\cake
\libs\model\datasources\dbo_source.php, line 525]

Code | Context

$sql=   "INSERT INTO `subjects_teachers` (`subject_id`,`teacher_id`)
VALUES (1,1)"
$error  =   "1062: Duplicate entry '1-1' for key 'unique link'"
$out=   null

---
I didn`t use unique key set to true because I handle independent
associations every time.
---
The controller code is the following:

function assignTeacher()
{
$this->Subject->recursive = -1;

$subjects = $this->Subject->find('all');

foreach ($subjects as $data)
{
$this->Subject->Teacher->recursive = -1;
$teachers = $this->Subject->Teacher->find('all', 
array('conditions'
=> array('Teacher.subjects LIKE' => '%'.$data['Subject']
['code'].'%')));

foreach ($teachers as $teacher_data)
{
$data['Teacher']['id'] = 
$teacher_data['Teacher']['id'];
$this->Subject->save($data);
}
}
}

--~--~-~--~~~---~--~~
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: Open Flash Chart Helper issues

2009-06-12 Thread Brendon Kozlowski

OH!  The helper was updated for version 2, I was still using version
1.  My mistake!  I guess it's time to upgrade!  :D

On Jun 11, 1:32 am, Wayne  wrote:
> These are the codes
>
> http://bin.cakephp.org/saved/47129 (controller)
>
> http://bin.cakephp.org/view/1136206468 (view)
>
> http://bin.cakephp.org/view/614424760(array dump)
>
> There was no error message, the graph just doesn't show up. You can
> say that the chart was not rendered at all.
>
> Regards,
> Wayne
--~--~-~--~~~---~--~~
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: Advice about file security

2009-06-12 Thread Martin Westin

I just had a small question.
Any particular reason you want to put the files on a separate server
and get them via ftp?

The easiest way to "secure" the acces to the files is (as it sounds
like you are doing) to send them out through a controller/action that
checks that you have purchased that particular file and so on. On top
of that you of that you have added the overhead of ftp which on the
face of it sound needlessly complicated. Loading them from a local
filesystem would be quicker and safer.

I have a Cake app outputting data at 60-70mbit read from a secure
folder on the server and dumped out via an action to priviliged users.
If you use readfile_chunked() (found in the comments on www.php.net/readfile)
you can output files of any size without overloading the server's
memory.  Dual layer DVD images via php? No problem :)

If the firewall is set correctly it is not really that unsafe to use
php as a middle-man to an ftp. Your app needs to be secure no matter
what you do.




On Jun 12, 4:09 pm, wowfka  wrote:
> Hello,
>
> Have question regarding file security. I am thinking to create e-shop
> where you can buy some files.
> Would it be secure if i create dedicated ftp server, allow access to
> it only from e-shop (IP). Users cant directly access ftp, i have
> written ftp client with php, which downloads, sends files to-from FTP
> server, then delivers it to buyer respectively. What security problems
> that solution may have?  Maybe anyone have implented anything similar?
> What solutions you have used.? Any suggestion appreciated.
--~--~-~--~~~---~--~~
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: 500 Internal Server Error

2009-06-12 Thread rich...@home

*Might* be an out of memory error:

Try increasing the size that PHP is allowed to consume in your php.ini
file. You will need to restart Apache for the change to be registered.

Search for "memory_limit" (without the quotes).


*Might* be a cached path problem:

delete all the files in the app/tmp directory (but leave the
directories intact)


On Jun 12, 1:34 pm, "Dave Maharaj :: WidePixels.com"
 wrote:
> Now for some unknown reason I am getting 500 Internal Server Error and can
> not access any part of the site.
>
> I have other  sites on the server and they are still running fine so that's
> not the problem
>
> It's a site that has been in the works for a while and is close to being
> finished.
> - Htaccess has not been changed in months
> - no database changes
>
> - was building the jquery image upload and crop following the bakery
> tutorial and was working then everything stopped working...entire site 500
> error
> -removed all changes to the controller where i was adding the image upload,
> components, helpers
> - deleted cache, sessions
>
> Checked apache logs: no fatal errors reported
>
> Deleted entire site...put blank html page there and that loads fine...
>
> Re uploaded app
>                 cake
>
> And it works again for a few run thru's then back to 500 error.
>
> Ideas why this would happen?
> What else to check?
>
> Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model + 2x behaviors = headache :(

2009-06-12 Thread Ernesto

So... is there any workaround?

On 12 Giu, 10:07, "Dr. Loboto"  wrote:
> What do you see in OrderModel::beforeValidate() do not prove anything
> in this case. State of $this->data in OrderModel::beforeSave() have
> sense. Validation and beforeValidate calls can even operate on copy of
> data.
>
> On Jun 11, 3:42 pm, Ernesto  wrote:
>
>
>
> > that's not correct.
>
> > a pr in model::beforeValidate shows the "Code" field.
>
> > the data array seems to be resetted at every behavior call
>
> > On 11 Giu, 10:13, "Dr. Loboto"  wrote:
>
> > > I don't know why, but model data modification is possible only in
> > > beforeSave method (at least in model itself) but your AutoCodeBehavior
> > > try to do it in beforeValidate method.
>
> > > On Jun 11, 2:38 pm, Ernesto  wrote:
>
> > > > bump!!!
>
> > > > On 9 Giu, 16:20, Ernesto  wrote:
>
> > > > > here's some pr output.
>
> > > > > @@@ AutoCodeBehavior @@@
>
> > > > > $model->data @ AutoCode::beforeValidate (begin of function)
> > > > > Note: this is the original data array returned by the view
>
> > > > > Array
> > > > > (
> > > > >     [Order] => Array
> > > > >         (
> > > > >             [customer_id] => 30
> > > > >             [ref] => T
> > > > >         )
> > > > > )
>
> > > > > $model->data @ AutoCode::beforeValidate (end of function)
> > > > > Note: the "Code" field is successfully added to model data array
>
> > > > > Array
> > > > > (
> > > > >     [Order] => Array
> > > > >         (
> > > > >             [customer_id] => 30
> > > > >             [ref] => T
> > > > >             [Code] => 20090609
> > > > >         )
> > > > > )
>
> > > > > @@@ AutoDateBehavior @@@
>
> > > > > $model->data @ AutoDate::beforeSave (begin of function)
> > > > > Note: the $model->data array is equal to the original one, "Code"
> > > > > field is magically disappeared, maybe Cake passes the original data
> > > > > array and not the modified one to every behavior?
>
> > > > > Array
> > > > > (
> > > > >     [Order] => Array
> > > > >         (
> > > > >             [customer_id] => 30
> > > > >             [ref] => T
> > > > >         )
> > > > > )
>
> > > > > $model->data @ AutoDate::beforeSave (end of function)
> > > > > Note: field "EstimatedDeliveryDate" is successfully added
>
> > > > > Array
> > > > > (
> > > > >     [Order] => Array
> > > > >         (
> > > > >             [customer_id] => 30
> > > > >             [ref] => T
> > > > >             [EstimatedDeliveryDate] => 2009-06-09
> > > > >         )
> > > > > )
>
> > > > > @@@ Model @@@
>
> > > > > $this->data @ model::beforeSave
> > > > > Note: there's only "EstimatedDeliveryDate" field in data array. It
> > > > > seems like the first behavior didn't work at all
>
> > > > > Array
> > > > > (
> > > > >     [Order] => Array
> > > > >         (
> > > > >             [customer_id] => 30
> > > > >             [ref] => T
> > > > >             [EstimatedDeliveryDate] => 2009-06-09
> > > > >         )
> > > > > )
>
> > > > > On 9 Giu, 15:52, Ernesto  wrote:
>
> > > > > > here's my code.
>
> > > > > > i removed all the comments.
>
> > > > > > class OrderModel extends AppModel {
>
> > > > > >         var $actsAs = array("AutoCode", "AutoDate");
>
> > > > > >         var $validate = array(
> > > > > >                 "Code" => array(
> > > > > >                         "unique" => array(
> > > > > >                                 "rule" => "isUnique",
> > > > > >                                 "allowEmpty" => false,
> > > > > >                                 "on" => "create"
> > > > > >                         )
> > > > > >                 ),
> > > > > >         )
>
> > > > > > }
>
> > > > > > class AutoCodeBehavior extends ModelBehavior {
>
> > > > > >         function beforeValidate (&$model) {
>
> > > > > >                 $model->data[$model->alias]["Code"] = date("Ymd");
>
> > > > > >                 return true;
>
> > > > > >         }
>
> > > > > > }
>
> > > > > > class AutoDateBehavior extends ModelBehavior {
>
> > > > > >         function beforeSave (&$model) {
>
> > > > > >                 
> > > > > > $model->data[$model->alias]["EstimatedDeliveryDate"] =
> > > > > > date("Y-m-d");
>
> > > > > >                 return true;
>
> > > > > >         }
>
> > > > > > }
>
> > > > > > On 9 Giu, 15:04, Rob Conner  wrote:
>
> > > > > > > You probably should paste code, your "in theory" based on code you
> > > > > > > told us your wrote is correct. But that doesn't solve the 
> > > > > > > problem. So
> > > > > > > there must be some error in your code.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Advice about file security

2009-06-12 Thread wowfka

Hello,

Have question regarding file security. I am thinking to create e-shop
where you can buy some files.
Would it be secure if i create dedicated ftp server, allow access to
it only from e-shop (IP). Users cant directly access ftp, i have
written ftp client with php, which downloads, sends files to-from FTP
server, then delivers it to buyer respectively. What security problems
that solution may have?  Maybe anyone have implented anything similar?
What solutions you have used.? Any suggestion appreciated.

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



xml parsing problem

2009-06-12 Thread robert123

i am using the below codes, took from the bakery, straight

 App::import('Xml');

// your XML file's location
$file = "my_xml_file.xml";

// now parse it
$parsed_xml =& new XML($file);
$parsed_xml = Set::reverse($parsed_xml); // this is what i call
magic

// see the returned array
   var_dump($parsed_xml);
 it shows
array(1) { ["Order"]=>  array(1) { ["id"]=>  string(7) "3525314" } }

the  my_xml_file.xml have the data below



it has two order data, the my_xml_file.xml was generated from the
database using $xml->serialize($data);

but whenever the code above is executed I only get
Array ( [Order] => Array ( [id] => 3525314 ) )

that is it is only reads the first order and never the second order,
how can i make it to read the whole xml data into an array, thank you




http://www.generics.ws
--~--~-~--~~~---~--~~
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: Containable recursive find problem

2009-06-12 Thread Andreas Derksen

Thanks, Works fine! Thought to complicated... :-)
Containable behavior is really nice ;-)

greets
Andreas

Martin Westin schrieb:
> You just go:
>
> 'contain' => array(
>   'Product' => array(
> 'conditions' => array('Product.id' => $productId),
> 'Module' => array(
>   'Subject'
> )
>   ),
>   'Check'
> )
>
> That is: in contain you simply name the nearest "associates" and in
> each of those you name furhter associates to return.
>
>
>
> On Jun 12, 2:02 pm, Andreas Derksen  wrote:
>   
>> Hi, im currently developing a checklist application witch has the following 
>> Models and relations:
>> Checklist belongsTo Product
>> Checklist hasMany Check
>> Product HABTM Module
>> Module hasMany Subjects
>> Subject belongsTo Module
>> So, what i want to do now is to generate tables like this:Checklist ID 
>> 2Module 1Subject 1Subject 2Subject 3Subject 4Module 2Subject 1Subject 
>> 2Subject 3Subject 4
>> I tried to query it like this:
>> $this->Checklist->find('first', array('contain' => array(
>>  'Product' => 
>> array('conditions' => array('Product.id' => $productId)),
>>  'Check' )));
>> the result is:Array ( [Checklist] => Array ( [id] => 1 [product_id] => 1 ) 
>> [Product] => Array ( [id] => 1 [name] => Product1 ) [Check] => Array ( [0] 
>> => Array ( [id] => 1 [check] => true [checklist_id] => 1 [subject_id] => 1 ) 
>> ) )Now I need the Product array recursive, means: the associated Module(s) 
>> and the Subject(s) associated to the Module(s).
>> A $this->Checklist->find('first', array('recursive' => 2, 'conditions' => 
>> array('id' => $checklistId))); returns everything I need, ... and more. 
>> thats the problem.
>> How can I do that?
>> Thanks in advance
>> Andreas
>> 
> >
>   

--~--~-~--~~~---~--~~
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: Multiple Checkbox Validation help

2009-06-12 Thread Dave Maharaj :: WidePixels.com

Yep...thats what I have. The submitted data value array, I get the possible
values in the db and compare them against submitted values with my
checkValues function called in the model validation.. If any do not match
then we know someone was messing around return false...

That’s working and got the error message all set up.

Thanks again.

Dave



-Original Message-
From: John Andersen [mailto:j.andersen...@gmail.com] 
Sent: June-12-09 3:50 AM
To: CakePHP
Subject: Re: Multiple Checkbox Validation help


Hi Dave,

On the assumption, that all the possible values from the checkboxes, can be
found in the database, I would consider using:

http://book.cakephp.org/view/152/Adding-your-own-Validation-Methods

and in the validation method, validate that the submitted checkbox values
exists in the database! Just in case someone is trying to hack your form! :)

If the values are not from the database, then you have to specify them
manually in the validate array, not a good solution!

Enjoy,
   John

On Jun 11, 9:37 pm, "Dave Maharaj :: WidePixels.com"
 wrote:
> I am trying to validate multiple checkboxes of a HABTM table. I 
> managed to validate the values but cannot get a message to display. I 
> have my own compare values in db against submitted data to validate 
> but no message appears
>
> I then see in the cookbook
>
> var $validate = array(
>           'function' => array(
>                 'allowedChoice' => array(
>                         'rule' => array('inList', array('Foo', 
> 'Bar')),
>                         'message' => 'Enter either Foo or Bar.'
>                 )
>           )
>         );
>
> and
>
> var $validate = array(
>     'multiple' => array(
>         'rule' => array('multiple', array('in' => array('foo', 'bar'),
'min'
> => 1, 'max' => 3)),
>         'message' => 'Please select one, two or three options'
>     )
> );
>
> Would either of these work for validating multiple checkboxes?
> And how do I get the values of the fields when they say 'rule' => 
> array('inList', array('Foo', 'Bar')),
>
> Or
>
> 'rule' => array('multiple', array('in' => array('foo', 'bar'), 'min' 
> => 1, 'max' => 3)),
>
> Thanks,
>
> Dave


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



Re: Containable recursive find problem

2009-06-12 Thread Martin Westin

You just go:

'contain' => array(
  'Product' => array(
'conditions' => array('Product.id' => $productId),
'Module' => array(
  'Subject'
)
  ),
  'Check'
)

That is: in contain you simply name the nearest "associates" and in
each of those you name furhter associates to return.



On Jun 12, 2:02 pm, Andreas Derksen  wrote:
> Hi, im currently developing a checklist application witch has the following 
> Models and relations:
> Checklist belongsTo Product
> Checklist hasMany Check
> Product HABTM Module
> Module hasMany Subjects
> Subject belongsTo Module
> So, what i want to do now is to generate tables like this:Checklist ID 
> 2Module 1Subject 1Subject 2Subject 3Subject 4Module 2Subject 1Subject 
> 2Subject 3Subject 4
> I tried to query it like this:
> $this->Checklist->find('first', array('contain' => array(
>                                                              'Product' => 
> array('conditions' => array('Product.id' => $productId)),
>                                                          'Check' )));
> the result is:Array ( [Checklist] => Array ( [id] => 1 [product_id] => 1 ) 
> [Product] => Array ( [id] => 1 [name] => Product1 ) [Check] => Array ( [0] => 
> Array ( [id] => 1 [check] => true [checklist_id] => 1 [subject_id] => 1 ) ) 
> )Now I need the Product array recursive, means: the associated Module(s) and 
> the Subject(s) associated to the Module(s).
> A $this->Checklist->find('first', array('recursive' => 2, 'conditions' => 
> array('id' => $checklistId))); returns everything I need, ... and more. thats 
> the problem.
> How can I do that?
> Thanks in advance
> Andreas
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



500 Internal Server Error

2009-06-12 Thread Dave Maharaj :: WidePixels.com

Now for some unknown reason I am getting 500 Internal Server Error and can
not access any part of the site.

I have other  sites on the server and they are still running fine so that's
not the problem

It's a site that has been in the works for a while and is close to being
finished. 
- Htaccess has not been changed in months
- no database changes


- was building the jquery image upload and crop following the bakery
tutorial and was working then everything stopped working...entire site 500
error
-removed all changes to the controller where i was adding the image upload,
components, helpers
- deleted cache, sessions

Checked apache logs: no fatal errors reported

Deleted entire site...put blank html page there and that loads fine...

Re uploaded app
cake
 
And it works again for a few run thru's then back to 500 error.

Ideas why this would happen? 
What else to check?

Dave 


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



RE: Relationship question

2009-06-12 Thread Dave Maharaj :: WidePixels.com

Right on.

Thanks for your help.

Much appreciated.

Dave 

-Original Message-
From: John Andersen [mailto:j.andersen...@gmail.com] 
Sent: June-12-09 3:27 AM
To: CakePHP
Subject: Re: Relationship question


Investors
- id
...

Posts
- id
- investor_id (mandatory)
- employee_id (optional)
...

Employees
- id
- investor_id (mandatory)
...

That's all, no post_id in employees! The belongsTo definition in the Post
model, does not require a foreign key in the Employee model! :) The Investor
/ Post relationship is a master / detail relationship.
The same goes for the Employee / Post relationship, except that it is not
mandatory!
   John

On Jun 11, 5:03 pm, "Dave Maharaj :: WidePixels.com"
 wrote:
> Right.
>
> Thanks for that.
>
> So to make this work with the relations you out lined below if I add 
> employee_id to the posts table , creates employees tables with 
> investor_id post_id that should do it for db changes? Add the 
> employees controller/model and add the relationshis to the other models
Investor / Posts.
>
> Thanks again.
>
> Dave
[snip]


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



Containable recursive find problem

2009-06-12 Thread Andreas Derksen





Hi, im currently developing a checklist application witch has the
following Models and relations:

Checklist belongsTo Product
Checklist hasMany Check
Product HABTM Module
Module hasMany Subjects
Subject belongsTo Module

So, what i want to do now is to generate tables like this:

Checklist ID 2

  

  Module 1
  


  Subject 1
  


  Subject 2
  


  Subject 3 
  


  Subject 4
  

  



  

  Module 2
  


  Subject 1
  


  Subject 2
  


  Subject 3 
  


  Subject 4
  

  


I tried to query it like this: 
$this->Checklist->find('first', array('contain' => array(
                                                             'Product'
=> array('conditions' => array('Product.id' => $productId)),
                                                         'Check'
)));

the result is:

Array
(
[Checklist] => Array
(
[id] => 1
[product_id] => 1
)

[Product] => Array
(
[id] => 1
[name] => Product1
)

[Check] => Array
(
[0] => Array
(
[id] => 1
[check] => true
[checklist_id] => 1
[subject_id] => 1
)

)

)

Now I need the Product array recursive, means: the associated Module(s)
and the Subject(s) associated to the Module(s).

A $this->Checklist->find('first', array('recursive' => 2,
'conditions' => array('id' => $checklistId))); returns everything
I need, ... and more. thats the problem.

How can I do that?

Thanks in advance
Andreas


--~--~-~--~~~---~--~~
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: Big difference between CakePHP and Joomla

2009-06-12 Thread bbparis

Hello,

I appreciate your answers, let me ask a question to make the things
more clear, for me sure.

if I want to build for example let we say an eCard system with Cake,
it will be a combine of CakePHP's scripts to build this system ( like
we combine many pages in 1 page )
or I have to have high level of programming knowledge to build this
eCard system??

I'm learning now CakePHP with phpvideotutorials.com, because I prefer
to learn by video, anyway, during this learning lessons, I saw a lot
of DOS or Lunix commands to manage database
and I understand that you type a command to ask CakePHP to build you a
POST script for example, so in this case everything is build in
CakePHP non ???

Simply, do I need to everything about PHP to build a system with
CakePHP, or just have a good idea about PHP and than I will be able to
build my system with Cake ??




--~--~-~--~~~---~--~~
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: Model + 2x behaviors = headache :(

2009-06-12 Thread Dr. Loboto

What do you see in OrderModel::beforeValidate() do not prove anything
in this case. State of $this->data in OrderModel::beforeSave() have
sense. Validation and beforeValidate calls can even operate on copy of
data.

On Jun 11, 3:42 pm, Ernesto  wrote:
> that's not correct.
>
> a pr in model::beforeValidate shows the "Code" field.
>
> the data array seems to be resetted at every behavior call
>
> On 11 Giu, 10:13, "Dr. Loboto"  wrote:
>
>
>
> > I don't know why, but model data modification is possible only in
> > beforeSave method (at least in model itself) but your AutoCodeBehavior
> > try to do it in beforeValidate method.
>
> > On Jun 11, 2:38 pm, Ernesto  wrote:
>
> > > bump!!!
>
> > > On 9 Giu, 16:20, Ernesto  wrote:
>
> > > > here's some pr output.
>
> > > > @@@ AutoCodeBehavior @@@
>
> > > > $model->data @ AutoCode::beforeValidate (begin of function)
> > > > Note: this is the original data array returned by the view
>
> > > > Array
> > > > (
> > > >     [Order] => Array
> > > >         (
> > > >             [customer_id] => 30
> > > >             [ref] => T
> > > >         )
> > > > )
>
> > > > $model->data @ AutoCode::beforeValidate (end of function)
> > > > Note: the "Code" field is successfully added to model data array
>
> > > > Array
> > > > (
> > > >     [Order] => Array
> > > >         (
> > > >             [customer_id] => 30
> > > >             [ref] => T
> > > >             [Code] => 20090609
> > > >         )
> > > > )
>
> > > > @@@ AutoDateBehavior @@@
>
> > > > $model->data @ AutoDate::beforeSave (begin of function)
> > > > Note: the $model->data array is equal to the original one, "Code"
> > > > field is magically disappeared, maybe Cake passes the original data
> > > > array and not the modified one to every behavior?
>
> > > > Array
> > > > (
> > > >     [Order] => Array
> > > >         (
> > > >             [customer_id] => 30
> > > >             [ref] => T
> > > >         )
> > > > )
>
> > > > $model->data @ AutoDate::beforeSave (end of function)
> > > > Note: field "EstimatedDeliveryDate" is successfully added
>
> > > > Array
> > > > (
> > > >     [Order] => Array
> > > >         (
> > > >             [customer_id] => 30
> > > >             [ref] => T
> > > >             [EstimatedDeliveryDate] => 2009-06-09
> > > >         )
> > > > )
>
> > > > @@@ Model @@@
>
> > > > $this->data @ model::beforeSave
> > > > Note: there's only "EstimatedDeliveryDate" field in data array. It
> > > > seems like the first behavior didn't work at all
>
> > > > Array
> > > > (
> > > >     [Order] => Array
> > > >         (
> > > >             [customer_id] => 30
> > > >             [ref] => T
> > > >             [EstimatedDeliveryDate] => 2009-06-09
> > > >         )
> > > > )
>
> > > > On 9 Giu, 15:52, Ernesto  wrote:
>
> > > > > here's my code.
>
> > > > > i removed all the comments.
>
> > > > > class OrderModel extends AppModel {
>
> > > > >         var $actsAs = array("AutoCode", "AutoDate");
>
> > > > >         var $validate = array(
> > > > >                 "Code" => array(
> > > > >                         "unique" => array(
> > > > >                                 "rule" => "isUnique",
> > > > >                                 "allowEmpty" => false,
> > > > >                                 "on" => "create"
> > > > >                         )
> > > > >                 ),
> > > > >         )
>
> > > > > }
>
> > > > > class AutoCodeBehavior extends ModelBehavior {
>
> > > > >         function beforeValidate (&$model) {
>
> > > > >                 $model->data[$model->alias]["Code"] = date("Ymd");
>
> > > > >                 return true;
>
> > > > >         }
>
> > > > > }
>
> > > > > class AutoDateBehavior extends ModelBehavior {
>
> > > > >         function beforeSave (&$model) {
>
> > > > >                 $model->data[$model->alias]["EstimatedDeliveryDate"] =
> > > > > date("Y-m-d");
>
> > > > >                 return true;
>
> > > > >         }
>
> > > > > }
>
> > > > > On 9 Giu, 15:04, Rob Conner  wrote:
>
> > > > > > You probably should paste code, your "in theory" based on code you
> > > > > > told us your wrote is correct. But that doesn't solve the problem. 
> > > > > > So
> > > > > > there must be some error in your code.
--~--~-~--~~~---~--~~
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: How to model a web host app?

2009-06-12 Thread Martin Westin

Sure,
full domains is just a matter of modifying the way you "find" the
correct config. Come to think of it, the code at the bakery does that
already. It is the very simplest, most generic way of doing it. I have
variations where it checks the root domain and only allows sub-
domains. It then throws a special error if the wrong root domain  is
used. (since this is usually a hacking attempt or serious problem with
the webserver)

$bootstrap = CONFIGS .'domains'.DS.$_SERVER['SERVER_NAME'].'.php';
$bootstrap will point to filenames like "example.com.php",
mail.google.com.php or anything you care to set in your vhost.



On Jun 12, 7:02 am, "milesrichard...@gmail.com"
 wrote:
> Thanks. I had seen that before but I am just now beginning to see how
> it will fit. Is it possible to do something like that with full
> domains rather than simply subdomains?
>
> Miles
>
> On Jun 11, 1:42 am, Steve  wrote:
>
>
>
> > You may want to check out this article in the 
> > bakery:http://bakery.cakephp.org/articles/view/one-core-one-app-multiple-dom...
>
> > It may not do it exactly that way you want to, but it should give you
> > an idea on accomplishing some of the things you want to do.
--~--~-~--~~~---~--~~
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: Big difference between CakePHP and Joomla

2009-06-12 Thread sbutch

I suggest frontend in Joomla,  bakend  in cakePHP.

On Jun 11, 10:40 pm, James K  wrote:
> Joomla is a CMS application built on a custom framework.
>
> CakePHP is just a framework - no application.
>
> - James
>
> On Jun 11, 4:56 am, bbparis  wrote:
>
> > Hi,
>
> > I'm now to CakePHP, I like to build a website for kids, an education
> > and interactive interface, something like (www.cghub.com), I would
> > like to offer for kids many education / intelligent services to learn
> > and have fun in the same time  ... so I began with learning CakePHP,
> > and I know already Joomla, my principal question to begin this
> > discussion with you is ( What is the big difference between CakePHP
> > and Joomla  ? )
>
> > I'm not expert with php, I'm still learning, you can check the
> > following link to have an idea about my level :
>
> >http://www.beginfromhere.com
>
> > also some nice php developers helped me in this way.
>
> > Best regards for all, and I hope I will have your answer, opinions,
> > comments soon.
>
> > Best regards,
> > bbparis
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---