Re: [fw-general] Zend_Translate addTranslation

2009-10-08 Thread Саша Стаменковић
How do you initialize Zend_Translate in your bootstrap?

Regards,
Saša Stamenković


On Wed, Oct 7, 2009 at 10:38 PM, ignace developer.ign...@gmail.com wrote:


 Ok the code i used is:

 if ($this-_hasParam('language')) {
$language = $this-_getParam('language');
if ($bootstrap = $this-getInvokeArg('bootstrap')) {
$translateResource =
 $bootstrap-getPluginResource('Translate');
$translate =
 $translateResource-getTranslate();
if (!$translate-isAvailable($language)) {
$options =
 $translateResource-getOptions();
try {

  $translate-setOptions(array('reload' = true));

  $translate-addTranslation($options['data'], $language);
} catch (Zend_Translate_Exception
 $e) {}
}
// is it now available?
if ($translate-isAvailable($language)) {
$translate-setLocale($language);
}
}
}

 Also is it possible for Zend_Translate to read all translation sources in
 the directory instead of one?


 thomasW wrote:
 
  You should give some reproducable code from your side instead of code
 from
  ZF.
  Looking at your result you should ask yourself what you are doing that
 the
  nl files are read as en.
  Because Zend_Translate has no way to detect for which language the
 content
  of a file is when the directory or filename does not reflect this.
 
  Greetings
  Thomas Weidner, I18N Team Leader, Zend Framework
  http://www.thomasweidner.com
 
  - Original Message -
  From: ignace developer.ign...@gmail.com
  To: fw-general@lists.zend.com
  Sent: Wednesday, October 07, 2009 7:42 PM
  Subject: [fw-general] Zend_Translate  addTranslation
 
 
 
  Hi,
 
  I have a problem: Zend_Translate loads by default the browser's default
  language (in my case nl) Then through a navigation I can alter the
  language
  in which I want to see the website but it doesn't change it a closer
 look
  showed that Zend_Translate indeed retrieves the translation source as it
  outputs at some point:
 
  'en' = array
 'About us' = 'About us'
 
  'nl' = array
 'About us' = 'Over ons'
 
  But changes it later on to:
 
  'en' = array
 'About us' = 'Over ons'
 
  'nl' = array
 'About us' = 'Over ons'
 
  This process occurs in Zend_Translate_Adapter at lines 499 - 501 in
  version
  1.10.0dev The lines in question are:
 
  if (array_key_exists($key, $temp)  is_array($temp[$key])) {
 $this-_translate[$key] = $temp[$key] +
  $this-_translate[$key];
 }
  --
  View this message in context:
 
 http://www.nabble.com/Zend_Translate---addTranslation-tp25791169p25791169.html
  Sent from the Zend Framework mailing list archive at Nabble.com.
 
 
 

 --
 View this message in context:
 http://www.nabble.com/Zend_Translate---addTranslation-tp25791169p25793989.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] Zend_Translate addTranslation

2009-10-08 Thread ignace

I use Zend_Application and my Bootstrap class is currently empty
Zend_Translate is initialized through the config

resources.translate.data = APPLICATION_PATH /path/to/translation
resources.translate.adapter = csv

Best Regards,
Ignace


