Re: include another model's view

2007-02-28 Thread AD7six



On Mar 1, 8:45 am, "AD7six" <[EMAIL PROTECTED]> wrote:
> On Mar 1, 12:08 am, "gerbenzomp" <[EMAIL PROTECTED]> wrote:
>
>
>
> > I've been programming in php for years, but I'm relatively new to
> > cake. I must say I am amazed at the ease of use and intuïtivity of the
> > framework! Mostly things just work the way you expect them to, which
> > makes it very easy to work with, and a great pleasure too!
>
> > There's also a lot of good documentation, so most questions I had,
> > were easily answered. Now i want to do something a little more
> > complex, and ran into a problem:
>
> > I want to use Cake's plugin-structure to allow for an extendible set
> > of, well let's call them "menu-widgets" for the navigation-bar of my
> > blog system.
>
> > So each "widget" resides in its own folder within the plugins-folder,
> > and has its own add/edit/delete methods and views.
>
> > But now I want to include the main view (view.thtml) of each widget in
> > the sidebar of my blog. Any ideas on how to do that?
>
> The immediate answer would be to use reqesutAction, the (not really
> slow) answer is to make use of elements. I wrote about a solution to
> this sort of modular design problem on my blog about this only
> yesterday (how ironic).http://www.noswad.me.uk/MiBlog/MiniControllers
>
> HTH,
>
> AD

PS Model's don't have views, but perhpas that was a slip of the keys.


--~--~-~--~~~---~--~~
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: include another model's view

2007-02-28 Thread AD7six



On Mar 1, 12:08 am, "gerbenzomp" <[EMAIL PROTECTED]> wrote:
> I've been programming in php for years, but I'm relatively new to
> cake. I must say I am amazed at the ease of use and intuïtivity of the
> framework! Mostly things just work the way you expect them to, which
> makes it very easy to work with, and a great pleasure too!
>
> There's also a lot of good documentation, so most questions I had,
> were easily answered. Now i want to do something a little more
> complex, and ran into a problem:
>
> I want to use Cake's plugin-structure to allow for an extendible set
> of, well let's call them "menu-widgets" for the navigation-bar of my
> blog system.
>
> So each "widget" resides in its own folder within the plugins-folder,
> and has its own add/edit/delete methods and views.
>
> But now I want to include the main view (view.thtml) of each widget in
> the sidebar of my blog. Any ideas on how to do that?

The immediate answer would be to use reqesutAction, the (not really
slow) answer is to make use of elements. I wrote about a solution to
this sort of modular design problem on my blog about this only
yesterday (how ironic). http://www.noswad.me.uk/MiBlog/MiniControllers

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: newbie: register user

2007-02-28 Thread Mariano Iglesias

That way the logic of how the password is hashed stays on the model side, as
it should (the User model should take care of how data is saved, anyway)

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de Langdon Stevenson
Enviado el: Miércoles, 28 de Febrero de 2007 06:52 p.m.
Para: cake-php@googlegroups.com
Asunto: Re: newbie: register user

Instead of setting

   $this->data['User']['password'] = hash('sha256',$salt.$user.$pass);


--~--~-~--~~~---~--~~
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: findCount SQL errors

2007-02-28 Thread Christopher E. Franklin, Sr.

Well, I got it to work.  For all those who will run into this problem
in the future, this is what I gathered.

When you are using HABTM, it is very tricky to make manual saving of
data successful.  After you do it once, it seems to make sense

With my data variables set for my classifieds, all that was left was
to save the information into the join tables.

Here is what I added:

$this->data['Edition']['Edition']['id'] = (string)$ad->editions;
$this->data['Category']['Category']['id'] = (string)$ad->class;

I do not set these to the xmlID because, cake is smart enough to know
that the id of the classified ad was already in the first array above
these two.
The way I have my join tables set up should be obvious but, here it
is:

classifieds_editions
-classified_id
-edition_id

categories_classifieds
-category_id
-classified_id

So, if you follow the naming convention to the "T", it will work out
in the end.

Cake says:
I have a classified array and I have a classified table, insert this
stuff but, I see that we have an edition array and it is Edition/
Edition so this is a join table.  The join table I am looking for
would be classifieds_editions since I already have a classified
array.  So, the id for editions is being set, so that would be
editions_id, now let me grab the id for the array that I have already
which would be classified_id.  Oh, look, I have another array called
category.  It's naming convention is Category/Category so, I already
have classified.  Which comes first in the alphabet soup?  Category
does so, the table I am looking for is categories_classifieds.  So, I
have the id for classifieds so, now I just need an id for category.
Oh, there it is in Category/Category/id.  /insert /wash hands /repeat

The array that is being passed looks like this:
Array {
  [Classified] => Array {
[id] => '1'
[...]
  }

[Edition] => Array {
   [Edition] => Array {
[id] => 'B,E,I,N,Y'
  }
}

[Category] => Array {
  [Category] => Array {
[id] => '0650'
  }
}
}

Very neat stuff.  I can't stress enough following the naming
conventions.  If you are having any problems, this would be the very
first place I would start looking.

My final code for this function looks like this:

