[fw-general] URL issue

2007-09-14 Thread debussy007

Hello,

Im trying out Zend Framework with Rob Allen's tutorial, but I have a weird
error :

Accessing my site like this : 

http://localhost/mysite   works,

but accessing it like this :

http://localhost/mysite/index.php   it crashes, wih the following exception
:

Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with
message 'Invalid controller specified (index.php)' in
D:\websites\mysite\library\Zend\Controller\Dispatcher\Standard.php:193 Stack
trace: #0 D:\websites\mysite\library\Zend\Controller\Front.php(911):
Zend_Controller_Dispatcher_Standard-dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Controller_Response_Http)) #1 D:\websites\mysite\index.php(26):
Zend_Controller_Front-dispatch() #2 {main} thrown in
D:\websites\mysite\library\Zend\Controller\Dispatcher\Standard.php on line
193

Anyone has any idea how that happen ?

Thank you for any help !!
-- 
View this message in context: 
http://www.nabble.com/URL-issue-tf4440432s16154.html#a12669289
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] URL issue

2007-09-14 Thread Pádraic Brady
The Zend Framework uses url rewriting to transpose a URL into a controller, 
action and possibly module name.

So the ending .php is not required. Your index URL is just the base, or 
alternatively:

http://localhost/mysite/index

In the above index is interpreted as a request for the IndexController. To 
access a specific method, say IndexController::searchAction():

http://localhost/mysite/index/search

You should note that all requests will pass through index.php anyway - so it 
doesn't require an explicit URL.

Have fun :)

Paddy
 
Pádraic Brady
http://blog.astrumfutura.com
http://www.patternsforphp.com


- Original Message 
From: debussy007 [EMAIL PROTECTED]
To: fw-general@lists.zend.com
Sent: Friday, September 14, 2007 7:21:15 AM
Subject: [fw-general] URL issue


Hello,

Im trying out Zend Framework with Rob Allen's tutorial, but I have a weird
error :

Accessing my site like this : 

http://localhost/mysite   works,

but accessing it like this :

http://localhost/mysite/index.php   it crashes, wih the following exception
:

Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with
message 'Invalid controller specified (index.php)' in
D:\websites\mysite\library\Zend\Controller\Dispatcher\Standard.php:193 Stack
trace: #0 D:\websites\mysite\library\Zend\Controller\Front.php(911):
Zend_Controller_Dispatcher_Standard-dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Controller_Response_Http)) #1 D:\websites\mysite\index.php(26):
Zend_Controller_Front-dispatch() #2 {main} thrown in
D:\websites\mysite\library\Zend\Controller\Dispatcher\Standard.php on line
193

Anyone has any idea how that happen ?

Thank you for any help !!
-- 
View this message in context: 
http://www.nabble.com/URL-issue-tf4440432s16154.html#a12669289
Sent from the Zend Framework mailing list archive at Nabble.com.








  

Tonight's top picks. What will you watch tonight? Preview the hottest shows on 
Yahoo! TV.
http://tv.yahoo.com/ 


[fw-general] Query - Can we run 2 copies of an application on same domain

2007-09-14 Thread Sanjay Aggarwal
I am trying to run 2 copies of an application by placing one copy on
doc_root another in doc_root/project folder. But due to redirection -
Request goes back to the first copy. Is there anyone who has faced the
similar problem? Or is there anyone who can suggest me the cause and
solution for the same?

Regards,
Sanjay Aggarwal



RE: [fw-general] Escape POST variable's value

2007-09-14 Thread Sanjay Aggarwal
Zend_Db class's function take care of it automatically. So you need not to
be worried. 

