Variables

2012-05-02 Thread Historiker
Kann mit jemand erklären, warum

?php echo $current_user['username']; ?

im default.ctp funktioniert und im add.ctp nicht?


Version 2.1
current_user gesetzt in AppController.php
...
public function beforeFilter() {
   ...
   $this-set('current_user', $this-Auth-user());

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Variables

2012-05-02 Thread luca capra


Il 02/05/2012 09:18, Historiker ha scritto:

Kann mit jemand erklären, warum

?php echo $current_user['username']; ?

im default.ctp funktioniert und im add.ctp nicht?


Version 2.1
 current_user gesetzt in AppController.php
 ...
 public function beforeFilter() {
...
$this-set('current_user', $this-Auth-user());

Maybe you implement beforeFilter in the add.ctp related controller 
without parent::beforeFilter ?


--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.



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


to realize a join query !

2012-05-02 Thread Serkan Sipahi
Hi all,

i trying to realize a join query but its not work and i can not see my 
problem/issue?!? I implement my code according to: 
http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html 


//Models:


class Category extends AppModel {

    public $hasMany = array(
    'Url' = array(
    'className'  = 'Url',
    'foreignKey' = 'category_id'
    )
    );}

class Url extends AppModel {

    public $hasMany = array(
    'ATag' = array(
    'className'  = 'ATag',
    'foreignKey' = 'url_id'
    ),
    'HTag' = array(
    'className'  = 'HTag',
    'foreignKey' = 'url_id'
    ),
    'HeadTag' = array(
    'className'  = 'HeadTag',
    'foreignKey' = 'url_id'
    ),
    'PTag' = array(
    'className'  = 'PTag',
    'foreignKey' = 'url_id'
    ),
    );
}


//Controller: 

    class FrontendController extends AppController {
    
    public function index(){
    
    $this-loadModel('Category');
    
    $keyword = 'some key';
    $domain  = 'www.some-domain.com'
    

    /*
  How can i realize this with joins:

  SELECT * FROM categories, urls, a_tags, head_tags
  WHERE categories.id = urls.category_id AND
  urls.id = a_tags.url_id AND
  urls.id = head_tags.url_id AND
  categories.name = 'some key' AND
  urls.name LIKE '%www.some-domain.com%'

    **/

            //it does not work(join)!
    $options['joins'] = array(
    array('table' = 'urls',
    'alias' = 'Url',
    'type' = 'LEFT',
    'conditions' = array(
    'Url.id = ATag.url_id',
    'Url.id = HTag.url_id',
    'Url.id = HeadTag.url_id',
    'Url.id = PTag.url_id',
    )
    )  
    );
    
    $options['conditions'] = array(
    'AND' = 
    array('Category.name' = $keyword),
    array(Url.name LIKE = %$domain%),
    );
    $this-Category-recursive = -1;
    $res = $this-Category-find('all', $options);
            

            pr($res)
    //Error:  SQLSTATE[42S22]: Column not found: 1054 Unknown column 
'ATag.url_id' in 'on clause'
   /*   SQL Query:  
    SELECT `Category`.`id`, `Category`.`parent_id`, `Category`.`lft`, 
`Category`.`rght`, `Category`.`name`,
   `Category`.`created`,`Category`.`modified`,`Category`.`blacklist`, 
`Category`.`is_searched_by_user` 
    FROM `ssx`.`categories` AS 
`Category` 
    LEFT JOIN `ssx`.`urls` AS `Url` ON (
   `Url`.`id` =`ATag`.`url_id` AND 
       `Url`.`id` = `HTag`.`url_id` AND 
   `Url`.`id` = 
`HeadTag`.`url_id` AND 
   `Url`.`id` = `PTag`.`url_id`) 
        WHERE 
`Category`.`name` = 'some kategory' AND
    `Url`.`name` LIKE 
'%www.some-domain.com%' 
   */


    }

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


$this-Params['controller'] doesn't work in cakephp component

2012-05-02 Thread Cruisine
hi guys...i need to know how to get current controller from cakephp
component
i tried to use $this-Params['controller'] on my component but it
keeping me get error message like this :

Notice (8): Undefined property: DynRubrikComponent::$params [APP
\controllers\components\dyn_rubrik.php, line 17]

do u guys know how to deal with this matter ? need ur help very
soon...thank u..

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: $this-Params['controller'] doesn't work in cakephp component

2012-05-02 Thread Tilen Majerle
in your __construct() method for component, first parameter is
ComponentCollection $collection object.
From here you can store controller to component like
$this-Controller = $collection-getController();

then params you have in $this-Controller-params
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/5/2 Cruisine cruisin...@yahoo.co.id

 hi guys...i need to know how to get current controller from cakephp
 component
 i tried to use $this-Params['controller'] on my component but it
 keeping me get error message like this :

 Notice (8): Undefined property: DynRubrikComponent::$params [APP
 \controllers\components\dyn_rubrik.php, line 17]

 do u guys know how to deal with this matter ? need ur help very
 soon...thank u..

 --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help
 others with their CakePHP related questions.


 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


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: get output controller from another controller

2012-05-02 Thread Christophe Vandeplas
Hello,

Unfortunately the output format (in my variable) is still not the REST XML.

Any other idea?

Thanks
Christophe

On Sat, Apr 28, 2012 at 6:31 AM, lowpass zijn.digi...@gmail.com wrote:
 I don't know if this is all you need but these might help:

 $this-response-type('xml');
 $this-viewPath = 'events';
 $this-view = 'view';  // assuming app/views/events/view.ctp

 On Fri, Apr 27, 2012 at 2:45 AM, Christophe Vandeplas
 christo...@vandeplas.com wrote:
 Hello,


 ( using CakePHP 2.1 )
 I'm building an application that synchronizes data between different
 instances of my application. (download and upload)

 My application is REST enabled and thus I can call controller actions
 from external applications and get the result in clean xml. However it
 is not only a REST server, but also a REST client.

 Downloading data from the other instance is easy. I do a $xml =
 Xml::build($xmlurl); and process the $xml variable to import
 everything into my database. Perfect.

 However I am stuck in the other direction: Uploading data.
 I could simply do a $xmldata = Xml::fromArray($event)-asXML() however
 there is some cleaning to be done. This cleaning is what I do in my
 REST view as my REST clients should see the same xml as what I'm
 uploading to the other instance.
 So if I already do all the work in my rest view, why recoding exactly
 the same filtering?

 The url /events/view/5.xml  calls  EventsController-view(5) with XML
 layout and outputs everything in XML, exactly as I want it.

 I have a ServersController-push() function.
 This function needs to do get the same output as /events/view/5.xml ,
 and upload it using a REST POST request to the other instance.

 You could say I could simply call the /events/view/5.xml page using an
 HTTP request from the application.
 However it seems absurd as i) it seems absurd (and inefficient/slow)
 to do HTTP requests to yourself to extract data and ii) I have
 authentication on my REST calls which makes it a lot more difficult.

 I tried with :
 $eventsController = new EventsController();
 $eventsController-set('event', $event);
 $view = new View($eventsController);
 $viewdata = $view-render('view');

 But this only outputs the data in HTML, and not XML.
 I tried to play with the CakeResponse object in that newly created
 $eventsController, but that doesn't work. (there are no request or
 response instances created, and creating them myself doesn't work)


 So my question is:
 What is the best way to get the output of /events/view/5.xml
 (EventsController-view(5) ) inside another controller ?


 Thanks for your expertise.
 Christophe

 --
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.


 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

 --
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.


 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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: get output controller from another controller

2012-05-02 Thread Christophe Vandeplas
Ok, great.

I managed to get what I want using lowpass advice.
$this-RequestHandler-renderAs($this, 'xml');
$this-viewPath = 'Events';
$this-set('event', $event);
$viewdata = $this-render('view');
print $viewdata;

But resetting the $this Controller to normal variables is rather
annoying and another problem right now.


So I tried to use the same code, but by using a separate
$eventsController = new EventsController();
This also doesn't work.  (I don't get the XML output, but the html one)
$eventsController = new EventsController();
$this-RequestHandler-renderAs($eventsController, 'xml');
debug($eventsController);
$eventsController-set('event', $event);
$eventsController-set('isAdmin', $this-_isAdmin());
$view = new View($eventsController);
$viewdata = $view-render('view');
print $viewdata;


