Re: [fw-general] custom route problem

2007-09-03 Thread Gunter Sammet
I figured that portion of the problem out.

Still need to resolve the default router issue. base url/admin needs to
route through the default router.

Thanks,

Gunter


On 9/2/07, Leo Büttiker [EMAIL PROTECTED] wrote:

 Hi Gunter
 You have to write a asterix '*' for the parameters. Something like
 '/:action/:detailPage/*'.
 Cheers,
 Leo

 
 Von: Gunter Sammet [mailto:[EMAIL PROTECTED]
 Gesendet: Samstag, 1. September 2007 03:55
 An: fw-general@lists.zend.com
 Betreff: [fw-general] custom route problem

 Hi all:
 I have following custom route:

 $router = $frontController-getRouter();
 $browseRoute = new Zend_Controller_Router_Route(
 '/:action/:detailPage', // URL to match; action and id will
 be matched
 array(
 'module' = 'default', // 'default' module
 'controller' = 'browse',
 'detailPage' = 'index'
 )
 );
 $router-addRoute('browse', $browseRoute);


 I want to use this custom route only for my browse controller matching
 (locations|expertise|advantage|info|lifestyle) actions. It works partially
 for e.g. base url/locations or base url/locations/browse_locations but
 it doesn't work for base url/locations/browse_locations/page/2 (should
 also work for base
 url/locations/browse_locations/page/2/key1/value1/.../.../keyX/valueX).

 All requests that have an existing controller (e.g. base url/admin or
 base url/admin/index or base url/admin/index or base
 url/admin/list/view/test etc.) should use the default route.

 Any suggestions on how to solve this problem?
 TIA

 Gunter




[fw-general] The Http adapter example from the docs is not working with digest ?!?

2007-09-03 Thread Truppe Steven

Hi folks,

i have a strange problem here:

i now try for 2 days to get the simple example from the docs working (),
but i never get a successful login attemp with Digest!

The only thing that looks strange to be is that the REALM allways is
MYREALM .= '-659'. So for the example from the docs i get Some
Realm-659 in the HTTP Headers.

Here is the code (just copied from the docs) and the file with the
credentials:


|_Resolver File Content

_someUser:Some Realm:fde17b91c3a510ecbaf7dbd37f59d4f8

_From my bootstrap file

_?php
require_once 'Zend/Auth/Adapter/Http.php';
||require_once 'Zend/Auth/Adapter/Http/Resolver/File.php';|
|$path = '../etc/passwd';
$resolver = new Zend_Auth_Adapter_Http_Resolver_File($path);

||$config = array(
'accept_schemes' = 'digest',
'realm'  = 'Some Realm',
'digest_domains' = '/ http://debug.byteshelter.org',
'nonce_timeout'  = 3600,
);|

|$adapter = new Zend_Auth_Adapter_Http($config);
$adapter-setDigestResolver($digestResolver);

||assert($request instanceof Zend_Controller_Request_Http);
assert($response instanceof Zend_Controller_Response_Http);

$adapter-setRequest(Zend_Controller_Front::getInstance()-getRequest());
$adapter-setResponse(||Zend_Controller_Front::getInstance()-getResponse()||);

$result = $adapter-authenticate();

if (!$result-isValid()) {
echo SUCCESS!!;
// Bad userame/password, or canceled password prompt
}else echo FAILED;|


This code is copied from the docs, but i never get a successful login !!
The docs says to use username=someUser, realm=Some Realm and
credentials=somePassword.

But i get no successful login !!

The only thing i can say that looks a bit strange is that the realm
allways have '-659' attached in the HTTP headers.

I hope someone can help me with this, i get cracy with this example !!

