2011年3月9日星期三

AW: [fw-webservices] Zend_Soap_AutoDiscover bug

Hi Omar,

can you see the "extra content" by requesting the wsdl file directly?
http://localhost/architecture/applications/security/public/ws/Security.php?wsdl

How do you call the Webservice? Native SoapClient or with Zend_Soap?

Maybe this bugreport describes your problem: http://bugs.php.net/bug.php?id=48216 (Read the user comments).

Like Richard already wrote, we need more info to help.

Regards,
Thorsten Ruf

> -----Ursprüngliche Nachricht-----
> Von: Richard Quadling [mailto:rquadling@gmail.com]
> Gesendet: Mittwoch, 9. März 2011 14:07
> An: Ing. Omar Antonio Díaz Peña
> Cc: fw-webservices@lists.zend.com
> Betreff: Re: [fw-webservices] Zend_Soap_AutoDiscover bug
>
> 2011/3/5 Ing. Omar Antonio Díaz Peña <oadiaz@uci.cu>:
> > Hi:
> >
> >
> >
> > I'm traying to publish a WSDL-based WebService using
> Zend_Soap_AutoDiscover,
> > I've made my own class and managed the requests for making all works
> well
> > but when I'm trying to use this WS from another PHP application I
> receive
> > this error: "SOAP-ERROR: Parsing WSDL: Couldn't load from
> >
> 'http://localhost/architecture/applications/security/public/ws/Security
> .php?
> > wsdl' : Extra content at the end of the document". The most estrange
> part is
> > its only happens in Windows platform because I've tested the same
> code in
> > Ubuntu Server and works as I expect.
> >
> >
> >
> > Excuse me for my English.
> >
> >
> >
> > Regards
> >
> > Omar
> >
> >
> >
> >
>
> Can you provide a link to the live WSDL please? If you don't want to
> do this on list, then off list for me is fine.
>
> You can see from my posts on http://news.php.net/php.soap that I'll
> help. And if I mess up, please be shout about it. Conversely, if I
> help ...
>
> Richard.
>
> --
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

Re: [fw-webservices] Zend_Soap_AutoDiscover bug

2011/3/5 Ing. Omar Antonio Díaz Peña <oadiaz@uci.cu>:
> Hi:
>
>
>
> I'm traying to publish a WSDL-based WebService using Zend_Soap_AutoDiscover,
> I've made my own class and managed the requests for making all works well
> but when I'm trying to use this WS from another PHP application I receive
> this error: "SOAP-ERROR: Parsing WSDL: Couldn't load from
> 'http://localhost/architecture/applications/security/public/ws/Security.php?
> wsdl' : Extra content at the end of the document". The most estrange part is
> its only happens in Windows platform because I've tested the same code in
> Ubuntu Server and works as I expect.
>
>
>
> Excuse me for my English.
>
>
>
> Regards
>
> Omar
>
>
>
>

Can you provide a link to the live WSDL please? If you don't want to
do this on list, then off list for me is fine.

You can see from my posts on http://news.php.net/php.soap that I'll
help. And if I mess up, please be shout about it. Conversely, if I
help ...

Richard.

--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

Re: [fw-db] Programmatically Clear Metadata Cache?

> You can save cache to registry or get it from bootstrap as it is the same
> instance as in table if that comes handy for you.

Also consider using Zend_Cache_Manager as a resource bootstrappable via application.ini, as you can retrieve the cache from there, too (especially if you have more than one cache instance).


Says: Andreas.

2011年3月8日星期二

Re: [fw-db] Programmatically Clear Metadata Cache?

You can save cache to registry or get it from bootstrap as it is the same
instance as in table if that comes handy for you.
---
Regards,
Saša Stamenković


On Tue, Mar 8, 2011 at 7:49 PM, JB Christy <jbchristy@pacbell.net> wrote:

> Thanks for your helpful reply. Hopefully I can figure out how to call that
> $table->getDefaultMetadataCache()->clean() at the right time / in the
> right context.
>
> -JB
>
>
> ------------------------------
> *From:* Саша Стаменковић <umpirsky@gmail.com>
>
> *To:* JBChristy <JBChristy@pacbell.net>
> *Cc:* fw-db@lists.zend.com
> *Sent:* Mon, March 7, 2011 10:57:20 PM
>
> *Subject:* Re: [fw-db] Programmatically Clear Metadata Cache?
>
> You can set table metadata cache with
>
> $cache = Zend_Cache::factory(...);
> Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
>
> and clear cache with
>
> $cache->clean(...);
>
> when the metadata changes.
>
> ---
> Regards,
> Saša Stamenković
>
>
> On Mon, Mar 7, 2011 at 10:40 PM, JBChristy <JBChristy@pacbell.net> wrote:
>
>> I've just up automatic (mem)caching of all Zend_DB_Table's. From time to
>> time, of course, the metadata changes. We do this in our production
>> environment by running sql scripts that add / drop / change columns as
>> necessary. I need some programmatic way to expire the metadata cache after
>> the sql runs, and no later than when updated code goes live, which is a
>> matter of minutes. I can't just wait til it times out.
>>
>> I've dug into Zend 1.11 Zend_Db_Table_Abstract, and the memcache key is an
>> md5 encoding of an optional port, optional host, dbname, schema name and
>> table name. There does not appear to be member function to expire the
>> cache,
>> nor even a function to return the md5 encoded key so I can delete it
>> manually.
>>
>> How are we supposed to clear the metadata cache when the metadata changes?
>>
>> Thanks in advance for your help!
>>
>> --
>> View this message in context:
>> http://zend-framework-community.634137.n4.nabble.com/Programmatically-Clear-Metadata-Cache-tp3340068p3340068.html
>> Sent from the Zend DB mailing list archive at Nabble.com.
>>
>
>

