[fw-general] [Fwd: [Zend_Mail] Iterating into a RCF822 message part]
I had sent this message to zend-core, but it didn't seem to get much attention there (the list seems fairly quiet). --- Begin Message --- I'm finding the RecursiveIteratorIterator very hand for looping through a message, however it won't seem to go into a multipart rcf822 for me. If I echo out my part, then it will show all parts of the message, but countParts shows 0 and the iterator won't go further into it. Is there any elegant way to handle a rcf822 message part in Zend_Mail? --- End Message ---
Re: [fw-general] Header confusion
I have indeed tried clearHeaders(), that was the first thing that came to my mind as well. The thing is, if I change the Zend_Controller_Response_Abstract's sendHeaders method to: foreach ($this->_headers as $header) { if (!$httpCodeSent && $this->_httpResponseCode) { header($header['name'] . ': ' . $header['value'],true, $this->_httpResponseCode); $httpCodeSent = true; } else { header($header['name'] . ': ' . $header['value'], true); } } it works just fine. I was merely wondering what the reasoning behind NOT setting replace = true in it. MF Sebastian Krebs wrote: Hi Maybe you use /clearHeaders()/, but its possible (i dont know), that this are headers implicit set by Apache, PHP, Browser or someone else and not by ZF. Maurice Fonk schrieb: Hi there, I'm trying to set a cache control header for my controller's response like this: public function testAction() { $this->getResponse()->setHeader('Cache-Control', 'max-age=2419200, must-revalidate', true); $this->getResponse()->setBody('test'); } According to firebug, I get the following header back: Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=2419200, must-revalidate And if I don't set the header in the response, I get: Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 As you can see, my header has been ADDED to the original header, but I wanted to replace it. I specified true as the override param in setHeader(), but I guess that only matters for headers set in the response. In Zend_Controller_Response_Abstract's sendHeaders method, there's the following bit of code: foreach ($this->_headers as $header) { if (!$httpCodeSent && $this->_httpResponseCode) { header($header['name'] . ': ' . $header['value'], false, $this->_httpResponseCode); $httpCodeSent = true; } else { header($header['name'] . ': ' . $header['value'], false); } } as you can see it uses false for replacing headers in php's native header function. This makes it impossible to override some headers by using the response object. I wonder why this is? MF -- Maurice Fonk [EMAIL PROTECTED] http://naneau.nl/ Scio me nihil scire
Re: [fw-general] Header confusion
Hi Maybe you use /clearHeaders()/, but its possible (i dont know), that this are headers implicit set by Apache, PHP, Browser or someone else and not by ZF. Maurice Fonk schrieb: Hi there, I'm trying to set a cache control header for my controller's response like this: public function testAction() { $this->getResponse()->setHeader('Cache-Control', 'max-age=2419200, must-revalidate', true); $this->getResponse()->setBody('test'); } According to firebug, I get the following header back: Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=2419200, must-revalidate And if I don't set the header in the response, I get: Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 As you can see, my header has been ADDED to the original header, but I wanted to replace it. I specified true as the override param in setHeader(), but I guess that only matters for headers set in the response. In Zend_Controller_Response_Abstract's sendHeaders method, there's the following bit of code: foreach ($this->_headers as $header) { if (!$httpCodeSent && $this->_httpResponseCode) { header($header['name'] . ': ' . $header['value'], false, $this->_httpResponseCode); $httpCodeSent = true; } else { header($header['name'] . ': ' . $header['value'], false); } } as you can see it uses false for replacing headers in php's native header function. This makes it impossible to override some headers by using the response object. I wonder why this is? MF
Re: [fw-general] newbie acl/auth question
First i have created resources with Zend_Acl_Resource as a "string-container" $res = new Zend_Acl_Resource ($request-> getControllerName ()); Now Ive implemted the Interface in my abstract Controller // in Controller $acl->add ($this); It depends on what you want to protect, what you let implements that interface, or even if you use Zend_Acl_Resource. But in my oppinion its more comfortable to let the object decide, which id he should have. And so youre able to do some kind of this in an abstract controller $acl->allow ($role, $this, 'read'); $acl->isAllowed ($role, $this, 'read'); Was that youre question? Oo Se.Krebs Hoopes schrieb: Hey, Apologies if this has been answered elsewhere, but i've searched the list and googled and am still somewhat confused. I guess my disconnect is the ids/names for roles and resources. I've followed Rob Allen's tutorials to get started, and have authentication working. My users in the database have a role field in the database, which is stored in the instance of Zend_Auth after I do authenticate(), and then: // success: store database row to auth's storage system. (Not the password though!) $data = $authAdapter->getResultRowObject(null, 'password'); $auth->getStorage()->write($data); So, I have all this user data for the logged in user. I can get the role of the logged in user by : $auth = Zend_Auth::getInstance(); $role = $auth->getStorage()->read()->role; // say this is "guest" Then I can call $acl = new Zend_Acl(); Here is where I kinda get confused. $acl->addRole(new Zend_Acl_Role($role)); But where do i get resources? Do I implement Zend_Acl_Resource_Interface in the model objects? Would it be in the index controller? I'm just playing around, so built on the (incredible) tutorials from Rob Allen, how would I prevent my guest user from deleting albums (if you've read those...)? Would the ACL rules be created and held in some central location? Thanks in advance for any advice, I'm just trying to wrap my head around this stuff :) - hoopes
Re: [fw-general] newbie acl/auth question
First i have created resources with Zend_Acl_Resource as a "string-container" $res = new Zend_Acl_Resource ($request-> getControllerName ()); Now Ive implemted the Interface in my abstract Controller // in Controller $acl->add ($this); It depends on what you want to protect, what you let implements that interface, or even if you use Zend_Acl_Resource. But in my oppinion its more comfortable to let the object decide, which id he should have. And so youre able to do some kind of this in an abstract controller $acl->allow ($role, $this, 'read'); $acl->isAllowed ($role, $this, 'read'); Was that youre question? Oo Se.Krebs Hoopes schrieb: Hey, Apologies if this has been answered elsewhere, but i've searched the list and googled and am still somewhat confused. I guess my disconnect is the ids/names for roles and resources. I've followed Rob Allen's tutorials to get started, and have authentication working. My users in the database have a role field in the database, which is stored in the instance of Zend_Auth after I do authenticate(), and then: // success: store database row to auth's storage system. (Not the password though!) $data = $authAdapter->getResultRowObject(null, 'password'); $auth->getStorage()->write($data); So, I have all this user data for the logged in user. I can get the role of the logged in user by : $auth = Zend_Auth::getInstance(); $role = $auth->getStorage()->read()->role; // say this is "guest" Then I can call $acl = new Zend_Acl(); Here is where I kinda get confused. $acl->addRole(new Zend_Acl_Role($role)); But where do i get resources? Do I implement Zend_Acl_Resource_Interface in the model objects? Would it be in the index controller? I'm just playing around, so built on the (incredible) tutorials from Rob Allen, how would I prevent my guest user from deleting albums (if you've read those...)? Would the ACL rules be created and held in some central location? Thanks in advance for any advice, I'm just trying to wrap my head around this stuff :) - hoopes
[fw-general] Header confusion
Hi there, I'm trying to set a cache control header for my controller's response like this: public function testAction() { $this->getResponse()->setHeader('Cache-Control', 'max-age=2419200, must-revalidate', true); $this->getResponse()->setBody('test'); } According to firebug, I get the following header back: Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=2419200, must-revalidate And if I don't set the header in the response, I get: Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 As you can see, my header has been ADDED to the original header, but I wanted to replace it. I specified true as the override param in setHeader(), but I guess that only matters for headers set in the response. In Zend_Controller_Response_Abstract's sendHeaders method, there's the following bit of code: foreach ($this->_headers as $header) { if (!$httpCodeSent && $this->_httpResponseCode) { header($header['name'] . ': ' . $header['value'], false, $this->_httpResponseCode); $httpCodeSent = true; } else { header($header['name'] . ': ' . $header['value'], false); } } as you can see it uses false for replacing headers in php's native header function. This makes it impossible to override some headers by using the response object. I wonder why this is? MF -- Maurice Fonk [EMAIL PROTECTED] http://naneau.nl/ Scio me nihil scire
[fw-general] newbie acl/auth question
Hey, Apologies if this has been answered elsewhere, but i've searched the list and googled and am still somewhat confused. I guess my disconnect is the ids/names for roles and resources. I've followed Rob Allen's tutorials to get started, and have authentication working. My users in the database have a role field in the database, which is stored in the instance of Zend_Auth after I do authenticate(), and then: // success: store database row to auth's storage system. (Not the password though!) $data = $authAdapter->getResultRowObject(null, 'password'); $auth->getStorage()->write($data); So, I have all this user data for the logged in user. I can get the role of the logged in user by : $auth = Zend_Auth::getInstance(); $role = $auth->getStorage()->read()->role; // say this is "guest" Then I can call $acl = new Zend_Acl(); Here is where I kinda get confused. $acl->addRole(new Zend_Acl_Role($role)); But where do i get resources? Do I implement Zend_Acl_Resource_Interface in the model objects? Would it be in the index controller? I'm just playing around, so built on the (incredible) tutorials from Rob Allen, how would I prevent my guest user from deleting albums (if you've read those...)? Would the ACL rules be created and held in some central location? Thanks in advance for any advice, I'm just trying to wrap my head around this stuff :) - hoopes
Re: [fw-general] .js module routes
Maurice Fonk wrote: new Zend_Controller_Router_Route('js/:file', array( 'module' => 'jscsscompressor', 'controller' => 'index', 'action' => 'compress') ) which works fine, as long as the javascript file I'm trying to request isn't in a subdirectory of the js directory. If that is the case, I get: If you add a slash it's like you would be adding another part to the URL, so your route won't match that. Use Regex Route for your purpose: new Zend_Controller_Router_Route_Regex('js/(.+)', array( 'module' => 'jscsscompressor', 'controller' => 'index', 'action' => 'compress') ), array( 1 => 'file' ), 'js/%s' ); -- Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | http://aie.pl/martel.asc =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= "In a mad world only the mad are sane." -- Akira Kurosawa
Re: [fw-general] Zend_Memory Problems
Hi there It's quite hard to guess what's wrong without some piece of your code. Please send some. Regards 2007/5/6, Piotr Sadowski <[EMAIL PROTECTED]>: Hello! Does anybody Has been using Zend_Memory Component. It seems it doesn't work on my machine (Windows). I didn't check what would be happen on UNIX machine. But my problem is that - I use File Backend and any file in cacheDir Has not been created !! So any data cannot be swapped form memory to File and vice versa. Please help me, I would be very gratefull Regards, Piotr Sadowski -- Pozdrawiam Bartosz Maciaszek
[fw-general] .js module routes
Hello, As a little project I want to write a Javascript/CSS compressor for use with the zend framework. I intend to build it as a module, so it can be easily used in different projects as well. Thing is, I'm having a spot of trouble with the routing process. I have modified my .htaccess to send requests ending in .js and .css to my index.php bootstrap. All the javascript files are in the same subdirectory of the webroot (js/), so I should be able to filter the request on that. I tried adding a route like so: $router->addRoute( 'javascript', //name of the route new Zend_Controller_Router_Route('js/:file', //all javascript is served from the js directory array( 'module' => 'jscsscompressor', 'controller' => 'index', 'action' => 'compress') ) //jscsscompressor/index/__call ); which works fine, as long as the javascript file I'm trying to request isn't in a subdirectory of the js directory. If that is the case, I get: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (js)' Am I doing this the right way? If I remove the :file bit I get the same error even without subdirectories. -- Maurice Fonk [EMAIL PROTECTED] http://naneau.nl/ Scio me nihil scire
[fw-general] Zend_Memory Problems
Hello! Does anybody Has been using Zend_Memory Component. It seems it doesn't work on my machine (Windows). I didn't check what would be happen on UNIX machine. But my problem is that - I use File Backend and any file in cacheDir Has not been created !! So any data cannot be swapped form memory to File and vice versa. Please help me, I would be very gratefull Regards, Piotr Sadowski
Re: [fw-general] Wiki manual updated - request for XSLT help
On 5/6/07, Martel Valgoerad <[EMAIL PROTECTED]> wrote: Or, if it does not work as you would expect it to, then you may try to use functions like normalize-space(string) or replace(string1,string2,string3). Replace looks as a worst solution but it may be the one that actually works. New lines are and (being chr(13) and chr(10) or carriage return and a line feed). What you want is for each element you want to "translate", you use the translate() function, as such ; Alex -- --- Project Wrangler, SOA, Information Alchymist, UX, RESTafarian, Topic Maps -- http://shelter.nu/blog/
Re: [fw-general] Wiki manual updated - request for XSLT help
Andries Seutens wrote: Hey Martel, Thanks a lot, this works really nice! A lot better than a mix of regular expressions and XSLT :)! No problem. Glad I could help. The tricky part is that this "space stripping" shouldnt be done in all nodes. Okay, I don't have time on me to test this today but first thing I would try is to use strip-space or preserve-space elements (whichever is more comfortable for you): http://www.w3schools.com/xsl/el_preserve-space.asp Or, if it does not work as you would expect it to, then you may try to use functions like normalize-space(string) or replace(string1,string2,string3). Replace looks as a worst solution but it may be the one that actually works. New lines are and (being chr(13) and chr(10) or carriage return and a line feed). http://www.w3schools.com/xpath/xpath_functions.asp#string Andriesss -- Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | http://aie.pl/martel.asc =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= "Idleness is not doing nothing. Idleness is being free to do anything." -- Floyd Dell
Re: [fw-general] Routes missing parameters
Andrew Yager wrote: If I have a route with the path /foo/:var1/:var2 - the only time it will be matched is when a URL is received in the form '/foo/bar/lah'. I can set a 'default' value for :var1 and :var2 when creating the route, so I would like to be able to request the URL '/foo' and have :var1 and :var2 automatically set from the default values. Is this possible? Yes, as Sebastian already mentioned, you can set the defaults and they will work just like you would like them too. Read the manual. Problem No 2: I have occasion to want to be able to call /foo/:var1 where var1 is an arbitary string containing text and the '/' character - e.g. /foo/ lah/de/dah and have it match, and then the controller break :var1 up. Is this possible? I haven't been able to get it to match again. One solution (again Sebastian's) is to urlencode a slash and it will be decoded automatically by the router. The other is to use a different type of route for this one problem - eg. a Zend_Controller_Router_Route_Regex. Remember you can mix and match different kind of routes. Andrew -- Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | http://aie.pl/martel.asc =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= "Idleness is not doing nothing. Idleness is being free to do anything." -- Floyd Dell