Any idea why the separate controller option doesn't work?

Thanks

Christophe



On Wed, May 2, 2012 at 3:16 PM, Christophe Vandeplas
christo...@vandeplas.com wrote:
 Hello,

 Unfortunately the output format (in my variable) is still not the REST XML.

 Any other idea?

 Thanks
 Christophe

 On Sat, Apr 28, 2012 at 6:31 AM, lowpass zijn.digi...@gmail.com wrote:
 I don't know if this is all you need but these might help:

 $this-response-type('xml');
 $this-viewPath = 'events';
 $this-view = 'view';  // assuming app/views/events/view.ctp

 On Fri, Apr 27, 2012 at 2:45 AM, Christophe Vandeplas
 christo...@vandeplas.com wrote:
 Hello,


 ( using CakePHP 2.1 )
 I'm building an application that synchronizes data between different
 instances of my application. (download and upload)

 My application is REST enabled and thus I can call controller actions
 from external applications and get the result in clean xml. However it
 is not only a REST server, but also a REST client.

 Downloading data from the other instance is easy. I do a $xml =
 Xml::build($xmlurl); and process the $xml variable to import
 everything into my database. Perfect.

 However I am stuck in the other direction: Uploading data.
 I could simply do a $xmldata = Xml::fromArray($event)-asXML() however
 there is some cleaning to be done. This cleaning is what I do in my
 REST view as my REST clients should see the same xml as what I'm
 uploading to the other instance.
 So if I already do all the work in my rest view, why recoding exactly
 the same filtering?

 The url /events/view/5.xml  calls  EventsController-view(5) with XML
 layout and outputs everything in XML, exactly as I want it.

 I have a ServersController-push() function.
 This function needs to do get the same output as /events/view/5.xml ,
 and upload it using a REST POST request to the other instance.

 You could say I could simply call the /events/view/5.xml page using an
 HTTP request from the application.
 However it seems absurd as i) it seems absurd (and inefficient/slow)
 to do HTTP requests to yourself to extract data and ii) I have
 authentication on my REST calls which makes it a lot more difficult.

 I tried with :
 $eventsController = new EventsController();
 $eventsController-set('event', $event);
 $view = new View($eventsController);
 $viewdata = $view-render('view');

 But this only outputs the data in HTML, and not XML.
 I tried to play with the CakeResponse object in that newly created
 $eventsController, but that doesn't work. (there are no request or
 response instances created, and creating them myself doesn't work)


 So my question is:
 What is the best way to get the output of /events/view/5.xml
 (EventsController-view(5) ) inside another controller ?


 Thanks for your expertise.
 Christophe

 --
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.


 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

 --
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.


 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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Sort assoc data