Re: [fw-db] Programmatically Clear Metadata Cache?

Thanks for your helpful reply. Hopefully I can figure out how to call that
$table->getDefaultMetadataCache()->clean() at the right time / in the right
context.

-JB

________________________________
From: Саша Стаменковић <umpirsky@gmail.com>
To: JBChristy <JBChristy@pacbell.net>
Cc: fw-db@lists.zend.com
Sent: Mon, March 7, 2011 10:57:20 PM
Subject: Re: [fw-db] Programmatically Clear Metadata Cache?

You can set table metadata cache with

$cache = Zend_Cache::factory(...);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);

and clear cache with

$cache->clean(...);

when the metadata changes.

---
Regards,
Saša Stamenković

On Mon, Mar 7, 2011 at 10:40 PM, JBChristy <JBChristy@pacbell.net> wrote:

I've just up automatic (mem)caching of all Zend_DB_Table's. From time to
>time, of course, the metadata changes. We do this in our production
>environment by running sql scripts that add / drop / change columns as
>necessary. I need some programmatic way to expire the metadata cache after
>the sql runs, and no later than when updated code goes live, which is a
>matter of minutes. I can't just wait til it times out.
>
>I've dug into Zend 1.11 Zend_Db_Table_Abstract, and the memcache key is an
>md5 encoding of an optional port, optional host, dbname, schema name and
>table name. There does not appear to be member function to expire the cache,
>nor even a function to return the md5 encoded key so I can delete it
>manually.
>
>How are we supposed to clear the metadata cache when the metadata changes?
>
>Thanks in advance for your help!
>
>--
>View this message in context:
>http://zend-framework-community.634137.n4.nabble.com/Programmatically-Clear-Metadata-Cache-tp3340068p3340068.html
>
>Sent from the Zend DB mailing list archive at Nabble.com.
>

2011年3月7日星期一

Re: [fw-db] Programmatically Clear Metadata Cache?

You can set table metadata cache with

$cache = Zend_Cache::factory(...);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);

and clear cache with

$cache->clean(...);

when the metadata changes.

---
Regards,
Saša Stamenković


On Mon, Mar 7, 2011 at 10:40 PM, JBChristy <JBChristy@pacbell.net> wrote:

> I've just up automatic (mem)caching of all Zend_DB_Table's. From time to
> time, of course, the metadata changes. We do this in our production
> environment by running sql scripts that add / drop / change columns as
> necessary. I need some programmatic way to expire the metadata cache after
> the sql runs, and no later than when updated code goes live, which is a
> matter of minutes. I can't just wait til it times out.
>
> I've dug into Zend 1.11 Zend_Db_Table_Abstract, and the memcache key is an
> md5 encoding of an optional port, optional host, dbname, schema name and
> table name. There does not appear to be member function to expire the
> cache,
> nor even a function to return the md5 encoded key so I can delete it
> manually.
>
> How are we supposed to clear the metadata cache when the metadata changes?
>
> Thanks in advance for your help!
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Programmatically-Clear-Metadata-Cache-tp3340068p3340068.html
> Sent from the Zend DB mailing list archive at Nabble.com.
>

[fw-db] Programmatically Clear Metadata Cache?

I've just up automatic (mem)caching of all Zend_DB_Table's. From time to
time, of course, the metadata changes. We do this in our production
environment by running sql scripts that add / drop / change columns as
necessary. I need some programmatic way to expire the metadata cache after
the sql runs, and no later than when updated code goes live, which is a
matter of minutes. I can't just wait til it times out.

I've dug into Zend 1.11 Zend_Db_Table_Abstract, and the memcache key is an
md5 encoding of an optional port, optional host, dbname, schema name and
table name. There does not appear to be member function to expire the cache,
nor even a function to return the md5 encoded key so I can delete it
manually.

How are we supposed to clear the metadata cache when the metadata changes?

Thanks in advance for your help!

--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Programmatically-Clear-Metadata-Cache-tp3340068p3340068.html
Sent from the Zend DB mailing list archive at Nabble.com.

[fw-webservices] Using Http Auth with a class that extends Zend_Service_Abstract

Hi there,

I have some troubles with an home-made Url Shortener using Digest HTTP
Auth for authentication.

The problem is my shortener use a Zend_Rest_Client to forward his query,
and that Rest Client extends Zend_Service_Abstract. And
Zend_Service_Abstract share his Http Client with all of it's subclasses
(getter and setter are final static methods too...).

So, if I give credentials to the HTTP Client Adapter, I must reset them
after each call to the shorten method, or I could send them to another
Web Server which is clearly not what I want.

I see that the problem seems to be solved in the actual ZF2
AbstractService, so I think this behavior is no longer wanted.

Do you have any idea of how I could avoid this annoying credentials
reset after each request ? Without changing my Web Service
authentication, of course...

Thanks for help,
Lucas

[fw-server] Re: How to move app fron Zend Server CE to another LAMP?

thx a lot
everything works nice now
thx again

--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-to-move-app-from-Zend-Server-CE-to-another-LAMP-tp3337679p3339236.html
Sent from the Zend Server mailing list archive at Nabble.com.

Re: [fw-server] Re: How to move app fron Zend Server CE to another LAMP?

If you see default apache 404 page, then most likely mod_rewrite is not
configured properly.

regards
Petar

