Re: Redirecting to another url in cake

2008-01-18 Thread Novice Programmer
Hello,

Actually i am trying to port a legacy application. In the page there are a
lot of forwards thro html  tag. Now what i was thinking was that
what is the best way to convert these tags new layouts, or the same layout
with different views loading at different time. After i researched i came to
following conclusions:

1. If the layout is quite different, then new layout would be better
otherwise existing layout would be cluttered with code.
2. If the layout is not that different, then new view in the same layout is
a better choice.

Please correct me if i am wrong.

Thanks.


On 1/19/08, bright_o <[EMAIL PROTECTED]> wrote:
>
>
> What exactly are you trying to accomplish?
>
> On Jan 18, 1:39 pm, "Novice Programmer" <[EMAIL PROTECTED]>
> wrote:
> > Hello guys,
> >
> > What is the best way to handle the redirections such as   in cake php. Do i define new layout for the page
> > mypage or should i have seperate view and load it in the exisiting
> layout
> > only. The new page to be loaded is quite different from the another
> page.
> >
> > --
> > Thanks & Regards,
> > Novice (http://ishuonweb.wordpress.com/).
>
> >
>


-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

--~--~-~--~~~---~--~~
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: Sharing Session across Different Applications

2008-01-18 Thread Kyo

It took a little time to figure out but now it works great!
Actually I made no change to the above code.
I just reuploaded the whole cake to the server. That's it.
There must have been some other factors that triggered the problem.

On Jan 18, 7:40 pm, Kyo <[EMAIL PROTECTED]> wrote:
> Thanks Adam. I did the method you suggested and found it very nice,
> but I'm having another problem now.
> In my case, it works in two different cake applications within one
> domain, but it doesn't seem to work in two separate domains.
>
> I did the following:
>
> This does a redirect from siteA.com/blah/index to siteB.com/blah/
> index.
>
> // siteA.com
>
> function index() {
> if(!$this->Session->check('Test')) {
> $this->Session->write('Test', 'Hello, this is only asession
> test!');
> }
>
> }
>
> function redirectem() {
> uses('string');
> $this->data['SiteTransfer']['sess_id'] = $this->Session->id();
> $this->SiteTransfer->id = String::uuid();
> if($this->SiteTransfer->save($this->data)) {
> $this->redirect('http://siteB.com/blah/catchem/uuid:'.$this-
>
> >SiteTransfer->id);
> }
> }
>
> // siteB.com
>
> function beforeFilter() {
> if(!empty($this->params['named']['uuid'])) {
> $uuid = $this->params['named']['uuid'];
> $this->data = $this->SiteTransfer->findById($uuid);
> $this->Session->id($this->data['SiteTransfer']['sess_id']);
> $this->SiteTransfer->del($uuid);
> }}
>
> function catchem($uuid) {
> $this->redirect('/blah/index');}
>
> function index() {
> debug($this->Session->read('Test'));
>
> }
>
> I found that SiteB.com instantiates thesessiondata with thesession
> ID in beforeFilter successfully;
> however, when the page (siteB.com/blah/index) gets rendered
> completely, siteB.com creates anothersessionid.
> Have I missed something fundamental?
>
> On Jan 17, 6:36 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
>
> > Yes, here is one method of making it more secure.
>
> > So have you two sites, siteA.com and siteB.com.
>
> > User is browsing siteA.com and you want them transferred to siteB.com
>
> > They click a link: eg. siteA.com/blah/redirectem/
>
> > In your redirectem method you get the currentsessionid and save it
> > into your database (eg. site_transfers) with a uuid (ie. String::uuid)
>
> > then you do a redirect to siteB.com/blah/catchem/$uuid
>
> > and search your database table for the uuid token and then instantiate
> > thesessionwith thesessionid from the db.
>
> > Then delete the uuid andsessionid from your site_transfers table.
>
> > All done!
>
> > On Jan 17, 2:57 pm, Kyo <[EMAIL PROTECTED]> wrote:
>
> > > Following your instruction, now i figured out how to share sessions
> > > between applications.
> > > In my view I appended thesessionID to the link like this:
>
> > > $html->link( 'Go to the other application',"http://www.example.com/
> > > other_cake/tests/index/sess_id:{$session->id('Test')}");
>
> > > On the other application, in the beforeFilter method in my controller:
>
> > > function beforeFilter() {
> > > $this->Session->id($this->params['named']['sess_id']);
>
> > > }
>
> > > I appreciate your instruction!
> > > Are there any way to make this more secure?
>
> > > On 1月16日, 午後10:48, Adam Royle <[EMAIL PROTECTED]> wrote:
>
> > > > Yes! When you transfer between applications (I'm guessing you have a
> > > > link of some description) append thesessionid onto your querystring
> > > > and use $this->Session->id($this->params['url']['sess_id']) on the
> > > > other end. There are more secure approaches to this, but you still
> > > > need to pass some kind of token so you know your user is really your
> > > > user.
>
> > > > Adam
>
> > > > On Jan 16, 6:58 pm, Kyo <[EMAIL PROTECTED]> wrote:
>
> > > > > Yes, I use the same db for both applications.
> > > > > When I jump from one cake application to another, they store two
> > > > >sessiondata with different IDs.
> > > > > Cookie got anything to do with it?
>
> > > > > On 1月16日, 午後5:44, AD7six <[EMAIL PROTECTED]> wrote:
>
> > > > > > On Jan 16, 6:15 am, Kyo <[EMAIL PROTECTED]> wrote:
>
> > > > > > > I currently use two Cake applications (beta 1.2) for my project 
> > > > > > > but
> > > > > > > I'm wondering if there is any way to sharesessiondata between 
> > > > > > > those
> > > > > > > two applications. Both applications have database sessions.
>
> > > > > > Use the same db for both? It's pretty much what db sessions are for.
--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread aranworld

I would like a little clarification here...

When people above are talking about "using plaintext passwords" and
"disabling hashing", are they talking about actually storing plaintext
passwords in the database?  I think most of us can agree that this is
Evil.

But is nate also suggesting that CakePHP developers think it is E-vil
for us to want to have access to the plaintext version of the password
during a Model save?  Or are we all in agreement that you need to send
a plaintext version of the desired password to the model, so that we
can actually validate it prior to saving ... to prevent the empty
password problem franky061 mentions above?

On Jan 18, 2:29 pm, francky06l <[EMAIL PROTECTED]> wrote:
> Sorry to jump in the passionate discussion, I do not see any complex
> problem in all this. Just my few cents about this hashing story:
>
> - Auth component is fine hashing automatically password, it defaults
> it to sha1, now (as mentioned earlier) you can write your own
> authenticate object. This object can actually not making hashing at
> all.
>
> - The only little thing to take care of is when you register your
> password (ie: btw good example on Chris blog, Chris I made a comment).
> If you use password field as input, Auth will hash it even if you left
> the password empty. Then you can sign in with an empty password. A
> validation rule against empty (password) will fail too in such case.
> The solution, is to set a rule on the confirm password and make the
> check on confirm_password (prior to hash it).
>
> Do not get me wrong, the Auth is fine and does perfectly the job. Take
> care when registering password, but usually it's done, isn't ?
>
> hth
> Franck
>
> On Jan 18, 10:36 pm, nate <[EMAIL PROTECTED]> wrote:
>
> > Right, we make it so you have to use an annoying and silly workaround
> > *for a reason*.  Because when it's annoying and silly, you have to
> > stop and think about it, because whatever it is you're trying to do is
> > probably wrong.  Whatever problem you are trying to solve by accessing
> > a plaintext password can probably be solved some other way.  You're
> > problem is not original.
>
> > You are not special.
> > You are not a beautiful and unique snowflake.
> > You are the all-singing, all-dancing crap of the earth.
>
> > On Jan 18, 3:32 pm, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > This particular issue is the framework trying to baby it's users.
> > > Telling us that we can't implement our own security practices. It's
> > > not even that you can turn it off if you don't want it, you just can't
> > > turn it off. You literally have to "deal with it" with a little
> > > workaround of some sort. Not that it's super hard to work around, but
> > > it is a work around. It's just annoying, and silly.. like I said.
>
> > > On Jan 18, 1:14 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > > > Now it's comments like this that help me understand why the developers
> > > > sometimes get frustrated with this mailing list. This statement serves
> > > > absolutely no purpose. It is a blind criticism without any productive
> > > > alternative.
>
> > > > Frameworks are developed for the mass, not individuals. Meaning, what's
> > > > there is going to serve 85% of the people just fine. If you have a 
> > > > _better_
> > > > alternative, then please suggest.
>
> > > > Otherwise, quit whining. It's not compiled code; it's PHP. If you don't 
> > > > like
> > > > it, open up the bloody file and hit the delete key move on.
> > > > --
> > > > Baz L
> > > > Web Development 2.0http://WebDevelopment2.com/
>
> > > > On Jan 18, 2008 1:31 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > > > I'll just say, I love any and all complaints about that auto hashing
> > > > > thing. I think it's silly and annoying and shouldnt be part of cake.
--~--~-~--~~~---~--~~
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: Ajax help

2008-01-18 Thread jenson

Hi guy,
   Thanks a lot for ur help..

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


--~--~-~--~~~---~--~~
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: mod_rewrite on AppServ

2008-01-18 Thread Raistlin Majere

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



mod_rewrite on AppServ

2008-01-18 Thread Raistlin Majere

AppServ 2.5.9
Apache 2.2.4
PHP 5.2.3
MySQL 5.0.45
phpMyAdmin-2.10.2

"Make sure that an .htaccess override is allowed: in your httpd.conf,
you should have a section that defines a section for each Directory on
your server. Make sure the AllowOverride is set to All  for the
correct Directory."

Where is that section? How do I set AllowOverride to All?

"Make sure you are loading up mod_rewrite correctly! You should see
something like LoadModule rewrite_module libexec/httpd/mod_rewrite.so
and AddModule mod_rewrite.c in your httpd.conf."

I searched for "libexec/httpd/mod_rewrite.so" and it is not in
httpd.conf.

I searched for "AddModule mod_rewrite.c" and it is notin httpd.conf.

What should I do?
--~--~-~--~~~---~--~~
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: afterFind() dillemna - eats memory for breakfast

2008-01-18 Thread b logica

On Jan 18, 2008 2:46 AM, AD7six <[EMAIL PROTECTED]> wrote:
>
> 32MB of memory is a bit stingy.

Sure. But it seems to be it should be more than enough to handle 1000
records. I can bump it up but I'd like to ensure I'm not doing so
unnecessarily.

> How about
> 1) delete your afterFind method
> 2) include "CONCAT(". $model->escapeField('first_name').','.$model-
> >escapeField('last_name').') AS full_name'"

I use Postgres because I prefer to do things with Pl/PgSQL, Pl/Python,
etc. Doing the concat in SQL was my first plan. However, I wanted to
know how to properly use afterFind() because I'm probably going to
need it. Like with urlencode(), etc.

> 3) look for $result[0]['full_name'] instead of $result['User']
> ['first_name'] etc.

I was thinking that that wouldn't work when User is more deeply nested
(when it'spart of an association). But I just remembered that
afterFind() isn't called then, so ...

> 4) url_encode where you need it (in the view)

Well, I was thinking that that just wouldn't be the Cake way ;-) It
seems to me that this is a chore for the model to deal with,
considering that I'm creating a new field in the array.

> Alternatively, to use the set class to do it would be something like:
> $keyPath = '{n}.User.id';
> $valuePath = array('{0} {1}', '{n}.User.first_name',
> '{n}.User.last_name');
> $results = Set::combine($results, $keyPath, $valuePath);
>

Oooh, that looks tasty! I'll check that out. Set is still a bit of a
mystery to me.

I came across this interesting AutoField behavior last night:

http://cakeexplorer.wordpress.com/category/model/

I'd like to test it out but ran into some weirdness with configure.php
that I haven't resolved. I'll post another thread about the problem
once I'm satisfied that it's just not just something boneheaded on my
part.

b

--~--~-~--~~~---~--~~
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: Redirecting to another url in cake

2008-01-18 Thread bright_o

What exactly are you trying to accomplish?