I've also tried to put some log output from within the file resolver
(Zend/Auth/Adapter/Http/Resolver/File.php in the resolve() method but
the output is never shown in the logs !! only the constructor of the
file resolver outputs something into the logs...


I realy don't know what to do from this point, so i hope someone can
point me to the right direction.


best regards,
Truppe Steven



|



|


Re: [fw-general] need help with simple authentication plugin (how to redirect to another :model :controller :action?)

2007-09-03 Thread Senmiao Liu
Hi Steven,

You can try this in you plugin:

public functino preDispatch($request)
{
auth code...
...
if(!$this-_acl-isAllowed($role, $resource, $action))
{
$request-setModuleName('default');
$request-setControllerName('index');
$request-setActionName('login');
}

}

And here's a good example:
http://devzone.zend.com/article/1665-Zend_Acl-Zend_Auth-Example-Scenario

2007/9/1, Truppe Steven [EMAIL PROTECTED]:

 i'm on writing a simple Zend_AclZend_Auth Plugin that checks in
 preDispatch() if there are any rules for resources related to the actual
 module/controller/action.

 this all works fine, my question now is how can i forward to the
 controller:admin action:login if i find that the current user needs to
 login because he has not enouth permissions set ?

 I also want to handle the Error stuff inside postDispatch(). So if there
 is an exception it forwards to model:default, controller:Error,
 action:customerror.

 There is a method called _forward but i can't remember how to use it and
 in which context i have use it.


 best regards,
 Truppe Steven




-- 
Cheers
Senmiao Liu

Ethos.com.cn


Re: [fw-general] need help with simple authentication plugin (how to redirect to another :model :controller :action?)

2007-09-03 Thread Truppe Steven
thank you, this works allready.

now there is another problem with the http authentication adapter (digest).

also if i use the data from the Unittest i can't get a successful login,
the login dialog allways pop up again after pressing OK. only
chancel hides the login dialog and shows the page.

i've created a post for this.

best regards,
Truppe Steven



Senmiao Liu wrote:
 Hi Steven,

 You can try this in you plugin:

 public functino preDispatch($request)
 {
 auth code...
 ...
 if(!$this-_acl-isAllowed($role, $resource, $action))
 {
 $request-setModuleName('default');
 $request-setControllerName('index');
 $request-setActionName('login');
 }
 
 }

 And here's a good example:
 http://devzone.zend.com/article/1665-Zend_Acl-Zend_Auth-Example-Scenario
 http://devzone.zend.com/article/1665-Zend_Acl-Zend_Auth-Example-Scenario

 2007/9/1, Truppe Steven [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]:

 i'm on writing a simple Zend_AclZend_Auth Plugin that checks in
 preDispatch() if there are any rules for resources related to the
 actual
 module/controller/action.

 this all works fine, my question now is how can i forward to the
 controller:admin action:login if i find that the current user needs to
 login because he has not enouth permissions set ?

 I also want to handle the Error stuff inside postDispatch(). So if
 there
 is an exception it forwards to model:default, controller:Error,
 action:customerror.

 There is a method called _forward but i can't remember how to use
 it and
 in which context i have use it.


 best regards,
 Truppe Steven




 -- 
 Cheers
 Senmiao Liu

 Ethos.com.cn http://Ethos.com.cn 


[fw-general] Zend_Db_Table $_sequence set to false AND inserting row with no PK value

2007-09-03 Thread Julien Pauli
Hi,

In the manual it is written that if you put $_sequence to boolean false, in
your ORM definition ( extending Zend_Db_Table_Abstract ), then you'll be
forced to provide values for PKs while inserting a new row.

However, this feature does not seem to be present actually ..?
inserting blank value still proxies to Adapter and creates a DB error (
caused by a NULL to be inserted on a PK col ) that give logically a
Zend_Db_Statement_Exception

Thx for response.

Julien.


RE: [fw-general] The Http adapter example from the docs is not working with digest ?!?

2007-09-03 Thread Bill Karwin
Is your 'hash' PHP extension enabled?
The Zend_Auth_Adapter_Http requires that extension.

Regards,
Bill Karwin 

 -Original Message-
 From: Truppe Steven [mailto:[EMAIL PROTECTED] 
 Sent: Monday, September 03, 2007 8:27 AM
 To: fw-general@lists.zend.com
 Subject: [fw-general] The Http adapter example from the docs 
 is not working with digest ?!?
 
 
 Hi folks,
 
 i have a strange problem here:
 
 i now try for 2 days to get the simple example from the docs 
 working (), but i never get a successful login attemp with Digest!
 
 The only thing that looks strange to be is that the REALM 
 allways is MYREALM .= '-659'. So for the example from the 
 docs i get Some Realm-659 in the HTTP Headers.
 
 Here is the code (just copied from the docs) and the file with the
 credentials:
 
 
 |_Resolver File Content
 
 _someUser:Some Realm:fde17b91c3a510ecbaf7dbd37f59d4f8
 
 _From my bootstrap file
 
 _?php
 require_once 'Zend/Auth/Adapter/Http.php';
 ||require_once 'Zend/Auth/Adapter/Http/Resolver/File.php';|
 |$path = '../etc/passwd';
 $resolver = new Zend_Auth_Adapter_Http_Resolver_File($path);
 
 ||$config = array(
 'accept_schemes' = 'digest',
 'realm'  = 'Some Realm',
 'digest_domains' = '/ http://debug.byteshelter.org',
 'nonce_timeout'  = 3600,
 );|
 
 |$adapter = new Zend_Auth_Adapter_Http($config);
 $adapter-setDigestResolver($digestResolver);
 
 ||assert($request instanceof Zend_Controller_Request_Http);
 assert($response instanceof Zend_Controller_Response_Http);
 
 $adapter-setRequest(Zend_Controller_Front::getInstance()-get
 Request());
 $adapter-setResponse(||Zend_Controller_Front::getInstance()-
 getResponse()||);
 
 $result = $adapter-authenticate();
 
 if (!$result-isValid()) {
 echo SUCCESS!!;
 // Bad userame/password, or canceled password prompt 
 }else echo FAILED;|
 
 
 This code is copied from the docs, but i never get a 
 successful login !!
 The docs says to use username=someUser, realm=Some Realm 
 and credentials=somePassword.
 
 But i get no successful login !!
 
 The only thing i can say that looks a bit strange is that the 
 realm allways have '-659' attached in the HTTP headers.
 
 I hope someone can help me with this, i get cracy with this example !!
 
 I've also tried to put some log output from within the file 
 resolver (Zend/Auth/Adapter/Http/Resolver/File.php in the 
 resolve() method but the output is never shown in the logs !! 
 only the constructor of the file resolver outputs something 
 into the logs...
 
 
 I realy don't know what to do from this point, so i hope 
 someone can point me to the right direction.
 
 
 best regards,
 Truppe Steven
 
 
 
 |
 
 
 
 |
 


RE: [fw-general] Zend_Db_Table $_sequence set to false AND inserting row with no PK value

2007-09-03 Thread Bill Karwin
Right -- you must provide a value if you use a natural key, or else you
will get a database error.  
 
There is no need for Zend_Db to enforce this.  The database enforces it,
preventing the insert and returning an error, which is then thrown as a
Zend_Db_Statement_Exception.
 
Regards,
Bill Karwin




From: Julien Pauli [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 03, 2007 1:47 PM
To: Zend Framework General
Subject: [fw-general] Zend_Db_Table $_sequence set to false AND
inserting row with no PK value


Hi,

In the manual it is written that if you put $_sequence to
boolean false, in your ORM definition ( extending Zend_Db_Table_Abstract
), then you'll be forced to provide values for PKs while inserting a new
row. 

However, this feature does not seem to be present actually ..?
inserting blank value still proxies to Adapter and creates a DB
error ( caused by a NULL to be inserted on a PK col ) that give
logically a Zend_Db_Statement_Exception 

Thx for response.

Julien.




[fw-general] [Zend_Cache]Why i cannot cache my Zend_Controller_Front?

2007-09-03 Thread qqinxl

hello,
I need some help about Zend_Cache.

Please look at the following code.
$this-_cache = Zend_Cache::factory('Core','File', $frontendOptions,
$backendOptions);
$this-_frontCtrl = $this-_cache-load('frontCtrl');
if(empty($this-_frontCtrl )){
  $this-_frontCtrl = $this-_getFrontController();
  $this-_cache-save($this-_frontCtrl, 'frontCtrl');
}

Firstly,i creat a object and save it to $this-_cache;and next,i get the
object from cache.

if($this-_frontCtrl  instanceof Zend_Controller_Front){
  echo 'Loading ok';
}

Here, all normal.I can get a object saved before.


But  $this-_frontCtrl-dispatch(); doesn't work.

Invalid controller specified (auth)#0
D:\MyProject\php\auction\library\Zend\Controller\Front.php(911):
Zend_Controller_Dispatcher_Standard-dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Controller_Response_Http)) #1 

If i try to remove the $this-_cache ,like this:
$this-_frontCtrl = $this-_getFrontController();//the same setting like
before!
$this-_frontCtrl-dispatch();
it's no problem.




-- 
View this message in context: 
http://www.nabble.com/-Zend_Cache-Why-i-cannot-cache-my-Zend_Controller_Front--tf4374896s16154.html#a12470268
Sent from the Zend Framework mailing list archive at Nabble.com.