On 03/07/2011 03:48 PM, Mr.Kilmister wrote:
> Yes, it is,
> And even the website is launched, but only partly :(
> I have 4 elements:
> - paginator, to find data, it works fine
> - accordion, to find details, works good
>
> but I also have a view helper:
>
> layout.phtml
> <?php echo $this->login(); ?>
>
> Login.php
> <?php
> class Application_View_Helper_Login extends Zend_View_Helper_Abstract
> {
> public function login()
> {
> $output = null;
> if (Zend_Auth::getInstance()->hasIdentity()) {
> $output = '
>
>
> "' . $this- view->url(
> array(
> 'controller' => 'auth',
> 'action' => 'logout'
> ),
> 'default',
> true) . '">logout
>
> ';
> } else {
> $output = '
>
>
> "' . $this- view->url(
> array(
> 'controller' => 'auth',
> 'action' => 'login'
> ),
> 'default',
> true) . '">login
>
> ';
> }
> return $output;
> }
> }
>
> It prints out an error:
>
> Not Found
> The requested URL /auth/login was not found on this server.
> Apache/2.2.16 (Ubuntu) Server at 127.0.0.1 Port 80
>
> (After login it will be the last part wiht ajax...)
>
> What's wrong?
> Could you help me, please?
>
> --
> View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-to-move-app-from-Zend-Server-CE-to-another-LAMP-tp3337679p3338993.html
> Sent from the Zend Server mailing list archive at Nabble.com.
>
>

[fw-server] Re: How to move app fron Zend Server CE to another LAMP?

Yes, it is,
And even the website is launched, but only partly :(
I have 4 elements:
- paginator, to find data, it works fine
- accordion, to find details, works good

but I also have a view helper:

layout.phtml
<?php echo $this->login(); ?>

Login.php
<?php
class Application_View_Helper_Login extends Zend_View_Helper_Abstract
{
public function login()
{
$output = null;
if (Zend_Auth::getInstance()->hasIdentity()) {
$output = '

"' . $this- view->url(
array(
'controller' => 'auth',
'action' => 'logout'
),
'default',
true) . '">logout

';
} else {
$output = '

"' . $this- view->url(
array(
'controller' => 'auth',
'action' => 'login'
),
'default',
true) . '">login

';
}
return $output;
}
}

It prints out an error:

Not Found
The requested URL /auth/login was not found on this server.
Apache/2.2.16 (Ubuntu) Server at 127.0.0.1 Port 80

(After login it will be the last part wiht ajax...)

What's wrong?
Could you help me, please?

--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-to-move-app-from-Zend-Server-CE-to-another-LAMP-tp3337679p3338993.html
Sent from the Zend Server mailing list archive at Nabble.com.

Re: [fw-mvc] Zend framework ACL - newbie help needed

Hi all,
Sorry to bother but I didn't receive a reply to the below - just wondering if
anyone can help me out? It is regarding Zend Acl and a simple method to learn
how to use this.

Matthew your reply is definitely useful but I am having trouble putting it all
together as explained in my latest reply below :(

Help!

Thanks,
Rishi


________________________________
From: Rishi Daryanani <rishijd@yahoo.com>
To: Matthew Weier O'Phinney <matthew@zend.com>; fw-mvc@lists.zend.com
Sent: Wed, March 2, 2011 7:20:02 PM
Subject: Re: [fw-mvc] Zend framework ACL - newbie help needed

Hi Matthew,

Thanks veyr much for your reply. I have a few questions, and we are having
trouble setting it up so I'll write that here as well:

Regarding $identity in your example - this is using Zend Auth as you said. For
now, I don't want to go into Zend Auth until I understand how to perform a
simple task on Zend Acl ;) Your examples have used $identity but if you think it

does simplify it please let me know, otherwise for now I am trying it without
the user of Zend Auth, as we are simply logging in the user with their username
+ user group ID (1, 2, or 3).
Further details:

* I was able to make the Zend_Acl object

But below parts are still unclear to me.
* Add roles to the Zend_Acl object
* Add resources to the Zend_Acl object
How can I match these roles with the currently existing users in my database?
For example I have following groups in my database.

1 Administrator
2 Regional Administrator
3 Content Manager

Basically, the above groups are "roles" . Administrator will have all privileges

in my CMS.

* Add resources to the Zend_Acl object
This is also not entirely clear to me. Should these be in the controller?
Eg-
http://framework.zend.com/wiki/pages/viewpage.action?pageId=39025#Zend_Acl%26MVCIntegration-AldemarBernal-4.DependenciesonOtherFrameworkComponents


$acl->add(new Zend_Acl_Resource('news')) (is "news" a controller? In where are
we defining the behavior of the $acl->add()? Is this inbuilt?)

Below is the the code I'm currently using. In the bootstrap.php :

Helper - library/My/Controller/Helper/
Plugin - library/My/Controller/Plugin/

/** Creating the ACL object */
require_once 'Zend/Acl.php';
$acl = new Zend_Acl();

/** Creating the Role object */
require_once 'Zend/Acl/Role.php';
$acl->addRole(new Zend_Acl_Role('staff'));
$acl->addRole(new Zend_Acl_Role('member'));


/**
* Creating resources:
* - News Controller
* Creating privileges:
* - Allow defaultRole to access news controller
* - Deny defaultRole to access add action of news controller
*/
require_once 'Zend/Acl/Resource.php';
$acl->add(new Zend_Acl_Resource('admin'))
->allow('staff', 'admin')
->deny('staff', 'admin', 'reports');


/** Registering the Plugin object */
//require_once 'Zend/Controller/Plugin/Acl.php';
//$front->registerPlugin(new Zend_Controller_Plugin_Acl($acl));


/* OK, do your stuff, front controller */
$frontController->dispatch();


I realise I need to go through the above again, but I'd like to post out a few
questions:

i) Are "plugin" files required? The link above mentions that we should upload a
certain ACL plugin + helper. Other tutorials mention this too. Is this correct?