On Jan 18, 1:39 pm, "Novice Programmer" <[EMAIL PROTECTED]>
wrote:
> Hello guys,
>
> What is the best way to handle the redirections such as   in cake php. Do i define new layout for the page
> mypage or should i have seperate view and load it in the exisiting layout
> only. The new page to be loaded is quite different from the another page.
>
> --
> Thanks & Regards,
> Novice (http://ishuonweb.wordpress.com/).

--~--~-~--~~~---~--~~
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: Basic Question: Refining Queries

2008-01-18 Thread the_woodsman

Hi,

I'm not sure I fully understand your problem, but:


> I'd like to figure out how to do something like:
> $this->set('friends', $this->User->Friends->Profiles->findAll());
> This returns every profile in the system, not just those for the
> user's friends.

Your controller isn't tied to usingjust one Model, the $uses array of
the Controller can specify all the models you want:

var $uses=array('Profiles','User');

then you can start all your queries from these models, no need to
chain them as above.

> how to access the specific data I want without doing 2 or 3
> levels of recursion on a find() for the user.

There are various ways to tweak Cake queries, like setting the
recursion level, or which tables to join for any particular query.


Jan 18, 11:09 pm, Chris Wade <[EMAIL PROTECTED]> wrote:



--~--~-~--~~~---~--~~
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: alphaNumeric validation in cakephp 1.2.0.6311-beta

2008-01-18 Thread Rajesh

I used custom validation and that worked. Is there any other rule
available that is specific to a  text area.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Simple binding question.

2008-01-18 Thread phpjoy

I wonder how I could make a simple query to work through bind(), and
not use a custom query.

I'm binding two models for a model:
$this->Ticket->bindModel(array('belongsTo' => array('Deal' =>
array('foreignKey' => 'deal_id';
$this->Ticket->bindModel(array('belongsTo' => array('Item' =>
array('foreignKey' => 'deal_id';

The resulting query I get is this:
SELECT `Ticket`.`id`, `Deal`.`file`, `Item`.`title` FROM `tickets` AS
`Ticket` LEFT JOIN `deals` AS `Deal` ON (`Ticket`.`deal_id` =
`Deal`.`id`) LEFT JOIN `items` AS `Item` ON (`Ticket`.`deal_id` =
`Item`.`id`) WHERE `Ticket`.`user_id` = 1

Now, instead of:
`Item` ON (`Ticket`.`deal_id` = `Item`.`id`)
I need:
`Item` ON (`Deal`.`item_id` = `Item`.`id`)

Which gives this query:
SELECT `Ticket`.`id`, `Deal`.`file`, `Item`.`title` FROM `tickets` AS
`Ticket` LEFT JOIN `deals` AS `Deal` ON (`Ticket`.`deal_id` =
`Deal`.`id`) LEFT JOIN `items` AS `Item` ON (`Deal`.`item_id` =
`Item`.`id`) WHERE `Ticket`.`user_id` = 1

I tried binding item to deal, and CakePHP made 200 queries instead.
That didn't work too well.
Any ideas how I could make a slim query with CakePHP, without using
query()?

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



Basic Question: Refining Queries

2008-01-18 Thread Chris Wade

Hi All,

I'm building my first site with cake, and am working my way through
the documentation, but so far this part is confusing.

I've got a page that shows a user's profile, the avatars of the user's
"friends," blog posts by the user, the number of comments for each
blog post, and comments by other users about that user, along with the
avatars of the commenters.

I've worked out the relationships between the models, but what I don't
know is how to access the specific data I want without doing 2 or 3
levels of recursion on a find() for the user.  This is what I'm doing
right now, and it works but it's incredibly bloated.  I'm getting back
all sorts of data I don't need and page load times are rather long.

I'd like to figure out the syntax for doing a find on just the avatars
for the user's friends.  Right now, I do it like this:

In the controller:
$this->set('data', $this->User->find(null, null, null, 3));

In the view:
foreach ($data['Friends'] as $friend):
echo $friend['Profile']['avatar'];
endforeach;

I'd like to figure out how to do something like:
$this->set('friends', $this->User->Friends->Profiles->findAll());

This returns every profile in the system, not just those for the
user's friends.  I'm sure I'm just missing something in the syntax and
there's a straightforward way to do this.  I could just write a query,
but I'd like to figure out how to do it through the framework.

Thanks for your help!

Chris

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



CakePHP Developer needed.

2008-01-18 Thread rmarrs

I need a Freelance CakePHP developer to finish a project I've started
that I do not have the time to finish.  Short, quick project.
Guestimated development time is about 30 hours.  Offering $35/hour.

Will need references, please send email to [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: setting $this->layout not redirecting to the specified layout

2008-01-18 Thread Novice Programmer
Wow.. Removing default.thtml from the layouts folder, fixes the problem. I
am confused ... :(

thanks.


On 1/19/08, Novice Programmer <[EMAIL PROTECTED]> wrote:
>
> Linux distribution : Redhat.
> Cake 1.1.x
>
> Is there something special that needs to be done when using another
> layout? Here is what i have done. In the default layout, the following code
> is written.
>
>
> <
> a href=" /uploads/index">image(' topmast5.jpg',
> array('width'=>"86", 'height'=>"33", 'border'=>"0", 'alt'=>""));?> td>
> The controller looks like.
>
> 
> class
> UploadsController extends AppController {
>
> var $name = 'Uploads' ;
>
> var $helpers = array ('Html', 'Javascript', 'Ajax' );
>
> function index()
>
> {
>
> $this->layout = 'uploadlayout';
>
> }
>
> }
>
> ?>
>
>
> --
> Thanks & Regards,
> Novice (http://ishuonweb.wordpress.com/).
>



-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

--~--~-~--~~~---~--~~
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: Easy questions about directory structure

2008-01-18 Thread Baz
You "can" do anything, but elements seems to be the best bet...

u would have the model:
/models/about.php

controller:
/controllers/controller_about.php

view:
/views/about/index.ctp

then the elements:

/views/elements/
  header.ctp
  footer.ctp
  menu.ctp




On Jan 18, 2008 3:07 PM, 1010011010 <[EMAIL PROTECTED]> wrote:

>
> I'm very new to CakePHP and used to to use procedural code.  I think I
> get the idea about MVC and the structure of CakePHP but I have a few
> questions.
>
> Say I have a page on my site that is a page with no content from a
> database (ie. about.php).  In the old days the page would render the
> content plus include the header, menu, and footer inside an includes
> folder.
>
> For example, the directory structure would look like this:
> about.php
> includes/header.php
> includes/footer.php
> includes/menu.php
>
> After doing some research it looks like the header, menu and footer
> would be Elements inside a Layout. Is that correct? and... would the
> "about" page just be a view with static content? What would the
> directory structure look like?
>
> >
>

--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread MrTufty

djiize, thanks for the code sample. That's effectively what my own
code was doing, except (for some stupid reason) I'd neglected to load
the User model to get the hashPasswords function (in the theory that
it would be loaded by the Auth component anyway, I think).

I'm with nate on this one (not because he's a god of Cake or anything)
- there is no good reason why you should have to use plaintext
passwords, and many good reasons not to. I've come across several
websites and applications using plaintext passwords during the last 2
years I've spent as a professional web developer, and in every
instance it's been for stupid reasons (like, "our users often forget
their passwords and need them sent to remind them" - in which case 2-
way encryption is a far better solution).

Steve

On Jan 18, 9:36 pm, nate <[EMAIL PROTECTED]> wrote:
> Right, we make it so you have to use an annoying and silly workaround
> *for a reason*.  Because when it's annoying and silly, you have to
> stop and think about it, because whatever it is you're trying to do is
> probably wrong.  Whatever problem you are trying to solve by accessing
> a plaintext password can probably be solved some other way.  You're
> problem is not original.
>
> You are not special.
> You are not a beautiful and unique snowflake.
> You are the all-singing, all-dancing crap of the earth.
>
> On Jan 18, 3:32 pm, rtconner <[EMAIL PROTECTED]> wrote:
>
> > This particular issue is the framework trying to baby it's users.
> > Telling us that we can't implement our own security practices. It's
> > not even that you can turn it off if you don't want it, you just can't
> > turn it off. You literally have to "deal with it" with a little
> > workaround of some sort. Not that it's super hard to work around, but
> > it is a work around. It's just annoying, and silly.. like I said.
>
> > On Jan 18, 1:14 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > > Now it's comments like this that help me understand why the developers
> > > sometimes get frustrated with this mailing list. This statement serves
> > > absolutely no purpose. It is a blind criticism without any productive
> > > alternative.
>
> > > Frameworks are developed for the mass, not individuals. Meaning, what's
> > > there is going to serve 85% of the people just fine. If you have a 
> > > _better_
> > > alternative, then please suggest.
>
> > > Otherwise, quit whining. It's not compiled code; it's PHP. If you don't 
> > > like
> > > it, open up the bloody file and hit the delete key move on.
> > > --
> > > Baz L
> > > Web Development 2.0http://WebDevelopment2.com/
>
> > > On Jan 18, 2008 1:31 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > > I'll just say, I love any and all complaints about that auto hashing
> > > > thing. I think it's silly and annoying and shouldnt be part of cake.
--~--~-~--~~~---~--~~
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: Only one register within a given set can be flagged: possible?

2008-01-18 Thread MrTufty

Spot on, that's how I would do it. Avoids the expensive (and non-
scaling by table size) updateAll. This way when you change the default
image, you only have one field in one record to change, rather than 1
field in N records where N might possibly be a very big number.

Steve

On Jan 18, 7:13 pm, Goranche <[EMAIL PROTECTED]> wrote:
> One way of doing this is to add a "defaultPhotoID" field to the photo
> gallery record...
> (and of course removing the "default" flag from the photos)
>
> a nice side effect is that it allows you to share photos between
> galleries... maybe not something that one would do, but replace the
> gallery with group and photo with articles... or just about any other
> example :)
>
> I also like to ask questions like: default photo is an attribute of
> which entity? photo or gallery?
>
> Goran
>
> Jaime wrote:
> > is set in the Photo model. Of course one and only one photo within
> > that album should have the "default" bit set, because it's non-sense
> > to flag more than one for the same album.
--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread francky06l

Sorry to jump in the passionate discussion, I do not see any complex
problem in all this. Just my few cents about this hashing story:

- Auth component is fine hashing automatically password, it defaults
it to sha1, now (as mentioned earlier) you can write your own
authenticate object. This object can actually not making hashing at
all.

- The only little thing to take care of is when you register your
password (ie: btw good example on Chris blog, Chris I made a comment).
If you use password field as input, Auth will hash it even if you left
the password empty. Then you can sign in with an empty password. A
validation rule against empty (password) will fail too in such case.
The solution, is to set a rule on the confirm password and make the
check on confirm_password (prior to hash it).

Do not get me wrong, the Auth is fine and does perfectly the job. Take
care when registering password, but usually it's done, isn't ?

hth
Franck


On Jan 18, 10:36 pm, nate <[EMAIL PROTECTED]> wrote:
> Right, we make it so you have to use an annoying and silly workaround
> *for a reason*.  Because when it's annoying and silly, you have to
> stop and think about it, because whatever it is you're trying to do is
> probably wrong.  Whatever problem you are trying to solve by accessing
> a plaintext password can probably be solved some other way.  You're
> problem is not original.
>
> You are not special.
> You are not a beautiful and unique snowflake.
> You are the all-singing, all-dancing crap of the earth.
>
> On Jan 18, 3:32 pm, rtconner <[EMAIL PROTECTED]> wrote:
>
> > This particular issue is the framework trying to baby it's users.
> > Telling us that we can't implement our own security practices. It's
> > not even that you can turn it off if you don't want it, you just can't
> > turn it off. You literally have to "deal with it" with a little
> > workaround of some sort. Not that it's super hard to work around, but
> > it is a work around. It's just annoying, and silly.. like I said.
>
> > On Jan 18, 1:14 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > > Now it's comments like this that help me understand why the developers
> > > sometimes get frustrated with this mailing list. This statement serves
> > > absolutely no purpose. It is a blind criticism without any productive
> > > alternative.
>
> > > Frameworks are developed for the mass, not individuals. Meaning, what's
> > > there is going to serve 85% of the people just fine. If you have a 
> > > _better_
> > > alternative, then please suggest.
>
> > > Otherwise, quit whining. It's not compiled code; it's PHP. If you don't 
> > > like
> > > it, open up the bloody file and hit the delete key move on.
> > > --
> > > Baz L
> > > Web Development 2.0http://WebDevelopment2.com/
>
> > > On Jan 18, 2008 1:31 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > > I'll just say, I love any and all complaints about that auto hashing
> > > > thing. I think it's silly and annoying and shouldnt be part of cake.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



setting $this->layout not redirecting to the specified layout

2008-01-18 Thread Novice Programmer
Linux distribution : Redhat.
Cake 1.1.x

Is there something special that needs to be done when using another layout?
Here is what i have done. In the default layout, the following code is
written.


image('topmast5.jpg',
array('width'=>"86", 'height'=>"33", 'border'=>"0", 'alt'=>""));?>
The controller looks like.


layout = 'uploadlayout';

}

}

?>


-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

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



Easy questions about directory structure

2008-01-18 Thread 1010011010

I'm very new to CakePHP and used to to use procedural code.  I think I
get the idea about MVC and the structure of CakePHP but I have a few
questions.

Say I have a page on my site that is a page with no content from a
database (ie. about.php).  In the old days the page would render the
content plus include the header, menu, and footer inside an includes
folder.

For example, the directory structure would look like this:
about.php
includes/header.php
includes/footer.php
includes/menu.php

After doing some research it looks like the header, menu and footer
would be Elements inside a Layout. Is that correct? and... would the
"about" page just be a view with static content? What would the
directory structure look like?

--~--~-~--~~~---~--~~
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: FPDF and FPDI with CakePHP

2008-01-18 Thread Takuo SHIONO

Hello Gianluca,

In may case, we put FPDF into vendors directory. Then we generate 
component php file, pdf_generator.php. In this php file, we define two 
classes. The first one is PdfGeneratorComponent class which is component 
class. The other is MyFPDF class which extends FPDF class.

The following is the brief example.

pdf_generator.php:


In the controller, we use this component as follows:

xxx_controller.php:
Pdf->generate();
 exit;
   }
}
?>


Best Wishes,

Takuo Shiono



--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread nate

Right, we make it so you have to use an annoying and silly workaround
*for a reason*.  Because when it's annoying and silly, you have to
stop and think about it, because whatever it is you're trying to do is
probably wrong.  Whatever problem you are trying to solve by accessing
a plaintext password can probably be solved some other way.  You're
problem is not original.

You are not special.
You are not a beautiful and unique snowflake.
You are the all-singing, all-dancing crap of the earth.

On Jan 18, 3:32 pm, rtconner <[EMAIL PROTECTED]> wrote:
> This particular issue is the framework trying to baby it's users.
> Telling us that we can't implement our own security practices. It's
> not even that you can turn it off if you don't want it, you just can't
> turn it off. You literally have to "deal with it" with a little
> workaround of some sort. Not that it's super hard to work around, but
> it is a work around. It's just annoying, and silly.. like I said.
>
> On Jan 18, 1:14 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > Now it's comments like this that help me understand why the developers
> > sometimes get frustrated with this mailing list. This statement serves
> > absolutely no purpose. It is a blind criticism without any productive
> > alternative.
>
> > Frameworks are developed for the mass, not individuals. Meaning, what's
> > there is going to serve 85% of the people just fine. If you have a _better_
> > alternative, then please suggest.
>
> > Otherwise, quit whining. It's not compiled code; it's PHP. If you don't like
> > it, open up the bloody file and hit the delete key move on.
> > --
> > Baz L
> > Web Development 2.0http://WebDevelopment2.com/
>
> > On Jan 18, 2008 1:31 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > I'll just say, I love any and all complaints about that auto hashing
> > > thing. I think it's silly and annoying and shouldnt be part of cake.
--~--~-~--~~~---~--~~
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: Paginate an array thats not from a model

2008-01-18 Thread Chris Hartjes

On Jan 18, 2008 1:54 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> Why are you using MVC if you aren't making models?

It's not about not using models, it's about using non-database powered models.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
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: Paginate an array thats not from a model

2008-01-18 Thread Arne-Kolja Bachstein

@rtconner: Thanks, I'll take a look at this.

@Michael: The project is much bigger, that's just one tricky part of
it.

On 18 Jan., 19:54, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> On Jan 18, 12:38 pm, Arne-Kolja Bachstein <[EMAIL PROTECTED]> wrote:
>
> > Hi there,
>
> > does anyone know if there is a chance to paginate data thats not
> > fetched from the database/a model using the paginator component or
> > something?
>
> > The situation: I have a search form that fetches its hits from an XML
> > file. That's done by first fetching the XML file, saving it to the tmp
> > folder and then loading the entries from that XML file into an array
> > using simplepie. And I am stuck atm with the pagination, since I have
> > no clue how I could solve this.
>
> Why are you using MVC if you aren't making models?
--~--~-~--~~~---~--~~
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: Paginate an array thats not from a model

2008-01-18 Thread [EMAIL PROTECTED]



On Jan 18, 12:38 pm, Arne-Kolja Bachstein <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> does anyone know if there is a chance to paginate data thats not
> fetched from the database/a model using the paginator component or
> something?
>
> The situation: I have a search form that fetches its hits from an XML
> file. That's done by first fetching the XML file, saving it to the tmp
> folder and then loading the entries from that XML file into an array
> using simplepie. And I am stuck atm with the pagination, since I have
> no clue how I could solve this.

Why are you using MVC if you aren't making models?

--~--~-~--~~~---~--~~
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: Only one register within a given set can be flagged: possible?

2008-01-18 Thread Goranche

One way of doing this is to add a "defaultPhotoID" field to the photo
gallery record...
(and of course removing the "default" flag from the photos)

a nice side effect is that it allows you to share photos between
galleries... maybe not something that one would do, but replace the
gallery with group and photo with articles... or just about any other
example :)

I also like to ask questions like: default photo is an attribute of
which entity? photo or gallery?

Goran

Jaime wrote:
> is set in the Photo model. Of course one and only one photo within
> that album should have the "default" bit set, because it's non-sense
> to flag more than one for the same album.

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



Saving multiple localized entries for one field _at once_! (code inside!)

2008-01-18 Thread ruxkor

Hi everybody,

AFAIK it is impossible, using the current TranslateBehavior, to insert
multiple values of one field at once.

Example.
I have an article (with its fields like created, user_id etc) and
define:

var $actsAs = array('Translate' =>
array('content'=>'LocaleContents'));
(to be able to fetch all translations as once as a hasMany relation)

Now in order to save ONE translation I would do:
create('') ?>

textarea('Article.content') ?>
end(__('Submit',true)) ?>

So far so good. But what if you want to save multiple languages?
First of all you have to update your translate.php in /cake/libs/model/
behaviors as shown in the bin: http://bin.cakephp.org/view/1939852942

Then just insert in the form fields like the following:
textarea('Article.content.LOCALE') ?>
examples:
- textarea('Article.content.en_us') ?>
- textarea('Article.content.de_de') ?>
etc.


please note. not throughly tested! i just came up with this idea.
--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread rtconner

Np :) I wouldn't expect you to read every little rejected bug report
on trac.

On Jan 18, 1:45 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On Jan 18, 2008 3:43 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
>
>
> > Ya I had this out with nate already. I've given up. I think my
> > solution was to set the hash type to none.
> >https://trac.cakephp.org/ticket/3364
>
> Aha!  So you did follow through.  My most humble appologies.
>
> --
> Chris Hartjes
> Internet Loudmouth
> Motto for 2008: "Moving from herding elephants to handling snakes..."
> @TheKeyBoard:http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread Chris Hartjes

On Jan 18, 2008 3:43 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
> Ya I had this out with nate already. I've given up. I think my
> solution was to set the hash type to none.
> https://trac.cakephp.org/ticket/3364

Aha!  So you did follow through.  My most humble appologies.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread rtconner

Ya I had this out with nate already. I've given up. I think my
solution was to set the hash type to none.
https://trac.cakephp.org/ticket/3364

On Jan 18, 1:38 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On Jan 18, 2008 3:32 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
>
>
> > This particular issue is the framework trying to baby it's users.
> > Telling us that we can't implement our own security practices. It's
> > not even that you can turn it off if you don't want it, you just can't
> > turn it off. You literally have to "deal with it" with a little
> > workaround of some sort. Not that it's super hard to work around, but
> > it is a work around. It's just annoying, and silly.. like I said.
>
> Okay, here's a "put up or shut up" challenge for you.
>
> Add a 'autohash' variable to the Auth component, and when it's set to
> false tell the Auth component to not automatically hash the password.
>
> i.e.
> $this->Auth->autohash = false;
>
> In fact, file a ticket on trac suggesting this.
>
> If you do that, then I promise to not mercilessly mock you in other threads. 
> ;)
>
> But if you won't do it, then it's the equivalent of complaining about
> the government when you don't vote in any elections.
>
> --
> Chris Hartjes
> Internet Loudmouth
> Motto for 2008: "Moving from herding elephants to handling snakes..."
> @TheKeyBoard:http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



How to test that adatabase table exists ?

2008-01-18 Thread foxmask

Good evening,
I would like to test if my database table exists or not
If no,   i will display a message to suggest to install the software
If yes,  i will "Route::connect()"  to the main page of the software.

I digged on the Model::Schema() but i dunno how to use it nor if it's
the well way to do the trick.


kind regards.

--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread Chris Hartjes

On Jan 18, 2008 3:32 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
> This particular issue is the framework trying to baby it's users.
> Telling us that we can't implement our own security practices. It's
> not even that you can turn it off if you don't want it, you just can't
> turn it off. You literally have to "deal with it" with a little
> workaround of some sort. Not that it's super hard to work around, but
> it is a work around. It's just annoying, and silly.. like I said.

Okay, here's a "put up or shut up" challenge for you.

Add a 'autohash' variable to the Auth component, and when it's set to
false tell the Auth component to not automatically hash the password.

i.e.
$this->Auth->autohash = false;


In fact, file a ticket on trac suggesting this.

If you do that, then I promise to not mercilessly mock you in other threads. ;)