2012-05-02 Thread Michael Gaiser
Yep, thats what I was looking for. Thanks.

On Tue, May 1, 2012 at 3:40 PM, lowpass zijn.digi...@gmail.com wrote:
 Do you mean using Containable? If so, just add an 'order' array under
 the associated model.

 'contain' = array(
  'OtherModel' = array(
    'fields' = array(...),
    'order' = array(
      'OtherModel.column' = 'ASC'
     )
  )
 )

 On Tue, May 1, 2012 at 5:55 PM, Michael Gaiser mjgai...@gmail.com wrote:
 So, I have been able to sort queries of the basic model, but how do
 you specify sorting paramaters for the associated models?

 --
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.


 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

 --
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.


 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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Send email Shell Application

2012-05-02 Thread Tony Presnow
I recently upgraded from cakephp 2.0.6 to 2.1.1 and started having problem 
sending out nightly emails. I'm getting smtp connection time out errors. 
Nothing has changed on the email server, and emails generated from website 
forms are still working ... Is it possible that the connection is being 
dropped because of the malformed message id?  
http://cakephp.lighthouseapp.com/projects/42648/tickets/2698-cakeemail-messageid-in-cli-environment
 

If so, how do I go about fixing this issue? 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Giving context to a select field?

2012-05-02 Thread Michael Gaiser
So, I have a Location Model that is using the tree behavior. Level 1
is Countries, their children are Regions. The Regions children are
cities... So I need to give some context to the results in the select
menu since there are several cities with the name Portland for
example. Is it Portland, Oregon or Portland, Maine? I know you can
give context to select fields by giving it an array with sub arrays.
As such, this is what I want to get from my database when I ask for
all the cities:

array('Oregon'=array(42='Salem',33='Portland', 50='Ashland'),
'Maine'=array(86='Portland', 103='Agusta'));

I can make that with a bit of post processing after the data is
retrieved from the DB, but is there a way to get that kind of format
straight from the query? Thanks.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Cakephp SSN Encryption