ii) Because my boot strap has routes for the CMS ("AdminController") and front
end ("IndexController"), can I only define roles and resources within my CMS /
AdminController? Or must this kind of code be in the bootstrap.php file?

iii) I understand the concept - that a 'resource' (say, the reporting module in
the CMS) needs to be defined. A bunch of 'roles' also would be defined, i.e.
user groups ("AdministratorRole" would get all rights, and "ContentManagerRole"
would get a few rights).
Then, when I am actually at the controller action for my 'reporting module' for
example, what code do I put in to tell ZF that "we are in the reporting module
resource, so check the logged in user's rights and grant access if permitted"?

Many thanks,
Rishi


________________________________
From: Matthew Weier O'Phinney <matthew@zend.com>
To: fw-mvc@lists.zend.com
Sent: Mon, February 28, 2011 10:07:18 PM
Subject: Re: [fw-mvc] Zend framework ACL - newbie help needed

-- Rishi Daryanani <rishijd@yahoo.com> wrote
(on Monday, 28 February 2011, 06:06 AM -0800):
> I'm very new to ACL and it's not something we've tried below. Any guidance
>would
>
> be appreciated; I'm going to start with code experimentation but would like to


> know if I'm on the right track.
>
>
> We are using a custom developed CMS which is using ZF", and we have our front
> end website as well. The CMS uses a controller called "AdminController", and
>the
>
> front end only uses a controller called "IndexController". I want to introduce


> access control to this CMS. Therefore some user groups will be restricted to
> some areas of the CMS.
>
> Current potential solution :
>
> I'm thinking of achieving this functionality as described below.
>
> 1. Have a database table to store the type of the user.
> 2. Have a separate table to store the pages the user is allowed or not allowed.
>
>
> 3. Check in each page whether the user have the access or not and display the
> page accordingly.
>
> Which is the best way to implement this using Zend framework? "Zend_Auth" or
> "Zend_Acl" ?

Zend_Auth is used for authentication of a user; i.e., evaluating the
provided credentials to determine identity.

Zend_Acl is used for authorization; i.e., to determine whether a given
user has the rights to access a given resource.

What you describe above is the realm of Zend_Acl.

> I have looked in to the "Zend_Acl" and it sounds good, however
> could someone guide me - what is the procedure for implementing this? Here are


> the links I found:
> http://framework.zend.com/manual/en/zend.acl.introduction.html
> http://framework.zend.com/wiki/pages/viewpage.action?pageId=39025

The basic workflow is:

* Create a Zend_Acl object
* Add roles to the Zend_Acl object
* Add resources to the Zend_Acl object
* Create the permissions

Now, that said, there are a variety of ways to do this. You can do it
up-front -- i.e., define all roles, resources, and permissions in a
given object or in your bootstrap. If you have only a handful of ACLs to
create, this is a straight-forward approach.

Another approach is to add them as you need them.

As an example, when you grab the user identity during login or later
from the Zend_Auth session container, you might include the role in the
identity information. You can then add this to the ACL as you grab it:

$acl->addRole($identity->role);

You could also define an array of roles, and then one master role for
the user (which would indicate the user inherits all of those roles):

foreach ($identity->roles as $role) {
$acl->addRole($role);
}
$acl->addRole($identity->username, $identity->roles);

Later, when you grab your page, you might also include ACL information
in the page metadata. This allows you to setup the resource and
permissions ad-hoc. As an example, let's assume that a "page" object
might have the following in its structure:

public $identifier;
public $roles = array(
array('role' => array('read', 'write'))
);

$acl->addResource($page->identifier);
foreach ($page->roles as $role => $rights) {
if (!$acl->hasRole($role)) {
$acl->addRole($role);
}
$acl->allow($role, $page->identifier, $rights);
}

Then, you can test right there and then:

if (!$acl->isAllowed($identity->role, $page->identifier, $currentPrivilege))

{
throw new AclException;
}

This allows you some flexibility -- you don't have to define all ACLs up
front, and can grow the graph as your content grows. That said, it can
get tricky if you want to introduce role inheritance, so you have to
setup a strict convention of how the roles are stored.

Hope that helps get you started!

> The gist of my understanding is:
> - In the AdminController (or is it bootstrap.php) I have to define a set of
> Roles and Resources that are accessed/denied for those roles. This follows the


> above tutorial example. In my case, I need to add a new user role called "staff
>
>
> user" who will just have access to one function in the CMS, a basic "customer
> lookup" reporting function.
>
> - However I also need to check (in the "customer lookup" function) if the
> logged-in user has access rights to view this page. In all other pages, I need


> to DENY access rights actually, if the logged in user is a "staff user". Is
> there a tutorial like this which explains it for newbies? Or could someone
>guide
>
> me on what kind of code goes where?
>
> I'm not sure how I can tell ZF the name of the resource of each
>section/function
>
> of the CMS. For example, if I have a section called "Reports", and functions
> called
> - "Customer Lookup"
> - "Orders report"
> - "Members report"
>
> then what code would I put in for each of the above controller functions to
> assign a resource name and possibly a module/sub-resource name to each
>function?
>
> Many thanks,
> Rishi
>
>
>

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

Re: [fw-server] How to move app fron Zend Server CE to another LAMP?

Hi is Zend folder within library folder on the Ubuntu server?