But if you won't do it, then it's the equivalent of complaining about
the government when you don't vote in any elections.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread rtconner

This particular issue is the framework trying to baby it's users.
Telling us that we can't implement our own security practices. It's
not even that you can turn it off if you don't want it, you just can't
turn it off. You literally have to "deal with it" with a little
workaround of some sort. Not that it's super hard to work around, but
it is a work around. It's just annoying, and silly.. like I said.

On Jan 18, 1:14 pm, Baz <[EMAIL PROTECTED]> wrote:
> Now it's comments like this that help me understand why the developers
> sometimes get frustrated with this mailing list. This statement serves
> absolutely no purpose. It is a blind criticism without any productive
> alternative.
>
> Frameworks are developed for the mass, not individuals. Meaning, what's
> there is going to serve 85% of the people just fine. If you have a _better_
> alternative, then please suggest.
>
> Otherwise, quit whining. It's not compiled code; it's PHP. If you don't like
> it, open up the bloody file and hit the delete key move on.
> --
> Baz L
> Web Development 2.0http://WebDevelopment2.com/
>
> On Jan 18, 2008 1:31 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
>
>
> > I'll just say, I love any and all complaints about that auto hashing
> > thing. I think it's silly and annoying and shouldnt be part of cake.
--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread Baz
Now it's comments like this that help me understand why the developers
sometimes get frustrated with this mailing list. This statement serves
absolutely no purpose. It is a blind criticism without any productive
alternative.

Frameworks are developed for the mass, not individuals. Meaning, what's
there is going to serve 85% of the people just fine. If you have a _better_
alternative, then please suggest.

Otherwise, quit whining. It's not compiled code; it's PHP. If you don't like
it, open up the bloody file and hit the delete key move on.
--
Baz L
Web Development 2.0
http://WebDevelopment2.com/

On Jan 18, 2008 1:31 PM, rtconner <[EMAIL PROTECTED]> wrote:

>
> I'll just say, I love any and all complaints about that auto hashing
> thing. I think it's silly and annoying and shouldnt be part of cake.
> >
>

--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread Chris Hartjes

On Jan 18, 2008 2:31 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
> I'll just say, I love any and all complaints about that auto hashing
> thing. I think it's silly and annoying and shouldnt be part of cake.
>

I think it's silly that people can't figure out how to deal with it.
The point of hashing the password is to provide security.  If you can
reproduce a password given the hash, well, that sounds like a big
security hole.

Perhaps I'm misunderstanding the problem.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Fatal Error (256): ConnectionManager::getDataSource - Non-existent data source

2008-01-18 Thread roliver

Hi all,

I just changed my core.php use the database to store sessions.  I made
sure all the proper settings were correct for database, table and I
created the table in my DB with the sessions.sql.  Now when I hit my
app I get the following error:

Fatal Error (256): ConnectionManager::getDataSource - Non-existent
data source ppc_alerts [CORE/cake/libs/model/connection_manager.php,
line 113]

notice the datasource ppc_alerts is set.  I can connect to via mysql
console just fine

any clues?

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



Redirecting to another url in cake

2008-01-18 Thread Novice Programmer
Hello guys,

What is the best way to handle the redirections such as   in cake php. Do i define new layout for the page
mypage or should i have seperate view and load it in the exisiting layout
only. The new page to be loaded is quite different from the another page.

-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread rtconner

I'll just say, I love any and all complaints about that auto hashing
thing. I think it's silly and annoying and shouldnt be part of cake.
--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread aranworld

Thanks for the example djiize.

I'm curious if that is the SOLE intended use of the Auth::authenticate
attribute?

Right now it appears as if it is, but the description "A reference to
the object used for authentication" suggests that it is intended to be
used for more than just a way to override the hashPasswords function.