2012-05-02 Thread Steven Scaffidi
Can you give me a specific example of how to use saveMany? I have 4000 
clients in my database. Can I create another encrypted field in the 
database (say ssn_temp) then do something like this:

$this-User-saveMany(array(array('ssn_temp' = array('User' = 'ssn'; 

Would something like that work? I'm really confused by the documentation on 
saveMany

On Tuesday, May 1, 2012 2:51:50 PM UTC-5, Justin Edwards wrote:

 Sorry temp table* not temp folder

 On Tue, May 1, 2012 at 7:51 PM, Justin Edwards 
 justinledwa...@gmail.comwrote:

 Steven,

 Create a controller method.

 Find the data from the temp folder set it to a variable, and then 
 saveMany from the variable to the encrypted table.   


 http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-savemany-array-data-null-array-options-array
  


 On Tue, May 1, 2012 at 7:18 PM, Steven Scaffidi ssca...@gmail.comwrote:

 Ok I have the data migrated already (I probably should have used 
 something like pentaho instead of writing my own queries but oh well). How 
 do I use cake's encryption function on the data?

 On Tuesday, May 1, 2012 2:07:56 PM UTC-5, Justin Edwards wrote:

 I would migrate it using pentaho.  Then you can run cake's encryption 
 function on the data.   You could make a temporary table /model and then 
 append it to the production table.

 On Tue, May 1, 2012 at 7:01 PM, Steven Scaffidi ssca...@gmail.comwrote:

 Thanks for the plugin that worked great. I still don't understand how
 to use pentaho though to encrypt social security numbers listed in the
 access database.

 On Apr 30, 5:28 pm, Justin Edwards justinledwa...@gmail.com wrote:
  #1http://bakery.cakephp.org/**articles/jmillerdesign/2011/**
 12/29/cipher_pl.http://bakery.cakephp.org/articles/jmillerdesign/2011/12/29/cipher_pl.
 ..
  #2http://www.pentaho.com/**download/http://www.pentaho.com/download/
 
 
 
 
 
 
 
  On Mon, Apr 30, 2012 at 4:46 PM, Steven Scaffidi ssca...@gmail.com 
 wrote:
   Hi - I'm looking for information on how to encrypt data in 
 Cakephp. My
   employer had a client management system built in Microsoft Access, 
 and
   I recently took that application and put it on a web-based space 
 built
   in cake. I need to now two things:
 
   #1 How can I encrypt social security numbers from new clients 
 coming
   into the system? I'm encrypting passwords right now, but I'm not 
 sure
   how to do social security numbers.
 
   #2 How do I take social security numbers that are currently listed 
 in
   Microsoft Access with no encryption and put them into the MySQL
   database encrypted?
 
   Thanks for the help,
 
   Steven
 
   --
   Our newest site for the community: CakePHP Video Tutorials
  http://tv.cakephp.org
   Check out the new CakePHP Questions sitehttp://ask.cakephp.organd 
 help
   others with their CakePHP related questions.
 
   To unsubscribe from this group, send email to
   cake-php+unsubscribe@**googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
more options, visit this group
   athttp://groups.google.com/**group/cake-phphttp://groups.google.com/group/cake-php

 --
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and 
 help others with their CakePHP related questions.


 To unsubscribe from this group, send email to
 cake-php+unsubscribe@**googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at 
 http://groups.google.com/**group/cake-phphttp://groups.google.com/group/cake-php


  -- 
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org 
 Check out the new CakePHP Questions site http://ask.cakephp.org and 
 help others with their CakePHP related questions.
  
  
 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





-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: $this-Params['controller'] doesn't work in cakephp component

2012-05-02 Thread euromark
@romel
first error: he wants it in a component - not the view

second issue: the request object should be used for this. not the 
controller itself (that used to be this way in 1.x)
http://book.cakephp.org/2.0/en/controllers/request-response.html#cakerequest
 
(as for right now it still works (readonly) but might be deprecated in 
later versions anyway)

but - concerning the view - why passing it on to the view manually? the 
view also has the request object and therefore this information
and last error: beforeFilter is only triggered on valid request. so it 
might break. always use beforeRender() for passing stuff like that to the 
view
but since its irrelevant to this thread..


Am Mittwoch, 2. Mai 2012 13:44:51 UTC+2 schrieb romel javier gomez herrera:

 hi! 

 if the version of cakephp is 2.1 
  // in /app/Controller/AppController.php 
  public function beforeFilter(){
  $this-set('controller',$this-params['controller']);
 $this-set('action',$this-params['action']); 
   
  }
   // in /app/View/Latyouts/default.ctp 
  echo 'Controller: '.$controller.'Controller.php'.'br /';
  echo 'View: '.$action.'.ctp';



 2012/5/2 Tilen Majerle tilen.maje...@gmail.com

 in your __construct() method for component, first parameter is 
 ComponentCollection $collection object.
 From here you can store controller to component like
 $this-Controller = $collection-getController();

 then params you have in $this-Controller-params
 --
 Lep pozdrav, Tilen Majerle
 http://majerle.eu



 2012/5/2 Cruisine cruisin...@yahoo.co.id

 hi guys...i need to know how to get current controller from cakephp
 component
 i tried to use $this-Params['controller'] on my component but it
 keeping me get error message like this :

 Notice (8): Undefined property: DynRubrikComponent::$params [APP
 \controllers\components\dyn_rubrik.php, line 17]

 do u guys know how to deal with this matter ? need ur help very
 soon...thank u..

 --
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and 
 help others with their CakePHP related questions.


 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


  -- 
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org 
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.
  
  
 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




-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Cakephp SSN Encryption

2012-05-02 Thread Steven Scaffidi
I created SSN through using regular sql and just literally copying whats in 
the ssn field to the ssn_temp field. And then, this would work if it didn't 
time out on me. How can I change the timeout time? There has to be a better 
way to do this though. 

public function encryptssn() {
$ssns = $this-User-find('list', array('fields' = array('id', 
'ssn_temp')));
$j = 1;
foreach ($ssns as $i) {
$this-User-id = $j;
$this-User-saveField('ssn', $i);
$j++;
}
$this-redirect(array('action' = 'index')); 
}

On Wednesday, May 2, 2012 3:03:46 PM UTC-5, Steven Scaffidi wrote:

 Can you give me a specific example of how to use saveMany? I have 4000 
 clients in my database. Can I create another encrypted field in the 
 database (say ssn_temp) then do something like this:

 $this-User-saveMany(array(array('ssn_temp' = array('User' = 'ssn'; 

 Would something like that work? I'm really confused by the documentation 
 on saveMany

 On Tuesday, May 1, 2012 2:51:50 PM UTC-5, Justin Edwards wrote:

 Sorry temp table* not temp folder

 On Tue, May 1, 2012 at 7:51 PM, Justin Edwards 
 justinledwa...@gmail.comwrote:

 Steven,

 Create a controller method.

 Find the data from the temp folder set it to a variable, and then 
 saveMany from the variable to the encrypted table.   


 http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-savemany-array-data-null-array-options-array
  


 On Tue, May 1, 2012 at 7:18 PM, Steven Scaffidi ssca...@gmail.comwrote:

 Ok I have the data migrated already (I probably should have used 
 something like pentaho instead of writing my own queries but oh well). How 
 do I use cake's encryption function on the data?

 On Tuesday, May 1, 2012 2:07:56 PM UTC-5, Justin Edwards wrote:

 I would migrate it using pentaho.  Then you can run cake's encryption 
 function on the data.   You could make a temporary table /model and then 
 append it to the production table.

 On Tue, May 1, 2012 at 7:01 PM, Steven Scaffidi ssca...@gmail.comwrote:

 Thanks for the plugin that worked great. I still don't understand how
 to use pentaho though to encrypt social security numbers listed in the
 access database.

 On Apr 30, 5:28 pm, Justin Edwards justinledwa...@gmail.com wrote:
  #1http://bakery.cakephp.org/**articles/jmillerdesign/2011/**
 12/29/cipher_pl.http://bakery.cakephp.org/articles/jmillerdesign/2011/12/29/cipher_pl.
 ..
  #2http://www.pentaho.com/**download/http://www.pentaho.com/download/
 
 
 
 
 
 
 
  On Mon, Apr 30, 2012 at 4:46 PM, Steven Scaffidi ssca...@gmail.com 
 wrote:
   Hi - I'm looking for information on how to encrypt data in 
 Cakephp. My
   employer had a client management system built in Microsoft 
 Access, and
   I recently took that application and put it on a web-based space 
 built
   in cake. I need to now two things:
 
   #1 How can I encrypt social security numbers from new clients 
 coming
   into the system? I'm encrypting passwords right now, but I'm not 
 sure
   how to do social security numbers.
 
   #2 How do I take social security numbers that are currently 
 listed in
   Microsoft Access with no encryption and put them into the MySQL
   database encrypted?
 
   Thanks for the help,
 
   Steven
 
   --
   Our newest site for the community: CakePHP Video Tutorials
  http://tv.cakephp.org
   Check out the new CakePHP Questions sitehttp://ask.cakephp.organd 
 help
   others with their CakePHP related questions.
 
   To unsubscribe from this group, send email to
   cake-php+unsubscribe@**googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
more options, visit this group
   athttp://groups.google.com/**group/cake-phphttp://groups.google.com/group/cake-php

 --
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and 
 help others with their CakePHP related questions.


 To unsubscribe from this group, send email to
 cake-php+unsubscribe@**googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at 
 http://groups.google.com/**group/cake-phphttp://groups.google.com/group/cake-php


  -- 
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org 
 Check out the new CakePHP Questions site http://ask.cakephp.org and 
 help others with their CakePHP related questions.
  
  
 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




On Wednesday, May 2, 2012 3:03:46 PM UTC-5, Steven Scaffidi wrote:

 Can you give me a specific example of how to use saveMany? I have 4000 
 clients in my database. Can I create another encrypted field in the 
 database (say ssn_temp) then do something like this:

 $this-User-saveMany(array(array('ssn_temp' = array('User' = 'ssn'; 

 Would something like that work? I'm really confused by the documentation 
 on saveMany

 On Tuesday, May 1, 2012 2:51:50 PM UTC-5, 

Re: Cakephp SSN Encryption

2012-05-02 Thread Justin Edwards
You can do it in batches.  You can also set the timeout.
http://php.net/manual/en/function.set-time-limit.php

'conditions' = array('User.id ' = '200')


On Wed, May 2, 2012 at 3:39 PM, Steven Scaffidi ssca...@gmail.com wrote:

 I created SSN through using regular sql and just literally copying whats
 in the ssn field to the ssn_temp field. And then, this would work if it
 didn't time out on me. How can I change the timeout time? There has to be a
 better way to do this though.

 public function encryptssn() {
 $ssns = $this-User-find('list', array('fields' = array('id',
 'ssn_temp')));
  $j = 1;
 foreach ($ssns as $i) {
 $this-User-id = $j;
  $this-User-saveField('ssn', $i);
 $j++;
 }
  $this-redirect(array('action' = 'index'));
 }

 On Wednesday, May 2, 2012 3:03:46 PM UTC-5, Steven Scaffidi wrote:

 Can you give me a specific example of how to use saveMany? I have 4000
 clients in my database. Can I create another encrypted field in the
 database (say ssn_temp) then do something like this:

 $this-User-saveMany(array(**array('ssn_temp' = array('User' =
 'ssn';

 Would something like that work? I'm really confused by the documentation
 on saveMany

 On Tuesday, May 1, 2012 2:51:50 PM UTC-5, Justin Edwards wrote:

 Sorry temp table* not temp folder

 On Tue, May 1, 2012 at 7:51 PM, Justin Edwards justinledwa...@gmail.com
  wrote:

 Steven,

 Create a controller method.

 Find the data from the temp folder set it to a variable, and then
 saveMany from the variable to the encrypted table.

 http://book.cakephp.org/2.0/**en/models/saving-your-data.**
 html#model-savemany-array-**data-null-array-options-arrayhttp://book.cakephp.org/2.0/en/models/saving-your-data.html#model-savemany-array-data-null-array-options-array



 On Tue, May 1, 2012 at 7:18 PM, Steven Scaffidi ssca...@gmail.comwrote:

 Ok I have the data migrated already (I probably should have used
 something like pentaho instead of writing my own queries but oh well). How
 do I use cake's encryption function on the data?

 On Tuesday, May 1, 2012 2:07:56 PM UTC-5, Justin Edwards wrote:

 I would migrate it using pentaho.  Then you can run cake's encryption
 function on the data.   You could make a temporary table /model and then
 append it to the production table.

 On Tue, May 1, 2012 at 7:01 PM, Steven Scaffidi ssca...@gmail.comwrote:

 Thanks for the plugin that worked great. I still don't understand how
 to use pentaho though to encrypt social security numbers listed in
 the
 access database.

 On Apr 30, 5:28 pm, Justin Edwards justinledwa...@gmail.com wrote:
  #1http://bakery.cakephp.org/**ar**ticles/jmillerdesign/2011/**12/*
 *29/cipher_pl.http://bakery.cakephp.org/articles/jmillerdesign/2011/12/29/cipher_pl.
 ..
  #2http://www.pentaho.com/**downl**oad/http://www.pentaho.com/download/
 
 
 
 
 
 
 
  On Mon, Apr 30, 2012 at 4:46 PM, Steven Scaffidi 
 ssca...@gmail.com wrote:
   Hi - I'm looking for information on how to encrypt data in
 Cakephp. My
   employer had a client management system built in Microsoft
 Access, and
   I recently took that application and put it on a web-based space
 built
   in cake. I need to now two things:
 
   #1 How can I encrypt social security numbers from new clients
 coming
   into the system? I'm encrypting passwords right now, but I'm not
 sure
   how to do social security numbers.
 
   #2 How do I take social security numbers that are currently
 listed in
   Microsoft Access with no encryption and put them into the MySQL
   database encrypted?
 
   Thanks for the help,
 
   Steven
 
   --
   Our newest site for the community: CakePHP Video Tutorials
  http://tv.cakephp.org
   Check out the new CakePHP Questions
 sitehttp://ask.cakephp.organd help
   others with their CakePHP related questions.
 
   To unsubscribe from this group, send email to
   cake-php+unsubscribe@**googlegro**ups.comcake-php%2bunsubscr...@googlegroups.comFor
more options, visit this group
   athttp://groups.google.com/**gro**up/cake-phphttp://groups.google.com/group/cake-php

 --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and
 help others with their CakePHP related questions.


 To unsubscribe from this group, send email to
 cake-php+unsubscribe@**googlegro**ups.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/**group**/cake-phphttp://groups.google.com/group/cake-php


  --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and
 help others with their CakePHP related questions.


 To unsubscribe from this group, send email to
 cake-php+unsubscribe@**googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/**group/cake-phphttp://groups.google.com/group/cake-php




 On Wednesday, May 2, 2012 3:03:46 PM UTC-5, 

Pass data between models during same request

2012-05-02 Thread esdev
I'm new to CakePHP and still unfamiliar with the API. So, please bear
with me here.

I have 5 models - 2 for an external data store, 2 for a local data
store, and 1 for the controller. I have one controller that's
directing all the activity. In the controller, I fetch the remote data
and pass control to the model. I have functions in my controller model
that perform all the data manipulation. Once complete, it sends the
data back to the controller. Now comes the tricky part for me. I'll
tell you how I want the app to behave functionally, maybe I can get
help in creating the solution to implement it.

I want the data that was passed out of the Invoice model to be saved
to the local data store. The data came from the remote source
identified in the models, InvoiceHeader and InvoiceDetail. The model,
Invoice, contains the data transformation methods. Once modified, the
data is passed back to the InvoicesController. All that work is
complete. My data array is ready to be saved locally.

But how do I accomplish this? ExternalHeader and ExternalDetail model
the local data store. How do I move the data from the Invoice models
to the External models so that it can be saved? Here's my broken
function:

protected function _saveLocal($_mergedData) {

if (!isset($this-ExternalHeader)) {
$this-loadModel('ExternalHeader');
if (!isset($this-ExternalDetail)) {
$this-loadModel('ExternalDetail');
}
}

//This part is broken.
$data = array($this-ExternalHeader = $_mergedData);
pr($data); die;
$this-ExternalHeader-create();
$this-ExternalHeader-saveAll($data);
//debug($this-ExternalHeader-validationErrors);
}

Please feel free to ask questions if something is unclear. I'm also
open to rethinking my workflow if what I'm doing is un-Cake-like or
overly complex.

Any help is appreciated.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Problem with JsHelper

2012-05-02 Thread Charles Blackwell
You need to switch these two around:
?php 
class Controller extends AppController { 
}  



On Wednesday, February 15, 2012 7:47:50 AM UTC-5, Diablo Sinfuego wrote:

 I have a problem with Js that I cannot resolve. I am basically trying 
 to write a Hello, world app to learn how to use this feature. 

 When I click on my submit button the first time, everything works. 
 When I click on the same button the second time, it blows up trying to 
 go to what appears to be a null controller: 

 Missing Controller 
 Error: Controller could not be found. 
 Error: Create the class Controller below in file: app/Controller/ 
 Controller.php 
 ?php 
 class Controller extends AppController { 
 } 

 Here is my Controller: 

 public function check($id = false) { 
 if (!empty($this-request-data)) { 
 if ($this-RequestHandler-isAjax()) { 
 $this-set('result', 'Hello, world'); 
 $this-render('result', 'ajax'); 
 } 
 } 
 } 

 Here is my View: 

 ?php echo $this-Html-script('jquery', array('inline' = false)); ? 
 ?php 
 echo $this-Form-create(); 
 echo $this-Js-submit('Check', array('update' = 
 '#success')); 
 echo $this-Form-end(); 
 ? 
 div id=success/div 
 div id=checking style=display: none;Checking.../div 
 ?php echo $this-Js-writeBuffer(); ? 

 JsHelper is generating the following JavaScript: 

 script type=text/javascript 
 //![CDATA[ 
 $(#submit-549405557).bind(click, function (event) {$.ajax({data:$ 
 (#submit-549405557).closest(form).serialize(), dataType:html, 
 success:function (data, textStatus) {$(#success).html(data);}, 
 type:post, url:\/hosts\/check}); 
 return false;}); 
 //]] 
 /script 

 I'm stumped why it works on the first click but not the second. 



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Fatal Error: Class 'String' not found in Model

2012-05-02 Thread Conor Manning
I have a web application that has been working fine until recently when I 
switched operating systems. I migrated from Ubuntu to Arch Linux, backing 
up my application online. In the process I lost some directories and my web 
application no longer worked.

To solve this, I downloaded CakePHP again, copied the Controllers, Models 
and Views from my old project into my new copy of Cake, and modified my 
config to reflect my database.

I'm using Cake's AuthComponent and I'm getting this strange error message:

 Fatal error: Class 'String' not found in /srv/http/bfm/app/Model/User.php on 
 line 39


I didn't know what to make of the line number because line 39 is the last 
line in the file. I'm not particularly experienced with PHP outside of Cake 
so perhaps somebody else will be able to tell me what that might mean.

Each User has many Podcasts, and each Podcast belongs to a User. It was in 
accessing any page which used find to retrieve Podcasts and associated User 
objects that the error occurred.

Stranger still, actions managed by the UsersController worked fine. I was 
able to access my user login page with no problems, and I was redirected to 
login when I tried to create a new user, which is consistent with my Auth 
settings.

In any case, I decided to track down the cause of this error. I commented 
out my validation code and my beforeSave method, which used 
AuthComponent::password to hash and salt my users' passwords. Once I did 
this, the error vanished. With some further clumsy debugging through 
commenting, I figured out that it was specifically the beforeSave method 
that was causing problems. 
I tried following the trail of functions called from beforeSave, through 
AuthComponent and Security. Both of those files had App::uses('String', 
'Utility') in them. What's more, I tried adding that line to User.php, and 
it didn't help solve the problem either.
My beforeSave method looks like this:

public beforeSave() {
if (isset($this-data[$this-alias]['password']) {
$password = $this-data[$this-alias]['password'];
$this-data[$this-alias]['password'] = AuthComponent::password($password);
}
return true;
}

When I replaced AuthComponent::password($password) with $password, the 
error was still there, which confused me, because I was sure String was 
needed for AuthComponent::password (via Security), and that was what was 
causing the trouble.

Maybe this was too long, but I wanted to give all the information I had, 
because I am well and truly stuck. I have no idea what's happening inside 
my code.
I can provide more information or code if it's useful. I just don't know 
where to begin.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: JsHelper CakePHP 2.1

2012-05-02 Thread Jackson Bicalho

I can turn around and with this:
http://www.cakephp.4uk.pl/




Em 03-05-2012 02:11, Charles Blackwell escreveu:
Are there any tutorials available for the JsHelper for CakePHP 2.1 
yet? --
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and 
help others with their CakePHP related questions.



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



--
Jackson Bicalho
jacksonbica...@gmail.com
jacksonbicalho.com.br
..

Luango - Sistemas e serviços para Internet
www.luango.com.br

Precisando de ajuda?
Acesse:
suporte.luango.com.br

Acompanhe nosso Blog:
blog.luango.com.br

..
cont...@luango.com.br

Horário de atendimento:
 - De segunda a sexta:
 - - das 8:00 as 12:00
 - - das 13:30 as 18:00



--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.



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