On 03/06/2011 05:20 PM, Mr.Kilmister wrote:
> Hi Zenders!
>
> I've just finished my first application. I wrote it on a Kubuntu with
> installed Zend Server CE. I have a second server, Ubuntu, where the
> application must be ultimately found. This Ubuntu is a pure, clean LAMP,
> Zend was never there.
>
> I copied /usr/local/Zend/share/ZendFramework/library/* to the application
> directory.
> Then I threw the entire application directory into /var/www on Ubuntu.
>
> I hope Ubuntu see Zend library...:
>
> print_r(inlude_path):
>
> /var/www/[my-app]/application/../library:/var/www/[my-app]/library:./usr/share/php:/usr/
> share/pear
>
> but nothing work:
>
> "An error occurred
> Application error"
>
> What's wrong?
> Could you help me, please?
>
> --
> View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-to-move-app-fron-Zend-Server-CE-to-another-LAMP-tp3337679p3337679.html
> Sent from the Zend Server mailing list archive at Nabble.com.
>
>

2011年3月6日星期日

[fw-mvc] Re: troubles with custom view-scripts location and noViewRender=true by default

The way I usually handle this:
- I register a Layout Plugin, extending Zend_Layout_Controller_Plugin_Layout
- I use the preDispatch hook to determine what module, controller, action I
am in
- I switch between layouts and views depending on the context

For me, that's by far the easiest method.
GJ


Xerkus wrote:
>
> May be this can be useful to you:
> http://stackoverflow.com/q/5210475/605093
>
> I need to test this idea in real application though.
>


--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/troubles-with-custom-view-scripts-location-and-noViewRender-true-by-default-tp3335661p3337702.html
Sent from the Zend MVC mailing list archive at Nabble.com.

[fw-server] How to move app fron Zend Server CE to another LAMP?

Hi Zenders!

I've just finished my first application. I wrote it on a Kubuntu with
installed Zend Server CE. I have a second server, Ubuntu, where the
application must be ultimately found. This Ubuntu is a pure, clean LAMP,
Zend was never there.

I copied /usr/local/Zend/share/ZendFramework/library/* to the application
directory.
Then I threw the entire application directory into /var/www on Ubuntu.

I hope Ubuntu see Zend library...:

print_r(inlude_path):

/var/www/[my-app]/application/../library:/var/www/[my-app]/library:./usr/share/php:/usr/
share/pear

but nothing work:

"An error occurred
Application error"

What's wrong?
Could you help me, please?

--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-to-move-app-fron-Zend-Server-CE-to-another-LAMP-tp3337679p3337679.html
Sent from the Zend Server mailing list archive at Nabble.com.

[fw-mvc] Re: troubles with custom view-scripts location and noViewRender=true by default

May be this can be useful to you:
http://stackoverflow.com/q/5210475/605093

I need to test this idea in real application though.

--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/troubles-with-custom-view-scripts-location-and-noViewRender-true-by-default-tp3335661p3337615.html
Sent from the Zend MVC mailing list archive at Nabble.com.

2011年3月5日星期六

Re: [fw-mvc] Re: troubles with custom view-scripts location and noViewRender=true by default

On Sat, Mar 5, 2011 at 2:11 AM, jonnott <jonnott@gmail.com> wrote:

> Is there another way to state this setting globally without using an
> INI file? The problem is that I need to generate this path *dynamically*, as
> the ZF entry-point is within a shared codebase.


Yes, you can bootstrap your view instance and then pull it from the
bootstrap to modify it. This ensures that you are accessing and modifying
the same view instance throughout your application.

To make sure your view is bootstrapped, add at least one configuration
option to application.ini. If you want to use all the defaults, then pass in
an empty config:

# application/configs/application.ini
; Bootstraps the view with default values
resources.view[] =

Then, you can pull the view from the bootstrap from within an action
controller like this:

# application/controllers/IndexController.php
public function init()
{
$bootstrap = $this->getInvokeArg('bootstrap');
$view = $bootstrap->getResource('view');
}

>From that point you can then add your custom view script paths:

$view->addScriptPath('path/to/my/view/scripts');

Would this work at the Zend_Controller_Action::preDispatch() level, or
> is that too late? (assuming the above would normally be in the front
> controller plugin routeShutdown() method).


Automatic view script rendering occurs during postDispatch, so swapping
paths in preDispatch or even within your action body should work. In my
example above I used init, which occurs before preDispatch.

My thinking would be to create a base action controller with this in
> preDispatch() which I can subclass for whatever action controllers need this
> logic.


If you find that you need to provide this functionality in more than one
action controller, I suggest using action helpers instead of creating a base
action controller. The problem with base action controllers is that they
tend to get bloated with some functionality for controllers A, B, and C and
other functionality for controllers D, E, and F. Maintaing this can become
problematic and often requires a large ugly switch.

Action helpers allow you to take that bit of functionality and encapsulate
it in its own class, allowing you to use it on-demand from any action
controller.

For more info on action helpers check out the docs:

http://framework.zend.com/manual/en/zend.controller.actionhelpers.html

Will this work just as well with inverted logic/booleans,
> i.e. Zend_Controller_Front->setParam('noViewRenderer')=true; and
> then $viewRenderer->setNoRender(false); in the routeShutdown() or
> action controller preDispatch()


Setting the param "noViewRenderer" to true prevents the front controller
from registering the view renderer helper entirely, but in your case I
believe you want it registered but simply not performing any automatic view
script rendering.

So I would go with my original suggestion of leaving the view renderer there
(because you might need it), disabling automatic view rendering (a property
of the view renderer itself), and then re-enabling it when required.

--
*Hector Virgen*
Sr. Web Developer
http://www.virgentech.com

[fw-mvc] Re: troubles with custom view-scripts location and noViewRender=true by default

Thanks Hector. Couple of further questions..


Hector Virgen wrote:
>
> resources.view.basePath = APPLICATION_PATH "/custom/path/to/views/"
>

Is there another way to state this setting globally without using an INI
file? The problem is that I need to generate this path *dynamically*, as the
ZF entry-point is within a shared codebase.


Hector Virgen wrote:
>
> $viewRenderer =
> Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
> $viewRenderer->setNoRender(true); // disable view rendering
>

Questions on this would be:

- Would this work at the Zend_Controller_Action::preDispatch() level, or is
that too late? (assuming the above would normally be in the front controller
plugin routeShutdown() method). My thinking would be to create a base action
controller with this in preDispatch() which I can subclass for whatever
action controllers need this logic.

- Will this work just as well with inverted logic/booleans, i.e.
Zend_Controller_Front->setParam('noViewRenderer')=true; and then
$viewRenderer->setNoRender(false); in the routeShutdown() or action
controller preDispatch() ??

Jonny

--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/troubles-with-custom-view-scripts-location-and-noViewRender-true-by-default-tp3335661p3336467.html
Sent from the Zend MVC mailing list archive at Nabble.com.

2011年3月4日星期五

[fw-webservices] Zend_Soap_AutoDiscover bug

Hi:

I'm traying to publish a WSDL-based WebService using Zend_Soap_AutoDiscover,
I've made my own class and managed the requests for making all works well
but when I'm trying to use this WS from another PHP application I receive
this error: "SOAP-ERROR: Parsing WSDL: Couldn't load from
'http://localhost/architecture/applications/security/public/ws/Security.php?
wsdl' : Extra content at the end of the document". The most estrange part is
its only happens in Windows platform because I've tested the same code in
Ubuntu Server and works as I expect.

Excuse me for my English.

Regards

Omar

Re: [fw-mvc] troubles with custom view-scripts location and noViewRender=true by default

I would approach this problem differently:

1) Use application.ini to set up your custom view script path

resources.view.basePath = APPLICATION_PATH "/custom/path/to/views/"

2) Use the plugin to disable the view renderer as necessary

$viewRenderer =
Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewRenderer->setNoRender(true); // disable view rendering

Then you can wrap that in your logic to decide whether views should be
rendered.

I hope this helps.

--
*Hector Virgen*
Sr. Web Developer
http://www.virgentech.com

[fw-mvc] troubles with custom view-scripts location and noViewRender=true by default

Been having a nightmare trying to use a completely custom view scripts
location, combined with having noViewRenderer=true by default in
Zend_Controller_Front, but then switching it on for certain action
controllers via a routeShutdown plugin hook.

I'm know the noViewRenderer param gets passed through to the dispatcher,
hence toggling it at the routeShutdown stage. I can test at various other
points below the dispatcher (i.e. in the action controller) that if I've set
noViewRenderer=false, this appears to persist down to the action controller
level.

I want to set a completely custom path to my view scripts, so I can't use
the default view scenario which gets set up by the viewRenderer action
helper, as it seems to test for the presence of a view scripts folder
according to the 'stock' folder structure.

So I tied replacing the initView() method of my action controller thus:

public function initView () {

$this->view = new Zend_View(array('basePath' => APPLICATION_PATH .
'/custom/path/to/views/'));

$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);
$this->_helper->addHelper($viewRenderer); // even slightly on track?!?!

return $this->view;
}

I'm then trying all sorts in my action method to try and get the view
working. I can get the view scripts loaded and rendered no problem. But
whatever I try, the view object that my view script sees somehow doesn't
have any of the vars I've assigned it in the controller - i.e. it looks to
be a different view object altogether..

public function indexAction () {

$this->initView(); // tried both with and without this, in various
permutations
$this->view->myvar = 'hello world';

$this->view->render('somescript'); // tried this, with or without .phtml
// OR
$this->render(); // ..also tried this
}

The direct Zend_Controller_Action::render() version seems to use code within
the viewRenderer helper to work out what view script it should load, and
whether it exists or not. Conversely, the $this->view->render() approach
uses the view object's native methods to do the same. Neither is playing
ball for me it would seem. Things might go wrong within the ::_script()
private method of the Zend_View_Abstract class from my extensive
problem-hunting (stab in the dark) investigations.

Can anyone help?

I basically want to:

- have noViewRenderer=true (M & C, but no V) by default, but for selected
actions/controllers I need to use a view and view scripts
- have completely custom paths to where my view scripts are located in my
bespoke folder structure

...can it be that hard?

Jon

--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/troubles-with-custom-view-scripts-location-and-noViewRender-true-by-default-tp3335661p3335661.html
Sent from the Zend MVC mailing list archive at Nabble.com.

[fw-mvc] Zend/JQuery collapsible fieldset

Hello,
I'm experimenting a weird behaviour of my Zend/Jquery built form,
I have built a complete form with zend, I set up fielset groups and would
like now to make them collapsible with jQuery. I did it already with a
normal html file and because of my lack of skills about zendframework, I
tried to follow the same "spirit" on the zend form.
Basically the problem is that the fieldset always toggles down and not up.
It works when I use the jQuery "hide" function which sets the display
property to "none" but doesn't when it uses a jQuery method playing with the
css in cache.
I know there would probably be a smarter to implement this feature with zend
and you are very welcome if you point it to me :)

but here are the basic codes :

[url=http://www.hiboox.fr/go/images/informatique/untitled,0f51c660ec65f7fb5e87f5863695c0e5.jpg.html][img]http://free0.hiboox.com/images/0911/0f51c660ec65f7fb5e87f5863695c0e5.jpg[/img][/url]

the layout :

[code]
<?php echo $this->headMeta(); ?>
<?php echo $this->headTitle(); ?>
<?php echo
$this->headLink()->prependStylesheet($this->baseUrl().'/css/site.css'); ?>
<?php echo
$this->headLink()->prependStylesheet($this->baseUrl().'/css/jquery.fancybox-1.3.4.css');
?>
<?php $this->jQuery()->enable();
echo $this->jQuery();?>
<?php echo
$this->headScript()->appendFile($this->baseUrl().'/scripts/jquery.fancybox-1.3.4.pack.js')?>
<?php echo
$this->headScript()->appendFile($this->baseUrl().'/scripts/collapsible.js')?>



<?php echo $this->escape($this->title); ?>

<?php echo $this->layout()->content; ?>

[/code]

the function :
[code]$.fn.collapsible = function ()
{

//toggle the component with class msg_body
$("#msg_head").click(function()
{
//var arrow = this.getElementsByTagName("img");
if ($(this).hasClass('msg_head_collapsed')){
$(this).removeClass('msg_head_collapsed').addClass('msg_head');
//arrow[0].src = "images/arrow_down.png";

}
else if ($(this).hasClass('msg_head')){
$(this).removeClass('msg_head').addClass('msg_head_collapsed');
//arrow[0].src = "images/arrow_right.png";

}


$(this).next(".msg_body").slideToggle('slow');



});................[/code]

the form : [code]<?php

class Application_Form_Testform extends Zend_Form
{

public function init()
{
$countryList=array('USA','UK');
$firstName = $this->createElement('text', 'firstName');
$firstName->setLabel('First Name')
->setAttrib('size',25)
->addValidator('StringLength', false,array(3,50))
->setValue('')
->setRequired(true);

$lastName = $this->createElement('text', 'lastName');
$lastName->setLabel('Last Name:')
->setAttrib('size', 25)
->addValidator('StringLength', false,array(3,50))
->setValue('')
->setRequired(true);




[....]

$this->addElements( array (

$firstName,
$lastName,
$address1,
$address2,
$postalCode,
$city,
$state,
$country,
$phone,
$emailAddress,
$website,
$userName,
$password,
$confirmPassword
)
);

$this->addDisplayGroup(array(

'firstName',
'lastName',
'userName',
'address1',
'address2',
'postalCode',
'city',
'state',
'country',
'phone'

),'contact');

$contact = $this->getDisplayGroup('contact');
/*$contact->setDecorators(array(

'FormElements',
'Fieldset',
array('HtmlTag',array('tag'=>'div','class'=>'msg_body'))

));*/

