Monday, August 31, 2009

Re: Has anyone had success using Ext JS 2.2.2 and a grouping grid?

Hey Frederik

check out the replies I gave you on the blog post ... grouping is
quite easy actually, all you need to do is change the datastore into a
GroupingStore and give it a groupField (ie. what field to group by).
Ext will take care of the rest ...

wirtsi

On 30 Aug., 07:00, FrederickD <manzanillo.engl...@gmail.com> wrote:
> I am trying to make my HTML tables look a little prettier using Ext
> JS. I would like to take a simple HTML table that lists users and the
> corresponding group name and produce a grouping grid in Ext JS.
>
> There is a javascript file named from-html.js in the examples folder
> of Ext JS. I have been using that to read the HTML from Cake and
> transform it into a pretty simple grid. (Yes... I know having HTML
> translated by javascript is not the future. The direction the CakeXT
> project is going with JSON objects is better, but the grouping
> functionality is not yet included...)
>
> Simple grids work great, except for the pagination part. That will be
> a separate post. It may be possible to use the Ext.data.GroupingStore
> function, but I am having trouble with the syntax for the 'sortinfo'
> and 'grouping'. Here is what I have so far:
>
>     var ds = new Ext.data.GroupingStore({        // Create data
> grouping
>                 reader: new Ext.data.XmlReader({
>                         record:'tbody tr'},
>                         fields),
> //                 sortInfo: {field: 'username', direction: "ASC"},
> //                 groupField:    'group_name'
>     });
>
> With the two lines commented, I get a simple data grid. With the two
> lines not comments I only get an HTML table.
>
> Does anyone have any experience with this part of Ext JS so that I can
> reference these fields? A more complete code example can be found athttp://extjs.com/forum/showthread.php?t=78141. So far no answers from
> that forum... I'm hoping somebody here can help me. Please.
>
> Thank you.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Default routing - methods naming convention problem

Not very positive, but you would have to edit the core cake files,
which you should never do.

So you either have to deal with the someAction URL or just deal with
writing it as some_action.

Someone clarify if I am wrong.

On Aug 31, 10:52 pm, Raph <ra...@epoczta.pl> wrote:
> Yes - I know. But I would like it to be "/some_controller/some_action"
> without changing methods names.
>
> On 1 Wrz, 02:08, Miles J <mileswjohn...@gmail.com> wrote:
>
> > Your URL would simply be /some_controller/someAction/.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Default routing - methods naming convention problem

Yes - I know. But I would like it to be "/some_controller/some_action"
without changing methods names.

On 1 Wrz, 02:08, Miles J <mileswjohn...@gmail.com> wrote:
> Your URL would simply be /some_controller/someAction/.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

render View/Element From Shell

Hi,
I've an app generating reports in xls/pdf/html. I want to add new
feature so that user can create those reports in background (scheduled
by cron). I plan to use shell but need to re-use the same View/Element
I've made earlier. Is there any way to do it?

Thanks 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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Welcome Page not finding CSS/Images

