Re: strange othAuth problem
?! Paste something to reproduce that please ( in the bin ) just give a link here --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
requestAction crashes Apache
I've managed to get a requestAction call to crash Apache, which is interesting because it is not often a piece of code crashes a web server. The function that is calling it is in the AppController, and below is the function's code: function memberLoggedIn() { if ($this-Session-check('memberLoggedIn')) { $member_session = $this-Session-read('memberLoggedIn'); if($member = $this-requestAction('/members/getMember/'.$member_session['id'])) { $this-set('member', $member); } else $this-Session-delete('memberLoggedIn'); } } This function is called on every page using the beforeFilter. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Theme woes due to HTML and Javascript helpers
Have just started playing around with Theming my application with the help of ThemeView class from http://cakeforge.org/snippet/detail.php?type=snippetid=18 While the theme view class works as expected the HTML helper starts becoming rather unhelpful - this is because of how the $themeWeb is used in methods like css, and image For example after theming $html-css('light','stylesheet',title='light') outputs the CSS path as /cheesecake/css/Classic/light.css same is true for $javascript-link('styleswitcher.js') which outputs the path as /cheesecake/js/Classic/styleswitcher.js This means that I am required to have a folder by the name of my theme in almost every folder of the webroot. A more convinient thing would be if the $html-css('light','stylesheet',title='light') would output the path as /cheesecake/Classic/css/light.css implying that there is only one additional folder per theme in the webroot! This in turn means the distributing themes for an application becomes much easier. Am I making sense enough to put this in Trac? Cheers .. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
RE: requestAction crashes Apache
From: cake-php@googlegroups.com function memberLoggedIn() { if ($this-Session-check('memberLoggedIn')) { $member_session = $this-Session-read('memberLoggedIn'); if($member = $this-requestAction('/members/getMember/'.$member_session['id'])) { $this-set('member', $member); } else $this-Session-delete('memberLoggedIn'); } } This function is called on every page using the beforeFilter. I suspect that requestAction is the source of your problems, then, since beforeFilter will also be called on requestAction The simple way around this would be to check if the action on members_controller is getMember, and if so exiting beforeFilter -- Regards, Ryan Ginstrom --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Implemented OthAuth
Sorry for you all trying to implement othAuth and having a tough time! I'm working on a new version with more features: teaser, Persistent Remember me login, other modes ( user has many groups, ACL ), ajax safe... also looking forward to get ride of beforeFilter. cake 1.2 will have component callbacks so othAuth might use those.. I'll be doing a step by step tutorial, and will post the beta version for you guys to test when it's finished.. Thanks guys. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Implemented OthAuth
Hi CraZyLegGs Thanks for othAuth. I am pretty happy with the results of the current version. It does the job for me :-) ACL support would be awesome if you can get that in for the next version. I think that the greatest weakness of the current release is documentation. Step by step tutorial/s would be great for the next release :-) Looking forward to seeing the results, and am happy to beta test if you need it. Regards, Langdon CraZyLeGs wrote: Sorry for you all trying to implement othAuth and having a tough time! I'm working on a new version with more features: teaser, Persistent Remember me login, other modes ( user has many groups, ACL ), ajax safe... also looking forward to get ride of beforeFilter. cake 1.2 will have component callbacks so othAuth might use those.. I'll be doing a step by step tutorial, and will post the beta version for you guys to test when it's finished.. Thanks guys. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
refresh a div
hi everybody, somebody ask me to make a tutorial on cakephp for some students. so i decide to make this students happy and give them a chat. i create a view add_mesg and a another called view_mesg. All works fine but now i want to use ajax. i've put two div called add_mesg_div and view_mesg_div in the index view. i've put the $this-render('the view', 'ajax'); in the function of the controller. now i can submit the form and i create a button that can refresh the view_mesg_div.. but how can i make this div refresh automaticaly? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Strange session problems ;-(
I have controller: in this case does not work, Session variable is empty (N, flavicon...) function view($id) { $data = $this-Ga-read(); $this-set('data', $data); $this-Session-write('modelid',$data['Ga']['name']); } but if I make code like this: function view($id) { $data = $this-Ga-read(); $this-set('data', $data); $ee = intval($id); if ($ee) $this-Session-write('modelid',$data['Ga']['name']); } All work normal. Where I made mistake? (Cake version - last 19 june, $id - equal for both case). Don't understand ;-(( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: refresh a div
bracchetto ha scritto: now i can submit the form and i create a button that can refresh the view_mesg_div.. but how can i make this div refresh automaticaly? take a look to this function: AjaxHelper::remoteTimer --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: refresh a div
yes.. thanks, now it works --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Implemented OthAuth
Hi crazylegs, you don't have to worry, I think it's kinda normal at this step to have some little glitches. >From what I saw from the code, othAuth is cool piece of software. >From month to month I see the cake members and the cake-based code making giant steps, so I'm confident we will resolve such minor things pretty quick. Thanks for your code olivvv Langdon Stevenson wrote: Hi CraZyLegGs Thanks for othAuth. I am pretty happy with the results of the current version. It does the job for me :-) ACL support would be awesome if you can get that in for the next version. I think that the greatest weakness of the current release is documentation. Step by step tutorial/s would be great for the next release :-) Looking forward to seeing the results, and am happy to beta test if you need it. Regards, Langdon CraZyLeGs wrote: Sorry for you all trying to implement othAuth and having a tough time! I'm working on a new version with more features: teaser, Persistent Remember me login, other modes ( user has many groups, ACL ), ajax safe... also looking forward to get ride of beforeFilter. cake 1.2 will have component callbacks so othAuth might use those.. I'll be doing a step by step tutorial, and will post the beta version for you guys to test when it's finished.. Thanks guys. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Controller argument causing update instead of insert
I'm having some trouble inserting new items into the database as the argument of a controller is causing it to update instead of insert. The URL is /forums/new_topic/3 where the argument 3 refers to the id of forum the topic will belong to. The first time I insert a new topic with that URL it creates a new topic with the id of 3. However the next time I try adding a topic to that forum using the aforementioned URL it will just update the last post. At no point am I assigning the id number of the topic, so I am not sure how it comes to inherent the id number of the controller argument. I've noticed in the SQL logs that cake is checking if a topic with the value of the argument exists - eg SELECT COUNT(*) AS count FROM `posts` WHERE (`id` = 3) - and if so it is doing the updates. My problem seems similar to this one: http://groups.google.com/group/cake-php/browse_thread/thread/b4eeaf674bad91ad/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: strange othAuth problem
//Set restrictions as below Note dont use preceeding or leading slashes var $othAuthRestrictions =array( 'add', 'edit', 'delete' ); function beforeFilter() { parent::beforeFilter(); } function delete($id) { $this-Article-del($id); //$this-flash('Article deleted.', $this-viewPath.'/articles/index'); $this-redirect('/articles/index'); } permissions are controller/delete controller/add controller/edit add and edit work perfect but delete altho restricted can be called by anyone as you can see from the above code i have tested it with a flash but its still being deleted, before the redirect to the login ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Controller argument causing update instead of insert
first paste your code --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Controller argument causing update instead of insert
Here is my code, I should mention when inserting both the Topic and the Post the problem occurs. function new_topic($forum_id) { $this-set('forum_id', $forum_id); if(empty($this-data)) { $this-set('newtopic', null); } else { $topic_valid = $this-Topic-validates($this-data); $post_valid = $this-Post-validates($this-data); if($topic_valid AND $post_valid) { $this-data['Post']['topic_id'] = 0; // set to zero for time being if($this-Post-save($this-data)) { $post_id = $this-Post-getInsertID(); $this-data['Topic']['first_post_id'] = $post_id; $this-data['Topic']['forum_id'] = $forum_id; if($this-Topic-save($this-data)) { $topic_id = $this-Topic-getInsertID(); $post = $this-Post-findById($post_id); $post['Post']['topic_id'] = $topic_id; $this-Post-save($post); } } } else { $this-validateErrors($this-Topic); $this-validateErrors($this-Post); $this-set('newtopic', $this-data); $this-render(); } } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
My option to secure sql: SafeSQL
Hi guys There is a class created by Monte Ohrt (Smarty Project) how can parse metachars inside a sql string. http://www.phpinsider.com/php/code/SafeSQL/ I been using it from some time now and i think that cake should implement something like that in the models. It work like this: require 'SafeSQL.class.php'; // dummy up a variable with a single quote in it $section_name = fred's place; // run the query through SafeSQL $safesql = new SafeSQL_MySQL; $query_string = $safesql-query(select * from sections where Section_Name = '%s', array($section_name)); echo $query_string; OUTPUT: select * from sections where Section_Name = 'fred\'s place' // $query_string is now safe to pass to your SQL library I manage to hack a method inside the AppModel. Goes like this: vendor('spine'.DS.'DB'.DS.'SafeSQL'); class AppModel extends Model { var $sq = null; function __construct ($id=false, $table=null, $ds=null) { $this-sq = new SafeSQL_MySQL(); parent::__construct($id, $table, $ds); } function safeQuery($sql, $args = array()) { return $this-query($this-sq-query($sql, $args)); } } .. And then $data = array(fred's place); $this-Post-safeQuery('UPDATE FROM post SET title = %s WHERE id = 3', $data); I think it will be great to do something like... $this-Post-findAll('title = %s', $data); ... or applying into $this-Model-save() method or in an array inside the models like $this-Model-validate. I just think that is cleaner than sanitize. Maybe internally it will call sanitize. Will be great. What do you think? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: My option to secure sql: SafeSQL
Cake already implements query escaping at mulitple levels. While it allows you to do custom queries, this method is not recommended. One of the main reasons for implementing an ActiveRecord-like model architecture is to eliminate the need to write SQL manually, and as such, methods like the above will never be natively supported. However, there are plans to use Cake's built-in query generating and escaping facilities to enable conditions-based, multi-record updates and deletes, which would effectively accomplish the same thing as the UPDATE query above. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: strange othAuth problem
http://cakephp.org/pastes/show/e6bed617b04b2021f2d907dce2f87eaa --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: How do you set home page title?
In the view using $this-here will give you the complete current page, using $base will give you cake/app/views --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Theme woes due to HTML and Javascript helpers
For now I have solved the problem by making copies of the html and javscript helper and changing them to do what I wanted - however this is *not* a prefered approach and I would still prefer that $themeWeb was used the way suggest in the previous post. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Controller argument causing update instead of insert
I've found a work around by changing the arguments and URL to work like this: /forums/new_topic/?forum=1 In doing this I've noticed that the controller arguments definitely influence model save calls as now I am seeing this SQL query: SELECT COUNT(*) AS count FROM `posts` WHERE (`id` = 'forum=1') Is there any way to turn off this behaviour? Surely the controller shouldn't these make assumptions about the arguments. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Validating against non-model data
Now I'm just starting to use cakePHP, so take this with caution: --- Solution 1) You have to put ALL your invalidate statements (and thus of course the checks you make) into a function beforevalidate (check the correct syntax). This is running - as the name says - before validate() runs - and it is in validate where the invalidation you set is considered and applied. Having your invalidate in your standard action (in register())is too late, validate did run already. Solution 2) If you invalidate in your regular action (register()), you can do this: a) invalidate your field $this-User-invalidate('confirmemail'); b) call validate() to check validation if($this-User-validates( $this-data )) then follow with your if and your else code accordingly --- I'm using solution 2 with good success, works fine. (Any hints if this can be done better are always welcome) Again, I'm just beginning, so check this before taking action on it, I might be wrong here. HTH, Attila --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---