$contact->addDecorator('Fieldset');
$contact->setLegend('zoby zoba')->setAttrib('id', 'zob');

[/code]

thank you very much for the help...
Alex

--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-JQuery-collapsible-fieldset-tp3335099p3335099.html
Sent from the Zend MVC mailing list archive at Nabble.com.

2011年3月2日星期三

Re: [fw-mvc] Zend framework ACL - newbie help needed

Hi Matthew,

Thanks veyr much for your reply. I have a few questions, and we are having
trouble setting it up so I'll write that here as well:

Regarding $identity in your example - this is using Zend Auth as you said. For
now, I don't want to go into Zend Auth until I understand how to perform a
simple task on Zend Acl ;) Your examples have used $identity but if you think it
does simplify it please let me know, otherwise for now I am trying it without
the user of Zend Auth, as we are simply logging in the user with their username
+ user group ID (1, 2, or 3).
Further details:

* I was able to make the Zend_Acl object

But below parts are still unclear to me.
* Add roles to the Zend_Acl object
* Add resources to the Zend_Acl object
How can I match these roles with the currently existing users in my database?
For example I have following groups in my database.

1 Administrator
2 Regional Administrator
3 Content Manager

Basically, the above groups are "roles" . Administrator will have all privileges
in my CMS.

* Add resources to the Zend_Acl object
This is also not entirely clear to me. Should these be in the controller?
Eg-
http://framework.zend.com/wiki/pages/viewpage.action?pageId=39025#Zend_Acl%26MVCIntegration-AldemarBernal-4.DependenciesonOtherFrameworkComponents

