Re: Export to Excel

2009-08-23 Thread delocalizer

Adam Royle's csv helper is very nice for this...
http://bakery.cakephp.org/articles/view/csv-helper-php5

cheers,
Conrad.

On Aug 23, 12:41 am, AMF afuhrm...@gmail.com wrote:
 I've been looking for a good tutorial/exaple on exporting data to
 excel like format.

 Any success/ideas/pinters.

 Thanks

 AMF
--~--~-~--~~~---~--~~
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: Validation alphaNumeric issue.

2009-08-23 Thread delocalizer

It's nothing to do with php version - the problem is CentOS (or RHEL)
- cake's built-in 'alphaNumeric' rule uses unicode matching in its
regex, which is not supported by the PCRE library that comes with
those flavours of Linux. If you know what you're doing you could try
to compile the library with unicode support, but probably the easiest
solution is write your own custom validation rule - just copy what is
in the cake core  replace the unicode stuff (in the curly braces)
with plain old ASCII regex

cheers,
Conrad.

On Aug 23, 1:09 pm, Howard  Lince hli...@gmail.com wrote:
 I am having a problem with alphaNumeric validation on my application,
 we redid the server (changed the os from opensuse to centos), and
 while alphaNumeric validation worked before, it constantly returns
 false now. I was told earlier it's the php 5.1.x so I upgraded to
 5.2.6, which was said to resolve this issue and it's still doing it,
 what can I do about this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Set containable vars in beforeFind() callback of model

2009-08-23 Thread Dr. Loboto

Is ClientUser model always associated? As I know, Containable demand
association for models in contain.