On Jan 18, 7:22 am, djiize <[EMAIL PROTECTED]> wrote:
> http://bin.cakephp.org/view/266619336
>
> Quick test of what I said, you just need to modify User->password
> function to your needs.
>
> On 18 jan, 12:45, MrTufty <[EMAIL PROTECTED]> wrote:
>
> > What he said ;)
>
> > I've been working with overriding hashPasswords to provide a randomly
> > salted sha256 implementation, but my brains leaked out of my ears
> > (that'll teach me to code at 3am).
>
> > Steve
>
> > On Jan 18, 11:30 am, djiize <[EMAIL PROTECTED]> wrote:
>
> > > You can already choose your hashing method, see in function
> > > Auth::hashPasswords
> > > If you define Auth->authenticate variable with the name of an object
> > > of your own that definse the function hashPasswords, this function
> > > will be called instead of the Auth default one
>
> > > If you just want md5 or sha256 instead of sha1, you can define
> > > Security->hashType (maybe in bootstrap)
>
> > > Thanks to code devs to permits that 2 things ;)
>
> > > On 18 jan, 11:47, phpjoy <[EMAIL PROTECTED]> wrote:
>
> > > > nate, someone could want to use other hashing methods and not the
> > > > default one.
> > > > i vote for enabling :)
>
> > > > and adding the last crypt component to cake :D
>
> > > > On Jan 18, 6:18 am, nate <[EMAIL PROTECTED]> wrote:
>
> > > > > No.  Disabling password hashing is Evil with a capital "E".  That's
> > > > > why I don't let you do it.
>
> > > > > On Jan 17, 11:03 am, dizz <[EMAIL PROTECTED]> wrote:
>
> > > > > > Thanks to both of you, I thought of this, but I thought it would be
> > > > > > easier to disable the AuthComponent::hashPasswords and then do what
> > > > > > Baz did above.
>
> > > > > > Anyways thanks again for the help.
>
> > > > > > -Andrew
>
> > > > > > On Jan 17, 10:45 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Yep,
>
> > > > > > > Use a different field, eg. new_password or something. (I'm 
> > > > > > > assuming
> > > > > > > you're validating when creating a password. No need for login)
>
> > > > > > > Here's assuming you have a model called User:
>
> > > > > > > // needed for validation for some reason
> > > > > > > $this->User->set($this->data);
> > > > > > > if ($this->validates($this->data))
> > > > > > > {
> > > > > > > $this->data['User']['passwd'] =
> > > > > > > $this->Auth->password($this->data['User']['new_passwd'] )
>
> > > > > > > // all we did was hash passwords, no need to revalidate.
> > > > > > > if ($this->save($this->data, false))
> > > > > > > {
> > > > > > > //do stuff
> > > > > > > } else
> > > > > > > {
> > > > > > > // invalid
> > > > > > > }
>
> > > > > > > }
>
> > > > > > > Would be nice to stick this is beforeSave in the model, but you 
> > > > > > > can't
> > > > > > > [easily] access the Auth component from the model.
>
> > > > > > > Hope this helps.
>
> > > > > > > On Jan 17, 2008 9:31 AM, dizz <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > Hello,
>
> > > > > > > > I am using the auth component and before my model can validate 
> > > > > > > > the
> > > > > > > > password the auth component already encrypts the password so 
> > > > > > > > making it
> > > > > > > > impossible to use the between built in valid method.
>
> > > > > > > > Is there any work around for this?
--~--~-~--~~~---~--~~
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: Paginate an array thats not from a model

2008-01-18 Thread rtconner

I guess you could overwrite the paginate() and paginateCount() methods
in the model.

On Jan 18, 10:38 am, Arne-Kolja Bachstein <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> does anyone know if there is a chance to paginate data thats not
> fetched from the database/a model using the paginator component or
> something?
>
> The situation: I have a search form that fetches its hits from an XML
> file. That's done by first fetching the XML file, saving it to the tmp
> folder and then loading the entries from that XML file into an array
> using simplepie. And I am stuck atm with the pagination, since I have
> no clue how I could solve this.
>
> Thanks in advance
>
> Arne
--~--~-~--~~~---~--~~
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: alphaNumeric validation in cakephp 1.2.0.6311-beta

2008-01-18 Thread aranworld

That is correct.  alphanumeric only works on un broken strings of
characters - presumably to test things like usernames.

There is no built-in validation rule that checks to see if a phrase
contains only letters or numbers.


On Jan 17, 11:36 pm, AD7six <[EMAIL PROTECTED]> wrote:
> On Jan 18, 3:39 am, Rajesh <[EMAIL PROTECTED]> wrote:
>
> > I have a field called comment which is of type text in db. And i have
> > the validation rule as alphaNumeric, required=true and message=>'some
> > message' in the model. The field is rendered as text area. Now if i
> > enter the value of comment as "sometext", this works fine and gets
> > stored in db, but when i enter the value as "some text" (note - the
> > space between 2 words), it throws the validation message and the data
> > is not saved.
> > Am i missing something ?
>
> A space isn't alpha numeric afaik.
>
> hth,
>
> AD
--~--~-~--~~~---~--~~
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: Acl::Allow does not work

2008-01-18 Thread aranworld

In my script, I have a Users node which is a parent of an edit node.

For each user, I create a permission to Users/edit/[user_id] by doing
the following command (for a User with alias 'ripley' and user_id
'23')

$this->Acl->grant('ripley', 'Users/edit/23', '*');

This works for me.  I am using Auth in 'actions' mode rather than
'crud' mode.  grant and allow are really the same thing, so this same
syntax should work for you as well.



On Jan 18, 6:51 am, NilsR <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> When I try to use
>
> $this->Acl->allow($aro['Aro']['id'],$aco['Aco']['id'], $actions);
>
> I get this error: Warning (512): DB_ACL::allow() - Invalid node [CORE/
> cake/libs/controller/components/acl.php, line 362]
>
> But these Aro and Aco DO exist. Well then i thought I have to do it
> like Acl::check without aliases:
>
> $this->Acl->allow( array( 'model '=> $aco['Aro']['model'],
> 'foreign_key' => $aco['Aro']['foreign_key']), $aco['Aco']['model'],
> $actions);
>
> But now i get an even weirder error:
>
> Missing Database Table
> Error: Database table lms_models for model model was not found.
>
> What am i doing wrong here?
>
> Greetings, Nils
--~--~-~--~~~---~--~~
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: i18n Translations

2008-01-18 Thread ruxkor

afaik every field is saved in the i18n table (in every language), if
you declare it as translatable.
so you should remove this field from the original table and only use
the i18n table for it.

eg if you have a model article and it should have fields as
id,user_id,created,body,title
and body,title should be translatable

you have to remove these two fields from the "articles" table and
instead rely on the TranslationBehavior.

On Jan 10, 1:19 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I've been using the translation behaviour to translate and it works
> fine for the translations but not the original default language, when
> I set my application to the default language (es Spanish) and try to
> get the content from the Original Model (Page) the Translation
> behaviour tries to look for a translation within thei18ntable
> instead the pages table.
> How can I solve this problem?

--~--~-~--~~~---~--~~
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: Ajax help

2008-01-18 Thread Novice Programmer
Hello Jenson,

I suffered the same issue. Here is the link that helped me.

http://www.reversefolds.com/articles/show/ajax

Thanks.


On 1/18/08, jenson <[EMAIL PROTECTED]> wrote:
>
>
>
> Hello guys,
>
> I need help regarding ajax with cake php ..I Can't really get a nice
> tutorial.. tutorial
> has expired(http://grahambird.co.uk/cake/tutorials/ajax.php) and the place
> where this
> page takes me is bit advanced for me. Can some one refer some other link?
>
> with regards,
> jenson rajan.A
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
> >
>


-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

--~--~-~--~~~---~--~~
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: Scriptaucolous effect.fade wont work

2008-01-18 Thread Novice Programmer
Hello David,

Yes you are right.. This is what i am getting at. The rendering on the page
starts before even the whole data has been fetched from teh database. I am
looking at how do other sites such as youtube fix this situation.

Thanks for your inputs.


On 1/18/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> > Thanks for the inputs guys... Coupling both of these resolves the
> issues.
> > I am having another AJAX problem.. with the below said string when i
> click
> > some other tab, the images on the foucsed tab fade but the images for
> the
> > new tab start appearing one by one. I want that they dont appear one by
> one
> > rather i want to load them at once using some Scriptaucolous effect(An
> > effect similar to the dynamic update on youtube home page). Any ideas on
> how
> > this can be done?
>
>
> I'm not sure I quite understand what you mean, but if you use ajax to
> update a div, the scriptaculous effect should apply to the entire div
> and not the individual elements of the div separately. So are the
> images you want to load with the scriptaculous effect all within the
> same div? if so, is that the div you have updated with your ajax call?
> If so, it may be the case that delay is due to the lag time it takes
> to download the images from the server (I mean that they don't all
> show up at the same time because the ajax update hasn't finished
> downloading from the server before the client starts to display them.
>
> Dave
> >
>


-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

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



Paginate an array thats not from a model

2008-01-18 Thread Arne-Kolja Bachstein

Hi there,

does anyone know if there is a chance to paginate data thats not
fetched from the database/a model using the paginator component or
something?

The situation: I have a search form that fetches its hits from an XML
file. That's done by first fetching the XML file, saving it to the tmp
folder and then loading the entries from that XML file into an array
using simplepie. And I am stuck atm with the pagination, since I have
no clue how I could solve this.

Thanks in advance

Arne
--~--~-~--~~~---~--~~
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: Only one register within a given set can be flagged: possible?

2008-01-18 Thread RichardAtHome

I'd be tempted to unset them all THEN set the default (one less WHERE
clause).

You could override the default save in the Model with (untested) :

function save($date) {

  if (!empty($this->data[$this->alias]['default'])) {
$this->UpdateAll(array("default"=>"0");
  }

  parent::save($data);

}

On Jan 18, 5:07 pm, grigri <[EMAIL PROTECTED]> wrote:
> Something like this? (This actually sets the others off AFTER setting
> this one on, but it makes little difference). If you put the login in
> beforeSave(), and the save fails, then the album won't have a default
> photo.
>
> (code not tested, might be typos)
>
> class Photo extends AppModel {
>   var $name = "Photo";
>
>   var $belongsTo = array('PhotoAlbum');
>
>   function afterSave($created) {
> if (!empty($this->data[$this->alias]['photo_album_id'])) {
>   if (!empty($this->data[$this->alias]['default'])) {
> // We have set this photo to default, so unset the default
> flag in all other photos in this album
> $this->updateAll(array('default' => '0'),
> array('photo_album_id' => $this->data[$this->alias]
> ['photo_album_id']), 'id' => '<> ' . $this->id);
>   }
> }
>   }
>
> }
>
> On Jan 18, 3:27 pm, Jaime <[EMAIL PROTECTED]> wrote:
>
> > Hello bakers!
>
> > Imagine this (common) scenario: a photo album that HasMany photos. A
> > user may select one of them as a "cover" or "default" photo to
> > illustrate the cover of the album. So a boolean field called "default"
> > is set in the Photo model. Of course one and only one photo within
> > that album should have the "default" bit set, because it's non-sense
> > to flag more than one for the same album.
>
> > This leads to some extra logic within the controller in order to unset
> > all other possibly previously flagged photos before setting the new
> > one. This is not a big deal nor very important, but is not very
> > beautiful either, is it?
>
> > As the great piece of software CakePHP is, perhaps there is the
> > possibility to specify within the model that only one register within
> > a given set can have a boolean field set. Or maybe can be defined
> > somehow in the MySQL DB.
>
> > I hope this is not a too philosophical question :-)
--~--~-~--~~~---~--~~
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: Only one register within a given set can be flagged: possible?

2008-01-18 Thread grigri

Something like this? (This actually sets the others off AFTER setting
this one on, but it makes little difference). If you put the login in
beforeSave(), and the save fails, then the album won't have a default
photo.

(code not tested, might be typos)

class Photo extends AppModel {
  var $name = "Photo";

  var $belongsTo = array('PhotoAlbum');

  function afterSave($created) {
if (!empty($this->data[$this->alias]['photo_album_id'])) {
  if (!empty($this->data[$this->alias]['default'])) {
// We have set this photo to default, so unset the default
flag in all other photos in this album
$this->updateAll(array('default' => '0'),
array('photo_album_id' => $this->data[$this->alias]
['photo_album_id']), 'id' => '<> ' . $this->id);
  }
}
  }
}

On Jan 18, 3:27 pm, Jaime <[EMAIL PROTECTED]> wrote:
> Hello bakers!
>
> Imagine this (common) scenario: a photo album that HasMany photos. A
> user may select one of them as a "cover" or "default" photo to
> illustrate the cover of the album. So a boolean field called "default"
> is set in the Photo model. Of course one and only one photo within
> that album should have the "default" bit set, because it's non-sense
> to flag more than one for the same album.
>
> This leads to some extra logic within the controller in order to unset
> all other possibly previously flagged photos before setting the new
> one. This is not a big deal nor very important, but is not very
> beautiful either, is it?
>
> As the great piece of software CakePHP is, perhaps there is the
> possibility to specify within the model that only one register within
> a given set can have a boolean field set. Or maybe can be defined
> somehow in the MySQL DB.
>
> I hope this is not a too philosophical question :-)
--~--~-~--~~~---~--~~
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: Storing user group in appmodel?

2008-01-18 Thread RichardAtHome

$this->{$this->modelClass}

Ahhh, I wondered what the syntax was for this! Up until now I've been
using a temporary variable:

$modelClass = $this->modelClass;
$this->$modelClass;

tyvm!

On Jan 18, 3:12 pm, francky06l <[EMAIL PROTECTED]> wrote:
> Well if you you set in AppModel :
>
> static usergroup = null;
> function store($group)
> {
> self::$usergroup = $group;
>
> }
>
> function getgroup()
> {
>return self::$usergroup;
>
> }
>
> in AppController ( suppoisng you store the group in the Session), you
> can do
>
> function beforeFilter()
> {
> if(isset($this->{$this->modelClass}) /* thank AD for this */
>   $this->{$this->modelClass}->store($this->Session-
>
> >('whereismygroup');
> }
>
> now in any model
>
> $currentgroup= $this->getgroup();
>
> Maybe you have to check values before storing etc ... but that the
> idea
>
> hth
> On Jan 18, 3:37 pm, Andreas <[EMAIL PROTECTED]> wrote:
>
> > Care to elaborate the session part? Didn't get that.
>
> > On Jan 18, 2:38 pm, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > You coul declare a static variable in appModel, and update it from
> > > session in beforeFilter ... just a hint ..
> > > hth
>
> > > On Jan 18, 2:25 pm, Andreas <[EMAIL PROTECTED]> wrote:
>
> > > > Hi
>
> > > > I've been using a variable in my appcontrol that stores what group the
> > > > user belongs to based on previous acl things done in the script. The
> > > > thing is that now I need the information in one of my models for
> > > > validation. Should i store the information in appmodel instead or is
> > > > there any other good solution on this? Is it possible (and a good
> > > > idea?) to store the information in Auth?
>
> > > > Andreas
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Only one register within a given set can be flagged: possible?

2008-01-18 Thread Jaime

Hello bakers!

Imagine this (common) scenario: a photo album that HasMany photos. A
user may select one of them as a "cover" or "default" photo to
illustrate the cover of the album. So a boolean field called "default"
is set in the Photo model. Of course one and only one photo within
that album should have the "default" bit set, because it's non-sense
to flag more than one for the same album.

This leads to some extra logic within the controller in order to unset
all other possibly previously flagged photos before setting the new
one. This is not a big deal nor very important, but is not very
beautiful either, is it?

As the great piece of software CakePHP is, perhaps there is the
possibility to specify within the model that only one register within
a given set can have a boolean field set. Or maybe can be defined
somehow in the MySQL DB.

I hope this is not a too philosophical question :-)

--~--~-~--~~~---~--~~
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: Storing user group in appmodel?

2008-01-18 Thread Andreas

Ah. Understand now. However I don't save it in sessions. But the above
easy to modify for my needs.

Thanks for the help!

Andreas

On Jan 18, 4:12 pm, francky06l <[EMAIL PROTECTED]> wrote:
> Well if you you set in AppModel :
>
> static usergroup = null;
> function store($group)
> {
> self::$usergroup = $group;
>
> }
>
> function getgroup()
> {
>return self::$usergroup;
>
> }
>
> in AppController ( suppoisng you store the group in the Session), you
> can do
>
> function beforeFilter()
> {
> if(isset($this->{$this->modelClass}) /* thank AD for this */
>   $this->{$this->modelClass}->store($this->Session-
>
> >('whereismygroup');
> }
>
> now in any model
>
> $currentgroup= $this->getgroup();
>
> Maybe you have to check values before storing etc ... but that the
> idea
>
> hth
> On Jan 18, 3:37 pm, Andreas <[EMAIL PROTECTED]> wrote:
>
> > Care to elaborate the session part? Didn't get that.
>
> > On Jan 18, 2:38 pm, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > You coul declare a static variable in appModel, and update it from
> > > session in beforeFilter ... just a hint ..
> > > hth
>
> > > On Jan 18, 2:25 pm, Andreas <[EMAIL PROTECTED]> wrote:
>
> > > > Hi
>
> > > > I've been using a variable in my appcontrol that stores what group the
> > > > user belongs to based on previous acl things done in the script. The
> > > > thing is that now I need the information in one of my models for
> > > > validation. Should i store the information in appmodel instead or is
> > > > there any other good solution on this? Is it possible (and a good
> > > > idea?) to store the information in Auth?
>
> > > > Andreas
--~--~-~--~~~---~--~~
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: Complete source code of any project with cakephp

2008-01-18 Thread Daniel Hofstetter

Hi Kishor,

Maybe this article helps you to get started:
http://facebook-developer.net/2007/10/18/building-your-first-facebook-application-with-cakephp/

Good luck!

--
Daniel Hofstetter
http://cakebaker.42dh.com
--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread djiize

http://bin.cakephp.org/view/266619336

Quick test of what I said, you just need to modify User->password
function to your needs.

On 18 jan, 12:45, MrTufty <[EMAIL PROTECTED]> wrote:
> What he said ;)
>
> I've been working with overriding hashPasswords to provide a randomly
> salted sha256 implementation, but my brains leaked out of my ears
> (that'll teach me to code at 3am).
>
> Steve
>
> On Jan 18, 11:30 am, djiize <[EMAIL PROTECTED]> wrote:
>
> > You can already choose your hashing method, see in function
> > Auth::hashPasswords
> > If you define Auth->authenticate variable with the name of an object
> > of your own that definse the function hashPasswords, this function
> > will be called instead of the Auth default one
>
> > If you just want md5 or sha256 instead of sha1, you can define
> > Security->hashType (maybe in bootstrap)
>
> > Thanks to code devs to permits that 2 things ;)
>
> > On 18 jan, 11:47, phpjoy <[EMAIL PROTECTED]> wrote:
>
> > > nate, someone could want to use other hashing methods and not the
> > > default one.
> > > i vote for enabling :)
>
> > > and adding the last crypt component to cake :D
>
> > > On Jan 18, 6:18 am, nate <[EMAIL PROTECTED]> wrote:
>
> > > > No.  Disabling password hashing is Evil with a capital "E".  That's
> > > > why I don't let you do it.
>
> > > > On Jan 17, 11:03 am, dizz <[EMAIL PROTECTED]> wrote:
>
> > > > > Thanks to both of you, I thought of this, but I thought it would be
> > > > > easier to disable the AuthComponent::hashPasswords and then do what
> > > > > Baz did above.
>
> > > > > Anyways thanks again for the help.
>
> > > > > -Andrew
>
> > > > > On Jan 17, 10:45 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > > > > > Yep,
>
> > > > > > Use a different field, eg. new_password or something. (I'm assuming
> > > > > > you're validating when creating a password. No need for login)
>
> > > > > > Here's assuming you have a model called User:
>
> > > > > > // needed for validation for some reason
> > > > > > $this->User->set($this->data);
> > > > > > if ($this->validates($this->data))
> > > > > > {
> > > > > > $this->data['User']['passwd'] =
> > > > > > $this->Auth->password($this->data['User']['new_passwd'] )
>
> > > > > > // all we did was hash passwords, no need to revalidate.
> > > > > > if ($this->save($this->data, false))
> > > > > > {
> > > > > > //do stuff
> > > > > > } else
> > > > > > {
> > > > > > // invalid
> > > > > > }
>
> > > > > > }
>
> > > > > > Would be nice to stick this is beforeSave in the model, but you 
> > > > > > can't
> > > > > > [easily] access the Auth component from the model.
>
> > > > > > Hope this helps.
>
> > > > > > On Jan 17, 2008 9:31 AM, dizz <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Hello,
>
> > > > > > > I am using the auth component and before my model can validate the
> > > > > > > password the auth component already encrypts the password so 
> > > > > > > making it
> > > > > > > impossible to use the between built in valid method.
>
> > > > > > > Is there any work around for this?
--~--~-~--~~~---~--~~
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: Question about Set class

2008-01-18 Thread Fran Iglesias


El 18/01/2008, a las 15:01, grigri escribió:

> debug(Set::extract($temp, '{n}.0.task'));

Thanks. So simple...

> On Jan 18, 1:00 pm, "R. Rajesh Jeba Anbiah"
> <[EMAIL PROTECTED]> wrote:
>>FWIW, when I profiled Set class last time, it was relatively huge
>> hit.
>>

I agree, but performance is not critical at this step of development  
(or even for the final application, we don't expect a huge amount of  
visitors). But I found Set class very useful.

--
Fran Iglesias
[EMAIL PROTECTED]




--~--~-~--~~~---~--~~
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: Storing user group in appmodel?

2008-01-18 Thread Andreas

Care to elaborate the session part? Didn't get that.

On Jan 18, 2:38 pm, francky06l <[EMAIL PROTECTED]> wrote:
> You coul declare a static variable in appModel, and update it from
> session in beforeFilter ... just a hint ..
> hth
>
> On Jan 18, 2:25 pm, Andreas <[EMAIL PROTECTED]> wrote:
>
> > Hi
>
> > I've been using a variable in my appcontrol that stores what group the
> > user belongs to based on previous acl things done in the script. The
> > thing is that now I need the information in one of my models for
> > validation. Should i store the information in appmodel instead or is
> > there any other good solution on this? Is it possible (and a good
> > idea?) to store the information in Auth?
>
> > Andreas
--~--~-~--~~~---~--~~
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: Storing user group in appmodel?

2008-01-18 Thread francky06l

Well if you you set in AppModel :

static usergroup = null;
function store($group)
{
self::$usergroup = $group;
}

function getgroup()
{
   return self::$usergroup;
}

in AppController ( suppoisng you store the group in the Session), you
can do

function beforeFilter()
{
if(isset($this->{$this->modelClass}) /* thank AD for this */
  $this->{$this->modelClass}->store($this->Session-
>('whereismygroup');
}


now in any model

$currentgroup= $this->getgroup();


Maybe you have to check values before storing etc ... but that the
idea

hth
On Jan 18, 3:37 pm, Andreas <[EMAIL PROTECTED]> wrote:
> Care to elaborate the session part? Didn't get that.
>
> On Jan 18, 2:38 pm, francky06l <[EMAIL PROTECTED]> wrote:
>
> > You coul declare a static variable in appModel, and update it from
> > session in beforeFilter ... just a hint ..
> > hth
>
> > On Jan 18, 2:25 pm, Andreas <[EMAIL PROTECTED]> wrote:
>
> > > Hi
>
> > > I've been using a variable in my appcontrol that stores what group the
> > > user belongs to based on previous acl things done in the script. The
> > > thing is that now I need the information in one of my models for
> > > validation. Should i store the information in appmodel instead or is
> > > there any other good solution on this? Is it possible (and a good
> > > idea?) to store the information in Auth?
>
> > > Andreas
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



i18n with DB?

2008-01-18 Thread R. Rajesh Jeba Anbiah

Lot of people/clients prefer to edit the language strings and have
them in DB. As I understand, we cannot use TranslateBehavior to change
the language of the UI; am I mistaken or is there any solution? TIA

--
  
Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Dynamic form validation rules?

2008-01-18 Thread R. Rajesh Jeba Anbiah

I'm searching to see if there is any dynamic form validation
(dynamically change the validation for a particular form field from
admin interface) implemented already. I hope, that is possible with
Behavior; but like to know if any such implementation is already done.
TIA

--
  
Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Dynamic form creation?

2008-01-18 Thread R. Rajesh Jeba Anbiah

Has anyone tried to implement dynamic form creation? I'm looking for a
solution to implement dynamic form creations.

--
  
Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Acl::Allow does not work

2008-01-18 Thread NilsR

Hi all,

When I try to use

$this->Acl->allow($aro['Aro']['id'],$aco['Aco']['id'], $actions);

I get this error: Warning (512): DB_ACL::allow() - Invalid node [CORE/
cake/libs/controller/components/acl.php, line 362]

But these Aro and Aco DO exist. Well then i thought I have to do it
like Acl::check without aliases:

$this->Acl->allow( array( 'model '=> $aco['Aro']['model'],
'foreign_key' => $aco['Aro']['foreign_key']), $aco['Aco']['model'],
$actions);

But now i get an even weirder error:

Missing Database Table
Error: Database table lms_models for model model was not found.

What am i doing wrong here?

Greetings, Nils
--~--~-~--~~~---~--~~
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: More then one view for same action

2008-01-18 Thread Frobozz

http://groups.google.com/group/cake-php/browse_frm/thread/ed7f7e12facfd83b/af42bbf0de33c3a0?#af42bbf0de33c3a0
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



column sorting...

2008-01-18 Thread bhushan A

Is there any class / library available to acieve column sorting in
cake php.? please reply me on [EMAIL PROTECTED]
bhushan
--~--~-~--~~~---~--~~
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: ACLs: ACO and ARO schema.

2008-01-18 Thread RichardAtHome

Thanks Dardo, it's a start :-)

On Jan 18, 12:47 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]>
wrote:
> http://api.cakephp.org/1.2/cake_2libs_2model_2db__acl_8php-source.html
>
> On Jan 18, 2008 8:02 AM, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
>
>
> > Could some kind soul please post (or point to a post of) the models
> > that map to the baked "acos", "aros" and "aros_acos" tables please?
>
> > A minor side note: As these are baked tables, shouldn't bake 'know'
> > about these tables and their relationships automatically or give you
> > an option to bake them models when you bake the tables with initdb?
>
> > Thanks in advance.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Plugin extension in Controller | Customizing app modules

2008-01-18 Thread Bruno Bergher

Okay, this might sound a bit crazy at first, but there's real reasons
for doing this.

We're a design firm that developed a CMS to handle the advanced layout
requirement of our projects. The main thing is being able to build
pages which content fields change in name, amount and type. And that's
really working fine.

The problem is that the rest of the app services (blog, news, product)
need to change from project to project. I mean: for a client's
website, having a blog post with title and body fields is enough, but
another one might need a summary and two picture fields added to that.
What we've being doing to address this requirement is to start a new
project with a basic deploy, common to all projects, and change the DB
tables, models and controllers to fit the need of the client.

The problem is that it starts to become hard to merge back the
improvements we make in one project to the trunk, and then to use it
in another project, because they can be specific and dependent of
certain fields.

So we discussed and came up with the idea of encapsulating the
functionality of each feature in plugins, such as blog, news, catalog,
each with their own models, controllers and basic views, so we could
then extend those base classes into the functionality that is specific
to the project.

Objectively put:

- There's the BaseBlogPostsController which has all the functionality
we need.
- There's the BlogPostsController, which works the same way, but needs
three new methods and to change one of the base methods.

That's simple, isn't it? Basic OOP: just make class
BlogPostsController extends BaseBlogPostsController! (This last one in
the inheritance chain extends AppController)

Not quite so.

I wrote a class and defined a workflow that enables the app classes to
actually extend the base classes, through a singleton a series of
App:import() calls. But there's one problem I just can't figure out,
and here I hope you can help:

Cake only looks for the view for an action in the app/views/
 folder, even if I added the plugin view folder to the
$viewPaths array in bootstrap.php.

I tried in BlogPostsController

function index() {
$this->autoRender = false;
parent::index();
}

but the view that Cake looks for is in the App folder.

And setAction() only accepts a string parameter, so I can't refer to
another class.

Does anyone has any idea?

I hope I was able to explain the problem properly. If not, PLEASE tell
me so and I'll try another way.

Thanks a lot!

--~--~-~--~~~---~--~~
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: i don't know why

2008-01-18 Thread AD7six



On Jan 18, 12:46 pm, MrTufty <[EMAIL PROTECTED]> wrote:
> Indeed AD.
>
> I was just being picky,

Keep it up - I just had a moment of bordom seeing yet another post
without a question in it, and a blatant lack of looking for the
answer.

;)

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



More then one view for same action

2008-01-18 Thread imrankhanjoya

hi
is it possible to have more then one view for the same action of the
controller. just like different layout for the controller we can use.
What i want to know is let us take a example.
if i have a action with name
profile()
with a view profile.thtml
this can we used to
to show the profile to the owner of profile
and to the visitor
we can make some changes on the bases of session value
but i want it another way round i want totally another  view for the
same action
Kindly help me out
sorry for bad english

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



Complete source code of any project with cakephp

2008-01-18 Thread Kishor

Hi folks,

Cakephp is new   for me  I go thr cake manual but i required source
code of  any project build on cake.I downloaded some project from
cakeforge.org  but it not run properly.Also i am facebook developer

i find that myfacebook project on cakeforge.org but no source code
found.Can any one help me where i find source code of above project so
i will dev my facebook application in cake.



thanx

--~--~-~--~~~---~--~~
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: Question about Set class

2008-01-18 Thread grigri

$temp = Array(
 0 => Array
 (
 0 => Array
 (
 'id' => 2,
 'task' => 'Circulares.Preparar'
 )
),
 1 => Array
 (
 0 => Array
 (
 'id' => 5,
 'task' => '*.*'
 )
 )
);

debug(Set::extract($temp, '{n}.0.task'));

// Output:

Array
(
[0] => Circulares.Preparar
[1] => *.*
)

On Jan 18, 1:00 pm, "R. Rajesh Jeba Anbiah"
<[EMAIL PROTECTED]> wrote:
> On Jan 18, 5:01 pm, Fran Iglesias <[EMAIL PROTECTED]> wrote:
>> ?'ve been trying several paths with Set::extract to get it but my
> > best result is with '{n}.{n}.task', which produces
>
> 
>
> FWIW, when I profiled Set class last time, it was relatively huge
> hit.
>
> --
>   
> Email: rrjanbiah-at-Y!comBlog:http://rajeshanbiah.blogspot.com/
--~--~-~--~~~---~--~~
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: dAuth v0.3 [Session losing 'salt' variable]

2008-01-18 Thread volve

Admittedly I gave this post an awfully vague subject so hopefully it
won't be totally dismissed. Upon further investigation I found some
more details.

Simply put: my $this->Session->read('salt'); is always empty when
attemptLogin is called. If I do print_r($this->Session->read()); in
attemptLogin, I only have:

Array
(
[Config] => Array
(
[userAgent] => 7a98565405c4c8c1b17961f9f9edd2fd
[time] => 1200631921
[rand] => 52815838
)

)

But if I do the same print_r from the Users/login action I have:

Array
(
[Config] => Array
(
[userAgent] => 7a98565405c4c8c1b17961f9f9edd2fd
[time] => 1200631921
[rand] => 52815838
)

[salt] => 282191378
)

I'm very confused why the salt is disappearing... :( I basically did a
fresh install of the v0.3 files from bakery.cakephp.org and wanted to
get them all working as-is before customizing (to make sure there was
nothing in my project interfering, I grep'd the entire source tree for
references to 'salt' and only found the new dAuth ones). Obviously
this means "Credentials mismatch" is the only result attemptLogin ever
yields because it can never successfully compare the passwords. I'm
baffled!

Any pointers anyone might have?

Thanks,
-volve


On Jan 17, 10:47 pm, volve <[EMAIL PROTECTED]> wrote:
> Hey all,
>
> I'm trying to get dAuth v0.3 working but am constantly presented with
> "Login failed: Credentials mismatch.". I added a slew of debug output
> to the component and sure enough my password hash and the one
> submitted are completely different.
>
> Some log_debug output from a login attempt:
>
> 2008-01-17 22:37:57 Debug: dAuthComponent attemptLogin...
> 2008-01-17 22:37:57 Debug: clean host...
> 2008-01-17 22:37:57 Debug: username and password present...
> 2008-01-17 22:37:57 Debug: username found in database...
> 2008-01-17 22:37:57 Debug: clear text = false...
> 2008-01-17 22:37:57 Debug: password hash:
> [7025cd2543c0f3a446487c973a124d0b25daa753] submitted hash:
> [fcb55b0e784e713ec1116766ffac3e75a833bcda]
> 2008-01-17 22:37:57 Debug: hashed password compare failed...
>
> Thinking maybe it was some stale user accounts, I went through the
> dAuth Users/register action again and that was successful. I also
> checked my files for copy-n-paste whitespace that might cause header
> issues but couldn't find any.
>
> I realize I may be behind the times on implementing dAuth but I hope
> someone else has resolved this. :)
>
> Thanks!
> -volve
--~--~-~--~~~---~--~~
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: Storing user group in appmodel?

2008-01-18 Thread francky06l

You coul declare a static variable in appModel, and update it from
session in beforeFilter ... just a hint ..
hth

On Jan 18, 2:25 pm, Andreas <[EMAIL PROTECTED]> wrote:
> Hi
>
> I've been using a variable in my appcontrol that stores what group the
> user belongs to based on previous acl things done in the script. The
> thing is that now I need the information in one of my models for
> validation. Should i store the information in appmodel instead or is
> there any other good solution on this? Is it possible (and a good
> idea?) to store the information in Auth?
>
> Andreas
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Storing user group in appmodel?

2008-01-18 Thread Andreas

Hi

I've been using a variable in my appcontrol that stores what group the
user belongs to based on previous acl things done in the script. The
thing is that now I need the information in one of my models for
validation. Should i store the information in appmodel instead or is
there any other good solution on this? Is it possible (and a good
idea?) to store the information in Auth?

Andreas
--~--~-~--~~~---~--~~
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: Question about Set class

2008-01-18 Thread R. Rajesh Jeba Anbiah

On Jan 18, 5:01 pm, Fran Iglesias <[EMAIL PROTECTED]> wrote:
   
> ?'ve been trying several paths with Set::extract to get it but my
> best result is with '{n}.{n}.task', which produces


FWIW, when I profiled Set class last time, it was relatively huge
hit.

--
  
Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/
--~--~-~--~~~---~--~~
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: Is it possible to display two view templates on one function?

2008-01-18 Thread Frobozz

Thanks for good example! I'm just newbie in CakePHP 8-)

On 18 янв, 18:40, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> No, you can render any view you want, even you can render no view.
>
> if ($inGoodMood){
>       $this->render('happy_face');} else {
>
>       $this->render('grumpy_face');
>
> }
>
> 2008/1/18 Frobozz <[EMAIL PROTECTED]>:
>
>
>
> > Since you have to create one view for one controller/action, no? Maybe
> > I'm wrong but I always was thinking that this is paradigm of CakePHP.
>
> > On 18 янв, 15:09, AD7six <[EMAIL PROTECTED]> wrote:
> > > On Jan 18, 10:06 am, Frobozz <[EMAIL PROTECTED]> wrote:
>
> > > > In my opinion it's more correctly to keep one view template that
> > > > contains both view templates and switches between them (so you'll got
> > > > one one view file for controller/action - that is how CakePHP wants
> > > > you to do this).
>
> > > Since when?
--~--~-~--~~~---~--~~
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: i don't know why

2008-01-18 Thread MrTufty

Indeed AD.

I was just being picky, because we see so many requests for help here
which don't give us any clues at all (and in most cases are a _demand_
for help rather than a request).

Steve

On Jan 18, 9:08 am, AD7six <[EMAIL PROTECTED]> wrote:
> On Jan 18, 10:03 am, MrTufty <[EMAIL PROTECTED]> wrote:
>
> > You're not telling us anything about your specific situation, so it's
> > unlikely anyone is going to be particularly helpful.
>
> I feel like being a bit particular :).
>
> My powers are telling me that allenxie should remove cake/ from
> the url - you don't browse to the cake directory. you browse to the
> top folder of the download.
>
> hth,
>
> AD
--~--~-~--~~~---~--~~
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: ACLs: ACO and ARO schema.

