Re: Validate rule: multiple (CookBook -> 4.1.4.17 Multiple)

2009-02-19 Thread WebbedIT

I have considered this and to be honest I will have to go down this
route for this particular validation rule as it also has a dependency,
but I was trying to get to the bottom of two things for future use:

1. How do I apply the built-in 'multiple' validation rule?

2. If Model::saveAll() saves HABTM data why does it not validate that
data first?

I have worked out the answer to question 1 but do not have an answer
for question 2.  Is this something I need to submit as a ticket as I'm
sure saveAll should validate any data it then saves for security
purposes?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



AW: Search db with find & conditions

2009-02-19 Thread Liebermann, Anja Carolin

That is how I do it in a very complex find condition:

$param = array();
$param['Hotelmaster.deleted'] = '0';

if($this->data['Hotelmaster']['name'])$param['Hotelmaster.name LIKE'] = 
'%'.trim($this->data['Hotelmaster']['name']).'%';
if($this->data['Hotelmaster']['buchungscode1'] && 
strlen($this->data['Hotelmaster']['buchungscode1'])>2){
$param['or'] = array (
'Hotelmaster.buchungscode1 LIKE' => 
'%'.strtoupper(trim($this->data['Hotelmaster']['buchungscode1'])).'%',
'Hotelmaster.buchungscode2 LIKE' => 
'%'.strtoupper(trim($this->data['Hotelmaster']['buchungscode1'])).'%',
'Hotelmaster.buchungscode3 LIKE' => 
'%'.strtoupper(trim($this->data['Hotelmaster']['buchungscode1'])).'%',
'Hotelmaster.buchungscode4 LIKE' => 
'%'.strtoupper(trim($this->data['Hotelmaster']['buchungscode1'])).'%');

}if($this->data['Hotelmaster']['exklusiv'])$param['Hotelmaster.exklusiv'] = 
$this->data['Hotelmaster']['exklusiv'];

if($this->data['Hotelmaster']['kategorie'])$param['Hotelmaster.kategorie'] = 
$this->data['Hotelmaster']['kategorie'];

if($this->data['Hotelmaster']['zielgebietmaster_id'])$param['Hotelmaster.zielgebietmaster_id']
 = $this->data['Hotelmaster']['zielgebietmaster_id'];

if($this->data['Hotelmaster']['ortmaster_id'])$param['Hotelmaster.ortmaster_id']
 = $this->data['Hotelmaster']['ortmaster_id'];

Hope that example helps

Anja

-Ursprüngliche Nachricht-
Von: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] Im Auftrag 
von rb
Gesendet: Donnerstag, 19. Februar 2009 20:00
An: CakePHP
Betreff: Re: Search db with find & conditions



The good news:
 I was able to get it working (thanks!)

The bad news:
 I'm now trying to append a LIKE condition, and I'm not appending the 
conditions array correctly. Every time I attempt to append the LIKE condition, 
it overwrites anything previously appended to the array, as well as does some 
other funky stuff.


$formSchools = $this->data['schools'];

$conditions = array();

if(!empty($formSchools['zip_mail']))
$conditions['School.zip_mail'] = $formSchools['zip_mail'];

if(!empty($formSchools['name']))
$conditions = "School.name LIKE '%{$formSchools['name']}%'";

if(!empty($formSchools['street_mail']))
$conditions['School.street_mail'] = $formSchools['street_mail'];

