Re: Call static function in bootstrap.php

2009-01-06 Thread gearvOsh

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



Benefits for $html-link

2009-01-05 Thread gearvOsh

Are there any benefits, or behind the scenes magic for doing this:

$html-link('Link', array('controller' = 'users', 'action' =
'login', 'var'));

Compared to:

$html-link('Link', '/users/login/var/');

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



Re: Auth Login Component not working :(

2009-01-05 Thread gearvOsh

Leave your login() action empty. CakePHP automatically does all the
login magic.

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



Using the named parameters

2009-01-05 Thread gearvOsh

Is this the only way to access named parameters without throwing a
notice?

$var = (isset($this-params['named']['var'])) ? $this-params['named']
['var'] : '';

Is there some sort of function to get named params that im overlooking?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth Broken.

2009-01-04 Thread gearvOsh

Firstly use PHP 5.

Secondly remove $this-Auth-allow('*'). Why are you even using the
Auth component if your allowing all pages to be viewable? Perhaps
place this in each controller separately.

And thirdly, I thought isAuthorized is called after you are logged in.
Someone correct me if im wrong.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM retrieving help

2009-01-04 Thread gearvOsh

I know how to pagination, but.

I would like to do the pagination from the Team model, but the data I
need to access is in the TeamsPlayer model. Understand?

On Jan 4, 8:01 am, Smelly_Eddie ollit...@gmail.com wrote:
 You would read the Cake Manual section on pagination which answers all
 your questions.http://book.cakephp.org/view/164/pagination

 On Jan 3, 10:30 pm, gearvOsh mileswjohn...@gmail.com wrote:

  Heres my tables and relations:

  Team
  Team-belongsTo: Country, State
  Team-hasAndBelongsToMany: User (the players on a team, table =
  teams_players)

  Team:
  CREATE TABLE IF NOT EXISTS `teams` (
    `id` int(10) NOT NULL auto_increment,
    `status` enum('approved','pending') NOT NULL default 'pending',
    `name` varchar(50) NOT NULL,
    `tag` varchar(10) NOT NULL,
    `urlName` varchar(30) NOT NULL,
    `website` varchar(50) NOT NULL,
    `irc` varchar(20) NOT NULL,
    `about` varchar(255) NOT NULL,
    `servers` varchar(100) NOT NULL,
    `logo` varchar(100) NOT NULL,
    `createDate` int(10) unsigned NOT NULL default '0',
    `state_id` int(10) unsigned NOT NULL default '0',
    `country_id` int(10) unsigned NOT NULL default '0',
    `created` datetime default NULL,
    `modified` datetime default NULL,
    PRIMARY KEY  (`id`),
    KEY `state_id` (`state_id`),
    KEY `country_id` (`country_id`)
  )

  TeamsPlayer
  CREATE TABLE IF NOT EXISTS `teams_players` (
    `id` int(11) NOT NULL auto_increment,
    `team_id` int(10) unsigned NOT NULL,
    `user_id` int(10) unsigned NOT NULL,
    `role` enum('leader','captain','member') NOT NULL default 'member',
    `status` enum('approved','pending') NOT NULL default 'pending',
    `joinDate` int(10) NOT NULL,
    PRIMARY KEY  (`id`),
    KEY `team_id` (`team_id`),
    KEY `user_id` (`user_id`)
  )

  Ok if I do a basic Team-find() all the data is returned correctly.

  Now the problem im running into is how do I grab all teams that I am
  part of, and paginate it at the same time? Since the user_id values is
  in TeamsPlayer, im getting confused on this. Any help would be
  appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: New Install Does Not Show Graphics

2009-01-04 Thread gearvOsh

Is this a localhost or webserver?

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



HABTM naming convention messed up?

2009-01-04 Thread gearvOsh

Ok I have a users and teams system. Users are part of a team. Here is
the naming conventions:

Model: Team, User
DB: teams, users
HABTM: teams_users (TeamUser model)

But when I set my HABTM relationships I get errors because it says
that the model TeamsUser does not exist. Shouldnt it be TeamUser?
Thats what all the documentation says.

I fail to see how this setup is better then having a table, model,
controller, etc all called Teams or Users.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM and associations and loading

2009-01-04 Thread gearvOsh

This happens to me when I place a HABTM on another HABTM, I have found
no solution to this except to just remove that relation.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM naming convention messed up?

2009-01-04 Thread gearvOsh

This is my team model. Once I change TeamUser to TeamsUser it works
correctly, but that shouldnt be. Based on the docs and naming
convention it should be TeamUser.

class Team extends AppModel {

/**
 * Teams belong to a country, state
 */
var $belongsTo = array('Country', 'State');

/**
 * Team has many members and games
 */
var $hasAndBelongsToMany = array(
'Leader' = array(
'className' = 'User',
'fields'= 
array('Leader.id', 'Leader.username',
'Leader.handle', 'Leader.avatar'),
'conditions'= 
array('TeamUser.role' = 'leader'),
'foreignKey'= 'team_id',
'associationForeignKey' = 'user_id'
),
'Players' = array(
'className' = 'User',
'fields'= 
array('Players.id', 'Players.username',
'Players.handle', 'Players.avatar'),
'conditions'= array('TeamUser.role 
!=' = 'leader',
'TeamUser.status' = 'approved'),
'foreignKey'= 'team_id',
'associationForeignKey' = 'user_id'
),
'Games' = array(
'className' = 'GameSystem',
'foreignKey'= 'team_id',
'associationForeignKey' = 'game_system_id'
)
);
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: API

2009-01-03 Thread gearvOsh

I usually open the files myself instead of using the API online. I
usually have to go through the methods themselves to find out the
options.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



HABTM retrieving help

2009-01-03 Thread gearvOsh

Heres my tables and relations:

Team
Team-belongsTo: Country, State
Team-hasAndBelongsToMany: User (the players on a team, table =
teams_players)

Team:
CREATE TABLE IF NOT EXISTS `teams` (
  `id` int(10) NOT NULL auto_increment,
  `status` enum('approved','pending') NOT NULL default 'pending',
  `name` varchar(50) NOT NULL,
  `tag` varchar(10) NOT NULL,
  `urlName` varchar(30) NOT NULL,
  `website` varchar(50) NOT NULL,
  `irc` varchar(20) NOT NULL,
  `about` varchar(255) NOT NULL,
  `servers` varchar(100) NOT NULL,
  `logo` varchar(100) NOT NULL,
  `createDate` int(10) unsigned NOT NULL default '0',
  `state_id` int(10) unsigned NOT NULL default '0',
  `country_id` int(10) unsigned NOT NULL default '0',
  `created` datetime default NULL,
  `modified` datetime default NULL,
  PRIMARY KEY  (`id`),
  KEY `state_id` (`state_id`),
  KEY `country_id` (`country_id`)
)

TeamsPlayer
CREATE TABLE IF NOT EXISTS `teams_players` (
  `id` int(11) NOT NULL auto_increment,
  `team_id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `role` enum('leader','captain','member') NOT NULL default 'member',
  `status` enum('approved','pending') NOT NULL default 'pending',
  `joinDate` int(10) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `team_id` (`team_id`),
  KEY `user_id` (`user_id`)
)


Ok if I do a basic Team-find() all the data is returned correctly.

Now the problem im running into is how do I grab all teams that I am
part of, and paginate it at the same time? Since the user_id values is
in TeamsPlayer, im getting confused on this. Any help would be
appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: new benchmarks of PHP frameworks

2009-01-02 Thread gearvOsh

These benchmarks dont mean anything.

Do a benchmark using a full fledged system (perhaps a whole social
community) and see how the work. Simply hello world pages are nothing
because no frameworks are used for that.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Reverse relations?

2008-12-31 Thread gearvOsh

I know how to do relations for foreign keys, but I cannot figure out
how to do this.

In my users table, I have a column called state_id and country_id. I
tried a hasOne country but that does not work. It looks for a user_id
on the Country table that matches the user id, I need it the other way
around. I need the country_id on the user table to match the id on the
country table. How would I go about this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Reverse relations?

2008-12-31 Thread gearvOsh

I could of sworn I tried that and it didn't work, I must have changed
the foreign_key. Anyways that worked.

Yeah I was also thinking in my system... is that a user is top level
and he has many different parts. A user is not necessarily part of a
country, but I guess ill have to do it that way.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to change data of dropdown box when value of other dropdown box changes

2008-12-30 Thread gearvOsh

Ok you keep asking like 10 questions a day here.

1 - Read the CakePHP manual
2 - What you want to do is JSON/Javascript
3 - Perhaps actually learn PHP or Cake
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: findCount different then find('count')

2008-12-30 Thread gearvOsh

Ah that was probably it. Its just one of those small things you keep
unnoticing.

On Dec 30, 6:51 am, mark_story mark.st...@gmail.com wrote:
 Yes this is correct. You need the conditions key, all the new style
 calls require there to be a conditions key if you want to include
 conditions.

 -Mark

 On Dec 30, 6:45 am, jason m ippatsu.ya...@gmail.com wrote:

  i think it should be

  return $this-find('count', array('conditions'=$conditions));

  On Dec 30, 2:59 pm, gearvOsh mileswjohn...@gmail.com wrote:

   All I did was this:

   return $this-find('count', $conditions);
   return $this-findCount($conditions);

   $conditions = array('OR' = array(
    'Friend.user_id'        = $user_id,
    'Friend.friend_id'      = $user_id
    ));
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: buttons in cakephp

2008-12-30 Thread gearvOsh

http://groups.google.com/group/cake-php/browse_thread/thread/48835c8925d3ca7a#

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



Re: Problem with auth component

2008-12-30 Thread gearvOsh

What does your AppController beforeFilter() look like?

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



Re: show / hide with ajax

2008-12-30 Thread gearvOsh

You mean an accordion?

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



Re: How to make buttons in cakephp

2008-12-29 Thread gearvOsh

You dont have to build your views with cake code only:

button type=button onclick=Name/button

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



Re: Auth Only Showing Logged in on Users Controller

2008-12-29 Thread gearvOsh

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



Re: Data validation doesn't work

2008-12-29 Thread gearvOsh

You either need to have:

required = true

Or use the notEmpty rule.

http://book.cakephp.org/view/127/One-Rule-Per-Field
http://book.cakephp.org/view/740/notEmpty
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Doing pagination without paginate()

2008-12-29 Thread gearvOsh

Im having problems getting pagination working. I have complex custom
queries and I just cant get it working correctly. Ive tried building a
custom paginate() method within the model that does additional
filtering, but then I also feel limited using the $paginate var in the
controller.

Anyone have suggestions here?

This is the method im trying to turn into paging (cant seem to get the
$user_id and $status passed in (its dynamic of course):

function getMyFriends($user_id, $status = 'approved', $limit = 5) {
$friends = $this-find('all', array(
'fields' = array('Friend.*'),
'recursive' = -1,
'conditions' = array(
'Friend.status' = $status,
'OR' = array(
'Friend.user_id' = $user_id,
'Friend.friend_id' = $user_id
)
),
'order' = 'Friend.requestTime ASC',
'limit' = $limit
));

$cleanFriends = array();
if (!empty($friends)) {
foreach ($friends as $friend) {
if ($friend['Friend']['friend_id'] != $user_id) {
$friend_id = $friend['Friend']['friend_id'];
} else {
$friend_id = $friend['Friend']['user_id'];
}

$userObj = $this-User-find('first', array(
'fields' = array('User.id', 'User.username', 
'User.avatar',
'User.handle', 'User.country_id', 'User.signupDate'),
'recursive' = -1,
'conditions' = array('User.id' = $friend_id)
));

if (!empty($userObj)) {
$cleanFriends[] = array_merge($friend, 
$userObj);
}
}
}

return $cleanFriends;
}

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



Re: Doing pagination without paginate()

2008-12-29 Thread gearvOsh

Ive been messing around with it a bit and got this, is this the right
way to do things?

class DashboardController extends AppController {
var $uses = array('Friend');

// Pagination
var $paginate = array(
'Friend' = array(
'limit' = 5,
'order' = array('Friend.requestTime' = 'ASC'),
'recursive' = -1
)
);

function index() {
$this-paginate['Friend'] = array('extra' = array('user_id' =
$this-Auth-user('id')));
debug($this-paginate('Friend', array('Friend.status' =
'approved')));
}
}

And the custom paginate query:

function paginate($conditions, $fields, $order, $limit, $page = 1,
$recursive = null, $extra = array()) {
$conditions[] = array('OR' = array(
'Friend.user_id' = $extra['extra']['user_id'],
'Friend.friend_id' = $extra['extra']['user_id']
));

$results = $this-findAll($conditions, $fields, $order, $limit,
$page, $recursive);
$cleanResults = array();

if (!empty($results)) {
foreach ($results as $friend) {
if ($friend['Friend']['friend_id'] != 
$extra['extra']['user_id']) {
$friend_id = $friend['Friend']['friend_id'];
} else {
$friend_id = $friend['Friend']['user_id'];
}

$userObj = $this-User-find('first', array(
'fields' = array('User.id', 'User.username', 
'User.avatar',
'User.handle', 'User.country_id', 'User.signupDate'),
'recursive' = -1,
'conditions' = array('User.id' = $friend_id)
));

if (!empty($userObj)) {
$cleanResults[] = array_merge($friend, 
$userObj);
}
}
}

return $cleanResults;
}

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



findCount different then find('count')

2008-12-29 Thread gearvOsh

So I noticed when I used find('count') that the query is wrong:

SELECT COUNT(*) AS `count` FROM `friends` AS `Friend` LEFT JOIN
`users` AS `User` ON (`Friend`.`user_id` = `User`.`id`) WHERE 1 = 1

But when I use findCount the query and results are correct:

SELECT COUNT(*) AS `count` FROM `friends` AS `Friend` WHERE
((`Friend`.`user_id` = 2) OR (`Friend`.`friend_id` = 2))

Is this a bug, or are they supposed to do separate things, or am I
doing the find('count') incorrectly?

This is the conditions im passing:

$conditions = array('OR' = array(
'Friend.user_id'= $user_id,
'Friend.friend_id'  = $user_id
));
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: findCount different then find('count')

2008-12-29 Thread gearvOsh

All I did was this:

return $this-find('count', $conditions);
return $this-findCount($conditions);

$conditions = array('OR' = array(
 'Friend.user_id'= $user_id,
 'Friend.friend_id'  = $user_id
 ));
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HTML 4 specific CakePHP?

2008-12-28 Thread gearvOsh

I have not found any option or setting for using HTML or XHTML.

All I have seen is that you can set the Doctype, but even if you set
the Doctype as HTML, all the tags are in XHTML.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newby: Undefined index error

2008-12-28 Thread gearvOsh

You need to be using the User model.

Make sure this is in your controller: $uses = array('User');

Perhaps look at these two links also:
http://book.cakephp.org/view/171/Access-Control-Lists
http://book.cakephp.org/view/172/Authentication
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HTML 4 specific CakePHP?

2008-12-27 Thread gearvOsh

No thats the thing, XHTML is not supported.

You would need to put the content-type as application/xhtml+xml which
in most cases breaks the layout and always breaks IE. Everyone usually
puts it as text/html which then renders the browser as regular HTML
and NOT XHTML. Im not telling you XHTML is bad, all im saying is that
in the end the browser outputs any type of XHTML as HTML 4.

In CakePHP you can choose the Doctypes of XHTML or HTML but the
taglist is all XHTML, which then causes markup errors.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HTML 4 specific CakePHP?

2008-12-27 Thread gearvOsh

@Arthur Pemberton - Yeah but then if I set my Doctype as HTML 4 im
riddled with markup errors which isnt good for me or the client.

@Marcelo Andrade - Yeah thats what I was hoping was in the system, but
I guess not. Ill see if I can extend it in some way.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How would I write this query

2008-12-27 Thread gearvOsh

Im a bit new to the model system, trying to understand how I would do
a query like so.

SELECT Friend.*, User.username, User.avatar, User.handler FROM friends
AS Friend, users AS User WHERE Friend.status = 'approved' AND
((user_id = ':user_id') OR (friend_id = ':user_id')) AND User.id =
Friend.user_id ORDER BY Friend.requestTime ASC LIMIT 0,5

It would also need pagination. It works similar to myspace/facebook
etc friend lists.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How would I write this query

2008-12-27 Thread gearvOsh

Snippets of the code:

CREATE TABLE IF NOT EXISTS `friends` (
  `user_id` int(10) unsigned NOT NULL,
  `friend_id` int(10) unsigned NOT NULL,
  `status` enum('approved','pending') NOT NULL default 'pending',
  `requestTime` int(10) NOT NULL,
  KEY `user_id` (`user_id`),
  KEY `friend_id` (`friend_id`)
)

CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL auto_increment,
  `username` varchar(50) NOT NULL,
  `password` varchar(100) NOT NULL,
  `status` enum('active','inactive','pending','disabled') NOT NULL
default 'pending',
  `hash` varchar(255) NOT NULL,
  `email` varchar(50) NOT NULL,
  `handle` varchar(50) NOT NULL,
  `gender` enum('male','female') NOT NULL default 'male',
  `firstName` varchar(25) NOT NULL,
  `lastName` varchar(25) NOT NULL,
  `birthdate` int(10) unsigned NOT NULL default '0',
  `city` varchar(25) NOT NULL,
  `state_id` int(10) unsigned NOT NULL default '0',
  `country_id` int(10) unsigned NOT NULL default '0',
  `zipCode` varchar(10) NOT NULL,
  `created` datetime default NULL,
  `modified` datetime default NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `username` (`username`),
  KEY `state_id` (`state_id`),
  KEY `country_id` (`country_id`)
)

class User extends AppModel {

var $hasMany = array(
// Profile modules
'Module' = array(
'className' = 'Module',
'conditions'= array('Module.display' = 'yes'),
'order' = 'Module.orderNo ASC',
'dependent' = true
),

// Friends
'Friend' = array(
'className' = 'Friend',
'order' = 'Friend.requestTime ASC',
'dependent' = true
)
);
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How would I write this query

2008-12-27 Thread gearvOsh

I got something working on this but I ran into a problem. When joining
the user table to the friend data, I dont know if its the friend_id or
the user_id. So I will have to do some filtering and extra queries
after i grab all friends.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How would I write this query

2008-12-27 Thread gearvOsh

This is what I came up with, I dont know if theres another solution.
Also im completely lost how to paginate this.

function getMyFriends($user_id, $status = 'approved', $limit = 5) {
$friends = $this-find('all', array(
'fields' = array('Friend.*'),
'recursive' = -1,
'conditions' = array(
'Friend.status' = $status,
'OR' = array(
'Friend.user_id' = $user_id,
'Friend.friend_id' = $user_id
)
),
'order' = 'Friend.requestTime ASC',
'limit' = $limit
));

$cleanFriends = array();
if (!empty($friends)) {
foreach ($friends as $friend) {
if ($friend['Friend']['friend_id'] != $user_id) 
{
$friend_id = 
$friend['Friend']['friend_id'];
} else {
$friend_id = 
$friend['Friend']['user_id'];
}

$userObj = $this-User-find('first', array(
'fields' = array('User.id', 
'User.username', 'User.avatar',
'User.handle', 'User.country_id', 'User.signupDate'),
'recursive' = -1,
'conditions' = array('User.id' = 
$friend_id)
));

if (!empty($userObj)) {
$cleanFriends[] = array_merge($friend, 
$userObj);
}
}
}

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



Re: the Gift of 1.2 Final

2008-12-26 Thread gearvOsh

Ive only been used cake a couple of weeks but have been watching it
for years. Ive got to say I love it the most out of the others ive
tried, keep up the good work.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Upgrade to 1.2 RC4 or 1.2 Final , get a Internal Server Error

2008-12-26 Thread gearvOsh

Your filename should be xxx_controller.php (no capital). If you were
just typing it that way.

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



HTML 4 specific CakePHP?

2008-12-26 Thread gearvOsh

Honestly I really dislike the xhtml type of tags in CakePHP. There
are no reasons for that, I think it would be a better idea to make it
html 4 strict.

Heres an article on why xhtml is retarded.

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



Re: HTML 4 specific CakePHP?

2008-12-26 Thread gearvOsh

Please explain your cleanliness? HTML 4 can do everything XHTML can
except self closing tags /.

Also your XHTML is being parsed as HTML and removed, so whats your
point?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HTML 4 specific CakePHP?

2008-12-26 Thread gearvOsh

Most browsers dont support XHTML and most people dont even write XHTML
correctly. If this is your site(http://www.pembo13.com/), your DTD is
XHTML but its being parsed as HTML. So basically thats kaput, did you
read the article I posted earlier?

@Graham Weldon - Seems like a lot of work to overwrite it. Actually I
dont see how that would work well.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: I'm not sure how to write this query...

2008-12-26 Thread gearvOsh

How is your database setup? Are tags a column in the blog table or is
it its own table?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: setlocale

2008-12-23 Thread gearvOsh

Is there a reason why this has not been implemented in the l10n? Im a
but curious :p
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using dynamic values in model validation

2008-12-22 Thread gearvOsh

Thanks, also is there a way I can get the parent controller data as
well?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Setting Required Validation in a Model

2008-12-22 Thread gearvOsh

I never use allowEmpty or required = true. Simply use the rule
notEmpty which means the field cannot be empty, thus required. And
if a field doesnt have that rule, its not required, it works perfectly
for me.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using dynamic values in model validation

2008-12-22 Thread gearvOsh

No not that. In the models beforeValidate() is it possible for me to
do like $controller-params?

UsersController - User Model

So in User::beforeValidate() can I get UsersControllers params, is
basically what im asking?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Can someone explain why this happens

2008-12-22 Thread gearvOsh

Ah I came to that assumption last time, but then I had random
instances where the hash wasnt being used as the id so I got confused.

Anyway, would I just leave it? Or put an ($id = null, $hash = '')?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: exclude form helper markup?

2008-12-21 Thread gearvOsh

Yes I really dislike that also, you have to do this everytime.

?php echo $form-input('email', array('div' = false, 'label' =
false)); ?

Div removes the surrounding div, and label removes the label.

Then you can create the label manually:

?php echo $form-label('email', 'Email:', array('class' =
'label')); ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: exclude form helper markup?

2008-12-21 Thread gearvOsh

@Adam - Theres nothing wrong with it, but when you have fancy forms
and pre-cssed systems, cakes markup just gets in the way/breaks things.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Disabling Auths auto-hashing

2008-12-21 Thread gearvOsh

Is there a setting to disable the AuthComponent from automatically
hashing the password index, without having to edit the core files? It
really annoys me.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Can someone explain why this happens

2008-12-21 Thread gearvOsh

So I have an action that verifies an email address after a successful
signup. It uses a hash that was given in the email sent out.

function verify($hash = '') {
}

This is my test hash and the url becomes: /users/verify/
eac20adf536b50f9fc0be58550fde763

When I go to that page, and even without submitting a form or doing
any data checking, this query is ran.

SELECT COUNT(*) AS `count` FROM `users` AS `User` WHERE `User`.`id` =
'eac20adf536b50f9fc0be58550fde763'

Why is it grabbing the hash from the controller action and running a
query when no interaction is made?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Using dynamic values in model validation

2008-12-21 Thread gearvOsh

Is there a way to use dynamic variables within the Model validation,
an example below.

'between' = array(
'rule' = array('between', $passMin, $passMax),
'message' = 'Password must be between '. $passMin .' and '. $passMax
)

I have an array of config settings that I would like to use here, but
am lost on a way to do this.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Updating a single database rows field

2008-12-19 Thread gearvOsh

So really weird. This was my previous action in the controller.

function verify($hash = NULL) {
}

That would fail the saveField(), and the saveField would try to do an
insert. It would also grab the wrong id for the User model.
But once I changed it to the following it works fine.

function verify($hash = '') {
}

Is there a reason why that fails? Is it in the docs, or is it a bug?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how to set session when Auth component is used in login page

2008-12-19 Thread gearvOsh

Its automatic in the Auth component, just do this.

if ($this-Auth-user()) {
// they are logged in
}

If user() is null, that means they are not logged in. Hope that helps.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Validate in 1.2RC4

2008-12-19 Thread gearvOsh

Dont you need to call this?

if ($this-Task-validates()) {
// if no errors, do something
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Updating a single database rows field

2008-12-18 Thread gearvOsh

I cant use i18n/l10n in models now can I. Please show me how I would
add errors to the $this-validationErrors array with a locale. If
something works, who cares where it belongs.

@grigri - I did updateAll, I just dislike how it doesnt escape and
quote the data.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Updating a single database rows field

2008-12-18 Thread gearvOsh

Also I wish to not import and initiate a locale class in the model
everytime I need it, which would be most of the time.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Updating a single database rows field

2008-12-18 Thread gearvOsh

Like I said, I dont want to Import the locale in every model method.

Also saveField fails at this point:

if (!empty($this-id)) {
if (!$db-update($this, $fields, $values)) {
$success = false;
}
}

Because of this, When I know for sure the row exists.

if (!$this-__exists  $count  0) {
$this-id = false;
}

Which fails because it runs this query:

SELECT COUNT(*) AS `count` FROM `users` AS `User` WHERE `User`.`id` =
'eac20adf536b50f9fc0be58550fde763'

Because for some reason the id is being pulled from the controller
action argument, which makes no god damn sense.

eac20adf536b50f9fc0be58550fde763 = $hash in verify($hash) {
http://cake/users/verify/eac20adf536b50f9fc0be58550fde763

I echo the id before $this-exists() and its correct. But when I echo
the id after that is called, it is wrong.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Updating a single database rows field

2008-12-18 Thread gearvOsh

I even moved all the code into the Model, did what you said, and its
still doing an insert instead of an update. Heres the method I call in
the controller:

function verifyEmailExpiration($username, $password, $hash, $expHours)
{
$userObj = $this-find('first', array(
'conditions' = array(
'User.username' = $username,
'User.password' = $password,
'User.hash' = $hash
),
'fields' = array('User.id', 'User.signupDate', 'User.status')
));

if (!empty($userObj)) {
$this-create();
$this-id = $userObj['User']['id'];

// Get timeframe
$signupTime = strtotime('+'. $expHours .' days', 
$userObj['User']
['signupDate']);
$currentTime = time();

if ($userObj['User']['status'] == 'active') {
$this-invalidate('', 'alreadyVerified');
return false;

} else if ($currentTime  $signupTime) {
$this-saveField('status', 'active');
return true;

} else {
$this-saveField('status', 'inactive');
$this-invalidate('', 'verifyTimeElapsed', 
array($expHours));
return false;
}
} else {
$this-invalidate('', 'verifyFailure');
}

return false;
}

Also I thought models by default didnt inherit the locale stuff, is
the app_model an exception?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Updating a single database rows field

2008-12-17 Thread gearvOsh

Ok, I may be stupid...  but how would I update a single field on a
single row. Something like the following without having to write a
custom query.

UPDATE users SET status = 'active' WHERE id = 1

Ive tried doing saveField() but that inserts a new row. Ive also tried
using updateAll() but that doesnt clean/escape the data correctly. Ive
also tried $this-Model-set() and then doing a save but also no. Any
ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Updating a single database rows field

2008-12-17 Thread gearvOsh

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



Re: Updating a single database rows field

2008-12-17 Thread gearvOsh

Tried it again that way and heres the error:

Warning (512): SQL Error: 1062: Duplicate entry '' for key 2 [CORE\cake
\libs\model\datasources\dbo_source.php, line 521]
Query: INSERT INTO `users` (`status`) VALUES ('inactive')

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



Re: Updating a single database rows field

2008-12-17 Thread gearvOsh

Nope, still doesn't work. This seems like a lot of hassle/steps in
between just to do something simple like update.

Heres a snippet of my code:

if ($this-User-validates()) {
$userObj = $this-User-find('first', array(
'conditions' = array(
'User.username' = $this-data['User']['username'],
'User.password' = $this-data['User']['password'],
'User.hash' = $hash
),
'fields' = array('User.id', 'User.signupDate')
));

if (!empty($userObj)) {
$this-User-create();
$this-User-id = $userObj['User']['id'];

if ($this-User-verifyEmail($userObj['User']['signupDate'],
$this-Settings-grab('email_verify_exp_hours'))) {
$this-User-saveField('status', 'active');
} else {
$this-User-invalidate('', sprintf(__d('errors',
'verifyTimeElapsed', true), $this-Settings-grab
('email_verify_exp_hours')));
$this-User-saveField('status', 'inactive');
}
} else {
$this-User-invalidate('', __d('errors', 'verifyFailure',
true));
}
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Updating a single database rows field

2008-12-17 Thread gearvOsh

I was only doing what the other guy suggested, I usually do not have
the create() method.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Overkill for a starter project?

2008-12-17 Thread gearvOsh

Honestly things like that I would just manually code or even use
Wordpress just because its so simple. You could use CakePHP simply for
the practice and automation, but there are no downsides using Cake.
Perhaps just a ton of files the client wouldn't understand what
they're for.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: AuthComponent Error... Wrong Password all the Time

2008-12-17 Thread gearvOsh

Try this: http://www.milesj.me/blog/read/debugging-cakephp-auth/

Or it could also be your password column in your database is at like
30 varchar... you would at least need 50+ if your hashing passwords.
Its possible some of the hashed password got cut off.

On Dec 17, 11:29 am, Christian csuei...@gmail.com wrote:
 Hello,

 I've been trying to find an error that does not let me login.
 Basically when I submit the correct username and password it says its
 a wrong password. I have not yet changed the layout views and in the
 default layout a table shows up with the SQL queries that were
 executed, well there I noticed that the password hashed being search
 for was not the same one that in the database for the user im login
 as, but the curious thing is that the hash is almost the same just
 about 5 or 8 extra characters. I am clueless on what to do really, it
 seems like the password i enter when i register is not the same one
 that gets saved. Help please?

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



Re: Updating a single database rows field

2008-12-17 Thread gearvOsh

Oh but the extra code is for extra form validation on my end. Using
invalidate() adds errors to the array that I can then loop through and
display in the view (I dislike having the error show up after the
input).

On Dec 17, 3:24 am, AD7six andydawso...@gmail.com wrote:
 On Dec 17, 9:56 am, gearvOsh mileswjohn...@gmail.com wrote:

  Nope, still doesn't work. This seems like a lot of hassle/steps in
  between just to do something simple like update.

 That's a lot of fat controller code for something as simple as that
 too ;). e.g. You should almost never need to do this in a controller
 $this-User-invalidate...

 Of the snippet you pasted, your controller code should be *no more*
 than

 function xyz($a, $param) {
 if ($this-data) {
 ..
 if ($this-User-save($data, extra, params)) {
  $this-Session-setFlash('success');
  $this-redirect('/wherever');

 }
 ..
 }

 AD



  Heres a snippet of my code:

  if ($this-User-validates()) {
      $userObj = $this-User-find('first', array(
          'conditions' = array(
              'User.username' = $this-data['User']['username'],
              'User.password' = $this-data['User']['password'],
              'User.hash' = $hash
          ),
          'fields' = array('User.id', 'User.signupDate')
      ));

      if (!empty($userObj)) {
          $this-User-create();
          $this-User-id = $userObj['User']['id'];

          if ($this-User-verifyEmail($userObj['User']['signupDate'],
  $this-Settings-grab('email_verify_exp_hours'))) {
              $this-User-saveField('status', 'active');
          } else {
              $this-User-invalidate('', sprintf(__d('errors',
  'verifyTimeElapsed', true), $this-Settings-grab
  ('email_verify_exp_hours')));
              $this-User-saveField('status', 'inactive');
          }
      } else {
          $this-User-invalidate('', __d('errors', 'verifyFailure',
  true));
      }

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



Re: Updating a single database rows field

2008-12-17 Thread gearvOsh

I still have yet to find a straight forward way to do this, so ill
simply do something like this:

function update($user_id, $fields) {
if (is_array($fields)) {
App::import('Sanitize');
Sanitize::clean($fields);

$cleanFields = array();
foreach ($fields as $field = $value) {
$cleanFields[] = User.. $field . = '. $value .';
}

$sql = UPDATE users AS User SET . implode(', ', $cleanFields) 
.
WHERE User.id = . Sanitize::escape($user_id) . LIMIT 1;
return $this-query($sql);
}

return NULL;
}

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



Re: $validate an array

2008-12-15 Thread gearvOsh

Perhaps do something like this

if ($this-RequestHandler-isPost()) {
$cleanData = array();
foreach ($this-data as $field = $data) {
// Rebuild the cleanData array based on your structure for the
database
}

$this-data = NULL;
$this-data['Model'] = $cleanData;

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



Re: Changing the Auth User Model

2008-12-14 Thread gearvOsh

Have you tried placing the Auth information in AppControllers
beforeFilter()? Try that and see what happens... and if that doesnt
help, look in the Auth Component manually.

On Dec 14, 11:59 am, DavidH djhollingwo...@gmail.com wrote:
 Please note that since the above post I've corrected the model name to
 Twitcher as opposed to Twitchers; but it still doesn't work.

         function beforeFilter()
         {
                 $this-Auth-userModel = 'Twitcher';
                 $this-Auth-loginAction = array('controller' = 'twitchers',
 'action' = 'login');
                 // $this-Auth-allow('view');
                 $this-Auth-redirectLogin = array('controller' = 'birds', 
 'action'
 = 'view');
         }

 On Dec 14, 7:55 pm, DavidH djhollingwo...@gmail.com wrote:

  Hi

  That's what I thought too. Here's one of my controllers:

  class BirdsController extends AppController {
          var $name = 'Birds';
          var $scaffold;
          var $components = array('Auth');

          function beforeFilter()
          {
                  $this-Auth-userModel = 'Twitchers';
                  $this-Auth-loginAction = array('controller' = 
  'twitchers',
  'action' = 'login');
                  // $this-Auth-allow('view');
                  $this-Auth-redirectLogin = array('controller' = 'birds', 
  'action'
  = 'view');
          }

  }

  However running any action in the birds view results in the above
  mentioned error looking for a users controller.

  On Dec 14, 6:48 pm, thatsgreat2345 thatsgreat2..@gmail.com wrote:

   That line should be in the beforeFilter , is that where it is located,
   if it is being used through out your controllers create an
   app_controller.php and add a beforeFilter to it that way auth is used
   by all your controllers, as well as you will only have to define the
   table once rather than in each controller.

   On Dec 14, 10:19 am, DavidH djhollingwo.@gmail.com wrote:

Sorry for the confusion.

Model: Twitcher
DB Table: Twitchers
Controller: twitchers_controller.php

I'm sure the Twitcher(s) stuff is OK. Why isn't it acting on my
userModel assignment?

David

On Dec 14, 5:50 pm, thatsgreat2345 thatsgreat2.@gmail.com 
wrote:

 The model is called Twichers? The model should be singular, called
 Twicher(models/twicher.php), the table in the database should be
 called twichers, and controller should be twichers_controller.php
 which you have.

 On Dec 14, 5:14 am, DavidH djhollingwo...@gmail.com wrote:

  Hi

  I'm sure there must be a simple solution to this; but I just can't 
  get
  it working.

  I'm using CakePHP version 1.2.0.7296 RC2 and I'm trying to implement
  authorization using the Auth component. My application uses a table 
  /
  model called Twitchers instead of users and so I've included the
  line:

  $this-Auth-userModel = 'Twitcher';

  throughout my controllers. Howeevr it doesn't matter how many times 
  I
  include this line Cake persistently tells me it can't find the
  UsersController in app/controllers/users_controller.php.

  I do have a TwitchersController in twitchers_controller.php.

  I've peppered just about every controller method with the userModel
  assignment; but I just can't get Cake to accept it.

  What have I omitted or done wrong?

  Thanks

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



Re: $validate an array

2008-12-14 Thread gearvOsh

Why/How is it a multidimensional array? If you use the FormHelper it
builds it into a nicely formatted array in $this-data['ModelName'];
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database design . Beginner having trouble.

2008-12-13 Thread gearvOsh

If I believe what you are saying, something like this would work (not
sure what fields you need):

// all the tenants
tenants
- id
- name

// all the expenses
expenses
- id
- cost

// relating a tenant to an expense = multiple tenants possible on an
expense
tenantExpenseRelation
- id
- tenant_id
- expenses_id
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Is CakePHP 1.2 fully backwards compatible with 1.1.16?

2008-12-12 Thread gearvOsh

Also, correct me if im mistaken.

Instead of loadModel('ModelName') and other variations, its now
App::import('Model', 'ModelName');

On Dec 12, 10:21 am, aranworld arancarli...@gmail.com wrote:
 The following are the main things I came across during a recent
 upgrade:

 -- all the html helper functions related to forms have been eliminated
 and replaced by the form helper
 -- getElement() has been replaced by element()
 -- the syntax for making queries has been significantly altered
 especially when it comes to getting lists used as options in a select
 form element

 Obviously, there is a lot more, but those elements are likely to be
 widespread in your website.

 -Aran

 On Dec 12, 9:20 am, teknoid teknoid.cake...@gmail.com wrote:

  No, you'll need to do quite a few adjustments to make it work exactly
  right. Then there is a switch to 1.2 features... i.e. even though
  things may work as is, there has been a number of improvements that
  you should take into account and modify your app to follow the latest
  recommended practices...

  Depending on your app (and cakephp skill) it might take a few hours a
  day or a year... very hard to estimate :)

  On Dec 12, 12:04 pm, glastoveteran alex.bo...@gmail.com wrote:

   Hi all,

   Is CakePHP 1.2 fully backwards compatible with 1.1.16?  If I just
   upgrade the cake directory can I expect everything to work straight
   away?

   Thanks,

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



Re: Debugging Auth: getting the name of teh action I get kicked

2008-12-12 Thread gearvOsh

Or check the $this-params, I believe its $this-params['action'];

On Dec 12, 7:06 am, Daniel Hofstetter dhofs...@gmail.com wrote:
 Hi Anja,

  I get kicked out of some actions in some controllers. I have alread
  placed
  function beforeFilter()
      {
          parent::beforeFilter();
                  $this-Auth-authError = sprintf(__('You are not
  authorized to access that location %s .',true),$this-name);
      }

  Which gives me at least the controller name.
  How can i get the name of the action which I am not authorized to see?
  Is there a possibility to get it shown on page?

  Mind: I have about 700 actions so something which I haven't to add to
  each action would be ideal.

 $this-action should do the trick.

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



Re: Prevent redirect in Auth

2008-12-12 Thread gearvOsh

It seems you will have to remove/comment out that part that redirects
in the auth component manually.

On Dec 12, 4:41 am, Dav fatsl...@gmail.com wrote:
 Tried that earlier, still redirects to users/login.

 I have this in my controller
 function beforeFilter() {
     $this-Auth-autoRedirect = false;

 }

 function login() {
         e('login...');
         die;

 }

 But it doesn't run, still redirect.

 Isn't the autoRedirect prop for After a login post has been made?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



$form-input with onkeyup, onfocus, etc

2008-12-12 Thread gearvOsh

So I have input fields that need javascript events for onfocus and
onkeyup.. here is my code:

?php // Username
echo $form-input('username', array('onkeyup' = populateUrl
('username', 'usernameUrl');, 'onfocus'= showSignupHelp
('username');)); ?

That works, BUT when you look at the source it looks like the
following:

input name=data[User][username] type=text  onkeyup=populateUrl
(#039;username#039;, #039;usernameUrl#039;);
onfocus=showSignupHelp(#039;username#039;); value=
id=UserUsername /

It seems the form helper is escaping all quotes and characters How
am I to bypass this? I've tried different combinations of quotes and
escaping quotes (\') etc but nothing works.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Getting an array of errors during validation

2008-12-11 Thread gearvOsh

So I understand the Model validation using $validate. I applied snooks
multiple validations using 
http://snook.ca/archives/cakephp/multiple_validation_sets_cakephp/,
all that works perfectly.

I do however dislike it when a field errors, the error message is
shown after the input. Id rather a list of all errors be shown above
the form, so what im asking is...

Is there a way to get an array of all current errors in the form?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Getting an array of errors during validation

2008-12-11 Thread gearvOsh

Ok ill take a look at that. Hopefully I can do something to get an
array so I can do a simple loop.

On Dec 11, 12:27 am, Marcus [EMAIL PROTECTED] wrote:
 On Dec 11, 9:14 am, gearvOsh [EMAIL PROTECTED] wrote:

  So I understand the Model validation using $validate. I applied snooks
  multiple validations 
  usinghttp://snook.ca/archives/cakephp/multiple_validation_sets_cakephp/,
  all that works perfectly.

  I do however dislike it when a field errors, the error message is
  shown after the input. Id rather a list of all errors be shown above
  the form, so what im asking is...

 Simply use FormHelper::error() to print error messages wherever and
 whenever you want:

 echo($form-error('Model.field1');
 echo($form-error('Model.field2');

 (http://api.cakephp.org/class_form_helper.html)

 Don't forget to remove the error message from your input fields:

 echo($form-input('Model.field1', array('error' = false)));
 echo($form-input('Model.field2', array('error' = false)));

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



Re: Getting an array of errors during validation

2008-12-11 Thread gearvOsh

I figured it out. $validationErrors contains the array, I simply set
it in the view.

// login.ctp
?php echo $this-element('errors', array('errors' = $form-
validationErrors['User'])); ?

// elements/errors.ctp
?php if (!empty($errors)) { ?
div class=failed
h5?php printf(__d('errors', 'totalErrors', true), count
($errors)); ?/h5

ul
?php foreach ($errors as $field = $error) { ?
li?php echo $error; ?/li
?php } ?
/ul
/div
?php } ?

But since im doing i18n/l10n and am not able to do __() in the model
or the view, I had to do it in the controller.

// Validation
$this-User-validate = array(
'username' = array(
'notEmpty' = array(
'rule' = 'notEmpty',
'message' = __d('errors', 'usernameEmpty2', true)
)),
'password' = array(
'notEmpty' = array(
'rule' = 'notEmpty',
'message' = __d('errors', 'passwordEmpty2', true)
)),
);

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



Re: Getting an array of errors during validation

2008-12-11 Thread gearvOsh

Oh and also stupid me, its basically in the manual:

http://book.cakephp.org/view/410/Validating-Data-from-the-Controller

My way doesnt require you to set the data to the view though, but
either way works.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question on form validating

2008-12-11 Thread gearvOsh

I just finished doing this today, these two links should help:

http://book.cakephp.org/view/125/Data-Validation
http://groups.google.com/group/cake-php/browse_thread/thread/d5e98df32a08c5cd#
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question on form validating

2008-12-11 Thread gearvOsh

Yes, I was about to to point out that it might be because your model
file name is capitalized.

On Dec 11, 4:57 am, AJV aapo.vi...@gmail.com wrote:
 :D

 Well I guess I just confirmed my newbie status, I had written the
 names of the model files Capitalized. I noticed that small letters
 work much better :D

 Well, that was a fun couple of hours.

 Aapo

 On Dec 11, 2:49 pm, AJV aapo.vi...@gmail.com wrote:

  I'm quessing this has something to do with communicating with the
  model file. Even if I write die() or some broken code to the model,
  nothing happens. Are there any ways to confirm that the controller
  talks to the model, and if not, how could it be fixed?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Finding Auth'd users Username

2008-12-11 Thread gearvOsh

If your logged in its:

$this-Auth-user('username');

Or you can assign a user variable to the view:

$this-set('user', $this-Auth-user());

echo $user['username'];

Hope that helps.

On Dec 11, 11:10 am, bioselem...@gmail.com bioselem...@gmail.com
wrote:
 I've been wacking my head on the wall for the past few days on this.
 I've got a basic auth login/logout system set up but for some reason
 nothing i try gets me the username. I just want to display it as in
 Your logged in as xyz. I know it's probably something stupid and I'm
 no doubt going about it the wrong way. Any help?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Prevent redirect in Auth

2008-12-11 Thread gearvOsh

Perhaps look at this: http://book.cakephp.org/view/395/autoRedirect

If that doesnt work, you may have to edit the core files manually.

On Dec 11, 9:40 am, Dav fatsl...@gmail.com wrote:
 Hi,

 I want to use the Auth component but I don't want it to send out the
 location: header.
 (I'm not using ajax)

 I just want to be able to override and control what should happen when
 a controller with auth is accessed.

 For instance just print out a custom error message.

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



Re: $form-input() helper question

2008-12-11 Thread gearvOsh

Yes most likely, but in my own apps I just write the div manually and
only use $html for forms/links and images.

On Dec 11, 1:53 pm, maytawn mayt...@gmail.com wrote:
 gearvOsh -

 Yeah, your're right.  I don't know what I was thinking... but is does
 bring up a related question.  If I was using the CakePHP form
 validation then I would need my input tags wrapped in the correct div
 tags... correct?  Since I'm setting div=false how whold I modify your
 suggestion to make sure my input tags are wrapped in the correct div
 tags?  would I have to do that by hand too, using $html-div()?

 On Dec 11, 4:02 am, Jon Bennett jmbenn...@gmail.com wrote:

  Hi maytawn,

    Thanks for the suggestion.  I tried it... but it did not seem to work.

    I added the CSS to my main css file.  And this is what I have in the
    view:

  what was the outputted html like? What did Firebug say tell you about
  the elements? What I suggested with definitely work in theory, but the
  CSS was untested, merely there to show how you can apply more than one
  class to an element.

  cheers,

  jon

  --

  jon bennett
  w:http://www.jben.net/
  iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $form-input() helper question

2008-12-10 Thread gearvOsh

Or you can disable the label on input and build the label yourself:

Disables the wrapping div and the label from showing
?php echo $form-input('password', array('maxLength' = '20', 'div'
= false, 'label' = false)); ?

Build the label manually
?php echo $form-label('password', __('password', true), array
('class' = 'label')); ?

On Dec 10, 5:29 pm, maytawn [EMAIL PROTECTED] wrote:
 Thanks.  I will try what you suggest.  I know that it is better to
 avoid inline CSS where possible.  But in this case it is styling that
 will only be used in one very specific place and I didn't want to
 clutter the main CSS file with such an insignificant snippet.  But I
 can live with doing that way if I have to.

 Thanks again.

 On Dec 10, 4:23 pm, Lane [EMAIL PROTECTED] wrote:

  Hi maytawn,

  I would advise against using the inline css to style the label tag.  I
  would recommend adding the CSS to your file but specify a specific
  label defininition for the cake forms.  For example the form helper
  automatically wraps the form elements and labels in a div with an
  appropriate classname for the type of form element.  So to style the
  labels for a form input you could use:

  div.input label { width: 300px; }

  Let me know if that helps.

  - Lane

  On Dec 10, 4:43 pm, maytawn [EMAIL PROTECTED] wrote:

   I have an instance where I need to increase the width and style of the
   label tag that is automatically created with the $form-input()
   method.  Since I already have a base CSS defined for all lable tags
   I would like to add some inline CSS using the style= attribute.  I
   am able to add the style= attribute to the input tage using the
   'options' key 'style' as shown below.
   echo $form-input('password', array('label' = 'New Password:', 'type'
   = 'password', 'style' = 'width:150px', 'after' = 'br /'));

   Is there a way to pass in a parameter that would allow me to do the
   same for the lable tag?- Hide quoted text -

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



More then 1 .po file for i18n/l10n

2008-12-10 Thread gearvOsh

So I have an existing language system on a site that I am converting
to CakePHP. This language system has about 8 files, each with a long
list of variables. I noticed in Cake it only has a default.po file,
are we able to add more then just the default.po file? If so, what if
there are 2 variables named the same, but in 2 different .po files.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $form-input() helper question

2008-12-10 Thread gearvOsh

You mean like this? label for=inputIdLabel input type=text
id=inputId/label ?

Thats incorrect syntax.

On Dec 10, 8:59 pm, maytawn [EMAIL PROTECTED] wrote:
 gearvOsh:

 I like your idea... it sems simple, but how do I call the $form-label
 () method so that the $form-input() method is wrapped inside?

 On Dec 10, 5:35 pm, Jon Bennett [EMAIL PROTECTED] wrote:

  Hi maytawn,

    I have an instance where I need to increase the width and style of the
    label tag that is automatically created with the $form-input()
    method.  Since I already have a base CSS defined for all lable tags
    I would like to add some inline CSS using the style= attribute.  I
    am able to add the style= attribute to the input tage using the
    'options' key 'style' as shown below.
    echo $form-input('password', array('label' = 'New Password:', 'type'
    = 'password', 'style' = 'width:150px', 'after' = 'br /'));

  why not add more than one class?

  .input-long label {
          clear: both; display: block; width: 150px;

  }

  .input-long input {
          clear: both; width: 150px;

  }

  echo $form-input('password', array(
          'label' =   'New Password:',
          'type'  =   'password',
          'class' =   'input input-long'
  ));

  hth

  jon

  --

  jon bennett
  w:http://www.jben.net/
  iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth-login() Not working correctly?

2008-12-09 Thread gearvOsh

I found out the problem after much debugging and stress. I was using
an old db that didnt use a salted password HENCE thats why it would
not login because it was adding the salt to the passwords. So when I
removed the salt it worked. Something like that should be noted in the
cookbook.

Also, if you are logged in, should you NOT be able to go to the login
page?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $this-Auth-user() is empty from controllers other than user

2008-12-09 Thread gearvOsh

Do all these controllers run the parent::beforeFilter() ?

On Dec 9, 12:38 pm, mr_timp [EMAIL PROTECTED] wrote:
 Well I think I have found the root-cause of the problem.  When
 navigating to pages generated via the user controller I have one
 session ID but when browsing to pages generated by other controllers
 another session ID is displayed - MOST odd!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth-login() Not working correctly?

2008-12-09 Thread gearvOsh

Ya but my Auth isnt redirecting itself, not sure if its supposed to. I
could just do a manual if statement though.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth-login() Not working correctly?

2008-12-08 Thread gearvOsh

Here is my AppController and my UsersController:

class AppController extends Controller {

var $components = array('Auth');

function beforeFilter() {
Security::setHash('md5');

// Authenticate
$this-Auth-sessionKey = 'User';
//$this-Auth-authorize = 'controller';
$this-Auth-loginAction = array('controller' = 'users', 
'action'
= 'login');
$this-Auth-loginRedirect = $referer;
$this-Auth-logoutRedirect = array('controller' = 'site', 
'action'
= 'index', 'home');
}
}

class UsersController extends AppController {

function index() {
$this-redirect(array('controller' = 'users', 'action' =
'login'));
}

/**
 * Login
 */
function login() {
$this-pageTitle = 'Login - GameSync';
$this-set('activeTab', 'login');
}

/**
 * Logout
 */
function logout() {
$this-redirect($this-Auth-logout());
}
}

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



Auth-login() Not working correctly?

2008-12-07 Thread gearvOsh

So im trying to get the Auth component to work, here is my
AppController.

function beforeFilter() {
// Referer
$referer = $this-referer(null, true);
if (empty($referer)) {
$referer = array('controller' = 'dashboard', 'action' = 'index');
}

// Authenticate
if (isset($this-Auth)) {
$this-Auth-sessionKey = 'User';
//$this-Auth-authorize = 'controller';
$this-Auth-loginAction = array('controller' = 'users', 'action' =
'login');
$this-Auth-loginRedirect = $referer;
$this-Auth-logoutRedirect = array('controller' = 'site', 'action'
= 'index', 'home');
}
}

That all works fine, its just when I submit my login form (users/
login), the password field does not get encrypted, so it never finds
any rows. I read the docs and it said that it should auto-encrypt any
field named password, obviously its not.

Login action:

// Form processing
if (!empty($this-data)) {
$this-Auth-login($this-data['Form']);
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth-login() Not working correctly?

2008-12-07 Thread gearvOsh

Also heres a debug of $this-data:

Array
(
[Form] = Array
(
[username] = test123
[password] = pass123
)

)

And the query being run by $this-Auth-login():

SELECT `User`.`id`, `User`.`username`, `User`.`password`  FROM
`users` AS `User` WHERE `User`.`username` = 'test123' AND
`User`.`password` = 'pass123' LIMIT 1
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth-login() Not working correctly?

2008-12-07 Thread gearvOsh

I tried removing the $this-Auth-login() and now it doesnt do
anything. No query is fired.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth-login() Not working correctly?

2008-12-07 Thread gearvOsh

Actually nevermind. The $this-data had to be under User, not Form.
Now the login is submitting and the query is being fired... BUT now
everytime I hit login the password field goes empty and it never
works.

On Dec 7, 9:50 pm, gearvOsh [EMAIL PROTECTED] wrote:
 I tried removing the $this-Auth-login() and now it doesnt do
 anything. No query is fired.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Handling Multiple Checkbox in Pagination

2008-12-06 Thread gearvOsh

Perhaps you can save them into an array and place the array into a
session.

On Dec 6, 1:26 am, krishna [EMAIL PROTECTED] wrote:
 Handling Multiple Checkbox in Pagination

 Hi Cake Bakers,

 In my project i am having a users table. In the admin, i have an
 option for the admin to message to particular users based selection.
 This selection is based on the pagination.
 Now my problem is that, when the admin selects 3 users(say) from the
 first page,
 then selects another 3 users from next page, how can i track the users
 list for which the
 message to be sent.

 Kindly help.

 Regards,
 Krishnan Nair

 ===

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



Re: Custom queries/sql in models/behaviors

2008-12-06 Thread gearvOsh

So I have this method within the model. The same array is returned
from above  but I get a mysql error for the contain.

SQL Error: 1064: You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near 'contain' at line 1 [CORE\cake\libs\model
\datasources\dbo_source.php, line 521]


function test() {
$this-actsAs = array('Container');

$this-bindModel(array(
'hasMany' = array(
'TeamMember' = array(
'className' = 'TeamMember',
'foreignKey'= 'team_id',
'conditions'= 
array('TeamMember.status' = 'approved'),
'order' = 
'TeamMember.joinDate ASC',
'dependent' = true,
//'finderQuery' = 'SELECT 
User.username, User.handle,
User.avatar FROM user AS User, teamMember as TeamMember WHERE User.id
= TeamMember.user_id LIMIT 1'
),
'TeamGame' = array(
'className' = 'TeamGame',
'foreignKey'= 'team_id'
)
)
));

$this-contain(array('TeamMember' = array('User'), 
'TeamGame'));

return $this-find('first');
}

On Dec 6, 3:35 am, Adam Royle [EMAIL PROTECTED] wrote:
 Add:

 var $actsAs = array('Containable');

 to your Team model.

 Then add this before your find() call:

 $this-Team-contain('TeamMember' = array('User'), 'TeamGame');

 Cheers,
 Adam

 On Dec 6, 12:51 pm, gearvOsh [EMAIL PROTECTED] wrote:

  Ok thats weird, I dont have foreign keys really setup but it still
  works. Im using $hasMany for members and games. But within the
  TeamMember and TeamGame arrays, is there way to get more information
  returned? I would need the members name, avatar, etc.

  Array
  (
      [0] = Array
          (
              [Team] = Array
                  (
                      [id] = 1
                      [status] = approved
                      [name] = chair
                      [tag] = _h_
                      [urlName] =
                      [website] =
                      [irc] =
                      [about] =
                      [servers] =
                      [logo] =
                      [createDate] = 0
                      [state_id] = 0
                      [country_id] = 0
                      [created] =
                      [modified] =
                  )

              [TeamMember] = Array
                  (
                      [0] = Array
                          (
                              [id] = 4
                              [team_id] = 1
                              [user_id] = 32
                              [role] = captain
                              [status] = approved
                              [joinDate] = 1211498560
                          )
                  )

              [TeamGame] = Array
                  (
                      [0] = Array
                          (
                              [team_id] = 1
                              [gameSystem_id] = 3
                          )
                  )
          )
  )

  On Dec 5, 4:08 pm, gearvOsh [EMAIL PROTECTED] wrote:

   Because I cant use foreign keys so all of those features are useless
   to me. I also cant use linked models.

   On Dec 5, 1:12 pm, teknoid [EMAIL PROTECTED] wrote:

 I am not a big fan of the model system because its very limiting if 
 you have advanced queries.

How did you come to that conclusion?

...

If you properly created your models and associations, a simple find
('all') will give you: Team, Roster, Game and League models with all
the relevant info.

On Dec 4, 6:23 pm, gearvOsh [EMAIL PROTECTED] wrote:

 Ok in my current system (its a gaming league) I have packages. I will
 use a Team package as an example. In this Team package I have a method
 getTeamInfo() which calls out to external queries. I do this so I only
 have to write a query once and can access its results through a method
 call. I prefer this way instead of having to write the same query over
 and over for different instances.

 require('teamExt.php');
 require('userExt.php');

 class Team {

         public static function getTeamInfo($team_id) {
                 $team = TeamExt::getTeamInfo($team_id);

                 if (!empty($team)) {
                         $team['roster'] = 
 TeamExt::getRoster($team_id);
                         $team['games']  = 
 TeamExt::getGamesPlayed($team_id

SQL error with Auth Component?

2008-12-06 Thread gearvOsh

So Im working with the auth component, heres my AppController.

class AppController extends Controller {

var $components = array('Auth');

function beforeFilter() {
// Authenticate
if (isset($this-Auth)) {
Security::setHash('md5');
$this-Auth-userScope = array('User.status' = 
'active');
$this-Auth-loginAction = '/auth/login/';
$this-Auth-loginRedirect = '/dashboard/';
$this-Auth-logoutRedirect = '/';
}
}

}

And my beforeFilter in my controller:

function beforeFilter() {
// No authorize
$this-Auth-allow('signup', 'reset', 'verify', 'forgot');
}

That should all work and the signup... etc pages should not require
authorization... but I keep getting these SQL errors. It looks like it
thinks auth is a model.

Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the
right syntax to use near 'allow' at line 1 [CORE\cake\libs\model
\datasources\dbo_source.php, line 521]

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



Re: Custom Helper not Working

2008-12-06 Thread gearvOsh

Missing php open/close tags?

On Dec 6, 1:00 pm, Sapslabs [EMAIL PROTECTED] wrote:
 I am creating a custom helper like this

 class ElapsedHelper extends AppHelper {
     function test(){
              return $this-output('test');
     }

 }

 Which is save under views/helpers/elapsed.php

 I am including this on my controller using

 var $helpers = array('Elapsed');

 but when I try it I get this error:

 class ElapsedHelper extends AppHelper {   function test(){ return
 $this-output('test');} }

 Missing Helper Class

 Error: The helper class ElapsedHelper can not be found or does not
 exist.

 Error: Create the class below in file: www/views/helpers/elapsed.php

 ?php
 class ElapsedHelper extends AppHelper {

 }

 ?

 Any idea on what I am doing wrong?

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



Re: SQL error with Auth Component?

2008-12-06 Thread gearvOsh

It seems this works below, but my previous code does not.

$this-Auth-allowedActions = array('signup', 'reset', 'verify',
'forgot');

Perhaps something wrong with the docs?
http://book.cakephp.org/view/247/AuthComponent-Methods#allow-382
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



  1   2   >