Re: Custom URLs

2007-05-17 Thread Alain Martini

Hello,

I found this solution really smart, now I am trying to redirect the
browser to the proper language (or a fallback language)
How can I handle that? I need that when a user comes to mysite.org
should be automatically redirected to mysite.org/en/ or mysite.org/de/
etc.
Not a problem for me to find what is the proper user locale, but I
have problems to make a redirection.
First of all, where is the right place to put the redirection?
bootstrap.php? app_controller.php?

Any clue?

Thank you :-)


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



Re: routing problem after upgrade

2007-04-12 Thread Alain Martini


>  $Route->connect('/artists/view/*', array('controller' => 'artists',
> 'action' => 'view', 'artists', 'Artists'));
>  $Route->connect('/artists/*', array('controller' => 'artists',
> 'action' => 'index', 'artists', 'Artists'));


Just found the bug :-)


seems that in the past releases calling myapp.org/artists/type4
overwrite the array with "type4". on the latests releases the passed
array
overwrite the parameter passed via GET

index ($type=null)
{


}

so the solution was simple: remove the 2 exceeding declarations on the
array:

$Route->connect('/artists/view/*', array('controller' => 'artists',
'action' => 'view'));
$Route->connect('/artists/*', array('controller' => 'artists',
'action' => 'index'));


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



routing problem after upgrade

2007-04-12 Thread Alain Martini

Hello,
I have upgraded cake to the latest stable and I have some problems
with routing.

I need to call a route that report a list of types.

myapp.org/artists/type1
myapp.org/artists/type3
myapp.org/artists/type6

and when i call "view" i need to see the single artist by id

myapp.org/artists/view/id

on routes.php i have

 $Route->connect('/artists/view/*', array('controller' => 'artists',
'action' => 'view', 'artists', 'Artists'));
 $Route->connect('/artists/*', array('controller' => 'artists',
'action' => 'index', 'artists', 'Artists'));

and this worked until the upgrade.


in the controller i have

index ($type=null)
{
//before the upgrade when calling myapp.org/artists/type6 the $type
variable contained "type6"
// after the upgrade $type variable contains "artists"
}


Before the upgrade when i called myapp.org/artists/view/6 showed me
the proper action via the view($id=null) function in the controller.
After the upgrade  myapp.org/artists/view/6 just rewrite the url to
myapp.org/artists/index

Any idea of what happens?


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



File download authorization

2007-03-07 Thread Alain Martini

Hello,
I have created a site that works with the oth authentication. I have a
"media" directory that contains medias that only authenticated users
should download.
I have created a controller wich read the directory (through the
"Folder" class) and a view that publish the file contents.
Now, how can i limit the download to the authenticated users only?

Security by hiding the files is no security.
If i put an .htaccess in the media directoy can stop the downloads but
for everyone. And i dont want to add an extra .htaccess login
mechanism.

Maybe someone has already solved that problem and can point me in the
right direction :-)


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



Re: form validation problem

2007-01-17 Thread Alain Martini


Well, i have solved :-)
I have to use:

var $uses = array('Contact');
instead of 
var $uses =null;



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



form validation problem

2007-01-17 Thread Alain Martini


hello,

Here is a real newbie question :-)
i have created a model to do some validation on a simple form without a
db attached.

VALID_EMAIL,
'name'=>VALID_NOT_EMPTY,
'content'=>VALID_NOT_EMPTY
);
var $useTable = false; //no db!
}
?>

i read that i have to use "validates" instead of "save" to perform
validation if i dont have a db attached.
in my controller i need to do something like

render("index","mylayout");
}


function send() {

if ($this->Contact->validates($this->data))
 {
//do something, sanitize, etc.
$this->render("index","mylayout");
 }
 else
 {
// validate errors

$this->set('userMessage',"Error!");
 $this->render("index","myerrorlayout");
 }
}
}
?>


but i get this error:

Notice: Undefined property: ContactsController::$Contact
Fatal error: Call to a member function validates() on a non-object

I am missing something?

There is somewere a snippet with a really simple form validation (w/o
database?)


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