2008-01-18 Thread Dardo Sordi Bogado

http://api.cakephp.org/1.2/cake_2libs_2model_2db__acl_8php-source.html

On Jan 18, 2008 8:02 AM, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
> Could some kind soul please post (or point to a post of) the models
> that map to the baked "acos", "aros" and "aros_acos" tables please?
>
> A minor side note: As these are baked tables, shouldn't bake 'know'
> about these tables and their relationships automatically or give you
> an option to bake them models when you bake the tables with initdb?
>
> Thanks in advance.
> >
>

--~--~-~--~~~---~--~~
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: thoughts about elements

2008-01-18 Thread [EMAIL PROTECTED]

I hadn't noticed. I had only checked view->element not controller-
>element.

Thanks for the tip, Andy.


On Jan 18, 10:04 am, AD7six <[EMAIL PROTECTED]> wrote:
> On Jan 18, 9:43 am, "[EMAIL PROTECTED]"
>
> <[EMAIL PROTECTED]> wrote:
> > Hi everyone,
> > I have been thinking a bit about how elements work and how to best
> > make use of them. My starting-point is that I really don't like having
> > to "set" a variable in the controller to get it to the view and then
> > have to also pass it along to the element. This somehow feels
> > redundant to me and I have been pondering the alternatives and which
> > to favor.
>
> > Is there any special reason why elements do not get access to
> > variables set in the view?
>
> They do already 
> see:https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/view/view...
>
> hth,
>
> AD
--~--~-~--~~~---~--~~
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: Is it possible to display two view templates on one function?