I did an install of CakePHP on my local device (Windows XP) with an
Apache server. I did the install to the letter as far as I can tell
(removed comment in front of mod_rewrite's load module statement), but
I'm getting a welcome page with no layout. And it seems like the whole
page isn't even showing up.

The thing that bugs me the most is that I uploaded the same exact
files up to my bluehost account and got the right welcome page. So
it's got to be something with my server setup but I can't figure it
out. Any help would be much appreciated.

This is all that showed up in the page source:

<h2>Release Notes for CakePHP 1.2.4.8284.</h2>
<a href="https://trac.cakephp.org/wiki/changelog/1.2.x.x">Read the
changelog </a>
<p>
<span class="notice success">Your tmp directory is writable.</span></
p>
<p>
<span class="notice success">The <em>FileEngine</em> is being used
for caching. To change the config edit APP/config/core.php </span></
p>
<p>
<span class="notice success">Your database configuration file is
present.</span></p>

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Problem with hasMany

The only things that look odd are 'Prioridad' (should be lowercase?)
and 'order'=>'ORDER BY RAND()'. I think that should be just
'order'=>'RAND()', but I could be wrong.

Looking at line 21 of 8166, there are 2 properties that it may be
failing on. I'd add these lines just above 921:

die(debug($this->alias));
die(debug($this->{$model}));

Run it once, then comment the 1st line. See if that shows anything helpful.

On Mon, Aug 31, 2009 at 4:18 PM, logislack<jhackes@gmail.com> wrote:
>
> I have a problem with a hasMany relationship. Locally everything works
> fine, but when I upload files to the server I get the following error
>
> Fatal error: Cannot access empty property in /sitiotmp/www2/nuevositio/
> cake/libs/model/model.php on line 921
>
> I'm using cake 1.2.3.8166
>
> My models with de problem:
>
> <?php
> class Grupos_de_contenido extends AppModel{
>   var $name = 'Grupos_de_contenido';
>   var $primaryKey = 'id';
>   var $displayField = 'nombre';
>
>   var $hasMany = array('Contenido'=> array('className'=>'Contenido',
>
> 'foreignKey'=>'id_grupo_contenido',
>
> 'order'=>'Contenido.Prioridad DESC, Contenido.titulo ASC',
>
> 'conditions'=>'Contenido.publicado = true'
>                                           ));
> }
> ?>
> ---------
> <?php
>   class Encuesta extends AppModel {
>       var $name = 'Encuesta';
>       var $tableName = 'encuestas';
>
>       var $hasMany = array('Respuesta'=>array
> ('className'=>'Respuesta', 'foreignKey'=>'id_encuesta'));
>
>       function obtenerEncuesta($id = null) {
>           $cond = array();
>           if(!is_null($id))
>               $cond = array('Encuesta.id' => $id);
>
>           return $this->find('first', array('contidions'=>$cond,
> 'order'=>'ORDER BY RAND()'));
>       }
>   }
> ?>
>
> help?
> 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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Problem getting associations to work

The model file names should be singular -- client.php, contact.php.

On Mon, Aug 31, 2009 at 4:09 PM, mdrisser<mdrisser@gmail.com> wrote:
>
> Hi all, I am officially completely stumped. I cannot seem to get
> associations to work at all, here is my code:
>
> clients table
> mysql> DESCRIBE clients;
> +-----------+--------------+------+-----+---------+-------+
> | Field     | Type         | Null | Key | Default | Extra |
> +-----------+--------------+------+-----+---------+-------+
> | id        | int(11)      | NO   | PRI | NULL    |       |
> | name      | varchar(50)  | NO   |     | NULL    |       |
> | address_1 | varchar(100) | NO   |     | NULL    |       |
> | address_2 | varchar(100) | NO   |     | NULL    |       |
> | city      | varchar(40)  | NO   |     | NULL    |       |
> | state     | varchar(10)  | NO   |     | NULL    |       |
> | postal    | varchar(10)  | NO   |     | NULL    |       |
> | country   | char(2)      | NO   |     | NULL    |       |
> | phone     | varchar(10)  | NO   |     | NULL    |       |
> | fax       | varchar(10)  | NO   |     | NULL    |       |
> | url       | varchar(80)  | NO   |     | NULL    |       |
> +-----------+--------------+------+-----+---------+-------+
>
> contacts_table
> mysql> DESCRIBE contacts;
> +------------+-------------+------+-----+---------+----------------+
> | Field      | Type        | Null | Key | Default | Extra          |
> +------------+-------------+------+-----+---------+----------------+
> | id         | int(11)     | NO   | PRI | NULL    | auto_increment |
> | first_name | varchar(20) | NO   |     | NULL    |                |
> | last_name  | varchar(20) | NO   |     | NULL    |                |
> | email      | varchar(40) | NO   |     | NULL    |                |
> | phone      | varchar(20) | NO   |     | NULL    |                |
> | cell_phone | varchar(20) | NO   |     | NULL    |                |
> | fax        | varchar(20) | NO   |     | NULL    |                |
> | client_id  | int(11)     | NO   |     | NULL    |                |
> +------------+-------------+------+-----+---------+----------------+
>
> contacts.php
> <?php
>
> class Contact extends AppModel {
>        var $name = 'Contact';
>        var $belongsTo = 'Client';
> }
> ?>
>
> contacts_controller.php
> <?php
> class ContactsController extends AppController {
>        var $name = 'Contacts';
>        public $view = 'Theme';
>        public $theme = 'default';
>        public $helpers = array('Form', 'Html', 'Javascript', 'Time');
>
>        public function index() {
>                $this->set('contacts', $this->Contact->find('all'));
>        }
> }
> ?>
>
> clients.php
> <?php
>
> class Client extends AppModel {
>        var $name = 'Client';
>        var $hasMany = 'Contact';
> }
> ?>
>
> clients_controller.php
> <?php
>
> class ClientsController extends AppController {
>        var $name = 'Clients';
>        public $view = 'Theme';
>        public $theme = 'default';
>        public $helpers = array('Form', 'Html', 'Javascript', 'Time');
>
>        public function index() {
>                $this->set('clients', $this->Client->find('all'));
>        }
> }
> ?>
>
> My understanding is that all of the above should result in both the
> clients table and the contacts table being queried, however, this does
> not appear to be the case. print_r() on the result in the contacts
> controller produces:
>
> Array ( [Contact] => Array ( [id] => 1 [first_name] => John
> [last_name] => Doe [email] => someone@somewhere.net [phone] =>
> 7605555555 [cell_phone] => 765551234 [fax] => [client_id] => 0 ) )
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Validate UK postcode without a space in it

What I meant was that perhaps an enhancement ticket should be opened
to have the core changed.

On Mon, Aug 31, 2009 at 4:54 PM, Aivaras<faifas1337@gmail.com> wrote:
> Or just create a custom validation rule, where you can add your own regexp -
> remember, that not changing the core will always be so helpful sooner or
> later ;)
>
> Faifas
> http://www.voveris.eu/
>
>
> On Mon, Aug 31, 2009 at 18:58, brian <bally.zijn@gmail.com> wrote:
>>
>> It looks like the Validation regex needs to be updated. This:
>>
>> $_this->regex = '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]?
>> [0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i';
>>
>> should be:
>>
>> $_this->regex =
>> '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]?[\s]?[0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i';
>>
>> Ditto for the Canadian one.
>>
>> On Mon, Aug 31, 2009 at 6:45 AM,
>> channel5<edd.dawson@comptonsolutions.com> wrote:
>> >
>> > Hi
>> >
>> > I've got a model that uses
>> >
>> > 'rule'=>array('postal',null,'uk')
>> >
>> > to successfully validate UK postcodes.
>> >
>> > However testing has shown that many people enter their postcodes in
>> > forms without using the space, so:
>> >
>> > W1W 5QU  <-- validates
>> > W1W5QU  <-- does not validate
>> >
>> > Has anyone got any tips on getting the validation to work irrespective
>> > of whether a user includes or excludes the space?
>> >
>> > Thanks
>> > c5
>> > >
>> >
>>
>>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Default routing - methods naming convention problem

Your URL would simply be /some_controller/someAction/.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Cake dies silently in case of fatal or parser error

found it, i've added ~E_DEPRECATED for php5.3 and then switched back
to 5.2, this was the root of the problem

On Aug 31, 8:06 pm, brian <bally.z...@gmail.com> wrote:
> Set debug = 2. Also, use:
>
> error_reporting(E_ALL);
> ini_set('display_errors', '1');
>
> ... in order to have PHP show something in the browser. If you can,
> check Apache's error log.
>
> On Mon, Aug 31, 2009 at 8:16 AM, XuMiX<v.tambovt...@gmail.com> wrote:
>
> > Unable to find the root of the problem. My cake install does not show
> > any errors to browser in case of critical error.
> > But errors from DB queries are shown as usual. Where should I dig?
> > Php logging is enabled, those fatal errors are not logged even in the
> > log file.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Cake dies silently in case of fatal or parser error

this is all done
all logs are empty, only Notice: Use of undefined constant
E_DEPRECATED - assumed 'E_DEPRECATED' in /var/www/nginx-default/cake/
libs/configure.php on line 295
is hown even if there is a fatal error after that

On Aug 31, 8:06 pm, brian <bally.z...@gmail.com> wrote:
> Set debug = 2. Also, use:
>
> error_reporting(E_ALL);
> ini_set('display_errors', '1');
>
> ... in order to have PHP show something in the browser. If you can,
> check Apache's error log.
>
> On Mon, Aug 31, 2009 at 8:16 AM, XuMiX<v.tambovt...@gmail.com> wrote:
>
> > Unable to find the root of the problem. My cake install does not show
> > any errors to browser in case of critical error.
> > But errors from DB queries are shown as usual. Where should I dig?
> > Php logging is enabled, those fatal errors are not logged even in the
> > log file.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: change route after authroize users

> oh, I get what you mean. You want to display different content for loggen in
> and guest users.
>
> You know, it's so hard to do that, but the key to cakePHP is that you
> actually need to think simple. I mean not programmer's simple, but - simple.
>
> What I did is I used a different layout!

good trick !
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Default routing - methods naming convention problem

I would like to urls in my app were look like "/some_controller/
some_action". The problem is I use camel-case methods naming
conventions, so I would have class "SomeControllerController" with
method "someAction()". Actually I like this convention and I don't
want to change it. In this case "/some_controller/some_action" won't
work, because Cake it's going to seek "some_action()" method.
How can I do this the way I want to?

I think there is a mistake in docs. Look at
http://book.cakephp.org/view/46/Routes-Configuration#Default-Routing-540
- it says (...)"and /products/view_clearance maps to the viewClearance
() action"(..) but It dosen't work.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Using Cake models from non-cake project

Hello Martin,

Thank you for the answer, indeed that approach worked brilliantly.

$app = new App();

On Aug 31, 10:04 am, Martin Westin <martin.westin...@gmail.com> wrote:
> It really is as simple as Felix writes. It is just that his post is
> from 2006 and a few details have changed.
>
> I just tried this on 1.2 stable and it does work:
>
> $_GET['url'] = 'favicon.ico';
> require_once('path_to_app_dir'.DS.'webroot'.DS.'index.php');
> // and then for example:
> $PostModel =& ClassRegistry::init('Post');
> print_r( $PostModel->find('all') );
>
> Notice:
> That it is called DS now unless you use your own slashes in paths.
> That your best option for brining a model to life is ClassRegistry.
> You wil need to have a real Cake app to point to. It needs database
> configs and (naturally) the models defined.
>
> /Martin
>
> On Aug 30, 6:38 pm, tbirand <tbir...@gmail.com> wrote:
>
> > Hi Thiago, thanks for the answer. Unfortunately I don't think that
> > works either, as the shells aren't really external scripts and I don't
> > see a way of including them in order to make use of the models. Any
> > other suggestions?
>
> > On Aug 29, 9:06 pm, Thiago Nuic Vidigal <tvidi...@gmail.com> wrote:
>
> > > I dont know if it will do what you want, but you can create your own cake
> > > shell as described i the book...
>
> > > On Sat, Aug 29, 2009 at 1:25 PM, tbirand <tbir...@gmail.com> wrote:
>
> > > > Hello all,
>
> > > > I've just started working with CakePHP a few days ago, and I really
> > > > like it. I develop Ruby on Rails apps as well, but having a similar
> > > > approach under PHP is most welcome since most of my clients have PHP
> > > > enabled hosts and I'm a bit more familiar with the language.
>
> > > > That being said, I've a question that I couldn't find an answer to so
> > > > far; is there any way to use the models in my cake application from an
> > > > outside non-cake php script? This is possible with Rails, I'm sure it
> > > > can be done here as well but after searching for a few hours I thought
> > > > I'd post here. Anyone have an idea? (I've already tried the technique
> > > > describet at
> > > >http://debuggable.com/posts/the-ultimate-cakephp-bootstrap-technique:...
> > > > to no avail.) I need to do this so I can use some newer db tables and
> > > > their respective models in a legacy php application until I have the
> > > > time to completely rewrite it.
>
> > > > Thanks in advance,
>
> > > > T.J.
>
>
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: CakePHP + PHP5.3 = ?