if(!empty($formSchools['state_province'])
$conditions['School.state_mail'] = $formSchools['state_province'];



I've tried a few different ways, but still not achieving the correct array 
structure.

So basically my question, How do you append a LIKE condition into the 
$conditions array?





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



AW: user Profile protection howto

2009-02-19 Thread Liebermann, Anja Carolin

Hi Amarradi,


This is how I do it:

As you can see i don't give any parameter at all, so the user cannot meddle 
with it.

function edit() {
/*
 * with this function the user can change his / her own password
 */
if (!empty($this->data)) {
if ($this->data['User']['password'] == 
$this->Auth->password('')){
$params = array(
'validate' => true,
'fieldList' => 
array('id','name','username','deleted','gruppe_id')
);
} else {
$params = array('validate' => true);
}

$this->data['User']['id'] = $this->Auth->user('id');
if ($this->data['User']['password'] == 
$this->Auth->password($this->data['User']['password2'])){
if ($this->User->save($this->data, $params)) {
$this->Session->setFlash(__('The User 
has bee savedt', true));

$this->redirect(array('controller'=>'todos', 'action'=>'index'));
} else {
$this->Session->setFlash(__('The User 
couldn't be saved. Please check.', true));
}
} else {
$this->Session->setFlash(__('passwords don't 
match. Please check.', true));
}

}
if (empty($this->data)) {
$this->data = $this->User->read(null, 
$this->Auth->user('id'));
}
}

Hope this helps

Anja

-Ursprüngliche Nachricht-
Von: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] Im Auftrag 
von amarradi
Gesendet: Donnerstag, 19. Februar 2009 19:55
An: CakePHP
Betreff: user Profile protection howto


Hello together,

How do i protect the userprofiles?

Because i don't know how i protect the userprofiles mutually. if a user is 
logged in and he visits

/cakePHP/users/edit/1 he can edit his profile. But when he typed in his browser 
/cakePHP/users/edit/2 he can edit an other profile.

How can i stop this?

many greeting

Marcus Radisch



--~--~-~--~~~---~--~~
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: Issues with ajax and cakephp

2009-02-19 Thread rgreenphotodesign

Hey Sal,

Have you tried adding a $this->render('update_select', 'ajax') in the
update_selection function in the trunks controller?

I have found that adding that helps with rendering ajax.

Russ

On Feb 19, 2:11 pm, Tóth Imre  wrote:
> I think ajax works fine, but i think it is not so tasty in the raw js way.
> With GWT it makes no sense to write it, and fun, so I encourage everybody to
> try it:)
> Wors fine wih cake:)
>
> 2009/2/19 sal 
>
>
>
>
>
> > Hello everyone,
>
> > The age old question... I have a simple page with two select boxes and
> > want the second one to populate according to what was selected in the
> > first one. So, in steps the ajax helper within cake. I have searched
> > and searched around the web and found several articles and tutorials
> > on the subject but many of them are 1.1 and outdated. I feel like I am
> > so close to getting it to work but can't figure out where I am going
> > wrong. The first select box is populating but the second is not. So,
> > I'm turning to the forums :) My setup is really simple, just two
> > databases, three entries in each. So obviously two models and
> > controllers and then the views. I'll include the necessary code
> > snippets for analysis. Any help would be so so appreciated, thanks! It
> > is worth noting that most of the code was taken off of the blog
>
> >http://www.devmoz.com/blog/2007/04/04/cakephp-update-a-select-box-usi...
>
> > FIRST, THE TABLES
>
> > --
> > -- Table structure for table `facilities`
> > --
>
> > CREATE TABLE IF NOT EXISTS `facilities` (
> >  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
> >  `name` varchar(50) NOT NULL,
> >  PRIMARY KEY (`id`)
> > ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
>
> > --
> > -- Dumping data for table `facilities`
> > --
>
> > INSERT INTO `facilities` (`id`, `name`) VALUES
> > (1, 'Atlanta'),
> > (2, 'Nashville'),
> > (3, 'Charlotte');
>
> > --
> > -- Table structure for table `trucks`
> > --
>
> > CREATE TABLE IF NOT EXISTS `trucks` (
> >  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
> >  `name` varchar(50) NOT NULL,
> >  `facility_id` int(11) unsigned NOT NULL,
> >  PRIMARY KEY (`id`),
> >  KEY `facility_id` (`facility_id`)
> > ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
>
> > --
> > -- Dumping data for table `trucks`
> > --
>
> > INSERT INTO `trucks` (`id`, `name`, `facility_id`) VALUES
> > (1, 'atl', 1),
> > (2, 'nsh', 2),
> > (3, 'cnc', 3);
>
> > 
> > NOW THE MODELS
>
> > 
> >        class Facility extends AppModel {
>
> >                var $name = 'Facility';
>
> >        }
>
> > ?>
>
> > 
> >        class Truck extends AppModel {
>
> >                var $name = 'Truck';
> >                var $belongsTo = array('Facility' => array('className' =>
> > 'Facility', 'foreignKey' => 'facility_id'));
>
> >        }
>
> > ?>
>
> > 
> > THE CONTROLLERS
>
> > 
> >        class FacilitiesController extends AppController {
>
> >                var $name = 'Facilities';
> >                var $helpers = array('Html', 'Form', 'Javascript', 'Ajax');
> >                var $components = array('RequestHandler');
>
> >        }
>
> > ?>
>
> > 
> >        class TrucksController extends AppController {
>
> >                var $name = 'Trucks';
> >                var $helpers = array('Html', 'Form', 'Javascript', 'Ajax');
> >                var $components = array('RequestHandler');
>
> >                function index() {
>
> >                        $this->set('facilities',
> > $this->Truck->Facility->find('list'));
>
> >                }
>
> >                function update_select() {
>
> >                        if (!empty($this->data['Facility']['id'])) {
>
> >                                $fac_id = $this->data['Facility']['id'];
> >                                $options = $this->Truck->find('list',
> > array('conditions' => array
> > ('Truck.facility_id' => $fac_id)));
> >                                $this->set('options', $options);
>
> >                        }
>
> >                }
>
> >        }
>
> > ?>
>
> > 
> > FINALLY, THE VIEWS
>
> > //trucks/index.ctp
> > 
> >    echo $form->select('Facility.id', array('options' => $facilities),
> > null, array('id' => 'facilities'));
> >    echo $form->select('Truck.id', array(), null, array('id' =>
> > 'trucks'));
>
> >    $options = array('url' => 'update_select', 'update' => 'trucks');
> >    echo $ajax->observeField('facilities', $options);
>
> > ?>
>
> > //trucks/update_select.ctp
> > 
> >        if (!empty($options)) {
>
> >        foreach ($options as $k => $v) {
>
> >                echo "$v";
>
> >        }
>
> >    }
>
> > ?>
>
> > Sorry for such a long post, thanks again

Re: ORDER BY Rating

2009-02-19 Thread Kyle Decot

Surely. It basically looks like what is below. I have removed some
validation code though to make it more readable.



On Feb 17, 4:53 am, Miles J  wrote:
> Can I see your Skatepark model.
--~--~-~--~~~---~--~~
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 Redirect After Session Has Expired

2009-02-19 Thread lawwton

Any ideas regarding this?

How can I ensure that after I am logged in if the session expires the
user is re-directed back to the login page for any new requests coming
in?

By the way, I could probably hack my way around this with a couple of
lines of code in my AppController. I am trying to understand why Auth
is just not simply re-directing after the session expires. Auth does
the right thing if I am not logged in, I get re-directed or sent to
the login page in my case. The question is why not when the session
expires. I am assuming I am missing something.

Thanks in advance,

Alfredo

On Feb 18, 1:38 pm, Alfredo Quiroga-Villamil 
wrote:
> I am sure there is a way to get this done, just not sure if I am
> missing something. Further details below:
>
> Issue:
> =
>
> Need to re-direct after session has expired or cleared.
>
> Description:
> =
>
> I am currently only using the Auth component to handle my
> authentication. No ACL for now. In my AppController I have:
>
> =
>         public function beforeFilter() {
>                 parent::beforeFilter();
>                 $this->Auth->loginAction = array('controller' => 'portal', 
> 'action'
> => 'login');
>                 $this->Auth->loginRedirect = array('controller' => 'portal',
> 'action' => 'main');
>                 $this->Auth->logoutRedirect = array('controller' => 'portal',
> 'action' => 'index');
>                 $this->Auth->autoRedirect = false;
>         } // End of beforeFilter()
> =
>
> Everything works great. The only issue I currently have is the following:
>
> After the session expire, I am not being re-directed or kicked out of
> the main view.
>
> I am only using cakephp as my backend engine. All my front end is
> built using something else and all I do is send ajax requets. I've
> also looked at the property ajaxLogin under Auth; but after further
> inspection of the code to try to understand what it does I found the
> part in auth.php where I think it's being called. See below:
>
> auth.php from cakephp
>
> =
>                 } else {
>                         if (!$this->user()) {
>                                 if (!$this->RequestHandler->isAjax()) {
>                                         
> $this->Session->setFlash($this->authError, 'default', array(), 'auth');
>                                         
> $this->Session->write('Auth.redirect', $url);
>                                         $controller->redirect($loginAction, 
> null, true);
>                                         return false;
>                                 } elseif (!empty($this->ajaxLogin)) {
>                                         $controller->viewPath = 'elements';
>                                         echo 
> $controller->render($this->ajaxLogin, 'ajax');
>                                         $this->_stop();
>                                         return false;
>                                 }
>                         }
>                 }
> =
>
> There are no re-directs there, it's rendering as the property
> documentation describes.
>
> How can I ensure that after I am logged in if the session expires the
> user is re-directed back to the login page for any request coming in.?
>
> Thanks in advance,
>
> Alfredo
--~--~-~--~~~---~--~~
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: user Profile protection howto

2009-02-19 Thread Miles J

All of these are wrong. You should be editing the user based on the id
stored in the session.

/users/edit/ instead of users/edit/1/

And within the edit action (if Auth is being used)

function edit() {
$user_id = $this->Auth->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: user Profile protection howto

2009-02-19 Thread Future22

Yes, that is the basic idea so that we can avoid sql injections, etc.
and.  Custom component it is but I thought there would be on out there
somewhere that we could piggy back off of.  Thank you...

On Feb 19, 6:09 pm, BrendonKoz  wrote:
> Future22:  I'd imagine a custom component could be created to test for
> these things, however...
>
> If the record doesn't exist, then the person checking for the record
> will obviously not match that ID (because it, the user, does not
> exist).  (For other models, you'd still have to run the query and do
> the test.)
>
> If it's a non-integer.  I've *ever-so-slightly* changed my cake
> bake script to do the following on view, edit, and delete methods:
>  if (!$id && !is_int($id)) {
> instead of simply doing.
>  if (!$id) {
>
> Now, this requires that your ID field is numeric, but I haven't had
> any models yet that do that, and it's easier to change the methods for
> one or two specific models than for all others.  :)
>
> On Feb 19, 3:39 pm, Future22  wrote:
>
> > But this raises another question... What if the user types in 30 but
> > the record does not exist?  or if the user types in a non-integer? so
> > we would have to check if it exists and if it is an integer.  Custom
> > component/function maybe to do these checks on each page (cotroller/
> > action/id)?  Is there something out there for available for use?
>
> > Curtis
>
> > On Feb 19, 2:02 pm, leo  wrote:
>
> > > Check who is the current user and only allow based on that?
>
> > > On Feb 19, 7:55 pm, amarradi  wrote:
>
> > > > Hello together,
>
> > > > How do i protect the userprofiles?
>
> > > > Because i don't know how i protect the userprofiles mutually. if a
> > > > user is logged in and he visits
>
> > > > /cakePHP/users/edit/1 he can edit his profile. But when he typed in
> > > > his browser /cakePHP/users/edit/2 he can edit an other profile.
>
> > > > How can i stop this?
>
> > > > many greeting
>
> > > > Marcus Radisch- Hide quoted text -
>
> > > - Show quoted text -- 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: PK showing in views with scaffolding output and Bake generated files

2009-02-19 Thread reidster

Is there any CakePHP requirement for naming postgres sequences?  Does
CakePHP automatically make the sequence association in an insert
statement for postgresql?  I cannot even locate the actual insert
statement that is passed to the database.

Thanks for sharing your insights.
-Reid

On Feb 16, 5:31 pm, reidster  wrote:
> Thanks, Brian.
>
> I have double-checked and the PG database does show the "id" as a PK
> for the table.
>
> The behavior I see is as follows:
> When I do an edit on the record, it does not show the id column for
> update.
> When I do a new record, it does show the id column for the insert.  Of
> course, I do not want the user to have to enter the id value.
> When I list the records, it shows the id column for each record.  I do
> not want the user to see the id value.
>
> I can manually go in and correct this, but I thought that scaffolding
> would do this for me.  I also thought that the bake process would
> eliminate the PK column from the user forms.  I just want to make sure
> I don't have some configuration problem before I go further.
>
> Thanks again,
> Reid
>
> On Feb 16, 4:37 pm, brian  wrote:
>
> > On Mon, Feb 16, 2009 at 3:29 PM,reidster wrote:
>
> > > I am new to CakePHP.  I have been experimenting with scaffolding and
> > > bake.  It works OK; however, I have one question.  I don't understand
> > > why my primary key columns (id) are showing up in the views.  As you
> > > may expect, I do not want the user to generate this id column value or
> > > be able to modify it.  In some examples I've seen when using
> > > scaffolding the "id" column is not presented to the view for the user
> > > to interact with.
>
> > Do you mean that your forms have a text input with/for the PK? They
> > should be hidden inputs, and then only for your edit forms. I can
> > think of only one reason why Cake would create regular inputs for your
> > PK and that's if Cake doesn't know that it's the PK. But, if the
> > column is named 'id' and is set as the PK in the DB there shouldn't be
> > any problem.
>
> > If you're referring to the html tables that Bake creates, just remove
> > them from the view. It's been a while since I used Bake, so I don't
> > remember offhand if it does include those automatically.
>
> > > Is there any way to make the primary key columns of my tables non-
> > > visible and yet still part of the DML (delete, update, insert, select)
> > > statements that are sent to the database when the user performs a
> > > submit?  I am using postgresql 8.3.  My understanding is that MySQL
> > > uses autoincrement and PG uses sequences (like Oracle).  Does CakePHP
> > > account for primary key columns that are populated with sequences
> > > instead of autoincrement?
>
> > The postgres driver, DboPostgres, handles that. It works just fine
> > with sequences.
--~--~-~--~~~---~--~~
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 Blog Tut 1.2 Database connection...

2009-02-19 Thread brian

Cake needs to be able to connect to your database as a user the
database trusts. Did you set the username & password in database.php?
Note that you don't have to use *your* username and password. You can
create application-specific users for that.

On Thu, Feb 19, 2009 at 6:01 PM, psiborg  wrote:
>
> I've been following the instructions in the Blog tutorial, and did
> alright...up to the point where I'm creating the database and getting
> Cake to connect to it.
>
> Is there a special place that Cake expects the database to be found?
> I'm using XAMPP on a Win XP machine, and CakePHP 1.2.1.8004.
>
> The tutorial doesn't specify a database creation method, so I used
> phpMyAdmin to create the database and add the posts from the tutorial.
>
> Then, I modified the database.php file, per page 10.1.3, and called up
> the localhost. Cake tells me that the tmp directory is writable, the
> FileEngine is being used for caching, and that my database
> configuration file is present. However, it also tells me that it is
> NOT able to connect to the database.
>
> Obviously, I'm a n00b to all of this (the last thing I had to do with
> a database was creating one using MS Access). I'm trying to learn
> enough to be able to help someone with his business, and maybe be able
> to get a job...
>
> >
>

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



update from cakePHP 1.2.0.7692 RC3 to cakePHP 1.2.1.8004 stable

2009-02-19 Thread amarradi

hello together,

until this moment i develop with cakePHP 1.2.0.7692 RC3. But now is
the Situation, that one bug is in the old version which is fixed in
1.2.1.8004.

How can i easy update from an older version to the newest. Is  there
any userguide available? Or should i try it.

many greeting

Marcus Radisch
--~--~-~--~~~---~--~~
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: Are we using the slowest PHP framework there is?

2009-02-19 Thread Rafael Bandeira aka rafaelbandeira3

We can't forget that even not using $uses, when loading a Model it
will construct all its links, and its link will construct all of their
links, and so forth...
So, anyway, you are most probably going to load each and every model
by just loading a single one - even though they might have nothing to
do with the request.

On Feb 18, 11:15 am, mark_story  wrote:
> On Feb 17, 8:35 pm, Motin  wrote:
>
>
>
> > CakePHP does have some issues with aggressive loading, and have
> > terrible performance in a lot of areas, but that benchmark, doesn't
> > really measure anything regarding to Yii. Because of Yii's lazy
> > loading, practically none of the commonly used objects/classes are
> > loaded in the test application. This makes it practically the same as
> > barebones PHP. However, in a real application, when the helpers and
> > models are actually used (and thus loaded), I think the results would
> > look much different.
>
> > Also, CakePHP is meant to be run with a non-file-based cache engine +
> > a php accelerator.
>
> > Still, I believe that Yii is much faster for slimmed down
> > applications, and I really hope that CakePHP can learn something from
> > the lazy loading parts (why on earth does Cake load _all_ models in
> > $uses on each request - instead of when they are actually used? for
> > instance).
>
> Well PHP4 is one reason.  Lazy loading doesn't work so well in PHP4,
> also using $uses is known to cause performance issues as you end up
> loading far too many models.  You ask about why cake doesn't lazy
> load, but by using $uses you are doing the opposite of lazy loading.
> $uses is probably the most aggressive loading strategy you can
> implement.  Using Controller::loadModel() or ClassRegistry::init() is
> a more _lazy_ approach.
>
> -Mark
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



dynamic arguments with autocomplete

2009-02-19 Thread juanf.cord...@gmail.com

I have 2 input fields, both are autocomplete fields
for example:
first field would be state field,
and the second field would be the city field -those that belong to the
first field (state field)-

How can I pass the ID of the state to the 2nd autocomplete so i can
get the cities that belong to the state

here is a piece of what I have
autoComplete('state.name', '/map/
autoCompleteState',array('minChars'=>3,'frequency'=>'0.4',
'afterUpdateElement' =>  'getSelectedId'))?>

autoComplete('city.name', '/map/
autoCompleteCity/'  ,array('minChars'=>3,'frequency'=>'0.4'))?>


Thank you

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



Problem with Blog Tut 1.2 Database connection...

2009-02-19 Thread psiborg

I've been following the instructions in the Blog tutorial, and did
alright...up to the point where I'm creating the database and getting
Cake to connect to it.

Is there a special place that Cake expects the database to be found?
I'm using XAMPP on a Win XP machine, and CakePHP 1.2.1.8004.

The tutorial doesn't specify a database creation method, so I used
phpMyAdmin to create the database and add the posts from the tutorial.

Then, I modified the database.php file, per page 10.1.3, and called up
the localhost. Cake tells me that the tmp directory is writable, the
FileEngine is being used for caching, and that my database
configuration file is present. However, it also tells me that it is
NOT able to connect to the database.

Obviously, I'm a n00b to all of this (the last thing I had to do with
a database was creating one using MS Access). I'm trying to learn
enough to be able to help someone with his business, and maybe be able
to get a job...

--~--~-~--~~~---~--~~
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: No password hashing

2009-02-19 Thread BrendonKoz

Yeah, scaffolding is only used for testing your application out, not
actually running it in production code.  As Auth/ACL is more of a
production-testing level, or stage, of coding, they do not work with
it (scaffolding).  It's a great time to learn how to use cake's bake
command if you haven't yet.  There is a screencast on the CakePHP
website on how to use it if you haven't yet.  :)

On Feb 19, 3:36 pm, "Toby Mathews"  wrote:
> Finally figured it!! I was baking everything using scaffolding - possibly an
> oversight on my part, but not using scaffolding seems to have solved the
> problem.
>
> Toby
>
>
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
>
> Of stevel
> Sent: 16 February 2009 23:11
> To: CakePHP
> Subject: Re: No password hashing
>
> Not quite sure what you were trying to do. How are you creating a new
> user? Using the Add function in the User controller? If you are, then
> the password will automatically be hashed by the ACL/Auth before it is
> saved to the database.
>
> On Feb 16, 1:36 pm, toby1kenobi  wrote:
> > Hi there,
>
> >   I've been following the great Acl/Auth tutorial in the manual
> > (http://book.cakephp.org/view/641/Simple-Acl-controlled-Application).
>
> >   I  have a problem at the point of creating users (10.2.4 Acts As a
> > Requester) - passwords are added to the database in plain text. This
> > means the login method doesn't work, as it's expecting them to be
> > hashed. I've been back over the tutorial a couple of times, but can't
> > see what I've missed. Looking elsewhere I've been unable to determine
> > what aspect of the setup might handle this - anyone able to cast any
> > light on this?
>
> >   Thanks,
>
> > Toby- 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: user Profile protection howto

2009-02-19 Thread BrendonKoz

Future22:  I'd imagine a custom component could be created to test for
these things, however...

If the record doesn't exist, then the person checking for the record
will obviously not match that ID (because it, the user, does not
exist).  (For other models, you'd still have to run the query and do
the test.)

If it's a non-integer.  I've *ever-so-slightly* changed my cake
bake script to do the following on view, edit, and delete methods:
 if (!$id && !is_int($id)) {
instead of simply doing.
 if (!$id) {

Now, this requires that your ID field is numeric, but I haven't had
any models yet that do that, and it's easier to change the methods for
one or two specific models than for all others.  :)

On Feb 19, 3:39 pm, Future22  wrote:
> But this raises another question... What if the user types in 30 but
> the record does not exist?  or if the user types in a non-integer? so
> we would have to check if it exists and if it is an integer.  Custom
> component/function maybe to do these checks on each page (cotroller/
> action/id)?  Is there something out there for available for use?
>
> Curtis
>
> On Feb 19, 2:02 pm, leo  wrote:
>
>
>
> > Check who is the current user and only allow based on that?
>
> > On Feb 19, 7:55 pm, amarradi  wrote:
>
> > > Hello together,
>
> > > How do i protect the userprofiles?
>
> > > Because i don't know how i protect the userprofiles mutually. if a
> > > user is logged in and he visits
>
> > > /cakePHP/users/edit/1 he can edit his profile. But when he typed in
> > > his browser /cakePHP/users/edit/2 he can edit an other profile.
>
> > > How can i stop this?
>
> > > many greeting
>
> > > Marcus Radisch- Hide quoted text -
>
> > - Show quoted text -- 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Search db with find & conditions

2009-02-19 Thread mscdex

On Feb 19, 5:36 pm, rb  wrote:
> Although, I need to read up on array_combine.  The line of code
> that appends the School prefix is still a little foggy.  it's working,
> just not exactly sure *how* it's appending that prefix.

Example array:
Array(
   [zip_mail] => 90210
   [state_mail] => CA
)

Here's a breakdown of what's happening in the complex line after
Set::filter:

1. An array containing the keys of the form results array is retrieved
by using array_keys. This array returned by array_keys() contains: [0]
=> zip_mail, [1] => state_mail
2. A call to preg_replace is made on this array of keys which
essentially performs a regular expression replace operation for each
element in that array. The results of this "find and replace" are
returned by preg_replace. These results would contain: [0] =>
School.zip_mail, [1] => School.state_mail
3. An array containing the values of the form results array is
retrieved by using array_values. This array contains: [0] => 90210,
[1] => CA
4. A call to array_combine is made, which will combine the two
supplied arrays (the array returned by preg_replace, and the array
returned by array_values) to generate an associative array. It does
this by pairing the values of each array to form key=>value pairs
which are saved into a new array that is eventually returned. That
gives us a final resultant array of: [School.zip_mail] => 90210,
[School.state_mail] => CA

I hope that makes that line of code a little clearer. Additional
information on each of the PHP functions can be found in the PHP
manual at php.net. :)
--~--~-~--~~~---~--~~
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: user Profile protection howto

2009-02-19 Thread Future22

Make sure your Auth session is set as well

function edit($id=null){
  If ($id==$this->Auth->user('id')) {
 user can edit
 }
 else {
 redirect...
 }
}

On Feb 19, 4:45 pm, amarradi  wrote:
> On 19 Feb., 22:31, Future22  wrote:> If 
> ($this->params['id']=$this->Auth->user('id')) {
> >     user can edit}
>
> > else {
> >     redirect...
>
> > }
>
> This doesn't run.
> The if-statement had an bug. The ==
> If ($this->params['id']==$this->Auth->user('id')) {
>
> >     user can edit}
>
> > else {
> >     redirect...
>
> > }
>
> But it is no change.
> Here my bug context
> In line 73 is the if-statement as the first statement in the action
> ==
> Notice (8): Undefined index:  id [APP/controllers/
> users_controller.php, line 73]
>
> Code | Context
>
> $id     =       "1"
>
>     }
>     function edit($id = null) {
>         if($this->params['id']==$this->Auth->user('id')) {
>
> UsersController::edit() - APP/controllers/users_controller.php, line
> 73
> Object::dispatchMethod() - CORE/cake/libs/object.php, line 116
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 259
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 213
> [main] - APP/webroot/index.php, line 90
>
> Warning (2): Cannot modify header information - headers already sent
> by (output started at /opt/lampp/htdocs/cakePHP/cake/basics.php:111)
> [CORE/cake/libs/controller/controller.php, line 587]
>
> Code | Context
>
> $status =       "Location:http://localhost/cakePHP/users";
>
> header - [internal], line ??
> Controller::header() - CORE/cake/libs/controller/controller.php, line
> 587
> Controller::redirect() - CORE/cake/libs/controller/controller.php,
> line 568
> UsersController::edit() - APP/controllers/users_controller.php, line
> 92
> Object::dispatchMethod() - CORE/cake/libs/object.php, line 116
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 259
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 213
> [main] - APP/webroot/index.php, line 90
>
> (default) 0 query took ms
--~--~-~--~~~---~--~~
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: Search db with find & conditions

2009-02-19 Thread rb


On Feb 19, 4:41 pm, mscdex  wrote:
>
> All of that might seem like more work, but I just thought I'd throw
> those tidbits out there if you were interested.

No, this is great stuff..

As I said, I'm new to cakePHP (as if that wasn't obvious).. so i'll
take all the tidbits I can get.

I re-wrote the code to handle the set::filter.  Code is easier to
read.  Although, I need to read up on array_combine.  The line of code
that appends the School prefix is still a little foggy.  it's working,
just not exactly sure *how* it's appending that prefix.

Tthanks again.. you've been more then helpful!
--~--~-~--~~~---~--~~
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: Quotes getting encoded in link/button Javascript

2009-02-19 Thread mscdex

On Feb 19, 1:09 pm, GrrrlRomeo  wrote:
> I'm trying to figure out how to get CakePHP to stop encoding quotes as
> html entities.
>
> This is my view code:
>
> button('UploadText',array('onClick'=>'$
> (\'#postAddForm\').ajaxSubmit({target: \'#postTextUpload\',url:\"'.
> $html->url('/posts/text').'\'});return false;'));?>

Did you try:
button('UploadText',array('escape' => false,
'onClick'=>'$(\'#postAddForm\').ajaxSubmit({target: \'#postTextUpload
\',url:\"'.$html->url('/posts/text').'\'});return false;'));?>

--~--~-~--~~~---~--~~
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 rule: multiple (CookBook -> 4.1.4.17 Multiple)

2009-02-19 Thread Smelly_Eddie

WebbedIT

I not sure if you have considered using your own validation method for
all checkbox fields.

You can use some simple logic to assess if one of the boxes is check,
and return errors accordingly.

Validation multiple fields with the OR conditon
http://edwardawebb.com/programming/php-programming/cakephp/validating-optional-fields-cakephp-dreaded-scenario

On Feb 18, 9:17 am, WebbedIT  wrote:
> The question I guess I now need answered is why doesn't
> Modell::saveAll validate HABTM data before saving it?
>
> By digging into the core I found that Model::saveAll does not have a
> switch case for hasAndBelongsToMany, but by my limited logical
> reasoning that would mean the data would not get saved either, yet it
> does.
>
> I amended lines #1511 to #1525 to the following which results in my
> HABTM model getting validated as required and my data is being saved
> as expected, but I don't fully follow the code so there's a high
> chance this is not a sensible solution:
>
>   if (isset($associations[$association])) {
>     switch ($associations[$association]) {
>       case 'belongsTo':
>       case 'hasAndBelongsToMany': // added
>         if ($this->__save($this->{$association}, $values, $options)) {
>           $data[$this->alias][$this->{$associations[$association]}
> [$association]['foreignKey']] = $this->{$association}->id; // edited
>         } else {
>           $validationErrors[$association] = 
> $this->{$association}->validationErrors;
>
>           $validates = false;
>         }
>         if (!$options['atomic']) {
>           $return[$association][] = $validates;
>         }
>       break;
>     }
>   }
--~--~-~--~~~---~--~~
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: Not URL Accessible

2009-02-19 Thread Miles J

If your returning anything non json, you should use a layout.

Also if you dont want them visiting the pages manually, but this in
your beforeFilter().

if (!$this->RequestHandler->isAjax()) {
die();
}

Or something similar to fit your needs.
--~--~-~--~~~---~--~~
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: Paginate variables

2009-02-19 Thread mscdex

On Feb 19, 2:15 pm, brian  wrote:
> Obviously, if you already have other conditions, you'll want to append them:
>
> $this->paginate['conditions'][] = array('Group.site_id' => $variable);

Shouldn't the conditions array contain only k=>v pairs and not sub-
arrays?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Not URL Accessible

2009-02-19 Thread WidePixels

When using jQuery to load AJAX elements, do you still use the layout -
> ajax in the controller and use the

ajax.ctp  file?

and how do you make the view file not accessable from typing it in the
addess bar?

Thanks

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



Re: user Profile protection howto

2009-02-19 Thread amarradi



On 19 Feb., 22:31, Future22  wrote:
> If ($this->params['id']=$this->Auth->user('id')) {
>     user can edit}
>
> else {
>     redirect...
>
> }
This doesn't run.
The if-statement had an bug. The ==
If ($this->params['id']==$this->Auth->user('id')) {
> user can edit}
>
> else {
> redirect...
>
> }

But it is no change.
Here my bug context
In line 73 is the if-statement as the first statement in the action
==
Notice (8): Undefined index:  id [APP/controllers/
users_controller.php, line 73]

Code | Context

$id =   "1"

}
function edit($id = null) {
if($this->params['id']==$this->Auth->user('id')) {

UsersController::edit() - APP/controllers/users_controller.php, line
73
Object::dispatchMethod() - CORE/cake/libs/object.php, line 116
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 259
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 213
[main] - APP/webroot/index.php, line 90

Warning (2): Cannot modify header information - headers already sent
by (output started at /opt/lampp/htdocs/cakePHP/cake/basics.php:111)
[CORE/cake/libs/controller/controller.php, line 587]

Code | Context

$status =   "Location: http://localhost/cakePHP/users";

header - [internal], line ??
Controller::header() - CORE/cake/libs/controller/controller.php, line
587
Controller::redirect() - CORE/cake/libs/controller/controller.php,
line 568
UsersController::edit() - APP/controllers/users_controller.php, line
92
Object::dispatchMethod() - CORE/cake/libs/object.php, line 116
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 259
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 213
[main] - APP/webroot/index.php, line 90

(default) 0 query took ms
--~--~-~--~~~---~--~~
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: Search db with find & conditions

2009-02-19 Thread mscdex

There was something else I was going to mention. You could probably
get rid of all those if (!empty()) checks where you're doing a simple
equality comparison in your query and instead do a call to Set::filter
() on the array. For example you could get rid of statements like:

$conditions['School.zip_mail'] = $formSchools['zip_mail'];
$conditions['School.street_mail'] = $formSchools['street_mail'];
$conditions['School.state_mail'] = $formSchools['state_province'];

These statements are checking for records that have fields equal to
some value. As you mentioned before, the form results array had empty
values in them where conditions were not entered for those respective
fields. Set::filter() will remove all elements in that array that are
empty, which can greatly simplify things.

You could do a:
$formSchools = Set::filter($this->data['schools']);
instead of:
$formSchools = $this->data['schools'];

Then to get the "School." prefix for all the array keys in
$formSchools, you can do something like this:
$formSchools = array_combine(preg_replace("/.+/", "School.$0",
array_keys($formSchools)), array_values($formSchools));

Next, you might do something like this for the special case of the
'name' field or any other field where you might use similar operators:
$formSchools['School.name LIKE'] =  "%{$formSchools['School.name']}%";
unset($formSchools['School.name']);


All of that might seem like more work, but I just thought I'd throw
those tidbits out there if you were interested.
--~--~-~--~~~---~--~~
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: user Profile protection howto

2009-02-19 Thread Future22

If ($this->params['id']=$this->Auth->user('id')) {
user can edit
}
else {
redirect...
}

On Feb 19, 3:49 pm, amarradi  wrote:
> Thanks
>
> But how do i realize this
>
> i tried in my user edit action such condition in the first line
>
> f($this->data['User']['id']!=$this->Auth->user('id')) {
> user can edit
>
> } else
>  ... redirect
> }
>
> But it doest run
>
> many greetings
>
> Marcus Radisch
--~--~-~--~~~---~--~~
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: Issues with ajax and cakephp

2009-02-19 Thread Tóth Imre
I think ajax works fine, but i think it is not so tasty in the raw js way.
With GWT it makes no sense to write it, and fun, so I encourage everybody to
try it:)
Wors fine wih cake:)

2009/2/19 sal 

>
> Hello everyone,
>
> The age old question... I have a simple page with two select boxes and
> want the second one to populate according to what was selected in the
> first one. So, in steps the ajax helper within cake. I have searched
> and searched around the web and found several articles and tutorials
> on the subject but many of them are 1.1 and outdated. I feel like I am
> so close to getting it to work but can't figure out where I am going
> wrong. The first select box is populating but the second is not. So,
> I'm turning to the forums :) My setup is really simple, just two
> databases, three entries in each. So obviously two models and
> controllers and then the views. I'll include the necessary code
> snippets for analysis. Any help would be so so appreciated, thanks! It
> is worth noting that most of the code was taken off of the blog
>
> http://www.devmoz.com/blog/2007/04/04/cakephp-update-a-select-box-using-ajax/
>
> FIRST, THE TABLES
>
> --
> -- Table structure for table `facilities`
> --
>
> CREATE TABLE IF NOT EXISTS `facilities` (
>  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
>  `name` varchar(50) NOT NULL,
>  PRIMARY KEY (`id`)
> ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
>
> --
> -- Dumping data for table `facilities`
> --
>
> INSERT INTO `facilities` (`id`, `name`) VALUES
> (1, 'Atlanta'),
> (2, 'Nashville'),
> (3, 'Charlotte');
>
> --
> -- Table structure for table `trucks`
> --
>
> CREATE TABLE IF NOT EXISTS `trucks` (
>  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
>  `name` varchar(50) NOT NULL,
>  `facility_id` int(11) unsigned NOT NULL,
>  PRIMARY KEY (`id`),
>  KEY `facility_id` (`facility_id`)
> ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
>
> --
> -- Dumping data for table `trucks`
> --
>
> INSERT INTO `trucks` (`id`, `name`, `facility_id`) VALUES
> (1, 'atl', 1),
> (2, 'nsh', 2),
> (3, 'cnc', 3);
>
>
> 
> NOW THE MODELS
>
> 
>class Facility extends AppModel {
>
>var $name = 'Facility';
>
>}
>
> ?>
>
> 
>class Truck extends AppModel {
>
>var $name = 'Truck';
>var $belongsTo = array('Facility' => array('className' =>
> 'Facility', 'foreignKey' => 'facility_id'));
>
>}
>
> ?>
>
>
> 
> THE CONTROLLERS
>
> 
>class FacilitiesController extends AppController {
>
>var $name = 'Facilities';
>var $helpers = array('Html', 'Form', 'Javascript', 'Ajax');
>var $components = array('RequestHandler');
>
>}
>
> ?>
>
> 
>class TrucksController extends AppController {
>
>var $name = 'Trucks';
>var $helpers = array('Html', 'Form', 'Javascript', 'Ajax');
>var $components = array('RequestHandler');
>
>function index() {
>
>$this->set('facilities',
> $this->Truck->Facility->find('list'));
>
>}
>
>function update_select() {
>
>if (!empty($this->data['Facility']['id'])) {
>
>$fac_id = $this->data['Facility']['id'];
>$options = $this->Truck->find('list',
> array('conditions' => array
> ('Truck.facility_id' => $fac_id)));
>$this->set('options', $options);
>
>}
>
>}
>
>}
>
> ?>
>
>
> 
> FINALLY, THE VIEWS
>
> //trucks/index.ctp
> 
>echo $form->select('Facility.id', array('options' => $facilities),
> null, array('id' => 'facilities'));
>echo $form->select('Truck.id', array(), null, array('id' =>
> 'trucks'));
>
>$options = array('url' => 'update_select', 'update' => 'trucks');
>echo $ajax->observeField('facilities', $options);
>
> ?>
>
> //trucks/update_select.ctp
> 
>if (!empty($options)) {
>
>foreach ($options as $k => $v) {
>
>echo "$v";
>
>}
>
>}
>
> ?>
>
>
> Sorry for such a long post, thanks again for taking the time to view
> it and any feedback you might have.
>
> -Regards
> >
>


-- 
Best Regards
Tóth Imre

--~--~-~--~~~---~--~~
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://grou

Re: Issues with ajax and cakephp

2009-02-19 Thread Tóth Imre
I think ajax works fine, but i think it is not so tasty in the raw js way.
With GWT it makes no sense to write it, and fun, so I encourage everybody to
try it:)
Wors fine wih cake:)

2009/2/19 sal 

>
> Hello everyone,
>
> The age old question... I have a simple page with two select boxes and
> want the second one to populate according to what was selected in the
> first one. So, in steps the ajax helper within cake. I have searched
> and searched around the web and found several articles and tutorials
> on the subject but many of them are 1.1 and outdated. I feel like I am
> so close to getting it to work but can't figure out where I am going
> wrong. The first select box is populating but the second is not. So,
> I'm turning to the forums :) My setup is really simple, just two
> databases, three entries in each. So obviously two models and
> controllers and then the views. I'll include the necessary code
> snippets for analysis. Any help would be so so appreciated, thanks! It
> is worth noting that most of the code was taken off of the blog
>
> http://www.devmoz.com/blog/2007/04/04/cakephp-update-a-select-box-using-ajax/
>
> FIRST, THE TABLES
>
> --
> -- Table structure for table `facilities`
> --
>
> CREATE TABLE IF NOT EXISTS `facilities` (
>  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
>  `name` varchar(50) NOT NULL,
>  PRIMARY KEY (`id`)
> ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
>
> --
> -- Dumping data for table `facilities`
> --
>
> INSERT INTO `facilities` (`id`, `name`) VALUES
> (1, 'Atlanta'),
> (2, 'Nashville'),
> (3, 'Charlotte');
>
> --
> -- Table structure for table `trucks`
> --
>
> CREATE TABLE IF NOT EXISTS `trucks` (
>  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
>  `name` varchar(50) NOT NULL,
>  `facility_id` int(11) unsigned NOT NULL,
>  PRIMARY KEY (`id`),
>  KEY `facility_id` (`facility_id`)
> ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
>
> --
> -- Dumping data for table `trucks`
> --
>
> INSERT INTO `trucks` (`id`, `name`, `facility_id`) VALUES
> (1, 'atl', 1),
> (2, 'nsh', 2),
> (3, 'cnc', 3);
>
>
> 
> NOW THE MODELS
>
> 
>class Facility extends AppModel {
>
>var $name = 'Facility';
>
>}
>
> ?>
>
> 
>class Truck extends AppModel {
>
>var $name = 'Truck';
>var $belongsTo = array('Facility' => array('className' =>
> 'Facility', 'foreignKey' => 'facility_id'));
>
>}
>
> ?>
>
>
> 
> THE CONTROLLERS
>
> 
>class FacilitiesController extends AppController {
>
>var $name = 'Facilities';
>var $helpers = array('Html', 'Form', 'Javascript', 'Ajax');
>var $components = array('RequestHandler');
>
>}
>
> ?>
>
> 
>class TrucksController extends AppController {
>
>var $name = 'Trucks';
>var $helpers = array('Html', 'Form', 'Javascript', 'Ajax');
>var $components = array('RequestHandler');
>
>function index() {
>
>$this->set('facilities',
> $this->Truck->Facility->find('list'));
>
>}
>
>function update_select() {
>
>if (!empty($this->data['Facility']['id'])) {
>
>$fac_id = $this->data['Facility']['id'];
>$options = $this->Truck->find('list',
> array('conditions' => array
> ('Truck.facility_id' => $fac_id)));
>$this->set('options', $options);
>
>}
>
>}
>
>}
>
> ?>
>
>
> 
> FINALLY, THE VIEWS
>
> //trucks/index.ctp
> 
>echo $form->select('Facility.id', array('options' => $facilities),
> null, array('id' => 'facilities'));
>echo $form->select('Truck.id', array(), null, array('id' =>
> 'trucks'));
>
>$options = array('url' => 'update_select', 'update' => 'trucks');
>echo $ajax->observeField('facilities', $options);
>
> ?>
>
> //trucks/update_select.ctp
> 
>if (!empty($options)) {
>
>foreach ($options as $k => $v) {
>
>echo "$v";
>
>}
>
>}
>
> ?>
>
>
> Sorry for such a long post, thanks again for taking the time to view
> it and any feedback you might have.
>
> -Regards
> >
>


-- 
Best Regards
Tóth Imre

--~--~-~--~~~---~--~~
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://grou

Re: Search db with find & conditions

2009-02-19 Thread rb

Okay, I take back my last post.

mscdex, I tried your suggestion a second time (the first time I
thought it wasn't working), and found that it works, I just needed to
remove the extra set of single quotes.

your suggestion (notice double and sigle quotes):
$conditions['School.name LIKE'] =  "'%{$formSchools['name']}%'";

your suggestion fixed:
$conditions['School.name LIKE'] =  "%{$formSchools['name']}%";

thanks again!
--~--~-~--~~~---~--~~
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: user Profile protection howto

2009-02-19 Thread amarradi

Thanks

But how do i realize this

i tried in my user edit action such condition in the first line

f($this->data['User']['id']!=$this->Auth->user('id')) {
user can edit
} else
 ... redirect
}

But it doest run

many greetings

Marcus Radisch
--~--~-~--~~~---~--~~
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: Search db with find & conditions

2009-02-19 Thread rb


Well, I have a work-around..I found that my original syntax of:

$conditions = "School.name LIKE '%{$formSchools['name']}%'";

was setting $conditions as a string, and not an array.  Which is why
it was replacing the array that was defined before it.

So instead (until I can find the right syntax), i'm appending the name
variable first, and then checking the remaining variables:

***
$conditions = array("School.name LIKE" => "%{$formSchools['name']}
%");

$conditions['School.zip_mail'] = $formSchools['zip_mail'];

$conditions['School.street_mail'] = $formSchools['street_mail'];

$conditions['School.state_mail'] = $formSchools['state_province'];
***

This works for now, but i'd really like to know how to do this
correctly.  Once I need to have two LIKE conditions (using this
method), i'll be S.O.L.
--~--~-~--~~~---~--~~
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: Search db with find & conditions

2009-02-19 Thread rb

On Feb 19, 2:23 pm, mscdex  wrote:
>
> Try: $conditions['School.name LIKE'] =  "'%{$formSchools['name']}%'";


that gives me:

Array
(
[School.zip_mail] => 1
[School.name LIKE] => '%school%'
[School.street_mail] => street name
)


--~--~-~--~~~---~--~~
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: No password hashing

2009-02-19 Thread Toby Mathews

Finally figured it!! I was baking everything using scaffolding - possibly an
oversight on my part, but not using scaffolding seems to have solved the
problem.

Toby

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of stevel
Sent: 16 February 2009 23:11
To: CakePHP
Subject: Re: No password hashing


Not quite sure what you were trying to do. How are you creating a new
user? Using the Add function in the User controller? If you are, then
the password will automatically be hashed by the ACL/Auth before it is
saved to the database.



On Feb 16, 1:36 pm, toby1kenobi  wrote:
> Hi there,
>
>   I've been following the great Acl/Auth tutorial in the manual
> (http://book.cakephp.org/view/641/Simple-Acl-controlled-Application).
>
>   I  have a problem at the point of creating users (10.2.4 Acts As a
> Requester) - passwords are added to the database in plain text. This
> means the login method doesn't work, as it's expecting them to be
> hashed. I've been back over the tutorial a couple of times, but can't
> see what I've missed. Looking elsewhere I've been unable to determine
> what aspect of the setup might handle this - anyone able to cast any
> light on this?
>
>   Thanks,
>
> Toby



--~--~-~--~~~---~--~~
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: user Profile protection howto

2009-02-19 Thread Future22

But this raises another question... What if the user types in 30 but
the record does not exist?  or if the user types in a non-integer? so
we would have to check if it exists and if it is an integer.  Custom
component/function maybe to do these checks on each page (cotroller/
action/id)?  Is there something out there for available for use?

Curtis

On Feb 19, 2:02 pm, leo  wrote:
> Check who is the current user and only allow based on that?
>
> On Feb 19, 7:55 pm, amarradi  wrote:
>
>
>
> > Hello together,
>
> > How do i protect the userprofiles?
>
> > Because i don't know how i protect the userprofiles mutually. if a
> > user is logged in and he visits
>
> > /cakePHP/users/edit/1 he can edit his profile. But when he typed in
> > his browser /cakePHP/users/edit/2 he can edit an other profile.
>
> > How can i stop this?
>
> > many greeting
>
> > Marcus Radisch- 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Issues with ajax and cakephp

2009-02-19 Thread sal

Hello everyone,

The age old question... I have a simple page with two select boxes and
want the second one to populate according to what was selected in the
first one. So, in steps the ajax helper within cake. I have searched
and searched around the web and found several articles and tutorials
on the subject but many of them are 1.1 and outdated. I feel like I am
so close to getting it to work but can't figure out where I am going
wrong. The first select box is populating but the second is not. So,
I'm turning to the forums :) My setup is really simple, just two
databases, three entries in each. So obviously two models and
controllers and then the views. I'll include the necessary code
snippets for analysis. Any help would be so so appreciated, thanks! It
is worth noting that most of the code was taken off of the blog
http://www.devmoz.com/blog/2007/04/04/cakephp-update-a-select-box-using-ajax/

FIRST, THE TABLES

--
-- Table structure for table `facilities`
--

CREATE TABLE IF NOT EXISTS `facilities` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

--
-- Dumping data for table `facilities`
--

INSERT INTO `facilities` (`id`, `name`) VALUES
(1, 'Atlanta'),
(2, 'Nashville'),
(3, 'Charlotte');

--
-- Table structure for table `trucks`
--

CREATE TABLE IF NOT EXISTS `trucks` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `facility_id` int(11) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `facility_id` (`facility_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

--
-- Dumping data for table `trucks`
--

INSERT INTO `trucks` (`id`, `name`, `facility_id`) VALUES
(1, 'atl', 1),
(2, 'nsh', 2),
(3, 'cnc', 3);


NOW THE MODELS



 array('className' =>
'Facility', 'foreignKey' => 'facility_id'));

}

?>


THE CONTROLLERS



set('facilities', 
$this->Truck->Facility->find('list'));

}

function update_select() {

if (!empty($this->data['Facility']['id'])) {

$fac_id = $this->data['Facility']['id'];
$options = $this->Truck->find('list', 
array('conditions' => array
('Truck.facility_id' => $fac_id)));
$this->set('options', $options);

}

}

}

?>


FINALLY, THE VIEWS

//trucks/index.ctp
select('Facility.id', array('options' => $facilities),
null, array('id' => 'facilities'));
echo $form->select('Truck.id', array(), null, array('id' =>
'trucks'));

$options = array('url' => 'update_select', 'update' => 'trucks');
echo $ajax->observeField('facilities', $options);

?>

//trucks/update_select.ctp
 $v) {

echo "$v";

}

}

?>


Sorry for such a long post, thanks again for taking the time to view
it and any feedback you might have.

-Regards
--~--~-~--~~~---~--~~
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 with only two tables... How to do that..?

2009-02-19 Thread ggcakephp

Hi.. I have a problem with HABTM relation...
I have two types of users "parent" and "student"(child of the parent)
stored in one table named "users". Field in this table named "type"
defines which type of user it is.

Fields in table "users":
  `id` int(11)
  `type` enum('a','t','p','s') //a - admin, t - teacher, p - parent, s
- student(child)
  `name` varchar(60)
  `surname` varchar(60)
  `login` varchar(16)
  `password` char(40)

Fields in table used to join named "childrensparents"
  `id` int(11) auto_increment,
  `parent_id` int(11) // foreign key identifying unique user from
table "users" (which has "type" field set as 'p')
  `child_id` int(11) // foreign key identifying unique user from table
"users" (which has "type" field set as 's')

...so both foreign keys are "linked" to the same table ("user")

I have to define parent-child relation in "User" model, assuming that
one parent can have many children(students) and one child(student)
belongs to one or more parents

I have no idea how to define "$hasAndBelongsToMany" relation in this
case (being honest i never used this type of ralation before, i'm
working with cakePHP since two months, so many things are new to my)

I'll be grateful for any help
Thankyou to all in advance

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



Quotes getting encoded in link/button Javascript

2009-02-19 Thread GrrrlRomeo

I'm trying to figure out how to get CakePHP to stop encoding quotes as
html entities.

This is my view code:

button('UploadText',array('onClick'=>'$
(\'#postAddForm\').ajaxSubmit({target: \'#postTextUpload\',url:\"'.
$html->url('/posts/text').'\'});return false;'));?>

And the HTML output:



I'm using CakePHP 1.2.1.8004 Stable

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



Problems with Security Component

2009-02-19 Thread amarradi

Hello together,

i want test what Security Component can do. So i added it

var $components = array('Security');

and in beforeFilter

function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('index','search');
// Security Component
$this->Security->requireAuth('add','edit');
// Security Component
$this->set('id',$this->Auth->user('id'));
$this->set('username',$this->Auth->user('username'));
}

But since this moment i had some Problems

in  my controller action
Undefined index:  Translate [APP/controllers/
translates_controller.php, line 84]

This is the Action with line 84

function search(){


$this->set('rowCount',$this->Translate->find('count'));
//$this->Session->setFlash();
83  $this->set('results',$this->Translate->search($this->data
['Translate']['q']));
84  $results=$this->Translate->search($this->data['Translate']
['q']);
if (!empty($this->data['Translate']['q']) && empty($results))
{
$this->Session->setFlash("Dieser Datensatz exitiert (noch)
nicht.");
$this->redirect(array('action'=>'add'), null, true);
}
else
{
   $this->set('results', $results);
//   $this->Session->setFlash("Test: ".$this->data['Translate']
['q']);

}
}

Whats that for an error?

many greeting

Marcus Radisch

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



Jquery Forms

2009-02-19 Thread WidePixels

Can someone point me in the right direction here, been looking online
and can not find anything. What I want to do is have an "edit" button
on my page so the user can edit his selections. Idea is on the profile
page the user has his selected "Artists". Now I want to add the "edit"
button which will turn that specific section into a form where they
can make changes and then click save and then that section does the
"saving" message and once saved changes to the newly updated
selection of artists.

I have the form as update_artists.ctp in my views/profile

Just confused with do I need a view file for the artists selections.
Right now its part of the profile.ctp so when the page loads it
displays everything. So if I load the update_artists.ctp inside
profile.ctp do i need to make a ctp page that returns the newly
updated info such as say view_artists.ctp which pulls the new info
from the newly update_artist.ctp form?

I am using jQuery and the jQuery.form.js. How do I set that up? I have
them loading from my view file fine. Just unsure how to set it all up.

Thanks
Dave


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



Re: Search db with find & conditions

2009-02-19 Thread mscdex

On Feb 19, 1:59 pm, rb  wrote:
> if(!empty($formSchools['name']))
>         $conditions = "School.name LIKE '%{$formSchools['name']}%'";

Try: $conditions['School.name LIKE'] =  "'%{$formSchools['name']}%'";
--~--~-~--~~~---~--~~
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: Paginate variables

2009-02-19 Thread Stu

That! is exacly what I was looking for, Thanks a bunch man!
--~--~-~--~~~---~--~~
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: Paginate variables

2009-02-19 Thread brian

Oh, the clue train just pulled in. You're trying to use a variable
when setting the class var $paginate. You can't do that. What you can
do, though, is adjust the $paginate var in your method/action.

So, if you have other stuff to put in $paginate ('order', 'limit',
etc.) go ahead and do so. Then in your method, do:

$this->paginate['conditions'] = array('Group.site_id' => $variable);

Obviously, if you already have other conditions, you'll want to append them:

$this->paginate['conditions'][] = array('Group.site_id' => $variable);

On Thu, Feb 19, 2009 at 2:07 PM, Stu  wrote:
>
> Well, this is interesting:
>
>  var $paginate = array(
>'conditions' => array(
>'Group.site_id' => $variable
>)
>  );
>
> this no longer gives me a missing " ) " parse error, but now I get
> this:
>
> Parse error: parse error in C:\web-dev\www\TelHD\controllers
> \group_details_controller.php on line 9
>
> and line 9 would be this bad boy:  'Group.site_id' => $variable
>
> On the other hand if I try this:
>
>  var $paginate = array(
>'conditions' => array(
>'Group.site_id' => 28
>)
>  );
>
> It works great...
>
> No doubts the problem comes from my variable now.
>
>
>
>
> >
>

--~--~-~--~~~---~--~~
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: Paginate variables

2009-02-19 Thread Stu

Well, this is interesting:

  var $paginate = array(
'conditions' => array(
'Group.site_id' => $variable
)
  );

this no longer gives me a missing " ) " parse error, but now I get
this:

Parse error: parse error in C:\web-dev\www\TelHD\controllers
\group_details_controller.php on line 9

and line 9 would be this bad boy:  'Group.site_id' => $variable

On the other hand if I try this:

  var $paginate = array(
'conditions' => array(
'Group.site_id' => 28
)
  );

It works great...

No doubts the problem comes from my variable now.




--~--~-~--~~~---~--~~
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: user Profile protection howto

2009-02-19 Thread leo

Check who is the current user and only allow based on that?

On Feb 19, 7:55 pm, amarradi  wrote:
> Hello together,
>
> How do i protect the userprofiles?
>
> Because i don't know how i protect the userprofiles mutually. if a
> user is logged in and he visits
>
> /cakePHP/users/edit/1 he can edit his profile. But when he typed in
> his browser /cakePHP/users/edit/2 he can edit an other profile.
>
> How can i stop this?
>
> many greeting
>
> Marcus Radisch
--~--~-~--~~~---~--~~
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: Search db with find & conditions

2009-02-19 Thread rb


The good news:
 I was able to get it working (thanks!)

The bad news:
 I'm now trying to append a LIKE condition, and I'm not appending
the conditions array correctly. Every time I attempt to append the
LIKE condition, it overwrites anything previously appended to the
array, as well as does some other funky stuff.


$formSchools = $this->data['schools'];

$conditions = array();

if(!empty($formSchools['zip_mail']))
$conditions['School.zip_mail'] = $formSchools['zip_mail'];

if(!empty($formSchools['name']))
$conditions = "School.name LIKE '%{$formSchools['name']}%'";

if(!empty($formSchools['street_mail']))
$conditions['School.street_mail'] = $formSchools['street_mail'];

if(!empty($formSchools['state_province'])
$conditions['School.state_mail'] = $formSchools['state_province'];



I've tried a few different ways, but still not achieving the correct
array structure.

So basically my question, How do you append a LIKE condition into the
$conditions array?



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



user Profile protection howto

2009-02-19 Thread amarradi

Hello together,

How do i protect the userprofiles?

Because i don't know how i protect the userprofiles mutually. if a
user is logged in and he visits

/cakePHP/users/edit/1 he can edit his profile. But when he typed in
his browser /cakePHP/users/edit/2 he can edit an other profile.

How can i stop this?

many greeting

Marcus Radisch

--~--~-~--~~~---~--~~
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: Paginate variables

2009-02-19 Thread brian

On Thu, Feb 19, 2009 at 1:24 PM, Stu  wrote:
>
> @Brian
>
> Sorry man, I appreciate the help, didn't quite understand what you
> meant by that.

No biggie. I thought that was pretty funny.

> the variable is set, that I know. (I hard coded values in it for
> testing purposes)
>
> And the error I get is a Parse error for a missing "  )  ". which is
> strange because I can tell for sure it's not the case.

I think I see it now. Aside from the missing $ that mscdex noticed,
you've got an extra quote at the end and it appears that you're trying
to concatenate strings in this 1st example:

var paginate = array('conditions' =>array('Group.site_id = '.
$variable .''));

I'm wondering if you did the same when using the => notation. It should be:

var $paginate = array(
'conditions' => array(
'Group.site_id' => $variable
)
);

--~--~-~--~~~---~--~~
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: Paginate variables

2009-02-19 Thread mscdex

On Feb 19, 1:24 pm, Stu  wrote:
> And the error I get is a Parse error for a missing "  )  ". which is
> strange because I can tell for sure it's not the case.

I'd make sure you don't have any code above that "var $paginage" line
that is missing a ')'
Just a guess
--~--~-~--~~~---~--~~
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: Paginate variables

2009-02-19 Thread Stu

@Brian

Sorry man, I appreciate the help, didn't quite understand what you
meant by that.

the variable is set, that I know. (I hard coded values in it for
testing purposes)

And the error I get is a Parse error for a missing "  )  ". which is
strange because I can tell for sure it's not the case.

I was thinking it just wouldn't accept it in that format...

Anyways thanks for the help but I think I'll try to work myself around
paginate.


--~--~-~--~~~---~--~~
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: Paginate variables

2009-02-19 Thread Stu

hehe, no it's there.  I couldn't copypaste the line from the code
since I have to work with 2 different machines (and having a Java bg
the '$' isn't in my nature of coding).

I was wondering if I had to get the variable from somewhere else..
app_controller, model..?

It's probably something easy seeing on it works great when the values
are hard coded, yet I can't seem to find the answer .




--~--~-~--~~~---~--~~
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: Paginate variables

2009-02-19 Thread brian

On Thu, Feb 19, 2009 at 1:04 PM, Stu  wrote:
>
> var paginate = array('conditions' =>array('Group.site_id ' => 28)); <
> --- this works perfectly but what I'm trying to achieve is instead of
> the "28" value being hard coded, i would like to put a variable at
> it's place.

Dude, I realise that. I know what a variable is. My point was, does
the resulting query work? You say it does, so it looks an awful lot
like your variable is not set. But, if you'd posted the error in the
first place, we'd probably know for sure.

--~--~-~--~~~---~--~~
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: Paginate variables

2009-02-19 Thread mscdex

On Feb 19, 12:42 pm, Stu  wrote:
> I tried the following:
>
> var paginate = array('conditions' =>array('Group.site_id = '.
> $variable .''));
>
> and:
>
> var paginate = array('conditions' =>array('Group.site_id ' =>
> $variable
> ));
>
> which only sends me Parse errors for some reason.

Have you tried: var $paginate = array('conditions' =>array
('Group.site_id ' => $variable));
I think you forgot the $ before 'paginate.'
--~--~-~--~~~---~--~~
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: combination of validation in model and behaviour?

2009-02-19 Thread mscdex

On Feb 17, 9:56 am, "Mark (Germany)" 
wrote:
> hey there
>
> i tried for hours - but i can't get it to work
> i want that the errors of the model AND of the behaviour are both
> shown togehter (not after each other, as soon as one of them is fine).

Have you tried putting all of these beforeSave validation checks into
your model's $validate array as individual validation rules? That way
all error messages would appear on the form together (next to their
respective form fields).
--~--~-~--~~~---~--~~
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: Paginate variables

2009-02-19 Thread Stu

var paginate = array('conditions' =>array('Group.site_id ' => 28)); <
--- this works perfectly but what I'm trying to achieve is instead of
the "28" value being hard coded, i would like to put a variable at
it's place.

Like so: var paginate = array('conditions' =>array('Group.site_id
= '. $foobar .''));

Every users on the application will have different permissions on what
they will be able to see or not.

I'm not really sure if I'm on the right track with "paginate" here

btw, the code is in my controller.


--~--~-~--~~~---~--~~
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: Paginate variables

2009-02-19 Thread brian

On Thu, Feb 19, 2009 at 12:42 PM, Stu  wrote:
>
> Hi,
>
> I have an array with Permissions which contains the "id" of the
> "Posts" that will be allowed for that user in particular
>
> Now I'm using this line here to filter out it's contents through
> 'paginate'.
>
> var paginate = array('conditions' =>array('Group.site_id = VALUE'));
>
> I can easily put a hardcoded value such as 28 and it will work fine,
> but I was wondering how would you give a variable to VALUE
>
> I tried the following:
>
>
> var paginate = array('conditions' =>array('Group.site_id = '.
> $variable .''));
>
> and:
>
> var paginate = array('conditions' =>array('Group.site_id ' =>
> $variable
> ));

What is the parse error? That last one should be fine. Does this work?

var paginate = array('conditions' =>array('Group.site_id ' => 28));

Perhaps the error is due to something else.

--~--~-~--~~~---~--~~
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: combination of validation in model and behaviour?

2009-02-19 Thread Mark (Germany)

anybody an idea, how i can validate them both togehter?
whatever i try, it seems to validate only one at a time


On 17 Feb., 15:56, "Mark (Germany)" 
wrote:
> hey there
>
> i tried for hours - but i can't get it to work
> i want that the errors of the model AND of the behaviour are both
> shown togehter (not after each other, as soon as one of them is fine).
>
> i tried it with before/afterValidate, etc, with returning queryData
> and return false... all kind of possibities
>
> MODEL:
>
>         function beforeSave() {
>                         if 
> (!empty($this->data['RelationRequest']['new_request'])) {
>                                 if 
> ($this->requestExists($this->data['RelationRequest']
> ['user_id'], UID)) {
>                                         $this->invalidate('user_id','a 
> request is already pending -
> please be patient');
>                                         return false;
>                                 } elseif ($this->User->Relation->hasRelation
> (RELATION_STATUS_BLOCKED, $this->data['RelationRequest']['user_id'],
> UID)) {
>                                         $this->invalidate('user_id','you have 
> been blocked');
>                                         return false;
>                                 } elseif ($this->User->Relation->hasRelation
> (RELATION_STATUS_FRIENDS, $this->data['RelationRequest']['user_id'],
> UID)) {
>                                         $this->invalidate('user_id','you are 
> already friends');
>                                         return false;
>                                 }
>                         }
>                         return true;
>         }
>
> BEHAVIOUR:
>
>         public function beforeSave(&$model, &$queryData) {
>                 $this->model = $model;
>
>                 if 
> (!$this->validateCaptcha($this->model->data[$this->model->name]))
> {
>                         
> $this->model->invalidate('captcha','captchaResultIncorrect');
>                         return false;
>                 }
>                 unset($this->model->data[$this->model->name]['captcha']);
>                 unset($this->model->data[$this->model->name]['captcha_hash']);
>                 unset($this->model->data[$this->model->name]['captcha_time']);
>         }
>
> what am i missing here?
> i know that the behaviour gets triggered first - and if i return false
> here, the validating of the model is skipped
> if i do not return false, the form will submit successfully, even it
> the captcha invalidates..
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Paginate variables

2009-02-19 Thread Stu

Hi,

I have an array with Permissions which contains the "id" of the
"Posts" that will be allowed for that user in particular

Now I'm using this line here to filter out it's contents through
'paginate'.

var paginate = array('conditions' =>array('Group.site_id = VALUE'));

I can easily put a hardcoded value such as 28 and it will work fine,
but I was wondering how would you give a variable to VALUE

I tried the following:


var paginate = array('conditions' =>array('Group.site_id = '.
$variable .''));

and:

var paginate = array('conditions' =>array('Group.site_id ' =>
$variable
));

which only sends me Parse errors for some reason.

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



Re: $html->url returns unexpected result when using named parameters.

2009-02-19 Thread fr33dom

You rock!

This was doing my head in for ages.

Thank you again,
mikee

On Dec 24 2008, 9:03 am, Farhadi  wrote:
> I found this bug (https://trac.cakephp.org/ticket/4522) that is
> exactly what I mentioned.
> Currently, there is no plan to fix this problem, for now you can use
> this workaround:
> Place this line at your routes.php :
> Router::connectNamed(array('namedparam'));
>
> Notice that you must specify all of your project's named parameters in
> the above array.
>
> On Dec 24, 9:59 am, Farhadi  wrote:
>
> > Hi,
> > I have defined a route:
> > Router::connect('/:lang/:controller/:action/*', null, array
> > ('lang'=>'[a-z]{2}'));
>
> > when I want to create a link using $html->link if there was a named
> > parameter in the url, the result is wrong.
> > for example when I am in /en/groups/index,
> > $html->url(array('lang'=>'en', 'var'=>10)); returns "/groups/index/
> > lang:en/var:10" instead of "/en/groups/index/var:10"
>
> > Is there anything wrong with the route that I defined or its a bug in
> > Router.
>
> > by the way there is no other routes defined.
>
> > Thank in advance
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Register on my system without login

2009-02-19 Thread amarradi

Hello together,

now i'm at the point that somebody should register on my system. There
a little problem, because the add action in my user controller need an
login, thats pointless.
in my entries Controller is an action
isAuthorized where i define the 'allows' which run without login
This runs very good...

should i implement in the UsersController also such an action.

In the system there are no groups only users in DB and foreign

many greetings

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



SQL Error: 1064: when trying to find from two tables

2009-02-19 Thread theotherdy

Dear All

I'm two days in to CakePHP and am loving it but have now spent all
afternoon tryiong to work out why I can't seem to do an implicit join
between two tables. I'm almost at the point of resorting to good old
SQL but thought I'd check here first to see if someone can tell me
where I've gone wrong. I get the message:

"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 '.`id` = 'Marker.MarkerScenario.Scenario.id''
at line 1 [CORE\cake\libs\model\datasources\dbo_source.php, line 514]

Query: SELECT `User`.`id`, `User`.`first_name`, `User`.`last_name`,
`User`.`username`, `User`.`created`, `User`.`modified` FROM `users` AS
`User` WHERE `Marker`.`id` = 1 AND
`User`.`ScenarioUser`.`Scenario`.`id` =
'Marker.MarkerScenario.Scenario.id'"

from the viewUsersForMarker below:

Session->setFlash(__('Invalid Marker.', true));
$this->redirect(array('action'=>'index')); //need to 
redirect
somewhere elserlong-term
}
$this->set('users', $this->User->find('all', array('conditions' 
 =>
array('Marker.id'  => $marker_id, 'User.ScenarioUser.Scenario.id'  =>
'Marker.MarkerScenario.Scenario.id';
}

I'm trying the get the users who are associated with a scenario that
is also associated with the marker identified by $marker_id.

Thank you for looking - classes below:

class Scenario extends AppModel
{
var $name= 'Scenario';
var $hasAndBelongsToMany = array( 'User' =>array('className' =>
'User'),'Administrator' =>array('className' =>
'Administrator'),'Marker' =>array('className' => 'Marker'));
var $hasMany = array( 'ScenarioUser', 'MarkerScenario');
}

class ScenarioUser extends AppModel
{
var $name= 'ScenarioUser';
var $belongsTo = array ('Scenario','User');
var $hasMany = array ('Justification');
var $useTable = "scenarios_users";
}

class MarkerScenario extends AppModel
{
var $name= 'MarkerScenario';
var $belongsTo = array ('Scenario','Marker');
var $useTable = "markers_scenarios";
}

class User extends AppModel
{
var $name= 'User';
var $hasAndBelongsToMany = array( 'Scenario' =>array('className' =>
'Scenario'),  'Marker' =>array('className' => 'Marker'));
var $hasMany = array( 'ScenarioUser' );
}

class Marker extends AppModel
{
var $name= 'Marker';
var $hasAndBelongsToMany = array( 'Scenario' =>array('className' =>
'Scenario'),'User' =>array('className' => 'User'));
var $hasMany = array( 'MarkerScenario');
}


--~--~-~--~~~---~--~~
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: Change view by userstate

2009-02-19 Thread amarradi

Thanks a lot,

thats the better way.

Marcus Radisch
--~--~-~--~~~---~--~~
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: render a view works but set-Variables are missing

2009-02-19 Thread volka

Hey,
it will work with jquery's $.ajax

Jquery rulez!!!


On 19 Feb., 16:39, volka  wrote:
> Hi,
> I want to render a view in another view using:
> echo $this->render('/board_threads/index', 'plain', null);
>
> The Layout 'plain' is just containing ' $content_for_layout; ?>'
>
> The rendering seems to work fine, but the Variable I set with set();
> in the index() of BoardThreadsController
> are undefinded..
>
> What is wrong here?
>
> Thanks and kind regards,
> Volka
--~--~-~--~~~---~--~~
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: Change view by userstate

2009-02-19 Thread Johnny

if you are using the Auth component for user authentification, you can
check if a user is logged in or not simply by using:
$session->check('Auth.User.id')
as a condition in your if clause

On Feb 19, 5:19 pm, amarradi  wrote:
> I found the solution
>
> I set an username on an variable, and after Logout this variable i set
> to null
>
> :)
>
> if(!empty($username)) {
>   echo $html->link('Logout', array
> ('controller'=>'users','action'=>'logout'));} else {
>
>   echo $html->link('Login', array
> ('controller'=>'users','action'=>'login'));}
>
> ?>
>
> many greetings
>
> Marcus Radisch

--~--~-~--~~~---~--~~
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: Wordpress is CakePHP

2009-02-19 Thread BrendonKoz

I wonder if that would make Wordpress smaller, or slightly larger than
the current install if it used a PHP framework.  I doubt they'd be
comfortable switching to someone else's codebase, unfortunately.  It
would be interesting to see Wordpress move to a TDD architecture.

I have Wordpress in a subdirectory of the webroot folder for Cake.  As
for the original topic, there should be a setting in Wordpress'
configuration (either in the database, if you're having issues
accessing/saving items), or in the many configuration options of the
Wordpress administration pages.  Backup the database before making any
changes just in case you end up setting the wrong config.  Also, keep
in mind that the app folder, in a production environment, really
should be below the hosted application's web root (for security).
David Golding has created a screencast showing just how to do this
(Running Cake Outside Root):
http://www.davidgolding.net/screencasts

Regardless of security concerns, you probably just want to get things
working, so look in Wordpress' configuration settings.


On Feb 19, 10:33 am, mbavio  wrote:
> Damn, by the title of the post, I thought that Matt was going to port
> Wordpress to use CakePHP. What a huge spread of the framework would be
> that! :P
>
> On Feb 19, 12:07 pm, Henrik Bjørnskov  wrote:
>
> > Why dont you host it on a subdomain on the same server ?
>
> > On Feb 19, 2:26 pm, Eber Freitas Dias  wrote:
>
> > > I had this problem and I fixed it by pointting my server to the webrrot
> > > folder instead of the app folder.
>
> > > On Thu, Feb 19, 2009 at 4:09 AM, Chris M  wrote:
> > > > I'm by NO MEANS an expert in this area, but it sounds like your router 
> > > > is
> > > > working properly but the WP install is looking at the absolute path to 
> > > > the
> > > > WP install.  Hopefully, there is a WP config to control this setting and
> > > > that will fix it for you.
>
> > > > Remember, I'm a newbie to Cake and to WP.  I'm not telling you the
> > > > definitive answer, only my 'gut feel' and what I would look for.
>
> > > > HIH ...
>
> > > > --
> > > > *From:* kaushik 
> > > > *To:* CakePHP 
> > > > *Sent:* Thursday, 19 February, 2009 5:28:53 PM
> > > > *Subject:* Re: Wordpress is CakePHP
>
> > > > I have installed Wordpress in "app\webroot\wordpress". it is working
> > > > properly when I am firing URL: "www.mysite.com/wordpress". But all the
> > > > link are showing in wordpress section like "www.mysite.com/app/webroot/
> > > > wordpress/?cat=1", although I am working with "www.mysite.com/
> > > > wordpress". even if I open "www.mysite.com/wordpress/wp-login.php", it
> > > > is redirected me to "www.mysite.com/wordpress/app/webroot/wordpress/wp-
> > > > admin/" after login.
>
> > > > What is fix for this problem so that it always use "www.mysite.com/wp-
> > > > admin/..." and "www.mysite.com/wordpress"?
>
> > > > On Feb 19, 11:05 am, Andras Kende  wrote:
> > > > > You could put the wordpress directory inside the webroot folder
>
> > > > > domain.com/wordpress
>
> > > > > On Feb 19, 2009, at 12:26 AM, kaushik wrote:
>
> > > > > > I have developed a site in cake. Now the client to integrate 
> > > > > > Wordpress
> > > > > > blog in this site. Is it possible to install Wordpress in any sub
> > > > > > directory and operate it from there.
>
> > > > > Andras Kendehttp://kende.com
> > > > --
> > > > Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find 
> > > > out
> > > > more
> > > > .
>
> > > --
> > > Éber Freitas Dias
>
> > >www.acoruja.comwww.tu-dus.comwww.eberfdias.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
-~--~~~~--~~--~--~---



render a view works but set-Variables are missing

2009-02-19 Thread volka

Hi,
I want to render a view in another view using:
echo $this->render('/board_threads/index', 'plain', null);

The Layout 'plain' is just containing ''

The rendering seems to work fine, but the Variable I set with set();
in the index() of BoardThreadsController
are undefinded..

What is wrong here?

Thanks and kind regards,
Volka

--~--~-~--~~~---~--~~
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: Wordpress is CakePHP

2009-02-19 Thread mbavio

Damn, by the title of the post, I thought that Matt was going to port
Wordpress to use CakePHP. What a huge spread of the framework would be
that! :P

On Feb 19, 12:07 pm, Henrik Bjørnskov  wrote:
> Why dont you host it on a subdomain on the same server ?
>
> On Feb 19, 2:26 pm, Eber Freitas Dias  wrote:
>
> > I had this problem and I fixed it by pointting my server to the webrrot
> > folder instead of the app folder.
>
> > On Thu, Feb 19, 2009 at 4:09 AM, Chris M  wrote:
> > > I'm by NO MEANS an expert in this area, but it sounds like your router is
> > > working properly but the WP install is looking at the absolute path to the
> > > WP install.  Hopefully, there is a WP config to control this setting and
> > > that will fix it for you.
>
> > > Remember, I'm a newbie to Cake and to WP.  I'm not telling you the
> > > definitive answer, only my 'gut feel' and what I would look for.
>
> > > HIH ...
>
> > > --
> > > *From:* kaushik 
> > > *To:* CakePHP 
> > > *Sent:* Thursday, 19 February, 2009 5:28:53 PM
> > > *Subject:* Re: Wordpress is CakePHP
>
> > > I have installed Wordpress in "app\webroot\wordpress". it is working
> > > properly when I am firing URL: "www.mysite.com/wordpress". But all the
> > > link are showing in wordpress section like "www.mysite.com/app/webroot/
> > > wordpress/?cat=1", although I am working with "www.mysite.com/
> > > wordpress". even if I open "www.mysite.com/wordpress/wp-login.php", it
> > > is redirected me to "www.mysite.com/wordpress/app/webroot/wordpress/wp-
> > > admin/" after login.
>
> > > What is fix for this problem so that it always use "www.mysite.com/wp-
> > > admin/..." and "www.mysite.com/wordpress"?
>
> > > On Feb 19, 11:05 am, Andras Kende  wrote:
> > > > You could put the wordpress directory inside the webroot folder
>
> > > > domain.com/wordpress
>
> > > > On Feb 19, 2009, at 12:26 AM, kaushik wrote:
>
> > > > > I have developed a site in cake. Now the client to integrate Wordpress
> > > > > blog in this site. Is it possible to install Wordpress in any sub
> > > > > directory and operate it from there.
>
> > > > Andras Kendehttp://kende.com
> > > --
> > > Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out
> > > more
> > > .
>
> > --
> > Éber Freitas Dias
>
> >www.acoruja.comwww.tu-dus.comwww.eberfdias.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: Change view by userstate

2009-02-19 Thread amarradi

I found the solution

I set an username on an variable, and after Logout this variable i set
to null

:)

if(!empty($username)) {
  echo $html->link('Logout', array
('controller'=>'users','action'=>'logout'));
} else {
  echo $html->link('Login', array
('controller'=>'users','action'=>'login'));
}
?>

many greetings

Marcus Radisch
--~--~-~--~~~---~--~~
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: Wordpress is CakePHP

2009-02-19 Thread Henrik Bjørnskov

Why dont you host it on a subdomain on the same server ?

On Feb 19, 2:26 pm, Eber Freitas Dias  wrote:
> I had this problem and I fixed it by pointting my server to the webrrot
> folder instead of the app folder.
>
>
>
> On Thu, Feb 19, 2009 at 4:09 AM, Chris M  wrote:
> > I'm by NO MEANS an expert in this area, but it sounds like your router is
> > working properly but the WP install is looking at the absolute path to the
> > WP install.  Hopefully, there is a WP config to control this setting and
> > that will fix it for you.
>
> > Remember, I'm a newbie to Cake and to WP.  I'm not telling you the
> > definitive answer, only my 'gut feel' and what I would look for.
>
> > HIH ...
>
> > --
> > *From:* kaushik 
> > *To:* CakePHP 
> > *Sent:* Thursday, 19 February, 2009 5:28:53 PM
> > *Subject:* Re: Wordpress is CakePHP
>
> > I have installed Wordpress in "app\webroot\wordpress". it is working
> > properly when I am firing URL: "www.mysite.com/wordpress". But all the
> > link are showing in wordpress section like "www.mysite.com/app/webroot/
> > wordpress/?cat=1", although I am working with "www.mysite.com/
> > wordpress". even if I open "www.mysite.com/wordpress/wp-login.php", it
> > is redirected me to "www.mysite.com/wordpress/app/webroot/wordpress/wp-
> > admin/" after login.
>
> > What is fix for this problem so that it always use "www.mysite.com/wp-
> > admin/..." and "www.mysite.com/wordpress"?
>
> > On Feb 19, 11:05 am, Andras Kende  wrote:
> > > You could put the wordpress directory inside the webroot folder
>
> > > domain.com/wordpress
>
> > > On Feb 19, 2009, at 12:26 AM, kaushik wrote:
>
> > > > I have developed a site in cake. Now the client to integrate Wordpress
> > > > blog in this site. Is it possible to install Wordpress in any sub
> > > > directory and operate it from there.
>
> > > Andras Kendehttp://kende.com
> > --
> > Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out
> > more
> > .
>
> --
> Éber Freitas Dias
>
> www.acoruja.comwww.tu-dus.comwww.eberfdias.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
-~--~~~~--~~--~--~---



Change view by userstate

2009-02-19 Thread amarradi

Hello,

i want that my login link will be an logout link when a user with this
browser is login in.

When he is logout the link should show login. And if he is login the
link should show logout
I tried

debug ($session->read()); die;

but there is no state variable.

Which variable can i use for that feature?

many greeting

Marcus Radisch
--~--~-~--~~~---~--~~
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: Links from an other controller in my view

2009-02-19 Thread amarradi

Thanks a lot it runs very well :) :) double smile
--~--~-~--~~~---~--~~
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: View Cache and special characters

2009-02-19 Thread brian

On Thu, Feb 19, 2009 at 8:00 AM, neverlosty  wrote:
>
> Hi,
>
> I'm trying to get view cache to work and everything is fine apart from
> when the URL has an apostrophe in it.
> eg, http://www.example.com/tim's+stuff
>
> The cache engine turns it into something like tim_s_stuff.php
> But when I try to access the page again, I simply get a white screen
> of fiery death.
>
> Does anyone know if there's something I can do to remedy this?

Certainly. Don't use apostrophes in your URLs. If really you must do
so, encode them first.

http://www.w3.org/Addressing/URL/4_URI_Recommentations.html
http://en.wikipedia.org/wiki/Percent-encoding

And apostrophes are an especially problematic character as certain
applications like to change them to "smart" quotes. Not very helpful
when the string they are in is to be used as a resource locator.

--~--~-~--~~~---~--~~
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: Wordpress is CakePHP

2009-02-19 Thread Eber Freitas Dias
I had this problem and I fixed it by pointting my server to the webrrot
folder instead of the app folder.

On Thu, Feb 19, 2009 at 4:09 AM, Chris M  wrote:

> I'm by NO MEANS an expert in this area, but it sounds like your router is
> working properly but the WP install is looking at the absolute path to the
> WP install.  Hopefully, there is a WP config to control this setting and
> that will fix it for you.
>
> Remember, I'm a newbie to Cake and to WP.  I'm not telling you the
> definitive answer, only my 'gut feel' and what I would look for.
>
> HIH ...
>
> --
> *From:* kaushik 
> *To:* CakePHP 
> *Sent:* Thursday, 19 February, 2009 5:28:53 PM
> *Subject:* Re: Wordpress is CakePHP
>
>
> I have installed Wordpress in "app\webroot\wordpress". it is working
> properly when I am firing URL: "www.mysite.com/wordpress". But all the
> link are showing in wordpress section like "www.mysite.com/app/webroot/
> wordpress/?cat=1", although I am working with "www.mysite.com/
> wordpress". even if I open "www.mysite.com/wordpress/wp-login.php", it
> is redirected me to "www.mysite.com/wordpress/app/webroot/wordpress/wp-
> admin/" after login.
>
> What is fix for this problem so that it always use "www.mysite.com/wp-
> admin/..." and "www.mysite.com/wordpress"?
>
>
> On Feb 19, 11:05 am, Andras Kende  wrote:
> > You could put the wordpress directory inside the webroot folder
> >
> > domain.com/wordpress
> >
> > On Feb 19, 2009, at 12:26 AM, kaushik wrote:
> >
> >
> >
> > > I have developed a site in cake. Now the client to integrate Wordpress
> > > blog in this site. Is it possible to install Wordpress in any sub
> > > directory and operate it from there.
> >
> > Andras Kendehttp://kende.com
> --
> Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out
> more
> .
>
> >
>


-- 
Éber Freitas Dias

www.acoruja.com
www.tu-dus.com
www.eberfdias.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
-~--~~~~--~~--~--~---



View Cache and special characters

2009-02-19 Thread neverlosty

Hi,

I'm trying to get view cache to work and everything is fine apart from
when the URL has an apostrophe in it.
eg, http://www.example.com/tim's+stuff

The cache engine turns it into something like tim_s_stuff.php
But when I try to access the page again, I simply get a white screen
of fiery death.

Does anyone know if there's something I can do to remedy this?

thanks,
Tony.
--~--~-~--~~~---~--~~
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: PHP output buffering

2009-02-19 Thread AD7six

Please ask your none-cakephp questions in an appropriate forum (i.e. a
general php group/forum/etc.).

On Feb 19, 12:37 pm, Double  wrote:
> code:
>
> $file = fopen("http://www.sample.com/index.asp?Page=1";, "r");
>
> while (!feof($file))  { // file go through file one line at a time
>
>         $line_wp = fgets($file_handle_wp);
>
> }
>
> it just gives me the asp file as code rather than interpreted by the
> server.
>
> Is there a way to get a process asp file from the server and then
> parse?
>
> On Feb 19, 4:20 am, John Andersen  wrote:
>
> > On Feb 19, 11:06 am, Double  wrote:
>
> > > I'm trying to execute an asp page fromphpand get the executed web
> > > page (html) to parse.
>
> > > When I run fopen, it just returns the actual script.
>
> > > Any ideas?
>
> > Please specify how you are opening the asp page! (Code!)
> > Enjoy,
> >    John
--~--~-~--~~~---~--~~
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: PHP output buffering

2009-02-19 Thread Double


code:

$file = fopen("http://www.sample.com/index.asp?Page=1";, "r");

while (!feof($file))  { // file go through file one line at a time

$line_wp = fgets($file_handle_wp);

}

it just gives me the asp file as code rather than interpreted by the
server.

Is there a way to get a process asp file from the server and then
parse?

On Feb 19, 4:20 am, John Andersen  wrote:
> On Feb 19, 11:06 am, Double  wrote:
>
> > I'm trying to execute an asp page fromphpand get the executed web
> > page (html) to parse.
>
> > When I run fopen, it just returns the actual script.
>
> > Any ideas?
>
> Please specify how you are opening the asp page! (Code!)
> Enjoy,
>    John

--~--~-~--~~~---~--~~
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: PHP output buffering

2009-02-19 Thread Marcelius

And what does this have to do with cakephp? :-)

On 19 feb, 10:06, Double  wrote:
> I'm trying to execute an asp page from php and get the executed web
> page (html) to parse.
>
> When I run fopen, it just returns the actual script.
>
> 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: Links from an other controller in my view

2009-02-19 Thread Aivaras

Or if you're not going to use router then:

$html->link('Add User', 'users/add');

Faifas



On Thu, Feb 19, 2009 at 13:14, djiize  wrote:
>
> $html->link('Add User', array('controller' => 'users', 'action' =>
> 'add'));
>
> On 19 fév, 12:01, amarradi  wrote:
>> Hello together,
>>
>> i have 2 Controller EntriesController and UsersController.
>>
>> And i have views for the Entries and views for the user.
>>
>> If i set an link like in an view from Entries i will get an link to
>> add new Entry
>>
>> $html->('Add Entry', array('action'=>'add'));
>>
>> But what have i to do to get an link to Add new User into the Entry-
>> View ? I tried
>>
>> $html->('Add User', array('action'=>'Users.add'));
>>
>> But is doesn't run
>>
>> Many greetings
>>
>> Marcus Radisch
> >
>

--~--~-~--~~~---~--~~
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: Links from an other controller in my view

2009-02-19 Thread djiize

$html->link('Add User', array('controller' => 'users', 'action' =>
'add'));

On 19 fév, 12:01, amarradi  wrote:
> Hello together,
>
> i have 2 Controller EntriesController and UsersController.
>
> And i have views for the Entries and views for the user.
>
> If i set an link like in an view from Entries i will get an link to
> add new Entry
>
> $html->('Add Entry', array('action'=>'add'));
>
> But what have i to do to get an link to Add new User into the Entry-
> View ? I tried
>
> $html->('Add User', array('action'=>'Users.add'));
>
> But is doesn't run
>
> Many greetings
>
> Marcus Radisch
--~--~-~--~~~---~--~~
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 logged in username on view a Question about the AuthComponent

2009-02-19 Thread djiize

oh thanks AD7six, didn't think of that (shame on me)

On 19 fév, 11:39, AD7six  wrote:
> On Feb 19, 11:30 am, djiize  wrote:
>
> > in your beforeFilter of beforeRender :
> > $this->set($this->Auth->user());
>
> Why bother. It's in the session, just read from it.
>
> view code:
> debug ($session->read()); die; and look
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Links from an other controller in my view

2009-02-19 Thread amarradi

Hello together,

i have 2 Controller EntriesController and UsersController.

And i have views for the Entries and views for the user.

If i set an link like in an view from Entries i will get an link to
add new Entry

$html->('Add Entry', array('action'=>'add'));

But what have i to do to get an link to Add new User into the Entry-
View ? I tried

$html->('Add User', array('action'=>'Users.add'));

But is doesn't run

Many greetings

Marcus Radisch
--~--~-~--~~~---~--~~
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: translate behavior

2009-02-19 Thread kicaj

I created:
$this->Category->locale = array('fre', 'eng');
$categories = $this->Category->find('all');

pr($categories); // return array only with default language - fre

$this->set('categories', $categories);

/* How use $delete? */
$delete = array(
array('locale' => 'fre'),
array('foreign_key' => 1, 'field' => 'title', 'locale' => 'eng'),
array('foreign_key' => 1, 'field' => 'title'));

Sorry, but my english is weak...

On 18 Lut, 23:49, "jitka (poLK)"  wrote:
> In doubts how to use something, read test cases - they're not only
> proving that old bugs are away, but also showing how are things
> supposed to be 
> used.https://trac.cakephp.org/browser/branches/1.2.x.x/cake/tests/cases/li...
> Read this method - it deletes few translations first, and then reads
> translated db content using array $locale.
--~--~-~--~~~---~--~~
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 logged in username on view a Question about the AuthComponent

2009-02-19 Thread amarradi

Thanks a lot :) Its so easy...

My next question is coming
--~--~-~--~~~---~--~~
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 logged in username on view a Question about the AuthComponent

2009-02-19 Thread AD7six



On Feb 19, 11:30 am, djiize  wrote:
> in your beforeFilter of beforeRender :
> $this->set($this->Auth->user());

Why bother. It's in the session, just read from it.

view code:
debug ($session->read()); die; and look
--~--~-~--~~~---~--~~
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 logged in username on view a Question about the AuthComponent

2009-02-19 Thread djiize

in your beforeFilter of beforeRender :
$this->set($this->Auth->user());

On 19 fév, 11:14, amarradi  wrote:
> Hello together,
>
> my Controller has the following action
> function beforeFilter() {
>         parent::beforeFilter();
>         $this->Auth->allow('index','search');
>     }
>
> if i click on the add Action e.q. i will be automatic redirect to the
> login screen. Thats ok.
>
> But how can i set the logged in username on the views? Thanks a lot
>
> many greetings
>
> Marcus Radisch
--~--~-~--~~~---~--~~
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: email to blog functionality

2009-02-19 Thread leo

On Feb 19, 10:50 am, Adam Royle  wrote:
> I've done it using cpanel (quite easy actually), and from some googling
> it seems possible with plesk too. Just search for " name> pipe email to script".
>
> With #1, you can use php imap extension, which lets you access both pop
> and imap mailboxes.
>
> Adam

Thanks Adam - that's just the Ds Bs. I can see now that either of
those options are open to me. Naturally the 'pipe to script' option is
the most desirable.

Parsing will not be a problem and I expect I'll be able to devise a
text format that enables me to send data such as password (for extra
security) and category. Images as well, I guess.

Thanks again.

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



The logged in username on view a Question about the AuthComponent

2009-02-19 Thread amarradi

Hello together,

my Controller has the following action
function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('index','search');
}

if i click on the add Action e.q. i will be automatic redirect to the
login screen. Thats ok.

But how can i set the logged in username on the views? Thanks a lot

many greetings

Marcus Radisch


--~--~-~--~~~---~--~~
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: email to blog functionality

2009-02-19 Thread Adam Royle
I've done it using cpanel (quite easy actually), and from some googling 
it seems possible with plesk too. Just search for " pipe email to script".

With #1, you can use php imap extension, which lets you access both pop 
and imap mailboxes.

Adam

leo wrote:
> Thanks, I'd assumed #1 was the only option, but #2 sounds interesting.
> Do you have any pointers on how to set up the email account? I don't
> know whether it'll be possible using shared hosting.
>
> Regarding #1, do you have any pointers for the script? I have no idea
> how to programatically access an email account.
>
> L
>
> On Feb 19, 10:17 am, Adam Royle  wrote:
>
>> Depends on your server setup. Two solutions:
>>
>> 1. Write a script that is called periodically through cron that checks
>> an email mailbox for new messages.
>> 2. Setup your email account to pipe to a script instead of to a mailbox.
>>
>> I have used #2 and it works well because the script only runs when it
>> needs to.
>>
>> Either way, once you get the email content you'll need to parse it
>> somehow to find the relevant content. I've used the mailparse php
>> extension and it works pretty well.
>>
>> Cheers,
>> Adam
>>
>> leo wrote:
>>  
>>> I'm looking at updating a blog by email - a la blogger&wordpress.
>>>
>>> Anybody have any ideas about how to go about this?
>>>
>>> Last time I thought about it I found some protocols and stuff through
>>> google, but google seems these days do be a bit chaffy and I can't
>>> remember what the protocol was.
>>>
>>> Anyway, it seems to me that protocol isn't important, it's how to get
>>> at the email from the blog script.
>>>
>>> Anyone?
>>>
> >
>
>

--~--~-~--~~~---~--~~
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: email to blog functionality

2009-02-19 Thread leo

Thanks, I'd assumed #1 was the only option, but #2 sounds interesting.
Do you have any pointers on how to set up the email account? I don't
know whether it'll be possible using shared hosting.

Regarding #1, do you have any pointers for the script? I have no idea
how to programatically access an email account.

L

On Feb 19, 10:17 am, Adam Royle  wrote:
> Depends on your server setup. Two solutions:
>
> 1. Write a script that is called periodically through cron that checks
> an email mailbox for new messages.
> 2. Setup your email account to pipe to a script instead of to a mailbox.
>
> I have used #2 and it works well because the script only runs when it
> needs to.
>
> Either way, once you get the email content you'll need to parse it
> somehow to find the relevant content. I've used the mailparse php
> extension and it works pretty well.
>
> Cheers,
> Adam
>
> leo wrote:
> > I'm looking at updating a blog by email - a la blogger&  wordpress.
>
> > Anybody have any ideas about how to go about this?
>
> > Last time I thought about it I found some protocols and stuff through
> > google, but google seems these days do be a bit chaffy and I can't
> > remember what the protocol was.
>
> > Anyway, it seems to me that protocol isn't important, it's how to get
> > at the email from the blog script.
>
> > Anyone?
--~--~-~--~~~---~--~~
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: PHP output buffering

2009-02-19 Thread John Andersen


On Feb 19, 11:06 am, Double  wrote:
> I'm trying to execute an asp page from php and get the executed web
> page (html) to parse.
>
> When I run fopen, it just returns the actual script.
>
> Any ideas?

Please specify how you are opening the asp page! (Code!)
Enjoy,
   John

--~--~-~--~~~---~--~~
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: email to blog functionality

2009-02-19 Thread Adam Royle

Depends on your server setup. Two solutions:

1. Write a script that is called periodically through cron that checks 
an email mailbox for new messages.
2. Setup your email account to pipe to a script instead of to a mailbox.

I have used #2 and it works well because the script only runs when it 
needs to.

Either way, once you get the email content you'll need to parse it 
somehow to find the relevant content. I've used the mailparse php 
extension and it works pretty well.

Cheers,
Adam

leo wrote:
> I'm looking at updating a blog by email - a la blogger&  wordpress.
>
> Anybody have any ideas about how to go about this?
>
> Last time I thought about it I found some protocols and stuff through
> google, but google seems these days do be a bit chaffy and I can't
> remember what the protocol was.
>
> Anyway, it seems to me that protocol isn't important, it's how to get
> at the email from the blog script.
>
> Anyone?
> >
>
>

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



PHP output buffering

2009-02-19 Thread Double


I'm trying to execute an asp page from php and get the executed web
page (html) to parse.

When I run fopen, it just returns the actual script.

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



email to blog functionality

2009-02-19 Thread leo

I'm looking at updating a blog by email - a la blogger  & wordpress.

Anybody have any ideas about how to go about this?

Last time I thought about it I found some protocols and stuff through
google, but google seems these days do be a bit chaffy and I can't
remember what the protocol was.

Anyway, it seems to me that protocol isn't important, it's how to get
at the email from the blog script.

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