2008-01-18 Thread Dardo Sordi Bogado
No, you can render any view you want, even you can render no view.

if ($inGoodMood){
  $this->render('happy_face');
} else {
  $this->render('grumpy_face');
}

2008/1/18 Frobozz <[EMAIL PROTECTED]>:
>
> Since you have to create one view for one controller/action, no? Maybe
> I'm wrong but I always was thinking that this is paradigm of CakePHP.
>
>
> On 18 янв, 15:09, AD7six <[EMAIL PROTECTED]> wrote:
> > On Jan 18, 10:06 am, Frobozz <[EMAIL PROTECTED]> wrote:
> >
> > > In my opinion it's more correctly to keep one view template that
> > > contains both view templates and switches between them (so you'll got
> > > one one view file for controller/action - that is how CakePHP wants
> > > you to do this).
> >
> > Since when?
> >
>

--~--~-~--~~~---~--~~
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: Differing Array structures with HABTM find requests? Multiple Views?

2008-01-18 Thread designvoid

Ok, I have had a good search on filtering HABTM and also found your
earlier post on this, but haven't had any joy getting it working, is
it possible you could give a slightly more detailed example?

I really don't want to get beaten by this as I have pretty much
everything else nailed, I've used BAKE and everything working fine,
and I've redesigned all the pages, even got LDAP and multiple
checkboxes working but its just these little extra bits of
functionality imposed by the interface design that are causing
headaches...

Again, thanks for your time!

toby.

On Jan 18, 9:42 am, designvoid <[EMAIL PROTECTED]> wrote:
> Excellent! Many thanks, I will search for more info on this and
> hopefully solve this!
>
> I had searched the group many times, in fact I read thru the group
> daily at the moment as I'm trying to learn as much as poss, its just
> trick sometimes knowing exactly what to search for as I'm still not
> 100% with specific terminology.
>
> Anyways, thanks again for the tip!! :-)
>
> On Jan 18, 9:37 am, AD7six <[EMAIL PROTECTED]> wrote:
>
> > On Jan 18, 10:29 am, designvoid <[EMAIL PROTECTED]> wrote:
>
> > > Noone able to add any insight to this?
>
> > There is a lot of insight already listed on the frequent discussions
> > page.
>
> > The really really easy solution is to make a model of your join table
> > and call $this->Project->ProjectsTeam->findAll($conditons); in both
> > cases.
>
> > hth,
>
> > AD
--~--~-~--~~~---~--~~
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: Is it possible to display two view templates on one function?

2008-01-18 Thread Frobozz

Since you have to create one view for one controller/action, no? Maybe
I'm wrong but I always was thinking that this is paradigm of CakePHP.

On 18 янв, 15:09, AD7six <[EMAIL PROTECTED]> wrote:
> On Jan 18, 10:06 am, Frobozz <[EMAIL PROTECTED]> wrote:
>
> > In my opinion it's more correctly to keep one view template that
> > contains both view templates and switches between them (so you'll got
> > one one view file for controller/action - that is how CakePHP wants
> > you to do this).
>
> Since when?
--~--~-~--~~~---~--~~
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: afterFind() dillemna - eats memory for breakfast

2008-01-18 Thread the_woodsman