Coffee, and very understanding girlfriends/boyfriends/husbands/
wives ;-).

On Aug 31, 12:08 pm, d <mil...@gmail.com> wrote:
> how do you guys find the time? seriously. you people are awesome.
>
> On Aug 31, 7:19 am, jperras <joel.per...@gmail.com> wrote:
>
> > Alright guys, it seems like you're all a bit confused.
>
> > If you only read one line of this entire post, read this: CakePHP 1.3 !
> > = Cake3
>
> > Now, while this may seem obvious to many, you guys have made the same
> > mistake that I've seen a few times on the #cakephp channel. The first
> > is a branch in the cakephp 1.x project, and the last is a completely
> > different beast altogether.
>
> > CakePHP 1.2 supports PHP4 and PHP5.2, inclusively. PHP 5.3 introduced
> > a few changes to the error handler flags, which we have accounted for
> > in CakePHP 1.3-dev and will be accounting for in all subsequent
> > releases.
>
> > The reason we are not including PHP 5.3 compatibility in CakePHP 1.2.x
> > is that we want people to move forward to CakePHP 1.3 & up when they
> > become stable. If you're willing to update the php *language* to a new
> > point release and not willing to update your application to a new
> > framework point release, I think you have a slight disconnect. If you
> > want, you could always apply the patches that we have committed to 1.3-
> > dev to a local git branch, and continue on your merry way by merging
> > in upstream changes from 1.2.x into your local branch.
>
> > CakePHP 1.2.x and 1.3.x are in *the same project*, athttp://code.cakephp.org/cakephp
> > . 1.2 and 1.3-dev are simply different branches.
>
> > CakePHP 2.0, a *different project*, is *also* being worked on, which
> > will be PHP 5.2 and up *only*, meaning we're dropping support for
> > PHP4. Seehttp://code.cakephp.org/cakephp2tofollow along the
> > development of this project. The goal of this release is to be a
> > nearly transparent upgrade for anyone running CakePHP 1.3 stable
> > (whenever that is released), meaning that the two should be pretty
> > much 100% API compatible.
>
> > Finally Cake3 is a *different project*, found athttp://code.cakephp.org/cake3.
> > This is an experimental project which is a complete rewrite of the
> > CakePHP framework from the ground up, and will *only* support PHP 5.3
> > and up.
>
> > I hope this clears up some of the confusion.
> > -jperras.
>
> > On Aug 30, 2:45 pm, Miles J <mileswjohn...@gmail.com> wrote:
>
> > > Yeah im pretty positive it wont be interchangeable. It uses a whole
> > > new model setup and also uses namespaces.
>
> > > The most you can do is interchange between 1.3/2.0.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Logfile location