-Original Message-
From: Kexiao Liao [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 14, 2007 7:28 AM
To: fw-general@lists.zend.com
Subject: [fw-general] Escape POST variable's value


Before I save POST variable's values into Database table, Do I need to
escape these values to filter out any unexpected characters in the string?
What is the function we need to call for these filtering?

--
View this message in context:
http://www.nabble.com/Escape-POST-variable%27s-value-tf4439669s16154.html#a1
2667161
Sent from the Zend Framework mailing list archive at Nabble.com.





[fw-general] Merging Zend_Config objects?

2007-09-14 Thread Jack Sleight

Hi,
Has anyone implemented a method to allow merging of two Zend_Config 
objects? Where the values in one will override the values in the other? 
I need to do this because I have a generic module in one folder (with a 
default config), that multiple sites use, and each site needs to specify 
its own configuration for the module (with the possibility of overriding 
the defaults).

Thanks,
--
Jack


Re: [fw-general] E-mail regular expression and empty fields.

2007-09-14 Thread ArticSun

I'm not sure if I got what it takes to add critical notes to the Zend
Framework ;).

About the fields problem... In the .phtml I write data from an array to the
value attribute of input fields.
It seems that if a certain key is not available in the array it writes the
'br /'.

So I can check if the key exists, but well.. that's a lot of extra code :).

I just put the data array through a simple filter:

// Zend_Filter_Input options.
$aOptions = array('allowEmpty' = true);

// Zend_Filter_Input filters.
$aFilters = array();

// Zend_Filter_Input validators.
$aValidators = array(
   'id' = array(
  'Digits'
   ),
   'relation_id' = array(
  new Zend_Validate_Regex('/^[0-9]{1,}$/'),
  'presence' = 'required',
  'allowEmpty' = false,
  'messages' = 'Selecteer een relatie.'
   )
); // Etc.

// Apply the filter to the post data.
$oFilter = new Zend_Filter_Input($aFilters, $aValidators,
$this-_request-getPost(), $aOptions);

// Save the data in the class var (escaped / html removed).
$this-_aCheckedData['contact'] = $oFilter-getEscaped();
return;

When a field is not filled in correctly conforming the filter, it seems the
key in the array $this-_aChekcedData['contact'] is removed.

Thanks!



Darby Felton wrote:
 
 Hi,
 
 Have you tried using Zend_Validate_EmailAddress? If for some reason it
 is unsatisfactory for your use case, you can help us to improve it by
 discussing the shortcomings you encounter here, and filing issues in the
 JIRA issue tracker:
 
 http://framework.zend.com/issues/secure/CreateIssue!default.jspa
 
 If you do not already have authorization to create issues, first create
 an account, and then simply send an e-mail to [EMAIL PROTECTED] requesting
 permission to post issues and comments.
 
 As for the second question, I think we'll need more information to be
 able to help you:
 
 How to Report Bugs Effectively
 http://www.chiark.greenend.org.uk/~sgtatham/bugs.html
 
 Best regards,
 Darby
 
 ArticSun wrote:
 Hi all!
 