Remember as well you could use an SQL view to achieve things like
this, making your code lots cleaner.
Remember you can also dynamically change the table used by a model, so
you can switch from the real table to the view for particular queries,
then switch back (No idea if that's considered good practice!).

On Jan 18, 9:55 am, grigri <[EMAIL PROTECTED]> wrote:
> Whether using database functions like CONCAT(), or php code, I agree
> it would be nice to handle fields in a simple, easy manner. In a
> project a while ago I was storing a comma-delimited list in a database
> field [I had my reasons] and explode()ing it in afterFind. The
> afterFind code, to handle all possible ways it could be called, was
> pretty horrendous.
>
> It would be cool to have a sort of inverse Model::deconstruct() called
> for each retrieved row, although I suppose you could build that sort
> of functionality with a behavior, and hide all the nasty code inside
> the behavior's afterFind, and put the callback in the model. Hmm...
> sounds like it could work.
>
> On Jan 18, 9:43 am, AD7six <[EMAIL PROTECTED]> wrote:
>
> > On Jan 18, 10:16 am, Flipflops <[EMAIL PROTECTED]> wrote:
>
> > > Hi AD7six
>
> > > I like you answer -  letting the database use CONCAT leaves your code
> > > nice and clean, how exactly are you suggesting to do it though?
>
> > Add it to your field list.
>
> > > Can you append it to the model in some way when you use a built in
> > > method (e.g. findAll)
>
> > Yup. see an example in 
> > here:https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/model/beh...
> > // see how MAX() is used.
>
> > > or were you suggesting creating a custom query
> > > function  in the model and then calling that instead of a built in
> > > method (e.g. $this-->MyModel->MyQuery())
>
> > Nope.
>
> > > I've got a horrible suspicion that I've been writing a whole load of
> > > unnecessary code, or does this only apply to 1.2 (I've only used 1.1
> > > so far).
>
> > I doubt you are alone if that's true - if I don't know what's
> > possible, I go with what works, and then spend ages doing purist code
> > optimizations ;).
>
> > hth,
>
> > AD
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Question about Set class

2008-01-18 Thread Fran Iglesias

Hi

I have this array:

Array
(
 [0] => Array
 (
 [0] => Array
 (
 [id] => 2
 [task] => Circulares.Preparar
 )
)
 [1] => Array
 (
 [0] => Array
 (
 [id] => 5
 [task] => *.*
 )
 )
)

I want to get an array like this

Array {
 [0] => Circulares.preparar
 [1] => *.*
}

?'ve been trying several paths with Set::extract to get it but my  
best result is with '{n}.{n}.task', which produces

Array
(
 [0] => Array
 (
 [0] => Circulares.Preparar
 )

 [1] => Array
 (
 [0] => *.*
 )
)

I would like to know if there is a way to achieve this using the Set  
class or I need to "postproccess" the result.

I've read the API, and http://www.thinkingphp.org/2007/02/24/cake-12s- 
set-class-eats-arrays-for-breakfast/ without success.


TIA
--
Fran Iglesias
[EMAIL PROTECTED]




--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread MrTufty

What he said ;)

I've been working with overriding hashPasswords to provide a randomly
salted sha256 implementation, but my brains leaked out of my ears
(that'll teach me to code at 3am).

Steve

On Jan 18, 11:30 am, djiize <[EMAIL PROTECTED]> wrote:
> You can already choose your hashing method, see in function
> Auth::hashPasswords
> If you define Auth->authenticate variable with the name of an object
> of your own that definse the function hashPasswords, this function
> will be called instead of the Auth default one
>
> If you just want md5 or sha256 instead of sha1, you can define
> Security->hashType (maybe in bootstrap)
>
> Thanks to code devs to permits that 2 things ;)
>
> On 18 jan, 11:47, phpjoy <[EMAIL PROTECTED]> wrote:
>
> > nate, someone could want to use other hashing methods and not the
> > default one.
> > i vote for enabling :)
>
> > and adding the last crypt component to cake :D
>
> > On Jan 18, 6:18 am, nate <[EMAIL PROTECTED]> wrote:
>
> > > No.  Disabling password hashing is Evil with a capital "E".  That's
> > > why I don't let you do it.
>
> > > On Jan 17, 11:03 am, dizz <[EMAIL PROTECTED]> wrote:
>
> > > > Thanks to both of you, I thought of this, but I thought it would be
> > > > easier to disable the AuthComponent::hashPasswords and then do what
> > > > Baz did above.
>
> > > > Anyways thanks again for the help.
>
> > > > -Andrew
>
> > > > On Jan 17, 10:45 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > > > > Yep,
>
> > > > > Use a different field, eg. new_password or something. (I'm assuming
> > > > > you're validating when creating a password. No need for login)
>
> > > > > Here's assuming you have a model called User:
>
> > > > > // needed for validation for some reason
> > > > > $this->User->set($this->data);
> > > > > if ($this->validates($this->data))
> > > > > {
> > > > > $this->data['User']['passwd'] =
> > > > > $this->Auth->password($this->data['User']['new_passwd'] )
>
> > > > > // all we did was hash passwords, no need to revalidate.
> > > > > if ($this->save($this->data, false))
> > > > > {
> > > > > //do stuff
> > > > > } else
> > > > > {
> > > > > // invalid
> > > > > }
>
> > > > > }
>
> > > > > Would be nice to stick this is beforeSave in the model, but you can't
> > > > > [easily] access the Auth component from the model.
>
> > > > > Hope this helps.
>
> > > > > On Jan 17, 2008 9:31 AM, dizz <[EMAIL PROTECTED]> wrote:
>
> > > > > > Hello,
>
> > > > > > I am using the auth component and before my model can validate the
> > > > > > password the auth component already encrypts the password so making 
> > > > > > it
> > > > > > impossible to use the between built in valid method.
>
> > > > > > Is there any work around for this?
--~--~-~--~~~---~--~~
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: Why do I get "No id set for Library::view()"?

2008-01-18 Thread powtac

Other solution:

In my controller after

$this->Library->save($this->data);

I now use

$this->redirect('view/'.$this->Library->getLastInsertId());

to redirect to the view of the saved data...
--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread djiize

You can already choose your hashing method, see in function
Auth::hashPasswords
If you define Auth->authenticate variable with the name of an object
of your own that definse the function hashPasswords, this function
will be called instead of the Auth default one

If you just want md5 or sha256 instead of sha1, you can define
Security->hashType (maybe in bootstrap)

Thanks to code devs to permits that 2 things ;)

On 18 jan, 11:47, phpjoy <[EMAIL PROTECTED]> wrote:
> nate, someone could want to use other hashing methods and not the
> default one.
> i vote for enabling :)
>
> and adding the last crypt component to cake :D
>
> On Jan 18, 6:18 am, nate <[EMAIL PROTECTED]> wrote:
>
> > No.  Disabling password hashing is Evil with a capital "E".  That's
> > why I don't let you do it.
>
> > On Jan 17, 11:03 am, dizz <[EMAIL PROTECTED]> wrote:
>
> > > Thanks to both of you, I thought of this, but I thought it would be
> > > easier to disable the AuthComponent::hashPasswords and then do what
> > > Baz did above.
>
> > > Anyways thanks again for the help.
>
> > > -Andrew
>
> > > On Jan 17, 10:45 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > > > Yep,
>
> > > > Use a different field, eg. new_password or something. (I'm assuming
> > > > you're validating when creating a password. No need for login)
>
> > > > Here's assuming you have a model called User:
>
> > > > // needed for validation for some reason
> > > > $this->User->set($this->data);
> > > > if ($this->validates($this->data))
> > > > {
> > > > $this->data['User']['passwd'] =
> > > > $this->Auth->password($this->data['User']['new_passwd'] )
>
> > > > // all we did was hash passwords, no need to revalidate.
> > > > if ($this->save($this->data, false))
> > > > {
> > > > //do stuff
> > > > } else
> > > > {
> > > > // invalid
> > > > }
>
> > > > }
>
> > > > Would be nice to stick this is beforeSave in the model, but you can't
> > > > [easily] access the Auth component from the model.
>
> > > > Hope this helps.
>
> > > > On Jan 17, 2008 9:31 AM, dizz <[EMAIL PROTECTED]> wrote:
>
> > > > > Hello,
>
> > > > > I am using the auth component and before my model can validate the
> > > > > password the auth component already encrypts the password so making it
> > > > > impossible to use the between built in valid method.
>
> > > > > Is there any work around for this?
--~--~-~--~~~---~--~~
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: Why do I get "No id set for Library::view()"?

2008-01-18 Thread powtac

Found the mistake: I redirected to the "view" controller and it
requires an id!

Fix: redirect to index:

$this->redirect('index');
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Proper way to sanitize all data?

2008-01-18 Thread R. Rajesh Jeba Anbiah

Could anyone suggest the right approach to sanitize user inputs?

Currently having $this->data = Sanitize::clean($this->data) in
AppController. Is there any better option? TIA


--
  
Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Why do I get "No id set for Library::view()"?

2008-01-18 Thread powtac

When I save a new library I recieve this "No id set for
Library::view()" flash message.

The library has 3 database fields:
id, content, timestamp.

But in my controller I only fill content and save it. The field id is
a auto_increment field, so do I have to fill it manually?
--~--~-~--~~~---~--~~
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: Dropdown without using generateList

2008-01-18 Thread krr

That worked! The numeric index was the problem. The values are stored
in db as displayed. Thanks.

On Jan 18, 3:53 pm, grigri <[EMAIL PROTECTED]> wrote:
> How is the event_name stored in the database? As a numeric index or as
> a text field?
>
> The code you've written assumes it's a numeric index (value '2' is
> displayed as 'Anniversary', ...)
>
> If it's a text field then you need to have the same values as display
> fields; the easiest way to do this is:
>
> $event_names = array('Birthday', 'Anniversary', ...);
> $event_names = array_combine($event_names, $event_names);
>
> This corresponds to this more long-winded code:
>
> $event_names = array(
>   'Birthday' => 'Birthday',
>   'Anniversary' => 'Anniversary',
>   ...
> );
>
> On Jan 18, 10:41 am, krr <[EMAIL PROTECTED]> wrote:
>
> > I have an events table which has event_name as one of the fields. The
> > value for this field is restricted (has to be a value from a set of
> > values, like 'Birthday', 'Anniversary', etc). So it is better to have
> > a dropdown instead of textbox in the views (add & edit).
>
> > Since these are not part of any table, I cannot use generateList in
> > the controller. So I used the below code in the controller.
>
> > $event_names = array('1'=>'Birthday', '2'=>'Anniversary', /*... etc...
> > */);
> > $this->set(compact('event_names'));
>
> > I am using the below code for event_name field in the views.
>
> > echo $form->input('event_name');
>
> > This works for add and dropdown appears. But in edit, the dropdown
> > does not automatically select the proper value according to the value
> > of event_name from the database.
>
> > Is there something I am missing?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



ACLs: ACO and ARO schema.

2008-01-18 Thread RichardAtHome

Could some kind soul please post (or point to a post of) the models
that map to the baked "acos", "aros" and "aros_acos" tables please?

A minor side note: As these are baked tables, shouldn't bake 'know'
about these tables and their relationships automatically or give you
an option to bake them models when you bake the tables with initdb?

Thanks in advance.
--~--~-~--~~~---~--~~
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: Dropdown without using generateList

2008-01-18 Thread grigri

How is the event_name stored in the database? As a numeric index or as
a text field?

The code you've written assumes it's a numeric index (value '2' is
displayed as 'Anniversary', ...)

If it's a text field then you need to have the same values as display
fields; the easiest way to do this is:

$event_names = array('Birthday', 'Anniversary', ...);
$event_names = array_combine($event_names, $event_names);

This corresponds to this more long-winded code:

$event_names = array(
  'Birthday' => 'Birthday',
  'Anniversary' => 'Anniversary',
  ...
);

On Jan 18, 10:41 am, krr <[EMAIL PROTECTED]> wrote:
> I have an events table which has event_name as one of the fields. The
> value for this field is restricted (has to be a value from a set of
> values, like 'Birthday', 'Anniversary', etc). So it is better to have
> a dropdown instead of textbox in the views (add & edit).
>
> Since these are not part of any table, I cannot use generateList in
> the controller. So I used the below code in the controller.
>
> $event_names = array('1'=>'Birthday', '2'=>'Anniversary', /*... etc...
> */);
> $this->set(compact('event_names'));
>
> I am using the below code for event_name field in the views.
>
> echo $form->input('event_name');
>
> This works for add and dropdown appears. But in edit, the dropdown
> does not automatically select the proper value according to the value
> of event_name from the database.
>
> Is there something I am missing?
--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread phpjoy

nate, someone could want to use other hashing methods and not the
default one.
i vote for enabling :)

and adding the last crypt component to cake :D