function classified_xml(){
// Perform these actions if a file was actually uploaded
if (!empty($this->params['form']) && is_uploaded_file($this-
>params['form']['File']['tmp_name'])){
move_uploaded_file($this->params['form']['File']
['tmp_name'], "/var/www/localhost/htdocs/app/tmp/".$this-
>params['form']['File']['name']);
$this->xml_data = $this->AdminTool->parse_classified("/var/
www/localhost/htdocs/app/tmp/".$this->params['form']['File']['name'],
$this->params['form']['File']['size']);
$this->xml_data = $this->AdminTool->fix_editions($this-
>xml_data);
$this->xml_data = $this->AdminTool->fix_dates($this-
>xml_data);
$this->xml_data = $this->AdminTool->fix_pictures($this-
>xml_data);
$this->xml_data = $this->AdminTool->fix_text($this-
>xml_data);
$this->Classified->recursive = 0;
$this->Classified->findAll();
$this->xmlID = $this->Classified->getNumRows();
++$this->xmlID;
$this->MrClean = new Sanitize();
foreach($this->xml_data as $ad){
$this->matchResult = $this->Classified-
>findCount("Classified.text = '".
addslashes($ad->text)."' AND Classified.editions = '$ad-
>editions' AND Classified.category = '$ad->class'");
if($this->matchResult == 0){
$this->data['Classified']['id'] = 
(integer)$this->xmlID;
$this->data['Classified']['itemno'] = (integer)$ad-
>itemno;
$this->data['Classified']['acctcode'] = (string)$ad-
>acctcode;
$this->data['Classified']['category'] = (string)$ad-
>class;
$this->data['Classified']['table'] = $ad->table;
$this->data['Classified']['start'] = $ad->start;
$this->data['Classified']['end'] = $ad->end;
$this->data['Classified']['editions'] = (string)$ad-
>editions;
$this->data['Classified']['specials'] = (string)$ad-
>specials;
$this->data['Classified']['dispname'] = (string)$ad-
>dispname;
$this->data['Classified']['dispnote'] = (string)$ad-
>dispnote;
$this->data['Classified']['disptag'] = (string)$ad-
>disptag;
$this->data['Classified']['dispcols'] = 
(integer)$ad-
>dispcols;
$this->data['Classified']['text'] = $ad->text;
$this->data['Edition']['Edition']['id'] = 
(string)$ad-
>editions;
$this->data['Category']['Category']['id'] = 
(s

Re: error: Call to a member function requestAction() on a non-object

2007-02-28 Thread phirschybar

ahh. Thanks for the info.. makes sense.

On Feb 28, 8:49 pm, "Samuel DeVore" <[EMAIL PROTECTED]> wrote:
> requestAction is a method of Controller not Model
>
> try
>
> $this->requestAction(...
>
> seehttp://api.cakephp.org/class_object.html#c40a38b60a3748b9cf75215b92ee...
> andhttp://manual.cakephp.org/chapter/controllers
>
> On 2/28/07, phirschybar <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > I am trying to make it so that some data to an element is present on
> > EVERY page on my entire app. So, to do this I made an
> > app_controller.php in /app and I have the following:
>
> > class AppController extends Controller {
>
> > function beforeFilter() { // grab all of the categories.
>
> > $this->set('navItems', 
> > $this->Category->requestAction('/categories/
> > getCategoryList', array('return'=>1)));
>
> > }
> > }
>
> > The problem is that I am getting the above error: Call to a member
> > function requestAction() on a non-object. This seems to indicate that
> > there is an issue with my model as it is not registering as an object
> > however. My Category model seems to be intact. I tested it by sending
> > my browser to '/categories/' and '/categories/getCategoryList' with
> > success using a controller and view.
>
> > Model for category.php, simple:
>
> > class Category extends AppModel{
>
> > var $name = 'Category';
>
> > }
>
> > I am using cake 1.2 .. I must be missing something obvious.
>
> --
> ==
> S. DeVore
> (the old fart) the advice is free, the lack of crankiness will cost you
>
> - its a fine line between a real question and an idiot


--~--~-~--~~~---~--~~
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: Help Using Date Range with findAll

2007-02-28 Thread BlenderStyle

I figured it out. I did this:
$conditions[]['Post.created'] = '>= 2007-02-01';
$conditions[]['Post.created'] = '<= 2007-02-28';
$this->Post->find($conditions);

It seems the complex conditions section in the model chapter in the
CakePHP Manual was wrong. It seems as Cake continues, the manual just
seems older and older. Oh well, Cake still rocks.

On Feb 28, 4:13 pm, "BlenderStyle" <[EMAIL PROTECTED]> wrote:
> It's worth noting that this isn't working either:
> $conditions['Post.id'] = array('>= 1', '<= 10');
> $this->Post->findAll($conditions);
>
> I think I don't understand how Cake deals with these ranges.
>
> On Feb 28, 4:10 pm, "BlenderStyle" <[EMAIL PROTECTED]> wrote:
>
> > I'm trying to find all Posts within a given range of dates (the month
> > of February 2007 in this example), and I can't figure it out.
>
> > This isn't returning any results:
> > $conditions['Post.created'] = array('>= 2007-02-01', '<= 2007-02-28');
> > $this->Post->findAll($conditions);
>
> > The strange part is that this works:
> > $conditions['Post.created'] = '>= 2007-02-01';
> > $this->Post->findAll($conditions);
>
> > And so does this:
> > $conditions['Post.created'] = '<= 2007-02-31';
> > $this->Post->findAll($conditions);
>
> > And so does this, assuming that posts exist on both those days, and it
> > only returns posts on those days:
> > $conditions['Post.created'] = array('2007-02-01', 2007-02-31');
> > $this->Post->findAll($conditions);
>
> > It also works if I query the database directly like this:
> > select * from posts where created >= '2007-02-01' && created <=
> > '2007-02-31';
>
> > Am I missing somthing? Why isn't this working?


--~--~-~--~~~---~--~~
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: Help Using Date Range with findAll

2007-02-28 Thread BlenderStyle

I figured it out. I did this:
$conditions[]['Post.created'] = '>= 2007-02-01';
$conditions[]['Post.created'] = '<= 2007-02-28';
$this->Post->find($conditions);

It seems the complex conditions section in the model chapter in the
CakePHP Manual was wrong. It seems as Cake continues, the manual just
seems older and older. Oh well, Cake still rocks.

On Feb 28, 4:13 pm, "BlenderStyle" <[EMAIL PROTECTED]> wrote:
> It's worth noting that this isn't working either:
> $conditions['Post.id'] = array('>= 1', '<= 10');
> $this->Post->findAll($conditions);
>
> I think I don't understand how Cake deals with these ranges.
>
> On Feb 28, 4:10 pm, "BlenderStyle" <[EMAIL PROTECTED]> wrote:
>
> > I'm trying to find all Posts within a given range of dates (the month
> > of February 2007 in this example), and I can't figure it out.
>
> > This isn't returning any results:
> > $conditions['Post.created'] = array('>= 2007-02-01', '<= 2007-02-28');
> > $this->Post->findAll($conditions);
>
> > The strange part is that this works:
> > $conditions['Post.created'] = '>= 2007-02-01';
> > $this->Post->findAll($conditions);
>
> > And so does this:
> > $conditions['Post.created'] = '<= 2007-02-31';
> > $this->Post->findAll($conditions);
>
> > And so does this, assuming that posts exist on both those days, and it
> > only returns posts on those days:
> > $conditions['Post.created'] = array('2007-02-01', 2007-02-31');
> > $this->Post->findAll($conditions);
>
> > It also works if I query the database directly like this:
> > select * from posts where created >= '2007-02-01' && created <=
> > '2007-02-31';
>
> > Am I missing somthing? Why isn't this working?


--~--~-~--~~~---~--~~
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: Switch Element On/Off

2007-02-28 Thread scragz

Includes with parts of layouts are elements. Other way is probably
better though.

On Feb 28, 1:49 pm, "phirschybar" <[EMAIL PROTECTED]> wrote:
> scragz: that sounds silly unless there is a slick way of doing
> 'includes' with parts of layouts. In your case I would be repeating a
> lot of layout code.
>
> GreyCells: thats exactly what I ended up doing. In my controller, I
> set a boolean and then just did a simple check for it in the view
> before rendering the element. I guess I could have also rendered the
> element and did the check inside of that but why bother including an
> extra file on every hit.. right?
>
> Thanks for the advice, guys.
>
> Ben
>
> On Feb 28, 4:01 pm, "GreyCells" <[EMAIL PROTECTED]> wrote:
>
> > Determine the business logic in the controller and use controller->set
> > to communicate the decisions to the views/elements.
>
> > Don't get too hung up on strict seperation of M->V->C there's plenty
> > of grey across the boundaries... A pragmatic approach if generally
> > more productive :)
>
> > Interesting discussion here:
>
> >http://groups.google.com/group/cake-php/browse_thread/thread/77860241...
>
> > ~GreyCells
>
> > On Feb 28, 7:44 pm, "phirschybar" <[EMAIL PROTECTED]> wrote:
>
> > > Hey all..
>
> > > What if I have an element and I want to switch it on for some pages
> > > and off for others?
>
> > > I could easily pass it some data and do the logic to determine if it
> > > should be shown right within the element itself or even in the default
> > > layout but then I would have business logic right in the views,
> > > violating MVC...
>
> > > How can I do the logic in the controller where it should be and only
> > > call the element from there?


--~--~-~--~~~---~--~~
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: error: Call to a member function requestAction() on a non-object

2007-02-28 Thread Samuel DeVore

requestAction is a method of Controller not Model

try

$this->requestAction(...

see http://api.cakephp.org/class_object.html#c40a38b60a3748b9cf75215b92ee3db1
and http://manual.cakephp.org/chapter/controllers

On 2/28/07, phirschybar <[EMAIL PROTECTED]> wrote:
>
> I am trying to make it so that some data to an element is present on
> EVERY page on my entire app. So, to do this I made an
> app_controller.php in /app and I have the following:
>
> class AppController extends Controller {
>
> function beforeFilter() { // grab all of the categories.
>
> $this->set('navItems', 
> $this->Category->requestAction('/categories/
> getCategoryList', array('return'=>1)));
>
> }
> }
>
> The problem is that I am getting the above error: Call to a member
> function requestAction() on a non-object. This seems to indicate that
> there is an issue with my model as it is not registering as an object
> however. My Category model seems to be intact. I tested it by sending
> my browser to '/categories/' and '/categories/getCategoryList' with
> success using a controller and view.
>
> Model for category.php, simple:
>
> class Category extends AppModel{
>
> var $name = 'Category';
>
> }
>
> I am using cake 1.2 .. I must be missing something obvious.
>
>
> >
>


-- 
==
S. DeVore
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

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



error: Call to a member function requestAction() on a non-object

2007-02-28 Thread phirschybar

I am trying to make it so that some data to an element is present on
EVERY page on my entire app. So, to do this I made an
app_controller.php in /app and I have the following:

class AppController extends Controller {

function beforeFilter() { // grab all of the categories.

$this->set('navItems', 
$this->Category->requestAction('/categories/
getCategoryList', array('return'=>1)));

}
}

The problem is that I am getting the above error: Call to a member
function requestAction() on a non-object. This seems to indicate that
there is an issue with my model as it is not registering as an object
however. My Category model seems to be intact. I tested it by sending
my browser to '/categories/' and '/categories/getCategoryList' with
success using a controller and view.

Model for category.php, simple:

class Category extends AppModel{

var $name = 'Category';

}

I am using cake 1.2 .. I must be missing something obvious.


--~--~-~--~~~---~--~~
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: Status of CakePHP 1.2.x.x

2007-02-28 Thread CraZyLeGs

http://en.wikipedia.org/wiki/Beta_version#Alpha

On Feb 28, 1:52 am, "Samuel DeVore" <[EMAIL PROTECTED]> wrote:
> don't you mean when it's done 'baking'  ;)  after all no one wants a
> partially raw cake.  Although licking the spoon (playing with the
> early alphas) does have it's rewards...
>
> On 2/27/07, nate <[EMAIL PROTECTED]> wrote:
>
>
>
> > Yeah, when it's done.
>
> > On Feb 27, 2:48 pm, "Mech7" <[EMAIL PROTECTED]> wrote:
> > > When is the ETA for 1.2 rc or stable ? or is it done when it's done :)
>
> --
> ==
> S. DeVore
> (the old fart) the advice is free, the lack of crankiness will cost you
>
> - its a fine line between a real question and an idiot


--~--~-~--~~~---~--~~
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: Integrating phpGACL with CakePHP

2007-02-28 Thread Mariano Iglesias

Update: still working on this (component is already over 900 lines,
including documentation, which is about 70% of the code). 

When the component runs for the first time it will set up PhpGacl database
schema (so there's no need to do anything other than just include phpGacl on
your vendors directory, and then adding PhpGacl as a component to your
controller), and create AXO groups/AXO objects for each controller/action
(see at the bottom of this message)

Let me give you a quick view on how you programmatically manipulate your ACL
data:

// Add groups

$this->PhpGacl->saveGroup(1, 'my group #1 with ID 1');
$this->PhpGacl->saveGroup(2, 'my group #1 with ID 2');

// Modify group

$this->PhpGacl->saveGroup(2, 'my group #1 with ID 2 with new name');

// Get groups

$groups = $this->PhpGacl->getGroups();

/*
 This gets you a threaded array like:

Array
(
[0] => Array
(
[id] => authenticated
[name] => Authenticated
)

[1] => Array
(
[id] => 2
[name] => my group #1
)

[2] => Array
(
[id] => 3
[name] => my group #2
[children] => Array
(
[0] => Array
(
[id] => 5
[name] => my group #2.1
)

)

)

[3] => Array
(
[id] => 4
[name] => my group #3
)

)
*/

// Add user:

$this->PhpGacl->saveUser(1, 'mariano.iglesias');

// Modify user:

$this->PhpGacl->saveUser(1, 'mariano.iglesias (new)');

// Assign groups to user:

$this->PhpGacl->assign(1, array(1, 2));

// Get user groups:

$this->PhpGacl->getUserGroups(1);

/*
 * This gets you an array like:
 * 
 * Array
 * (
 *[0] => 1,
 *[1] => 2,
 *[2] => authenticated
 * )
 */

// Change user group assignments:

$this->PhpGacl->assign(1, array(2, 'authenticated'));

/*
 * After which the previous assigned group #1 will be un-assigned, #2
 * will remain assigned, and 'authenticated' will be added to the assignment
 */

// Delete group (and related data):

$this->PhpGacl->delGroup(3);

/*
 * By default if the group has children, they will be added as children
 * of this group's parent. But if you call it like:
 *
 * $this->PhpGacl->delGroup(3, false);
 *
 * Then the children will also be deleted.
 *
 * Naturally deleting a group means that assignments with this group are
 * also removed
 */

// Delete user (and related data):

$this->PhpGacl->delUser(1);

// Add controller and its actions as AXO objects:

$this->PhpGacl->saveController('Posts');

/* 
 * It creates an AXO group called Posts, and assigned to them
 * one AXO object per action.
 *
 * If the controller was already added, only new actions are
 * added
 */

Next step I'm working on is the assignment of rules between group ->
controller/action, and user -> controller/action.

After that wrap phpGACL check, set up a few things, and then release the
first version (without the plugin to manipulate data via GUI)

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


--~--~-~--~~~---~--~~
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: Help Using Date Range with findAll

2007-02-28 Thread BlenderStyle

It's worth noting that this isn't working either:
$conditions['Post.id'] = array('>= 1', '<= 10');
$this->Post->findAll($conditions);

I think I don't understand how Cake deals with these ranges.

On Feb 28, 4:10 pm, "BlenderStyle" <[EMAIL PROTECTED]> wrote:
> I'm trying to find all Posts within a given range of dates (the month
> of February 2007 in this example), and I can't figure it out.
>
> This isn't returning any results:
> $conditions['Post.created'] = array('>= 2007-02-01', '<= 2007-02-28');
> $this->Post->findAll($conditions);
>
> The strange part is that this works:
> $conditions['Post.created'] = '>= 2007-02-01';
> $this->Post->findAll($conditions);
>
> And so does this:
> $conditions['Post.created'] = '<= 2007-02-31';
> $this->Post->findAll($conditions);
>
> And so does this, assuming that posts exist on both those days, and it
> only returns posts on those days:
> $conditions['Post.created'] = array('2007-02-01', 2007-02-31');
> $this->Post->findAll($conditions);
>
> It also works if I query the database directly like this:
> select * from posts where created >= '2007-02-01' && created <=
> '2007-02-31';
>
> Am I missing somthing? Why isn't this working?


--~--~-~--~~~---~--~~
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: newbie: register user

2007-02-28 Thread Mariano Iglesias

Or a more clean way would be to change it on the beforeSave() of the model.
And then if you build queries to find the user using user / password, just
set a findByUserAndPassword method on the model where you take the plain
password as parameter, and hash it before doing the find.

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar

-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de Langdon Stevenson
Enviado el: Miércoles, 28 de Febrero de 2007 06:52 p.m.
Para: cake-php@googlegroups.com
Asunto: Re: newbie: register user

Instead of setting

   $this->data['User']['password'] = hash('sha256',$salt.$user.$pass);

Why not do this:

   $newUser = $this->data['User'];
   $newUser['password'] = hash('sha256',$salt.$user.$pass);

   if($this->User->save($newUser)) { ...

That way the original data is unchanged.  Or you could just set the 
password to null if the save fails.  Meaning that the user has to 
re-enter the password, which seems to be a fairly typical way of doing 
things.  It also reduces the number of times that the password is 
whizzing around on the Internet.


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



include another model's view

2007-02-28 Thread gerbenzomp

I've been programming in php for years, but I'm relatively new to
cake. I must say I am amazed at the ease of use and intuïtivity of the
framework! Mostly things just work the way you expect them to, which
makes it very easy to work with, and a great pleasure too!

There's also a lot of good documentation, so most questions I had,
were easily answered. Now i want to do something a little more
complex, and ran into a problem:

I want to use Cake's plugin-structure to allow for an extendible set
of, well let's call them "menu-widgets" for the navigation-bar of my
blog system.

So each "widget" resides in its own folder within the plugins-folder,
and has its own add/edit/delete methods and views.

But now I want to include the main view (view.thtml) of each widget in
the sidebar of my blog. Any ideas on how to do that?

Thanks,

Gerben from The Netherlands


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

2007-02-28 Thread codecowboy

How do you build an array of checkboxes?


--~--~-~--~~~---~--~~
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: New Auth component asking for login on every page :(

2007-02-28 Thread joradom

you have to set up the Auth object with the allowed actions in your
controller:

i.e. in my users_controller

function beforeFilter() {
$this->Auth->userModel = 'User';
$this->Auth->sessionKey = 'My';
$this->Auth->loginRedirect = '/users/index';
$this->Auth->allowedActions = array('index', 'register',
'logout','login');
}

there is a set function wich takes an array as argument, surely a
better way to setup your object.

I'm not sure if it is better to have a call to Auth in each controller
or put it in the app_controller, may depend on your application i
guess.

Hope this helps, because I'm struggling too with this component and
these are just experiments, not good code :)


On 27 feb, 17:08, "Digital Spaghetti"
<[EMAIL PROTECTED]> wrote:
> Hey guys,
>
> I'm reasonably new to CakePHP, really only had a play about with it so
> far but I am ready to take it to the next level.
>
> The first thing I am building into my app is the user system, so users
> can log in and get access to specific areas.  I've decided to go with
> 1.2.x.x branch since it has the new Auth component but I've come
> across problems already.
>
> In my AppController class, I have added the Auth component, but now
> every page I look at, it's asking me to log in as a user (via /users/
> login as the default in Auth), but of course I don't want this on
> every page, only pages that are under admin.
>
> Can anyone direct me the proper usage of this component, as it's not
> well documented yet (at least to a level I can read) and how to only
> have it ask for login on certain controller functions (like /admin/
> posts/add for example).
>
> Tane


--~--~-~--~~~---~--~~
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: newbie: register user

2007-02-28 Thread Langdon Stevenson

Hi cbmeeks

> Below is my function to register a new user.  In the function, you
> will notice that I attempt to sha256 the password to store in the
> database.  Works great.
> 
> However, just before the data is saved, the password box gets the new
> sha256-ed password.  In other words, if there is an error saving, you
> can actually SEE the sha256 password.  Which would mean that a user
> might not catch that and re-submit which would pass their password in
> as the new sha256 password.

Instead of setting

   $this->data['User']['password'] = hash('sha256',$salt.$user.$pass);

Why not do this:

   $newUser = $this->data['User'];
   $newUser['password'] = hash('sha256',$salt.$user.$pass);

   if($this->User->save($newUser)) { ...

That way the original data is unchanged.  Or you could just set the 
password to null if the save fails.  Meaning that the user has to 
re-enter the password, which seems to be a fairly typical way of doing 
things.  It also reduces the number of times that the password is 
whizzing around on the Internet.

Regards,
Langdon

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

2007-02-28 Thread codecowboy

Hi Dan,

You might want to use the html helper.  I believe that you should be
using id="data..." as opposed to name="data..." but the helper will
take care of that.  I'm assuming that the relationship is a has_many.
In which case you should check out the models chapter of the cake
manual.  See the "Saving Related Model Data" section.  Its near the
bottom of the chapter.

I created an action and view to test some things out.  Here they are:

function temp(){
if(empty($this->data)){
$this->render();
exit();
}
else{
print_r($this->data);
}
}

===view===


checkbox('Tag/Tag', 'check1', array('multiple' =>
'multiple', 'value'=>'1'))); ?>
checkbox('Tag/Tag', 'check2', array('multiple' =>
'multiple', 'value'=>'2'))); ?>
checkbox('Tag/Tag', 'check3', array('multiple' =>
'multiple', 'value'=>'3'))); ?>
checkbox('Tag/Tag', 'check4', array('multiple' =>
'multiple', 'value'=>'4'))); ?>
checkbox('Tag/Tag', 'check5', array('multiple' =>
'multiple', 'value'=>'5'))); ?>
checkbox('Tag/Tag', 'check6', array('multiple' =>
'multiple', 'value'=>'6'))); ?>
selectTag('Tag/Tag',
array('1'=>'one','2'=>'two','3'=>'three'), null, array('multiple' =>
'multiple'))); ?>
submit('Login'); ?>


You can then fool around with the form submissions to see what the
data array looks like.  For some reason, the checkboxes to do not work
like the select box does.  I do know a hack to make the select boxes
work but I want to see if this leads anywhere or if any other people
can add comments.

I haven't specifically run into this problem yet so I am interested to
see what you find out.  Please let me know what happens.

Later,

Guy


--~--~-~--~~~---~--~~
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: Switch Element On/Off

2007-02-28 Thread phirschybar

scragz: that sounds silly unless there is a slick way of doing
'includes' with parts of layouts. In your case I would be repeating a
lot of layout code.

GreyCells: thats exactly what I ended up doing. In my controller, I
set a boolean and then just did a simple check for it in the view
before rendering the element. I guess I could have also rendered the
element and did the check inside of that but why bother including an
extra file on every hit.. right?

Thanks for the advice, guys.

Ben

On Feb 28, 4:01 pm, "GreyCells" <[EMAIL PROTECTED]> wrote:
> Determine the business logic in the controller and use controller->set
> to communicate the decisions to the views/elements.
>
> Don't get too hung up on strict seperation of M->V->C there's plenty
> of grey across the boundaries... A pragmatic approach if generally
> more productive :)
>
> Interesting discussion here:
>
> http://groups.google.com/group/cake-php/browse_thread/thread/77860241...
>
> ~GreyCells
>
> On Feb 28, 7:44 pm, "phirschybar" <[EMAIL PROTECTED]> wrote:
>
> > Hey all..
>
> > What if I have an element and I want to switch it on for some pages
> > and off for others?
>
> > I could easily pass it some data and do the logic to determine if it
> > should be shown right within the element itself or even in the default
> > layout but then I would have business logic right in the views,
> > violating MVC...
>
> > How can I do the logic in the controller where it should be and only
> > call the element from there?


--~--~-~--~~~---~--~~
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: Include Js file in layouts

2007-02-28 Thread GreyCells

Hi CraZyLeGs

The HeadHelper /functionality/ is now in the core - not the code
itself.

Put: $javascript->link(array('jquery.js', app.js), false); in your
view.ctp and e($scripts_for_layout); in the head section of your
layout.ctp and you get the same functionality as HeadHelper. (Note the
second arg 'false' on $javascript->link).

~GreyCells


On Feb 21, 9:51 am, "CraZyLeGs" <[EMAIL PROTECTED]> wrote:
> The head helper isn't part of the  core.
> it was written by rossoft and it's available in his blog
>
> On Feb 20, 9:33 am, "GreyCells" <[EMAIL PROTECTED]> wrote:
>
> > If you're using 1.2, then take a look here:
>
> >http://cake.insertdesignhere.com/posts/view/17
>
> > The HeadHelper functionality is implemented in the core.
>
> > ~GreyCells
>
> > On Feb 20, 8:07 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > > I want to include javascript file in layout.It is possible? if it is,
> > > how to include javascript file.
>
> > > If i include like this
>
> > > app/views/layouts/index.thtml
>
> > > 
> > > Untitled-1
> > > 
> > > 
>
> > > 
>
> > > it is not working.


--~--~-~--~~~---~--~~
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: newbie: register user

2007-02-28 Thread [EMAIL PROTECTED]

I haven't tried this, but it should work.  Change your code to

else
{
   $this->data['User']['password'] = $pass;
   $this->Session-setFlash('Please correct errors below.');
}

or its typical to empty out any password fields on errors, but that's
up to you.

Scott


I think you can change

if($this->User->save($this->data))
{
   $this->Session->setFlash('Thank you for registering!');
   $this->redirect('/users/index');
}

On Feb 28, 9:24 am, "cbmeeks" <[EMAIL PROTECTED]> wrote:
> Below is my function to register a new user.  In the function, you
> will notice that I attempt to sha256 the password to store in the
> database.  Works great.
>
> However, just before the data is saved, the password box gets the new
> sha256-ed password.  In other words, if there is an error saving, you
> can actually SEE the sha256 password.  Which would mean that a user
> might not catch that and re-submit which would pass their password in
> as the new sha256 password.  Hope that makes sense.
>
> I know which line is doing it.  What I am asking is for a more elegant
> way.  How would you guys change this function?
>
> Thanks!
>
> function register()
> {
> if(empty($this->data))
> {
> $this->render();
> }
> else
> {
> $this->cleanUpFields();
>
> 
> if($this->User->findByUsername($this->data['User']['username']))
> {
> $this->Session->setFlash('ERROR: User 
> already exists.');
> $this->redirect('/users/register');
> }
> else
> {
> // sha256 the pass
> $salt = "SOMESALTVALUE";
> $user = 
> $this->data['User']['username'];
> $pass = 
> $this->data['User']['password'];
> $this->data['User']['password'] = 
> hash('sha256',$salt.$user.
> $pass);
>
> if($this->User->save($this->data))
> {
> 
> $this->Session->setFlash('Thank you for registering!');
> 
> $this->redirect('/users/index');
> }
> else
> {
> 
> $this->Session->setFlash('Please correct errors below.');
> }
> }
> }
> }


--~--~-~--~~~---~--~~
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: show page from tree with a for loop

2007-02-28 Thread Oneill

Is it difficult? I have a link for the threadedlists I use to put my
menu together... http://bakery.cakephp.org/articles/view/63

On 28 feb, 15:36, "Oneill" <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I am busy with my nodes controller... I forwarded each routing to
> nodes_controller -> show.
> Now I have my nodes table structure with a id, name, parent_id and
> url. The url is just the name which it should be accessible in the
> browser. Like about_us.
>
> Now you can see the parent_id is for the three effect which can go on
> eternaly. If want to add a subnode to about_us with the url name
> 'contactinfo'. I don't want to put about_us/contactinfo in the
> database because i have an tree script which haves a drag and drop
> function. And thats based on the parent_id.
>
> So I am looking for an FOR loop which cuts the requested url into
> parts like this:
> $mylink=$sanit->sql(substr($_SERVER['QUERY_STRING'], 4));
> $parts = explode('/', $mylink);
>
> Now i would like to do the for loop which looks into the database if
> it can find the requested parts in the RIGHT follow ups. Has somebody
> an Idea how I should do that?
>
> Greetz,


--~--~-~--~~~---~--~~
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: Please help me understand URL and Routes in Cake

2007-02-28 Thread John


> So, I'd like to have the following URLs
> /units- for a view showing a table of multiple units
> /units/- for a view of the single unit (no, I don't
> want to use the action in the URL like /units/view/, I'd
> like to keep this one as short and simple as possible)

I wanted to do something similar, but rather than using routes I put a
condition in the beforeFilter of a controller. The controller is
called galleries, I wanted to keep the actions like index, view,
detail, etc. So I could have /galleries/view/ but also to
have /galleries/

Anyway I've got the following in my controller

var $regions = array('london', 'south_west', 'north', 'south_east',
'central', 'wales', 'scotland', 'northern_ireland');

function beforeFilter()
{
if(in_array($this->action, $this->regions))
  {
 $this->region();
 exit;
  }
}

So if the is a URL like /galleries/london it will route to the the
action region() in the controller.

It works well, but I was wondering if there are better solutions?




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



Problem with multiple INSERTS

2007-02-28 Thread [EMAIL PROTECTED]

i want to post a array with multiples IDs, at an relationchip table.
All this id are generated by a list of checkboxes.


design

architecture

videos

and my save function =
$t = new customs;
$t->save($this->data['customs']);

do you have any idea ?

---
Dan


--~--~-~--~~~---~--~~
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: Switch Element On/Off

2007-02-28 Thread scragz

Make multiple layouts and switch between them in the controller, $this-
>layout = 'no_thingy';

On Feb 28, 11:44 am, "phirschybar" <[EMAIL PROTECTED]> wrote:
> Hey all..
>
> What if I have an element and I want to switch it on for some pages
> and off for others?
>
> I could easily pass it some data and do the logic to determine if it
> should be shown right within the element itself or even in the default
> layout but then I would have business logic right in the views,
> violating MVC...
>
> How can I do the logic in the controller where it should be and only
> call the element from there?


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



Switch Element On/Off

2007-02-28 Thread phirschybar

Hey all..

What if I have an element and I want to switch it on for some pages
and off for others?

I could easily pass it some data and do the logic to determine if it
should be shown right within the element itself or even in the default
layout but then I would have business logic right in the views,
violating MVC...

How can I do the logic in the controller where it should be and only
call the element from there?


--~--~-~--~~~---~--~~
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: findNeighbours does not seem to be working

2007-02-28 Thread Xandornot

I even tried putting this in the model with all parameters as static
values, still it does not respond with any values for prev and next.
Does anyone have any ways to get this to work?

On Feb 26, 9:32 am, "Xandornot" <[EMAIL PROTECTED]> wrote:
> Hi, has anyone successfully used findNeighbours? I have tried this in
> several models and even a simple use such as $this->set('neighbours',
> $this->Slide->findNeighbours(null, 'id', $id); with $id properly
> filled only produces an empty array of [prev] and [next] with no
> previous and next ids produced. Any ideas?


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



Re: Form validation + Ajax ?

2007-02-28 Thread bernardo

google cache?

http://www.google.com/search?q=cache:wiki.cakephp.org/faq:how_do_i_validate_a_form_with_ajax?s=ajax%2Bupdate

On Feb 27, 8:55 am, "Mech7" <[EMAIL PROTECTED]> wrote:
> Does anybody know how i can reach the wiki? I found this link thru
> google but i can't acces it :(
>
> http://cakebaker.42dh.com/2005/12/31/form-validation-with-ajax/


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



Re: Form validation + Ajax ?

2007-02-28 Thread mindcharger

AFAIK the wiki is off...

Try:

http://bakery.cakephp.org/

Good luck!

On Feb 27, 11:55 am, "Mech7" <[EMAIL PROTECTED]> wrote:
> Does anybody know how i can reach the wiki? I found this link thru
> google but i can't acces it :(
>
> http://cakebaker.42dh.com/2005/12/31/form-validation-with-ajax/


--~--~-~--~~~---~--~~
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: Missing Model error message on production server, but OK on localhost (development)

2007-02-28 Thread djiize

When you move your app from a place to another, don't forget to empty
the /app/tmp subfolders (cache models, persistent)

On 28 fév, 16:27, "Robson" <[EMAIL PROTECTED]> wrote:
> i keep getting message on my production server, but it works ok on
> developemnt
>
> Missing Model
>
> No class found for the Image model
>
> Notice: If you want to customize this error message, create app/views/
> errors/missing_model.thtml.
>
> Fatal: Create the class below in file : app/models/image.php
>
> Image Model :
>
>  class Image extends AppModel {
>var $name = 'Image';
>var $belongsTo=array('Project');}
>
> ?>
>
> Images controller
>
> 
> uses ("Sanitize");
> class ImagesController extends AppController
> {
> var $scaffold;
> var $name="Images";
> var $uses=array("Image");
>
> }
>
> ?>
>
> All works well on my localhost thou
>
> Localhost server:
> 
> Apache version :Apache/2.0.59 (Win32)
>
> PHP version :5.2.0
>
> Loaded extensions :
> bcmath, calendar, com_dotnet, ctype, session, filter, ftp, hash,
> iconv, json, odbc, pcre, Reflection, date, libxml, standard,
> tokenizer, zlib, SimpleXML, dom, SPL, wddx, xml, xmlreader, xmlwriter,
> apache2handler, mbstring, mysql, mysqli, PDO, pdo_sqlite, SQLite
>
> MySQL version :5.0.27-community-nt
> ---
>
> My production server:
> 
>
> Apache 1.3.37 (Unix)
> PHP 5.2.0
> MySQL 4.1.21-standard
>
> --
>
> I use cake ver: 1.1.13.4450
>
> If any1 got any ideas please share with me ;]
>
> Thanks in advance
> Rob


--~--~-~--~~~---~--~~
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: changing ACL tablenames

2007-02-28 Thread Norman normal

you would have to search+replace in the code (it should not be much
work though), it seems the tables names are hardcoded

On Feb 28, 10:31 am, "symfony" <[EMAIL PROTECTED]> wrote:
> Are there any possbilities for changing the tablenames of the acl
> needed databasetables (aros, acos and so on) and of cause working with
> them correctly?


--~--~-~--~~~---~--~~
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: findCount SQL errors

2007-02-28 Thread Christopher E. Franklin, Sr.

Ok, as it turns out, the array that AD7six suggested did not work for
me personally with or without addslashes(), magic quotes on or off or
any variation therein.  That is not to say that it doesn't work, it
just did not make a correct comparison for my purposes.

On the other hand, bernardo, your suggestion did work and it works
flawlesly as I had wanted.  I get 0 double entries out of 3
records.  I went ahead and left magic_quotes on for now.  I like not
having to deal with it.  Funny thing is, when I turned it off and used
cake to do my save without sanitizing for SQL, MySQL took the data,
apostrophes, ampersands and all without me having to specifically
addslashes before the save.  I am guessing cake does this
automagically when I call save().

Thanks a million for your help (both of you!)  Now for my second
question that i am not too clear on.  I have searched this group for
information on saving HABTM.  From what I have above, I have a
classifieds_editions and a categories_classifieds.

>From what I can gather from other posts, am I supposed to do?

$this->data['Edition']['Edition']['classified_id'] = (integer)$this-
>xmlID;
$this->data['Edition']['Edition']['edition_id'] = (integer)$ad-
>editions;


I am pretty confused on this part.  Like I said, I have read the
manual, looked at the API checked this group and google.  I am at a
loss.

On Feb 28, 3:28 am, "bernardo" <[EMAIL PROTECTED]> wrote:
> On Feb 28, 7:50 am, "AD7six" <[EMAIL PROTECTED]> wrote:
>
> > On Feb 28, 10:15 am, "Christopher E. Franklin, Sr."<[EMAIL PROTECTED]> 
> > wrote:
> > > I will try that as well.  I thought that's what the sanitize->sql()
> > > did
> > > .  Maybe I am mistaken.
>
> > If you use a string constraint, you are basically on your own from
> > cake's perspective. If you use an array constraint, cake should take
> > care of it for you. I bet this works, or at the very least does not
> > generate errors:
>
> > $this->matchResult = $this->Classified->findCount(array(
> > "Classified.text" = $ad->text,
> > "Classified.editions" => $ad->editions)
> > );
>
> I don't think this works because it cuts the string at the first
> newline.
>
>
>
> > 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: baking the scaffolding

2007-02-28 Thread hydra12

I'm not sure where the documentation is, but here's how I do it:

I added php.exe to my path in windows.  That makes things a lot
easier.  My setup is like this: my webroot is in c:\web\projects.
Cake is inside projects.  I put my apps in my projects directory, too,
not in cake.

>From the command prompt: c:\>cd web\projects\cake\cake\scripts
 c:\web\projects\cake\cake\scripts>php bake.php -project c:\web
\projects\myApp
This will create a basic project for you at c:\web\projects\myApp.
For me, using cake_1.2.0.4206, I get a few errors, and some folders
don't get created.  Open c:\web\projects\myApp and create a models
folder.  Also create a tmp folder.  Inside tmp, make a cache folder.
Inside cache, make a models folder.  Also, bake (for me, at least)
doesn't make the vendors or components folders.

Anyway, once you have done that, at the command prompt:
 c:\web\projects\cake\cake\scripts>php bake.php -app c:\web
\projects\myApp
It will first walk you through your db config.  After that, create a
model for your app.  It will exit to the command prompt.  Run bake
again and create a controller.  Tell it you want to make some basic
class methods.  This will bake the scaffolded methods into your
controller.  Run bake again, and create a view.  Tell it you want to
create some scaffolded views.

Tada!  You're done.  Now do it again for your other tables.

On Feb 28, 7:29 am, "xhenxhe" <[EMAIL PROTECTED]> wrote:
> It seems when I first a cake quite a few months ago I remember reading
> on how to "bake" - which basically turns the scaffolding into editable
> code. Where do I find documentation on how to do this (in windows)?


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

2007-02-28 Thread nate

$object is used in cases where a controller uses more than one model,
and you wish to paginate a model other than the default.  "Allowed
parameters" are pagination parameters which a user is allowed to pass
in the URL.

For any further questions about new 1.2 features, please see here:
http://groups.google.com/group/cake-php/msg/c3d21174244b4329

On Feb 28, 2:04 am, "Adrian Maier" <[EMAIL PROTECTED]> wrote:
> On 2/27/07, nate <[EMAIL PROTECTED]> wrote:
>
>
>
> > $scope is filtering criteria, and $whitelist is a list of allowed
> > parameters.
>
> Thanks for trying to explain, Nate. However, since i'm very new to
> CakePHP   i can't figure out what would be the purpose of these
> "allowed parameters".   :-D
>
> > $object is interpreted as $scope if it is an array, since by default,
> > the $object parameter is not required.
>
> So,  the filter criteria should normally be passed as the $scope. In
> this case what is $object meant for ?
>
> I find that the API documentation is too minimal (it seems to be
> generated from sources and sometimes the explainations are
> not verbose enough).
> But this is compensated by the people on this group who are very
> nice and willing help.  :)
>
> I'm very happy that i found this google group to post my questions : it's
> easier to get answers here than on the irc channel where sometimes there
> are several conversations taking place at the same time and it's hard
> to follow,
>
> Thanks,
> Adrian Maier
>
> > On Feb 27, 2:28 am, "Adrian Maier" <[EMAIL PROTECTED]> wrote:
> > > On 2/27/07, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> > > > Just pass your conditions as the first parameter to your paginate
> > > > function.
>
> > > > $your_conditions = array('session_id'=>$session_id);
> > > > $this->set( 'importData', $this->paginate($your_conditions) );
>
> > > Thanks,   I'll try this.
>
> > > The funny thing is that I had looked at the paginate() function in
> > > the API, but I couldn't figure out by myself what is the meaning
> > > of its parameters:
> > > mixed   $object
> > > mixed   $scope
> > > array$whitelist
>
> > > I am wondering how is someone supposed to guess that the $object
> > > is actually an array that defines the filtering criteria for the query.
>
> > > The other two parameters : $scope and $whitelist are still puzzling
> > > me. What are they?


--~--~-~--~~~---~--~~
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 editor and view

2007-02-28 Thread bernardo

Make sure the spaces are not in your source files (before or after the
php tags) as these spaces will be added to the ajax response.

On Feb 28, 10:13 am, "dhalsim" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've put an ajax editor in my view and the problem I have is when I
> edit my field for the second or more time, the value in the text field
> is prefixed with sereval tabulation (I don't see directly the value in
> the input). I don't understand where they come from.
>
> this is a piece of my view :
> 
>   
> 
> editor('ajax_edit_nom','/utilisateurs/ajax_update/'.
> $user['utilisateurid'].'/nom')); ?>
>
> and my UtilisateursController with the ajax_update() method :
>
> function ajax_update($id,$sub)
> {
> $value = $this->params['form']['value']; //new value
> to save
>
> $this->Utilisateur->id = $id;
> if (!$this->Utilisateur->saveField($sub, $value,
> true))
> {
> $this->set('error', true);
> }
> $user = $this->Utilisateur->read(array($sub), $id);
> $this->set('value',$user['Utilisateur'][$sub]);
> $this->layout = 'ajax';
> }
>
> and finally th ajax_update.thtml
> 
>
> If anybody has an 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: Please help me understand URL and Routes in Cake

2007-02-28 Thread Chris Lamb

> I understand that Cake does [routing] this in two phases, one
> using apache mod rewrite to pass the rest of the path to cake and the
> second one by "Routes" to further route the URL in cake internally. Is
> this correct?

Yes.

> I assume that the major purpose of the Routes is to map URLs to
> controllers, functions and parameters.

Correct.

> 1. I've seen a colon (:) used in the manual in routes config (like /
> blog/:action/* ). What is the special meaning of the colon? It isn't
> mentioned anywhere.

They are to control the parameters that are passed to the Controller.
I think the syntax is a Ruby-ism. First, the general case. If your
route is:

  /blog/:spam/* 

then if the browser requested

  /blog/eggs/

then $this->params['spam'] would contain the value 'eggs'. You can have
more than one in the route. For example:

  /blog/:year/:month/:day/:slug/*

gets you something like the default WordPress blog link structure.
There are two 'magic' parameters, "controller" and "action" which, when
set, decide which controller or action to call respectively. For
example, the route:

  /blog/:action/:spam

when called with:

  /blog/view/eggs/

will call the "view" action with $this->params['spam'] set to "eggs".


> 2. Can I use regular expressions in Routes like on mod rewrite? How?
> The manual doesn't mention it.

Just use regular Perl-compatible regexs.


> 3. Can I still use URL query string parameters using "?" ? Or does
> cake only use the /controller/action/param/param... convention?

Cake has a different method of handling query string parameters. My
advice is to construct a controller action to display $this->params and
see how they are handled.


> Hope I am making myself clear. Sorry for the long message.

Hopefully someone else can help with the rest if the above does not
help you solve the problem yourself. Note that the CakePHP source is
very readable for a PHP program, so examining the dispatcher code may
make sense than any of this.

Best wishes,

-- 
 Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20


signature.asc
Description: PGP signature


Missing Model error message on production server, but OK on localhost (development)

2007-02-28 Thread Robson

i keep getting message on my production server, but it works ok on
developemnt

Missing Model

No class found for the Image model

Notice: If you want to customize this error message, create app/views/
errors/missing_model.thtml.

Fatal: Create the class below in file : app/models/image.php




Image Model :



Images controller




All works well on my localhost thou

Localhost server:

Apache version :Apache/2.0.59 (Win32)

PHP version :5.2.0

Loaded extensions :
bcmath, calendar, com_dotnet, ctype, session, filter, ftp, hash,
iconv, json, odbc, pcre, Reflection, date, libxml, standard,
tokenizer, zlib, SimpleXML, dom, SPL, wddx, xml, xmlreader, xmlwriter,
apache2handler, mbstring, mysql, mysqli, PDO, pdo_sqlite, SQLite

MySQL version :5.0.27-community-nt
---

My production server:


Apache 1.3.37 (Unix)
PHP 5.2.0
MySQL 4.1.21-standard

--



I use cake ver: 1.1.13.4450

If any1 got any ideas please share with me ;]

Thanks in advance
Rob


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



newbie: register user

2007-02-28 Thread cbmeeks

Below is my function to register a new user.  In the function, you
will notice that I attempt to sha256 the password to store in the
database.  Works great.

However, just before the data is saved, the password box gets the new
sha256-ed password.  In other words, if there is an error saving, you
can actually SEE the sha256 password.  Which would mean that a user
might not catch that and re-submit which would pass their password in
as the new sha256 password.  Hope that makes sense.

I know which line is doing it.  What I am asking is for a more elegant
way.  How would you guys change this function?

Thanks!

function register()
{
if(empty($this->data))
{
$this->render();
}
else
{
$this->cleanUpFields();


if($this->User->findByUsername($this->data['User']['username']))
{
$this->Session->setFlash('ERROR: User 
already exists.');
$this->redirect('/users/register');
}
else
{
// sha256 the pass
$salt = "SOMESALTVALUE";
$user = $this->data['User']['username'];
$pass = $this->data['User']['password'];
$this->data['User']['password'] = 
hash('sha256',$salt.$user.
$pass);

if($this->User->save($this->data))
{
$this->Session->setFlash('Thank 
you for registering!');
$this->redirect('/users/index');
}
else
{

$this->Session->setFlash('Please correct errors below.');
}
}
}
}


--~--~-~--~~~---~--~~
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: multi-page forms

2007-02-28 Thread lukemack

cool thanks, Chris.

Toby - the formwizard seems to break validation. did you use it with
validation?

On 27 Feb, 15:04, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On 2/23/07,lukemack<[EMAIL PROTECTED]> wrote:
>
>
>
> > Chris - can you elaborate on the problem with the back button? I
> > assume you mean the browser back button?  I guess there are three
> > options - sessions, database and hidden fields. If the user hits
> > 'back' - is the session data lost? do hidden fields get lost? would
> > using a database help?
>
> Yeah, I'm talking about the browser back button.  Unless you can
> completely disable it, you can run into problems in multi-page forms.
> Sessions are the best way to go because even they use the back button,
> the next time they load a page the session data should still be there
> (unless the session has timed out of course).
>
> My personal experience has been that you have to design your
> multi-page forms around the idea that they WILL screw you up by using
> the browser back button.
>
> Hope that helps.
>
> --
> Chris Hartjes
>
> My motto for 2007:  "Just build it, damnit!"
>
> rallyhat.com - digital photo scavenger hunt
> @TheBallpark -http://www.littlehart.net/attheballpark
> @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: security - verify POST via submit button

2007-02-28 Thread Chris Lamb

> how can i make sure that user data have been submitted via
> pressing a submit button instead of sending spagetti code
> appended to the controller url ?

Check out the Security Component page in the manual. [0]


Kind wishes,

-- 
 Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20

[0] http://manual.cakephp.org/chapter/security


signature.asc
Description: PGP signature


security - verify POST via submit button

2007-02-28 Thread jyrgen

Hi all,

how can i make sure that user data have been submitted via
pressing a submit button instead of sending spagetti code
appended to the controller url ?

I assume it is not sufficient to test for a submit value or hidden
field.

thank you !

jyrgen


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



ajax editor and view

2007-02-28 Thread dhalsim

Hi,

I've put an ajax editor in my view and the problem I have is when I
edit my field for the second or more time, the value in the text field
is prefixed with sereval tabulation (I don't see directly the value in
the input). I don't understand where they come from.

this is a piece of my view :

  

editor('ajax_edit_nom','/utilisateurs/ajax_update/'.
$user['utilisateurid'].'/nom')); ?>

and my UtilisateursController with the ajax_update() method :

function ajax_update($id,$sub)
{
$value = $this->params['form']['value']; //new value
to save

$this->Utilisateur->id = $id;
if (!$this->Utilisateur->saveField($sub, $value,
true))
{
$this->set('error', true);
}
$user = $this->Utilisateur->read(array($sub), $id);
$this->set('value',$user['Utilisateur'][$sub]);
$this->layout = 'ajax';
}

and finally th ajax_update.thtml


If anybody has an 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: User Authentication

2007-02-28 Thread Digital Spaghetti

In Cake 1.2.x.x there is a new Auth component, however it may still be 
buggy and I've had issues with it already, but keep an eye on it as it 
should integrate with ACL (or so I have been told).



-- 
Tane Piper
Personal: http://digitalspaghetti.me.uk
Work: http://nohalfmeasures.com

This email is: [ ] blogable [ x ] ask first [ ] private



xhenxhe wrote:
> I'm completely new to this so please excuse my ignorance. I want to
> create a new site and start with user accounts, authentication, login
> form, logout, etc - all that you would expect from a user class. I
> would assume there are so many sites that have this that there is some
> sort of package I could plug in and work from there rather than
> reinventing the wheel for every site that requires authentication.
> Does this exist, or are there any good tutorials that can get me up
> and running?
>
> Thanks,
> Dustin
>
>
> >
>
>   


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



show page from tree with a for loop

2007-02-28 Thread Oneill

Hi guys,

I am busy with my nodes controller... I forwarded each routing to
nodes_controller -> show.
Now I have my nodes table structure with a id, name, parent_id and
url. The url is just the name which it should be accessible in the
browser. Like about_us.

Now you can see the parent_id is for the three effect which can go on
eternaly. If want to add a subnode to about_us with the url name
'contactinfo'. I don't want to put about_us/contactinfo in the
database because i have an tree script which haves a drag and drop
function. And thats based on the parent_id.

So I am looking for an FOR loop which cuts the requested url into
parts like this:
$mylink=$sanit->sql(substr($_SERVER['QUERY_STRING'], 4));
$parts = explode('/', $mylink);

Now i would like to do the for loop which looks into the database if
it can find the requested parts in the RIGHT follow ups. Has somebody
an Idea how I should do that?

Greetz,


--~--~-~--~~~---~--~~
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: variable number of items in one table

2007-02-28 Thread mike

Found this answer and seems to work.

$sum = 0;

foreach($result as $row)
{
$sum += $row['price'];

}  Thanks Mariano


On Feb 28, 1:39 pm, "mike" <[EMAIL PROTECTED]> wrote:
> Thanks very much fo the reply.
>
> I currently have the simple code below printing out of the values in
> Orderlines.
>
> foreach ($item as $index=>$row) {
>
> $price = $row['price'];
> $qty = $row['qty'];
>
> $total = $price*$qty;
>
> echo $price;
> echo $qty;
> echo $total;
>
> }
>
> What I'd like to do next is add all $total in as many rows it prints.
> Simple enough but not sure how.
> I think I need to add a unique variable to $total on each loop then
> add then all up when it breaks out of the loop ()
> Does anyone have an example I could look at?
>
> Thanks very much for the help so far!
>
> Mike.


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



baking the scaffolding

2007-02-28 Thread xhenxhe

It seems when I first a cake quite a few months ago I remember reading
on how to "bake" - which basically turns the scaffolding into editable
code. Where do I find documentation on how to do this (in windows)?


--~--~-~--~~~---~--~~
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: variable number of items in one table

2007-02-28 Thread mike

Thanks very much fo the reply.

I currently have the simple code below printing out of the values in
Orderlines.

foreach ($item as $index=>$row) {

$price = $row['price'];
$qty = $row['qty'];

$total = $price*$qty;

echo $price;
echo $qty;
echo $total;

}

What I'd like to do next is add all $total in as many rows it prints.
Simple enough but not sure how.
I think I need to add a unique variable to $total on each loop then
add then all up when it breaks out of the loop ()
Does anyone have an example I could look at?

Thanks very much for the help so far!

Mike.


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



changing ACL tablenames

2007-02-28 Thread symfony

Are there any possbilities for changing the tablenames of the acl
needed databasetables (aros, acos and so on) and of cause working with
them correctly?


--~--~-~--~~~---~--~~
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: User Authentication

2007-02-28 Thread xhenxhe

great, thanks!

On Feb 28, 5:55 am, "Hubbo" <[EMAIL PROTECTED]> wrote:
> Hi Dustin.
>
> I've just begun using dAuth 0.3http://bakery.cakephp.org/articles/view/152
> for a project and it seem to work really well and is easy to
> configure. Read the dAuth articles and read up on "Simple User
> Authentication" and "Access Control Lists" in the Cake manual and you
> should be good to go =).
>
> Best regards,
> Miche
>
> On Feb 28, 1:25 pm, "xhenxhe" <[EMAIL PROTECTED]> wrote:
>
> > I'm completely new to this so please excuse my ignorance. I want to
> > create a new site and start with user accounts, authentication, login
> > form, logout, etc - all that you would expect from a user class. I
> > would assume there are so many sites that have this that there is some
> > sort of package I could plug in and work from there rather than
> > reinventing the wheel for every site that requires authentication.
> > Does this exist, or are there any good tutorials that can get me up
> > and running?
>
> > Thanks,
> > Dustin


--~--~-~--~~~---~--~~
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: User Authentication

2007-02-28 Thread Hubbo

Hi Dustin.

I've just begun using dAuth 0.3 http://bakery.cakephp.org/articles/view/152
for a project and it seem to work really well and is easy to
configure. Read the dAuth articles and read up on "Simple User
Authentication" and "Access Control Lists" in the Cake manual and you
should be good to go =).

Best regards,
Miche

On Feb 28, 1:25 pm, "xhenxhe" <[EMAIL PROTECTED]> wrote:
> I'm completely new to this so please excuse my ignorance. I want to
> create a new site and start with user accounts, authentication, login
> form, logout, etc - all that you would expect from a user class. I
> would assume there are so many sites that have this that there is some
> sort of package I could plug in and work from there rather than
> reinventing the wheel for every site that requires authentication.
> Does this exist, or are there any good tutorials that can get me up
> and running?
>
> Thanks,
> Dustin


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



User Authentication

2007-02-28 Thread xhenxhe

I'm completely new to this so please excuse my ignorance. I want to
create a new site and start with user accounts, authentication, login
form, logout, etc - all that you would expect from a user class. I
would assume there are so many sites that have this that there is some
sort of package I could plug in and work from there rather than
reinventing the wheel for every site that requires authentication.
Does this exist, or are there any good tutorials that can get me up
and running?

Thanks,
Dustin


--~--~-~--~~~---~--~~
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: findAll with NOT LIKE

2007-02-28 Thread GreyCells

There is also the function model->escapeField() e.g.:

$this->Article->escapeField('text')." NOT LIKE '%cheese%'"

A very useful function for those awkward SQL conditions.

~GreyCells

On Feb 28, 12:00 pm, "jyrgen" <[EMAIL PROTECTED]> wrote:
> i found the solution right after a posted my question !!
>
>  "and not" => array(
>
> array("Article.text" => "LIKE %cheese%"),
> ),
>
> thanks anyways :-)
>
> Jyrgen


--~--~-~--~~~---~--~~
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: Integrating phpGACL with CakePHP

2007-02-28 Thread Digital Spaghetti

Hi Mariano,

Absolutly - I've been looking for an ACL solution similar to this.  I've 
had issues with CakePHP's own ACL system, and feel I do need more levels 
of control.  Please keep me informed on your work and I'd be happy to do 
some testing.

-- 
Tane Piper
Personal: http://digitalspaghetti.me.uk
Work: http://nohalfmeasures.com

This email is: [ ] blogable [ x ] ask first [ ] private



Mariano Iglesias wrote:
> My fellow bakers,
>
> As I found myself in the need of having a highly customizable ACL system for
> a CakePHP application I'm developing, I'm going ahead with something some
> people asked in the past if it could be available.
>
> The issues with this application that prevented me from using CakePHP's
> builtin ACL, which is very strong BTW, were among others:
>
> 1. I needed a fine grained set of permissions.
> 2. I needed AROs to belong to more than one group.
> 3. I needed collision handling.
>
> So I'm now working on a component that provides a wrapper for phpGACL (using
> its latest version, 3.3.7), so that it hides the inner complexities of
> phpGACL from CakePHP applications.
>
> I'm setting it up to use the 3D layer system (AROs, ACOs, and AXOs) to allow
> greater flexibility (so I can do stuff like: this action can be accessed via
> Web, but can't be accessed via RSS for this particular user, interesting
> when using CakePHP 1.2 automatic content type management)
>
> I'm expecting to finish the component tomorrow. The component, as I said,
> will be a programmatic wrapper. I'm also planning to build a plugin that'll
> offer the manipulation of these permissions, but have yet not established
> when I'll start with that.
>
> Anyway, I've just wanted to drop a note if anyone was looking for the same.
>
> -MI
>
> ---
>
> Remember, smart coders answer ten questions for every question they ask. 
> So be smart, be cool, and share your knowledge. 
>
> BAKE ON!
>
> blog: http://www.MarianoIglesias.com.ar
>
>
> >
>
>   



--~--~-~--~~~---~--~~
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: findAll with NOT LIKE

2007-02-28 Thread jyrgen

i found the solution right after a posted my question !!

 "and not" => array(
 
array("Article.text" => "LIKE %cheese%"),
),

thanks anyways :-)

Jyrgen


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



findAll with NOT LIKE

2007-02-28 Thread jyrgen

Hi all,

i'm struggling with a complex find condition, containing
several Arrays in this fashion:

$conditions= Array(
"Article.type" => "6",
"and" => array(

array("Article.text" => "LIKE %pasta%"),
),

"or" => array(

array("Article.text" => "LIKE %salami%"),

array("Article.text" => "LIKE %pizza%"),
)
);

This works like a charm, but how can i make use of one (or more) sql
NOT LIKE
conditions, since

"not" => array(

array("Article.text" => "LIKE %cheese%"),
),

doesn't work. I get this error

Notice: Array to string conversion in /var/www/cake/cake/libs/model/
datasources/dbo_source.php on line 1342

thank you very much !

Jürgen


--~--~-~--~~~---~--~~
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: findCount SQL errors

2007-02-28 Thread bernardo



On Feb 28, 7:50 am, "AD7six" <[EMAIL PROTECTED]> wrote:
> On Feb 28, 10:15 am, "Christopher E. Franklin, Sr."<[EMAIL PROTECTED]> wrote:
> > I will try that as well.  I thought that's what the sanitize->sql()
> > did
> > .  Maybe I am mistaken.
>
> If you use a string constraint, you are basically on your own from
> cake's perspective. If you use an array constraint, cake should take
> care of it for you. I bet this works, or at the very least does not
> generate errors:
>
> $this->matchResult = $this->Classified->findCount(array(
> "Classified.text" = $ad->text,
> "Classified.editions" => $ad->editions)
> );

I don't think this works because it cuts the string at the first
newline.

>
> 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: findCount SQL errors

2007-02-28 Thread bernardo

On Feb 28, 6:15 am, "Christopher E. Franklin, Sr."
<[EMAIL PROTECTED]> wrote:
> I will try that as well.  I thought that's what the sanitize->sql()
> did

If you look at the definitio of sanitize->sql():

function sql($string) {
if (!ini_get('magic_quotes_gpc')) {
$string = addslashes($string);
}
return $string;
}

So my guess is that you have magic_quotes_gpc enabled and addslashes
is not being called.
Note that in cake 1.2 sanitize->sql has been deprecated and has
sanitize->escape instead, which in the case of mysql calls
mysql_real_escape_string.


--~--~-~--~~~---~--~~
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: findCount SQL errors

2007-02-28 Thread AD7six



On Feb 28, 10:15 am, "Christopher E. Franklin, Sr."
<[EMAIL PROTECTED]> wrote:
> I will try that as well.  I thought that's what the sanitize->sql()
> did
> .  Maybe I am mistaken.
>
If you use a string constraint, you are basically on your own from
cake's perspective. If you use an array constraint, cake should take
care of it for you. I bet this works, or at the very least does not
generate errors:

$this->matchResult = $this->Classified->findCount(array(
"Classified.text" = $ad->text,
"Classified.editions" => $ad->editions)
);

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



Please help me understand URL and Routes in Cake

2007-02-28 Thread barduck


Hi,

I am trying to understand how friendly URLs and "Routes" work in Cake
and have few of questions that might be trivial but I can't seem to
find an answer in the documentation.

I am familiar with url rewriting from other platforms where I used a
similar functionality of mod rewrite to map logical URLs to physical
server paths. I understand that Cake does this in two phases, one
using apache mod rewrite to pass the rest of the path to cake and the
second one by "Routes" to further route the URL in cake internally. Is
this correct?

I assume that the major purpose of the Routes is to map URLs to
controllers, functions and parameters.

Questions:

1. I've seen a colon (:) used in the manual in routes config (like /
blog/:action/* ). What is the special meaning of the colon? It isn't
mentioned anywhere.
2. Can I use regular expressions in Routes like on mod rewrite? How?
The manual doesn't mention it.
3. Can I still use URL query string parameters using "?" ? Or does
cake only use the /controller/action/param/param... convention?

And now to a real example:

Suppose I have a Model called Unit, so I would like to have a view to
show multiple units in table, with various filters and sorted
parameters, and a view that shows the information on a single unit.

So, I'd like to have the following URLs
/units- for a view showing a table of multiple units
/units/- for a view of the single unit (no, I don't
want to use the action in the URL like /units/view/, I'd
like to keep this one as short and simple as possible)

I defined the following Routes:

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

So far everything works fine.

Now I would like to accomplish 2 additional things:

1. Have parameters passed to the /units/ index view (like filters and
sort columns) on the URL. I would normally do this with query string
parameters:
/units?sort=column&filer=.&...
How do I do this in Cake so it doesn't interfere with the single unit
view?

2. I would like to be able to pass multiple units to the index view
and show these units in the same multiple units table (with unknown
parameter count). Like this
/units/unit1+unit2+units3
OR
/units/unit1/unit2/unit3/...

How do I define unknown count of parameters in Routes and how do I do
this without interfering with the single unit view?


Hope I am making myself clear. Sorry for the long message.

Thanks in advance!

- barduck


--~--~-~--~~~---~--~~
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: Integrating phpGACL with CakePHP

2007-02-28 Thread Langdon Stevenson

Interesting project Mariano.  I think it is probably over kill for my 
needs personally, but hope it works out.  It will become one more reason 
for Cake to be your framework of choice :-)

Langdon


Mariano Iglesias wrote:
> My fellow bakers,
> 
> As I found myself in the need of having a highly customizable ACL system for
> a CakePHP application I'm developing, I'm going ahead with something some
> people asked in the past if it could be available.

--~--~-~--~~~---~--~~
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: findCount SQL errors

2007-02-28 Thread Christopher E. Franklin, Sr.

I will try that as well.  I thought that's what the sanitize->sql()
did
.  Maybe I am mistaken.

On Feb 27, 6:22 pm, "bernardo" <[EMAIL PROTECTED]> wrote:
> You don't need to escape html characters. In fact doing that will give
> you incorrect results because the escaped string will never match.
> Html escaping will convert html special chars(< > & " ') into
> entities, but what you want is adding backslashes to the characters
> that are illegal in the query.
>
> So, I think you just need to use addslashes:
>
> $this->Classified->findCount("Classified.text = '" . addslashes($ad->text) . 
> "' AND
>
> Classified.editions = '$ad->editions'");
>
> On Feb 27, 10:03 pm, "Christopher E. Franklin, Sr."
>
> <[EMAIL PROTECTED]> wrote:
> > Hrmm, I seem to have fixed it.
>
> > The first time I tried this code, before I posted, it didn't work but,
> > now it does.  Maybe I had a typo. /shrug
>
> > Here is what I changed:
> > [...]
> > $this->xmlID = $this->Classified->getNumRows();
> > ++$this->xmlID;
> > [...]
> > $this->matchResult = $this->Classified->findCount("text = 
> > '".$this->MrClean->sql($this->MrClean->html($ad->text))."' AND editions = 
> > '".
>
> > $ad->editions."'");
> > [...]
> > $this->data['Classified']['text'] = 
> > $this->MrClean->sql($this->MrClean->html($ad->text));
>
> > [...]
>
> > My conclusion is that the sanitize->sql() really doesn't help if you
> > have any html characters in your text.
> > So, I convert the special characters using html() and the escape with
> > sql().
> > I do the same thing on insert so, when I match the text, it should
> > compare exactly.  There a few snags.  Some ads get by but, I can live
> > with it.  I will just use strip slashes and html_special_chars
> > functions to convert the text back to my original HTML formatted.
>
> > Sorry for the bother and long posts


--~--~-~--~~~---~--~~
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: Drake :: Drupal-CakePHP 1.0.1b Released

2007-02-28 Thread kiang

One more bug.

The sorting function for each column wasn't work. The url became:
http://localhost/drupal/drake?run=/modules/index?sor[0]=-2&sr=0

---
Finjon Kiang


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



Integrating phpGACL with CakePHP

2007-02-28 Thread Mariano Iglesias

My fellow bakers,

As I found myself in the need of having a highly customizable ACL system for
a CakePHP application I'm developing, I'm going ahead with something some
people asked in the past if it could be available.

The issues with this application that prevented me from using CakePHP's
builtin ACL, which is very strong BTW, were among others:

1. I needed a fine grained set of permissions.
2. I needed AROs to belong to more than one group.
3. I needed collision handling.

So I'm now working on a component that provides a wrapper for phpGACL (using
its latest version, 3.3.7), so that it hides the inner complexities of
phpGACL from CakePHP applications.

I'm setting it up to use the 3D layer system (AROs, ACOs, and AXOs) to allow
greater flexibility (so I can do stuff like: this action can be accessed via
Web, but can't be accessed via RSS for this particular user, interesting
when using CakePHP 1.2 automatic content type management)

I'm expecting to finish the component tomorrow. The component, as I said,
will be a programmatic wrapper. I'm also planning to build a plugin that'll
offer the manipulation of these permissions, but have yet not established
when I'll start with that.

Anyway, I've just wanted to drop a note if anyone was looking for the same.

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


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