Yep, indeed, symlink would be an elegant solution!

On Mon, Aug 31, 2009 at 22:52, Aivaras <faifas1337@gmail.com> wrote:
indeed, defining it is so simple! On the other hand you can still create a symlink from /var/www/app_name/logs/ to app_path/tmp/logs.

I bet that will work like a charm if you have +Options FollowSymlinksOnOwnerMatch also ;)

Faifas
http://www.voveris.eu/



On Mon, Aug 31, 2009 at 23:16, Crazy <crazytje@gmail.com> wrote:

Thanks, that's just what I was looking for.

I'll just define the TMP, to /var/<app>/


On Aug 31, 4:12 pm, Kornelije Sajler <xaj...@gmail.com> wrote:
> There is a LOGS constant for Paths in CakePHP. You can find it in your
> cake_1.2.4.8284/cake/config/paths.php default is:
> define('LOGS', TMP.'logs'.DS);
>
> TMP = if (!defined('TMP')) {
> define('TMP', APP.'tmp'.DS);}
>
> DS = define('DS', DIRECTORY_SEPARATOR);
> I wouldn't change that!
>
> So you have two choices to move all your tmp CakePHP files (sessions, logs,
> cache,..) to wherever you are by changing TMP path or you can only adjust
> the LOGS path.
>
> There is probably nicer way to change TMP dir (since have if
> (!defined('TMP'))) but I don't know where could be defined!
>
> Hope it helps!
>
> Kornelije Sajler
>
> On Mon, Aug 31, 2009 at 15:40, Crazy <crazy...@gmail.com> wrote:
>
> > Hi,
>
> > In one of my projects it's required that the log files are being
> > logged to /var/logs/<appname>
>
> > I was wondering if it was possible to change the default location of
> > app/tmp/logs?






--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Validate UK postcode without a space in it

Or just create a custom validation rule, where you can add your own regexp - remember, that not changing the core will always be so helpful sooner or later ;)

Faifas
http://www.voveris.eu/


On Mon, Aug 31, 2009 at 18:58, brian <bally.zijn@gmail.com> wrote:

It looks like the Validation regex needs to be updated. This:

$_this->regex = '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]?
[0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i';

should be:

$_this->regex =
'/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]?[\s]?[0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i';

Ditto for the Canadian one.

On Mon, Aug 31, 2009 at 6:45 AM,
channel5<edd.dawson@comptonsolutions.com> wrote:
>
> Hi
>
> I've got a model that uses
>
> 'rule'=>array('postal',null,'uk')
>
> to successfully validate UK postcodes.
>
> However testing has shown that many people enter their postcodes in
> forms without using the space, so:
>
> W1W 5QU  <-- validates
> W1W5QU  <-- does not validate
>
> Has anyone got any tips on getting the validation to work irrespective
> of whether a user includes or excludes the space?
>
> Thanks
> c5
> >
>




--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Logfile location

indeed, defining it is so simple! On the other hand you can still create a symlink from /var/www/app_name/logs/ to app_path/tmp/logs.

I bet that will work like a charm if you have +Options FollowSymlinksOnOwnerMatch also ;)

Faifas
http://www.voveris.eu/


On Mon, Aug 31, 2009 at 23:16, Crazy <crazytje@gmail.com> wrote:

Thanks, that's just what I was looking for.

I'll just define the TMP, to /var/<app>/


On Aug 31, 4:12 pm, Kornelije Sajler <xaj...@gmail.com> wrote:
> There is a LOGS constant for Paths in CakePHP. You can find it in your
> cake_1.2.4.8284/cake/config/paths.php default is:
> define('LOGS', TMP.'logs'.DS);
>
> TMP = if (!defined('TMP')) {
> define('TMP', APP.'tmp'.DS);}
>
> DS = define('DS', DIRECTORY_SEPARATOR);
> I wouldn't change that!
>
> So you have two choices to move all your tmp CakePHP files (sessions, logs,
> cache,..) to wherever you are by changing TMP path or you can only adjust
> the LOGS path.
>
> There is probably nicer way to change TMP dir (since have if
> (!defined('TMP'))) but I don't know where could be defined!
>
> Hope it helps!
>
> Kornelije Sajler
>
> On Mon, Aug 31, 2009 at 15:40, Crazy <crazy...@gmail.com> wrote:
>
> > Hi,
>
> > In one of my projects it's required that the log files are being
> > logged to /var/logs/<appname>
>
> > I was wondering if it was possible to change the default location of
> > app/tmp/logs?



--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: change route after authroize users

oh, I get what you mean. You want to display different content for loggen in and guest users.

You know, it's so hard to do that, but the key to cakePHP is that you actually need to think simple. I mean not programmer's simple, but - simple.

What I did is I used a different layout! Sounds crazy, but is so simple and works like a charm, trust me! What you do is create a
beforeFilter(){
    parent::beforeFilter();
    if ($this->Auth->user('role') == 'member'){
        $this->layout = 'loggedin';
    }
}

in controllers you require a diff content. In the different layout serve different elements and they'll do the job for you also (Y).

Let me know if you find this handy,
Faifas
http://voveris.eu/


On Mon, Aug 31, 2009 at 17:53, AgBorkowski <andrzejborkowski@gmail.com> wrote:

i know that but i want change general route '/' so yes your trick
witch redirect working after user did login but after even go to /
load default general route from /

but i'll try user Route::conntect in login() :)

On 31 Sie, 10:32, Aivaras <faifas1...@gmail.com> wrote:
> Hey,
>
> did you take a look at thishttp://book.cakephp.org/view/391/loginAction?
>
> Faifas
>
> On Mon, Aug 31, 2009 at 11:05, andrzejborkow...@gmail.com <
>
>
>
> andrzejborkow...@gmail.com> wrote:
>
> > i want to change default route after login my users, i try like this:
>
> > [/project/app_controller.php]
> > public function beforeFilter() {
> > (...)
> >        if($this->Auth->user()){
> >                Router::connect('/', array('controller' => 'users', 'action'
> > => 'profile'));
> >                Router::promote();
> > }
>
> > but it dont work and still active first default route form route.php..



--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

Yay! The query works! :)

Thank you! I really appreciate your patience. :)

Thanks for your time and knowledge!

~Sarah