I got two questions about validating form data. The first one might be
 the simplest. I've got a regular expression which checks if an e-mail
 address is correct:
 
 new
 Zend_Validate_Regex(/^$|^[-a-z0-9!#$%'*+/=?^_`{|}~]+(\.[-a-z0-9!#$%'*+/=?^_`{|}~]+)*@(([a-z]([-a-z0-9]*[a-z0-9]+)?){1,63}\.)+([a-z]([-a-z0-9]*[a-z0-9]+)?){2,63}$/)
 
 I've added the / at the beginning and end because other expressions
 wouldn't
 work without it. This expression works when I use it in ereg for
 example.
 I now get the error: Internal error matching pattern {the pattern}.
 Does
 anyone know what I'm doing wrong, or what would be a good expression (but
 I
 don't want to make this a script request!).
 
 The second question is about fields that get a br / when the value was
 not
 right regarding the validator. I do something like:
 
 // Apply the filter to the post data.
 $oFilter = new Zend_Filter_Input($aFilters, $aValidators,
 $this-_request-getPost(), $aOptions);
 
 // Save the data in the class var (escaped / html removed).
 $this-_aCheckedData['relation'] = $oFilter-getEscaped();
 
 When there are errors I show the form again. I try to print the data
 again
 (the data I put in _aCheckedData['relation'] here), and now the field
 that
 was not correct, contains br /, in stead of the value the user filled
 in.
 
 What could I be doing wrong here? If you need more information, please
 ask.
 
 Thanks!
 
 

-- 
View this message in context: 
http://www.nabble.com/E-mail-regular-expression-and-empty-fields.-tf4435743s16154.html#a12673544
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Auth: how to deal with crypt (des, md5)

2007-09-14 Thread mbneto
Hi,

I am trying to use Zend_Auth_Adapter_DbTable to provide authentication but I
noticed that it only works if the password is stored in clear text (at least
for me).

If this is the expected behaviour how do I add such support?  Should I
extended the Zend_Auth_Adapter_DbTable and give my implementation of the
authenticate method?

Regards.


Re: [fw-general] Query - Can we run 2 copies of an application on same domain

2007-09-14 Thread Johannes Schill
Modify the rewrite-rules so all requests (you have to make exceptions for
css/js/jpeg/jpg/gif/png/ico etc..) beginning with /project goes to
/project/index.php?

I haven't tried it myself, but i suppose it would work on apache and lighty.


Cheers,
Johannes


On 9/14/07, Sanjay Aggarwal [EMAIL PROTECTED] wrote:

 I am trying to run 2 copies of an application by placing one copy on
 doc_root another in doc_root/project folder. But due to redirection -
 Request goes back to the first copy. Is there anyone who has faced the
 similar problem? Or is there anyone who can suggest me the cause and
 solution for the same?

 Regards,
 Sanjay Aggarwal




Re: [fw-general] Merging Zend_Config objects?

2007-09-14 Thread Nico Edtinger

?php
function _fix_merge($array) {
foreach($array as $k = $v) {
if (!is_array($v)) {
continue;
}
if (is_int(key($v))) {
$array[$k] = $v[1];
} else {
$array[$k] = _fix_merge($v);
}
}

return $array;
}

$config1 = new Zend_Config_Ini(...);
$config2 = new Zend_Config_Ini(...);
$config = new Zend_Config(_fix_merge(array_merge_recursive($config1- 
toArray(), $config2-toArray(;

?

nico

Jack Sleight wrote:

Hi,
Has anyone implemented a method to allow merging of two Zend_Config  
objects? Where the values in one will override the values in the  
other? I need to do this because I have a generic module in one  
folder (with a default config), that multiple sites use, and each  
site needs to specify its own configuration for the module (with  
the possibility of overriding the defaults).

Thanks,
--
Jack




Re: [fw-general] E-mail regular expression and empty fields.

2007-09-14 Thread Darby Felton
From http://framework.zend.com/manual/en/zend.filter.input.html:

All fields that are neither invalid, missing, nor unknown are
considered valid. You can get values for valid fields using a magic
accessor. There are also non-magic accessor methods getEscaped() and
getUnescaped().

I believe that the behavior you're seeing is expected, as
Zend_Filter_Input does not make available invalid data by design.

Best regards,
Darby

ArticSun wrote:
 I'm not sure if I got what it takes to add critical notes to the Zend
 Framework ;).
 
 About the fields problem... In the .phtml I write data from an array to the
 value attribute of input fields.
 It seems that if a certain key is not available in the array it writes the
 'br /'.
 
 So I can check if the key exists, but well.. that's a lot of extra code :).
 
 I just put the data array through a simple filter:
 
 // Zend_Filter_Input options.
 $aOptions = array('allowEmpty' = true);
 
 // Zend_Filter_Input filters.
 $aFilters = array();
 
 // Zend_Filter_Input validators.
 $aValidators = array(
'id' = array(
   'Digits'
),
'relation_id' = array(
   new Zend_Validate_Regex('/^[0-9]{1,}$/'),
   'presence' = 'required',
   'allowEmpty' = false,
   'messages' = 'Selecteer een relatie.'
)
 ); // Etc.
 
 // Apply the filter to the post data.
 $oFilter = new Zend_Filter_Input($aFilters, $aValidators,
 $this-_request-getPost(), $aOptions);
 
 // Save the data in the class var (escaped / html removed).
 $this-_aCheckedData['contact'] = $oFilter-getEscaped();
 return;
 
 When a field is not filled in correctly conforming the filter, it seems the
 key in the array $this-_aChekcedData['contact'] is removed.
 
 Thanks!
 
 
 
 Darby Felton wrote:
 Hi,

 Have you tried using Zend_Validate_EmailAddress? If for some reason it
 is unsatisfactory for your use case, you can help us to improve it by
 discussing the shortcomings you encounter here, and filing issues in the
 JIRA issue tracker:

 http://framework.zend.com/issues/secure/CreateIssue!default.jspa

 If you do not already have authorization to create issues, first create
 an account, and then simply send an e-mail to [EMAIL PROTECTED] requesting
 permission to post issues and comments.

 As for the second question, I think we'll need more information to be
 able to help you:

 How to Report Bugs Effectively
 http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

 Best regards,
 Darby

 ArticSun wrote:
 Hi all!

I got two questions about validating form data. The first one might be
 the simplest. I've got a regular expression which checks if an e-mail
 address is correct:

 new
 Zend_Validate_Regex(/^$|^[-a-z0-9!#$%'*+/=?^_`{|}~]+(\.[-a-z0-9!#$%'*+/=?^_`{|}~]+)*@(([a-z]([-a-z0-9]*[a-z0-9]+)?){1,63}\.)+([a-z]([-a-z0-9]*[a-z0-9]+)?){2,63}$/)

 I've added the / at the beginning and end because other expressions
 wouldn't
 work without it. This expression works when I use it in ereg for
 example.
 I now get the error: Internal error matching pattern {the pattern}.
 Does
 anyone know what I'm doing wrong, or what would be a good expression (but
 I
 don't want to make this a script request!).

 The second question is about fields that get a br / when the value was
 not
 right regarding the validator. I do something like:

 // Apply the filter to the post data.
 $oFilter = new Zend_Filter_Input($aFilters, $aValidators,
 $this-_request-getPost(), $aOptions);

 // Save the data in the class var (escaped / html removed).
 $this-_aCheckedData['relation'] = $oFilter-getEscaped();

 When there are errors I show the form again. I try to print the data
 again
 (the data I put in _aCheckedData['relation'] here), and now the field
 that
 was not correct, contains br /, in stead of the value the user filled
 in.

 What could I be doing wrong here? If you need more information, please
 ask.

 Thanks!

 


Re: [fw-general] Zend_Auth: how to deal with crypt (des, md5)

2007-09-14 Thread Jack Sleight

Use:
$auth-setCredentialTreatment('MD5(?)');
The value can be anything that would be valid for the DB. The ? will be 
replaced with the submitted password.


mbneto wrote:

Hi,

I am trying to use Zend_Auth_Adapter_DbTable to provide authentication 
but I noticed that it only works if the password is stored in clear 
text (at least for me).


If this is the expected behaviour how do I add such support?  Should I 
extended the Zend_Auth_Adapter_DbTable and give my implementation of 
the authenticate method?


Regards.


--
Jack


Re: [fw-general] getting start of month with Zend_Date

2007-09-14 Thread Thomas Weidner

What about the following:

$current = new Zend_Date();
$begin = $current-setDay(1);

Greetings
Thomas
I18N Team Leader

- Original Message - 
From: Graham Anderson [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Friday, September 14, 2007 3:11 PM
Subject: [fw-general] getting start of month with Zend_Date



Afternoon list,

is there an easier ( and more readable ) way than the following to 
retrieve an object for the start of the current month?


$currentDate = new Zend_Date();
$startOfMonth = new Zend_Date(
{$currentDate-get(Zend_Date::YEAR)}
-{$currentDate-get(Zend_Date::MONTH)}-01
);

regards
Graham


Re: [fw-general] getting start of month with Zend_Date

2007-09-14 Thread Graham Anderson

Thomas Weidner wrote:

What about the following:

$current = new Zend_Date();
$begin = $current-setDay(1);


Thanks Thomas, didn't see that method!


Re: [fw-general] hats off to Matthew

2007-09-14 Thread Matthew Weier O'Phinney
-- Matthew Weier O'Phinney [EMAIL PROTECTED] wrote
(on Thursday, 13 September 2007, 04:40 PM -0400):
 -- David Mintz [EMAIL PROTECTED] wrote
 (on Thursday, 13 September 2007, 04:26 PM -0400):
  Kudos to Matthew Weier O'Phinney for traveling to New York City
  yesterday and giving a fine presentation on ZF for nyphp.org in the
  back room of a loud bar where the screen was too far away for the
  audience to read the text. You made it look easy. Thanks also for
  answering question and question after question on *@ lists.zend.com
  lists as well as in noisy downtown New York bars.
 
 You're too kind -- thanks for having me down to NYPHP!
 
 For those who haven't attended an NYPHP meeting before, if you're ever
 in the area, make an effort to do so -- great group of people, with a
 variety of experience under their collective belts.
 
 I'll be posting slides in the next couple days on my blog, so you can
 actually read them ;-)

I've posted an entry regarding the session, as well as my slides, on my
blog:


http://weierophinney.net/matthew/archives/143-NYPHP-Zend-Framework-Presentation.html

-- 
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


Re: [fw-general] E-mail regular expression and empty fields.

2007-09-14 Thread Tobias Gies
Hey Artic,

to answer your first question, Zend_Validate_Regex uses the PCRE regex
engine (this one is about 200 times as fast as ereg, IIRC), which means that
all regexes must begin and end with a specific delimiter. You are free to
choose any character you like as delimiter, as long as it does not exist in
the regex itself.

This basically means that you will have to either put a backslash before all
the slashes inside your regex (you used the slash as regex delimiter), or
you will have to choose a character as delimiter that you did NOT use in
your regex (which will, looking at the regex, indeed be somewhat complicated
;)).

Or, as Darby already suggested, you could just use
Zend_Validate_EmailAddress as validator to make life easier.

Greets from Germany,
Tobias

2007/9/13, ArticSun [EMAIL PROTECTED]:


 Hi all!

I got two questions about validating form data. The first one might be
 the simplest. I've got a regular expression which checks if an e-mail
 address is correct:

 new

 Zend_Validate_Regex(/^$|^[-a-z0-9!#$%'*+/=?^_`{|}~]+(\.[-a-z0-9!#$%'*+/=?^_`{|}~]+)*@(([a-z]([-a-z0-9]*[a-z0-9]+)?){1,63}\.)+([a-z]([-a-z0-9]*[a-z0-9]+)?){2,63}$/)

 I've added the / at the beginning and end because other expressions
 wouldn't
 work without it. This expression works when I use it in ereg for
 example.
 I now get the error: Internal error matching pattern {the pattern}. Does
 anyone know what I'm doing wrong, or what would be a good expression (but
 I
 don't want to make this a script request!).

 The second question is about fields that get a br / when the value was
 not
 right regarding the validator. I do something like:

 // Apply the filter to the post data.
 $oFilter = new Zend_Filter_Input($aFilters, $aValidators,
 $this-_request-getPost(), $aOptions);

 // Save the data in the class var (escaped / html removed).
 $this-_aCheckedData['relation'] = $oFilter-getEscaped();

 When there are errors I show the form again. I try to print the data again
 (the data I put in _aCheckedData['relation'] here), and now the field that
 was not correct, contains br /, in stead of the value the user filled
 in.

 What could I be doing wrong here? If you need more information, please
 ask.

 Thanks!
 --
 View this message in context:
 http://www.nabble.com/E-mail-regular-expression-and-empty-fields.-tf4435743s16154.html#a12654897
 Sent from the Zend Framework mailing list archive at Nabble.com.