umpirsky wrote:
 
 How do you initialize Zend_Translate in your bootstrap?
 
 Regards,
 Saša Stamenković
 
 
 On Wed, Oct 7, 2009 at 10:38 PM, ignace developer.ign...@gmail.com
 wrote:
 

 Ok the code i used is:

 if ($this-_hasParam('language')) {
$language = $this-_getParam('language');
if ($bootstrap = $this-getInvokeArg('bootstrap'))
 {
$translateResource =
 $bootstrap-getPluginResource('Translate');
$translate =
 $translateResource-getTranslate();
if (!$translate-isAvailable($language)) {
$options =
 $translateResource-getOptions();
try {

  $translate-setOptions(array('reload' = true));

  $translate-addTranslation($options['data'], $language);
} catch (Zend_Translate_Exception
 $e) {}
}
// is it now available?
if ($translate-isAvailable($language)) {
$translate-setLocale($language);
}
}
}

 Also is it possible for Zend_Translate to read all translation sources in
 the directory instead of one?


 thomasW wrote:
 
  You should give some reproducable code from your side instead of code
 from
  ZF.
  Looking at your result you should ask yourself what you are doing that
 the
  nl files are read as en.
  Because Zend_Translate has no way to detect for which language the
 content
  of a file is when the directory or filename does not reflect this.
 
  Greetings
  Thomas Weidner, I18N Team Leader, Zend Framework
  http://www.thomasweidner.com
 
  - Original Message -
  From: ignace developer.ign...@gmail.com
  To: fw-general@lists.zend.com
  Sent: Wednesday, October 07, 2009 7:42 PM
  Subject: [fw-general] Zend_Translate  addTranslation
 
 
 
  Hi,
 
  I have a problem: Zend_Translate loads by default the browser's
 default
  language (in my case nl) Then through a navigation I can alter the
  language
  in which I want to see the website but it doesn't change it a closer
 look
  showed that Zend_Translate indeed retrieves the translation source as
 it
  outputs at some point:
 
  'en' = array
 'About us' = 'About us'
 
  'nl' = array
 'About us' = 'Over ons'
 
  But changes it later on to:
 
  'en' = array
 'About us' = 'Over ons'
 
  'nl' = array
 'About us' = 'Over ons'
 
  This process occurs in Zend_Translate_Adapter at lines 499 - 501 in
  version
  1.10.0dev The lines in question are:
 
  if (array_key_exists($key, $temp)  is_array($temp[$key])) {
 $this-_translate[$key] = $temp[$key] +
  $this-_translate[$key];
 }
  --
  View this message in context:
 
 http://www.nabble.com/Zend_Translate---addTranslation-tp25791169p25791169.html
  Sent from the Zend Framework mailing list archive at Nabble.com.
 
 
 

 --
 View this message in context:
 http://www.nabble.com/Zend_Translate---addTranslation-tp25791169p25793989.html
 Sent from the Zend Framework mailing list archive at Nabble.com.


 
 

-- 
View this message in context: 
http://www.nabble.com/Zend_Translate---addTranslation-tp25791169p25799363.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] external or untrusted authors for zend form config

2009-10-08 Thread Ralikwen

Hi,
The config file for ZF form seems to be a great way to allow untrusted users
to upload their forms.
It just seems a bit too powerful for that :)

Any idea what are the things I should disallow on such uploaded forms?
E.g.
- setting paths: addElementPrefixPath, addPrefixPath
- accessing functions: Zend_Validate_Callback
- accessing the db: Db_RecordExists and Db_NoRecordExists


Thx.
SWK
-- 
View this message in context: 
http://www.nabble.com/external-or-untrusted-authors-for-zend-form-config-tp25799496p25799496.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Removing BR from FormMultiCheckbox

2009-10-08 Thread Anders Gunnarsson


How do I remove the br/ between checkBoxes, using the multiCheckbox 
(Zend_Form_Element)?


Seems to be a rather unnecessary default anyway. I'd rather use css to 
handle the view.


regards
Anders


[fw-general] Using chained routes with a /admin prefix

2009-10-08 Thread vikram . melonfire
Hi all

I have a Module_NewsController with actions such as indexAction,
displayAction etc. This controller also includes some admin actions
which are prefixed with 'admin' ie. adminEditAction, adminDeleteAction
etc.

Using the default router, I am able to  access the public actions ie
/module/news/display. What I would like to do is add an admin/ prefix
to the default routes such that the route /admin/module/news/delete is
handled by the adminDeleteAction.

