IE6 and IE7 losing sessions - can't log in - solved

2013-08-15 Thread Jeremy Burns
I'm posting this as I had a problem that was driving me nuts. I know IE7 is 
ancient, so there are some posts on this subject from 2008/9, but none 
solved it for me. I have a global banking client trying my software and 
their standard browser is IE6. That is not at all uncommon in large 
corporates; upgrading a browser version is a big task and when you have 
hundreds or thousands of web apps that 'work' in IE6 retesting them is a 
major project. Microsoft even have a special IE6 support arrangement with 
them.

IE6 was proving a step too far for anything approaching a modern web site 
(that - as you'd expect - works perfectly in modern browsers) so they have 
agreed to limit it to users with IE7, which had some residual problems that 
also occurred in IE6.

Anyhow, that's the background, here's the problem and the solution. I just 
hope it helps at least one other person with this issue.

I'm using CakePHP version 2.3.9, but I suspect this would work in previous 
2.x versions too.

*The problem*

Users can log in with any browser but not IE6/7. Even if the right 
credentials work (and you know by using debug statements that the user is 
being logged in) they are constantly returned to the login screen as not 
logged in. Tracking it back, it's all good until the user is redirected, 
when for some reason the session fails, losing the logged in state. For the 
record, I am using database sessions - not sure how relevant this is to 
other session variants.

*The solution*

Add these lines to core.php:

Configure::write(
'Session',
array(
'defaults' => 'database',
'cookie' => '[something]',
'cookieTimeout' => 0,
'checkAgent' => false,
'ini' => array (
'session.cookie_secure' => false,
'session.referer_check' => false
)
)
);

Note that you need to add something relevant as the cookie name. I'd 
recommend avoiding underscores and special characters as there are other IE 
issues related to domain names that contain underscores and - even if they 
have nothing to do with this issues - I prefer to avoid them.

You cannot imagine my joy when I was able to log in after applying this fix.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


bootstrap twitter typeahead , dont work for me in cakephp

2013-08-15 Thread Renato Bigliazzi
Hi , I can not do the twitter bootstrap component typeahead work with cake. 
i use https://github.com/rudylee/cbunny , but dont work form me.


In my view

JS


 $(document).ready(function(){ 
$('#itemdesc').typeahead({
source: function (query, process) {
  return $.ajax({
url:''Invoices','action'=>'localizaprodutos'));?>',
type: 'get',
data: {q: query},
dataType: 'json',
success: function (json) {
  return process(json);
}
  });
}
  });
});


HTML



and controller

public function localizaprodutos(){
 $this->autoRender = false;
$this->RequestHandler->respondAs('json');

// get the search term from URL
$term = $this->request->query['q'];
$users = 
$this->Invoice->Invoicedetail->Inventoryitem->find('all',array(
'conditions' => array(
'Inventoryitem.desc LIKE' => '%'.$term.'%'
)
));

// Format the result for select2
$result = array();
foreach($produtos as $key => $produto) {
array_push($result, $produto['Inventoryitem']['desc']);
}
$produtos = $result;

echo json_encode($produtos);
}


Thanks

Renato




-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Character on code , very weird.

2013-08-15 Thread Renato Bigliazzi
Thanks , Rodrigo

I will review, thank you for now

Regards

Renato 

Em terça-feira, 13 de agosto de 2013 08h54min03s UTC-3, Renato Bigliazzi 
escreveu:
>
> Good morning, appeared on my screen, a character who can not make out, 
> already tried everything, but he insisted, the problem is that the 
> variables hinders the ajax callback. I managed to get the characteristics 
> of this character, as in the photo.
>
> I thank
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Cake 1.3: Using translate behaviour and find('list') returns wrong name

2013-08-15 Thread Christian
Hi,

I am using the translate behaviour in my models and so far it worked well. 
However, one issue I can't get fixed and I am not sure if this is me or 
cake. If I use a find('all') on my model everything works fine - however, 
if I use a find('list'), the result is [id]=>id (e.g. [22]=>22. Everything 
worked fine (and as expected) before I implemented the translate behaviour.

I did two debugs right after each other to show what I mean:


$categories=$this->Category->find('list', 
array(
 'conditions' => array(
 'Category.parent_id' => $id,
'Category.active' => 1
 )
)
); 
debug($categories);


returns

Array
(
[22] => 22
)

  
while the same query with 'all'
  

$categories=$this->Category->find('all', 
array(
 'conditions' => array(
 'Category.parent_id' => $id,
'Category.active' => 1
 )
)
);   


returns:

customerweb_test/controllers/categories_controller.php (line 160) 
Array
(
[0] => Array
(
[Category] => Array
(
[id] => 22
[parent_id] => 1
[active] => 1
[created] => 2011-11-03 21:31:16
[modified] => 2013-08-15 00:23:48
[locale] => eng
[name] => Dummies with Engraving
[description] => 
[detailed_description] => 
)

)
)


Any ideas how to fix this?

Thanks a lot,
Christian

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Simple controller action takes over 13 seconds

2013-08-15 Thread Xtagon
I cloned the DB locally for development and the slow speeds completely went 
away. I guess there was a lot of overhead connecting to the remote DB other 
than the query, because the query itself was really fast. I'm not sure I 
understand what went on there, but I'm good to go now. Thanks for your 
assistance.

On Tuesday, August 13, 2013 3:44:45 PM UTC-7, Xtagon wrote:
>
> Versions: CakePHP 2.3.9 running on Apache 2.2 with PHP 5.4 on Windows.
>
> I created a new CakePHP app and made a basic controller, model, and view. 
> The page takes over 13 seconds to load, even for fast database queries. 
> DebugKit timer shows that all that time is being spent in "Controller 
> action", and the sql log says the total time for all queries is only 248ms 
> (that's a remote DB, so that's an acceptable delay for now)
>
> The default landing page for CakePHP shows all green, database works, tmp 
> is writable, etc.
>
> So the bottleneck is not the database, it's the controller. The controller 
> literally only consists of one find method, and it makes no difference how 
> many records I'm loading. After the 13 seconds, the page displays correctly.
>
> What's the best way to debug this? I appreciate your assistance, as I am 
> at wits end.
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


loginError Element

2013-08-15 Thread Eric Haskins
Afternoon all,

 I am having an issue with the Auth Component.  I set  'flash' => 
array('key'=>'auth','element'=>'alerts/error'),  in my Auth config in 
appcontroller.  Permission errors work fine but invalid login is still 
using default element. Am I missing something somewhere?

'Auth' => array(
'authorize' => array('Tiny'),
'authenticate' => array(
'all' => array('userModel' => 'Account'),
'Form' => array(
'fields' => array('username' => 'email', 'password' => 
'password'),
'scope' => array(
'Account.is_active' => 'yes'
),
'recursive' => 1,
)),
'flash' => array('key'=>'auth','element'=>'alerts/error'),
'loginRedirect' => array('controller' => 'home', 'action' => 
'index'),
'logoutRedirect' => array('controller' => 'account', 'action' 
=> 'login'),
'loginAction' => '/login',
)

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: consoleShell & Sanitize class

2013-08-15 Thread malducin
I did panic a little when I saw that Sanitize was being deprecated. I use 
it in all my models before save to clean inputs of non-HTML data. I even 
extended the Sanitize class to use htmlspecialchars instead of htmlentities 
(have to preserve accented characters, etc.).

Anyway I prefer to sanitize input before being saved as opposed to just 
using h() on output. For non HTML fields I think a viable alternative is to 
use the filter functions in PHP, for example:

http://php.net/manual/en/function.filter-var.php

For HTML input I use the HTML Purifier library as a vendor package and use 
a component to clean the input before saving in the controller. Just 
updated the Brita component that was posted long time ago in the Bakery:

http://bakery.cakephp.org/articles/debuggeddesigns/2008/11/04/brita-component-with-html-purifier

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Extend a core behavoir

2013-08-15 Thread Rodrigo Mourão
I already didi this with tree behavior like Andre recommended.

models/behaviors/tree_plus.php

> With App::import()...
>
> Them you can extend it:
> class MyTreeBehavior extends TreeBehavior...
>
> Em quarta-feira, 14 de agosto de 2013 10h05min03s UTC-3, Mohammad Naghavi 
> escreveu:
>>
>> Hi All,
>> I want to extend the core TreeBehavior without replacing it or copying it 
>> to my own behavior folder, I just want to extend it to add some additional 
>> functionalists which are based on tree behavior.
>> is there a way to do it?
>>
>> regards,
>> Mohammad
>>  
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Character on code , very weird.

2013-08-15 Thread Rodrigo Mourão
This kind of thing make we loose so many time to find, and normally is a
stupid thing to fix.

Did you check the encoding in models and controllers too?
If all encoding is ok without bom.

You should try to use an empty layout, so check if the string appear.
If you see it, so probably the problem is in controller or model.
If not appear the problem is in views. You should be going to eliminate the
possibilities.



Regards




** **

*Rodrigo Mourão*

*Webjump internet & social media*

rodr...@webjump.com.br • www.webjump.com.br

Rua Prof. Artur Ramos, 241 • conj. 52 • SP

Fone (11) 2338.6889



2013/8/15 Renato Bigliazzi 

> Hi , rodrigo , thanks
>
> I check the files , all are whit UT8 .
>
> I put the code in notepad++ , and convert to ansi , look below.
>
> *f?  *
>
> i cant find where come from that.
>
> Thanks
>
> Renato
>
>
>
> Em terça-feira, 13 de agosto de 2013 08h54min03s UTC-3, Renato Bigliazzi
> escreveu:
>>
>> Good morning, appeared on my screen, a character who can not make out,
>> already tried everything, but he insisted, the problem is that the
>> variables hinders the ajax callback. I managed to get the characteristics
>> of this character, as in the photo.
>>
>> I thank
>>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "CakePHP" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/cake-php/eVMfrOpGQEE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
<>

Re: Character on code , very weird.

2013-08-15 Thread Renato Bigliazzi
Hi , rodrigo , thanks

I check the files , all are whit UT8 .

I put the code in notepad++ , and convert to ansi , look below.

*f?  *

i cant find where come from that.

Thanks

Renato



Em terça-feira, 13 de agosto de 2013 08h54min03s UTC-3, Renato Bigliazzi 
escreveu:
>
> Good morning, appeared on my screen, a character who can not make out, 
> already tried everything, but he insisted, the problem is that the 
> variables hinders the ajax callback. I managed to get the characteristics 
> of this character, as in the photo.
>
> I thank
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.