On Jan 18, 6:18 am, nate <[EMAIL PROTECTED]> wrote:
> No.  Disabling password hashing is Evil with a capital "E".  That's
> why I don't let you do it.
>
> On Jan 17, 11:03 am, dizz <[EMAIL PROTECTED]> wrote:
>
> > Thanks to both of you, I thought of this, but I thought it would be
> > easier to disable the AuthComponent::hashPasswords and then do what
> > Baz did above.
>
> > Anyways thanks again for the help.
>
> > -Andrew
>
> > On Jan 17, 10:45 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > > Yep,
>
> > > Use a different field, eg. new_password or something. (I'm assuming
> > > you're validating when creating a password. No need for login)
>
> > > Here's assuming you have a model called User:
>
> > > // needed for validation for some reason
> > > $this->User->set($this->data);
> > > if ($this->validates($this->data))
> > > {
> > > $this->data['User']['passwd'] =
> > > $this->Auth->password($this->data['User']['new_passwd'] )
>
> > > // all we did was hash passwords, no need to revalidate.
> > > if ($this->save($this->data, false))
> > > {
> > > //do stuff
> > > } else
> > > {
> > > // invalid
> > > }
>
> > > }
>
> > > Would be nice to stick this is beforeSave in the model, but you can't
> > > [easily] access the Auth component from the model.
>
> > > Hope this helps.
>
> > > On Jan 17, 2008 9:31 AM, dizz <[EMAIL PROTECTED]> wrote:
>
> > > > Hello,
>
> > > > I am using the auth component and before my model can validate the
> > > > password the auth component already encrypts the password so making it
> > > > impossible to use the between built in valid method.
>
> > > > Is there any work around for this?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Dropdown without using generateList

2008-01-18 Thread krr

I have an events table which has event_name as one of the fields. The
value for this field is restricted (has to be a value from a set of
values, like 'Birthday', 'Anniversary', etc). So it is better to have
a dropdown instead of textbox in the views (add & edit).

Since these are not part of any table, I cannot use generateList in
the controller. So I used the below code in the controller.

$event_names = array('1'=>'Birthday', '2'=>'Anniversary', /*... etc...
*/);
$this->set(compact('event_names'));

I am using the below code for event_name field in the views.

echo $form->input('event_name');


This works for add and dropdown appears. But in edit, the dropdown
does not automatically select the proper value according to the value
of event_name from the database.

Is there something I am missing?

--~--~-~--~~~---~--~~
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: Sharing Session across Different Applications

2008-01-18 Thread Kyo

Thanks Adam. I did the method you suggested and found it very nice,
but I'm having another problem now.
In my case, it works in two different cake applications within one
domain, but it doesn't seem to work in two separate domains.

I did the following:

This does a redirect from siteA.com/blah/index to siteB.com/blah/
index.

// siteA.com

function index() {
if(!$this->Session->check('Test')) {
$this->Session->write('Test', 'Hello, this is only a session
test!');
}
}

function redirectem() {
uses('string');
$this->data['SiteTransfer']['sess_id'] = $this->Session->id();
$this->SiteTransfer->id = String::uuid();
if($this->SiteTransfer->save($this->data)) {
$this->redirect('http://siteB.com/blah/catchem/uuid:'.$this-
>SiteTransfer->id);
}
}

// siteB.com

function beforeFilter() {
if(!empty($this->params['named']['uuid'])) {
$uuid = $this->params['named']['uuid'];
$this->data = $this->SiteTransfer->findById($uuid);
$this->Session->id($this->data['SiteTransfer']['sess_id']);
$this->SiteTransfer->del($uuid);
}
}
function catchem($uuid) {
$this->redirect('/blah/index');
}
function index() {
debug($this->Session->read('Test'));
}

I found that SiteB.com instantiates the session data with the session
ID in beforeFilter successfully;
however, when the page (siteB.com/blah/index) gets rendered
completely, siteB.com creates another session id.
Have I missed something fundamental?



On Jan 17, 6:36 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
> Yes, here is one method of making it more secure.
>
> So have you two sites, siteA.com and siteB.com.
>
> User is browsing siteA.com and you want them transferred to siteB.com
>
> They click a link: eg. siteA.com/blah/redirectem/
>
> In your redirectem method you get the currentsessionid and save it
> into your database (eg. site_transfers) with a uuid (ie. String::uuid)
>
> then you do a redirect to siteB.com/blah/catchem/$uuid
>
> and search your database table for the uuid token and then instantiate
> thesessionwith thesessionid from the db.
>
> Then delete the uuid andsessionid from your site_transfers table.
>
> All done!
>
> On Jan 17, 2:57 pm, Kyo <[EMAIL PROTECTED]> wrote:
>
> > Following your instruction, now i figured out how to share sessions
> > between applications.
> > In my view I appended thesessionID to the link like this:
>
> > $html->link( 'Go to the other application',"http://www.example.com/
> > other_cake/tests/index/sess_id:{$session->id('Test')}");
>
> > On the other application, in the beforeFilter method in my controller:
>
> > function beforeFilter() {
> > $this->Session->id($this->params['named']['sess_id']);
>
> > }
>
> > I appreciate your instruction!
> > Are there any way to make this more secure?
>
> > On 1月16日, 午後10:48, Adam Royle <[EMAIL PROTECTED]> wrote:
>
> > > Yes! When you transfer between applications (I'm guessing you have a
> > > link of some description) append thesessionid onto your querystring
> > > and use $this->Session->id($this->params['url']['sess_id']) on the
> > > other end. There are more secure approaches to this, but you still
> > > need to pass some kind of token so you know your user is really your
> > > user.
>
> > > Adam
>
> > > On Jan 16, 6:58 pm, Kyo <[EMAIL PROTECTED]> wrote:
>
> > > > Yes, I use the same db for both applications.
> > > > When I jump from one cake application to another, they store two
> > > >sessiondata with different IDs.
> > > > Cookie got anything to do with it?
>
> > > > On 1月16日, 午後5:44, AD7six <[EMAIL PROTECTED]> wrote:
>
> > > > > On Jan 16, 6:15 am, Kyo <[EMAIL PROTECTED]> wrote:
>
> > > > > > I currently use two Cake applications (beta 1.2) for my project but
> > > > > > I'm wondering if there is any way to sharesessiondata between those
> > > > > > two applications. Both applications have database sessions.
>
> > > > > Use the same db for both? It's pretty much what db sessions are for.
--~--~-~--~~~---~--~~
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: Problem with Plugins > Controller Missing?

2008-01-18 Thread NilsR

Yeah it was something like that ... but only worked with current
version - my cake folder was more than 1 month old.

Thanks anyway :D

Nils

On 17 Jan., 17:31, MrTufty <[EMAIL PROTECTED]> wrote:
> The problem here is the mismatch between the name of the plugin and
> the default controller name.
>
> For this to work, you need to rename contents_controller.php to
> content_controller.php (and obviously amend the class name within
> that). Additionally the views/contents/ folder needs to be renamed.
>
> That should fix the problem.
>
> Steve
>
> On Jan 17, 11:42 am, NilsR <[EMAIL PROTECTED]> wrote:
>
> > I can't access the default controller of my plugin. Cake tells me,
> > that the controller is missing.
> > My Structure looks like the following:
>
> > app/
> > plugins/
> >         content/
> >                 content_app_controller.php
> >                 content_app_model.php
> >                 controllers/
> >                         contents_controller.php
> >                 models/
> >                         content.php
> >                 views/
> >                         contents/
> >                                 admin_edit.ctp
> >                                 admin_new.ctp
>
> > When i now try to access example.com/contents/index it tells me the
> > controller is missing.
--~--~-~--~~~---~--~~
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: Sessions, Webserivce and Ajax

2008-01-18 Thread lordG

Could you elaborate on this? Which unrelated things?

I traced the issue to the __start function of the Session Component.

function __start(){
if ($this->__started === false) {
if ($this->__bare === 0) {
if (!$this->id() && parent::start()) {
$this->__started = true;
parent::_checkValid();
} else {
$this->__started = parent::start();
}
}
}
return $this->__started;
}

It does not even look at starting the session or checking the
useragent if the $params['bare'] is not 0. In my tests, Setting
Configure::write('Session.checkAgent', false) did not change this.
--~--~-~--~~~---~--~~
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: maybe a bug in findAllThreaded() in version cake-1.2.0.6311-beta

2008-01-18 Thread Chaso

thanks! changeing the line works!

On 18 Jan., 10:50, AD7six <[EMAIL PROTECTED]> wrote:
> On Jan 18, 10:39 am, Chaso <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi!
>
> > the following code works in cake-1.2.0.5875
>
> >$this->Modelname->findAllThreaded(null,null, '`order` ASC');
>
> > but in cake-1.2.0.6311-beta the children are missing in the threaded
> > array (children is empty).
>
> > I did a little further investigation on this: I compared cake/libs/
> > model.php in both mentioned versions and I found out that the problem
> > is the model variable 'alias':
>
> > If i set
>
> >var $alias = 'Modelname';
>
> > in the model class then everything works fine.
> > If I don't state this explicitly Modelname->alias is an empty array
> > (which can't be an array key, as like it is used in __doThread in
> > version cake-1.2.0.6311-beta).
>
> > I hope this is useful for debugging...
>
> > Best Regards,
> > Florian
>
> https://trac.cakephp.org/wiki/bugreport
>
> see bug #3810
--~--~-~--~~~---~--~~
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: afterFind() dillemna - eats memory for breakfast

2008-01-18 Thread grigri

Whether using database functions like CONCAT(), or php code, I agree
it would be nice to handle fields in a simple, easy manner. In a
project a while ago I was storing a comma-delimited list in a database
field [I had my reasons] and explode()ing it in afterFind. The
afterFind code, to handle all possible ways it could be called, was
pretty horrendous.

It would be cool to have a sort of inverse Model::deconstruct() called
for each retrieved row, although I suppose you could build that sort
of functionality with a behavior, and hide all the nasty code inside
the behavior's afterFind, and put the callback in the model. Hmm...
sounds like it could work.

On Jan 18, 9:43 am, AD7six <[EMAIL PROTECTED]> wrote:
> On Jan 18, 10:16 am, Flipflops <[EMAIL PROTECTED]> wrote:
>
> > Hi AD7six
>
> > I like you answer -  letting the database use CONCAT leaves your code
> > nice and clean, how exactly are you suggesting to do it though?
>
> Add it to your field list.
>
> > Can you append it to the model in some way when you use a built in
> > method (e.g. findAll)
>
> Yup. see an example in 
> here:https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/model/beh...
> // see how MAX() is used.
>
> > or were you suggesting creating a custom query
> > function  in the model and then calling that instead of a built in
> > method (e.g. $this-->MyModel->MyQuery())
>
> Nope.
>
> > I've got a horrible suspicion that I've been writing a whole load of
> > unnecessary code, or does this only apply to 1.2 (I've only used 1.1
> > so far).
>
> I doubt you are alone if that's true - if I don't know what's
> possible, I go with what works, and then spend ages doing purist code
> optimizations ;).
>
> hth,
>
> AD
--~--~-~--~~~---~--~~
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: maybe a bug in findAllThreaded() in version cake-1.2.0.6311-beta

2008-01-18 Thread AD7six



On Jan 18, 10:39 am, Chaso <[EMAIL PROTECTED]> wrote:
> Hi!
>
> the following code works in cake-1.2.0.5875
>
>$this->Modelname->findAllThreaded(null,null, '`order` ASC');
>
> but in cake-1.2.0.6311-beta the children are missing in the threaded
> array (children is empty).
>
> I did a little further investigation on this: I compared cake/libs/
> model.php in both mentioned versions and I found out that the problem
> is the model variable 'alias':
>
> If i set
>
>var $alias = 'Modelname';
>
> in the model class then everything works fine.
> If I don't state this explicitly Modelname->alias is an empty array
> (which can't be an array key, as like it is used in __doThread in
> version cake-1.2.0.6311-beta).
>
> I hope this is useful for debugging...
>
> Best Regards,
> Florian

https://trac.cakephp.org/wiki/bugreport

see bug #3810
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



maybe a bug in findAllThreaded() in version cake-1.2.0.6311-beta

2008-01-18 Thread Chaso

Hi!

the following code works in cake-1.2.0.5875

   $this->Modelname->findAllThreaded(null,null, '`order` ASC');

but in cake-1.2.0.6311-beta the children are missing in the threaded
array (children is empty).

I did a little further investigation on this: I compared cake/libs/
model.php in both mentioned versions and I found out that the problem
is the model variable 'alias':

If i set

   var $alias = 'Modelname';

in the model class then everything works fine.
If I don't state this explicitly Modelname->alias is an empty array
(which can't be an array key, as like it is used in __doThread in
version cake-1.2.0.6311-beta).

I hope this is useful for debugging...

Best Regards,
Florian

--~--~-~--~~~---~--~~
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: afterFind() dillemna - eats memory for breakfast

2008-01-18 Thread AD7six



On Jan 18, 10:16 am, Flipflops <[EMAIL PROTECTED]> wrote:
> Hi AD7six
>
> I like you answer -  letting the database use CONCAT leaves your code
> nice and clean, how exactly are you suggesting to do it though?

Add it to your field list.

> Can you append it to the model in some way when you use a built in
> method (e.g. findAll)

Yup. see an example in here: 
https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/model/behaviors/tree.php
// see how MAX() is used.

> or were you suggesting creating a custom query
> function  in the model and then calling that instead of a built in
> method (e.g. $this-->MyModel->MyQuery())

Nope.

> I've got a horrible suspicion that I've been writing a whole load of
> unnecessary code, or does this only apply to 1.2 (I've only used 1.1
> so far).

I doubt you are alone if that's true - if I don't know what's
possible, I go with what works, and then spend ages doing purist code
optimizations ;).

hth,

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



  1   2   >