On Aug 30, 11:07 pm, delocalizer <conrad.leon...@hotmail.com> wrote:
> now I understand, you want associated user & animal info for all
> specified Userpages...
> so as I suggested before, do the find on Userpage model...
> but use contain to provide the associated stuff:
>
> $pages = $this->Userpage->find('all',array(
>     'conditions'=>array(
>          'or'=>array(
>              'approved'=>1,
>              'and'=>array(
>                  'Userpage.approved' => -1,
>                  'user_id' => $id
>              )
>          )
>      ),
>     'contain'=>array(
>         User=>array(
>             Animal=>array(
>                 'fields'=>array(
>                     'frontfilename'
>                  )
>             )
>         )
>     )
> ))
>
> cheers,
> C.
>
> On Aug 31, 10:42 am, Sarah <sarah.e.p.jo...@gmail.com> wrote:
>
> > I would like the results from the query to include all userpages that
> > either have an approved value of 1 or belong to the current user
> > (whose id is stored in the $id var) and have an approved value of -1.
> > Basically I want a list of all userpages that are approved for public
> > viewing or that are not approved but belong to the logged in user.  So
> > a user can see all of their userpages and only the approved userpages
> > of the other users.
>
> > I'm sorry that by use of "the user".  I did not mean specifically the
> > user stored in $id (which is not a variable used for a loop, but holds
> > the user stored in the session), I mean each author of the the
> > userpages.  So for each userpage I would like its id, its author's id,
> > and its author's frontfilename.
>
> > I hope this clarified the relationship between Userpages and Users.
>
> > Perhaps it is, sorry.  I am relatively new to both cake and mysql, so
> > I'm still trying to figure out and understand the capabilities of
> > both.
>
> > Again, thanks.  :)
> > ~Sarah
>
> > On Aug 30, 4:16 pm, delocalizer <conrad.leon...@hotmail.com> wrote:
>
> > > ok... but I'm still not sure exactly what your intent is. When you say
> > > you need information on THE user's animal - do you mean there is a
> > > particular user that you are trying to get information on, like the
> > > current requesting user? $id is a unique value in your method (ie. not
> > > a loop iterator or something)? If so, why have find('all') and
> > > 'order'=>array('User.id'=>'asc')?  Part of my confusion is that you
> > > don't have a well-defined belongsTo relationship between Userpages and
> > > Users - which user does a page with approved = 1 belongTo? But if you
> > > need only info on the user with 'id'=>$id, set 'conditions' at the
> > > User model level as well:
>
> > >                  $array = $this->User->find('first', array(
> > >                         'conditions'=>array('id'=>$id),
> > >                         'fields'=>array('id', 'animal_id'),
> > >                          'contain'=>array(
> > >                                 'Animal'=>array(
> > >                                         'fields'=>array
> > > ('frontfilename')
> > >                                 ),
> > >                                 'Userpage'=>array(
> > >                                         'conditions'=>array(
> > >                                                 'or'=>array(
>
> > > 'approved'=>1,
> > >                                                         'and'=>array(
> > > 'Userpage.approved' => -1,
> > > 'user_id' => $id
> > >                                                         )
> > >                                                 )
> > >                                         ),
> > >                                         'order'=>array(
> > >                                                 'id'=>'desc')
> > >                                         )
> > >                                 )
> > >                         )
> > >                 );
>
> > > I think this thread might be straying outside the scope of cakephp
> > > into program design details :)
>
> > > On Aug 31, 7:14 am, Sarah <sarah.e.p.jo...@gmail.com> wrote:
>
> > > > I'm performing this in the Userpages controller.  I was calling find
> > > > on Users because I need information on the user's animal.
>
> > > > User hasMany Userpages
> > > > User belongsTo Animal
> > > > The foreign keys are set up appropriately.
>
> > > > I need to get a list of all userpages in which: (Userpages.approved =
> > > > 1) OR (Userpages.approved = -1 AND User.id/user_id = $id)
>
> > > > But I want the following information: the Userpage id, the userpage
> > > > user_id, and the frontfilename from the user's animal.
>
> > > > The concept is similar to a list of comments:
> > > > I want the id and contents of the comment, I want the information on
> > > > the user, including the user's picture (in this case frontfilename
> > > > which is a column in Animal).
>
> > > > I suppose the catch is that more than one user can be the same animal
> > > > (users are in groups).
>
> > > > I've been searching everything that I can think of and searching based
> > > > off what I find.  Do you think the kind of join matters?
>
> > > > I appreciate your following up and your help.
>
> > > > Thank you,
> > > > ~Sarah
>
> > > > On Aug 30, 1:28 am, delocalizer <conrad.leon...@hotmail.com> wrote:
>
> > > > > Ah I hadn't realised you just wanted Userpages - in which case why not
> > > > > call find on Userpage?
> > > > > If you're in Users controller:
> > > > > $pages = $this->User->Userpage->find('all',array(
> > > > >     'conditions'=>array(
> > > > >          'or'=>array(
> > > > >              'approved'=>1,
> > > > >              'and'=>array(
> > > > >                  'Userpage.approved' => -1,
> > > > >                  'user_id' => $id
> > > > >              )
> > > > >          )
> > > > >      )
> > > > > ))
>
> > > > > On Aug 30, 3:21 pm, Sarah <sarah.e.p.jo...@gmail.com> wrote:
>
> > > > > > Wow, this was very cool.  Thank you for the advice.
>
> > > > > > I realized I had forgotten a condition.  So this is where I am now:
>
> > > > > >                  $array = $this->User->find('all', array(
> > > > > >                         'fields'=>array('id', 'animal_id'),
> > > > > >                         'order'=>array('User.id'=>'asc'),
> > > > > >                         'contain'=>array(
> > > > > >                                 'Animal'=>array(
> > > > > >                                         'fields'=>array
> > > > > > ('frontfilename')
> > > > > >                                 ),
> > > > > >                                 'Userpage'=>array(
> > > > > >                                         'conditions'=>array(
> > > > > >                                                 'or'=>array(
> > > > > >                                                         'approved'=>1,
> > > > > >                                                         'and'=>array(
>
> > > > > > 'Userpage.approved' => -1,
>
> > > > > > 'user_id' => $id
> > > > > >                                                         )
> > > > > >                                                 )
> > > > > >                                         ),
> > > > > >                                         'order'=>array(
> > > > > >                                                 'id'=>'desc')
> > > > > >                                         )
> > > > > >                                 )
> > > > > >                         )
> > > > > >                 );
>
> > > > > > This does not cause any errors.  :)  However, I'm not quite sure that
> > > > > > this is what I need.  To my understand based of the reading on
> > > > > > containable (and the results that I received from the query), this
> > > > > > query will return all users and only return their userpage information
> > > > > > if it matches the conditions.  I suppose I could just check each user
> > > > > > from the query to see if that user had any userpage info returned by
> > > > > > the query, but I imagine this would slow things down?
>
> > > > > > I thank you very much for your time and help.  I would appreciate any
> > > > > > advice you can give.  :)
>
> > > > > > Thanks,
> > > > > > ~Sarah
>
> > > > > > On Aug 29, 1:08 am, delocalizer <conrad.leon...@hotmail.com> wrote:
>
> > > > > > > Hi Sarah,
> > > > > > > If you have a reasonably complicated find query with associated models
> > > > > > > and conditions, the core 'Containable' behaviour is very handy:http://book.cakephp.org/view/474/Containable
> > > > > > > so in your AppModel put this (and all your models will have access to
> > > > > > > the behaviour):
> > > > > > > var $actsAs = array('Containable');
> > > > > > > then you would have for your query something like this:
> > > > > > > $array = $this->User->find('all',array(
> > > > > > >     'fields'=>array('id','animal_id'),
> > > > > > >     'order'=>array('id'=>'asc'),
> > > > > > >     'contain'=>array(
> > > > > > >          Animal=>array(
> > > > > > >             fields=>array('frontfilename')
> > > > > > >          ),
> > > > > > >          Userpage=>array(
> > > > > > >             'conditions'=>array(
> > > > > > >                 'approved' => '1'
> > > > > > >             ),
> > > > > > >             'order'=>array(
> > > > > > >                 'id'=>'desc')
> > > > > > >          )
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Problem with hasMany

I have a problem with a hasMany relationship. Locally everything works
fine, but when I upload files to the server I get the following error

Fatal error: Cannot access empty property in /sitiotmp/www2/nuevositio/
cake/libs/model/model.php on line 921

I'm using cake 1.2.3.8166

My models with de problem:

<?php
class Grupos_de_contenido extends AppModel{
var $name = 'Grupos_de_contenido';
var $primaryKey = 'id';
var $displayField = 'nombre';

var $hasMany = array('Contenido'=> array('className'=>'Contenido',

'foreignKey'=>'id_grupo_contenido',

'order'=>'Contenido.Prioridad DESC, Contenido.titulo ASC',

'conditions'=>'Contenido.publicado = true'
));
}
?>
---------
<?php
class Encuesta extends AppModel {
var $name = 'Encuesta';
var $tableName = 'encuestas';

var $hasMany = array('Respuesta'=>array
('className'=>'Respuesta', 'foreignKey'=>'id_encuesta'));

function obtenerEncuesta($id = null) {
$cond = array();
if(!is_null($id))
$cond = array('Encuesta.id' => $id);

return $this->find('first', array('contidions'=>$cond,
'order'=>'ORDER BY RAND()'));
}
}
?>

help?
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Logfile location

Thanks, that's just what I was looking for.

I'll just define the TMP, to /var/<app>/


On Aug 31, 4:12 pm, Kornelije Sajler <xaj...@gmail.com> wrote:
> There is a LOGS constant for Paths in CakePHP. You can find it in your
> cake_1.2.4.8284/cake/config/paths.php default is:
> define('LOGS', TMP.'logs'.DS);
>
> TMP = if (!defined('TMP')) {
> define('TMP', APP.'tmp'.DS);}
>
> DS = define('DS', DIRECTORY_SEPARATOR);
> I wouldn't change that!
>
> So you have two choices to move all your tmp CakePHP files (sessions, logs,
> cache,..) to wherever you are by changing TMP path or you can only adjust
> the LOGS path.
>
> There is probably nicer way to change TMP dir (since have if
> (!defined('TMP'))) but I don't know where could be defined!
>
> Hope it helps!
>
> Kornelije Sajler
>
> On Mon, Aug 31, 2009 at 15:40, Crazy <crazy...@gmail.com> wrote:
>
> > Hi,
>
> > In one of my projects it's required that the log files are being
> > logged to /var/logs/<appname>
>
> > I was wondering if it was possible to change the default location of
> > app/tmp/logs?
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Problem getting associations to work

Hi all, I am officially completely stumped. I cannot seem to get
associations to work at all, here is my code:

clients table
mysql> DESCRIBE clients;
+-----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+-------+
| id | int(11) | NO | PRI | NULL | |
| name | varchar(50) | NO | | NULL | |
| address_1 | varchar(100) | NO | | NULL | |
| address_2 | varchar(100) | NO | | NULL | |
| city | varchar(40) | NO | | NULL | |
| state | varchar(10) | NO | | NULL | |
| postal | varchar(10) | NO | | NULL | |
| country | char(2) | NO | | NULL | |
| phone | varchar(10) | NO | | NULL | |
| fax | varchar(10) | NO | | NULL | |
| url | varchar(80) | NO | | NULL | |
+-----------+--------------+------+-----+---------+-------+

contacts_table
mysql> DESCRIBE contacts;
+------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| first_name | varchar(20) | NO | | NULL | |
| last_name | varchar(20) | NO | | NULL | |
| email | varchar(40) | NO | | NULL | |
| phone | varchar(20) | NO | | NULL | |
| cell_phone | varchar(20) | NO | | NULL | |
| fax | varchar(20) | NO | | NULL | |
| client_id | int(11) | NO | | NULL | |
+------------+-------------+------+-----+---------+----------------+

contacts.php
<?php

class Contact extends AppModel {
var $name = 'Contact';
var $belongsTo = 'Client';
}
?>

contacts_controller.php
<?php
class ContactsController extends AppController {
var $name = 'Contacts';
public $view = 'Theme';
public $theme = 'default';
public $helpers = array('Form', 'Html', 'Javascript', 'Time');

public function index() {
$this->set('contacts', $this->Contact->find('all'));
}
}
?>

clients.php
<?php

class Client extends AppModel {
var $name = 'Client';
var $hasMany = 'Contact';
}
?>

clients_controller.php
<?php

class ClientsController extends AppController {
var $name = 'Clients';
public $view = 'Theme';
public $theme = 'default';
public $helpers = array('Form', 'Html', 'Javascript', 'Time');

public function index() {
$this->set('clients', $this->Client->find('all'));
}
}
?>

My understanding is that all of the above should result in both the
clients table and the contacts table being queried, however, this does
not appear to be the case. print_r() on the result in the contacts
controller produces:

Array ( [Contact] => Array ( [id] => 1 [first_name] => John
[last_name] => Doe [email] => someone@somewhere.net [phone] =>
7605555555 [cell_phone] => 765551234 [fax] => [client_id] => 0 ) )

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: File Uploads: What security-issues I have to take care of?

Regarding the mimetype, it allows all mimetypes listed in the config
folder. If you want to restrict the type, use the file validation
behavior.

For the second part of your question. You would do a normal controller
action setup like /files/download/1 and then use the media view and
your own logic to determine the file.

http://book.cakephp.org/view/489/Media-Views
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Losing Session on Redirect

Hi everyone,

I've read through all the various posts regarding losing session data
on redirects. Tried most everything, including

* Setting security to low
* Toggled useragent check off
* Tried starting session manually
* Within redirect function and commented out anything regarding
sessions
* Storing sessions in database

After setting security to low and commenting out items in redirect
function, I can now redirect without losing session data about 75%
time, but there's still occasions, including anytime I delete a
record, where the session is totally wiped out.

In addition, even when I redirect and do NOT lose session data, the
session 'flash' data is never carried over.

In my research, I read that this could be a larger PHP issue, than
just Cake, but wanted to post and start discussion again.

Has anyone come up with a foolproof method for redirecting without
losing session data everytime?

I'm on PHP 5.6.5, Cake 1.2.4.8166.

Thanks!
Wilson

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: store array into session

hi Nancy

yes :) . i test this and understand that we can store array into
session :).

thanks for your reply.

On Aug 31, 8:25 pm, Nancy <nancy.milli...@gmail.com> wrote:
> Have you tried it?  It does store it as a string but seems to recreate
> it as an array when you read it back in.  At least, I tried it
> yesterday and it seemed to do the right thing.
>
> On Aug 28, 1:31 am, persianshadow <persiansha...@gmail.com> wrote:
>
> > hi
>
> > i want store array of ids into session but i explore API of cakephp
> > and see  $value ( Session->write($name,$value) )
>
> > only get string , i need it for store id of items  that user select .
>
> > anybody have idea for do 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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: store array into session

Have you tried it? It does store it as a string but seems to recreate
it as an array when you read it back in. At least, I tried it
yesterday and it seemed to do the right thing.

On Aug 28, 1:31 am, persianshadow <persiansha...@gmail.com> wrote:
> hi
>
> i want store array of ids into session but i explore API of cakephp
> and see  $value ( Session->write($name,$value) )
>
> only get string , i need it for store id of items  that user select .
>
> anybody have idea for do 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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: File Uploads: What security-issues I have to take care of?

Hey,

yeah that's what I intend to do. I used your Uploader to upload files
for testing purposes, this works well, BUT I think that the allowed
mimetypes are not working as they should. I can upload ANY file,
although I allowed only JPEG and GIF to the plugin. That's a bit
weird, but I'm sure I'll find out why this is happening.


Let's assume we have done the work for uploading the files, store the
files with a unique name in a separate folder etc. but HOW can I
prevent a user getting files from other users? I think at the moment
every user can just type in a filename and if it's there, he will be
able to download it, no matter if it belongs to that user or not.

I've seen several solutions to this issue, mostly there is a php-
action involved (let's say download.php?filename.ext) where the
permission for the user is checked.

But there has to be a cake-style solution to this, right? In my DB I
store the user_id to every file that's uploaded, so I can check by
$this->Auth->User('id') wether the file belongs to the requesting
user, or not. But the direct download is not prevented.

Would a certain entry in the ROUTES.PHP file bring any help to that?
Maybe to redirect every request to the folder webroot/files to an
action that checks the permissions or sth. like that...?

I know it's kinda hard to understand what I mean, but if I see once
how to to such things, I won't bother you guys anymore, I swear :)

Regards,

DD


On 31 Aug., 18:11, Miles J <mileswjohn...@gmail.com> wrote:
> Yeah but thats pretty pointless if your just uploading images.
>
> But yes what you said would be the ideal situation if you want to do a
> download system, or supply files to users.
>
> On Aug 31, 4:56 am, Stinkbug <justink...@gmail.com> wrote:
>
> > There is one thing to keep in mind when uploading files and that's the
> > security risks in uploading files to the webroot where people can
> > access them directly.  It's generally recommended to upload files to a
> > directory outside of the webservers document root and give them a
> > unique name, so that the file can't be accessed directly.  Store a
> > reference in the database as a pointer to the file on the file
> > system.  Then you can use Cakes Media view to access the file.
>
> > This helps prevent people from uploading a malicious file and then
> > executing it on the server.  On top of that you can do all kinds of
> > server authentication or even use the ACL to grant proper permissions
> > to the files.
>
> > On Aug 30, 10:51 am, DigitalDude <e.blumsten...@googlemail.com> wrote:
>
> > > Hey,
>
> > > in my first "real" and own project, I want to implement the ability to
> > > upload files to a user's account. The filetypes I need to be able to
> > > upload are:
>
> > > - PDF
> > > - JPG
> > > - GIF
> > > - PNG
> > > - XLS
> > > - DOC
> > > - OpenOffice Documents
> > > - ZIP
> > > - RAR
>
> > > Before I start to implement a file-uploading action, I need to
> > > consider what are the security-risks of fileuploads in general, and in
> > > case of any of the listed filetypes above.
>
> > > What are the dangers of these filetypes, abd how can I prevent myself
> > > and my server from getting in danger?
>
> > > Regards,
>
> > > DD
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Validation question

I need to add a custom validation rule but cant quite figure out how to do it.
 
The field being validated has to be unique specific to the user. So User1 can use 'foo' , User2 can use 'foo' but each user cannot use 'foo' twice.
 
What would be the best way to handle something like this?
 
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Array of input text

Hi guys

thanks you all for this information. Finally I think I'll move forward with this line:

<? echo $form->input('', array('label' => 'URL', 'id' => '', 'name' => 'data[Blogurl][url][]')); ?>

Anyway I need to check how it works once it's POSTed.


If this succeeds OK I'll send you the relevant part of the view; but surely won't work with the saveAll method. Probably I'll write a custom method in the Blog model to save URLs.

Thanks again!




Nicolás Andrade
nmac@nicoandra.com.ar
Blog | CV | Flickr | Del.icio.us | LastFM




--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: How to stop html->link helper adding line breaks

Do you have your own AppHelper defined? I saw a tip once for getting
HTML output with newlines:

class AppHelper extends Helper
{
function output($string)
{
return parent::output("${string}\n");
}
}

Maybe that's the problem? In any case, the newlines should be ignored
by the browser.

On Mon, Aug 31, 2009 at 5:23 AM, WebbedIT<paul@webbedit.co.uk> wrote:
>
> Anybody?  I have now started seeing this with other helpers, such as
> time, when I have a comma or fullstop appearing after the html the
> helper generates.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: File Uploads: What security-issues I have to take care of?

Yeah but thats pretty pointless if your just uploading images.

But yes what you said would be the ideal situation if you want to do a
download system, or supply files to users.

On Aug 31, 4:56 am, Stinkbug <justink...@gmail.com> wrote:
> There is one thing to keep in mind when uploading files and that's the
> security risks in uploading files to the webroot where people can
> access them directly.  It's generally recommended to upload files to a
> directory outside of the webservers document root and give them a
> unique name, so that the file can't be accessed directly.  Store a
> reference in the database as a pointer to the file on the file
> system.  Then you can use Cakes Media view to access the file.
>
> This helps prevent people from uploading a malicious file and then
> executing it on the server.  On top of that you can do all kinds of
> server authentication or even use the ACL to grant proper permissions
> to the files.
>
> On Aug 30, 10:51 am, DigitalDude <e.blumsten...@googlemail.com> wrote:
>
> > Hey,
>
> > in my first "real" and own project, I want to implement the ability to
> > upload files to a user's account. The filetypes I need to be able to
> > upload are:
>
> > - PDF
> > - JPG
> > - GIF
> > - PNG
> > - XLS
> > - DOC
> > - OpenOffice Documents
> > - ZIP
> > - RAR
>
> > Before I start to implement a file-uploading action, I need to
> > consider what are the security-risks of fileuploads in general, and in
> > case of any of the listed filetypes above.
>
> > What are the dangers of these filetypes, abd how can I prevent myself
> > and my server from getting in danger?
>
> > Regards,
>
> > DD
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: CakePHP + PHP5.3 = ?

how do you guys find the time? seriously. you people are awesome.


On Aug 31, 7:19 am, jperras <joel.per...@gmail.com> wrote:
> Alright guys, it seems like you're all a bit confused.
>
> If you only read one line of this entire post, read this: CakePHP 1.3 !
> = Cake3
>
> Now, while this may seem obvious to many, you guys have made the same
> mistake that I've seen a few times on the #cakephp channel. The first
> is a branch in the cakephp 1.x project, and the last is a completely
> different beast altogether.
>
> CakePHP 1.2 supports PHP4 and PHP5.2, inclusively. PHP 5.3 introduced
> a few changes to the error handler flags, which we have accounted for
> in CakePHP 1.3-dev and will be accounting for in all subsequent
> releases.
>
> The reason we are not including PHP 5.3 compatibility in CakePHP 1.2.x
> is that we want people to move forward to CakePHP 1.3 & up when they
> become stable. If you're willing to update the php *language* to a new
> point release and not willing to update your application to a new
> framework point release, I think you have a slight disconnect. If you
> want, you could always apply the patches that we have committed to 1.3-
> dev to a local git branch, and continue on your merry way by merging
> in upstream changes from 1.2.x into your local branch.
>
> CakePHP 1.2.x and 1.3.x are in *the same project*, athttp://code.cakephp.org/cakephp
> . 1.2 and 1.3-dev are simply different branches.
>
> CakePHP 2.0, a *different project*, is *also* being worked on, which
> will be PHP 5.2 and up *only*, meaning we're dropping support for
> PHP4. Seehttp://code.cakephp.org/cakephp2to follow along the
> development of this project. The goal of this release is to be a
> nearly transparent upgrade for anyone running CakePHP 1.3 stable
> (whenever that is released), meaning that the two should be pretty
> much 100% API compatible.
>
> Finally Cake3 is a *different project*, found athttp://code.cakephp.org/cake3.
> This is an experimental project which is a complete rewrite of the
> CakePHP framework from the ground up, and will *only* support PHP 5.3
> and up.
>
> I hope this clears up some of the confusion.
> -jperras.
>
> On Aug 30, 2:45 pm, Miles J <mileswjohn...@gmail.com> wrote:
>
> > Yeah im pretty positive it wont be interchangeable. It uses a whole
> > new model setup and also uses namespaces.
>
> > The most you can do is interchange between 1.3/2.0.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Cake dies silently in case of fatal or parser error

Set debug = 2. Also, use:

error_reporting(E_ALL);
ini_set('display_errors', '1');

... in order to have PHP show something in the browser. If you can,
check Apache's error log.

On Mon, Aug 31, 2009 at 8:16 AM, XuMiX<v.tambovtsev@gmail.com> wrote:
>
> Unable to find the root of the problem. My cake install does not show
> any errors to browser in case of critical error.
> But errors from DB queries are shown as usual. Where should I dig?
> Php logging is enabled, those fatal errors are not logged even in the
> log file.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Validate UK postcode without a space in it

It looks like the Validation regex needs to be updated. This:

$_this->regex = '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]?
[0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i';

should be:

$_this->regex =
'/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]?[\s]?[0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i';

Ditto for the Canadian one.

On Mon, Aug 31, 2009 at 6:45 AM,
channel5<edd.dawson@comptonsolutions.com> wrote:
>
> Hi
>
> I've got a model that uses
>
> 'rule'=>array('postal',null,'uk')
>
> to successfully validate UK postcodes.
>
> However testing has shown that many people enter their postcodes in
> forms without using the space, so:
>
> W1W 5QU  <-- validates
> W1W5QU  <-- does not validate
>
> Has anyone got any tips on getting the validation to work irrespective
> of whether a user includes or excludes the space?
>
> Thanks
> c5
> >
>

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---