On Aug 21, 3:51 pm, Adrian gond...@gmail.com wrote:
 Btw when I add debug($queryData); it confirms the contain array is
 present:

 app\models\ticket.php (line 175)

 Array
 (
     [conditions] = Array
         (
             [Ticket.ticket_status] = New
         )

     [fields] = Array
         (
             [0] = Ticket.ticket_id
         )

     [joins] = Array
         (
         )

     [limit] = 51
     [offset] =
     [order] = Array
         (
             [0] =
         )

     [page] = 1
     [group] =
     [callbacks] = 1
     [contain] = Array
         (
             [ClientUser] = Array
                 (
                     [fields] = Array
                         (
                             [0] = ClientUser.user_group_id
                         )

                 )

         )

 )

 But it is not taking effect in the sql:

 Warning (512): SQL Error: 1054: Unknown column
 'ClientUser.user_group_id' in 'where clause' [CORE\cake\libs\model
 \datasources\dbo_source.php, line 525]

 Query: SELECT `Ticket`.`ticket_id` FROM `tickets` AS `Ticket` WHERE
 `Ticket`.`ticket_status` = 'New' AND
 `Ticket`.`ticket_support_group_id` = 2 AND `Ticket`.`ticket_status` !=
 'Deleted' AND ((`Ticket`.`ticket_client_group_id` = 84) AND
 (`ClientUser`.`user_group_id` = 204) AND (((`Ticket`.`ticket_openedby`
 = 1024) OR (`Ticket`.`ticket_client_user_id` = 1024 LIMIT 51

 On 21 Aug, 09:24, Adrian gond...@gmail.com wrote:



  Hi

  I am trying to set my contain array from within the models beforeFind
  () callback so a certain model is always contained. I have the
  following code:

          function beforeFind($queryData) {
                  // Always contain the client user
                  if(empty($queryData['contain']['ClientUser'])) {
                          $queryData['contain']['ClientUser']['fields'] = 
  array
  ('ClientUser.user_group_id');
                  }
                  return $queryData;
          }

  should this not work?

  At the moment the find operations just ignore this.

  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: How do I merge 2 tables

2009-08-23 Thread Farjad Habib
http://book.cakephp.org/view/78/Associations-Linking-Models-Together

go through this and u ll get an idea

On Sun, Aug 23, 2009 at 5:55 PM, simplesi siwalt...@hotmail.com wrote:



 I'm re-coding a simple helpdesk application and I'd like to merge 2 tables
 into one.
 I could probably do this using a raw MySQL query but I'd like to know if it
 is possible to do it using a one-time controller/view action.

 My main table is Issues and my associated table is Changes where each issue
 has many changes.
 I'd like to loop through each Issue and find all assoicated Change.details
 and put them into one Issue.alldetails field.

 Any ideas please?

 regards

 Simon



 --
 View this message in context:
 http://www.nabble.com/How-do-I-merge-2-tables-tp25103063p25103063.html
 Sent from the CakePHP mailing list archive at Nabble.com.


 



-- 
Farjad Habib
BS 2011
LUMS

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



Request help with a model definition.

2009-08-23 Thread gedm

Hi,

I am very new to Cake and have searched for an answer to this but
can't quite get my head around it enough to ask ask the right
question.  I'm hoping someone here can point me in the right
direction.

I have 2 tables, Users and Comments.  Each User has many comments.  I
have defined the Comments table as follows:
FieldType
id   int(11)  auto_increment
titlevarchar(150)
comment  text
user_id  int(11)
comment_id   int(11)

The comment_id refers back to the id field in the same table to track
the parent comment vs the child comment.  The problem is when I
retrieve
the data the user_id and user table aren't joined for the
childcomments.


An example of the data for a
parent comment might be:
id:   1
Title:  This is a parent Comment Title
comment:  This is the first comment.  The Parent.
user_id:  1
comment_id:

The Child comment of this might be:
id:   2
Title:
comment:  This is the child comment to comment number 1
user_id:  121
comment_id:  1

The comment_id is 1 to indicate this comment belongs to the parent
comment with ID = 1

My user.php model is:
class User extends AppModel {
var $name = 'User';

var $hasMany = array(
'Comment' = array(
'className' = 'Comment',
'foreignKey' = 'user_id',
'dependent' = false
)
);
}

My comment.php model is:
class Comment extends AppModel {
var $name = 'Comment';
var $belongsTo = array(
'User' = array(
'className' = 'User',
'foreignKey' = 'user_id'
),
'ParentComment' = array(
'className' = 'Comment',
'foreignKey' = 'comment_id'
),
);


var $hasMany = array(
 'ChildComment' = array(
 'className' = 'Comment',
 'foreignKey' = 'comment_id'
)
);
}


The comments controller view action is as follows:
function view($id = null) {
if (!$id) {
$this-Session-setFlash(__('Invalid Comment.', true));
$this-redirect(array('action'='index'));
}
$this-set('comment', $this-Comment-read(null, $id));
}



The debug($comment) results in the following:
Array
(
[Comment] = Array
(
[id] = 1
[title] = New Comments Site
[comment] = Hi all,
I am working on a new comments site.  Please be patient while I get
everything working properly.
Thanks
[user_id] = 1
[comment_id] = 0
)

[User] = Array
(
[id] = 1
[login] = gedm
[fullname] = gedm
[role_id] = 1
[password] = 245cb65084c076918943eaeb73dec56f2e1a3e54
[email] = g...@anemail.com
[active] = 1
)

[ParentComment] = Array
(
[id] =
[title] =
[comment] =
[user_id] =
[comment_id] =
)

[ChildComment] = Array
(
[0] = Array
(
[id] = 2
[title] = Sub comment
[comment] = This is a sub comment of one.
[user_id] = 2
[comment_id] = 1
)
)
)

Any help or suggestions would be appreciated.

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



Using a Button to Submit an AJAX Form

2009-08-23 Thread Shaun

In a non-AJAX form, I commonly use this:

$form-button('Submit', array('onclick' = 'this.form.submit()'));

I can't use this with the AJAX helper because the onclick event will
reload the page.  How can I use a button with AJAX?  I want to avoid
using a regular submit button because it doesn't play well with CSS.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How to save a record but not clear an empty field?

2009-08-23 Thread gedm

I'm wondering how the cakephp bakery site ignores the blank password
field when a user is updating their profile?

That is, if the password is left blank it updates the other fields in
the record but does not clear the password when the record is saved.
How is this done?

Thanks

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



Re: Certain strings crashing CakePHP - where do I look first?

2009-08-23 Thread technicaltitch

After a small struggle with my budget hosts, they've told me my text
was triggering a mod_security2 rule and are willing to disable it for
my site (if I assure them I'm on the case re security). As far as I
can tell you cannot disable this in .htaccess files.

Thanks SO MUCH for helping me eliminate my code and CakePHP - I
couldn't approach my hosts until I was confident that it wasn't my
code or CakePHP, and that blaming the Apache config was plausible,
which I couldn't have done without the generous assistance of everyone
here.

A HUGE thank you (from me and the charity Comunidad Inti Wara Yassi)


On Aug 22, 1:36 am, technicaltitch technicalti...@gmail.com wrote:
 I submitted a ticket about this to my host's server admin, and
 includinghttp://geocities.com/in the request caused:

 Not Acceptable
 An appropriate representation of the requested resource /pdesk.cgi
 could not be found on this server.
 Additionally, a 404 Not Found error was encountered while trying to
 use an ErrorDocument to handle the request.
 HTTPD Server Server atwww.getsomesupport.comPort 443

 Removing those few characters allowed the ticket to submit
 successfully.

 On Aug 22, 12:57 am, technicaltitch technicalti...@gmail.com wrote:



  You are such stars for helping me with this - its incredible thank you
  so much!

  I tried the new redirect method but got errors (missing arguments for
  AppController::redirect(), $status and $exit undefined) when I tried
  to log in, as this involved a redirect to the login form, so I logged
  in and then copied across the redirect override - to no avail - when I
  save the changes it redirects to the homepage, which contains no hint
  of the error. Also got the site working locally (was my PHP version
  thanks so much AD7six) - and can't repeat the defect. Do these point
  to Apache or PHP as the cause?

  I tried disabling mod_security using:
  IfModule mod_security.c
          SecFilterEngine Off
          SecFilterScanPOST Off
  /IfModule
  in every .htaccess file in my site, but it didn't make any difference
  (I sanitize everything, and it can't be this as it doesn't happen
  locally - unless it could be that local is Windows and host is Linux -
  seems very unlikely).

  I'd really appreciate any tips if anything's obvious about resolving
  the redirect override - or does the fact that it works locally mean
  this is unlikely to reveal anything?

  Tried creating a test subdirectory but suspected it wouldn't work - I
  get a 500 error probably related to my non-standard directory layout
  (so that my cake and app directories are outside my public_html
  directory - seemed safer).

  My reason for another site is in case the forum software has somehow
  added this filtering site-wide - it seems to be a server setting, (its
  only $11). I do get this error when I try the text in any table in the
  system (including tables that are nothing to do with tinyMCE and very
  little to do with the rest of the code). Will try baking an unrelated
  table to see if I can repeat it there but I very much expect to as it
  seems platform related.

  As far as I can tell, I don't have access to PHP settings - just
  CPanel on a shared hosting platform.

  Am I right in suspecting Apache or PHP? If so any ideas where I can
  look? I can't find anything likely by googling filters for either.
  Does Cake automatically use certain PHP filters on all POST and GET
  submissions or something?

  Thanks HUGELY, I'll be so incredibly happy when I/we crack this
  Chris/tt

  On Aug 18, 5:11 pm, Brendon Kozlowski (Realm)

  brendon...@hotmail.com wrote:
   I like archF6's suggestion, it's easy to test, and if it doesn't solve
   it, continue from there.  It might work, it might not.  I don't think
   a 500 server error would automatically redirect (but instead stop
   execution).  Regardless, it's about a 20 second test.  With Dreamhost
   I can enable/disable mod_security, I'm not sure if you would be able
   to test that on your host or not.  To be clear - I don't know why
   mod_security would mess with this, but it can't hurt to take a look if
   you're able to make such changes.

   On Aug 17, 11:23 am, technicaltitch technicalti...@gmail.com wrote:

App was built Oct 2007 but it's taken the organization this long to
find funding for someone to test and work on it, (hence I'm struggling
to get my head round stuff again).

I will have a go at creating a test subdirectory and adding that debug
code- fantastic fantastic ideas thanks - probably blindingly obvious
to PHPers but not to me (a decade working with C, Java and .NET but
only ever used PHP on volunteer projects).

Is it possible that a phpBB install may have had this as a side-
effect? Ie, can filters be set up on all form input for a given space
on a shared CPanel server?

I have commented out my controller method and seen the error, so I'm
assuming the redirect is called elsewhere, where do I put the 

Re: How do I merge 2 tables

2009-08-23 Thread simplesi



Farjad Habib wrote:
 
 http://book.cakephp.org/view/78/Associations-Linking-Models-Together
 
 go through this and u ll get an idea
AFAICT there's nothing in there to show how loop through all the records in
one table and update another table as appropriate :)

I tried modifying the

foreach ($issues as issue) loop in my index view of Issues and I can extract
all associated Change.detail fields using a inner loop of

$totaldetail = '';
foreach($issue['Change'] as $subchange) {
   if (!empty($subchange['detail'])) {
  $totaldetail = $totaldetail . $subchange['detail'];
   }
};

but I don't seem able to make Issue.alldetails = $totaldetail and save each
updated record :(

regards

Simon


-- 
View this message in context: 
http://www.nabble.com/How-do-I-merge-2-tables-tp25103063p25103642.html
Sent from the CakePHP mailing list archive at Nabble.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: Validation alphaNumeric issue.

2009-08-23 Thread Tmyclyk Dmytryk

Thank you for the thorough description, I appreciate it - I could have
sworn I had it working on my other CentOS box without doing anything
specific, but I may not have, for now I am using

rule = array('custom', '/^[a-z0-9]*$/i')

and it works fine, thank you again!

Best Regards,
Howard

On Aug 23, 6:37 am, delocalizer conrad.leon...@hotmail.com wrote:
 It's nothing to do with php version - the problem is CentOS (or RHEL)
 - cake's built-in 'alphaNumeric' rule uses unicode matching in its
 regex, which is not supported by the PCRE library that comes with
 those flavours of Linux. If you know what you're doing you could try
 to compile the library with unicode support, but probably the easiest
 solution is write your own custom validation rule - just copy what is
 in the cake core  replace the unicode stuff (in the curly braces)
 with plain old ASCII regex

 cheers,
 Conrad.

 On Aug 23, 1:09 pm, Howard  Lince hli...@gmail.com wrote:



  I am having a problem with alphaNumeric validation on my application,
  we redid the server (changed the os from opensuse to centos), and
  while alphaNumeric validation worked before, it constantly returns
  false now. I was told earlier it's the php 5.1.x so I upgraded to
  5.2.6, which was said to resolve this issue and it's still doing it,
  what can I do about this?- 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: logged in users list

2009-08-23 Thread Rick

You could use a database table (maybe add columns to one of the auth
tables?).

user/account
login-time

When a user tries to log in
check that his account is not already in the table.
if it is there and the login-time is recent then don't allow login.
If not there add his name/account and current time to the table and
allow user.

Rick



On Aug 23, 1:41 am, Junaed Halim jun...@gmail.com wrote:
 Hello all,  I am using cake's Auth component for login purpose.
 Now my client wants to get a list of all logged in users.
 Can anyone give any advice how to do that?

 I also need to prevent multiple simultaneous login using single account.
 Any help will be appreciated.

 Thank you.

 --
 Junaed Halim
--~--~-~--~~~---~--~~
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: logged in users list

2009-08-23 Thread Onezino HEAT
please read cake log documentation, u can register everthyng the user do.

2009/8/23 Junaed Halim jun...@gmail.com

 Hello all,  I am using cake's Auth component for login purpose.
 Now my client wants to get a list of all logged in users.
 Can anyone give any advice how to do that?

 I also need to prevent multiple simultaneous login using single account.
 Any help will be appreciated.

 Thank you.

 --
 Junaed Halim

 


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



pages not diplayed

2009-08-23 Thread xxbeta

My project is working properly on my local server, apache on windows
xp. However, after uploading all the files onto the hosting server,
some pages just can not be displayed.Only returns a blank page in the
web browser, both IE and Firefox. The hosting server should be linux.
Need advice.

Thanks 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: pages not diplayed

2009-08-23 Thread Onezino HEAT
the server need change some files of apache conf.
http://book.cakephp.org/view/27/Developing-with-CakePHP

2009/8/23 xxbeta xxb...@gmail.com


 My project is working properly on my local server, apache on windows
 xp. However, after uploading all the files onto the hosting server,
 some pages just can not be displayed.Only returns a blank page in the
 web browser, both IE and Firefox. The hosting server should be linux.
 Need advice.

 Thanks 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: Dying on blank white page

2009-08-23 Thread Arvind

Well..it may be browser cache but not sure though.

On Aug 21, 1:22 pm, Bert Van den Brande cyr...@gmail.com wrote:
 I've had blank pages when :
 * .htaccess was not working as it should, due to restrictions from
 Apache (it needed Allow Overwrite All)
 * a table was missing from the db, and the error couldn't be displayed
 by Cake because it got into a recursion when trying to output the
 message html (this is very project specific since we added some magic
 stuff to /app/config/routes.php)

 Still it's weird that all of a sudden it started working ... I'm
 thinking along the line of a browser page cache that just showed you
 the white page again instead of reloading the requested url ?

 On Thu, Aug 20, 2009 at 10:00 PM, Arvindarvind.mai...@gmail.com wrote:

  It has started to work without doing anything moments ago. All i did,
  i decided to debug through dispatcher
  and before going into the dispatcher i decided to do some dies
  around
  to the dispatcher call in webroot/index.php file to make sure it goes
  into
  (which i had tested already; just wanted to double check it) it and
  after
  doing 2-3 dies around the code

         if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) {
                 trigger_error(CakePHP core could not be found.  Check
  the value of
  CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php.  It should point to
  the directory containing your  . DS . cake core directory and your
   . DS . vendors root directory., E_USER_ERROR);
         }
         if (isset($_GET['url'])  $_GET['url'] === 'favicon.ico') {
                 return;
         } else {

                 $Dispatcher = new Dispatcher();
                 $Dispatcher-dispatch($url);
         }
         if (Configure::read()  0) {
                 echo !--  . round(getMicrotime() - $TIME_START,
  4) . s --;
         }

  and it started to work all at once. And tmp/cache files also started
  to
  get
  generated! VERY STRANGE INDEED!!

  I think there must be something which i am missing. Please let me
  know if someone has faced this kind of problem. Some apache
  server problem? Cake hash validation problem? or caching problem?

  Please put your thoughts before cakephp ( which i love the most in
  frameworks ) starts to become a mystery to me. (I wish it were not a
  cakephp problem though)

  On Aug 21, 12:21 am, Arvind arvind.mai...@gmail.com wrote:
  Hi everyone,

  I uploaded my local controller files, view files and one css file to
  remote server 2 hrs ago and tried to access the site admin section but
  it is dying on blank white page without any debug report or any error
  displayed. The entire system is working fine on my local wamp server
  and also worked well on the same remote server yesterday but is not
  working right now. I have checked all files many a times and all files
  mentioned above are parallel to my local files with one exception. On
  the remote server there is no cache files being generated inside the
  app/tmp/cache folder which i noticed today only but i am sure it
  worked with same settings 1 day ago. I am trying to debug in webroot/
  index.php file and it is reaching till the dispatcher alright. I also
  tried by removing .htaccess but same problem with /webroot/index.php
  file. Mod rewrite is WORKING just fine.

  Not sure what is the problem. Anyone with thoughts on this is most
  welcome as i have already started to pull my hair.

  Here is the url where it is dying on blank page 
  :http://d1041638.blacknight.com/admin/users/login

  Thanks in advance,

  Arvind.
--~--~-~--~~~---~--~~
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: Dying on blank white page

2009-08-23 Thread Arvind

Yes of course. But as i mentioned above no cache files were being
written to tmp cache directory.

On Aug 21, 3:00 pm, rich...@home richardath...@gmail.com wrote:
 Also worth remembering to clear the app/tmp directories (just the
 files, leave the directory structures intact) when you upload

 On Aug 21, 9:22 am, Bert Van den Brande cyr...@gmail.com wrote:

  I've had blank pages when :
  * .htaccess was not working as it should, due to restrictions from
  Apache (it needed Allow Overwrite All)
  * a table was missing from the db, and the error couldn't be displayed
  by Cake because it got into a recursion when trying to output the
  message html (this is very project specific since we added some magic
  stuff to /app/config/routes.php)

  Still it's weird that all of a sudden it started working ... I'm
  thinking along the line of a browser page cache that just showed you
  the white page again instead of reloading the requested url ?

  On Thu, Aug 20, 2009 at 10:00 PM, Arvindarvind.mai...@gmail.com wrote:

   It has started to work without doing anything moments ago. All i did,
   i decided to debug through dispatcher
   and before going into the dispatcher i decided to do some dies
   around
   to the dispatcher call in webroot/index.php file to make sure it goes
   into
   (which i had tested already; just wanted to double check it) it and
   after
   doing 2-3 dies around the code

          if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) {
                  trigger_error(CakePHP core could not be found.  Check
   the value of
   CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php.  It should point to
   the directory containing your  . DS . cake core directory and your
. DS . vendors root directory., E_USER_ERROR);
          }
          if (isset($_GET['url'])  $_GET['url'] === 'favicon.ico') {
                  return;
          } else {

                  $Dispatcher = new Dispatcher();
                  $Dispatcher-dispatch($url);
          }
          if (Configure::read()  0) {
                  echo !--  . round(getMicrotime() - $TIME_START,
   4) . s --;
          }

   and it started to work all at once. And tmp/cache files also started
   to
   get
   generated! VERY STRANGE INDEED!!

   I think there must be something which i am missing. Please let me
   know if someone has faced this kind of problem. Some apache
   server problem? Cake hash validation problem? or caching problem?

   Please put your thoughts before cakephp ( which i love the most in
   frameworks ) starts to become a mystery to me. (I wish it were not a
   cakephp problem though)

   On Aug 21, 12:21 am, Arvind arvind.mai...@gmail.com wrote:
   Hi everyone,

   I uploaded my local controller files, view files and one css file to
   remote server 2 hrs ago and tried to access the site admin section but
   it is dying on blank white page without any debug report or any error
   displayed. The entire system is working fine on my local wamp server
   and also worked well on the same remote server yesterday but is not
   working right now. I have checked all files many a times and all files
   mentioned above are parallel to my local files with one exception. On
   the remote server there is no cache files being generated inside the
   app/tmp/cache folder which i noticed today only but i am sure it
   worked with same settings 1 day ago. I am trying to debug in webroot/
   index.php file and it is reaching till the dispatcher alright. I also
   tried by removing .htaccess but same problem with /webroot/index.php
   file. Mod rewrite is WORKING just fine.

   Not sure what is the problem. Anyone with thoughts on this is most
   welcome as i have already started to pull my hair.

   Here is the url where it is dying on blank page 
   :http://d1041638.blacknight.com/admin/users/login

   Thanks in advance,

   Arvind.
--~--~-~--~~~---~--~~
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: Please help - 3rd time trying to post - Why is knownusers from IBM tutorial not working?

2009-08-23 Thread Dr. Loboto

There are a lot of chages between cake 1.1 and 1.2. IBM tutorials was
written for 1.1

On Aug 22, 11:34 pm, winegoddess winegodd...@gmail.com wrote:
 THANK YOU!!

 Im surprised I couldnt find anything correcting the tutorial on this.

 THANK YOU!!!

 Judy

 On Aug 21, 6:41 pm, Sam Sherlock sam.sherl...@gmail.com wrote:



  no longer findAll use find('all')http://book.cakephp.org/view/449/find
  - S

  2009/8/21 winegoddess winegodd...@gmail.com

   Hello, I am not sure why my messages are not getting through.

   I have a question regarding the IBM tutorial

  http://www.ibm.com/developerworks/opensource/tutorials/os-php-cake2/s...

   My knownusers page is not working.
   I get a message that
   The first argument should be an array [APP\views\users\knownusers.ctp,
   line 3]

   I have several records in the users table.

   Here are my files:

   VIEW (knownusers.ctp)
   table
   ?php echo $html-tableHeaders(array_keys($knownusers[0]['User']));
   foreach ($knownusers as $thisuser){
    echo $html-tableCells($thisuser['User']);
   }

   ?
   /table

   MODEL:

   ?php
   class User extends AppModel
   {
          var $name = 'User';

           var $validate = array(
                  'first_name' = array(

                                   'ruleName2' = array(
                                                   'rule' = 'alphaNumeric',
                                                   'required' = true,
                                                   'message' = 'You must
   enter a first name using letters only.'
                                                  )
                           ),

                  'last_name' = array(
                                  'ruleName' = array(
                                          'rule' = '/^.{1,40}$/',
                                                   'message' = 'Please enter
   a first name between 1 and 40
   characters.'
                                                          ),
                                  'ruleName2' = array(
                                           'rule' = 'alphaNumeric',
                                           'required' = true,
                                           'message' = 'You must enter a
   first name.'
                                                  )

                          ),
             'username' = array(
                           'ruleName' = array(
                           'rule' = '/^.{6,40}$/',
                                                   'message' = 'Please enter
   a username between 6 and 40
   characters.'
                                                          ),
                           'ruleName2' = array(
                           'rule' = 'isUnique',
                                                  'message' = 'This username
   has already been taken.'
                                                  )
                           ),

                     'password' = array (
                                                  'rule' = '/^.{6,40}$/',
                                                   'message' = 'Please enter
   a password between 6 and 40
   characters.'
                                                          ),
                      'email' = array('rule' = 'email',
                                                           'message' =
   'Please enter a valid email address.'
                                                          ),

                    );

   }
   ?

   CONTROLLER  (truncated)

   ?php
   class UsersController extends AppController
   {

   var $name = 'Users';

   var $helpers = array('Html', 'Form' );

   .
   .
   .

    function knownusers()
      {
   $this-set('knownusers', $this-User-findAll(null,
                  array('id', 'username', 'first_name', 'last_name'), 'id
   DESC') ) ;
      }
--~--~-~--~~~---~--~~
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 do I merge 2 tables

2009-08-23 Thread Farjad Habib
sory my bad.

On Sun, Aug 23, 2009 at 8:08 PM, simplesi siwalt...@hotmail.com wrote:




 Farjad Habib wrote:
 
  http://book.cakephp.org/view/78/Associations-Linking-Models-Together
 
  go through this and u ll get an idea
 AFAICT there's nothing in there to show how loop through all the records in
 one table and update another table as appropriate :)

 I tried modifying the

 foreach ($issues as issue) loop in my index view of Issues and I can
 extract
 all associated Change.detail fields using a inner loop of

 $totaldetail = '';
 foreach($issue['Change'] as $subchange) {
   if (!empty($subchange['detail'])) {
  $totaldetail = $totaldetail . $subchange['detail'];
   }
 };

 but I don't seem able to make Issue.alldetails = $totaldetail and save each
 updated record :(

 regards

 Simon


 --
 View this message in context:
 http://www.nabble.com/How-do-I-merge-2-tables-tp25103063p25103642.html
 Sent from the CakePHP mailing list archive at Nabble.com.


 



-- 
Farjad Habib
BS 2011
LUMS

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



Re: Using a Button to Submit an AJAX Form

2009-08-23 Thread schneimi

Not sure if this is all you need, but the form must have the option
onsubmit=return(false); to not reload the page.

Regards

On 23 Aug., 15:54, Shaun sbef...@gmail.com wrote:
 In a non-AJAX form, I commonly use this:

 $form-button('Submit', array('onclick' = 'this.form.submit()'));

 I can't use this with the AJAX helper because the onclick event will
 reload the page.  How can I use a button with AJAX?  I want to avoid
 using a regular submit button because it doesn't play well with CSS.
--~--~-~--~~~---~--~~
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: Validation alphaNumeric issue.

2009-08-23 Thread delocalizer

You're very welcome. That will work for ASCII characters only of
course. I've never looked into why that library isn't compiled with
Unicode support by default - RHEL releases tend towards the
conservative, but it seems a strange omission to me to ignore the
character sets of most of the world's languages!

On Aug 24, 12:20 am, Tmyclyk Dmytryk hli...@gmail.com wrote:
 Thank you for the thorough description, I appreciate it - I could have
 sworn I had it working on my other CentOS box without doing anything
 specific, but I may not have, for now I am using

 rule = array('custom', '/^[a-z0-9]*$/i')

 and it works fine, thank you again!

 Best Regards,
 Howard

 On Aug 23, 6:37 am, delocalizer conrad.leon...@hotmail.com wrote:



  It's nothing to do with php version - the problem is CentOS (or RHEL)
  - cake's built-in 'alphaNumeric' rule uses unicode matching in its
  regex, which is not supported by the PCRE library that comes with
  those flavours of Linux. If you know what you're doing you could try
  to compile the library with unicode support, but probably the easiest
  solution is write your own custom validation rule - just copy what is
  in the cake core  replace the unicode stuff (in the curly braces)
  with plain old ASCII regex

  cheers,
  Conrad.

  On Aug 23, 1:09 pm, Howard  Lince hli...@gmail.com wrote:

   I am having a problem with alphaNumeric validation on my application,
   we redid the server (changed the os from opensuse to centos), and
   while alphaNumeric validation worked before, it constantly returns
   false now. I was told earlier it's the php 5.1.x so I upgraded to
   5.2.6, which was said to resolve this issue and it's still doing it,
   what can I do about this?- 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: How to save a record but not clear an empty field?

2009-08-23 Thread delocalizer

Hi Gerard;
There would be many ways to do this - one way would be to put some
logic in the User model beforeValidate method that checks if password
field is set in the data but blank, then password field is unset - so
it won't be validated or saved.
eg.
function beforeValidate(){
if (isset($this-data['User']['pwd']  strlen($this-data['User']
['pwd'])==0)){
unset($this-data['User']['pwd]);
}
return true;
}
If you do this you'll have to hash your own password rather than let
Auth do it automatically, because Auth will hash a blank password and
the 'if' condition will never be true.

On Aug 24, 12:04 am, gedm gerard.me...@gmail.com wrote:
 I'm wondering how the cakephp bakery site ignores the blank password
 field when a user is updating their profile?

 That is, if the password is left blank it updates the other fields in
 the record but does not clear the password when the record is saved.
 How is this done?

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



Re: logged in users list

2009-08-23 Thread Miles J

You would need a datetime column named lastLoginTime or something
equivalent.

Then you would update that with the current timestamp each login.

Then you would find all users that have logged in within the past x
minutes.
--~--~-~--~~~---~--~~
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 save a record but not clear an empty field?

2009-08-23 Thread Dr. Loboto

 If you do this you'll have to hash your own password rather than let
 Auth do it automatically, because Auth will hash a blank password and
 the 'if' condition will never be true.

If do not touch Auth hashing behavior password field can be checked
not as notBlank but by comparison with hashed empty string.
--~--~-~--~~~---~--~~
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: Validation alphaNumeric issue.

2009-08-23 Thread Dr. Loboto

alphaNumeric rule is for latin letters only, yes. Good for usernames,
for example. If you want non-latin letters there too, you may try
this:
rule = array('custom', '/^[\w\d]*$/iu')
But it also includes underscore. And depends on server locale.

On Aug 24, 5:37 am, delocalizer conrad.leon...@hotmail.com wrote:
 You're very welcome. That will work for ASCII characters only of
 course. I've never looked into why that library isn't compiled with
 Unicode support by default - RHEL releases tend towards the
 conservative, but it seems a strange omission to me to ignore the
 character sets of most of the world's languages!

 On Aug 24, 12:20 am, Tmyclyk Dmytryk hli...@gmail.com wrote:



  Thank you for the thorough description, I appreciate it - I could have
  sworn I had it working on my other CentOS box without doing anything
  specific, but I may not have, for now I am using

  rule = array('custom', '/^[a-z0-9]*$/i')

  and it works fine, thank you again!

  Best Regards,
  Howard

  On Aug 23, 6:37 am, delocalizer conrad.leon...@hotmail.com wrote:

   It's nothing to do with php version - the problem is CentOS (or RHEL)
   - cake's built-in 'alphaNumeric' rule uses unicode matching in its
   regex, which is not supported by the PCRE library that comes with
   those flavours of Linux. If you know what you're doing you could try
   to compile the library with unicode support, but probably the easiest
   solution is write your own custom validation rule - just copy what is
   in the cake core  replace the unicode stuff (in the curly braces)
   with plain old ASCII regex

   cheers,
   Conrad.

   On Aug 23, 1:09 pm, Howard  Lince hli...@gmail.com wrote:

I am having a problem with alphaNumeric validation on my application,
we redid the server (changed the os from opensuse to centos), and
while alphaNumeric validation worked before, it constantly returns
false now. I was told earlier it's the php 5.1.x so I upgraded to
5.2.6, which was said to resolve this issue and it's still doing it,
what can I do about this?- 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: logged in users list

2009-08-23 Thread Junaed Halim
Thank you all for your reply. I'll get the logged-in users by adding a
datetime column and updating it.
But how would I know whether someone has logged out or not?
They can simply close the browser without logging out themselves.
Am I missing something?

On Mon, Aug 24, 2009 at 8:50 AM, Miles J mileswjohn...@gmail.com wrote:


 You would need a datetime column named lastLoginTime or something
 equivalent.

 Then you would update that with the current timestamp each login.

 Then you would find all users that have logged in within the past x
 minutes.
 



-- 
Junaed Bin Halim
Member, R  D Group
Commlink Info Tech Ltd.

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



Please Help!! my password is always null!!!

2009-08-23 Thread liaogz82

Hi all,

I dont know why but my password is always sent as null in $this-data,
which causes it to be unable to retrieve data for comparison. The
following below are my codes:

login.ctp
div class=login
h2Login/h2
?php echo $form-create('User', array
('controller'='users','action'='login'));?
?php echo $form-input('User.username');?
?php echo $form-input('User.password',array
('type'='password'));?
?php echo $form-submit('Login');?
?php echo $form-end(); ?
/div ?php
?

users_controller.php
function login()
{
$this-layout = 'login';
if(!empty($this-data))
{
$user = $this-User-validateLogin($this-data['User']);
if($user != '')
{
$this-Session-write('User', $user);
$this-Session-setFlash('You\'ve successfully logged
in.');
$this-redirect(array('controller'='subscribers',
'actions'='index'));
}
else
{
$this-Session-setFlash(json_encode($this-data));
$this-redirect(array
('controller'='users','actions'='login'));
}
}
}

function logout()
{
$this-Session-destroy('user');
$this-Session-setFlash('You\'ve successfully logged out.');
$this-redirect($this-Auth-logout());
}

user.php
class User extends AppModel {

var $name = 'User';
//var $actsAs = array('Acl' = array('requester'));
var $useDbConfig = 'tracksdb';

function parentNode() {
}

/* To get the login ID of staff
function getStaffID()
{
return gangzheng;
/* to change. The ID should be gotten from session
}*/

//The Associations below have been created with all possible keys,
those that are not needed can be removed
var $belongsTo = array(
'Group' = array('className' = 'Group',
'foreignKey' = 'group_id',
'conditions' = '',
'fields' = '',
'order' = '',
'counterCache' = ''),
);

var $hasMany = array(
'Login' = array('className' = 'Login',
'foreignKey' = 'user_id',
'conditions' = '',
'fields' = '',
'order' = '',
'limit' = '',
'offset' = '',
'dependent' = '',
'exclusive' = '',
'finderQuery' = '',
'counterQuery' = ''),
);

function validateLogin($data)
{
$user = $this-find(array('username' = $data['username'],
'password' = sha1($data['password'])), array('id', 'username'));
if(empty($user) == false)
return $user['User'];
return false;
}
}

The flash message kept showing {User:
{username:gangzheng,password:null}}. So i am not sure what is
going on. the password field is always set to null no matter what i
type into the password field. Please help. Thanks

Gangzheng
--~--~-~--~~~---~--~~
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 do I merge 2 tables

2009-08-23 Thread Martin Westin


Here are two basic example of how you do it using MySQL

insert with a select statement for the values.
http://mysql-tips.blogspot.com/2005/04/mysql-insert-select-example.html

and the variation where you can trick mysql into doing an update.
http://forums.mysql.com/read.php?61,65650,262461#msg-262461


What you would want to do is create a new empty table with the desired
fields from both tables. Then do a select joining the two tables and
inserting the results into the new table. Using the second method you
should be abel to update to oneof the involved tables... but I
wouldn't do that myself.


good luck.




On Aug 23, 4:08 pm, simplesi siwalt...@hotmail.com wrote:
 Farjad Habib wrote:

 http://book.cakephp.org/view/78/Associations-Linking-Models-Together

  go through this and u ll get an idea

 AFAICT there's nothing in there to show how loop through all the records in
 one table and update another table as appropriate :)

 I tried modifying the

 foreach ($issues as issue) loop in my index view of Issues and I can extract
 all associated Change.detail fields using a inner loop of

 $totaldetail = '';
 foreach($issue['Change'] as $subchange) {
    if (!empty($subchange['detail'])) {
       $totaldetail = $totaldetail . $subchange['detail'];
    }

 };

 but I don't seem able to make Issue.alldetails = $totaldetail and save each
 updated record :(

 regards

 Simon

 --
 View this message in 
 context:http://www.nabble.com/How-do-I-merge-2-tables-tp25103063p25103642.html
 Sent from the CakePHP mailing list archive at Nabble.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
-~--~~~~--~~--~--~---