$acl->add(new Zend_Acl_Resource('news')) (is "news" a controller? In where are
we defining the behavior of the $acl->add()? Is this inbuilt?)

Below is the the code I'm currently using. In the bootstrap.php :

Helper - library/My/Controller/Helper/
Plugin - library/My/Controller/Plugin/

/** Creating the ACL object */
require_once 'Zend/Acl.php';
$acl = new Zend_Acl();

/** Creating the Role object */
require_once 'Zend/Acl/Role.php';
$acl->addRole(new Zend_Acl_Role('staff'));
$acl->addRole(new Zend_Acl_Role('member'));


/**
* Creating resources:
* - News Controller
* Creating privileges:
* - Allow defaultRole to access news controller
* - Deny defaultRole to access add action of news controller
*/
require_once 'Zend/Acl/Resource.php';
$acl->add(new Zend_Acl_Resource('admin'))
->allow('staff', 'admin')
->deny('staff', 'admin', 'reports');


/** Registering the Plugin object */
//require_once 'Zend/Controller/Plugin/Acl.php';
//$front->registerPlugin(new Zend_Controller_Plugin_Acl($acl));


/* OK, do your stuff, front controller */
$frontController->dispatch();


I realise I need to go through the above again, but I'd like to post out a few
questions:

i) Are "plugin" files required? The link above mentions that we should upload a
certain ACL plugin + helper. Other tutorials mention this too. Is this correct?

ii) Because my boot strap has routes for the CMS ("AdminController") and front
end ("IndexController"), can I only define roles and resources within my CMS /
AdminController? Or must this kind of code be in the bootstrap.php file?

iii) I understand the concept - that a 'resource' (say, the reporting module in
the CMS) needs to be defined. A bunch of 'roles' also would be defined, i.e.
user groups ("AdministratorRole" would get all rights, and "ContentManagerRole"
would get a few rights).
Then, when I am actually at the controller action for my 'reporting module' for
example, what code do I put in to tell ZF that "we are in the reporting module
resource, so check the logged in user's rights and grant access if permitted"?