I know I can do this using custom routes, but since there are a number
of admin*Actions in the controller, I was wondering if I can somehow
use route chaining here? For example, can I set up a route chain for
/admin/module/*, such that routes beginning with this are
automatically transferred to the Module_NewsController? How do I map
the action names in this case?

Is this even possible, or have I misunderstood how route chains work?
Any advice would be appreciated. Alternate approaches would also be
welcome, my only constraint is that I'd like to have public routes as
/module/controller/action and admin routes as
/admin/module/controller/action.

TIA,

Vikram


RE: [fw-general] Re: [zf-contributors] Re: [fw-general] SimpleCloud API Proposals

2009-10-08 Thread Wil Sinclair
Matthew and I actually spoke with Daniel Lo and Justin Plock about this very 
issue before the announcement. We decided to leave room in Zend_Queue for 
additional features because there was a lot of feedback on the Zend_Queue 
proposal calling for more message-oriented features.

As Matthew (Weier O'Phinney) points out, Zend_Cloud_Queue was designed 
specifically for simple queues in the cloud, like SQS. Features that aren't 
common to most of these queue service offerings will not be supported in 
Zend_Cloud_Queue. We're actually planning to have a 
Zend_Cloud_Queue_Adapter_ZendQueue (the naming can- and probably should- be 
tweaked) adapter. This will provide support for local queues through 
Zend_Queue, which is important for 'offline' development for the cloud. We will 
probably write direct adapters from Zend_Cloud_Queue to 
Zend_Service_Amazon_Sqs, however.

As with all design decisions in the Simple Cloud API, we're open to new ideas. 
So if there is a better way to do this, throw it out there so we can discuss it.

This is a great discussion, and we should make sure it is added to the 
commentary on the proposal. I'll paste this response in a comment there. I'd 
appreciate it if everyone responded on the proposal instead of on the list so 
we can track these discussions and keep them in a place that someone new to ZF 
can find them.

,Wil

 -Original Message-
 From: Matthew Weier O'Phinney [mailto:matt...@zend.com]
 Sent: Wednesday, October 07, 2009 8:14 AM
 To: fw-general@lists.zend.com; zf-contribut...@lists.zend.com
 Subject: Re: [fw-general] Re: [zf-contributors] Re: [fw-general]
 SimpleCloud API Proposals
 
 -- Matthew Ratzloff m...@builtfromsource.com wrote
 (on Wednesday, 07 October 2009, 07:55 AM -0700):
  I think any queue class should follow the conventions set forth by
 Zend_Queue
  (by extending or implementing the appropriate adapter class).  This
 looks like
  a major oversight in Zend_Cloud_Queue's API.
 
 Not necessarily. Cloud queues tend to be more simplified and offer
 slightly fewer features than local queue systems. Trying to map the
 conventions of Zend_Queue -- which offers support for a broader variety
 of queue systems and hence features -- may not make sense.
 
 
  On Tue, Oct 6, 2009 at 7:44 AM, Matthew Weier O'Phinney
 matt...@zend.com
  wrote:
 
  -- Wil Sinclair w...@zend.com wrote
  (on Monday, 05 October 2009, 12:53 PM -0700):
   On Sept. 22, Zend launched the Simple Cloud API project:
 http://
   www.simplecloud.org
  
   This ambitious project makes cloud application services from
 vendors such
  as
   Amazon, Microsoft Azure, and Rackspace available through one
 API,
  bringing the
   platform portability that you expect from PHP to the cloud.
  
   I’m happy to announce that the proposals for
 Zend_Cloud_Storage,
   Zend_Cloud_Queue, and Zend_Cloud_Document are now ready for
 review.
  
   Please take a look at the proposals and leave any feedback you
 have.
 
  And for those who like to click links, you'll find them here:
 
   * Zend_Cloud_Document:
    http://framework.zend.com/wiki/display/ZFPROP/
  Zend_Cloud_Document+-+Wil+Sinclair
 
   * Zend_Cloud_Storage:
    http://framework.zend.com/wiki/display/ZFPROP/
  Zend_Cloud_Storage+-+Wil+Sinclair
 
   * Zend_Cloud_Queue:
    http://framework.zend.com/wiki/display/ZFPROP/
  Zend_Cloud_Queue+-+Wil+Sinclair
 
  --
  Matthew Weier O'Phinney
  Project Lead            | matt...@zend.com
  Zend Framework          | http://framework.zend.com/
 
 
 
 --
 Matthew Weier O'Phinney
 Project Lead| matt...@zend.com
 Zend Framework  | http://framework.zend.com/


[fw-general] Zend_Http_Client_Adapter_Curl fails handshake in https connection

2009-10-08 Thread Alberto Zanon

I need to connect to a remote server via https with mutual authentication.
This is the code:
$zendClient = new Zend_Http_Client('https://site url',
array(
'maxredirects' = 0,
'strict' = false,
'timeout' = 30,
'sslcert' = 'certificate name with key + certificate.pem',
'sslpassphrase' = 'password',
'adapter' = 'Zend_Http_Client_Adapter_Curl',
'curloptions' = array(CURLOPT_SSL_VERIFYPEER = false)
)
);

$zendClient-setHeaders(array(
list of custom headers
)
);

$zendClient-setRawData('row data');

$response = $zendClient-request('POST');

It results in this exception:
Error in cURL request: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3
alert handshake failure

If I execute curl from shell command line, it connects successfully. This
is the command line:
curl --cert certificate name.pem --cert-type PEM --data-binary 'post raw
data' --header 'header value' --include --insecure --key private
key.key --key-type PEM --pass password --show-error --verbose --url site
url

I use:
PHP 5.2.11
ZF 1.8.4
libcurl 7.19.6
OpenSSL 0.9.8b

Could you help me please?

Thanks in advance

Alberto
-- 
View this message in context: 
http://www.nabble.com/Zend_Http_Client_Adapter_Curl-fails-handshake-in-https-connection-tp25801770p25801770.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] newbie Auth problem

2009-10-08 Thread robos85

Hi, I'm starting to learn the Zend FM. I'm making some tutorials for 1.8 (i'm
using 1.9).
I stuck on error: Notice: Undefined property:
Zend_Auth_Storage_Session::$read in
C:\wamp\www\dziury\application\plugins\AccessCheck.php on line 18

Notice: Trying to get property of non-object in
C:\wamp\www\dziury\application\plugins\AccessCheck.php on line 19

My files:
Bootstrap.php:
?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initAutoload()
{
$modelLoader = new Zend_Application_Module_Autoloader(array(
'namespace' =  '',
'basePath'  =  
APPLICATION_PATH
));

$acl = new Model_LibraryAcl; // obiekt modelu do ACL potrzebny 
do
przekazania do pluginu
$auth = Zend_Auth::getInstance(); // obiekt modelu do AUTH 
potrzebny do
przekazania do pluginu

$fc = Zend_Controller_Front::getInstance(); // instancja - 
umożliwia
ładowanie pluginów
$fc-registerPlugin( new Plugin_AccessCheck($acl, $auth) ); // 
rejestruje
plugin. Przekazać 2 zmienne potrzebne do sprawdzenia

return $modelLoader;
}
}


plugins/AccessCheck.php:
class Plugin_AccessCheck extends Zend_Controller_Plugin_Abstract
{
private $_acl = null;
private $_auth = null;

public function __construct( Zend_Acl $acl, Zend_Auth $auth )
{
$this-_acl = $acl;
$this-_auth = $auth;
}

public function preDispatch( Zend_Controller_Request_Abstract $request )
// musimy poznać jaki aktualnie jest kontroler. Robimy to dzięki
Zend_Controller_Request_Abstract i przypisujemy do zmiennej $request
{
$resource = $request-getControllerName(); // nazwa kontrolera
$action = $request-getActionName(); // akcja

$identity = $this-_auth-getStorage()-read; // pobieramy i
odczytujemy dane z Auth odnośnie informacji o userze
$role = $identity-role; // pobranie roli. role to nazwa pola z bazy

if( !$this-_acl-isAllowed($role, $resource, $action) ) //
sprawdzenie zgodności z warunkami w modelu acl
{
$request-setControllerName('authentication') // ustawienie
nazwy kontrolera
-setActionName('login'); // ustawienie nazwy akcji

}
}
}

How to fix that?
-- 
View this message in context: 
http://www.nabble.com/newbie-Auth-problem-tp25802961p25802961.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] newbie Auth problem

2009-10-08 Thread David Mintz
2009/10/8 robos85 robo...@gmail.com


 Hi, I'm starting to learn the Zend FM. I'm making some tutorials for 1.8
 (i'm
 using 1.9).
 I stuck on error: Notice: Undefined property:
 Zend_Auth_Storage_Session::$read


Stop right there. It looks highly probable that you forgot the parentheses
followeding 'read'. That is, where you say $whatever-read, you need to say
$whatever-read(); PHP thinks you're trying to access a property rather than
call a method.

-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness


Re: [fw-general] Zend_Acl roles and permission on action

2009-10-08 Thread David Mintz
On Wed, Oct 7, 2009 at 6:58 PM, tomascejka dis.cejkato...@gmail.com wrote:


 I read about Acl and I think about roles and permisson and I want to ask if
 there is necessary make implementation on database layer. I mean persisting
 permissions with relations to roles strutured in tree structure.

 As I have read about Acl there is a possibility that it is not necessary to
 make another layer above Acl princip implemented in Zend_Acl.

 Can m


As I understand it, it is perfectly OK to write all your ACL rules in PHP
and load them at runtime, with no persistence involved. If, however, you
want to create an interface through which an administrator can manipulate
ACL rules interactively, you obviously will need persistence.

-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness


Re: [fw-general] Zend_Acl roles and permission on action

2009-10-08 Thread Ralph Schindler
As a side note, you may also find that by using the assertion system, 
you can create dynamic rules as assertions that will further lookup 
information from the database as needed.


Using this as a reference:
http://ralphschindler.com/2009/08/13/dynamic-assertions-for-zend_acl-in-zf

Imagine that inside assert(...), you call other methods of a *specific* 
User model object to check if they do indeed has the proper credentials 
to further do said privilege.


-ralph

David Mintz wrote:



On Wed, Oct 7, 2009 at 6:58 PM, tomascejka dis.cejkato...@gmail.com 
mailto:dis.cejkato...@gmail.com wrote:



I read about Acl and I think about roles and permisson and I want to
ask if
there is necessary make implementation on database layer. I mean
persisting
permissions with relations to roles strutured in tree structure.

As I have read about Acl there is a possibility that it is not
necessary to
make another layer above Acl princip implemented in Zend_Acl.

Can m


As I understand it, it is perfectly OK to write all your ACL rules in 
PHP and load them at runtime, with no persistence involved. If, however, 
you want to create an interface through which an administrator can 
manipulate ACL rules interactively, you obviously will need persistence.


--
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness


Re: [fw-general] ZF 1.9.3 and phpunit 3.4.0 zf_tool problem

2009-10-08 Thread Ladislav Prskavec
I think that was the same problem as http://www.phpunit.de/ticket/883 
and this ticket is now deleted from 3.4.1 problems with  reproduction


Regards

Ladislav


Marcello Duarte wrote:

Hi,

I have applied Raphael's patch from #ZF-7894 and the PHPUnit error in fact
is not showing anymore.

However now, no providers are recognized:

m...@groovy:~$ zf show version
   An Error Has Occurred
 Action 'show' is not a valid action.   


Zend Framework Command Line Console Tool v1.9.3

And Ladislav, what is the bug id for PHPUnit?

Cheers,
Marcello


Raphael Stolt-2 wrote:
  

Hi Benjamin,

Can you provide some tips on how to catch if PHPUnit 3.4.0 is twice in the
include_path and on how to remove it it this is the case? As I had the
same
problem and after reverting to one release before PHPUnit 3.4.0 the
problem
was gone.

Cheers,

Raphael

2009/9/22 Benjamin Eberlei kont...@beberlei.de



do you have phpunit on your include path twice?

On Tue, 22 Sep 2009 18:06:15 +0200, Ladislav Prskavec
ladis...@prskavec.net wrote:
  

If run zf tool:

 zf version

Fatal error: Cannot redeclare class
phpunit_framework_testsuite_dataprovider in



/usr/local/zend/share/pear/PEAR/PHPUnit/Framework/TestSuite/DataProvider.php
  

on line 64

Using Ubuntu 9.04 with Zend Server CE 4.0.5 (php 5.2.10, tested zf


1.9.2
  

and 1.9.3 )

Ladislav




  



--
Ing. Ladislav Prskavec
E-mail: ladislav.prska...@gmail.com
Tel. / Phone: +420 604 419 262
Blog: http://blog.prskavec.net
LinkedIn: http://www.linkedin.com/in/ladislavprskavec
Twitter: http://twitter.com/abtris/



Re: [fw-general] ZF 1.9.3 and phpunit 3.4.0 zf_tool problem

2009-10-08 Thread Ladislav Prskavec

Now, i'm make new ticket for this problem http://www.phpunit.de/ticket/898



Ladislav Prskavec wrote:
I think that was the same problem as http://www.phpunit.de/ticket/883 
and this ticket is now deleted from 3.4.1 problems with  reproduction


Regards

Ladislav



--
Ing. Ladislav Prskavec
E-mail: ladislav.prska...@gmail.com
Tel. / Phone: +420 604 419 262
Blog: http://blog.prskavec.net
LinkedIn: http://www.linkedin.com/in/ladislavprskavec
Twitter: http://twitter.com/abtris/



Re: [fw-general] Removing BR from FormMultiCheckbox

2009-10-08 Thread Hector Virgen
You can pass in a different separator when creating your element.
$this-addElement('multiCheckbox', 'my_checkboxes', array(
'separator' = PHP_EOL
));

Or afterwards if necessary:

$multiCheckboxElement-setSeparator(PHP_EOL);

--
Hector


On Thu, Oct 8, 2009 at 12:24 AM, Anders Gunnarsson and...@metropolis.sewrote:


 How do I remove the br/ between checkBoxes, using the multiCheckbox
 (Zend_Form_Element)?

 Seems to be a rather unnecessary default anyway. I'd rather use css to
 handle the view.

 regards
 Anders



[fw-general] Auto escape all variables in View

2009-10-08 Thread admirau

Has anyone here already created custom View,
which escapes all variables by default?

Willing to share?

-- 
regards
takeshin
-- 
View this message in context: 
http://www.nabble.com/Auto-escape-all-variables-in-View-tp25803270p25803270.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] post-login, redirecting back to where they came from

2009-10-08 Thread David Mintz
Let's say you have a front controller plugin with a preDispatch method that
looks at the module/action/controller, checks if
Zend_Auth::getInstance()-hasIdentity(), and resets the
module/action/controller to default/users/login if appropriate.

How do you save the initial request URI and redirect following a successful
login? I can think of two techniques: (1) save it in the session or (2)
stuff it in the login form as a hidden field and let it go along for the
ride.

Any suggestions as to which is preferable, or other alternatives?

-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness


Re: [fw-general] Auto escape all variables in View

2009-10-08 Thread David Mintz
On Thu, Oct 8, 2009 at 12:02 PM, admirau admi...@gmail.com wrote:


 Has anyone here already created custom View,
 which escapes all variables by default?

 Willing to share?


Or imagine a Zend_View whose constructor took an option autoEscape = true,
true by default. Hmmm



-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness


Re: [fw-general] post-login, redirecting back to where they came from

2009-10-08 Thread Hector Virgen
I found it better to use a $_GET parameter for this. This allows you to
create hyperlinks out of the URL that redirects the user to a specific page
after logging in.

--
Hector


On Thu, Oct 8, 2009 at 1:25 PM, David Mintz da...@davidmintz.org wrote:

 Let's say you have a front controller plugin with a preDispatch method that
 looks at the module/action/controller, checks if
 Zend_Auth::getInstance()-hasIdentity(), and resets the
 module/action/controller to default/users/login if appropriate.

 How do you save the initial request URI and redirect following a successful
 login? I can think of two techniques: (1) save it in the session or (2)
 stuff it in the login form as a hidden field and let it go along for the
 ride.

 Any suggestions as to which is preferable, or other alternatives?

 --
 David Mintz
 http://davidmintz.org/

 The subtle source is clear and bright
 The tributary streams flow through the darkness



Re: [fw-general] post-login, redirecting back to where they came from

2009-10-08 Thread David Mintz
On Thu, Oct 8, 2009 at 4:28 PM, Hector Virgen djvir...@gmail.com wrote:

 I found it better to use a $_GET parameter for this. This allows you to
 create hyperlinks out of the URL that redirects the user to a specific page
 after logging in.



Not sure I follow. You would put this GET parameter... where? Append it to
the login form's action attribute (url-encoding any slashes in the URI you
want to redirect to)? How's that different from putting in a hidden field,
ultimately?


-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness


Re: [fw-general] post-login, redirecting back to where they came from

2009-10-08 Thread Hector Virgen
The URL would look something like this:
/login?to=/dashboard

I also experimented with a hidden field but I ended up switching to using
the $_GET parameter because it gave me flexibility to create hyperlinks:

a href=/login?to=/dashboardLogin To Dashboard/a
a href=/login?to=/profileLogin To Profile/a

The hidden field would also work if you use $this-_request-getParam('to'),
so it's up to when it comes to the controller plugin redirect.

Also, I suggest storing the 'to' param in the session (from within your
AuthController) in case the user supplies a bad password. This way you don't
lose the parameter in case they fail to log in on the first attempt.

--
Hector


On Thu, Oct 8, 2009 at 2:20 PM, David Mintz da...@davidmintz.org wrote:



 On Thu, Oct 8, 2009 at 4:28 PM, Hector Virgen djvir...@gmail.com wrote:

 I found it better to use a $_GET parameter for this. This allows you to
 create hyperlinks out of the URL that redirects the user to a specific page
 after logging in.



  Not sure I follow. You would put this GET parameter... where? Append it to
 the login form's action attribute (url-encoding any slashes in the URI you
 want to redirect to)? How's that different from putting in a hidden field,
 ultimately?



 --
 David Mintz
 http://davidmintz.org/

 The subtle source is clear and bright
 The tributary streams flow through the darkness



Re: [fw-general] post-login, redirecting back to where they came from

2009-10-08 Thread Micah Gersten
You can accomplish the same thing by just storing the initial page in a
session variable (Zend_Session).  The links can be the same links, but
the user should be redirected to login if they have not already.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Hector Virgen wrote:
 The URL would look something like this:

 /login?to=/dashboard

 I also experimented with a hidden field but I ended up switching to
 using the $_GET parameter because it gave me flexibility to create
 hyperlinks:

 a href=/login?to=/dashboardLogin To Dashboard/a
 a href=/login?to=/profileLogin To Profile/a

 The hidden field would also work if you use
 $this-_request-getParam('to'), so it's up to when it comes to the
 controller plugin redirect.

 Also, I suggest storing the 'to' param in the session (from within
 your AuthController) in case the user supplies a bad password. This
 way you don't lose the parameter in case they fail to log in on the
 first attempt.

 --
 Hector


 On Thu, Oct 8, 2009 at 2:20 PM, David Mintz da...@davidmintz.org
 mailto:da...@davidmintz.org wrote:



 On Thu, Oct 8, 2009 at 4:28 PM, Hector Virgen djvir...@gmail.com
 mailto:djvir...@gmail.com wrote:

 I found it better to use a $_GET parameter for this. This
 allows you to create hyperlinks out of the URL that redirects
 the user to a specific page after logging in. 



 Not sure I follow. You would put this GET parameter... where?
 Append it to the login form's action attribute (url-encoding any
 slashes in the URI you want to redirect to)? How's that different
 from putting in a hidden field, ultimately?



 -- 
 David Mintz
 http://davidmintz.org/

 The subtle source is clear and bright
 The tributary streams flow through the darkness




Re: [fw-general] post-login, redirecting back to where they came from

2009-10-08 Thread Hector Virgen
That's a good point. I like that better :)

--
Hector


On Thu, Oct 8, 2009 at 2:43 PM, Micah Gersten mi...@onshore.com wrote:

  You can accomplish the same thing by just storing the initial page in a
 session variable (Zend_Session).  The links can be the same links, but the
 user should be redirected to login if they have not already.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developerhttp://www.onshore.com



 Hector Virgen wrote:

 The URL would look something like this:
  /login?to=/dashboard

  I also experimented with a hidden field but I ended up switching to using
 the $_GET parameter because it gave me flexibility to create hyperlinks:

  a href=/login?to=/dashboardLogin To Dashboard/a
 a href=/login?to=/profileLogin To Profile/a

  The hidden field would also work if you use
 $this-_request-getParam('to'), so it's up to when it comes to the
 controller plugin redirect.

  Also, I suggest storing the 'to' param in the session (from within your
 AuthController) in case the user supplies a bad password. This way you don't
 lose the parameter in case they fail to log in on the first attempt.

 --
 Hector


 On Thu, Oct 8, 2009 at 2:20 PM, David Mintz da...@davidmintz.org wrote:



 On Thu, Oct 8, 2009 at 4:28 PM, Hector Virgen djvir...@gmail.com wrote:

 I found it better to use a $_GET parameter for this. This allows you to
 create hyperlinks out of the URL that redirects the user to a specific page
 after logging in.



   Not sure I follow. You would put this GET parameter... where? Append it
 to the login form's action attribute (url-encoding any slashes in the URI
 you want to redirect to)? How's that different from putting in a hidden
 field, ultimately?


 --
 David Mintz
 http://davidmintz.org/

 The subtle source is clear and bright
 The tributary streams flow through the darkness





[fw-general] Is the book Is Zend Framework: The Off icial Programmer’s Reference Guide based on ZF v1.9?

2009-10-08 Thread swilhelm

Is the 
http://www.amazon.com/exec/obidos/tg/detail/-/1430219068/ref=ord_cart_shr?_encoding=UTF8m=ATVPDKIKX0DERv=glance
book , Zend Framework: The Official Programmer's Reference Guide base on ZF
1.9?

- Steve W.
-- 
View this message in context: 
http://www.nabble.com/Is-the-book-Is-%22Zend-Framework%3A-The-Official-Programmer%E2%80%99s-Reference-Guide%22-based-on-ZF-v1.9--tp25813410p25813410.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Acl roles and permission on action

2009-10-08 Thread Hector Virgen
I've been trying out the changes in Zend_Acl and this is a major
improvement. Thanks!
One thing I'm having trouble with -- is it possible to create an allow
rule that uses an assertion for *all* privileges?

For example, I can create a rule like this:

$acl = new Zend_Acl();
$acl-allow(null, null, 'edit', new MyAssertion());
$allowed = $acl-isAllowed($member, $exam, 'edit');

As expected, Zend_Acl will call the assert() method on the MyAssertion
object and I can test for edit permissions.

However, I want the assertion to be called for any privilege on a specific
role/resource combination. So I wrote my rule like this:

$acl = new Zend_Acl();
$acl-allow('member', 'exam', null, new MyAssertion());
$allowed = $acl-isAllowed($member, $exam, 'edit');

With the above code the privilege passed to the assertion is null, when I
was expecting it to be edit (as called in $acl-isAllowed());

It seems the workaround would be to explicitly provide all of the privileges
in an array:

$acl = new Zend_Acl();
$acl-allow('member', 'exam', array('edit', 'view', [etc.]), new
MyAssertion());
$allowed = $acl-isAllowed($member, $exam, 'edit');

Is this normal or should I file a bug report?

--
Hector


On Thu, Oct 8, 2009 at 7:31 AM, Ralph Schindler ralph.schind...@zend.comwrote:

 As a side note, you may also find that by using the assertion system, you
 can create dynamic rules as assertions that will further lookup information
 from the database as needed.

 Using this as a reference:
 http://ralphschindler.com/2009/08/13/dynamic-assertions-for-zend_acl-in-zf

 Imagine that inside assert(...), you call other methods of a *specific*
 User model object to check if they do indeed has the proper credentials to
 further do said privilege.

 -ralph

 David Mintz wrote:



 On Wed, Oct 7, 2009 at 6:58 PM, tomascejka dis.cejkato...@gmail.commailto:
 dis.cejkato...@gmail.com wrote:


I read about Acl and I think about roles and permisson and I want to
ask if
there is necessary make implementation on database layer. I mean
persisting
permissions with relations to roles strutured in tree structure.

As I have read about Acl there is a possibility that it is not
necessary to
make another layer above Acl princip implemented in Zend_Acl.

Can m


 As I understand it, it is perfectly OK to write all your ACL rules in PHP
 and load them at runtime, with no persistence involved. If, however, you
 want to create an interface through which an administrator can manipulate
 ACL rules interactively, you obviously will need persistence.

 --
 David Mintz
 http://davidmintz.org/

 The subtle source is clear and bright
 The tributary streams flow through the darkness




[fw-general] Zend_Controller_Router_Route_Regex mapping fails when using optional parameters

2009-10-08 Thread frank.quosdorf

In config.ini, the following route has been set up:

routes.verified.type = Zend_Controller_Router_Route_Regex
routes.verified.route = ([a-z]{2})_([A-Z]{2})/verified/(.+)(/(\d+))?
routes.verified.defaults.module = verified
routes.verified.defaults.controller = index
routes.verified.defaults.action = index
routes.verified.defaults.page = 1
routes.verified.map.1 = language
routes.verified.map.2 = region
routes.verified.map.3 = routeCaption
routes.verified.map.4 = page
routes.verified.reverse = %s_%s/verified/%s/%d

The last part of the route ( /[any number] ) is optional.

When requesting http://domain.com/en_GB/verified/what-does-this-mean without
the optional parameter ( /[any number] ), parameters are properly mapped:

Param: language: en
Param: region: GB
Param: routeCaption: what-does-this-mean
Param: module: verified
Param: controller: index
Param: action: index
Param: page: 1

But, when requesting the complete route as in
http://domain.com/en_GB/verified/find-items/1 with the optional parameter (
/1 ) given, the router does map the parameters as follows:

Param: language: en
Param: region: GB
Param: routeCaption: Find-courses/1
Param: module: verified
Param: controller: index
Param: action: index
Param: page: 1

Apparently, parameters 3 and 4 (even including the slash in between) are
mapped into one request parameter (routeCaption) which is not the desired
result.

What am I doing wrong?
-- 
View this message in context: 
http://www.nabble.com/Zend_Controller_Router_Route_Regex-mapping-fails-when-using-optional-parameters-tp25815360p25815360.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Is the book Is Zend Framework: The Official Programmer ’s Reference Guide based on ZF v1.9?

2009-10-08 Thread Ralph Schindler

This is not an official response, as I would have to find confirmation.

If I had to guess, it was based on 1.8 strickly looking at the release 
date, and what I know about publishing timelines.  Either way, this is a 
good thing.  1.8 offered up Zend_Application, which IMO rounds out what 
a proper project (MVC based application should look and act like). The 
1.9 features, which while awesome, you can certainly catch up on by 
reading the online documentation.


Either way, I'll ask around and find out exactly what its based on.

-ralph

swilhelm wrote:
Is the 
http://www.amazon.com/exec/obidos/tg/detail/-/1430219068/ref=ord_cart_shr?_encoding=UTF8m=ATVPDKIKX0DERv=glance

book , Zend Framework: The Official Programmer's Reference Guide base on ZF
1.9?

- Steve W.