Many thanks,
Rishi


________________________________
From: Matthew Weier O'Phinney <matthew@zend.com>
To: fw-mvc@lists.zend.com
Sent: Mon, February 28, 2011 10:07:18 PM
Subject: Re: [fw-mvc] Zend framework ACL - newbie help needed

-- Rishi Daryanani <rishijd@yahoo.com> wrote
(on Monday, 28 February 2011, 06:06 AM -0800):
> I'm very new to ACL and it's not something we've tried below. Any guidance
>would
>
> be appreciated; I'm going to start with code experimentation but would like to

> know if I'm on the right track.
>
>
> We are using a custom developed CMS which is using ZF", and we have our front
> end website as well. The CMS uses a controller called "AdminController", and
>the
>
> front end only uses a controller called "IndexController". I want to introduce

> access control to this CMS. Therefore some user groups will be restricted to
> some areas of the CMS.
>
> Current potential solution :
>
> I'm thinking of achieving this functionality as described below.
>
> 1. Have a database table to store the type of the user.
> 2. Have a separate table to store the pages the user is allowed or not allowed.
>
> 3. Check in each page whether the user have the access or not and display the
> page accordingly.
>
> Which is the best way to implement this using Zend framework? "Zend_Auth" or
> "Zend_Acl" ?

Zend_Auth is used for authentication of a user; i.e., evaluating the
provided credentials to determine identity.

Zend_Acl is used for authorization; i.e., to determine whether a given
user has the rights to access a given resource.

What you describe above is the realm of Zend_Acl.

> I have looked in to the "Zend_Acl" and it sounds good, however
> could someone guide me - what is the procedure for implementing this? Here are

> the links I found:
> http://framework.zend.com/manual/en/zend.acl.introduction.html
> http://framework.zend.com/wiki/pages/viewpage.action?pageId=39025

The basic workflow is:

* Create a Zend_Acl object
* Add roles to the Zend_Acl object
* Add resources to the Zend_Acl object
* Create the permissions

Now, that said, there are a variety of ways to do this. You can do it
up-front -- i.e., define all roles, resources, and permissions in a
given object or in your bootstrap. If you have only a handful of ACLs to
create, this is a straight-forward approach.

Another approach is to add them as you need them.

As an example, when you grab the user identity during login or later
from the Zend_Auth session container, you might include the role in the
identity information. You can then add this to the ACL as you grab it:

$acl->addRole($identity->role);

You could also define an array of roles, and then one master role for
the user (which would indicate the user inherits all of those roles):

foreach ($identity->roles as $role) {
$acl->addRole($role);
}
$acl->addRole($identity->username, $identity->roles);

Later, when you grab your page, you might also include ACL information
in the page metadata. This allows you to setup the resource and
permissions ad-hoc. As an example, let's assume that a "page" object
might have the following in its structure:

public $identifier;
public $roles = array(
array('role' => array('read', 'write'))
);

$acl->addResource($page->identifier);
foreach ($page->roles as $role => $rights) {
if (!$acl->hasRole($role)) {
$acl->addRole($role);
}
$acl->allow($role, $page->identifier, $rights);
}

Then, you can test right there and then:

if (!$acl->isAllowed($identity->role, $page->identifier, $currentPrivilege))
{
throw new AclException;
}

This allows you some flexibility -- you don't have to define all ACLs up
front, and can grow the graph as your content grows. That said, it can
get tricky if you want to introduce role inheritance, so you have to
setup a strict convention of how the roles are stored.

Hope that helps get you started!

> The gist of my understanding is:
> - In the AdminController (or is it bootstrap.php) I have to define a set of
> Roles and Resources that are accessed/denied for those roles. This follows the

> above tutorial example. In my case, I need to add a new user role called "staff
>
> user" who will just have access to one function in the CMS, a basic "customer
> lookup" reporting function.
>
> - However I also need to check (in the "customer lookup" function) if the
> logged-in user has access rights to view this page. In all other pages, I need

> to DENY access rights actually, if the logged in user is a "staff user". Is
> there a tutorial like this which explains it for newbies? Or could someone
>guide
>
> me on what kind of code goes where?
>
> I'm not sure how I can tell ZF the name of the resource of each
>section/function
>
> of the CMS. For example, if I have a section called "Reports", and functions
> called
> - "Customer Lookup"
> - "Orders report"
> - "Members report"
>
> then what code would I put in for each of the above controller functions to
> assign a resource name and possibly a module/sub-resource name to each
>function?
>
> Many thanks,
> Rishi
>
>
>

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

[fw-server] Zend_Soap client and SoapServer UTF-8 encoding problem

Hello and thank in advance
I have a website and The site works on one server and DB on the other
server. When I enter on site text to submit to DB on non english letters, it
saves and ther render corect. For example if I enter "Привет Всем" I will
see the same text on the site when display.

All MySQL collation as table as fields are utf8_general_ci Meta
content-encoding on the page also utf-8 as on site as on phpMyAdmin

Although if I access DB with phpMyAdmin I see КонÑтнатин ПаРIf I
change it to Привет Всем then on the site I see ???????? ????

It was not working like this on our local test on 2 different servers with
Windows on them. But after deploy to centOS online server it bacome work
like this.

Looks like it double encode text to UTF-8. I cannot find where is it.

Zend_Soap_Client:: or SoapServer:: or MySQL encoding.

I rejected idea of Mysql because I though that if it is MySQl then it saves
wrong, and then when it extraxts it should send wrong data.

kindest regards

--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-Soap-client-and-SoapServer-UTF-8-encoding-problem-tp3331415p3331415.html
Sent from the Zend Server mailing list archive at Nabble.com.